Skip to content

Commit 4824d63

Browse files
committed
Revert marray alignment change
Signed-off-by: JackAKirk <[email protected]>
1 parent 9538849 commit 4824d63

File tree

1 file changed

+3
-40
lines changed

1 file changed

+3
-40
lines changed

sycl/include/sycl/marray.hpp

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17,45 +17,11 @@
1717
namespace sycl {
1818
__SYCL_INLINE_VER_NAMESPACE(_V1) {
1919

20-
template <std::size_t N, typename T> constexpr std::size_t vecAlignment() {
21-
static_assert(N > 0, "Invalid number of elements.");
22-
constexpr size_t SizeOfT = sizeof(T);
23-
static_assert(SizeOfT > 0, "Invalid size of T.");
24-
// First find the "previous" vector num elements.
25-
size_t res = N >= 16 ? 16
26-
: N >= 8 ? 8
27-
: N >= 4 ? 4
28-
: N >= 3 ? 3
29-
: N >= 2 ? 2
30-
: 1;
31-
// Then calculate the alignment size in bytes, making sure it's power of 2.
32-
res *= SizeOfT;
33-
res--;
34-
res |= res >> 1;
35-
res |= res >> 2;
36-
res |= res >> 4;
37-
res |= res >> 8;
38-
res |= res >> 16;
39-
res++;
40-
return res;
41-
}
42-
43-
#if defined(_WIN32) || defined(_WIN64)
44-
#define MARRAY_WINDOWS_ALIGN_ATTR \
45-
__declspec(align(vecAlignment<NumElements, Type>()))
46-
#define MARRAY_LINUX_ALIGN_ATTR
47-
#else
48-
#define MARRAY_WINDOWS_ALIGN_ATTR
49-
#define MARRAY_LINUX_ALIGN_ATTR \
50-
__attribute__((aligned(vecAlignment<NumElements, Type>())))
51-
#endif
52-
53-
/// Provides a cross-patform math array class template that works on
20+
/// Provides a cross-platform math array class template that works on
5421
/// SYCL devices as well as in host C++ code.
5522
///
5623
/// \ingroup sycl_api
57-
template <typename Type, std::size_t NumElements>
58-
class MARRAY_WINDOWS_ALIGN_ATTR marray {
24+
template <typename Type, std::size_t NumElements> class marray {
5925
using DataT = Type;
6026

6127
public:
@@ -332,7 +298,7 @@ class MARRAY_WINDOWS_ALIGN_ATTR marray {
332298
}
333299
return Ret;
334300
}
335-
} MARRAY_LINUX_ALIGN_ATTR;
301+
};
336302

337303
#define __SYCL_MAKE_MARRAY_ALIAS(ALIAS, TYPE, N) \
338304
using ALIAS##N = sycl::marray<TYPE, N>;
@@ -370,8 +336,5 @@ __SYCL_MAKE_MARRAY_ALIASES_FOR_MARRAY_LENGTH(16)
370336
#undef __SYCL_MAKE_MARRAY_ALIASES_FOR_SIGNED_AND_UNSIGNED_TYPES
371337
#undef __SYCL_MAKE_MARRAY_ALIASES_FOR_MARRAY_LENGTH
372338

373-
#undef MARRAY_LINUX_ALIGN_ATTR
374-
#undef MARRAY_WINDOWS_ALIGN_ATTR
375-
376339
} // __SYCL_INLINE_VER_NAMESPACE(_V1)
377340
} // namespace sycl

0 commit comments

Comments
 (0)