[Mlir-commits] [mlir] [mlir][Vector] Add support for poison indices to `Extract/IndexOp` (PR #123488)
Diego Caballero
llvmlistbot at llvm.org
Sat Jan 18 15:34:24 PST 2025
================
@@ -26,6 +26,15 @@ def Vector_Dialect : Dialect {
// Base class for Vector dialect ops.
class Vector_Op<string mnemonic, list<Trait> traits = []> :
- Op<Vector_Dialect, mnemonic, traits>;
+ Op<Vector_Dialect, mnemonic, traits> {
+
+ // Includes definitions for operations that support the use of poison values
+ // within positive index ranges.
+ code extraPoisonClassDeclaration = [{
+ // Integer to represent a poison index within a static and positive integer
+ // range.
+ static constexpr int64_t kPoisonIndex = -1;
+ }];
----------------
dcaballe wrote:
Lazy me started with this approach to refactor and declare the poison value index for different operations (shuffle, insert, extract, ...), thinking that I would turn this into an interface eventually. Giving it another thought, I feel like using an interface with a `getPoisonIndexValue` method that returns `-1` could be an overkill? WDYT?
I was also wondering if the `OpFoldResult` implementation would have a place somewhere to accommodate this declaration. cc: @matthias-springer
https://github.com/llvm/llvm-project/pull/123488
More information about the Mlir-commits
mailing list