Skip to content

Commit 43c6d7a

Browse files
alexeyvoronov-intelvladimirlaz
authored andcommitted
[SYCL] Fix GCC/Clang ABI incompatibility
Resolve a regression after changing SYCL vec class to trivially copyable that introduces ABI incompatibility between SYCL library(compiled by GCC) and SYCL user code(compiled by CLANG) for SYCL builtin functions. This patch resolved it by making SYCL vec class trivially copyable only on the device side(workaround), will be fixed after detailed analysis. Signed-off-by: Vladimir Lazarev <[email protected]> Signed-off-by: Alexey Voronov <[email protected]>
1 parent ad8e079 commit 43c6d7a

File tree

7 files changed

+13
-0
lines changed

7 files changed

+13
-0
lines changed

sycl/include/CL/sycl/types.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,13 @@ template <typename Type, int NumElements> class vec {
350350

351351
vec() { m_Data = {0}; }
352352

353+
// TODO Remove this difference between host and device side after
354+
// when root cause of API incompatibility will be fixed
355+
#ifdef __SYCL_DEVICE_ONLY__
353356
vec(const vec &Rhs) = default;
357+
#else
358+
vec(const vec &Rhs) : m_Data(Rhs.m_Data) {}
359+
#endif
354360

355361
vec(vec &&Rhs) = default;
356362

sycl/test/basic_tests/valid_kernel_args.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ struct SomeStructure {
2929
static_assert(std::is_trivially_copyable<Type>::value, \
3030
"Is not trivially copyable type.");
3131

32+
#ifdef __SYCL_DEVICE_ONLY__
3233
CHECK_PASSING_TO_KERNEL_BY_VALUE(int)
3334
CHECK_PASSING_TO_KERNEL_BY_VALUE(cl::sycl::cl_uchar4)
3435
CHECK_PASSING_TO_KERNEL_BY_VALUE(SomeStructure)
36+
#endif

sycl/test/built-ins/vector_common.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang -std=c++11 -fsycl %s -o %t.out -lstdc++ -lOpenCL -lsycl
2+
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
23
// RUN: %CPU_RUN_PLACEHOLDER %t.out
34
// RUN: %GPU_RUN_PLACEHOLDER %t.out
45
// RUN: %ACC_RUN_PLACEHOLDER %t.out

sycl/test/built-ins/vector_geometric.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang -std=c++11 -fsycl %s -o %t.out -lstdc++ -lOpenCL -lsycl
2+
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
23
// RUN: %CPU_RUN_PLACEHOLDER %t.out
34
// RUN: %GPU_RUN_PLACEHOLDER %t.out
45
// RUN: %ACC_RUN_PLACEHOLDER %t.out

sycl/test/built-ins/vector_integer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang -std=c++11 -fsycl %s -o %t.out -lstdc++ -lOpenCL -lsycl
2+
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
23
// RUN: %CPU_RUN_PLACEHOLDER %t.out
34
// RUN: %GPU_RUN_PLACEHOLDER %t.out
45
// RUN: %ACC_RUN_PLACEHOLDER %t.out

sycl/test/built-ins/vector_math.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang -std=c++11 -fsycl %s -o %t.out -lstdc++ -lOpenCL -lsycl
2+
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
23
// RUN: %CPU_RUN_PLACEHOLDER %t.out
34
// RUN: %GPU_RUN_PLACEHOLDER %t.out
45
// RUN: %ACC_RUN_PLACEHOLDER %t.out

sycl/test/built-ins/vector_relational.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clang -std=c++11 -fsycl %s -o %t.out -lstdc++ -lOpenCL -lsycl
2+
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
23
// RUN: %CPU_RUN_PLACEHOLDER %t.out
34
// RUN: %GPU_RUN_PLACEHOLDER %t.out
45
// RUN: %ACC_RUN_PLACEHOLDER %t.out

0 commit comments

Comments
 (0)