Repository navigation
feat(rccl): embed CSV tuner configs in librccl.so #13038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
22af4d5
feat(rccl): embed CSV tuner configs in librccl.so
mustafabar 8b2408b
fix(rccl): address review feedback on embedded CSV tuner
mustafabar d2ce21b
fix(rccl): address ARGUS review on embedded CSV tuner
mustafabar 92168ce
fix(rccl): address second ARGUS round on embedded CSV tuner
mustafabar a301f5e
Merge branch 'develop' into users/mustafabar/embedded-csv-tuner
mustafabar b77af59
fix(rccl): address third ARGUS round on embedded CSV tuner
mustafabar 74bd50f
test(rccl): cover csvTunerInit disk arm and the embedded knob
mustafabar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # | ||
| # Copyright (c) 2026, Advanced Micro Devices, Inc. All rights reserved. | ||
| # | ||
| # See LICENSE.txt for license information | ||
| # | ||
| # Embeds tuner/*.csv into a header so librccl.so ships the built-in CSV tuner | ||
| # configs without the files being staged on disk. | ||
| # | ||
| # cmake -DTUNER_DIR=<dir> -DOUT_FILE=<header> -P GenerateEmbeddedTunerConfigs.cmake | ||
|
|
||
| if(NOT DEFINED TUNER_DIR OR NOT DEFINED OUT_FILE) | ||
| message(FATAL_ERROR "GenerateEmbeddedTunerConfigs.cmake requires -DTUNER_DIR and -DOUT_FILE") | ||
| endif() | ||
|
|
||
| set(RAW_DELIM "RCCLCSV") | ||
|
|
||
| # Match what the runtime accepts on disk (findTunerFileInDir): a stray | ||
| # tuner/notes.csv would otherwise be embedded and, sorting first, become what | ||
| # the arch-unknown lookup returns. | ||
| file(GLOB CSV_FILES "${TUNER_DIR}/rccl_tuner*.csv") | ||
| list(SORT CSV_FILES) | ||
|
|
||
| set(ENTRIES "") | ||
| foreach(CSV_FILE ${CSV_FILES}) | ||
| get_filename_component(CSV_NAME ${CSV_FILE} NAME) | ||
| file(READ ${CSV_FILE} CSV_CONTENT) | ||
|
|
||
| # The name is spliced into a C++ string literal, the content into a raw one. | ||
| if(CSV_NAME MATCHES "[\"\\\\]") | ||
| message(FATAL_ERROR "${CSV_FILE} has a quote or backslash in its name and cannot be embedded") | ||
| endif() | ||
| string(FIND "${CSV_CONTENT}" ")${RAW_DELIM}\"" BAD_IDX) | ||
| if(NOT BAD_IDX EQUAL -1) | ||
| message(FATAL_ERROR "${CSV_FILE} contains the raw string terminator )${RAW_DELIM}\" and cannot be embedded") | ||
| endif() | ||
|
|
||
| string(APPEND ENTRIES " {\"${CSV_NAME}\", R\"${RAW_DELIM}(${CSV_CONTENT})${RAW_DELIM}\"},\n") | ||
| message(STATUS "Embedding tuner config: ${CSV_NAME}") | ||
| endforeach() | ||
|
|
||
| list(LENGTH CSV_FILES CSV_COUNT) | ||
|
|
||
| set(HEADER "/* Generated by cmake/GenerateEmbeddedTunerConfigs.cmake -- do not edit, do not commit. */ | ||
| #ifndef RCCL_TUNER_EMBEDDED_CONFIGS_H_ | ||
| #define RCCL_TUNER_EMBEDDED_CONFIGS_H_ | ||
|
|
||
| /* ${CSV_COUNT} config(s) embedded from the source tree's tuner/ directory. */ | ||
| struct RcclEmbeddedTunerConfig { | ||
| const char* name; | ||
| const char* content; | ||
| }; | ||
|
|
||
| static const RcclEmbeddedTunerConfig kRcclEmbeddedTunerConfigs[] = { | ||
| ${ENTRIES} {nullptr, nullptr}, /* sentinel: array is never zero-length */ | ||
| }; | ||
|
|
||
| #endif /* RCCL_TUNER_EMBEDDED_CONFIGS_H_ */ | ||
| ") | ||
|
|
||
| # Rewrite only on change so regeneration does not force a rebuild. | ||
| set(OLD_HEADER "") | ||
| if(EXISTS ${OUT_FILE}) | ||
| file(READ ${OUT_FILE} OLD_HEADER) | ||
| endif() | ||
| if(NOT OLD_HEADER STREQUAL HEADER) | ||
| file(WRITE ${OUT_FILE} "${HEADER}") | ||
| endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.