[Mlir-commits] [mlir] [mlir][linalg] Extend elementwise (PR #124661)
Renato Golin
llvmlistbot at llvm.org
Tue Jan 28 08:22:35 PST 2025
================
@@ -55,6 +55,50 @@ def TernaryFn : I32EnumAttr<"TernaryFn", "", [
let genSpecializedAttr = 0;
let cppNamespace = "::mlir::linalg";
}
+
+// Join two I32EnumAttrCase lists. This joining takes care that the
+// 'int enum values' in the combined list do not overlap. It does this
+// by adding to each element of second list the offset '!size(a)'.
+class JoinTwoI32EnumAttrCaseList< list<I32EnumAttrCase> a,
----------------
rengolin wrote:
Thinking out loud, perhaps it would be easier to use bit patterns instead of joining enum lists. We won't have more than 20 operations per `Category`, so:
* Unary: `(op | (0xFF << 1))`
* Binary: `(op | (0xFF << 2))`
* Ternary: `(op | (0xFF << 3))`
And set the enums above like:
* `I32EnumAttrCase<"log", (1 << 1)>`
* `I32EnumAttrCase<"sub", (1 << 2)>`
* `I32EnumAttrCase<"select", (1 << 3)>`
etc?
Then you don't need all the complex sequential logic in the parser/verifiers.
https://github.com/llvm/llvm-project/pull/124661
More information about the Mlir-commits
mailing list