[libc-commits] [libc] [libc] NVPTX Profiling Draft (PR #92009)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Mon May 13 12:31:39 PDT 2024


================
@@ -0,0 +1,70 @@
+#include "LibcGpuBenchmark.h"
+
+namespace LIBC_NAMESPACE {
+namespace libc_gpu_benchmarks {
+
+Benchmark *Benchmark::Start = nullptr;
----------------
jhuber6 wrote:

So, I'm assuming we're maintaining some global list of function pointers to call for benchmarks. That's how unit tests work I believe. Doing this in a global constructor is good because it's run single-threaded in a separate kernel call so you don't need to worry about threads.

We have a utilitiy called `FixedVector` which you can simply set to contain something like `64` elements and then push back into it. Let's just assume that no one is going to register more than 64 benchmarks in a single file for now, but we can always increase it.

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


More information about the libc-commits mailing list