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

Steven Perron via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 21 06:46:01 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))
----------------
s-perron wrote:

I don't mind this change. It will help us identify errors of this type earlier. 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. This will be generally useful. We run into error like this with shader that accidentally adding the kernel capability.

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


More information about the llvm-commits mailing list