https://github.com/jhuber6 updated 
https://github.com/llvm/llvm-project/pull/196351

>From 5ddd9aae4df1892fe11bc2c6c6e1ac70c9dff400 Mon Sep 17 00:00:00 2001
From: Joseph Huber <[email protected]>
Date: Thu, 7 May 2026 10:34:42 -0500
Subject: [PATCH 1/3] [libclc] Canonicalize 'clspv' to the
 'spirv-unknown-vulkan' triple

Summary:
The libclc project has clspv support for exporting OpenCL standard
library utilities to Vulkan consumers. This was previously exposed as a
hack into the build system that renamed the triple and relied on macro
defines. Recent changes allowed us to use `vulkan` as an OS for the
spir-V target. This should make the intention more clear and allow the
system to inherit the same triple handling the other targets use.

Tested the build, but I will need @rjodinchr and @alan-baker to verify.
---
 libclc/CMakeLists.txt                         | 82 +++++++++----------
 libclc/README.md                              |  7 +-
 libclc/clc/include/clc/clcfunc.h              |  2 +-
 .../clc/lib/{clspv => vulkan}/CMakeLists.txt  |  2 +-
 .../{clspv => vulkan}/integer/clc_mul_hi.cl   |  4 +-
 .../lib/{clspv => vulkan}/math/clc_sw_fma.cl  |  0
 libclc/cmake/modules/AddLibclc.cmake          |  4 +-
 .../lib/{clspv => vulkan}/CMakeLists.txt      |  6 +-
 .../conversion/convert_float.inc              |  0
 .../conversion/convert_float2float.cl         |  0
 .../conversion/convert_float2int.cl           |  0
 .../conversion/convert_int2float.cl           |  0
 .../conversion/convert_integer.cl             |  0
 .../conversion/convert_integer.inc            |  4 +-
 .../opencl/lib/{clspv => vulkan}/math/fma.cl  |  0
 .../{clspv => vulkan}/shared/vstore_half.cl   |  0
 .../{clspv => vulkan}/shared/vstore_half.inc  |  0
 libclc/test/CMakeLists.txt                    |  2 +-
 18 files changed, 54 insertions(+), 59 deletions(-)
 rename libclc/clc/lib/{clspv => vulkan}/CMakeLists.txt (61%)
 rename libclc/clc/lib/{clspv => vulkan}/integer/clc_mul_hi.cl (77%)
 rename libclc/clc/lib/{clspv => vulkan}/math/clc_sw_fma.cl (100%)
 rename libclc/opencl/lib/{clspv => vulkan}/CMakeLists.txt (88%)
 rename libclc/opencl/lib/{clspv => vulkan}/conversion/convert_float.inc (100%)
 rename libclc/opencl/lib/{clspv => vulkan}/conversion/convert_float2float.cl 
(100%)
 rename libclc/opencl/lib/{clspv => vulkan}/conversion/convert_float2int.cl 
(100%)
 rename libclc/opencl/lib/{clspv => vulkan}/conversion/convert_int2float.cl 
(100%)
 rename libclc/opencl/lib/{clspv => vulkan}/conversion/convert_integer.cl (100%)
 rename libclc/opencl/lib/{clspv => vulkan}/conversion/convert_integer.inc (93%)
 rename libclc/opencl/lib/{clspv => vulkan}/math/fma.cl (100%)
 rename libclc/opencl/lib/{clspv => vulkan}/shared/vstore_half.cl (100%)
 rename libclc/opencl/lib/{clspv => vulkan}/shared/vstore_half.inc (100%)

diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt
index cb05fb7b662d8..a9fe66ee64172 100644
--- a/libclc/CMakeLists.txt
+++ b/libclc/CMakeLists.txt
@@ -23,7 +23,7 @@ option(
 )
 
 # List of all supported architectures.
-set( LIBCLC_ARCHS_ALL amdgpu amdgcn clspv clspv64 nvptx64 spirv spirv64 )
+set( LIBCLC_ARCHS_ALL amdgpu amdgcn nvptx64 spirv spirv64 )
 
 set(LIBCLC_TARGET ${LLVM_DEFAULT_TARGET_TRIPLE})
 
@@ -101,7 +101,7 @@ list(GET TRIPLE 0 ARCH)
 list(GET TRIPLE 2 OS)
 
 if(ARCH STREQUAL spirv OR ARCH STREQUAL spirv64)
-  if(NOT LIBCLC_USE_SPIRV_BACKEND AND NOT llvm-spirv_exe)
+  if(NOT OS STREQUAL vulkan AND NOT LIBCLC_USE_SPIRV_BACKEND AND NOT 
llvm-spirv_exe)
     message(FATAL_ERROR "SPIR-V backend or llvm-spirv is required for libclc 
${LIBCLC_TARGET}")
   endif()
 endif()
@@ -121,11 +121,13 @@ if(ARCH STREQUAL amdgcn)
 elseif(ARCH STREQUAL nvptx64)
   add_subdirectory(clc/lib/ptx-nvidiacl)
 elseif(ARCH STREQUAL spirv OR ARCH STREQUAL spirv64)
-  add_subdirectory(clc/lib/spirv)
-  add_subdirectory(opencl/lib/spirv)
-elseif(ARCH STREQUAL clspv OR ARCH STREQUAL clspv64)
-  add_subdirectory(clc/lib/clspv)
-  add_subdirectory(opencl/lib/clspv)
+  if(OS STREQUAL vulkan)
+    add_subdirectory(clc/lib/vulkan)
+    add_subdirectory(opencl/lib/vulkan)
+  else()
+    add_subdirectory(clc/lib/spirv)
+    add_subdirectory(opencl/lib/spirv)
+  endif()
 endif()
 
 add_custom_target( libclc ALL )
@@ -133,30 +135,18 @@ add_custom_target( libclc ALL )
 add_custom_target( libclc-opencl-builtins COMMENT "Build libclc OpenCL 
builtins" )
 add_dependencies( libclc libclc-opencl-builtins )
 
-# Determine the clang target triple.
+# Determine the clang target triple. Vulkan and SPIR-V backend targets use the
+# triple directly; other SPIR-V targets fall back to the legacy SPIR target.
 set(clang_triple ${LIBCLC_TARGET})
-if(ARCH STREQUAL spirv AND LIBCLC_USE_SPIRV_BACKEND)
-  set(clang_triple spirv32--)
-elseif(ARCH STREQUAL spirv64 AND LIBCLC_USE_SPIRV_BACKEND)
-  set(clang_triple spirv64--)
-elseif(ARCH STREQUAL spirv OR ARCH STREQUAL clspv)
-  set(clang_triple spir--)
-elseif(ARCH STREQUAL spirv64 OR ARCH STREQUAL clspv64)
-  set(clang_triple spir64--)
-endif()
-
-# Determine the preprocessor identifier for this target.
-set(MACRO_ARCH ${ARCH})
-if(ARCH STREQUAL spirv)
-  set(MACRO_ARCH SPIRV32)
-elseif(ARCH STREQUAL spirv64)
-  set(MACRO_ARCH SPIRV64)
-elseif(ARCH STREQUAL clspv)
-  set(MACRO_ARCH CLSPV32)
-elseif(ARCH STREQUAL clspv64)
-  set(MACRO_ARCH CLSPV64)
+if(ARCH STREQUAL spirv OR ARCH STREQUAL spirv64)
+  if(NOT OS STREQUAL vulkan AND NOT LIBCLC_USE_SPIRV_BACKEND)
+    if(ARCH STREQUAL spirv)
+      set(clang_triple spir--)
+    else()
+      set(clang_triple spir64--)
+    endif()
+  endif()
 endif()
-string(TOUPPER "CLC_${MACRO_ARCH}" target_define)
 
 # Address space values.
 set(private_addrspace_val 0)
@@ -164,7 +154,7 @@ set(generic_addrspace_val 0)
 if(ARCH STREQUAL amdgcn)
   set(private_addrspace_val 5)
 endif()
-if(ARCH STREQUAL spirv OR ARCH STREQUAL spirv64)
+if((ARCH STREQUAL spirv OR ARCH STREQUAL spirv64) AND NOT OS STREQUAL vulkan)
   set(generic_addrspace_val 4)
 endif()
 
@@ -174,12 +164,13 @@ set(target_extra_defines)
 set(opt_flags -O3)
 
 if(ARCH STREQUAL spirv OR ARCH STREQUAL spirv64)
-  list(APPEND target_compile_flags -O0 -finline-hint-functions)
-  list(APPEND target_extra_defines CLC_SPIRV)
-  set(opt_flags)
-elseif(ARCH STREQUAL clspv OR ARCH STREQUAL clspv64)
-  list(APPEND target_compile_flags -Wno-unknown-assumption -U__opencl_c_int64)
-  list(APPEND target_extra_defines CLC_CLSPV)
+  if(OS STREQUAL vulkan)
+    list(APPEND target_compile_flags -Wno-unknown-assumption 
-U__opencl_c_int64)
+  else()
+    list(APPEND target_compile_flags -O0 -finline-hint-functions)
+    list(APPEND target_extra_defines CLC_SPIRV)
+    set(opt_flags)
+  endif()
 elseif(ARCH STREQUAL amdgcn)
   list(APPEND target_compile_flags "SHELL:-Xclang -mcode-object-version=none")
 endif()
@@ -191,18 +182,22 @@ if(ARCH STREQUAL amdgcn)
 elseif(ARCH STREQUAL nvptx64 AND (OS STREQUAL nvidiacl OR OS STREQUAL cuda))
   list(APPEND _clc_overrides ${CLC_PTX_NVIDIACL_SOURCES})
 elseif(ARCH STREQUAL spirv OR ARCH STREQUAL spirv64)
-  list(APPEND _clc_overrides ${CLC_SPIRV_SOURCES})
-elseif(ARCH STREQUAL clspv OR ARCH STREQUAL clspv64)
-  list(APPEND _clc_overrides ${CLC_CLSPV_SOURCES})
+  if(OS STREQUAL vulkan)
+    list(APPEND _clc_overrides ${CLC_VULKAN_SOURCES})
+  else()
+    list(APPEND _clc_overrides ${CLC_SPIRV_SOURCES})
+  endif()
 endif()
 libclc_merge_sources(clc_sources ${CLC_GENERIC_SOURCES} ${_clc_overrides})
 
-# Collect OpenCL sources. SPIR-V and Clspv targets use self-contained
+# Collect OpenCL sources. SPIR-V and Vulkan targets use self-contained
 # subsets while others merge with target-specific overrides.
 if(ARCH STREQUAL spirv OR ARCH STREQUAL spirv64)
-  set(opencl_sources ${OPENCL_SPIRV_SOURCES})
-elseif(ARCH STREQUAL clspv OR ARCH STREQUAL clspv64)
-  set(opencl_sources ${OPENCL_CLSPV_SOURCES})
+  if(OS STREQUAL vulkan)
+    set(opencl_sources ${OPENCL_VULKAN_SOURCES})
+  else()
+    set(opencl_sources ${OPENCL_SPIRV_SOURCES})
+  endif()
 else()
   set(_opencl_overrides)
   if(ARCH STREQUAL amdgcn)
@@ -231,7 +226,6 @@ set(compile_flags
 )
 
 set(_common_defs
-  ${target_define}
   ${target_extra_defines}
   __CLC_PRIVATE_ADDRSPACE_VAL=${private_addrspace_val}
   __CLC_GENERIC_ADDRSPACE_VAL=${generic_addrspace_val}
diff --git a/libclc/README.md b/libclc/README.md
index 81ce1553d139c..9399c5cb89925 100644
--- a/libclc/README.md
+++ b/libclc/README.md
@@ -50,12 +50,11 @@ cmake ../llvm -G Ninja -DLLVM_ENABLE_PROJECTS="clang" 
-DCMAKE_BUILD_TYPE=Release
   -DLLVM_RUNTIME_TARGETS="nvptx64-nvidia-cuda"
 ```
 
-#### Configure for CLSPV targets
+#### Configure for Vulkan (clspv) targets
 ```
 cmake ../llvm -G Ninja -DLLVM_ENABLE_PROJECTS="clang" 
-DCMAKE_BUILD_TYPE=Release \
-  -DRUNTIMES_clspv--_LLVM_ENABLE_RUNTIMES=libclc \
-  -DRUNTIMES_clspv64--_LLVM_ENABLE_RUNTIMES=libclc \
-  -DLLVM_RUNTIME_TARGETS="clspv--;clspv64--"
+  -DRUNTIMES_spirv64-unknown-vulkan_LLVM_ENABLE_RUNTIMES=libclc \
+  -DLLVM_RUNTIME_TARGETS="spirv64-unknown-vulkan"
 ```
 
 #### Configure for SPIR-V targets
diff --git a/libclc/clc/include/clc/clcfunc.h b/libclc/clc/include/clc/clcfunc.h
index 5457a1892ac87..79b5f4230fac7 100644
--- a/libclc/clc/include/clc/clcfunc.h
+++ b/libclc/clc/include/clc/clcfunc.h
@@ -14,7 +14,7 @@
 #define _CLC_INLINE inline
 #define _CLC_CONST __attribute__((const))
 
-#if defined(CLC_CLSPV)
+#if defined(__VULKAN__)
 #define _CLC_DEF __attribute__((noinline)) 
__attribute__((clspv_libclc_builtin))
 #else
 #define _CLC_DEF
diff --git a/libclc/clc/lib/clspv/CMakeLists.txt 
b/libclc/clc/lib/vulkan/CMakeLists.txt
similarity index 61%
rename from libclc/clc/lib/clspv/CMakeLists.txt
rename to libclc/clc/lib/vulkan/CMakeLists.txt
index e54fccb10c3b7..172e3be32d65c 100644
--- a/libclc/clc/lib/clspv/CMakeLists.txt
+++ b/libclc/clc/lib/vulkan/CMakeLists.txt
@@ -1,4 +1,4 @@
-libclc_configure_source_list(CLC_CLSPV_SOURCES
+libclc_configure_source_list(CLC_VULKAN_SOURCES
   ${CMAKE_CURRENT_SOURCE_DIR}
   integer/clc_mul_hi.cl
   math/clc_sw_fma.cl
diff --git a/libclc/clc/lib/clspv/integer/clc_mul_hi.cl 
b/libclc/clc/lib/vulkan/integer/clc_mul_hi.cl
similarity index 77%
rename from libclc/clc/lib/clspv/integer/clc_mul_hi.cl
rename to libclc/clc/lib/vulkan/integer/clc_mul_hi.cl
index aab761736fff2..fdf4ac344341f 100644
--- a/libclc/clc/lib/clspv/integer/clc_mul_hi.cl
+++ b/libclc/clc/lib/vulkan/integer/clc_mul_hi.cl
@@ -6,7 +6,7 @@
 //
 
//===----------------------------------------------------------------------===//
 
-// Opt-out of libclc mul_hi implementation for clspv.
-// clspv has an internal implementation that does not required using a bigger
+// Opt-out of libclc mul_hi implementation for Vulkan SPIR-V targets.
+// clspv has an internal implementation that does not require using a bigger
 // data size. That implementation is based on OpMulExtended which is SPIR-V
 // specific, thus it cannot be written in OpenCL-C.
diff --git a/libclc/clc/lib/clspv/math/clc_sw_fma.cl 
b/libclc/clc/lib/vulkan/math/clc_sw_fma.cl
similarity index 100%
rename from libclc/clc/lib/clspv/math/clc_sw_fma.cl
rename to libclc/clc/lib/vulkan/math/clc_sw_fma.cl
diff --git a/libclc/cmake/modules/AddLibclc.cmake 
b/libclc/cmake/modules/AddLibclc.cmake
index e1e099d2c9869..9d81324b6d8f9 100644
--- a/libclc/cmake/modules/AddLibclc.cmake
+++ b/libclc/cmake/modules/AddLibclc.cmake
@@ -111,7 +111,9 @@ function(link_libclc_builtin_library target_name)
     DEPENDS ${link_deps}
   )
 
-  if(ARG_ARCH STREQUAL spirv OR ARG_ARCH STREQUAL spirv64)
+  string(REPLACE "-" ";" triple_parts "${ARG_TRIPLE}")
+  list(GET triple_parts 2 triple_os)
+  if((ARG_ARCH STREQUAL spirv OR ARG_ARCH STREQUAL spirv64) AND NOT triple_os 
STREQUAL vulkan)
     # SPIR-V targets produce a .spv file from the linked bitcode.
     set(builtins_lib ${library_dir}/${ARG_OUTPUT_FILENAME}.spv)
     if(LIBCLC_USE_SPIRV_BACKEND)
diff --git a/libclc/opencl/lib/clspv/CMakeLists.txt 
b/libclc/opencl/lib/vulkan/CMakeLists.txt
similarity index 88%
rename from libclc/opencl/lib/clspv/CMakeLists.txt
rename to libclc/opencl/lib/vulkan/CMakeLists.txt
index 2b9aa33f6e178..5fa2e7a367678 100644
--- a/libclc/opencl/lib/clspv/CMakeLists.txt
+++ b/libclc/opencl/lib/vulkan/CMakeLists.txt
@@ -1,8 +1,8 @@
 set(_gen ${CMAKE_CURRENT_SOURCE_DIR}/../generic)
 
-# CLSPV uses a curated subset of generic builtins plus its own overrides,
+# Vulkan uses a curated subset of generic builtins plus its own overrides,
 # so this list is self-contained rather than merged with the generic set.
-libclc_configure_source_list(_clspv_sources
+libclc_configure_source_list(_vulkan_sources
   ${CMAKE_CURRENT_SOURCE_DIR}
   conversion/convert_float2float.cl
   conversion/convert_float2int.cl
@@ -85,4 +85,4 @@ libclc_configure_source_list(_gen_sources
   math/tgamma.cl
 )
 
-set(OPENCL_CLSPV_SOURCES ${_clspv_sources} ${_gen_sources} PARENT_SCOPE)
+set(OPENCL_VULKAN_SOURCES ${_vulkan_sources} ${_gen_sources} PARENT_SCOPE)
diff --git a/libclc/opencl/lib/clspv/conversion/convert_float.inc 
b/libclc/opencl/lib/vulkan/conversion/convert_float.inc
similarity index 100%
rename from libclc/opencl/lib/clspv/conversion/convert_float.inc
rename to libclc/opencl/lib/vulkan/conversion/convert_float.inc
diff --git a/libclc/opencl/lib/clspv/conversion/convert_float2float.cl 
b/libclc/opencl/lib/vulkan/conversion/convert_float2float.cl
similarity index 100%
rename from libclc/opencl/lib/clspv/conversion/convert_float2float.cl
rename to libclc/opencl/lib/vulkan/conversion/convert_float2float.cl
diff --git a/libclc/opencl/lib/clspv/conversion/convert_float2int.cl 
b/libclc/opencl/lib/vulkan/conversion/convert_float2int.cl
similarity index 100%
rename from libclc/opencl/lib/clspv/conversion/convert_float2int.cl
rename to libclc/opencl/lib/vulkan/conversion/convert_float2int.cl
diff --git a/libclc/opencl/lib/clspv/conversion/convert_int2float.cl 
b/libclc/opencl/lib/vulkan/conversion/convert_int2float.cl
similarity index 100%
rename from libclc/opencl/lib/clspv/conversion/convert_int2float.cl
rename to libclc/opencl/lib/vulkan/conversion/convert_int2float.cl
diff --git a/libclc/opencl/lib/clspv/conversion/convert_integer.cl 
b/libclc/opencl/lib/vulkan/conversion/convert_integer.cl
similarity index 100%
rename from libclc/opencl/lib/clspv/conversion/convert_integer.cl
rename to libclc/opencl/lib/vulkan/conversion/convert_integer.cl
diff --git a/libclc/opencl/lib/clspv/conversion/convert_integer.inc 
b/libclc/opencl/lib/vulkan/conversion/convert_integer.inc
similarity index 93%
rename from libclc/opencl/lib/clspv/conversion/convert_integer.inc
rename to libclc/opencl/lib/vulkan/conversion/convert_integer.inc
index dc0dad71ca445..072f36918831a 100644
--- a/libclc/opencl/lib/clspv/conversion/convert_integer.inc
+++ b/libclc/opencl/lib/vulkan/conversion/convert_integer.inc
@@ -6,8 +6,8 @@
 //
 
//===----------------------------------------------------------------------===//
 
-// Do not generate user-facing default conversions for clspv as they are 
handled
-// natively. Do not generate user-facing "_rte" conversions for clspv as they
+// Do not generate user-facing default conversions for Vulkan targets as they
+// are handled natively. Do not generate user-facing "_rte" conversions as they
 // are handled natively.
 
 #define __CLC_DEFINE_FUNCTION_ROUNDING_MODE_SATURATION_IMPL(TYPE_SRC, MODE)    
\
diff --git a/libclc/opencl/lib/clspv/math/fma.cl 
b/libclc/opencl/lib/vulkan/math/fma.cl
similarity index 100%
rename from libclc/opencl/lib/clspv/math/fma.cl
rename to libclc/opencl/lib/vulkan/math/fma.cl
diff --git a/libclc/opencl/lib/clspv/shared/vstore_half.cl 
b/libclc/opencl/lib/vulkan/shared/vstore_half.cl
similarity index 100%
rename from libclc/opencl/lib/clspv/shared/vstore_half.cl
rename to libclc/opencl/lib/vulkan/shared/vstore_half.cl
diff --git a/libclc/opencl/lib/clspv/shared/vstore_half.inc 
b/libclc/opencl/lib/vulkan/shared/vstore_half.inc
similarity index 100%
rename from libclc/opencl/lib/clspv/shared/vstore_half.inc
rename to libclc/opencl/lib/vulkan/shared/vstore_half.inc
diff --git a/libclc/test/CMakeLists.txt b/libclc/test/CMakeLists.txt
index 98566a517f604..4c54d93b26813 100644
--- a/libclc/test/CMakeLists.txt
+++ b/libclc/test/CMakeLists.txt
@@ -7,7 +7,7 @@ set(LIBCLC_TEST_DEPS
 umbrella_lit_testsuite_begin(check-libclc)
 
 # Testing unresolved symbols.
-# Skip nvptx, clspv, spirv targets
+# Skip nvptx and spirv targets.
 if(ARCH MATCHES amdgcn)
   foreach(tgt IN LISTS LIBCLC_UNRESOLVED_SYMBOL_TEST_TARGETS)
     set(target_file "$<TARGET_PROPERTY:${tgt},TARGET_FILE>")

>From 7328d259f20d30d3ab9fa2f739d31d822b84ce5e Mon Sep 17 00:00:00 2001
From: Joseph Huber <[email protected]>
Date: Thu, 7 May 2026 20:33:05 -0500
Subject: [PATCH 2/3] Use __NVPTX__

---
 .../clc/lib/generic/atomic/clc_atomic_compare_exchange.inc  | 6 +++---
 libclc/clc/lib/generic/atomic/clc_atomic_def.inc            | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libclc/clc/lib/generic/atomic/clc_atomic_compare_exchange.inc 
b/libclc/clc/lib/generic/atomic/clc_atomic_compare_exchange.inc
index 07ef69d426768..d28e3c72e465e 100644
--- a/libclc/clc/lib/generic/atomic/clc_atomic_compare_exchange.inc
+++ b/libclc/clc/lib/generic/atomic/clc_atomic_compare_exchange.inc
@@ -8,16 +8,16 @@
 
 #ifdef __CLC_SCALAR
 
-#if defined(__SPIR32__) || defined(CLC_NVPTX)
+#if defined(__SPIR32__) || defined(__NVPTX__)
 #if (defined(__CLC_FPSIZE) && __CLC_FPSIZE <= 32) ||                           
\
     (defined(__CLC_GENSIZE) && (__CLC_GENSIZE == 32))
 #define __CLC_HAS_ATOMIC
 #endif
-#else // defined(__SPIR32__) || defined(CLC_NVPTX)
+#else // defined(__SPIR32__) || defined(__NVPTX__)
 #if defined(__CLC_FPSIZE) || (__CLC_GENSIZE >= 32)
 #define __CLC_HAS_ATOMIC
 #endif
-#endif // defined(__SPIR32__) || defined(CLC_NVPTX)
+#endif // defined(__SPIR32__) || defined(__NVPTX__)
 
 #ifdef __CLC_HAS_ATOMIC
 
diff --git a/libclc/clc/lib/generic/atomic/clc_atomic_def.inc 
b/libclc/clc/lib/generic/atomic/clc_atomic_def.inc
index 3a313defe0c03..2af450ffbbe5c 100644
--- a/libclc/clc/lib/generic/atomic/clc_atomic_def.inc
+++ b/libclc/clc/lib/generic/atomic/clc_atomic_def.inc
@@ -8,16 +8,16 @@
 
 #ifdef __CLC_SCALAR
 
-#if defined(__SPIR32__) || defined(CLC_NVPTX)
+#if defined(__SPIR32__) || defined(__NVPTX__)
 #if (defined(__CLC_FPSIZE) && __CLC_FPSIZE <= 32) ||                           
\
     (defined(__CLC_GENSIZE) && (__CLC_GENSIZE == 32))
 #define __CLC_HAS_ATOMIC
 #endif
-#else // defined(__SPIR32__) || defined(CLC_NVPTX)
+#else // defined(__SPIR32__) || defined(__NVPTX__)
 #if defined(__CLC_FPSIZE) || (__CLC_GENSIZE >= 32)
 #define __CLC_HAS_ATOMIC
 #endif
-#endif // defined(__SPIR32__) || defined(CLC_NVPTX)
+#endif // defined(__SPIR32__) || defined(__NVPTX__)
 
 #ifdef __CLC_HAS_ATOMIC
 

>From e4fb0be9b7c097d931ebd6dcde31e0d409f79beb Mon Sep 17 00:00:00 2001
From: Joseph Huber <[email protected]>
Date: Fri, 8 May 2026 06:56:24 -0500
Subject: [PATCH 3/3] spirv32 fix

---
 libclc/CMakeLists.txt                | 16 ++++++++--------
 libclc/cmake/modules/AddLibclc.cmake |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt
index a9fe66ee64172..cf1834a7ece63 100644
--- a/libclc/CMakeLists.txt
+++ b/libclc/CMakeLists.txt
@@ -23,7 +23,7 @@ option(
 )
 
 # List of all supported architectures.
-set( LIBCLC_ARCHS_ALL amdgpu amdgcn nvptx64 spirv spirv64 )
+set( LIBCLC_ARCHS_ALL amdgpu amdgcn nvptx64 spirv spirv32 spirv64 )
 
 set(LIBCLC_TARGET ${LLVM_DEFAULT_TARGET_TRIPLE})
 
@@ -100,7 +100,7 @@ string( REPLACE "-" ";" TRIPLE  ${LIBCLC_TARGET} )
 list(GET TRIPLE 0 ARCH)
 list(GET TRIPLE 2 OS)
 
-if(ARCH STREQUAL spirv OR ARCH STREQUAL spirv64)
+if(ARCH STREQUAL spirv OR ARCH STREQUAL spirv32 OR ARCH STREQUAL spirv64)
   if(NOT OS STREQUAL vulkan AND NOT LIBCLC_USE_SPIRV_BACKEND AND NOT 
llvm-spirv_exe)
     message(FATAL_ERROR "SPIR-V backend or llvm-spirv is required for libclc 
${LIBCLC_TARGET}")
   endif()
@@ -120,7 +120,7 @@ if(ARCH STREQUAL amdgcn)
   add_subdirectory(opencl/lib/amdgpu)
 elseif(ARCH STREQUAL nvptx64)
   add_subdirectory(clc/lib/ptx-nvidiacl)
-elseif(ARCH STREQUAL spirv OR ARCH STREQUAL spirv64)
+elseif(ARCH STREQUAL spirv OR ARCH STREQUAL spirv32 OR ARCH STREQUAL spirv64)
   if(OS STREQUAL vulkan)
     add_subdirectory(clc/lib/vulkan)
     add_subdirectory(opencl/lib/vulkan)
@@ -138,7 +138,7 @@ add_dependencies( libclc libclc-opencl-builtins )
 # Determine the clang target triple. Vulkan and SPIR-V backend targets use the
 # triple directly; other SPIR-V targets fall back to the legacy SPIR target.
 set(clang_triple ${LIBCLC_TARGET})
-if(ARCH STREQUAL spirv OR ARCH STREQUAL spirv64)
+if(ARCH STREQUAL spirv OR ARCH STREQUAL spirv32 OR ARCH STREQUAL spirv64)
   if(NOT OS STREQUAL vulkan AND NOT LIBCLC_USE_SPIRV_BACKEND)
     if(ARCH STREQUAL spirv)
       set(clang_triple spir--)
@@ -154,7 +154,7 @@ set(generic_addrspace_val 0)
 if(ARCH STREQUAL amdgcn)
   set(private_addrspace_val 5)
 endif()
-if((ARCH STREQUAL spirv OR ARCH STREQUAL spirv64) AND NOT OS STREQUAL vulkan)
+if((ARCH STREQUAL spirv OR ARCH STREQUAL spirv32 OR ARCH STREQUAL spirv64) AND 
NOT OS STREQUAL vulkan)
   set(generic_addrspace_val 4)
 endif()
 
@@ -163,7 +163,7 @@ set(target_compile_flags)
 set(target_extra_defines)
 set(opt_flags -O3)
 
-if(ARCH STREQUAL spirv OR ARCH STREQUAL spirv64)
+if(ARCH STREQUAL spirv OR ARCH STREQUAL spirv32 OR ARCH STREQUAL spirv64)
   if(OS STREQUAL vulkan)
     list(APPEND target_compile_flags -Wno-unknown-assumption 
-U__opencl_c_int64)
   else()
@@ -181,7 +181,7 @@ if(ARCH STREQUAL amdgcn)
   list(APPEND _clc_overrides ${CLC_AMDGPU_SOURCES})
 elseif(ARCH STREQUAL nvptx64 AND (OS STREQUAL nvidiacl OR OS STREQUAL cuda))
   list(APPEND _clc_overrides ${CLC_PTX_NVIDIACL_SOURCES})
-elseif(ARCH STREQUAL spirv OR ARCH STREQUAL spirv64)
+elseif(ARCH STREQUAL spirv OR ARCH STREQUAL spirv32 OR ARCH STREQUAL spirv64)
   if(OS STREQUAL vulkan)
     list(APPEND _clc_overrides ${CLC_VULKAN_SOURCES})
   else()
@@ -192,7 +192,7 @@ libclc_merge_sources(clc_sources ${CLC_GENERIC_SOURCES} 
${_clc_overrides})
 
 # Collect OpenCL sources. SPIR-V and Vulkan targets use self-contained
 # subsets while others merge with target-specific overrides.
-if(ARCH STREQUAL spirv OR ARCH STREQUAL spirv64)
+if(ARCH STREQUAL spirv OR ARCH STREQUAL spirv32 OR ARCH STREQUAL spirv64)
   if(OS STREQUAL vulkan)
     set(opencl_sources ${OPENCL_VULKAN_SOURCES})
   else()
diff --git a/libclc/cmake/modules/AddLibclc.cmake 
b/libclc/cmake/modules/AddLibclc.cmake
index 9d81324b6d8f9..41297e8eb1e92 100644
--- a/libclc/cmake/modules/AddLibclc.cmake
+++ b/libclc/cmake/modules/AddLibclc.cmake
@@ -113,7 +113,7 @@ function(link_libclc_builtin_library target_name)
 
   string(REPLACE "-" ";" triple_parts "${ARG_TRIPLE}")
   list(GET triple_parts 2 triple_os)
-  if((ARG_ARCH STREQUAL spirv OR ARG_ARCH STREQUAL spirv64) AND NOT triple_os 
STREQUAL vulkan)
+  if((ARG_ARCH STREQUAL spirv OR ARG_ARCH STREQUAL spirv32 OR ARG_ARCH 
STREQUAL spirv64) AND NOT triple_os STREQUAL vulkan)
     # SPIR-V targets produce a .spv file from the linked bitcode.
     set(builtins_lib ${library_dir}/${ARG_OUTPUT_FILENAME}.spv)
     if(LIBCLC_USE_SPIRV_BACKEND)

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to