[libc-commits] [PATCH] D148485: [libc] Add the '--threads' and '--blocks' option to the GPU loaders

Artem Belevich via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Apr 17 11:31:08 PDT 2023


tra added inline comments.


================
Comment at: libc/utils/gpu/loader/Main.cpp:34
+    if (argv[offset] == std::string("--threads")) {
+      params.num_threads_x = offset + 1 < argc ? atoi(argv[offset + 1]) : 1;
+      offset++;
----------------
Nit: Can we use `strtoul` instead? Sometimes it's convenient to be able to use hex numbers and you would also get an indication if the input is not a number.


================
Comment at: libc/utils/gpu/loader/nvptx/Loader.cpp:137-139
+          cuLaunchKernel(function, params.num_blocks_x, /*gridDimY=*/1,
+                         /*gridDimZ=*/1, params.num_threads_x, /*blockDimY=*/1,
                          /*bloackDimZ=*/1, 0, stream, nullptr, args_config))
----------------
If we're allowing controlling the number of blocks/threads at all, is there a reason not to allow specifying all dimensions?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148485/new/

https://reviews.llvm.org/D148485



More information about the libc-commits mailing list