Skip to content

Conversation

@mshahneo
Copy link
Contributor

convert-vector-to-llvm pass applies a set of vector transformation patterns that are not included in the standard convert-to-llvm pass interface. These additional transformations are required to properly lower MLIR vector operations. Since not all vector ops have direct llvm dialect lowering, many of them must first be progressively rewritten into simpler or more canonical vector ops, which are then lowered to llvm. Therefore, running convert-vector-to-llvm is necessary to ensure a complete and correct lowering of vector operations to the llvm dialect.

Original PR: #166204 + post-commit failure fixes.

The `convert-vector-to-llvm` pass applies a set of vector transformation
patterns that are not included in the standard `convert-to-llvm` pass interface.
These additional transformations are required to properly lower
MLIR vector operations. Since not all vector ops have direct
`llvm` dialect lowering, many of them must first be progressively
rewritten into simpler or more canonical vector ops, which are then
lowered to `llvm`. Therefore, running `convert-vector-to-llvm` is
necessary to ensure a complete and correct lowering of vector operations
to the `llvm` dialect.
@llvmbot
Copy link
Member

llvmbot commented Nov 25, 2025

@llvm/pr-subscribers-mlir-gpu

Author: Md Abdullah Shahneous Bari (mshahneo)

Changes

convert-vector-to-llvm pass applies a set of vector transformation patterns that are not included in the standard convert-to-llvm pass interface. These additional transformations are required to properly lower MLIR vector operations. Since not all vector ops have direct llvm dialect lowering, many of them must first be progressively rewritten into simpler or more canonical vector ops, which are then lowered to llvm. Therefore, running convert-vector-to-llvm is necessary to ensure a complete and correct lowering of vector operations to the llvm dialect.

Original PR: #166204 + post-commit failure fixes.


Full diff: https://github.com/llvm/llvm-project/pull/169573.diff

2 Files Affected:

  • (modified) mlir/lib/Dialect/GPU/Pipelines/CMakeLists.txt (+1)
  • (modified) mlir/lib/Dialect/GPU/Pipelines/GPUToXeVMPipeline.cpp (+3)
diff --git a/mlir/lib/Dialect/GPU/Pipelines/CMakeLists.txt b/mlir/lib/Dialect/GPU/Pipelines/CMakeLists.txt
index ec68acfee7ef1..85b7b1ce90637 100644
--- a/mlir/lib/Dialect/GPU/Pipelines/CMakeLists.txt
+++ b/mlir/lib/Dialect/GPU/Pipelines/CMakeLists.txt
@@ -21,6 +21,7 @@ add_mlir_dialect_library(MLIRGPUPipelines
   MLIRNVVMToLLVM
   MLIRReconcileUnrealizedCasts
   MLIRSCFToControlFlow
+  MLIRVectorToLLVMPass
   MLIRVectorToSCF
   MLIRXeGPUTransforms
   MLIRXeGPUToXeVM
diff --git a/mlir/lib/Dialect/GPU/Pipelines/GPUToXeVMPipeline.cpp b/mlir/lib/Dialect/GPU/Pipelines/GPUToXeVMPipeline.cpp
index b097d3a0c9686..38313dc3c01d5 100644
--- a/mlir/lib/Dialect/GPU/Pipelines/GPUToXeVMPipeline.cpp
+++ b/mlir/lib/Dialect/GPU/Pipelines/GPUToXeVMPipeline.cpp
@@ -111,8 +111,11 @@ void buildPostGPUCommonPassPipeline(
     pm.addPass(createGpuToLLVMConversionPass(gpuToLLVMOptions));
   }
   pm.addPass(createLowerAffinePass());
+  pm.addPass(createConvertVectorToLLVMPass());
   pm.addPass(createConvertToLLVMPass());
   pm.addPass(createReconcileUnrealizedCastsPass());
+  pm.addNestedPass<gpu::GPUModuleOp>(createCanonicalizerPass());
+  pm.addNestedPass<gpu::GPUModuleOp>(createCSEPass());
   // gpu-module-to-binary
   {
     GpuModuleToBinaryPassOptions gpuToModuleBinOptions;

@llvmbot
Copy link
Member

llvmbot commented Nov 25, 2025

@llvm/pr-subscribers-mlir

Author: Md Abdullah Shahneous Bari (mshahneo)

Changes

convert-vector-to-llvm pass applies a set of vector transformation patterns that are not included in the standard convert-to-llvm pass interface. These additional transformations are required to properly lower MLIR vector operations. Since not all vector ops have direct llvm dialect lowering, many of them must first be progressively rewritten into simpler or more canonical vector ops, which are then lowered to llvm. Therefore, running convert-vector-to-llvm is necessary to ensure a complete and correct lowering of vector operations to the llvm dialect.

Original PR: #166204 + post-commit failure fixes.


Full diff: https://github.com/llvm/llvm-project/pull/169573.diff

2 Files Affected:

  • (modified) mlir/lib/Dialect/GPU/Pipelines/CMakeLists.txt (+1)
  • (modified) mlir/lib/Dialect/GPU/Pipelines/GPUToXeVMPipeline.cpp (+3)
diff --git a/mlir/lib/Dialect/GPU/Pipelines/CMakeLists.txt b/mlir/lib/Dialect/GPU/Pipelines/CMakeLists.txt
index ec68acfee7ef1..85b7b1ce90637 100644
--- a/mlir/lib/Dialect/GPU/Pipelines/CMakeLists.txt
+++ b/mlir/lib/Dialect/GPU/Pipelines/CMakeLists.txt
@@ -21,6 +21,7 @@ add_mlir_dialect_library(MLIRGPUPipelines
   MLIRNVVMToLLVM
   MLIRReconcileUnrealizedCasts
   MLIRSCFToControlFlow
+  MLIRVectorToLLVMPass
   MLIRVectorToSCF
   MLIRXeGPUTransforms
   MLIRXeGPUToXeVM
diff --git a/mlir/lib/Dialect/GPU/Pipelines/GPUToXeVMPipeline.cpp b/mlir/lib/Dialect/GPU/Pipelines/GPUToXeVMPipeline.cpp
index b097d3a0c9686..38313dc3c01d5 100644
--- a/mlir/lib/Dialect/GPU/Pipelines/GPUToXeVMPipeline.cpp
+++ b/mlir/lib/Dialect/GPU/Pipelines/GPUToXeVMPipeline.cpp
@@ -111,8 +111,11 @@ void buildPostGPUCommonPassPipeline(
     pm.addPass(createGpuToLLVMConversionPass(gpuToLLVMOptions));
   }
   pm.addPass(createLowerAffinePass());
+  pm.addPass(createConvertVectorToLLVMPass());
   pm.addPass(createConvertToLLVMPass());
   pm.addPass(createReconcileUnrealizedCastsPass());
+  pm.addNestedPass<gpu::GPUModuleOp>(createCanonicalizerPass());
+  pm.addNestedPass<gpu::GPUModuleOp>(createCSEPass());
   // gpu-module-to-binary
   {
     GpuModuleToBinaryPassOptions gpuToModuleBinOptions;

@mshahneo mshahneo merged commit 23f9030 into llvm:main Nov 26, 2025
13 checks passed
tanji-dg pushed a commit to tanji-dg/llvm-project that referenced this pull request Nov 27, 2025
…-vector-to-llvm`. (llvm#169573)

`convert-vector-to-llvm` pass applies a set of vector transformation
patterns that are not included in the standard `convert-to-llvm` pass
interface. These additional transformations are required to properly
lower MLIR vector operations. Since not all vector ops have direct
`llvm` dialect lowering, many of them must first be progressively
rewritten into simpler or more canonical vector ops, which are then
lowered to `llvm`. Therefore, running `convert-vector-to-llvm` is
necessary to ensure a complete and correct lowering of vector operations
to the `llvm` dialect.

Original PR: llvm#166204 +
post-commit failure fixes.
GeneraluseAI pushed a commit to GeneraluseAI/llvm-project that referenced this pull request Nov 27, 2025
…-vector-to-llvm`. (llvm#169573)

`convert-vector-to-llvm` pass applies a set of vector transformation
patterns that are not included in the standard `convert-to-llvm` pass
interface. These additional transformations are required to properly
lower MLIR vector operations. Since not all vector ops have direct
`llvm` dialect lowering, many of them must first be progressively
rewritten into simpler or more canonical vector ops, which are then
lowered to `llvm`. Therefore, running `convert-vector-to-llvm` is
necessary to ensure a complete and correct lowering of vector operations
to the `llvm` dialect.

Original PR: llvm#166204 +
post-commit failure fixes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants