Skip to content

Commit

Permalink
Regards #674: The kernel_t::name() metod renamed to `mangled_name()…
Browse files Browse the repository at this point in the history
…`, to clarify to the user what they're actually getting; this doesn't fully resolve the issue though.
  • Loading branch information
eyalroz committed Sep 10, 2024
1 parent ff84ec3 commit e4641c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions examples/by_api_module/execution_control.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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

// ------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion src/cuda/api/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e4641c7

Please sign in to comment.