Skip to content

Commit d0a396b

Browse files
author
Ivan Karachun
committed
[SYCL] Aligned set_arg behaviour with SYCL specification
According to SYCL 1.2.1 specification, rev. 7, paragraph 4.8.5: template <typename T> void set_arg(int argIndex, T &&arg) ... The argument can be either a SYCL accessor, a SYCL sampler or a trivially copyable and standard-layout C++ type. Signed-off-by: Ivan Karachun <[email protected]>
1 parent b2da2c8 commit d0a396b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sycl/include/CL/sycl/handler.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,11 @@ class __SYCL_EXPORT handler {
386386
static_cast<int>(AccessTarget), ArgIndex);
387387
}
388388

389-
template <typename T> void setArgHelper(int ArgIndex, T &&Arg) {
389+
template <typename T>
390+
typename std::enable_if<std::is_trivially_copyable<T>::value &&
391+
std::is_standard_layout<T>::value,
392+
void>::type
393+
setArgHelper(int ArgIndex, T &&Arg) {
390394
void *StoredArg = (void *)storePlainArg(Arg);
391395

392396
if (!std::is_same<cl_mem, T>::value && std::is_pointer<T>::value) {

0 commit comments

Comments
 (0)