[libc-commits] [PATCH] D158320: [libc] Initial support for microbenchmarking GPU code

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Aug 18 14:59:42 PDT 2023


jhuber6 created this revision.
jhuber6 added reviewers: tra, arsenm, sivachandra, lntue, michaelrj, JonChesterfield.
Herald added subscribers: libc-commits, mattd, asavonic, kerbowa, tpr, jvesely.
Herald added projects: libc-project, All.
jhuber6 requested review of this revision.
Herald added subscribers: wangpc, wdng.

This is the initial attempt at microbenchmarking GPU code. It uses
several compiler hacks to ensure that only the code we want to test is
between these profiling instructions. I tested this on both NVPTX and
AMDGPu architecture. AMDGPU seems to work quite well and matches what I
expect from `llvm-mca` when checking the assembly via `llvm-objump -D`
on the binary. NVPTX on the other hand requires `-Xcuda-ptxas -O0` to
get consistent results, otherwise it will reorder the operations and end
up getting noise.

This is difficult because if there is a single load or store inside of
the timing region it well completely drown out any latency. A single
load / store is probably more costly than most primitive match
functions so it drowns out everything else.

I'm putting this up as a stand-in that can hopefully be refined further
in the future, as such there are no users currently.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158320

Files:
  libc/src/__support/GPU/nvptx/utils.h
  libc/utils/gpu/CMakeLists.txt
  libc/utils/gpu/timing/CMakeLists.txt
  libc/utils/gpu/timing/amdgpu/CMakeLists.txt
  libc/utils/gpu/timing/amdgpu/timing.h
  libc/utils/gpu/timing/nvptx/CMakeLists.txt
  libc/utils/gpu/timing/nvptx/timing.h
  libc/utils/gpu/timing/timing.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158320.551655.patch
Type: text/x-patch
Size: 9094 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230818/a6eea984/attachment.bin>


More information about the libc-commits mailing list