[all-commits] [llvm/llvm-project] 4a411e: [MLIR] Fix rewrite of ops with vector operands to ...

Benoit Jacob via All-commits all-commits at lists.llvm.org
Wed Feb 19 11:52:24 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4a411eb4ee673e2687d38fda16d6db6b907f37d2
      https://github.com/llvm/llvm-project/commit/4a411eb4ee673e2687d38fda16d6db6b907f37d2
  Author: Benoit Jacob <jacob.benoit.1 at gmail.com>
  Date:   2025-02-19 (Wed, 19 Feb 2025)

  Changed paths:
    M mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
    M mlir/lib/Conversion/GPUCommon/GPUOpsLowering.h
    M mlir/test/Conversion/MathToROCDL/math-to-rocdl.mlir

  Log Message:
  -----------
  [MLIR] Fix rewrite of ops with vector operands to LLVM on GPU (#127844)

There was a discrepancy between the type-converter and rewrite-pattern
parts of conversion to LLVM used in various GPU targets, at least ROCDL
and NVVM:
- The TypeConverter part was handling vectors of arbitrary rank,
converting them to nests of `!llvm.array< ... >` with a vector at the
inner-most dimension:
https://github.com/llvm/llvm-project/blob/8337d01e3058e7f47675f5b2b908b4e7821895d7/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp#L629-L655
- The rewrite pattern part was not handling `llvm.array`:
https://github.com/llvm/llvm-project/blob/8337d01e3058e7f47675f5b2b908b4e7821895d7/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp#L594-L596

That led to conversion failures when lowering `math` dialect ops on
rank-2 vectors, as in the testcase being added in this PR.

This PR fixes this by reusing a shared utility already used in other
conversions to LLVM:

https://github.com/llvm/llvm-project/blob/8337d01e3058e7f47675f5b2b908b4e7821895d7/mlir/lib/Conversion/LLVMCommon/VectorPattern.cpp#L80-L104

---------

Signed-off-by: Benoit Jacob <jacob.benoit.1 at gmail.com>



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