From c7b21f809fcd6d9886ef7842ddee070c2caabb2f Mon Sep 17 00:00:00 2001 From: Victor Lomuller Date: Fri, 27 Jun 2025 16:47:17 +0100 Subject: [PATCH] [SYCL][SPIRV] Use upstream declaration of builtins Upstream started to use SPIR-V builtins and rather than pushing for the adoption of our Sema hacks (with the limitations), we now started to provide them as part of a specific headers. The patch removes GenericCastToPtrExplicit from the SPIRVBuiltins.td and use __clang_spirv_builtins.h instead. --- clang/lib/Sema/SPIRVBuiltins.td | 13 ------------- sycl/include/sycl/detail/address_space_cast.hpp | 4 ++++ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/clang/lib/Sema/SPIRVBuiltins.td b/clang/lib/Sema/SPIRVBuiltins.td index e226e3b223e17..d7c158e499d15 100644 --- a/clang/lib/Sema/SPIRVBuiltins.td +++ b/clang/lib/Sema/SPIRVBuiltins.td @@ -849,19 +849,6 @@ foreach InType = TLUnsignedInts.List in { } } -foreach AS = [GlobalAS, LocalAS, PrivateAS] in { - def : SPVBuiltin<"GenericCastToPtrExplicit", [PointerType, PointerType], Attr.Const>; -} - -foreach Ty = [Void, ConstType] in { - def : SPVBuiltin<"GenericCastToPtrExplicit_ToGlobal", [PointerType, PointerType, Int], Attr.Const>; - def : SPVBuiltin<"GenericCastToPtrExplicit_ToLocal", [PointerType, PointerType, Int], Attr.Const>; - def : SPVBuiltin<"GenericCastToPtrExplicit_ToPrivate", [PointerType, PointerType, Int], Attr.Const>; - def : SPVBuiltin<"GenericCastToPtr_ToGlobal", [PointerType, PointerType, Int], Attr.Const>; - def : SPVBuiltin<"GenericCastToPtr_ToLocal", [PointerType, PointerType, Int], Attr.Const>; - def : SPVBuiltin<"GenericCastToPtr_ToPrivate", [PointerType, PointerType, Int], Attr.Const>; -} - foreach Type = TLFloat.List in { foreach v = [2, 3, 4, 8, 16] in { def : SPVBuiltin<"VectorTimesScalar", [VectorType, VectorType, Type], Attr.Const>; diff --git a/sycl/include/sycl/detail/address_space_cast.hpp b/sycl/include/sycl/detail/address_space_cast.hpp index 3d878631900fd..672e59113ebc7 100644 --- a/sycl/include/sycl/detail/address_space_cast.hpp +++ b/sycl/include/sycl/detail/address_space_cast.hpp @@ -13,6 +13,10 @@ #include +#ifdef __SYCL_DEVICE_ONLY__ +#include <__clang_spirv_builtins.h> +#endif + namespace sycl { inline namespace _V1 {