[clang] [llvm] [Clang][SYCL] Define Intel IGCA preprocessor macro definitions for SYCL during device compilation (PR #227877)
Tom Honermann via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 8 12:32:06 PST 2026
================
@@ -1510,6 +1512,20 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
// SYCL device compiler which doesn't produce host binary.
if (LangOpts.SYCLIsDevice) {
Builder.defineMacro("__SYCL_DEVICE_ONLY__", "1");
+ if (OffloadArch Arch = TI.getOffloadArch(); Arch.isIntelIGCA()) {
+ llvm::IntelGPU::IGCATarget IGCA = Arch.igcaTarget();
+
+ Builder.defineMacro("__OFFLOAD_ARCH_IGCA__", Twine(IGCA.getTarget()));
+ if (IGCA.isAnyCompute())
+ Builder.defineMacro("__OFFLOAD_ARCH_IGCA_COMPUTE__");
+ else if (IGCA.isAnyRender())
+ Builder.defineMacro("__OFFLOAD_ARCH_IGCA_RENDER__");
+
+ if (IGCA.isComputeExact())
+ Builder.defineMacro("__OFFLOAD_ARCH_IGCA_COMPUTE_EXACT__");
+ else if (IGCA.isRenderExact())
+ Builder.defineMacro("__OFFLOAD_ARCH_IGCA_RENDER_EXACT__");
----------------
tahonermann wrote:
Remove both cases of `else`. Though there are no current processors that provide both compute and render capabilities, future processors might.
https://github.com/llvm/llvm-project/pull/227877
More information about the cfe-commits
mailing list