Skip to content

Commit bab7c33

Browse files
[SYCL][NFC] Fix basic_tests/types.cpp on Windows (#8470)
Recent extension of the test (addition of `-D__NO_EXT_VECTOR_TYPE_ON_HOST__` RUN line) exposed an existing limitation of `vec` class alignment on Windows, which caused the test to fail. This commit conditionally disables the check to avoid the test failure because of this known issue/limitation.
1 parent c51f1a6 commit bab7c33

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

sycl/test/basic_tests/types.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ template <typename T, int N> inline void checkVectorSizeAndAlignment() {
2121
using VectorT = s::vec<T, N>;
2222
constexpr auto RealLength = (N != 3 ? N : 4);
2323
static_assert(sizeof(VectorT) == (sizeof(T) * RealLength), "");
24-
static_assert(alignof(VectorT) == (alignof(T) * RealLength), "");
24+
#if defined(_WIN32) && (_MSC_VER) && \
25+
defined(__NO_EXT_VECTOR_TYPE_ON_HOST__) && !defined(__SYCL_DEVICE_ONLY__)
26+
// See comments around __SYCL_ALIGNED_VAR macro definition in types.hpp
27+
// We can't enforce proper alignment of "huge" vectors (>64 bytes) on Windows
28+
// and the test exposes this limitation.
29+
if constexpr (alignof(T) * RealLength < 64)
30+
#endif
31+
static_assert(alignof(VectorT) == (alignof(T) * RealLength), "");
2532
}
2633

2734
template <typename T> inline void checkVectorsWithN() {

0 commit comments

Comments
 (0)