[llvm] [SPIRV] Do not use OpTypeRuntimeArray in Kernel env. (PR #149522)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 21 07:10:45 PDT 2025


================
@@ -744,8 +744,14 @@ void SPIRV::RequirementHandler::checkSatisfiable(
     IsSatisfiable = false;
   }
 
+  AvoidCapabilitiesSet AvoidCaps;
+  if (!ST.isShader())
+    AvoidCaps.S.insert(SPIRV::Capability::Shader);
+  else
+    AvoidCaps.S.insert(SPIRV::Capability::Kernel);
+
   for (auto Cap : MinimalCaps) {
-    if (AvailableCaps.contains(Cap))
+    if (AvailableCaps.contains(Cap) && !AvoidCaps.S.contains(Cap))
----------------
Keenuts wrote:

> I'm guessing that if you do this change, and not the OpRuntimeArray change, the test case would give an error that the shader capability is not supported.

We should already have this error surfacing: after all we have a list of available capabilities by environment.
But seems like when `!ST.isShader()` we add OpenCL capabilities, but some are implicitely adding `Shader` (`StorageImageReadWithoutFormat`).
Removing those from the OpenCL list does surface the existing "Unable to meet requirement" error)

https://github.com/llvm/llvm-project/pull/149522


More information about the llvm-commits mailing list