Branch: refs/heads/bbiiggppiigg/amdgpu-hostcall-multiwave-scratch
Home: https://github.com/dyninst/dyninst
Commit: fc3d24eafe7e7913742969212aaccee16e16ebe8
https://github.com/dyninst/dyninst/commit/fc3d24eafe7e7913742969212aaccee16e16ebe8
Author: wuxx1279 <bbiiggppiigg@xxxxxxxxx>
Date: 2026-07-07 (Tue, 07 Jul 2026)
Changed paths:
M dyninstAPI/src/AmdgpuPointHandler.C
M dyninstAPI/src/AmdgpuPointHandler.h
M dyninstAPI/src/amdgpu-scratch-abi.h
M dyninstAPI/src/codegen/codegen-amdgpu.C
M dyninstAPI/src/emit-amdgpu.C
Log Message:
-----------
amdgpu: size the scratch-mode SGPR grant to the actual requirement (112 -> 48)
Previously the SGPR grant was MAXED to 112 (gran 12) for every instrumented
kernel, and the trampoline's reserved SGPRs sat at fixed highs s[92:95] â safe
only because nothing was granted that high. In scratch mode, size the grant to
what is actually needed and place the reserved block near the top of that tight
grant.
- maximizeSgprAllocationIfKernel is now scratch-aware: it sizes the grant to
gran 4 (48 SGPRs) instead of maxing (global path still maxes, unchanged).
- The reserved trampoline block (EXEC-save pair + SADDR) is derived from the KD
grant in both emitCall (readCallerGrantedSgprTop) and generateBranch (KD
granule), so they stay consistent (derive-from-grant; uniform-callee case).
- The scratch prologue is decoupled from the reserved base: FLAT_SCRATCH is the
fixed special pair s[102:103], and SADDR=0 is now set per-trampoline in
emitCall rather than the prologue.
- generateBranch reserves the same block so the springboard/call-target
allocateGprBlock (which ignores the KD grant) cannot collide.
CRITICAL accounting: granulated_wavefront_sgpr_count INCLUDES the special SGPRs,
which occupy the HIGHEST-numbered SGPRs. Per LLVM getNumExtraSGPRs the count of
extras is a cascade (VCC-only=2, +XNACK=4, +FLAT_SCRATCH=6); enabling flat
scratch reserves the top 6 even under xnack- (xnack pair stays a gap). So the
4-reg spill block must sit BELOW all 6: reservedBase = grantTop-10. (An earlier
grantTop-4 landed EXEC-save on FLAT_SCRATCH, corrupting the scratch base ->
HSA_STATUS_ERROR_MEMORY_APERTURE_VIOLATION.)
Grant-48 layout: callee s0-31, reserved block s38-41 (EXEC s38/39, SADDR s40),
specials s42-47. Validated N=64/256/512 PASSED, deterministic 5/5, hostcalls
scaling linearly.
Co-Authored-By: Claude Opus 4.8 <noreply@xxxxxxxxxxxxx>
To unsubscribe from these emails, change your notification settings at https://github.com/dyninst/dyninst/settings/notifications
|