[Mlir-commits] [mlir] [mlir][spirv] Support poison index when converting vector.insert/extract (PR #125560)
Jakub Kuderski
llvmlistbot at llvm.org
Mon Feb 3 12:30:42 PST 2025
================
@@ -137,6 +137,26 @@ struct VectorBroadcastConvert final
}
};
+// SPIR-V does not have a concept of a poison index for certain instructions,
+// which creates a UB hazard when lowering from otherwise equivalent Vector
+// dialect instructions, because this index will be considered out-of-bounds.
+// To avoid this, this function implements a dynamic sanitization, arbitrarily
+// choosing to replace the poison index with index 0 (always in-bounds).
+static Value sanitizeDynamicIndex(ConversionPatternRewriter &rewriter,
+ Location loc, Value dynamicIndex,
+ int64_t kPoisonIndex) {
----------------
kuhar wrote:
Why not use `vector::ExtractOp::kPoisonIndex` directly?
https://github.com/llvm/llvm-project/pull/125560
More information about the Mlir-commits
mailing list