Repository navigation
feat(rccl): embed CSV tuner configs in librccl.so - #13038
Conversation
tuner/*.csv is compiled into the library and used as the stock tuning default, so clusters no longer need the file staged on every node or on NFS. Disk locations and NCCL_TUNER_CONFIG_FILE still override it. RCCL_TUNER_EMBEDDED_CONFIG=0 disables the embedded map.
|
No undocumented RCCL or NCCL environment-variable changes. |
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
There was a problem hiding this comment.
🟡 Changes recommended
New CSV discovery and test-target generation dependencies can leave configs omitted or cause clean parallel builds to fail.
3 open findings
What changed in this PR
Embeds RCCL CSV tuner defaults into librccl.so while preserving disk-based overrides.
Changes:
- Generates an embedded configuration header from
tuner/*.csv. - Adds buffer-backed parsing and embedded-config resolution.
- Adds host microtests and updated documentation.
| File | Description |
|---|---|
projects/rccl/CMakeLists.txt |
Adds embedded-config generation and removes CSV installation. |
projects/rccl/src/CMakeLists.txt |
Makes RCCL depend on generated configs. |
projects/rccl/cmake/GenerateEmbeddedTunerConfigs.cmake |
Generates the embedded CSV header. |
projects/rccl/src/plugin/tuner/csv_tuner.cc |
Resolves and parses embedded configurations. |
projects/rccl/src/include/tuner.h |
Exposes embedded-config helpers. |
projects/rccl/test/host/csv-tuner-test.cc |
Tests parsing, resolution, and application. |
projects/rccl/test/host/CMakeLists.txt |
Adds the tuner microtests. |
projects/rccl/test/test_categories_micro.yaml |
Registers the new test suite. |
projects/rccl/tuner/README.md |
Documents embedded defaults and overrides. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Document RCCL_TUNER_EMBEDDED_CONFIG in CHANGELOG.md and env-variables.rst. Make the micro-test targets depend on the generated header so a clean parallel build cannot race it, and glob the CSVs with CONFIGURE_DEPENDS so a newly added file is picked up. Clarify the generic-config fallback in the tuner README.
There was a problem hiding this comment.
ARGUS
Findings
1 finding(s) that could not be posted as inline comments
projects/rccl/test/host/csv-tuner-test.cc:264(Low) The target-row filter omits numPipeOps and regBuff, which csvTunerGetCollInfo also requires The target-row filter checks onlynNodesandnRanks, butcsvTunerGetCollInfo(csv_tuner.cc:696-697) also gates onnumPipeOpsandregBuffagainst the 1 and 0 passed at line 278. Every shipped row ends-1,-1today, so the first retune that sets either value makestargetunmatchable and line 281 fails for a reason unrelated to the code under test.
Bottom line: Worth settling before approval: the installed-override example at tuner/README.md:35 copies the CSV under a name no disk probe looks for, so the documented override is inert.
Comment @argus review to re-run, or @argus re-review after pushing.
Add a test that the generator embeds each CSV verbatim, and tests that a share-path CSV beats the embedded map. Strengthen the over-long-line and CRLF cases so they can actually fail. Regenerate the header from an always-run target so a deleted CSV stops shipping. Fix the README install example filename and qualify the arch claim in env-variables.rst.
corey-derochie-amd
left a comment
There was a problem hiding this comment.
LGTM. The unresolved Argus notes all look valid, so best to review and consider addressing those before merge.
Cap the config file read so a wrong path cannot grow the allocation, check the standalone generator's exit status, make the generic share-path test use an arch the embedded map carries, and note that stale tuner/ copies from earlier builds still win.
PedramAlizadeh
left a comment
There was a problem hiding this comment.
LGTM! Just the introduced conflicts need to be resolved.
Thanks Mustafa!
Restrict the generator glob to rccl_tuner*.csv so a stray CSV cannot become the arch-unknown pick, and reject names that would break the string literal. Cover the arch-unknown, no-trailing-newline and oversized-file branches, derive the arch from the embedded map instead of hardcoding gfx950, and make the cost-table case select on every field getCollInfo gates on.
|
@argus re-review |
csvTunerInit's disk arm had no case: every existing test resolved to the embedded map, so dropping the resolved-path capture left the suite green while a share-path CSV silently loaded nothing. Also split the knob case so it distinguishes ignoring the embedded map from disabling the tuner.
TheRock Submodule Bump ActivityNewest first
|



Motivation
The built-in CSV tuner (
src/plugin/tuner/csv_tuner.cc) can only read its tuning table from a file on disk. On a multi-node cluster that means staging the CSV on every node or putting it on NFS, which is an operational burden and a silent mis-tune whenever one node's copy drifts. Compiling the shipped configs into the library removes that requirement.Technical Details
tuner/*.csvis compiled intolibrccl.soas astd::map<std::string, std::string>(key = file name, value = CSV text) and used as the stock default. New generatorcmake/GenerateEmbeddedTunerConfigs.cmakeemits the content as raw string literals and fails the build if a CSV ever contains the raw-string terminator. It runs from an always-run target and rewrites the header only when the content changes, so deleting a CSV stops shipping it without churning rebuilds.NCCL_TUNER_CONFIG_FILE, then the<libdir>/tuner/andshare/rccl/tuner/locations). The embedded map is a new step 8, so a customer-placed CSV still overrides it.rocm_install(DIRECTORY tuner ...)andfile(COPY tuner ...)are dropped, so the binary is the only stock source and the build tree cannot shadow it.rccl_tuner.csv, otherwise stays inactive. It never borrows another arch's tuning, matching the existing disk rule. When the arch cannot be determined, any embedded config may be used, same as the existing directory scan.RCCL_TUNER_EMBEDDED_CONFIG=0disables only the embedded defaults;NCCL_TUNER_PLUGIN=nonestill disables the tuner entirely.fgetsloop became a buffer-based one shared by both sources, preservingfgetstruncate-and-resume on over-long lines so file-backed and embedded configs cannot diverge. Parsing is otherwise identical to before, with one deliberate exception noted below.One intentional parsing change
A trailing
\ris now stripped from each line. This only matters for CRLF config files whose line ends on a trailing comma, where the stray CR previously became its own token:The old value was wrong. LF files are unaffected.
Issue Tracking
JIRA ID: AICOMRCCL-2762
Test Plan
New host microtests in
test/host/csv-tuner-test.cc: that the generator embeds eachtuner/*.csvbyte for byte, embedded/file parse parity, arch-key selection,NCCL_TUNER_CONFIG_FILEandshare/rccl/tuner/overrides beating the embedded map, the disable knob, CRLF, and over-long-line chunking. A separate differential harness compares the old and new parsers across 32 inputs (shipped CSV, 8/9/10/11 field counts, whitespace, CRLF variants, unknown enums, no trailing newline, 255/256-char boundaries, over-long lines with valid and invalid tails).On Ruby
mi350-cluster-2(gfx950), single-node 8 GPU,all_reduce_perf -b 1K -e 256M -f 2 -g 8withNCCL_DEBUG=INFO NCCL_DEBUG_SUBSYS=TUNING, in four configurations: stock,NCCL_TUNER_CONFIG_FILEpointed at a copy of the same bytes,RCCL_TUNER_EMBEDDED_CONFIG=0, andNCCL_TUNER_PLUGIN=none.Test Result
31 of the 32 differential inputs parse identically between the old and new parsers. The single difference is the CRLF trailing-comma case described above.
rccl-UnitTestsMicropasses, including the new cases.On Ruby: the stock run logs
Using built-in CSV tuner, config: <embedded>/rccl_tuner_gfx950.csvand loads 7 configs. Embedded vs file source give identicalApplied configdecisions after dedup and busbw within run-to-run noise at all 19 sizes;#wrong=0in every run. Both negative controls resolve no CSV tuner.strings librccl.so.1.0confirms the CSV bytes are in the binary andbuild/release/tuner/is gone.Not covered: the
nNodes=2,nRanks=16rows are exercised by the unit test but not on hardware. The 16-rank run fails at init on this develop-HEAD build (sched_setaffinity failed: Invalid argument,src/os/linux.cc:612); it reproduces withNCCL_TUNER_PLUGIN=noneand stock/opt/rocmRCCL passes the identical job, so it is pre-existing and not from this change.Submission Checklist