Skip to content

Adding HBM read bandwidth preset - #250

Merged
gilbertlee-amd merged 6 commits into
ROCm:candidatefrom
gilbertlee-amd:HbmPreset
Mar 28, 2026
Merged

gilbertlee-amd merged 6 commits into
ROCm:candidatefrom
gilbertlee-amd:HbmPreset

Conversation

@gilbertlee-amd

Copy link
Copy Markdown
Collaborator

Motivation

This PR adds a new HBM bandwidth preset hbm, which sweeps over various GFX options to find the maximum attainable read bandwidth. Sweep options include which GPUs to target GPU_INDICES, number of subexecutors (CUs/WGPs) to use NUM_SUB_EXECS, unrolling factors UNROLLS, and element bytes sizes ELEM_BYTES.

Usage: ./TransferBench hbm <numBytesAtLeast=1GB>

Technical Details

This preset contains its own specialized / simplified HIP kernel which is optimized for HBM reads, separate from the main TransferBench MIMO Transfer kernel. GPU wallclock timestamps are used by default to measure time (skips kernel launch latency) USE_WALLCLOCK, with HIP event timing being the alternative method of time measurement (includes kernel launch latency). Each threadblock is assigned an identical amount of data to read, such that unroll and threadblock size are accounted for, so that the total amount of data read across all threadblocks is greater than or equal to the optional numBytesAtLeast argument. A time-based pre-warm is executed first PREWARM_MSEC, before some number of iterations are executed NUM_ITERATIONS. In total there are NUM_BUFFER input buffers allocated (according to MEM_TYPE) and initialized with pseudo random data. Each iteration cycles through these different input buffers.

To get more information about runs, users can set SHOW_EXTRA to see which options resulted in the best bandwidth based on the criteria set by CRITERIA (max/avg/min bandwidth). Setting SHOW_DETAILS to 1 will show per config results, and setting to 2 will show per iteration results.

This preset supports multi-rank is supported - results will be collected then reported across all GPUs / all ranks.
This preset should also run on NVIDIA hardware, although some memory types aren't supported.

Test Plan

Collected some sample results on machines. Repeats appear to be quite consistent between runs, as well as between (max/avg/min).

MI300X:

[HBM Bandwidth Related]
BLOCKSIZES           =      256,512 : Threadblock sizes to sweep over (multiple of 128 up to 1024)
CRITERIA             =            0 : Reporting highest MAX bandwidth (0=MAX,1=AVG,2=MIN)
ELEM_BYTES           =         16,8 : Element sizes in bytes to sweep over (must contain only 4,8 or 16)
GPU_INDICES          =              : GPU indices to test.  Leave empty for all
MEM_TYPE             =            0 : Using default GPU memory (0=default, 1=fine-grained, 2=uncached, 3=managed)
NUM_BUFFERS          =            2 : Number of buffers to rotate through (1 per iteration)
NUM_ITERATIONS       =          100 : Number of iterations to time
NUM_SUB_EXECS        =          304 : Number of subexecutors to sweep over (default to all available)
PREWARM_MSEC         =           50 : Prewarm duration in msec
SHOW_DETAILS         =            0 : Show sweep details (ignored for multi-rank).  Setting to 2 shows per iteration output
SHOW_EXTRA           =            0 : Show best sweep config details
TEMPORAL_MASK        =            3 : Temporal mask (1 = temporal, 2 = non-temporal, 3 = both)
UNROLLS              =       16,8,4 : Unroll factors to sweep over (must contain only 1,2,4,8 or 16)
USE_WALLCLOCK        =            1 : Using GPU wall-clock for timing

Testing on at least 1073741824 bytes (24 configs per GPU): ................
┌------------┬--------------------------------------------┐
│ Rank   GPU │ MaxBw (GB/s)   AvgBw (GB/s)   MinBw (GB/s) │
├------------┼--------------------------------------------┤
│    0     0 │      5080.94        5052.32        4988.59 │
│    0     1 │      5083.34        5056.90        5024.94 │
│    0     2 │      5083.34        5060.90        5003.90 │
│    0     3 │      5080.70        5051.52        5016.03 │
│    0     4 │      5066.11        5044.05        4998.79 │
│    0     5 │      5077.83        5047.59        5020.01 │
│    0     6 │      5072.32        5048.55        5019.31 │
│    0     7 │      5080.70        5049.15        4969.92 │
└------------┴--------------------------------------------┘

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new hbm preset intended to sweep kernel/config options and report maximum attainable HBM read bandwidth, including multi-rank aggregation of best-per-GPU results.

Changes:

  • Added new hbm preset implementation with a dedicated read-bandwidth kernel and sweep/aggregation logic.
  • Updated the preset function signature across all presets to also receive whether the byte-count argument was explicitly provided.
  • Added utility helpers for rank-uniformity checking and simple allocation/deallocation forwarders; updated changelog.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
src/header/TransferBench.hpp Minor C++ cleanup (NULLnullptr) and removed an unused variable.
src/client/Utilities.hpp Adds IsUniform helper + IS_UNIFORM macro and allocation/deallocation forwarders.
src/client/Presets/Presets.hpp Wires in new hbm preset and extends preset function signature with bytesSpecified.
src/client/Presets/HbmBandwidth.hpp New preset: kernel table + sweep execution + timing + cross-rank reporting.
src/client/Presets/AllToAll.hpp Updated preset function signature to include bytesSpecified.
src/client/Presets/AllToAllN.hpp Updated preset function signature to include bytesSpecified.
src/client/Presets/AllToAllSweep.hpp Updated preset function signature to include bytesSpecified.
src/client/Presets/HealthCheck.hpp Updated preset function signature to include bytesSpecified.
src/client/Presets/NicRings.hpp Updated preset function signature to include bytesSpecified.
src/client/Presets/NicPeerToPeer.hpp Updated preset function signature to include bytesSpecified.
src/client/Presets/OneToAll.hpp Updated preset function signature to include bytesSpecified.
src/client/Presets/PeerToPeer.hpp Updated preset function signature to include bytesSpecified.
src/client/Presets/PodAllToAll.hpp Updated preset function signature to include bytesSpecified.
src/client/Presets/PodPeerToPeer.hpp Updated preset function signature to include bytesSpecified.
src/client/Presets/Scaling.hpp Updated preset function signature to include bytesSpecified.
src/client/Presets/Schmoo.hpp Updated preset function signature to include bytesSpecified.
src/client/Presets/Sweep.hpp Updated preset function signature to include bytesSpecified.
CHANGELOG.md Documents the new hbm preset addition.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/client/Presets/HbmBandwidth.hpp
Comment thread src/client/Presets/HbmBandwidth.hpp Outdated
Comment thread src/client/Presets/HbmBandwidth.hpp Outdated
Comment thread src/client/Presets/HbmBandwidth.hpp
Comment thread src/client/Presets/HbmBandwidth.hpp Outdated
Comment thread src/client/Utilities.hpp
Comment thread src/client/Presets/HbmBandwidth.hpp Outdated
Comment thread src/client/Presets/HbmBandwidth.hpp Outdated
Comment thread src/client/Presets/HbmBandwidth.hpp Outdated
Comment thread src/client/Presets/Presets.hpp Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/client/Presets/HbmBandwidth.hpp
Comment thread src/client/Presets/HbmBandwidth.hpp Outdated
Comment thread src/client/Utilities.hpp
Comment thread src/client/Presets/HbmBandwidth.hpp Outdated
Comment on lines +466 to +468
for (int iteration = 0; iteration < numIterations; iteration++) {
*minStartCycle = std::numeric_limits<long long int>::max();
*maxStopCycle = 0;

Copilot AI Mar 28, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When USE_WALLCLOCK is disabled, minStartCycle/maxStopCycle remain nullptr but are still unconditionally dereferenced and reset each iteration. This will segfault/crash in event-timing mode. Guard the *minStartCycle/*maxStopCycle writes (and any kernel arguments that rely on them) behind useWallClock, or allocate/init these buffers unconditionally (and update the kernel to handle nullptrs safely).

Copilot uses AI. Check for mistakes.
@gilbertlee-amd
gilbertlee-amd merged commit 168cdc1 into ROCm:candidate Mar 28, 2026
1 of 4 checks passed
@gilbertlee-amd
gilbertlee-amd deleted the HbmPreset branch March 28, 2026 03:15
@nileshnegi nileshnegi mentioned this pull request Apr 27, 2026
1 task
nileshnegi added a commit that referenced this pull request May 2, 2026
- Initial pod communication support (#235)
- cuda + MNNVL update & pod presets (#241)
- Increase CQ size for high qps (#244)
- fix hang when NVML is present but fabricmanager isnt (#246)
- Adding nica2a preset  (#248)
- Adding HBM read bandwidth preset (#250)
- Pod Ring preset (#251)
- gfxsweep preset (#254) (#256)
- Adding Batched DMA support (hipMemcpyBatchAsync), and bmasweep preset (#255)
- Adding a wallclock consistency detection preset (#258)
- Adding smoketest preset for simple correctness tests (#266)
- Help / envvars / presets presets (#267)
- Modernize CMake build (#268)
- Replace version-based pod/amd-smi detection with compile-time API probes (#269)
- Fix collective mismatch hangs in multi-rank error paths (#270)
- Fix SHOW_ITERATIONS table truncation with multiple transfers per executor (#271)
- Reformat a2asweep output to match gfxsweep style (#272)
- Gfx sweep update (#274)
- Increasing flush frequency in smoketest (#275)
- Adding new experimental copy-only GFX kernel, gfxsweep update (#277)
- Fixes for cuMem compilation and invalid device ordinal (#278)
- Simplifying socket connect, allow for using host address (#279)
- Updating podring to run on single node without need to force single pod (#280)
- Adding SHOW_PERCENTILES to show extra per-iteration statistics (#281)

---------

Co-authored-by: AtlantaPepsi <timhu102@gmail.com>
Co-authored-by: Pak Nin Lui <pak.lui@amd.com>
Co-authored-by: pierreantoineH <PierreAntoine.Harraud@amd.com>
Co-authored-by: Nilesh M Negi <Nilesh.Negi@amd.com>
Co-authored-by: Claude <claude@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
nileshnegi added a commit that referenced this pull request May 2, 2026
- Initial pod communication support (#235)
- cuda + MNNVL update & pod presets (#241)
- Increase CQ size for high qps (#244)
- fix hang when NVML is present but fabricmanager isnt (#246)
- Adding nica2a preset  (#248)
- Adding HBM read bandwidth preset (#250)
- Pod Ring preset (#251)
- gfxsweep preset (#254) (#256)
- Adding Batched DMA support (hipMemcpyBatchAsync), and bmasweep preset (#255)
- Adding a wallclock consistency detection preset (#258)
- Adding smoketest preset for simple correctness tests (#266)
- Help / envvars / presets presets (#267)
- Modernize CMake build (#268)
- Replace version-based pod/amd-smi detection with compile-time API probes (#269)
- Fix collective mismatch hangs in multi-rank error paths (#270)
- Fix SHOW_ITERATIONS table truncation with multiple transfers per executor (#271)
- Reformat a2asweep output to match gfxsweep style (#272)
- Gfx sweep update (#274)
- Increasing flush frequency in smoketest (#275)
- Adding new experimental copy-only GFX kernel, gfxsweep update (#277)
- Fixes for cuMem compilation and invalid device ordinal (#278)
- Simplifying socket connect, allow for using host address (#279)
- Updating podring to run on single node without need to force single pod (#280)
- Adding SHOW_PERCENTILES to show extra per-iteration statistics (#281)

---------

Co-authored-by: Tim <43156029+AtlantaPepsi@users.noreply.github.com>
Co-authored-by: Pak Nin Lui <pak.lui@amd.com>
Co-authored-by: pierreantoineH <PierreAntoine.Harraud@amd.com>
Co-authored-by: Nilesh M Negi <Nilesh.Negi@amd.com>
Co-authored-by: Claude <claude@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants