Skip to content

Commit d9ff9e3

Browse files
committed
Add convert-xevm-to-llvm pass.
Co-authored-by: Artem Kroviakov artem.kroviakov@intel.com
1 parent dc8e89b commit d9ff9e3

File tree

9 files changed

+816
-0
lines changed

9 files changed

+816
-0
lines changed

mlir/include/mlir/Conversion/Passes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
#include "mlir/Conversion/VectorToSCF/VectorToSCF.h"
8181
#include "mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h"
8282
#include "mlir/Conversion/VectorToXeGPU/VectorToXeGPU.h"
83+
#include "mlir/Conversion/XeVMToLLVM/XeVMToLLVM.h"
8384

8485
namespace mlir {
8586

mlir/include/mlir/Conversion/Passes.td

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,4 +1495,13 @@ def ConvertVectorToXeGPU : Pass<"convert-vector-to-xegpu"> {
14951495
];
14961496
}
14971497

1498+
//===----------------------------------------------------------------------===//
1499+
// XeVMToLLVM
1500+
//===----------------------------------------------------------------------===//
1501+
1502+
def ConvertXeVMToLLVMPass : Pass<"convert-xevm-to-llvm"> {
1503+
let summary = "Convert XeVM to LLVM dialect";
1504+
let dependentDialects = ["xevm::XeVMDialect", ];
1505+
}
1506+
14981507
#endif // MLIR_CONVERSION_PASSES
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//===-- XeVMToLLVM.h - Convert XeVM to LLVM dialect -------------*- C++ -*-===//
2+
//
3+
// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
#ifndef MLIR_CONVERSION_XEVMTOLLVM_XEVMTOLLVMPASS_H_
9+
#define MLIR_CONVERSION_XEVMTOLLVM_XEVMTOLLVMPASS_H_
10+
11+
#include <memory>
12+
13+
namespace mlir {
14+
class DialectRegistry;
15+
class LLVMTypeConverter;
16+
class RewritePatternSet;
17+
class Pass;
18+
} // namespace mlir
19+
20+
namespace mlir {
21+
#define GEN_PASS_DECL_CONVERTXEVMTOLLVMPASS
22+
#include "mlir/Conversion/Passes.h.inc"
23+
24+
void populateXeVMToLLVMConversionPatterns(RewritePatternSet &patterns);
25+
26+
void registerConvertXeVMToLLVMInterface(DialectRegistry &registry);
27+
} // namespace mlir
28+
29+
#endif // MLIR_CONVERSION_XEVMTOLLVM_XEVMTOLLVMPASS_H_

mlir/include/mlir/InitAllExtensions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "mlir/Conversion/SCFToEmitC/SCFToEmitC.h"
3333
#include "mlir/Conversion/UBToLLVM/UBToLLVM.h"
3434
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
35+
#include "mlir/Conversion/XeVMToLLVM/XeVMToLLVM.h"
3536
#include "mlir/Dialect/AMX/Transforms.h"
3637
#include "mlir/Dialect/Affine/TransformOps/AffineTransformOps.h"
3738
#include "mlir/Dialect/ArmNeon/TransformOps/ArmNeonVectorTransformOps.h"
@@ -90,6 +91,7 @@ inline void registerAllExtensions(DialectRegistry &registry) {
9091
gpu::registerConvertGpuToLLVMInterface(registry);
9192
NVVM::registerConvertGpuToNVVMInterface(registry);
9293
vector::registerConvertVectorToLLVMInterface(registry);
94+
registerConvertXeVMToLLVMInterface(registry);
9395

9496
// Register all transform dialect extensions.
9597
affine::registerTransformDialectExtension(registry);

mlir/lib/Conversion/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,4 @@ add_subdirectory(VectorToLLVM)
7373
add_subdirectory(VectorToSCF)
7474
add_subdirectory(VectorToSPIRV)
7575
add_subdirectory(VectorToXeGPU)
76+
add_subdirectory(XeVMToLLVM)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
add_mlir_conversion_library(MLIRXeVMToLLVM
2+
XeVMToLLVM.cpp
3+
4+
ADDITIONAL_HEADER_DIRS
5+
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/XeVMToLLVM
6+
7+
DEPENDS
8+
MLIRConversionPassIncGen
9+
10+
LINK_COMPONENTS
11+
Core
12+
13+
LINK_LIBS PUBLIC
14+
MLIRFuncDialect
15+
MLIRGPUDialect
16+
MLIRLLVMCommonConversion
17+
MLIRLLVMDialect
18+
MLIRXeVMDialect
19+
MLIRPass
20+
MLIRTransforms
21+
)

0 commit comments

Comments
 (0)