From 6ebb6863c2de7ecd0f58a5fd6c378324b20f8bcc Mon Sep 17 00:00:00 2001 From: "Larsen, Steffen" Date: Fri, 14 Nov 2025 03:37:22 -0800 Subject: [PATCH 1/2] [NativeCPU] Avoid using vector_t in NativeCPU This commit avoid the use of the to-be-removed sycl::vec::vector_t in the native-cpu utilities. Signed-off-by: Larsen, Steffen --- libdevice/nativecpu_utils.cpp | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/libdevice/nativecpu_utils.cpp b/libdevice/nativecpu_utils.cpp index 1b040b2d245ff..c4bed38268983 100644 --- a/libdevice/nativecpu_utils.cpp +++ b/libdevice/nativecpu_utils.cpp @@ -95,10 +95,29 @@ DefGenericCastToPtrExpl(ToGlobal, OCL_GLOBAL); DefSubgroupBlockINTEL_vt(Type, v8) namespace ncpu_types { +// Legacy SYCL header vector definitions. +template +using element_type_for_vector_t = typename sycl::detail::map_type< + DataT, +#if (!defined(_HAS_STD_BYTE) || _HAS_STD_BYTE != 0) + std::byte, /*->*/ std::uint8_t, // +#endif + bool, /*->*/ std::uint8_t, // + sycl::half, /*->*/ sycl::detail::half_impl::StorageT, // + sycl::ext::oneapi::bfloat16, /*->*/ uint16_t, // + char, /*->*/ sycl::detail::ConvertToOpenCLType_t, // + DataT, /*->*/ DataT // + >::type; +template +using vector_t = + std::conditional_t, + element_type_for_vector_t __attribute__(( + ext_vector_type(NumElements)))>; + template struct vtypes { - using v2 = typename sycl::vec::vector_t; - using v4 = typename sycl::vec::vector_t; - using v8 = typename sycl::vec::vector_t; + using v2 = vector_t; + using v4 = vector_t; + using v8 = vector_t; }; } // namespace ncpu_types @@ -224,7 +243,7 @@ DefineLogicalGroupOp(bool, bool, i1); } \ \ DEVICE_EXTERNAL Type __spirv_GroupBroadcast( \ - int32_t g, Type v, sycl::vec::vector_t l) noexcept { \ + int32_t g, Type v, ncpu_types::vector_t l) noexcept { \ if (__spv::Scope::Flag::Subgroup == g) \ return __mux_sub_group_broadcast_##Sfx(v, l[0]); \ else \ @@ -232,7 +251,7 @@ DefineLogicalGroupOp(bool, bool, i1); } \ \ DEVICE_EXTERNAL Type __spirv_GroupBroadcast( \ - int32_t g, Type v, sycl::vec::vector_t l) noexcept { \ + int32_t g, Type v, ncpu_types::vector_t l) noexcept { \ if (__spv::Scope::Flag::Subgroup == g) \ return __mux_sub_group_broadcast_##Sfx(v, l[0]); \ else \ @@ -310,8 +329,8 @@ DefShuffleINTEL_All(float, f32, float); DefShuffleINTEL_All(_Float16, f16, _Float16); #define DefineShuffleVec(T, N, Sfx, MuxType) \ - using vt##T##N = sycl::vec::vector_t; \ - using vt##MuxType##N = sycl::vec::vector_t; \ + using vt##T##N = ncpu_types::vector_t; \ + using vt##MuxType##N = ncpu_types::vector_t; \ DefShuffleINTEL_All(vt##T##N, v##N##Sfx, vt##MuxType##N) #define DefineShuffleVec2to16(Type, Sfx, MuxType) \ From 404662fa2dc792e0781debe35ae8aafe34dd9421 Mon Sep 17 00:00:00 2001 From: Steffen Larsen Date: Fri, 14 Nov 2025 12:47:44 +0100 Subject: [PATCH 2/2] Fix formatting --- libdevice/nativecpu_utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libdevice/nativecpu_utils.cpp b/libdevice/nativecpu_utils.cpp index c4bed38268983..c5714dd2d3a21 100644 --- a/libdevice/nativecpu_utils.cpp +++ b/libdevice/nativecpu_utils.cpp @@ -243,7 +243,7 @@ DefineLogicalGroupOp(bool, bool, i1); } \ \ DEVICE_EXTERNAL Type __spirv_GroupBroadcast( \ - int32_t g, Type v, ncpu_types::vector_t l) noexcept { \ + int32_t g, Type v, ncpu_types::vector_t l) noexcept { \ if (__spv::Scope::Flag::Subgroup == g) \ return __mux_sub_group_broadcast_##Sfx(v, l[0]); \ else \ @@ -251,7 +251,7 @@ DefineLogicalGroupOp(bool, bool, i1); } \ \ DEVICE_EXTERNAL Type __spirv_GroupBroadcast( \ - int32_t g, Type v, ncpu_types::vector_t l) noexcept { \ + int32_t g, Type v, ncpu_types::vector_t l) noexcept { \ if (__spv::Scope::Flag::Subgroup == g) \ return __mux_sub_group_broadcast_##Sfx(v, l[0]); \ else \