[DynInst_API:] [dyninst/dyninst] 7fca38: amdgpu: multi-wave scratch spill + hostcall fixes; ...


Date: Mon, 06 Jul 2026 20:13:53 -0700
From: bbiiggppiigg <noreply@xxxxxxxxxx>
Subject: [DynInst_API:] [dyninst/dyninst] 7fca38: amdgpu: multi-wave scratch spill + hostcall fixes; ...
  Branch: refs/heads/bbiiggppiigg/amdgpu-hostcall-multiwave-scratch
  Home:   https://github.com/dyninst/dyninst
  Commit: 7fca38d3845e4d0ca5f30bbad2af738a6458de52
      https://github.com/dyninst/dyninst/commit/7fca38d3845e4d0ca5f30bbad2af738a6458de52
  Author: wuxx1279 <bbiiggppiigg@xxxxxxxxx>
  Date:   2026-07-06 (Mon, 06 Jul 2026)

  Changed paths:
    A amdgpu-hostcall-poc/CLAUDE.md
    A amdgpu-hostcall-poc/HOSTCALL_HANDOFF.md
    A amdgpu-hostcall-poc/SPILL_ROADMAP.md
    A amdgpu-hostcall-poc/WORKFLOW_AND_LIMITATIONS.txt
    A amdgpu-hostcall-poc/add_object_aliases.py
    A amdgpu-hostcall-poc/check_link.py
    A amdgpu-hostcall-poc/device_lib/.gdbinit
    A amdgpu-hostcall-poc/device_lib/README
    A amdgpu-hostcall-poc/device_lib/compile.sh
    A amdgpu-hostcall-poc/device_lib/compute_hashes.py
    A amdgpu-hostcall-poc/device_lib/device_only.cpp
    A amdgpu-hostcall-poc/device_lib/device_only.cpp-hip-amdgcn-amd-amdhsa.hipfb
    A amdgpu-hostcall-poc/device_lib/extracted_funptr.yaml
    A amdgpu-hostcall-poc/device_lib/funptr.yaml
    A amdgpu-hostcall-poc/examples/test_amdgpu_instrument/CMakeLists.txt
    A amdgpu-hostcall-poc/examples/test_amdgpu_instrument/Inst.C
    A amdgpu-hostcall-poc/examples/test_amdgpu_instrument/Inst.h
    A amdgpu-hostcall-poc/examples/test_amdgpu_instrument/README.md
    A amdgpu-hostcall-poc/examples/test_amdgpu_instrument/external.C
    A amdgpu-hostcall-poc/examples/test_amdgpu_instrument/test_amdgpu_instrument.C
    A amdgpu-hostcall-poc/examples/test_amdgpu_instrument/testcc.C
    A amdgpu-hostcall-poc/hostcall_lib/hostcall_lib.cpp
    A amdgpu-hostcall-poc/hostcall_lib/hostcall_lib.s
    A amdgpu-hostcall-poc/hostcall_lib/hostcalls.h
    A amdgpu-hostcall-poc/instrument.sh
    A amdgpu-hostcall-poc/launcher/dyninst_trace.txt
    A amdgpu-hostcall-poc/launcher/hostcall_launcher.cpp
    A amdgpu-hostcall-poc/mutatee/code-objects/1-host-x86_64-unknown-linux--
    A amdgpu-hostcall-poc/mutatee/code-objects/908.yaml
    A amdgpu-hostcall-poc/mutatee/code-objects/gfx908.backup
    A amdgpu-hostcall-poc/mutatee/code-objects/patch_mutatee.py
    A amdgpu-hostcall-poc/mutatee/fmeta_data.txt
    A amdgpu-hostcall-poc/mutatee/fmeta_data2.txt
    A amdgpu-hostcall-poc/mutatee/test.cpp
    A amdgpu-hostcall-poc/mutatee2/code-objects/1-host-x86_64-unknown-linux--
    A amdgpu-hostcall-poc/mutatee2/code-objects/908.yaml
    A amdgpu-hostcall-poc/mutatee2/code-objects/gfx908.backup
    A amdgpu-hostcall-poc/mutatee2/code-objects/patch_mutatee.py
    A amdgpu-hostcall-poc/mutatee2/fmeta_data.txt
    A amdgpu-hostcall-poc/mutatee2/fmeta_data2.txt
    A amdgpu-hostcall-poc/mutatee2/test.cpp
    A amdgpu-hostcall-poc/mutatee2/test.s
    A amdgpu-hostcall-poc/preload.cpp
    A amdgpu-hostcall-poc/probe/hc_fn.cpp
    A amdgpu-hostcall-poc/probe/hc_fn.s
    A amdgpu-hostcall-poc/probe/hc_fn2.cpp
    A amdgpu-hostcall-poc/probe/hc_fn2.s
    A amdgpu-hostcall-poc/probe/hc_fn2_afs.s
    A amdgpu-hostcall-poc/probe/pd_gfx908:xnack+.s
    A amdgpu-hostcall-poc/probe/pd_gfx908:xnack-.s
    A amdgpu-hostcall-poc/probe/probe_dev.cpp
    A amdgpu-hostcall-poc/probe/probe_host.cpp
    A amdgpu-hostcall-poc/scratch_probe/scratch_probe.cpp
    A amdgpu-hostcall-poc/vectoradd_mutatee/decode_kd.py
    A amdgpu-hostcall-poc/vectoradd_mutatee/vectoradd.cpp
    M dyninstAPI/src/ASTs/AmdgpuPrologue.C
    M dyninstAPI/src/ASTs/AmdgpuPrologue.h
    M dyninstAPI/src/AmdgpuPointHandler.C
    M dyninstAPI/src/BPatch/BPatch_point.C
    A dyninstAPI/src/amdgpu-abi-sgpr.h
    M dyninstAPI/src/amdgpu-gfx908-details.C
    M dyninstAPI/src/amdgpu-gfx908-details.h
    A dyninstAPI/src/amdgpu-scratch-abi.h
    M dyninstAPI/src/codegen/codegen-amdgpu.C
    M dyninstAPI/src/emit-amdgpu.C
    M dyninstAPI/src/inst-amdgpu.C

  Log Message:
  -----------
  amdgpu: multi-wave scratch spill + hostcall fixes; add hostcall PoC

dyninst AMDGPU codegen:
- Add amdgpu-abi-sgpr.h: a KD->ABI SGPR layout pass (computeAbiSgprLayout)
  grounded in the authoritative AMDGPU "SGPR Register Set Up Order" table.
- Fix multi-wave scratch corruption: the entry springboard long-jump
  (codegen-amdgpu.C generateBranch) grabbed s[8:9] = wgid / scratch wave
  offset after scratch-enable shifted the system SGPRs up, clobbering the
  per-wave offset before the prologue captured it -> all waves shared one
  scratch base. Now reserve the live system-SGPR range [userSgprCount,
  liveSgprEnd) so allocateGprBlock allocates above it.
- ScratchAbi seam (amdgpu-scratch-abi.h + Gfx908ScratchAbi) for hardware
  per-wave scratch register spill (env-gated DYNINST_SPILL_SCRATCH);
  emitScratchEntryPrologue builds per-wave FLAT_SCRATCH from the layout pass.

Validated end-to-end (instrument -> HSA load+freeze -> per-wave scratch
spill -> GPU->CPU hostcall -> dyninst_trace.txt) at N=64/128/256, all PASSED
with linear per-wave hostcall scaling.

amdgpu-hostcall-poc/: source snapshot of the host/device prototype
(hostcall_lib, launcher, mutatee, add_object_aliases.py, instrument.sh,
docs). Includes the extern-mailbox fix: the device-side mailbox must be a
pure `extern` declaration, else the compiler constant-folds the ticket/
status handshake into an 88-byte no-op stub that issues no hostcall.

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
[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] [dyninst/dyninst] 7fca38: amdgpu: multi-wave scratch spill + hostcall fixes; ..., bbiiggppiigg <=