[Mlir-commits] [mlir] [MLIR][Mesh] Add sharding propagation pass (PR #69665)

Kunwar Grover llvmlistbot at llvm.org
Thu Nov 2 21:50:22 PDT 2023


================
@@ -235,6 +235,19 @@ AffineMap AffineMap::getPermutationMap(ArrayRef<unsigned> permutation,
   return permutationMap;
 }
 
+AffineMap AffineMap::getMultiDimMapWithTargets(unsigned numDims,
+                                               ArrayRef<int64_t> targets,
+                                               MLIRContext *context) {
+  AffineMap result =
+      AffineMap::get(/*dimCount=*/numDims, /*symbolCount=*/0, context);
+  int64_t pos = 0;
+  for (int64_t t : targets) {
+    result = result.insertResult(getAffineDimExpr(t, context), pos);
----------------
Groverkss wrote:

You can do this the same way getPermutationMap does. You could even make getPermutationMap call to this function for some clean up. 

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


More information about the Mlir-commits mailing list