Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .claude/skills/transferbench-debug/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Only after that, branch by symptom — see the table below.
| Bandwidth varies wildly run-to-run | Warmup too short, NUMA/clock policy | `NUM_WARMUPS=10`, `SHOW_ITERATIONS=1`, `SHOW_PERCENTILES=50,90,99` | `references/common-failures.md` §perf |
| Crash / segfault | Bad memory code (e.g. `F` on a GPU without fine-grain), bad kernel for arch | Run with `dryrun` first; rebuild without optimization for symbol info | `references/common-failures.md` §crash |
| "Unsupported" / executor missing | Build-time disable (e.g. `DISABLE_NIC_EXEC=1`, `DISABLE_POD_COMM=1`) | `./TransferBench` (no args) — its banner lists which executors are compiled in | `references/common-failures.md` §unsupported |
| Storage Transfer (`S` with `F`, or `nvme` preset) rejected or fails | `TB_STORAGE_PATHS` unset, hipFile unavailable, or hipFile direct I/O not usable on this host | `./TransferBench` (no args) — storage section shows paths and hipFile availability; retry with `HIPFILE_FORCE_COMPAT_MODE=true` | `references/common-failures.md` §storage |
| Output is garbled / interleaved across ranks | MPI stderr buffering, no per-rank labels | `mpirun --tag-output` or pipe each rank into a per-rank log | `references/multi-rank-debug.md` §output |

## The four "always-on" introspection commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,41 @@ Catalog of the most common "it doesn't work" cases, organized by symptom. Each s

---

## §storage — storage Transfer (`S` with hipFile `F`) or `nvme` preset fails

### Symptom
- "No storage paths are defined on rank N" or the `nvme` preset prints `TB_STORAGE_PATHS` instructions and exits.
- "Storage memory (S) can only be accessed by the hipFile (F) executor".
- "hipFile executor is requested but is not available".
- "hipFile read/write ... failed (...): ... hipFile's fastpath may not be usable here".
- "Storage N (...) is a block device. Writing to it destroys its contents and requires TB_STORAGE_ALLOW_BLOCK_WRITE=1".
- "Storage N (...) is an existing file that holds data. Writing to it destroys its contents and requires TB_STORAGE_ALLOW_OVERWRITE=1", or the `nvme` preset reports `UNVALIDATED` on a second run.
- "numBytes (...) and [data.byteOffset] (...) are not both multiples of 4096. hipFile will use its compatibility path for unaligned I/O" (warning).
- Suspiciously high bandwidth with I/O path `compat`.

### Cause
- `TB_STORAGE_PATHS` is unset, or the storage index is beyond the list (`S1` with one path).
- A combination outside what storage Transfers allow: exactly one SRC and one DST, one of them `S`, the other `G` on the executor's GPU, same rank.
- The binary was built without hipFile support: `hipfile.h` from the hipFile development package (`amdrocm-hipfile-dev<version>`) was not found at build time. The version line then has no `hipFile`. Rebuilding is the only fix.
- "error while loading shared libraries: libhipfile.so.0" at startup: the binary was built with hipFile support and the hipFile runtime package (`amdrocm-hipfile<version>`) is missing on this host.
- A storage path under `/dev/` that does not exist is rejected ("Paths under /dev/ ... are not created"): almost always a mistyped device name.
- hipFile attempted direct I/O where it can't work (no AIS support in the GPU driver, no PCIe P2PDMA, storage not local NVMe, WSL2 with an older hipFile). It does not always fall back by itself.
- A write targets a raw block device without the opt-in.
- A storage file already holds data (a user's file, or the file an earlier run left behind) and `TB_STORAGE_ALLOW_OVERWRITE=1` is not set.
- Compatibility-path I/O goes through host memory and the page cache; it is not a direct storage ↔ GPU number.

### Fix
1. `./TransferBench` with no args — the storage section lists the paths and whether hipFile is available on this host.
2. `./TransferBench dryrun 1M "<expression>"` to see the parsed Transfer; fix the SRC/EXE/DST combination.
3. `HIPFILE_FORCE_COMPAT_MODE=true` to confirm the Transfer itself is sound; then `ais-check` (ships with hipFile) to see why direct I/O is unavailable.
4. `TB_VERBOSE=1` and look for `storage I/O path:` — `HIPFILE_ALLOW_COMPAT_MODE=false` makes hipFile fail instead of silently using `compat`.
5. For direct I/O: use a byte count that is a multiple of 4096, `BYTE_OFFSET=0`, and a file on xfs / ext4 on a local NVMe drive (or the raw block device).
6. Block devices: **do not** set `TB_STORAGE_ALLOW_BLOCK_WRITE=1` unless the user confirms the device holds nothing of value. Read-only Transfers (`S0->F0->G0`) work without it, but skip validation.
Existing files: delete TransferBench's own scratch file or set `TB_STORAGE_ALLOW_OVERWRITE=1` to reuse it; **do not** set it for a file that may hold the user's data.
7. `TB_HIPFILE_SKIP_BUF_REGISTER=1` if it hangs or fails while registering the GPU buffer.

---

## §parser — config-file parser rejects a line

### Symptom
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ The first one is especially valuable when debugging — its banner names every e
| `NIC_CQ_POLL_BATCH=N` | CQ poll batch size | Reduce to 1 to expose race conditions |
| `NIC_RELAX_ORDER=0\|1` | Relaxed ordering on the NIC | Disable when ordering bugs suspected |

## Storage (hipFile) debug

| Variable | Effect | Use case |
|---|---|---|
| `TB_VERBOSE=1` | Logs storage open, hipFile handle / buffer registration, and `storage I/O path: fastpath\|compat\|mixed\|unknown` per executor (`unknown`: hipFile older than 0.5.0, or `HIPFILE_STATS_LEVEL=0`) | "Did this hipFile number come from direct I/O or from the compatibility path?" |
| `HIPFILE_FORCE_COMPAT_MODE=true` | hipFile's own variable: never attempt direct I/O | hipFile Transfers fail with "fastpath may not be usable here" |
| `HIPFILE_ALLOW_COMPAT_MODE=false` | hipFile's own variable: fail instead of falling back | Prove a result is direct I/O |
| `TB_HIPFILE_SKIP_BUF_REGISTER=1` | Skip `hipFileBufRegister` | Hang or failure while registering the GPU buffer with hipFile |
| `TB_STORAGE_TIMED_SYNC=1` | Include `fdatasync` in write timing | Compatibility-path write bandwidth looks too good |

## Pod / multi-rank fallbacks

| Variable | Effect | Use case |
Expand Down
13 changes: 11 additions & 2 deletions .claude/skills/transferbench-run/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Use when the user wants to *run* TransferBench (the ROCm/CUDA memor

# TransferBench

TransferBench is a command-line utility for benchmarking simultaneous data transfers between CPU, GPU, and NIC memory locations using GPU kernels, DMA engines, RDMA NICs, or CPU threads. It runs on AMD (ROCm/HIP) and NVIDIA (CUDA) platforms.
TransferBench is a command-line utility for benchmarking simultaneous data transfers between CPU, GPU, and NIC memory locations using GPU kernels, DMA engines, RDMA NICs, or CPU threads. It can also benchmark I/O between storage (NVMe-backed files or block devices) and GPU memory using hipFile. It runs on AMD (ROCm/HIP) and NVIDIA (CUDA) platforms; the hipFile executor is HIP-only.

The binary is named `TransferBench` (HIP build) or `TransferBenchCuda` (CUDA build). A prebuilt `TransferBenchCuda` may exist at the repo root; otherwise build with `make` (HIP) or `make TransferBenchCuda` (CUDA).

Expand All @@ -25,7 +25,9 @@ A **SubExecutor (SE)** is the unit of parallelism inside an executor:
- CPU executor → CPU thread
- GPU executor → threadblock / Compute Unit (CU)
- DMA / Batched-DMA → stream / batch item (must have a single SRC)
- NIC → Queue Pair
- TDM → threadblock / Compute Unit (CU)
- NIC / Nearest-NIC → Queue Pair
- hipFile (storage) → I/O thread

## Invocation

Expand Down Expand Up @@ -76,6 +78,13 @@ Write a small `.cfg` file (see `references/config-format.md`) and pass it as the
./TransferBench nicrings # NIC ring tests
```

### "How fast is NVMe ↔ GPU?" → nvme preset or storage Transfers
```bash
TB_STORAGE_PATHS=/mnt/nvme0/tb.dat ./TransferBench nvme 1G # write + read per GPU, validated
TB_STORAGE_PATHS=/mnt/nvme0/tb.dat ./TransferBench cmdline 1G "1 4 (S0->F0->G0)" # one hipFile read, 4 I/O threads
```
`S0` is the first path in `TB_STORAGE_PATHS` (a file, or a block device such as `/dev/nvme1n1`). `F` is the hipFile executor. Check the reported I/O path (`fastpath` vs `compat`) before comparing numbers, and never set `TB_STORAGE_ALLOW_BLOCK_WRITE=1` without confirming with the user: it lets TransferBench overwrite the listed block devices. A file that already holds data is read-only (writes rejected, reads unvalidated) unless `TB_STORAGE_ALLOW_OVERWRITE=1` is set; use that only for TransferBench's own scratch file, such as the one an earlier run left behind. See `references/config-format.md` and `references/env-vars.md`.

### "Pod-aware (multi-rank, single MNNVL/XGMI pod)" → pod presets
```bash
./TransferBench podp2p # within-pod P2P
Expand Down
30 changes: 30 additions & 0 deletions .claude/skills/transferbench-run/references/config-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ Example:
| `B` | Batched-DMA | GPU device | `hipMemcpyBatchAsync`-based; HIP 7.1 / CUDA 12.8+ |
| `I#.#` | NIC executor | NIC index `.` QP index | e.g. `I0.2` |
| `N#.#` | Nearest-NIC executor | GPU index `.` QP index | Picks each end's closest NIC |
| `T` | TDM | GPU device | SubExecutor = threadblock / CU; AMD gfx1250 or NVIDIA sm_90+ |
| `F` | hipFile | GPU device | SubExecutor = I/O thread; storage ↔ GPU memory via `hipFileRead`/`hipFileWrite` |

Executor and memory codes are independent: `F` as an executor is hipFile, `F` as a memory location is fine-grain device memory.

## Memory-location codes

Expand All @@ -68,10 +72,36 @@ A memory location is `<code><index>`. Multiple locations can be concatenated for
| `G` | Global device memory | GPU |
| `F` | Fine-grain device memory | GPU |
| `U` | Uncached device memory | GPU |
| `M` | Managed memory | GPU |
| `N` | Null (no read or no write) | ignored |
| `S` | Storage (regular file or raw block device) | position in `TB_STORAGE_PATHS` |

`N` on the SRC side gives a "memset-like" write benchmark; `N` on the DST side gives a "read-only" benchmark.

## Storage transfers (`S` with `F`)

`S<n>` is the n-th path (0-based) in the comma-separated `TB_STORAGE_PATHS` environment variable. Rules:

- `S` only works with the `F` (hipFile) executor, and that executor needs exactly one `S`.
- Exactly one SRC and one DST: one is `S`, the other is `G` on the executor's GPU (`S0->F1->G1` is valid, `S0->F0->G1` is not). Same rank for all three.
- The byte count and `BYTE_OFFSET` should be multiples of 4096. Other values are accepted with a warning (hipFile uses its compatibility path).
- A block device is only written to with `TB_STORAGE_ALLOW_BLOCK_WRITE=1` (destroys its contents). Without it, writes are rejected and reads skip validation.
- A file that already holds data (including one left by an earlier run) is only written to with `TB_STORAGE_ALLOW_OVERWRITE=1`. Without it, writes are rejected and reads skip validation.
- A missing regular file is created; a missing path under `/dev/` (other than `/dev/shm/`) is an error.
- `F` needs a binary built with hipFile support (the version line shows `hipFile`).
- No executor subindices, no PingPong, HIP builds only.

```
## hipFile read: storage 0 into GPU0 with 4 I/O threads
1 4 (S0->F0->G0)

## hipFile write: GPU0 to storage 0 with 4 I/O threads
1 4 (G0->F0->S0)

## Two GPUs each reading from their own drive in parallel
2 4 (S0->F0->G0) (S1->F1->G1)
```

## Idiomatic patterns

```
Expand Down
24 changes: 24 additions & 0 deletions .claude/skills/transferbench-run/references/env-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,30 @@ This is a curated guide to the most-used variables. For the authoritative comple
| `NIC_RELAX_ORDER` | `1` | Relaxed ordering on the NIC. |
| `TB_NIC_FILTER` | unset | Restrict which NICs participate. |

## Storage (hipFile executor)

| Variable | Default | Effect |
|---|---|---|
| `TB_STORAGE_PATHS` | unset | Comma-separated files and/or block devices. `S<n>` in a Transfer is the n-th path (0-based). Required for any storage Transfer and for the `nvme` preset. |
| `TB_STORAGE_ALLOW_BLOCK_WRITE` | unset | `1` allows writing to block devices in `TB_STORAGE_PATHS`. **Destroys their contents.** |
| `TB_STORAGE_ALLOW_OVERWRITE` | unset | `1` allows overwriting files in `TB_STORAGE_PATHS` that already hold data (needed to reuse the file an earlier run left behind). **Replaces their contents**, for reads too. |
| `TB_STORAGE_TIMED_SYNC` | unset | `1` includes flushing written data to storage (`fdatasync`) in write timing. |
| `TB_HIPFILE_SKIP_BUF_REGISTER` | unset | `1` skips `hipFileBufRegister` for the hipFile executor. |
| `HIPFILE_FORCE_COMPAT_MODE` | `false` | hipFile's own variable: `true` forces its compatibility path (POSIX I/O via host memory). |
| `HIPFILE_ALLOW_COMPAT_MODE` | `true` | hipFile's own variable: `false` fails instead of falling back, guaranteeing direct I/O. |
| `HIPFILE_UNSUPPORTED_FILE_SYSTEMS` | `false` | hipFile's own variable: `true` attempts direct I/O on file systems other than ext4 (`data=ordered`) / xfs. |

The `HIPFILE_*` variables are read by hipFile once per process and are never set by TransferBench.

Used by the `nvme` preset:

| Variable | Default | Effect |
|---|---|---|
| `NUM_FILE_SE` | `4` | I/O threads per Transfer. |
| `NUM_GPU_DEVICES` | all | Limit GPUs tested. |
| `NVME_MODE` | `0` | `0` write + read, `1` write only, `2` read only. |
| `NVME_PAIRED` | `0` | `1` = GPU i only uses storage path (i mod #paths); `0` = every GPU × every path. |

## Multi-rank / pod

| Variable | Default | Effect |
Expand Down
2 changes: 2 additions & 0 deletions .claude/skills/transferbench-run/references/presets.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ For the live list on a given build, run `./TransferBench presets`.
| `gfxsweep` | Sweeps GFX kernel options for one Transfer. |
| `hbm` | Local HBM read bandwidth on each GPU. |
| `healthcheck` | Quick correctness/perf health check (AMD MI300 series only). |
| `nvme` | GPU → storage write and storage → GPU read per GPU and storage path, via hipFile, with validation. Needs `TB_STORAGE_PATHS`; non-zero exit on failure. |
| `one2all` | All subsets of parallel transfers from one GPU to all others. |
| `p2p` | Peer-to-peer device-memory matrix between every GPU pair. |
| `pcopy` | Parallel copies from a single GPU to other GPUs. |
Expand Down Expand Up @@ -70,5 +71,6 @@ These print and exit; they don't run transfers.
- "All-pairs simultaneous" → `a2a`.
- "How does perf scale with CUs?" → `scaling` or `gfxsweep`.
- "Across two nodes via RDMA" → `nicp2p` for matrix, `nica2a` for collective-style.
- "How fast can a GPU load from / save to NVMe?" → `nvme` with `TB_STORAGE_PATHS` set.
- "Within an MNNVL pod" → `podp2p` / `poda2a`.
- "I want to capture what a preset does and tweak it" → run with `TB_DUMP_CFG_FILE=out.cfg`, then edit `out.cfg`.
1 change: 1 addition & 0 deletions .github/workflows/README_BUILD_PACKAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ The workflow always builds with:
- `ENABLE_MPI_COMM=OFF` — MPI multi-node communicator disabled (would require OpenMPI at runtime; not bundled by TheRock SDK). Packages are built to run out of the box with only `numactl`/`libnuma1` from the OS.
- `DISABLE_DMABUF=OFF` — DMA-BUF support for GPU Direct RDMA
- `BUILD_RELOCATABLE_PACKAGE=ON` — RVS-style install prefix + package naming
- `ENABLE_HIPFILE` is left at its default (`AUTO`) — the hipFile executor is built when the SDK provides `hipfile.h` and `libhipfile`. The binary then needs `libhipfile.so.0` at runtime, and the DEB/RPM packages depend on the hipFile runtime package of the ROCm release they were built against (`amdrocm-hipfile<major>.<minor>`). Pass `-DENABLE_HIPFILE=OFF` to build without it
- `GPU_TARGETS` — full data-center + consumer set (gfx906, 908, 90a, 942, 950, 1030, 1100/01/02, 1150/51/52/53, 1200/01)

## Local builds
Expand Down
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,52 @@
Documentation for TransferBench is available at
[https://rocm.docs.amd.com/projects/TransferBench](https://rocm.docs.amd.com/projects/TransferBench).

## v1.72.00
### Added
- Added storage memory type [S] to benchmark I/O between storage and GPU memory. `SN` refers to the N-th path
(starting from 0) in the new comma-separated `TB_STORAGE_PATHS` environment variable. Each path is either a regular
file (typically on an NVMe-backed filesystem) or a raw block device such as `/dev/nvme1n1`
- Regular files are created and grown as needed, and are left in place afterwards. A path under `/dev/` (other
than `/dev/shm/`) that does not exist is rejected instead of being created, as it is most likely a mistyped
device name
- A file that already holds data when TransferBench first uses it (including one left behind by an earlier run)
is only written to if `TB_STORAGE_ALLOW_OVERWRITE=1` is set. Otherwise it is treated like a block device:
Transfers that write to it are rejected, and Transfers that read from it transfer the existing contents
without data validation
- Each entry must be a distinct file or device, and ranks on the same host need distinct paths (files are locked
while in use, and block devices that are written to are opened exclusively). An empty entry ahead of a path is
rejected, as it would renumber the storage indices that follow it
- Block devices are never created or resized, and are only written to if `TB_STORAGE_ALLOW_BLOCK_WRITE=1` is set
(this destroys their contents). Otherwise Transfers that write to them are rejected, and Transfers that read
from them transfer the existing contents without data validation
- Added hipFile executor [F], which moves data between storage memory and GPU memory using
`hipFileRead`/`hipFileWrite`. It is indexed by GPU, and its SubExecutors are I/O threads issuing blocking calls
- hipFile is an optional build-time dependency: the executor is built when `hipfile.h` (hipFile development
package, e.g. `amdrocm-hipfile-dev10.2`) is found, and TransferBench then links against `libhipfile`
- Makefile: detected under `HIPFILE_PATH` (defaults to `ROCM_PATH`); `DISABLE_HIPFILE=1` builds without it
- CMake: `-DENABLE_HIPFILE=AUTO|ON|OFF` (default `AUTO`: use hipFile if found under `ROCM_PATH`), with
`-DHIPFILE_PATH` (or the `HIPFILE_PATH` environment variable) to point at it. Packages built with hipFile support depend on the hipFile runtime package (e.g. `amdrocm-hipfile10.2`)
- Without hipFile support, [F] and [S] are still parsed, and a Transfer using the hipFile executor is rejected
with an error saying that TransferBench was built without hipFile support
- e.g. `1 4 (S0->F0->G0)` reads storage 0 into GPU 0 memory with 4 I/O threads, and `(G0->F0->S0)` writes
- A storage Transfer has exactly one SRC and one DST: one is storage memory and the other is GPU device memory [G]
on the Executor's GPU. Other combinations involving [S] or the executor [F] are rejected with a fatal error
- Wildcards for the Executor index and the GPU memory index follow each other, e.g. `(S0->F*->G*)` expands to one
Transfer per GPU
- If the number of bytes or `BYTE_OFFSET` is not a multiple of 4096, a warning is shown, as hipFile then uses its
compatibility path
- Timing uses CPU wall clock around the I/O calls only. Written data is flushed and the page cache dropped before
each timed pass. `TB_STORAGE_TIMED_SYNC=1` includes flushing written data to storage in write timing
- `TB_HIPFILE_SKIP_BUF_REGISTER=1` skips registering GPU buffers with hipFile
- Not supported on NVIDIA hardware
- Added "nvme" preset, which writes from each GPU to each storage path and then reads from each storage path into
each GPU using the hipFile executor, with data validation of every Transfer. It reports bandwidth and the I/O path
used (fastpath / compat) per Transfer, and returns a non-zero exit code if any Transfer fails
- Behavior can be modified with `NUM_FILE_SE`, `NUM_GPU_DEVICES`, `NVME_MODE` and `NVME_PAIRED`
- Topology output now lists storage paths and whether the hipFile executor is available
### Modified
- Help text and examples/example.cfg now list all eight Executors and the managed [M] and storage [S] memory types

## v1.71.02
### Added
- LaunchTransferBench.sh now supports bracketed range wildcards in the host list, e.g. `node[1..4]` or
Expand Down
Loading
Loading