[libc-commits] [libc] [libc] Add Kernel Resource Usage to nvptx-loader (PR #97503)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Sun Jul 14 18:26:38 PDT 2024


================
@@ -229,6 +229,43 @@ CUresult launch_kernel(CUmodule binary, CUstream stream,
   return CUDA_SUCCESS;
 }
 
+void print_kernel_resources(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);
+  printf("%6s registers: %d\n", kernel_name, num_regs);
+}
+
+void print_resources(void *image) {
----------------
jhuber6 wrote:

Yeah, I figured it would just be an option that the benchmarks use to print verbose information on kernel launch so the user can see it. However, it's definitely true that it's not objectively useful if it includes all the benchmarking overhead. So we may need some name arguments if someone wants to make a dummy kernel or something.

https://github.com/llvm/llvm-project/pull/97503


More information about the libc-commits mailing list