diff --git a/examples/by_api_module/execution_control.cu b/examples/by_api_module/execution_control.cu index ff6fcc0b..e2d57031 100644 --- a/examples/by_api_module/execution_control.cu +++ b/examples/by_api_module/execution_control.cu @@ -56,13 +56,16 @@ int main(int argc, char **argv) #if CUDA_VERSION >= 12030 cuda::kernel_t const& base_ref = kernel; - auto name_from_kernel = base_ref.name(); - if (strcmp(name_from_kernel, kernel_name) != 0) { + auto mangled_name_from_kernel = base_ref.mangled_name(); +#ifdef __GNUC__ + auto demangled_name = demangle(mangled_name_from_kernel); + if (strcmp(demangled_name.c_str(), kernel_name) != 0) { std::cout << "CUDA reports a different name for kernel \"" << kernel_name - << "\" via its handle: \"" << name_from_kernel << "\"" << std::endl; + << "\" via its handle: \"" << demangled_name << "\"" << std::endl; return EXIT_FAILURE; } +#endif #endif // ------------------------------------------ diff --git a/src/cuda/api/kernel.hpp b/src/cuda/api/kernel.hpp index 5575cce5..e632e3db 100644 --- a/src/cuda/api/kernel.hpp +++ b/src/cuda/api/kernel.hpp @@ -191,7 +191,9 @@ class kernel_t { #endif #if CUDA_VERSION >= 12030 - const char *name() const { return cuda::kernel::detail_::get_name(context_handle_, handle_); } + /// Return the mangled name of the kernel (representing the original name, and, + /// possibly, the parameter types) + const char *mangled_name() const { return cuda::kernel::detail_::get_name(context_handle_, handle_); } module_t module() const; #endif