Skip to content

Commit 6166fda

Browse files
authored
[MLIR][Conversion][XeGPU][XeVM] Add XeGPUToXeVM conversion pass and tests. (#154556)
Add XeGPU to XeVM conversion pass and tests.
1 parent 47f0fb9 commit 6166fda

File tree

14 files changed

+1664
-0
lines changed

14 files changed

+1664
-0
lines changed

mlir/include/mlir/Conversion/Passes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
#include "mlir/Conversion/VectorToSCF/VectorToSCF.h"
8383
#include "mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h"
8484
#include "mlir/Conversion/VectorToXeGPU/VectorToXeGPU.h"
85+
#include "mlir/Conversion/XeGPUToXeVM/XeGPUToXeVM.h"
8586
#include "mlir/Conversion/XeVMToLLVM/XeVMToLLVM.h"
8687

8788
namespace mlir {

mlir/include/mlir/Conversion/Passes.td

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,4 +1555,16 @@ def ConvertXeVMToLLVMPass : Pass<"convert-xevm-to-llvm"> {
15551555
let dependentDialects = ["LLVM::LLVMDialect"];
15561556
}
15571557

1558+
//===----------------------------------------------------------------------===//
1559+
// XeGPUToXeVM
1560+
//===----------------------------------------------------------------------===//
1561+
1562+
def ConvertXeGPUToXeVMPass : Pass<"convert-xegpu-to-xevm"> {
1563+
let summary = "Convert XeGPU to XeVM dialect";
1564+
let dependentDialects = ["xevm::XeVMDialect", "vector::VectorDialect",
1565+
"memref::MemRefDialect", "arith::ArithDialect",
1566+
"LLVM::LLVMDialect", "index::IndexDialect",
1567+
"gpu::GPUDialect", "scf::SCFDialect"];
1568+
}
1569+
15581570
#endif // MLIR_CONVERSION_PASSES
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//===-- XeGPUToXeVM.h - Convert XeGPU to XeVM 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_XEGPUTOXEVM_XEGPUTOXEVM_H_
9+
#define MLIR_CONVERSION_XEGPUTOXEVM_XEGPUTOXEVM_H_
10+
11+
#include <memory>
12+
13+
namespace mlir {
14+
class DialectRegistry;
15+
class LLVMTypeConverter;
16+
class RewritePatternSet;
17+
class Pass;
18+
19+
#define GEN_PASS_DECL_CONVERTXEGPUTOXEVMPASS
20+
#include "mlir/Conversion/Passes.h.inc"
21+
22+
void populateXeGPUToXeVMConversionPatterns(
23+
const LLVMTypeConverter &typeConverter, RewritePatternSet &patterns);
24+
25+
} // namespace mlir
26+
27+
#endif // MLIR_CONVERSION_XEGPUTOXEVM_XEGPUTOXEVM_H_

mlir/lib/Conversion/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,4 @@ add_subdirectory(VectorToSCF)
7676
add_subdirectory(VectorToSPIRV)
7777
add_subdirectory(VectorToXeGPU)
7878
add_subdirectory(XeVMToLLVM)
79+
add_subdirectory(XeGPUToXeVM)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
add_mlir_conversion_library(MLIRXeGPUToXeVM
2+
XeGPUToXeVM.cpp
3+
4+
ADDITIONAL_HEADER_DIRS
5+
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/XeGPUToXeVM
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+
MLIRVectorDialect
20+
MLIRArithDialect
21+
MLIRIndexDialect
22+
MLIRXeGPUDialect
23+
MLIRPass
24+
MLIRTransforms
25+
)

0 commit comments

Comments
 (0)