[Mlir-commits] [mlir] [mlir] [linalg] Fix bufferize error in tensor.parallel_insert_slice op (PR #98312)

Matthias Springer llvmlistbot at llvm.org
Wed Jul 10 06:29:23 PDT 2024


================
@@ -997,6 +997,11 @@ struct ParallelInsertSliceOpInterface
     rewriter.eraseOp(op);
     return success();
   }
+
+  LogicalResult resolveConflicts(Operation *op, RewriterBase &rewriter,
+                                 const AnalysisState &state) const {
+    return success();
----------------
matthias-springer wrote:

This is incorrect and would break test cases such as:
```
func.func @reproducer(%f: f32, %num_threads: index, %idx: index) -> f32 {
  %0 = tensor.empty() : tensor<5xf32>
  %1 = linalg.fill ins(%f: f32) outs(%0: tensor<5xf32>) -> tensor<5xf32>
  %result = scf.forall (%thread_idx) in (%num_threads) shared_outs (%o = %1) -> tensor<5xf32> {
    %2 = tensor.extract_slice %o[%thread_idx][1][1] : tensor<5xf32> to tensor<1xf32>
    scf.forall.in_parallel {
      tensor.parallel_insert_slice %2 into %o[%thread_idx][1][1] : tensor<1xf32> into tensor<5xf32>
    }
  }

  %orig_use = tensor.extract %1[%idx] : tensor<5xf32>
  return %orig_use : f32
}
```
A copy must be interested here for the operand of `scf.forall`.


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


More information about the Mlir-commits mailing list