Skip to content

Commit d74d00f

Browse files
[Depend-intel#333] Convert a subset of GPU dialect ops to the GPU OpenCL runtime calls
1 parent c94a772 commit d74d00f

File tree

4 files changed

+577
-0
lines changed

4 files changed

+577
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//===-- GpuOclRuntime.h - GPU OpenCL runtime --------------------*- 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+
9+
#ifndef GC_GPUOCLRUNTIME_H
10+
#define GC_GPUOCLRUNTIME_H
11+
12+
namespace mlir::gc::gpu {
13+
constexpr char GPU_OCL_MALLOC[] = "gcGpuOclMalloc";
14+
constexpr char GPU_OCL_DEALLOC[] = "gcGpuOclDealloc";
15+
constexpr char GPU_OCL_MEMCPY[] = "gcGpuOclMemcpy";
16+
constexpr char GPU_OCL_KERNEL_CREATE[] = "gcGpuOclKernelCreate";
17+
constexpr char GPU_OCL_KERNEL_DESTROY[] = "gcGpuOclKernelDestroy";
18+
constexpr char GPU_OCL_KERNEL_LAUNCH[] = "gcGpuOclKernelLaunch";
19+
constexpr char GPU_OCL_MOD_DESTRUCTOR[] = "gcGpuOclModuleDestructor";
20+
} // namespace mlir::gc::gpu
21+
22+
#ifndef GC_GPU_OCL_CONST_ONLY
23+
24+
// TBD
25+
26+
#else
27+
#undef GC_GPU_OCL_CONST_ONLY
28+
#endif
29+
#endif

include/gc/Transforms/Passes.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ def LinalgToXeGPU : Pass<"linalg-to-xegpu", "func::FuncOp"> {
9393
"DPAS register block sizes MxNxK">,
9494
];
9595
}
96+
97+
def GpuToGpuOcl : Pass<"gpu-to-gpuocl", "ModuleOp"> {
98+
let summary = "Convert the GPU operations to GpuOclRuntime calls.";
99+
let description = [{
100+
Convert the gpu alloc, dealloc, memcpy and launch operations to GpuOclRuntime calls.
101+
}];
102+
}
96103
#endif // GC_USE_IMEX
97104

98105
def IterativeTilingAndFusion : Pass<"iterative-tiling-and-fusion",

lib/gc/Transforms/GPU/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
gc_add_mlir_library(GcGpuPasses
2+
GpuToGpuOcl.cpp
23
LinalgToXeGPU.cpp
34
Pipeline.cpp
45

0 commit comments

Comments
 (0)