diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2022-12-01 11:00:30 +0100 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2023-01-23 21:43:06 +0100 |
commit | 10cef708a7ccaf69c18be86460583f9b62ee3c29 (patch) | |
tree | 1228a6fc4f415fa186974791274a55a71e79e654 /llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h | |
parent | 0775f21b62a5fe6422c3d021685a779e647bf8d1 (diff) | |
download | llvm-10cef708a7ccaf69c18be86460583f9b62ee3c29.zip llvm-10cef708a7ccaf69c18be86460583f9b62ee3c29.tar.gz llvm-10cef708a7ccaf69c18be86460583f9b62ee3c29.tar.bz2 |
AMDGPU: Clean up LDS-related occupancy calculations
Occupancy is expressed as waves per SIMD. This means that we need to
take into account the number of SIMDs per "CU" or, to be more precise,
the number of SIMDs over which a workgroup may be distributed.
getOccupancyWithLocalMemSize was wrong because it didn't take SIMDs
into account at all.
At the same time, we need to take into account that WGP mode offers
access to a larger total amount of LDS, since this can affect how
non-power-of-two LDS allocations are rounded. To make this work
consistently, we distinguish between (available) local memory size and
addressable local memory size (which is always limited by 64kB on
gfx10+, even with WGP mode).
This change results in a massive amount of test churn. A lot of it is
caused by the fact that the default work group size is 1024, which means
that (due to rounding effects) the default occupancy on older hardware
is 8 instead of 10, which affects scheduling via register pressure
estimates. I've adjusted most tests by just running the UTC tools, but
in some cases I manually changed the work group size to 32 or 64 to make
sure that work group size chunkiness has no effect.
Differential Revision: https://reviews.llvm.org/D139468
Diffstat (limited to 'llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h')
-rw-r--r-- | llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h index d527199ce..4d34235 100644 --- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h +++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h @@ -192,6 +192,10 @@ unsigned getWavefrontSize(const MCSubtargetInfo *STI); /// \returns Local memory size in bytes for given subtarget \p STI. unsigned getLocalMemorySize(const MCSubtargetInfo *STI); +/// \returns Maximum addressable local memory size in bytes for given subtarget +/// \p STI. +unsigned getAddressableLocalMemorySize(const MCSubtargetInfo *STI); + /// \returns Number of execution units per compute unit for given subtarget \p /// STI. unsigned getEUsPerCU(const MCSubtargetInfo *STI); |