1d275d636SJeremy L Thompson // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and other CEED contributors. 2c9c2c079SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3c9c2c079SJeremy L Thompson // 4c9c2c079SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 5c9c2c079SJeremy L Thompson // 6c9c2c079SJeremy L Thompson // This file is part of CEED: http://github.com/ceed 7c9c2c079SJeremy L Thompson 82b730f8bSJeremy L Thompson #include "ceed-cuda-compile.h" 92b730f8bSJeremy L Thompson 1049aac155SJeremy L Thompson #include <ceed.h> 11c9c2c079SJeremy L Thompson #include <ceed/backend.h> 12c9c2c079SJeremy L Thompson #include <ceed/jit-tools.h> 13c9c2c079SJeremy L Thompson #include <cuda_runtime.h> 14c9c2c079SJeremy L Thompson #include <nvrtc.h> 15c9c2c079SJeremy L Thompson #include <stdarg.h> 16c9c2c079SJeremy L Thompson #include <string.h> 172b730f8bSJeremy L Thompson 182b730f8bSJeremy L Thompson #include <sstream> 192b730f8bSJeremy L Thompson 20c9c2c079SJeremy L Thompson #include "ceed-cuda-common.h" 21c9c2c079SJeremy L Thompson 22c9c2c079SJeremy L Thompson #define CeedChk_Nvrtc(ceed, x) \ 23c9c2c079SJeremy L Thompson do { \ 24c9c2c079SJeremy L Thompson nvrtcResult result = static_cast<nvrtcResult>(x); \ 252b730f8bSJeremy L Thompson if (result != NVRTC_SUCCESS) return CeedError((ceed), CEED_ERROR_BACKEND, nvrtcGetErrorString(result)); \ 26c9c2c079SJeremy L Thompson } while (0) 27c9c2c079SJeremy L Thompson 282b730f8bSJeremy L Thompson #define CeedCallNvrtc(ceed, ...) \ 292b730f8bSJeremy L Thompson do { \ 302b730f8bSJeremy L Thompson int ierr_q_ = __VA_ARGS__; \ 312b730f8bSJeremy L Thompson CeedChk_Nvrtc(ceed, ierr_q_); \ 326574a04fSJeremy L Thompson } while (0) 332b730f8bSJeremy L Thompson 34c9c2c079SJeremy L Thompson //------------------------------------------------------------------------------ 35c9c2c079SJeremy L Thompson // Compile CUDA kernel 36c9c2c079SJeremy L Thompson //------------------------------------------------------------------------------ 37ddae5012SJeremy L Thompson static int CeedCompileCore_Cuda(Ceed ceed, const char *source, const bool throw_error, bool *is_compile_good, CUmodule *module, 38ddae5012SJeremy L Thompson const CeedInt num_defines, va_list args) { 39ca735530SJeremy L Thompson size_t ptx_size; 4022070f95SJeremy L Thompson char *ptx; 41a491a57eSJeremy L Thompson const int num_opts = 4; 424753b775SJeremy L Thompson CeedInt num_jit_source_dirs = 0, num_jit_defines = 0; 43b13efd58SJeremy L Thompson const char **opts; 44c9c2c079SJeremy L Thompson nvrtcProgram prog; 45ca735530SJeremy L Thompson struct cudaDeviceProp prop; 46ca735530SJeremy L Thompson Ceed_Cuda *ceed_data; 47ca735530SJeremy L Thompson 48ca735530SJeremy L Thompson cudaFree(0); // Make sure a Context exists for nvrtc 49c9c2c079SJeremy L Thompson 50c9c2c079SJeremy L Thompson std::ostringstream code; 51c9c2c079SJeremy L Thompson 52c9c2c079SJeremy L Thompson // Get kernel specific options, such as kernel constants 53c9c2c079SJeremy L Thompson if (num_defines > 0) { 54c9c2c079SJeremy L Thompson char *name; 55c9c2c079SJeremy L Thompson int val; 56ca735530SJeremy L Thompson 57c9c2c079SJeremy L Thompson for (int i = 0; i < num_defines; i++) { 58c9c2c079SJeremy L Thompson name = va_arg(args, char *); 59c9c2c079SJeremy L Thompson val = va_arg(args, int); 60c9c2c079SJeremy L Thompson code << "#define " << name << " " << val << "\n"; 61c9c2c079SJeremy L Thompson } 62c9c2c079SJeremy L Thompson } 63c9c2c079SJeremy L Thompson 64c9c2c079SJeremy L Thompson // Standard libCEED definitions for CUDA backends 6591adc9c8SJeremy L Thompson code << "#include <ceed/jit-source/cuda/cuda-jit.h>\n\n"; 66c9c2c079SJeremy L Thompson 67c9c2c079SJeremy L Thompson // Non-macro options 68b13efd58SJeremy L Thompson CeedCallBackend(CeedCalloc(num_opts, &opts)); 69c9c2c079SJeremy L Thompson opts[0] = "-default-device"; 702b730f8bSJeremy L Thompson CeedCallBackend(CeedGetData(ceed, &ceed_data)); 712b730f8bSJeremy L Thompson CeedCallCuda(ceed, cudaGetDeviceProperties(&prop, ceed_data->device_id)); 7229ec485eSJed Brown std::string arch_arg = 7329ec485eSJed Brown #if CUDA_VERSION >= 11010 7429ec485eSJed Brown // NVRTC used to support only virtual architectures through the option 7529ec485eSJed Brown // -arch, since it was only emitting PTX. It will now support actual 7629ec485eSJed Brown // architectures as well to emit SASS. 7729ec485eSJed Brown // https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/index.html#dynamic-code-generation 7829ec485eSJed Brown "-arch=sm_" 7929ec485eSJed Brown #else 8029ec485eSJed Brown "-arch=compute_" 8129ec485eSJed Brown #endif 8229ec485eSJed Brown + std::to_string(prop.major) + std::to_string(prop.minor); 83c9c2c079SJeremy L Thompson opts[1] = arch_arg.c_str(); 84c9c2c079SJeremy L Thompson opts[2] = "-Dint32_t=int"; 85a491a57eSJeremy L Thompson opts[3] = "-DCEED_RUNNING_JIT_PASS=1"; 864753b775SJeremy L Thompson // Additional include dirs 87b13efd58SJeremy L Thompson { 88b13efd58SJeremy L Thompson const char **jit_source_dirs; 89b13efd58SJeremy L Thompson 90b13efd58SJeremy L Thompson CeedCallBackend(CeedGetJitSourceRoots(ceed, &num_jit_source_dirs, &jit_source_dirs)); 91b13efd58SJeremy L Thompson CeedCallBackend(CeedRealloc(num_opts + num_jit_source_dirs, &opts)); 92b13efd58SJeremy L Thompson for (CeedInt i = 0; i < num_jit_source_dirs; i++) { 934753b775SJeremy L Thompson std::ostringstream include_dir_arg; 94b13efd58SJeremy L Thompson 954753b775SJeremy L Thompson include_dir_arg << "-I" << jit_source_dirs[i]; 964753b775SJeremy L Thompson CeedCallBackend(CeedStringAllocCopy(include_dir_arg.str().c_str(), (char **)&opts[num_opts + i])); 97b13efd58SJeremy L Thompson } 98b13efd58SJeremy L Thompson CeedCallBackend(CeedRestoreJitSourceRoots(ceed, &jit_source_dirs)); 99b13efd58SJeremy L Thompson } 1004753b775SJeremy L Thompson // User defines 1014753b775SJeremy L Thompson { 1024753b775SJeremy L Thompson const char **jit_defines; 1034753b775SJeremy L Thompson 1044753b775SJeremy L Thompson CeedCallBackend(CeedGetJitDefines(ceed, &num_jit_defines, &jit_defines)); 1054753b775SJeremy L Thompson CeedCallBackend(CeedRealloc(num_opts + num_jit_source_dirs + num_jit_defines, &opts)); 1064753b775SJeremy L Thompson for (CeedInt i = 0; i < num_jit_defines; i++) { 1074753b775SJeremy L Thompson std::ostringstream define_arg; 1084753b775SJeremy L Thompson 1094753b775SJeremy L Thompson define_arg << "-D" << jit_defines[i]; 1104753b775SJeremy L Thompson CeedCallBackend(CeedStringAllocCopy(define_arg.str().c_str(), (char **)&opts[num_opts + num_jit_source_dirs + i])); 1114753b775SJeremy L Thompson } 1124753b775SJeremy L Thompson CeedCallBackend(CeedRestoreJitDefines(ceed, &jit_defines)); 1134753b775SJeremy L Thompson } 114c9c2c079SJeremy L Thompson 115c9c2c079SJeremy L Thompson // Add string source argument provided in call 116c9c2c079SJeremy L Thompson code << source; 117c9c2c079SJeremy L Thompson 118c9c2c079SJeremy L Thompson // Create Program 1192b730f8bSJeremy L Thompson CeedCallNvrtc(ceed, nvrtcCreateProgram(&prog, code.str().c_str(), NULL, 0, NULL, NULL)); 120c9c2c079SJeremy L Thompson 121c9c2c079SJeremy L Thompson // Compile kernel 122*c21e34e2SJeremy L Thompson CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "---------- ATTEMPTING TO COMPILE JIT SOURCE ----------\n"); 12326ef7cdaSJeremy L Thompson CeedDebug(ceed, "Source:\n%s\n", code.str().c_str()); 124*c21e34e2SJeremy L Thompson CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "---------- END OF JIT SOURCE ----------\n"); 125bdcc2728SJeremy L Thompson if (CeedDebugFlag(ceed)) { 126bdcc2728SJeremy L Thompson // LCOV_EXCL_START 127*c21e34e2SJeremy L Thompson CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "---------- JiT COMPILER OPTIONS ----------\n"); 128bdcc2728SJeremy L Thompson for (CeedInt i = 0; i < num_opts + num_jit_source_dirs + num_jit_defines; i++) { 129bdcc2728SJeremy L Thompson CeedDebug(ceed, "Option %d: %s", i, opts[i]); 130bdcc2728SJeremy L Thompson } 131bdcc2728SJeremy L Thompson CeedDebug(ceed, ""); 132*c21e34e2SJeremy L Thompson CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "---------- END OF JiT COMPILER OPTIONS ----------\n"); 133bdcc2728SJeremy L Thompson // LCOV_EXCL_STOP 134bdcc2728SJeremy L Thompson } 1354753b775SJeremy L Thompson nvrtcResult result = nvrtcCompileProgram(prog, num_opts + num_jit_source_dirs + num_jit_defines, opts); 136ca735530SJeremy L Thompson 137b13efd58SJeremy L Thompson for (CeedInt i = 0; i < num_jit_source_dirs; i++) { 138b13efd58SJeremy L Thompson CeedCallBackend(CeedFree(&opts[num_opts + i])); 139b13efd58SJeremy L Thompson } 1404753b775SJeremy L Thompson for (CeedInt i = 0; i < num_jit_defines; i++) { 1414753b775SJeremy L Thompson CeedCallBackend(CeedFree(&opts[num_opts + num_jit_source_dirs + i])); 1424753b775SJeremy L Thompson } 143b13efd58SJeremy L Thompson CeedCallBackend(CeedFree(&opts)); 144ddae5012SJeremy L Thompson *is_compile_good = result == NVRTC_SUCCESS; 14528c1f747SJeremy L Thompson if (!*is_compile_good) { 146c9c2c079SJeremy L Thompson char *log; 147ca735530SJeremy L Thompson size_t log_size; 148ca735530SJeremy L Thompson 149ca735530SJeremy L Thompson CeedCallNvrtc(ceed, nvrtcGetProgramLogSize(prog, &log_size)); 1502b730f8bSJeremy L Thompson CeedCallBackend(CeedMalloc(log_size, &log)); 1512b730f8bSJeremy L Thompson CeedCallNvrtc(ceed, nvrtcGetProgramLog(prog, log)); 15228c1f747SJeremy L Thompson if (throw_error) { 1532b730f8bSJeremy L Thompson return CeedError(ceed, CEED_ERROR_BACKEND, "%s\n%s", nvrtcGetErrorString(result), log); 15428c1f747SJeremy L Thompson } else { 155c49dc7a7SJeremy L Thompson // LCOV_EXCL_START 15628c1f747SJeremy L Thompson CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- COMPILE ERROR DETECTED ----------\n"); 15728c1f747SJeremy L Thompson CeedDebug(ceed, "Error: %s\nCompile log:\n%s\n", nvrtcGetErrorString(result), log); 158*c21e34e2SJeremy L Thompson CeedDebug256(ceed, CEED_DEBUG_COLOR_WARNING, "---------- BACKEND MAY FALLBACK ----------\n"); 15928c1f747SJeremy L Thompson CeedCallBackend(CeedFree(&log)); 16028c1f747SJeremy L Thompson CeedCallNvrtc(ceed, nvrtcDestroyProgram(&prog)); 16128c1f747SJeremy L Thompson return CEED_ERROR_SUCCESS; 162c49dc7a7SJeremy L Thompson // LCOV_EXCL_STOP 16328c1f747SJeremy L Thompson } 164c9c2c079SJeremy L Thompson } 165c9c2c079SJeremy L Thompson 16629ec485eSJed Brown #if CUDA_VERSION >= 11010 16729ec485eSJed Brown CeedCallNvrtc(ceed, nvrtcGetCUBINSize(prog, &ptx_size)); 16829ec485eSJed Brown CeedCallBackend(CeedMalloc(ptx_size, &ptx)); 16929ec485eSJed Brown CeedCallNvrtc(ceed, nvrtcGetCUBIN(prog, ptx)); 17029ec485eSJed Brown #else 1712b730f8bSJeremy L Thompson CeedCallNvrtc(ceed, nvrtcGetPTXSize(prog, &ptx_size)); 1722b730f8bSJeremy L Thompson CeedCallBackend(CeedMalloc(ptx_size, &ptx)); 1732b730f8bSJeremy L Thompson CeedCallNvrtc(ceed, nvrtcGetPTX(prog, ptx)); 17429ec485eSJed Brown #endif 1752b730f8bSJeremy L Thompson CeedCallNvrtc(ceed, nvrtcDestroyProgram(&prog)); 176c9c2c079SJeremy L Thompson 1772b730f8bSJeremy L Thompson CeedCallCuda(ceed, cuModuleLoadData(module, ptx)); 1782b730f8bSJeremy L Thompson CeedCallBackend(CeedFree(&ptx)); 179c9c2c079SJeremy L Thompson return CEED_ERROR_SUCCESS; 180c9c2c079SJeremy L Thompson } 181c9c2c079SJeremy L Thompson 182ddae5012SJeremy L Thompson int CeedCompile_Cuda(Ceed ceed, const char *source, CUmodule *module, const CeedInt num_defines, ...) { 183ddae5012SJeremy L Thompson bool is_compile_good = true; 184ddae5012SJeremy L Thompson va_list args; 185ddae5012SJeremy L Thompson 186ddae5012SJeremy L Thompson va_start(args, num_defines); 18718c38aeeSJeremy L Thompson const CeedInt ierr = CeedCompileCore_Cuda(ceed, source, true, &is_compile_good, module, num_defines, args); 18818c38aeeSJeremy L Thompson 189ddae5012SJeremy L Thompson va_end(args); 19018c38aeeSJeremy L Thompson CeedCallBackend(ierr); 191ddae5012SJeremy L Thompson return CEED_ERROR_SUCCESS; 192ddae5012SJeremy L Thompson } 193ddae5012SJeremy L Thompson 194ddae5012SJeremy L Thompson int CeedTryCompile_Cuda(Ceed ceed, const char *source, bool *is_compile_good, CUmodule *module, const CeedInt num_defines, ...) { 195ddae5012SJeremy L Thompson va_list args; 196ddae5012SJeremy L Thompson 197ddae5012SJeremy L Thompson va_start(args, num_defines); 19818c38aeeSJeremy L Thompson const CeedInt ierr = CeedCompileCore_Cuda(ceed, source, false, is_compile_good, module, num_defines, args); 19918c38aeeSJeremy L Thompson 200ddae5012SJeremy L Thompson va_end(args); 20118c38aeeSJeremy L Thompson CeedCallBackend(ierr); 202ddae5012SJeremy L Thompson return CEED_ERROR_SUCCESS; 203ddae5012SJeremy L Thompson } 204ddae5012SJeremy L Thompson 205c9c2c079SJeremy L Thompson //------------------------------------------------------------------------------ 206c9c2c079SJeremy L Thompson // Get CUDA kernel 207c9c2c079SJeremy L Thompson //------------------------------------------------------------------------------ 208eb7e6cafSJeremy L Thompson int CeedGetKernel_Cuda(Ceed ceed, CUmodule module, const char *name, CUfunction *kernel) { 2092b730f8bSJeremy L Thompson CeedCallCuda(ceed, cuModuleGetFunction(kernel, module, name)); 210c9c2c079SJeremy L Thompson return CEED_ERROR_SUCCESS; 211c9c2c079SJeremy L Thompson } 212c9c2c079SJeremy L Thompson 213b2165e7aSSebastian Grimberg //------------------------------------------------------------------------------ 214b2165e7aSSebastian Grimberg // Run CUDA kernel with block size selected automatically based on the kernel 215b2165e7aSSebastian Grimberg // (which may use enough registers to require a smaller block size than the 216b2165e7aSSebastian Grimberg // hardware is capable) 217b2165e7aSSebastian Grimberg //------------------------------------------------------------------------------ 2182b730f8bSJeremy L Thompson int CeedRunKernelAutoblockCuda(Ceed ceed, CUfunction kernel, size_t points, void **args) { 219c9c2c079SJeremy L Thompson int min_grid_size, max_block_size; 220ca735530SJeremy L Thompson 2212b730f8bSJeremy L Thompson CeedCallCuda(ceed, cuOccupancyMaxPotentialBlockSize(&min_grid_size, &max_block_size, kernel, NULL, 0, 0x10000)); 222eb7e6cafSJeremy L Thompson CeedCallBackend(CeedRunKernel_Cuda(ceed, kernel, CeedDivUpInt(points, max_block_size), max_block_size, args)); 223ca735530SJeremy L Thompson return CEED_ERROR_SUCCESS; 224c9c2c079SJeremy L Thompson } 225c9c2c079SJeremy L Thompson 226c9c2c079SJeremy L Thompson //------------------------------------------------------------------------------ 227c9c2c079SJeremy L Thompson // Run CUDA kernel 228c9c2c079SJeremy L Thompson //------------------------------------------------------------------------------ 229eb7e6cafSJeremy L Thompson int CeedRunKernel_Cuda(Ceed ceed, CUfunction kernel, const int grid_size, const int block_size, void **args) { 230e9c76bddSJeremy L Thompson CeedCallBackend(CeedRunKernelDimShared_Cuda(ceed, kernel, NULL, grid_size, block_size, 1, 1, 0, args)); 231c9c2c079SJeremy L Thompson return CEED_ERROR_SUCCESS; 232c9c2c079SJeremy L Thompson } 233c9c2c079SJeremy L Thompson 234c9c2c079SJeremy L Thompson //------------------------------------------------------------------------------ 235c9c2c079SJeremy L Thompson // Run CUDA kernel for spatial dimension 236c9c2c079SJeremy L Thompson //------------------------------------------------------------------------------ 237eb7e6cafSJeremy L Thompson int CeedRunKernelDim_Cuda(Ceed ceed, CUfunction kernel, const int grid_size, const int block_size_x, const int block_size_y, const int block_size_z, 2382b730f8bSJeremy L Thompson void **args) { 239e9c76bddSJeremy L Thompson CeedCallBackend(CeedRunKernelDimShared_Cuda(ceed, kernel, NULL, grid_size, block_size_x, block_size_y, block_size_z, 0, args)); 240c9c2c079SJeremy L Thompson return CEED_ERROR_SUCCESS; 241c9c2c079SJeremy L Thompson } 242c9c2c079SJeremy L Thompson 243c9c2c079SJeremy L Thompson //------------------------------------------------------------------------------ 244ea61e9acSJeremy L Thompson // Run CUDA kernel for spatial dimension with shared memory 245c9c2c079SJeremy L Thompson //------------------------------------------------------------------------------ 246e9c76bddSJeremy L Thompson static int CeedRunKernelDimSharedCore_Cuda(Ceed ceed, CUfunction kernel, CUstream stream, const int grid_size, const int block_size_x, 247e9c76bddSJeremy L Thompson const int block_size_y, const int block_size_z, const int shared_mem_size, const bool throw_error, 248e9c76bddSJeremy L Thompson bool *is_good_run, void **args) { 249023b8a51Sabdelfattah83 #if CUDA_VERSION >= 9000 250023b8a51Sabdelfattah83 cuFuncSetAttribute(kernel, CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES, shared_mem_size); 251023b8a51Sabdelfattah83 #endif 252e9c76bddSJeremy L Thompson CUresult result = cuLaunchKernel(kernel, grid_size, 1, 1, block_size_x, block_size_y, block_size_z, shared_mem_size, stream, args, NULL); 253ca735530SJeremy L Thompson 254c9c2c079SJeremy L Thompson if (result == CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES) { 255c9c2c079SJeremy L Thompson int max_threads_per_block, shared_size_bytes, num_regs; 256ca735530SJeremy L Thompson 2572b730f8bSJeremy L Thompson cuFuncGetAttribute(&max_threads_per_block, CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK, kernel); 2582b730f8bSJeremy L Thompson cuFuncGetAttribute(&shared_size_bytes, CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES, kernel); 259c9c2c079SJeremy L Thompson cuFuncGetAttribute(&num_regs, CU_FUNC_ATTRIBUTE_NUM_REGS, kernel); 260c49dc7a7SJeremy L Thompson if (throw_error) { 261c9c2c079SJeremy L Thompson return CeedError(ceed, CEED_ERROR_BACKEND, 262c9c2c079SJeremy L Thompson "CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES: max_threads_per_block %d on block size (%d,%d,%d), shared_size %d, num_regs %d", 2632b730f8bSJeremy L Thompson max_threads_per_block, block_size_x, block_size_y, block_size_z, shared_size_bytes, num_regs); 264c49dc7a7SJeremy L Thompson } else { 265c49dc7a7SJeremy L Thompson // LCOV_EXCL_START 266c49dc7a7SJeremy L Thompson CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- LAUNCH ERROR DETECTED ----------\n"); 267c49dc7a7SJeremy L Thompson CeedDebug(ceed, "CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES: max_threads_per_block %d on block size (%d,%d,%d), shared_size %d, num_regs %d\n", 268c49dc7a7SJeremy L Thompson max_threads_per_block, block_size_x, block_size_y, block_size_z, shared_size_bytes, num_regs); 269*c21e34e2SJeremy L Thompson CeedDebug256(ceed, CEED_DEBUG_COLOR_WARNING, "---------- BACKEND MAY FALLBACK ----------\n"); 270c49dc7a7SJeremy L Thompson // LCOV_EXCL_STOP 271ddae5012SJeremy L Thompson } 272c49dc7a7SJeremy L Thompson *is_good_run = false; 273c9c2c079SJeremy L Thompson } else CeedChk_Cu(ceed, result); 274c9c2c079SJeremy L Thompson return CEED_ERROR_SUCCESS; 275c9c2c079SJeremy L Thompson } 2762a86cc9dSSebastian Grimberg 277e9c76bddSJeremy L Thompson int CeedRunKernelDimShared_Cuda(Ceed ceed, CUfunction kernel, CUstream stream, const int grid_size, const int block_size_x, const int block_size_y, 278ddae5012SJeremy L Thompson const int block_size_z, const int shared_mem_size, void **args) { 279ddae5012SJeremy L Thompson bool is_good_run = true; 280ddae5012SJeremy L Thompson 281e9c76bddSJeremy L Thompson CeedCallBackend(CeedRunKernelDimSharedCore_Cuda(ceed, kernel, stream, grid_size, block_size_x, block_size_y, block_size_z, shared_mem_size, true, 282e9c76bddSJeremy L Thompson &is_good_run, args)); 283ddae5012SJeremy L Thompson return CEED_ERROR_SUCCESS; 284ddae5012SJeremy L Thompson } 285ddae5012SJeremy L Thompson 286e9c76bddSJeremy L Thompson int CeedTryRunKernelDimShared_Cuda(Ceed ceed, CUfunction kernel, CUstream stream, const int grid_size, const int block_size_x, const int block_size_y, 287ddae5012SJeremy L Thompson const int block_size_z, const int shared_mem_size, bool *is_good_run, void **args) { 288e9c76bddSJeremy L Thompson CeedCallBackend(CeedRunKernelDimSharedCore_Cuda(ceed, kernel, stream, grid_size, block_size_x, block_size_y, block_size_z, shared_mem_size, false, 289e9c76bddSJeremy L Thompson is_good_run, args)); 290ddae5012SJeremy L Thompson return CEED_ERROR_SUCCESS; 291ddae5012SJeremy L Thompson } 292ddae5012SJeremy L Thompson 2932a86cc9dSSebastian Grimberg //------------------------------------------------------------------------------ 294