Skip to content

Commit 24c4df9

Browse files
authored
[SYCL] Use perfect forwarding when calling UR API (#17952)
1 parent b6b25ee commit 24c4df9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sycl/source/detail/adapter.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ class Adapter {
123123
///
124124
/// \sa adapter::checkUrResult
125125
template <UrApiKind UrApiOffset, typename... ArgsT>
126-
ur_result_t call_nocheck(ArgsT... Args) const {
126+
ur_result_t call_nocheck(ArgsT &&...Args) const {
127127
ur_result_t R = UR_RESULT_SUCCESS;
128128
if (!adapterReleased) {
129129
detail::UrFuncInfo<UrApiOffset> UrApiInfo;
130130
auto F = UrApiInfo.getFuncPtr(&UrFuncPtrs);
131-
R = F(Args...);
131+
R = F(std::forward<ArgsT>(Args)...);
132132
}
133133
return R;
134134
}
@@ -137,15 +137,15 @@ class Adapter {
137137
///
138138
/// \throw sycl::runtime_exception if the call was not successful.
139139
template <UrApiKind UrApiOffset, typename... ArgsT>
140-
void call(ArgsT... Args) const {
141-
auto Err = call_nocheck<UrApiOffset>(Args...);
140+
void call(ArgsT &&...Args) const {
141+
auto Err = call_nocheck<UrApiOffset>(std::forward<ArgsT>(Args)...);
142142
checkUrResult(Err);
143143
}
144144

145145
/// \throw sycl::exceptions(errc) if the call was not successful.
146146
template <sycl::errc errc, UrApiKind UrApiOffset, typename... ArgsT>
147-
void call(ArgsT... Args) const {
148-
auto Err = call_nocheck<UrApiOffset>(Args...);
147+
void call(ArgsT &&...Args) const {
148+
auto Err = call_nocheck<UrApiOffset>(std::forward<ArgsT>(Args)...);
149149
checkUrResult<errc>(Err);
150150
}
151151

0 commit comments

Comments
 (0)