Skip to content

Commit

Permalink
[Depend-intel#333] Convert a subset of GPU dialect ops to the GPU Ope…
Browse files Browse the repository at this point in the history
…nCL runtime calls
  • Loading branch information
AndreyPavlenko committed Sep 15, 2024
1 parent bd49e3a commit 8635ad2
Show file tree
Hide file tree
Showing 4 changed files with 569 additions and 0 deletions.
29 changes: 29 additions & 0 deletions include/gc/ExecutionEngine/GPURuntime/GpuOclRuntime.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//===-- GpuOclRuntime.h - GPU OpenCL runtime --------------------*- C++ -*-===//
//
// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef GC_GPUOCLRUNTIME_H
#define GC_GPUOCLRUNTIME_H

namespace mlir::gc::gpu {
constexpr char GPU_OCL_MALLOC[] = "gcGpuOclMalloc";
constexpr char GPU_OCL_DEALLOC[] = "gcGpuOclDealloc";
constexpr char GPU_OCL_MEMCPY[] = "gcGpuOclMemcpy";
constexpr char GPU_OCL_KERNEL_CREATE[] = "gcGpuOclKernelCreate";
constexpr char GPU_OCL_KERNEL_DESTROY[] = "gcGpuOclKernelDestroy";
constexpr char GPU_OCL_KERNEL_LAUNCH[] = "gcGpuOclKernelLaunch";
constexpr char GPU_OCL_MOD_DESTRUCTOR[] = "gcGpuOclModuleDestructor";
} // namespace mlir::gc::gpu

#ifndef GC_GPU_OCL_CONST_ONLY

// TBD

#else
#undef GC_GPU_OCL_CONST_ONLY
#endif
#endif
7 changes: 7 additions & 0 deletions include/gc/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ def LinalgToXeGPU : Pass<"linalg-to-xegpu", "func::FuncOp"> {
"DPAS register block sizes MxNxK">,
];
}

def GpuToGpuOcl : Pass<"gpu-to-gpuocl", "ModuleOp"> {
let summary = "Convert the GPU operations to GpuOclRuntime calls.";
let description = [{
Convert the gpu alloc, dealloc, memcpy and launch operations to GpuOclRuntime calls.
}];
}
#endif // GC_USE_IMEX

def IterativeTilingAndFusion : Pass<"iterative-tiling-and-fusion",
Expand Down
1 change: 1 addition & 0 deletions lib/gc/Transforms/GPU/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gc_add_mlir_library(GcGpuPasses
GpuToGpuOcl.cpp
LinalgToXeGPU.cpp

DEPENDS
Expand Down
Loading

0 comments on commit 8635ad2

Please sign in to comment.