Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9103c8c
feat: add anvil KFD/SDMA queue library headers
nileshnegi May 5, 2026
4cfc859
feat: add anvil.cpp — xio-free adaptation of anvil.hip
nileshnegi May 5, 2026
32a2bf5
build: add ENABLE_ANVIL_EXEC cmake option for GPU-initiated SDMA exec…
nileshnegi May 5, 2026
29052c6
feat: add EXE_GPU_INITIATED_DMA enum value (char code 'S')
nileshnegi May 5, 2026
8fd77b0
build: fix hsakmt IMPORTED target — use STATIC for .a, add drm transi…
nileshnegi May 5, 2026
ca5dc52
feat: add anvilQueues field to ExeInfo for SDMA queue handles
nileshnegi May 5, 2026
8408f97
feat: add TransfersHaveErrors validation for EXE_GPU_INITIATED_DMA
nileshnegi May 5, 2026
e9039a8
feat: implement PrepareAnvilExecutor and extend Teardown for anvil
nileshnegi May 6, 2026
9ce6051
feat: implement AnvilTransferKernel and RunAnvilExecutor
nileshnegi May 6, 2026
f056a77
fix: add gfx1250 s_waitcnt compat in sdma-ep.h; remove kernel no-op g…
nileshnegi May 6, 2026
20241a0
fix: make IsGpuExeType unconditional to prevent segfault on gfx950
nileshnegi May 6, 2026
5ddb1d8
build: add ENABLE_ANVIL_EXEC flag to Makefile
nileshnegi May 6, 2026
5858cf6
build: pass libhsakmt.a via -Wl, to avoid -x hip parsing it as source
nileshnegi May 6, 2026
0db8f54
feat: add TB_VERBOSE=1 logging for anvil alloc/dealloc lifecycle
nileshnegi May 6, 2026
3dbb620
fix: add EXE_GPU_INITIATED_DMA to ExeTypeToStr as "GISDMA"
nileshnegi May 6, 2026
e59c66e
feat: extend USE_DMA_EXEC in AllToAll preset to support BMA and GISDMA
nileshnegi May 6, 2026
5bbcc10
fix: remove ANVIL_EXEC_ENABLED guard from RecursiveWildcardTransferEx…
nileshnegi May 7, 2026
254f6a7
fix: remove ANVIL_EXEC_ENABLED guard from GetHsaAgent switch case
nileshnegi May 7, 2026
8fb8364
anvil: suppress nodiscard warnings on hipFree in SdmaQueue dtor
nileshnegi May 7, 2026
6eba6d1
anvil: add HSA preferred-engine selection + SDMA affinity topology table
nileshnegi May 7, 2026
d06612a
topology: fix SDMA affinity table column alignment
nileshnegi May 7, 2026
32435e7
fix: honor byteOffset in DMA and Anvil writes
nileshnegi Jun 28, 2026
4d8c5f5
anvil: run GISDMA transfers concurrently with per-transfer timing
nileshnegi Jul 10, 2026
e25f322
anvil: add opt-in round-robin SDMA engine selection
nileshnegi Jul 11, 2026
081833d
anvil: use hipExtLaunchKernelGGL for GISDMA kernel timing
nileshnegi Jul 11, 2026
cb5a8e3
anvil: use engine-ordered signal for GISDMA completion
nileshnegi Jul 11, 2026
00ffecb
anvil: add runtime toggles for GISDMA doorbell placement and completi…
nileshnegi Jul 13, 2026
7830ed5
anvil: add ANVIL_LEGACY toggle for legacy put/quiet GISDMA completion
nileshnegi Jul 13, 2026
edb0625
anvil: split GISDMA kernel into four non-branching variants
nileshnegi Jul 13, 2026
ed33c34
anvil: chunk GISDMA copies to lift the 1 GiB per-transfer limit
nileshnegi Jul 21, 2026
7b940cf
anvil: add host-initiated (CPU-driven) SDMA queue path
nileshnegi Jul 21, 2026
0a3a12e
anvil: add OSS7 fused copy+signal SDMA packet (gfx1250)
nileshnegi Jul 21, 2026
870d5ab
build: enable XIO_SDMA_OSS7 fused packets by default (all-arch safe)
nileshnegi Jul 21, 2026
7f6b2ee
anvil: rename GISDMA executor to GMA and split host path into HMA
nileshnegi Jul 22, 2026
95f39bb
docs: document GMA/HMA anvil SDMA executors in CHANGELOG
nileshnegi Jul 31, 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

## v1.69.00
### Added
Expand Down
60 changes: 60 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,25 @@ 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 across
# archs - the MI4 structs and host code are ABI-only, and the fused *device*
# code is arch-gated via XIO_SDMA_OSS7_ENABLED (src/anvil/anvil_device.hpp) so
# it only codegens on gfx1250/gfx950. Safe to enable for an all-arch package
# build; the fused path is still selected at runtime only on gfx1250. On by
# default; 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
78 changes: 71 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,77 @@ _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
# across archs - the MI4 structs and host code are ABI-only, and the fused
# *device* code is arch-gated via XIO_SDMA_OSS7_ENABLED (anvil_device.hpp)
# so it only codegens on gfx1250/gfx950 regardless of GPU_TARGETS. The
# fused path is still selected at runtime only on gfx1250. On by default;
# 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