Skip to content

Commit

Permalink
Fixed ptx kernel crash
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanming-hu committed Oct 22, 2019
1 parent 9dbd5d4 commit af3cdd9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lang/src/backends/llvm_ptx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class CodeGenLLVMGPU : public CodeGenLLVM {

CodeGenLLVMGPU(CodeGenBase *codegen_base, Kernel *kernel)
: CodeGenLLVM(codegen_base, kernel) {
kernel_grid_dim = 1;
kernel_block_dim = 1;
}

FunctionType compile_module_to_executable() override {
Expand Down Expand Up @@ -66,9 +68,10 @@ class CodeGenLLVMGPU : public CodeGenLLVM {

auto ptx = compile_module_to_ptx(module);
auto cuda_kernel = cuda_context.compile(ptx, kernel_name);
return [=](Context context) {
cuda_context.launch(cuda_kernel, &context, kernel_grid_dim,
kernel_block_dim);
auto grid_dim = kernel_grid_dim;
auto block_dim = kernel_block_dim;
return [grid_dim, block_dim, cuda_kernel](Context context) {
cuda_context.launch(cuda_kernel, &context, grid_dim, block_dim);
};
#else
TC_NOT_IMPLEMENTED;
Expand Down

0 comments on commit af3cdd9

Please sign in to comment.