[llvm] [llvm-calc-occupancy] Add an AMDGPU occupancy calculator tool (PR #208727)

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 05:53:31 PDT 2026


================
@@ -0,0 +1,30 @@
+# This tool depends on AMDGPU backend internals (GCNSubtarget). Only build it
+# when the AMDGPU target is enabled.
+if(NOT "AMDGPU" IN_LIST LLVM_TARGETS_TO_BUILD)
+  return()
+endif()
+
+include_directories(
+  ${LLVM_MAIN_SRC_DIR}/lib/Target/AMDGPU
+  ${LLVM_BINARY_DIR}/lib/Target/AMDGPU
+  )
+
+set(LLVM_LINK_COMPONENTS
+  AMDGPUCodeGen
+  AMDGPUDesc
+  AMDGPUInfo
----------------
nico wrote:

It seems a bit strange that this reaches into llvm/lib/AMDGPU internals. Maybe expose a public api (llvm/include/llvm/Target/AMDGPU) instead of this having reach into internals?

(Yes, the AMDGPU unit tests do this too, but they are tests, this here is an actual tool. Also it's a bit strange for the tests too imho 😅)

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


More information about the llvm-commits mailing list