[libc-commits] [libc] [libc] Add Kernel Resource Usage to nvptx-loader (PR #97503)
via libc-commits
libc-commits at lists.llvm.org
Sat Jul 6 14:40:48 PDT 2024
================
@@ -229,6 +229,17 @@ CUresult launch_kernel(CUmodule binary, CUstream stream,
return CUDA_SUCCESS;
}
+void print_resource_usage(CUmodule binary, const char *kernel_name) {
+ CUfunction function;
+ if (CUresult err = cuModuleGetFunction(&function, binary, kernel_name))
+ handle_error(err);
+ int num_regs;
+ if (CUresult err =
+ cuFuncGetAttribute(&num_regs, CU_FUNC_ATTRIBUTE_NUM_REGS, function))
+ handle_error(err);
+ fprintf(stderr, "%6s registers: %d\n", kernel_name, num_regs);
----------------
jameshu15869 wrote:
Ah yeah, I don't think there's a specific reason I put it in `stderr`.
https://github.com/llvm/llvm-project/pull/97503
More information about the libc-commits
mailing list