Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0a435c8
feat: add anvil KFD/SDMA queue library headers
nileshnegi May 5, 2026
cb8a576
feat: add anvil.cpp — xio-free adaptation of anvil.hip
nileshnegi May 5, 2026
1b1ec70
build: add ENABLE_ANVIL_EXEC cmake option for GPU-initiated SDMA exec…
nileshnegi May 5, 2026
324d0d9
feat: add EXE_GPU_INITIATED_DMA enum value (char code 'S')
nileshnegi May 5, 2026
6e4b475
build: fix hsakmt IMPORTED target — use STATIC for .a, add drm transi…
nileshnegi May 5, 2026
6fd0022
feat: add anvilQueues field to ExeInfo for SDMA queue handles
nileshnegi May 5, 2026
fd0502a
feat: add TransfersHaveErrors validation for EXE_GPU_INITIATED_DMA
nileshnegi May 5, 2026
e8232c7
feat: implement PrepareAnvilExecutor and extend Teardown for anvil
nileshnegi May 6, 2026
26d5483
feat: implement AnvilTransferKernel and RunAnvilExecutor
nileshnegi May 6, 2026
8218dcd
fix: add gfx1250 s_waitcnt compat in sdma-ep.h; remove kernel no-op g…
nileshnegi May 6, 2026
cfc5fc3
fix: make IsGpuExeType unconditional to prevent segfault on gfx950
nileshnegi May 6, 2026
03f4638
build: add ENABLE_ANVIL_EXEC flag to Makefile
nileshnegi May 6, 2026
1419b3c
build: pass libhsakmt.a via -Wl, to avoid -x hip parsing it as source
nileshnegi May 6, 2026
dad5aa7
feat: add TB_VERBOSE=1 logging for anvil alloc/dealloc lifecycle
nileshnegi May 6, 2026
716c1a2
fix: add EXE_GPU_INITIATED_DMA to ExeTypeToStr as "GISDMA"
nileshnegi May 6, 2026
5d10c46
feat: extend USE_DMA_EXEC in AllToAll preset to support BMA and GISDMA
nileshnegi May 6, 2026
062d1e4
fix: remove ANVIL_EXEC_ENABLED guard from RecursiveWildcardTransferEx…
nileshnegi May 7, 2026
90d287b
fix: remove ANVIL_EXEC_ENABLED guard from GetHsaAgent switch case
nileshnegi May 7, 2026
a5fffe3
anvil: suppress nodiscard warnings on hipFree in SdmaQueue dtor
nileshnegi May 7, 2026
44068b9
anvil: add HSA preferred-engine selection + SDMA affinity topology table
nileshnegi May 7, 2026
98fd410
topology: fix SDMA affinity table column alignment
nileshnegi May 7, 2026
f174c05
fix: honor byteOffset in DMA and Anvil writes
nileshnegi Jun 28, 2026
9d4fc48
anvil: run GISDMA transfers concurrently with per-transfer timing
nileshnegi Jul 10, 2026
d542d0b
anvil: add opt-in round-robin SDMA engine selection
nileshnegi Jul 11, 2026
151769f
anvil: use hipExtLaunchKernelGGL for GISDMA kernel timing
nileshnegi Jul 11, 2026
ebb9301
anvil: use engine-ordered signal for GISDMA completion
nileshnegi Jul 11, 2026
09c87b2
anvil: add runtime toggles for GISDMA doorbell placement and completi…
nileshnegi Jul 13, 2026
0ce43f7
anvil: add ANVIL_LEGACY toggle for legacy put/quiet GISDMA completion
nileshnegi Jul 13, 2026
b61b3e1
anvil: split GISDMA kernel into four non-branching variants
nileshnegi Jul 13, 2026
6fa3874
anvil: chunk GISDMA copies to lift the 1 GiB per-transfer limit
nileshnegi Jul 21, 2026
1aa6b4e
anvil: add host-initiated (CPU-driven) SDMA queue path
nileshnegi Jul 21, 2026
e533b6c
anvil: add OSS7 fused copy+signal SDMA packet (gfx1250)
nileshnegi Jul 21, 2026
45c36c1
build: enable XIO_SDMA_OSS7 fused packets by default (all-arch safe)
nileshnegi Jul 21, 2026
3c7f986
anvil: rename GISDMA executor to GMA and split host path into HMA
nileshnegi Jul 22, 2026
8a36010
docs: document GMA/HMA anvil SDMA executors in CHANGELOG
nileshnegi Jul 31, 2026
49dae56
anvil: address PR #343 review feedback in vendored SDMA layer
nileshnegi Aug 8, 2026
7e82b52
a2a: batch each source GPU's BMA copies into one launch
nileshnegi Aug 13, 2026
9fb2b4b
core: scale executor byte total by destination count
nileshnegi Aug 13, 2026
4587bd0
poda2a: add BMA/GMA/HMA executor support
nileshnegi Aug 13, 2026
e4a4222
anvil: reuse GMA SDMA queues across re-prepares to fix sweep queue ex…
nileshnegi Aug 15, 2026
dcac4d8
anvil: tighten comments across the SDMA executor changes
nileshnegi Aug 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ Documentation for TransferBench is available at
- Added support for SWEEP_MIN_POW2 and SWEEP_MAX_POW2 to set sweep bounds when bytes to transfer is 0
- Adding support for Tensor Data Mover (TDM)-based executor [T] on supported hardware. This provides
an alternative data movement mechanism which utilizes async loads to shared memory / from shared memory
- Adding new GPU-initiated SDMA executor "GMA" [S] (AMD only, opt-in via `-DENABLE_ANVIL_EXEC=ON`), which
drives KFD SDMA queues directly from a GPU kernel using the bundled `anvil` KFD/SDMA queue library
- Adding new host-initiated SDMA executor "HMA" [H] (AMD only), a CPU-driven variant of the anvil SDMA
path where the host builds packets, rings the doorbell, and polls for completion
- Extended the AllToAll preset `USE_DMA_EXEC` to select the executor: 0=GFX, 1=DMA, 2=BMA, 3=GMA, 4=HMA
### Modified
- CPU NUMA nodes with 0 cores will now be hidden. To re-enable, set TB_SHOW_ALL_NUMA=1
- Switching to use of persistent threadpools to cut-down on thread creation overheads
Expand Down
58 changes: 58 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ option(ENABLE_MPI_COMM "Enable MPI Communicator support"
option(ENABLE_AMD_SMI "Enable AMD-SMI pod membership queries" OFF)
option(ENABLE_POD_COMM "Enable pod communication" OFF)
option(BUILD_RELOCATABLE_PACKAGE "Build with RVS-style relocatable RPATH and amdrocm<MAJOR>-transferbench package naming" OFF)
option(ENABLE_ANVIL_EXEC "Enable GPU-initiated SDMA executor via anvil (AMD MI300X only)" OFF)

include(cmake/Dependencies.cmake) # rocm-cmake, rocm_local_targets, rocm_check_target_ids

Expand Down Expand Up @@ -440,6 +441,46 @@ else()
endif()
endif()

## Check for anvil SDMA executor support
if(NOT ENABLE_ANVIL_EXEC)
message(STATUS "For CMake builds, anvil GPU-initiated SDMA executor requires -DENABLE_ANVIL_EXEC=ON")
message(STATUS "- Disabling anvil executor support")
else()
message(STATUS "Attempting to build with anvil GPU-initiated SDMA executor")

find_library(HSAKMT_LIBRARY hsakmt PATHS ${ROCM_PATH}/lib ${ROCM_PATH}/lib64 NO_DEFAULT_PATH)
find_path(HSAKMT_INCLUDE_DIR hsakmt/hsakmt.h PATHS ${ROCM_PATH}/include NO_DEFAULT_PATH)

if(HSAKMT_LIBRARY AND HSAKMT_INCLUDE_DIR)
# hsakmt is typically a static archive; drm_amdgpu/drm are transitive deps
if(HSAKMT_LIBRARY MATCHES "\\.a$")
add_library(hsakmt STATIC IMPORTED)
else()
add_library(hsakmt SHARED IMPORTED)
endif()
find_library(DRM_AMDGPU_LIBRARY drm_amdgpu)
find_library(DRM_LIBRARY drm)
set_target_properties(hsakmt PROPERTIES
IMPORTED_LOCATION "${HSAKMT_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${HSAKMT_INCLUDE_DIR}"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${HSAKMT_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${DRM_AMDGPU_LIBRARY};${DRM_LIBRARY}")
set(ANVIL_EXEC_FOUND 1)
message(STATUS "- Building with anvil GPU-initiated SDMA executor support")
message(STATUS " - hsakmt: ${HSAKMT_LIBRARY}")
message(STATUS " - drm_amdgpu: ${DRM_AMDGPU_LIBRARY}")
message(STATUS " - drm: ${DRM_LIBRARY}")
else()
if(NOT HSAKMT_LIBRARY)
message(WARNING "- libhsakmt not found under ${ROCM_PATH}/lib or ${ROCM_PATH}/lib64")
endif()
if(NOT HSAKMT_INCLUDE_DIR)
message(WARNING "- hsakmt/hsakmt.h not found under ${ROCM_PATH}/include")
endif()
message(WARNING "- Building without anvil executor support")
endif()
endif()

set(PACKAGE_NAME TB)
set(LIBRARY_NAME TransferBench)

Expand Down Expand Up @@ -472,6 +513,23 @@ endif()
if(POD_COMM_FOUND)
target_compile_definitions(TransferBench PRIVATE POD_COMM_ENABLED)
endif()
if(ANVIL_EXEC_FOUND)
target_sources(TransferBench PRIVATE src/anvil/anvil.cpp)
target_include_directories(TransferBench PRIVATE src/anvil)
target_compile_definitions(TransferBench PRIVATE ANVIL_EXEC_ENABLED)
target_link_libraries(TransferBench PRIVATE hsakmt)
# XIO_SDMA_OSS7: fused COPY_LINEAR_WAIT_SIGNAL_MI4 packet. ABI-portable (structs
# + host code build on any arch; device code is arch-gated to gfx1250/gfx950 via
# XIO_SDMA_OSS7_ENABLED and selected at runtime only on gfx1250), so it is safe
# for all-arch builds. Set -DENABLE_XIO_SDMA_OSS7=OFF to force the separate path.
option(ENABLE_XIO_SDMA_OSS7 "Enable fused MI4 SDMA packets (gfx1250 runtime)" ON)
if(ENABLE_XIO_SDMA_OSS7)
target_compile_definitions(TransferBench PRIVATE XIO_SDMA_OSS7=1)
message(STATUS "- Building with XIO_SDMA_OSS7 (fused MI4 SDMA packets; device code gated to gfx1250/gfx950)")
else()
message(STATUS "- Building without XIO_SDMA_OSS7 (separate COPY_LINEAR + ATOMIC path)")
endif()
endif()

target_compile_definitions(TransferBench PRIVATE
TB_GIT_BRANCH="${TB_GIT_BRANCH}"
Expand Down
76 changes: 69 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ NVCC ?= $(CUDA_PATH)/bin/nvcc
DEBUG ?= 0

# Optional features (set to 0 to disable, 1 to enable)
# DISABLE_MPI_COMM: Disable MPI communicator support (default: 0)
# DISABLE_AMD_SMI: Disable AMD-SMI pod membership checking support (default: 0)
# DISABLE_NVML: Disable NVML pod membership detection for CUDA builds (default: 0)
# DISABLE_POD_COMM: Disable pod communication support (default: 0)
# DISABLE_CUMEM: Disable CUDA driver API (also disables pod on CUDA) (default: 0)
# DISABLE_MPI_COMM: Disable MPI communicator support (default: 0)
# DISABLE_AMD_SMI: Disable AMD-SMI pod membership checking support (default: 0)
# DISABLE_NVML: Disable NVML pod membership detection for CUDA builds (default: 0)
# DISABLE_POD_COMM: Disable pod communication support (default: 0)
# DISABLE_CUMEM: Disable CUDA driver API (also disables pod on CUDA) (default: 0)
# ENABLE_ANVIL_EXEC: Enable GPU-initiated SDMA executor (AMD KFD, ROCm only) (default: 0)

# ROCm device libraries can live in different locations depending on packaging.
# hipcc/clang needs to find the amdgcn bitcode directory at link time.
Expand Down Expand Up @@ -266,14 +267,75 @@ _TB_DIR := $(dir $(abspath $(firstword $(MAKEFILE_LIST))))
TB_GIT_BRANCH := $(shell git -C "$(_TB_DIR)" rev-parse --abbrev-ref HEAD 2>/dev/null || sed -n '1p' "$(_TB_DIR)GIT_VERSION" 2>/dev/null || echo unknown)
TB_GIT_COMMIT := $(shell git -C "$(_TB_DIR)" rev-parse --short HEAD 2>/dev/null || sed -n '2p' "$(_TB_DIR)GIT_VERSION" 2>/dev/null || echo unknown)
COMMON_FLAGS += -DTB_GIT_BRANCH='"$(TB_GIT_BRANCH)"' -DTB_GIT_COMMIT='"$(TB_GIT_COMMIT)"'

ANVIL_ENABLED = 0
# Compile with GPU-initiated SDMA executor (anvil/KFD) if
# 1) ENABLE_ANVIL_EXEC is set to 1
# 2) hsakmt/hsakmt.h is found (KFD user-space library header)
# 3) libhsakmt is found (static or shared)
# Note: disabled by default; requires AMD ROCm KFD and is AMD-only
ENABLE_ANVIL_EXEC ?= 0
ifeq ($(ENABLE_ANVIL_EXEC), 1)
ifeq ($(MAKECMDGOALS),TransferBenchCuda)
$(info - Anvil executor not supported for CUDA builds; ignoring ENABLE_ANVIL_EXEC=1)
else
$(info Attempting to build with Anvil GPU-initiated SDMA executor support)
HSAKMT_INC := $(firstword $(wildcard \
$(ROCM_PATH)/include/hsakmt/hsakmt.h \
/usr/include/hsakmt/hsakmt.h))
HSAKMT_LIB := $(firstword $(wildcard \
$(ROCM_PATH)/lib/libhsakmt.a \
$(ROCM_PATH)/lib64/libhsakmt.a \
$(ROCM_PATH)/lib/libhsakmt.so \
/usr/lib/x86_64-linux-gnu/libhsakmt.so))
ifeq ($(HSAKMT_INC),)
$(info - hsakmt/hsakmt.h not found; cannot build Anvil executor)
$(info - Install libhsakmt-dev or ensure ROCM_PATH is set correctly)
else ifeq ($(HSAKMT_LIB),)
$(info - libhsakmt not found; cannot build Anvil executor)
$(info - Install libhsakmt or ensure ROCM_PATH is set correctly)
else
ANVIL_ENABLED = 1
COMMON_FLAGS += -DANVIL_EXEC_ENABLED -I./src/anvil
# XIO_SDMA_OSS7: fused COPY_LINEAR_WAIT_SIGNAL_MI4 packet. ABI-portable
# (device code is arch-gated to gfx1250/gfx950 via XIO_SDMA_OSS7_ENABLED and
# selected at runtime only on gfx1250). Set ENABLE_XIO_SDMA_OSS7=0 to force
# the separate COPY_LINEAR + ATOMIC path.
ENABLE_XIO_SDMA_OSS7 ?= 1
ifeq ($(ENABLE_XIO_SDMA_OSS7), 1)
COMMON_FLAGS += -DXIO_SDMA_OSS7=1
$(info - Building with XIO_SDMA_OSS7 (fused MI4 SDMA packets; device code gated to gfx1250/gfx950))
else
$(info - Building without XIO_SDMA_OSS7 (separate COPY_LINEAR + ATOMIC path))
endif
# Link hsakmt; use -Wl, to pass the static archive directly to the
# linker — without it, -x hip causes the compiler to parse the .a
# as source and emit "expected unqualified-id" / UTF-8 errors.
ifeq ($(suffix $(HSAKMT_LIB)),.a)
LDFLAGS += -Wl,$(HSAKMT_LIB) -ldrm_amdgpu -ldrm
else
LDFLAGS += -lhsakmt
endif
$(info - Building with Anvil GPU-initiated SDMA executor. Can set ENABLE_ANVIL_EXEC=0 to disable)
endif
endif
ifeq ($(ANVIL_ENABLED), 0)
$(info - Building without Anvil GPU-initiated SDMA executor support)
endif
endif
endif

.PHONY : all clean

all: TransferBench

TransferBench: ./src/client/Client.cpp $(shell find -regex ".*\.\hpp")
$(CXX) $(CXXFLAGS) $(HIPFLAGS) $(COMMON_FLAGS) $< -o $@ $(HIPLDFLAGS) $(LDFLAGS)
ANVIL_SRCS =
ifeq ($(ANVIL_ENABLED), 1)
ANVIL_SRCS = ./src/anvil/anvil.cpp
endif

TransferBench: ./src/client/Client.cpp $(ANVIL_SRCS) $(shell find -regex ".*\.\hpp")
$(CXX) $(CXXFLAGS) $(HIPFLAGS) $(COMMON_FLAGS) ./src/client/Client.cpp $(ANVIL_SRCS) -o $@ $(HIPLDFLAGS) $(LDFLAGS)

TransferBenchCuda: ./src/client/Client.cpp $(shell find -regex ".*\.\hpp")
$(NVCC) $(NVFLAGS) $(COMMON_FLAGS) $< -o $@ $(LDFLAGS)
Expand Down
Loading