MCPcopy Create free account
hub / github.com/AdaptiveCpp/AdaptiveCpp / launch_kernel_from_module

Function launch_kernel_from_module

src/runtime/cuda/cuda_queue.cpp:181–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179};
180
181result launch_kernel_from_module(CUmodule module,
182 std::string_view kernel_name,
183 const rt::range<3> &grid_size,
184 const rt::range<3> &block_size,
185 unsigned shared_memory, cudaStream_t stream,
186 void **kernel_args) {
187 CUfunction f;
188 CUresult err = cuModuleGetFunction(&f, module, kernel_name.data());
189
190 if (err != CUDA_SUCCESS) {
191 return make_error(__acpp_here(),
192 error_info{"cuda_queue: could not extract kernel from module",
193 error_code{"CU", static_cast<int>(err)}});
194 }
195
196 err = cuLaunchKernel(f, static_cast<unsigned>(grid_size.get(0)),
197 static_cast<unsigned>(grid_size.get(1)),
198 static_cast<unsigned>(grid_size.get(2)),
199 static_cast<unsigned>(block_size.get(0)),
200 static_cast<unsigned>(block_size.get(1)),
201 static_cast<unsigned>(block_size.get(2)),
202 shared_memory, stream, kernel_args, nullptr);
203
204 if (err != CUDA_SUCCESS) {
205 return make_error(__acpp_here(),
206 error_info{"cuda_queue: could not submit kernel from module",
207 error_code{"CU", static_cast<int>(err)}});
208 }
209
210 return make_success();
211}
212}
213
214

Calls 3

make_errorFunction · 0.85
make_successFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected