[llvm-branch-commits] [llvm] [mlir] [mlir][ODS] Add so-called "Natural Sharding" to ops (PR #239254)
Markus Böck via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Nov 9 02:10:38 PST 2026
================
@@ -1370,6 +1370,110 @@ cc_library(
)
```
+#### Natural Sharding with Op Partitions
+
+Sharding by index splits the ops arbitrarily: which shard an op ends up in
+depends on the number of shards and on the names of all other ops. As an
+alternative, a dialect can shard its ops "naturally" by grouping them into
+named *op partitions*, such as arithmetic, memory or control flow ops. Each
+partition is generated into its own declaration and definition files, almost as
+if it were a dialect of its own, but all ops are still registered in one
+dialect.
+
+Partitions are `Partition` records with a name, which must be a C++
+identifier. The dialect lists its partitions, and every op sets its `partition`
+to one of these records (a different record with the same name is rejected),
+typically with a `let` around a group of ops:
+
+```tablegen
+def MyDialect_ArithPartition : Partition<"Arith">;
+def MyDialect_MemoryPartition : Partition<"Memory">;
+
+def MyDialect : Dialect {
+ let name = "my_dialect";
+ let opPartitions = [MyDialect_ArithPartition, MyDialect_MemoryPartition];
----------------
zero9178 wrote:
At least so far, generating a dialect definition and declaration did not require knowing all the ops list, so this information has to get to the dialect generator somehow.
I don't know of any blockers requiring us to use the corresponding `Ops.td` file, let me prototype it
https://github.com/llvm/llvm-project/pull/239254
More information about the llvm-branch-commits
mailing list