[Mlir-commits] [mlir] Reland "[mlir][spirv] Fix UpdateVCEPass to deduce the correct set of capabilities" (PR #151502)

Igor Wodiany llvmlistbot at llvm.org
Thu Jul 31 06:41:36 PDT 2025


================
@@ -95,6 +95,14 @@ static LogicalResult checkAndUpdateCapabilityRequirements(
   return success();
 }
 
+static void addAllImpliedCapabilities(SetVector<spirv::Capability> &caps) {
+  for (unsigned i = 0; i < caps.size(); ++i) {
+    spirv::Capability cap = caps[i];
+    ArrayRef<spirv::Capability> impliedCaps = getDirectImpliedCapabilities(cap);
+    caps.insert_range(impliedCaps);
+  }
----------------
IgWod-IMG wrote:

It was before I found out how much issues my suggestions cause :) Tbh, if we didn't go with single loop approach, I'd say that the function shouldn't be destructive on the input vector. The input vector can be either updated so it contains all caps or we can return a new vector without modifying the input. I like the first approach more and I think that's what @kuhar suggests (it uses temporary new SetVector internally). I just don't like the approach where we return a new vector and modify the input – actually this was my main motivation behind that comment, but I also hoped we can be smart how we implement the in-place update.

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


More information about the Mlir-commits mailing list