Skip to content

Commit

Permalink
[LLVMCPU] Populate index to LLVM conversion patterns (iree-org#17886)
Browse files Browse the repository at this point in the history
The index dialect provides some operations on index types missing from
arith (so would otherwise need casting to a specific type), which can be
more convenient to use in rewrites.

Signed-off-by: Benjamin Maxwell <benjamin.maxwell@arm.com>
  • Loading branch information
MacDue authored Jul 15, 2024
1 parent 5943426 commit 7dafb0e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/src/iree/compiler/Codegen/LLVMCPU/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ iree_compiler_cc_library(
"@llvm-project//mlir:FuncTransforms",
"@llvm-project//mlir:FunctionInterfaces",
"@llvm-project//mlir:IR",
"@llvm-project//mlir:IndexToLLVM",
"@llvm-project//mlir:LLVMCommonConversion",
"@llvm-project//mlir:LLVMDialect",
"@llvm-project//mlir:LinalgDialect",
Expand Down
1 change: 1 addition & 0 deletions compiler/src/iree/compiler/Codegen/LLVMCPU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ iree_cc_library(
MLIRFuncTransforms
MLIRFunctionInterfaces
MLIRIR
MLIRIndexToLLVM
MLIRLLVMCommonConversion
MLIRLLVMDialect
MLIRLinalgDialect
Expand Down
2 changes: 2 additions & 0 deletions compiler/src/iree/compiler/Codegen/LLVMCPU/ConvertToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h"
#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h"
#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h"
#include "mlir/Conversion/IndexToLLVM/IndexToLLVM.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/LoweringOptions.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
Expand Down Expand Up @@ -1048,6 +1049,7 @@ void ConvertToLLVMPass::runOnOperation() {
populateFuncToLLVMConversionPatterns(typeConverter, patterns);
arith::populateArithToLLVMConversionPatterns(typeConverter, patterns);
arith::populateExpandBFloat16Patterns(patterns);
index::populateIndexToLLVMConversionPatterns(typeConverter, patterns);
populateVectorToSCFConversionPatterns(patterns);
// Some n-D vectors are generated by EmulateNarrowType pass, so we need to
// unroll them to 1-D before converting to the LLVM dialect.
Expand Down

0 comments on commit 7dafb0e

Please sign in to comment.