Proteus
Programmable JIT compilation and optimization for C/C++ using LLVM
Loading...
Searching...
No Matches
CompilerInterfaceDeviceInternal.h
Go to the documentation of this file.
3
4// Return "auto" should resolve to cudaError_t or hipError_t.
5inline auto __jit_launch_kernel_internal(void *Kernel, dim3 GridDim,
6 dim3 BlockDim, void **KernelArgs,
7 uint64_t ShmemSize, void *Stream) {
8
9 using namespace llvm;
10 using namespace proteus;
11
12 static const bool IsProteusDisabledEnvVar =
13 getEnvOrDefaultBool("PROTEUS_DISABLE", false);
14
15 if (IsProteusDisabledEnvVar) {
17 Kernel, GridDim, BlockDim, KernelArgs, ShmemSize,
18 static_cast<typename JitDeviceImplT::DeviceStream_t>(Stream));
19 }
20
21 auto &Jit = JitDeviceImplT::instance();
22 if (Jit.isProteusDisabled()) {
24 Kernel, GridDim, BlockDim, KernelArgs, ShmemSize,
25 static_cast<typename JitDeviceImplT::DeviceStream_t>(Stream));
26 }
27
28 auto OptionalKernelInfo = Jit.getJITKernelInfo(Kernel);
29 if (!OptionalKernelInfo) {
31 Kernel, GridDim, BlockDim, KernelArgs, ShmemSize,
32 static_cast<typename JitDeviceImplT::DeviceStream_t>(Stream));
33 }
34
35 auto &KernelInfo = OptionalKernelInfo.value().get();
36
37 if (Config::get().ProteusDebugOutput) {
38 Logger::logs("proteus") << "JIT Launch Kernel\n";
39 Logger::logs("proteus") << "=== Kernel Info\n";
40 Logger::logs("proteus") << "KernelName " << KernelInfo.getName() << "\n";
41 Logger::logs("proteus") << "Grid " << GridDim.x << ", " << GridDim.y << ", "
42 << GridDim.z << "\n";
43 Logger::logs("proteus") << "Block " << BlockDim.x << ", " << BlockDim.y
44 << ", " << BlockDim.z << "\n";
45 Logger::logs("proteus") << "KernelArgs " << KernelArgs << "\n";
46 Logger::logs("proteus") << "ShmemSize " << ShmemSize << "\n";
47 Logger::logs("proteus") << "Stream " << Stream << "\n";
48 Logger::logs("proteus") << "=== End Kernel Info\n";
49 }
50
51 return Jit.compileAndRun(
52 KernelInfo, GridDim, BlockDim, KernelArgs, ShmemSize,
53 static_cast<typename JitDeviceImplT::DeviceStream_t>(Stream));
54}
auto __jit_launch_kernel_internal(void *Kernel, dim3 GridDim, dim3 BlockDim, void **KernelArgs, uint64_t ShmemSize, void *Stream)
Definition CompilerInterfaceDeviceInternal.h:5
void * Kernel
Definition CompilerInterfaceDevice.cpp:54
JitEngineHost & Jit
Definition CompilerInterfaceHost.cpp:25
Definition CompiledLibrary.h:7
Definition MemoryCache.h:26
cudaError_t launchKernelDirect(void *KernelFunc, dim3 GridDim, dim3 BlockDim, void **KernelArgs, uint64_t ShmemSize, CUstream Stream)
Definition CoreDeviceCUDA.h:38