Skip to content

Commit 336cb82

Browse files
sndmitrievv-klochkov
authored andcommitted
[SYCL] Use correct scalar types for vector elements on Windows
Implementation uses wrong types for 64-bit integers on Windows for vector elements because '[unsigned] long' is being used. But on Windows 'long' has 32 bits as opposed to 64 bits on Linux. This patch corrects this problem. Signed-off-by: Sergey Dmitriev <serguei.n.dmitriev@intel.com>
1 parent 45dbbd1 commit 336cb82

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

sycl/include/CL/sycl/types.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1741,7 +1741,7 @@ DECLARE_TYPE_T(half);
17411741
DECLARE_TYPE_T(double);
17421742

17431743
#define GET_CL_TYPE(target, num) __##target##num##_vec_t
1744-
#define GET_SCALAR_CL_TYPE(target) target
1744+
#define GET_SCALAR_CL_TYPE(target) __##target##_t
17451745

17461746
#undef DECLARE_TYPE_T
17471747
#undef DECLARE_LLTYPE_T
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %clangxx %s -o %t.out -lOpenCL -lsycl
2+
// RUN: %t.out
3+
4+
// Test that vector with 'unsigned long long' elements has enough bits to store
5+
// value.
6+
7+
#define SYCL_SIMPLE_SWIZZLES
8+
#include <CL/sycl.hpp>
9+
10+
int main(void) {
11+
unsigned long long ref = 1ull - 2ull;
12+
auto vec = cl::sycl::vec<unsigned long long, 1>(ref);
13+
unsigned long long val = vec.template swizzle<cl::sycl::elem::s0>();
14+
15+
assert(val == ref);
16+
return 0;
17+
}

0 commit comments

Comments
 (0)