Skip to content

Commit 61d4694

Browse files
authored
[XeGPUToXeVM] Add SIMT 4k GEMM e2e test. (#1077)
1 parent 199a45f commit 61d4694

File tree

7 files changed

+601
-7
lines changed

7 files changed

+601
-7
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
From 2e17b18af9fe6c10ea4cc87c864ebaaa94d41c18 Mon Sep 17 00:00:00 2001
2+
From: Charitha Saumya <[email protected]>
3+
Date: Tue, 20 May 2025 00:12:00 +0000
4+
Subject: [PATCH] add mem copy support in sycl runtime
5+
6+
---
7+
mlir/lib/ExecutionEngine/SyclRuntimeWrappers.cpp | 9 ++++++++-
8+
1 file changed, 8 insertions(+), 1 deletion(-)
9+
10+
diff --git a/mlir/lib/ExecutionEngine/SyclRuntimeWrappers.cpp b/mlir/lib/ExecutionEngine/SyclRuntimeWrappers.cpp
11+
index c250340c38fc..5ed9e3871f60 100644
12+
--- a/mlir/lib/ExecutionEngine/SyclRuntimeWrappers.cpp
13+
+++ b/mlir/lib/ExecutionEngine/SyclRuntimeWrappers.cpp
14+
@@ -149,7 +149,6 @@ static void launchKernel(sycl::queue *queue, sycl::kernel *kernel, size_t gridX,
15+
// Wrappers
16+
17+
extern "C" SYCL_RUNTIME_EXPORT sycl::queue *mgpuStreamCreate() {
18+
-
19+
return catchAll([&]() {
20+
sycl::queue *queue =
21+
new sycl::queue(getDefaultContext(), getDefaultDevice());
22+
@@ -168,6 +167,14 @@ mgpuMemAlloc(uint64_t size, sycl::queue *queue, bool isShared) {
23+
});
24+
}
25+
26+
+extern "C" SYCL_RUNTIME_EXPORT void
27+
+mgpuMemcpy(void *dst, void *src, size_t sizeBytes, sycl::queue *queue) {
28+
+ catchAll([&]() {
29+
+ // TODO: Add support for async copy
30+
+ queue->memcpy(dst, src, sizeBytes).wait();
31+
+ });
32+
+}
33+
+
34+
extern "C" SYCL_RUNTIME_EXPORT void mgpuMemFree(void *ptr, sycl::queue *queue) {
35+
catchAll([&]() {
36+
if (ptr) {
37+
--
38+
2.34.1

lib/Conversion/XeGPUToXeVM/XeGPUToXeVM.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,12 @@ class LoadStorePrefetchNdToXeVMPattern : public OpConversionPattern<OpType> {
274274

275275
auto tileW = tdescTy.getDimSize(1);
276276
auto tileH = tdescTy.getDimSize(0);
277-
int32_t vblocks = 1;
278-
if (elemBitSize == 16) {
279-
vblocks = (tileW + 16 - 1) / 16;
280-
tileW = 16;
281-
}
277+
int32_t vblocks = tdescTy.getArrayLength();
278+
// TODO: Why is vblocks calculated like this?
279+
// if (elemBitSize == 16) {
280+
// vblocks = (tileW + 16 - 1) / 16;
281+
// tileW = 16;
282+
// }
282283

283284
if constexpr (std::is_same_v<OpType, StoreNdOp>) {
284285
VectorType srcVecTy = cast<VectorType>(op.getValue().getType());

test/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ if(IMEX_ENABLE_VULKAN_RUNNER)
4646
)
4747
endif()
4848

49+
if(IMEX_ENABLE_SYCL_RUNTIME)
50+
list(APPEND IMEX_TEST_DEPENDS
51+
mlir_sycl_runtime
52+
)
53+
endif()
54+
4955
if(IMEX_ENABLE_SYCL_RUNTIME)
5056
list(APPEND IMEX_TEST_DEPENDS
5157
sycl-runtime

test/Integration/Dialect/XeGPUToXeVM/gemm_4kx4kx4k_f16_f16_f16_simt.mlir

Lines changed: 541 additions & 0 deletions
Large diffs are not rendered by default.

test/Integration/Dialect/XeGPUToXeVM/xegpu-to-llvm.pp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@
77
convert-xevm-to-llvm
88
cse
99
)
10+
reconcile-unrealized-casts
11+
convert-vector-to-scf
1012
convert-scf-to-cf
13+
expand-strided-metadata
14+
finalize-memref-to-llvm
1115
convert-cf-to-llvm
1216
convert-vector-to-llvm
1317
convert-arith-to-llvm
14-
expand-strided-metadata
15-
finalize-memref-to-llvm
18+
convert-index-to-llvm
19+
convert-func-to-llvm
20+
convert-math-to-llvm
1621
gpu-to-llvm
22+
lower-affine
1723
reconcile-unrealized-casts
1824
cse
1925
gpu-module-to-binary)

test/lit.cfg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
config.substitutions.append(('%imex_runner', config.imex_runner))
4141
config.substitutions.append(('%python_executable', config.python_executable))
4242
if config.imex_enable_sycl_runtime:
43+
config.substitutions.append(('%mlir_sycl_runtime', config.mlir_sycl_runtime))
4344
config.substitutions.append(('%sycl_runtime', config.sycl_runtime))
4445
if config.imex_enable_l0_runtime:
4546
config.substitutions.append(('%levelzero_runtime', config.levelzero_runtime))

test/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ config.mlir_c_runner_utils = os.path.normpath(os.path.join(config.mlir_runner_ut
5353
if config.enable_vulkan_runner:
5454
config.vulkan_runtime_wrappers = os.path.normpath(os.path.join(config.mlir_runner_utils_dir, config.shlib_prefix + "vulkan-runtime-wrappers" + config.llvm_shlib_ext))
5555
if config.imex_enable_sycl_runtime:
56+
config.mlir_sycl_runtime = os.path.normpath(os.path.join(config.mlir_runner_utils_dir, config.shlib_prefix + "mlir_sycl_runtime" + config.llvm_shlib_ext))
5657
config.sycl_runtime = os.path.normpath(os.path.join(config.imex_lib_dir, config.shlib_prefix + "sycl-runtime" + config.llvm_shlib_ext))
5758
if config.imex_enable_l0_runtime:
5859
config.levelzero_runtime = os.path.normpath(os.path.join(config.imex_lib_dir, config.shlib_prefix + "level-zero-runtime" + config.llvm_shlib_ext))

0 commit comments

Comments
 (0)