[all-commits] [llvm/llvm-project] 7994b1: [mlir][Transforms] Dialect Conversion: Resolve ins...

Matthias Springer via All-commits all-commits at lists.llvm.org
Sat Jun 15 04:39:11 PDT 2024


  Branch: refs/heads/users/matthias-springer/dialect_conv_mat_ip
  Home:   https://github.com/llvm/llvm-project
  Commit: 7994b15e031fa9cff2aba976430d4f3da621b023
      https://github.com/llvm/llvm-project/commit/7994b15e031fa9cff2aba976430d4f3da621b023
  Author: Matthias Springer <mspringer at nvidia.com>
  Date:   2024-06-15 (Sat, 15 Jun 2024)

  Changed paths:
    M mlir/lib/Transforms/Utils/DialectConversion.cpp
    M mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
    M mlir/test/Conversion/ArithToLLVM/convert-nd-vector-to-llvmir.mlir
    M mlir/test/Conversion/ArithToSPIRV/arith-to-spirv.mlir
    M mlir/test/Conversion/IndexToLLVM/index-to-llvm.mlir
    M mlir/test/Conversion/IndexToSPIRV/index-to-spirv.mlir
    M mlir/test/Conversion/MathToSPIRV/math-to-core-spirv.mlir
    M mlir/test/Conversion/MemRefToLLVM/convert-dynamic-memref-ops.mlir
    M mlir/test/Conversion/MemRefToLLVM/convert-static-memref-ops.mlir
    M mlir/test/Conversion/MemRefToLLVM/memref-to-llvm.mlir
    M mlir/test/Conversion/MemRefToSPIRV/bitwidth-emulation.mlir
    M mlir/test/Conversion/MemRefToSPIRV/memref-to-spirv.mlir
    M mlir/test/Conversion/NVGPUToNVVM/nvgpu-to-nvvm.mlir
    M mlir/test/Conversion/VectorToLLVM/vector-scalable-memcpy.mlir
    M mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir
    M mlir/test/Conversion/VectorToSPIRV/vector-to-spirv.mlir
    M mlir/test/Dialect/SCF/bufferize.mlir
    M mlir/test/Dialect/Vector/linearize.mlir

  Log Message:
  -----------
  [mlir][Transforms] Dialect Conversion: Resolve insertion point TODO

Remove a TODO in the dialect conversion code base when materializing unresolved conversions:
```
// FIXME: Determine a suitable insertion location when there are multiple
// inputs.
```

The implementation used to select an insertion point as follows:
- If the cast has exactly one operand: right after the definition of the SSA value.
- Otherwise: right before the cast op.

However, it is not necessary to change the insertion point. Unresolved materializations (`UnrealizedConversionCastOp`) are built during `buildUnresolvedArgumentMaterialization` or `buildUnresolvedTargetMaterialization`. In the former case, the op is inserted at the beginning of the block. In the latter case, only one operand is supported in the dialect conversion, and the op is inserted right after the definition of the SSA value. I.e., the `UnrealizedConversionCastOp` is already inserted at the right place and it is not necessary to change the insertion point for the resolved materialization op.

Note: The IR change changes slightly because the `unrealized_conversion_cast` ops at the beginning of a block are no longer doubly-inverted (by setting the insertion to the beginning of the block when inserting the `unrealized_conversion_cast` and again when inserting the resolved conversion op). All affected test cases were fixed by using `CHECK-DAG` instead of `CHECK`.

Also improve the quality of multiple test cases that did not check for the correct operands.

Note: This commit is in preparation of decoupling the argument/source/target materialization logic of the type converter from the dialect conversion (to reduce its complexity and make that functionality usable from a new dialect conversion driver).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list