Repository navigation
test(rccl): guard cache bits on LL flag-poll loads (AICOMRCCL-2742) #12836
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
Open
dhanavikram
wants to merge
6
commits into
develop
Choose a base branch
from
users/dhanavikram/ll-nt-bit-test
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+722
−8
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cdb06e8
test(rccl): guard cache bits on LL flag-poll loads (AICOMRCCL-2742)
dhanavikram e512824
ci(rccl): run the LL cache-bit guard in CI (AICOMRCCL-2742)
dhanavikram ff82951
test(rccl): address LL cache-bit guard review (AICOMRCCL-2742)
dhanavikram 0eb1593
test(rccl): widen the LL poll window past the inlined abort check (AI…
dhanavikram 212f1a2
test(rccl): address Argus review of the LL cache-bit guard (AICOMRCCL…
dhanavikram 0218a21
test(rccl): check LL polls in every offload bundle, incl. DDA and LLA…
dhanavikram 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,3 @@ | ||
| __pycache__/ | ||
| .pytest_cache/ | ||
| *.pyc |
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,74 @@ | ||
| # RCCL LL Cache-Bit Guard | ||
|
|
||
| A [pytest](https://pytest.org) guard that checks the cache-policy bits on the | ||
| LL protocol's flag-poll loads in a built `librccl.so`. | ||
|
|
||
| ## Why | ||
|
|
||
| An LL receiver re-reads one 16-byte line `{data1, flag1, data2, flag2}` until | ||
| both flags change: the LL primitives (`readLL` in `src/device/prims_ll.h`), the | ||
| DDA LL kernels (`ddaLLWaitLineFlags`) and LLA2A in the symmetric kernels. A | ||
| peer GPU or a NIC writes that line. If the load can be served from a stale | ||
| cached copy, the receiver never sees the new flag and the collective hangs. | ||
|
|
||
| The source asks for the right behaviour (`__builtin_nontemporal_load`, or a | ||
| system-scope load on some arches), but the compiler picks the bits that end up | ||
| in the instruction. A compiler update, a code change, or a new arch can drop | ||
| them with no build error. This guard reads the final ISA and fails if that | ||
| happens. | ||
|
|
||
| ## What it checks | ||
|
|
||
| 1. Pulls the device code for each arch out of `librccl.so`, from every offload | ||
| bundle (the device linker adds one per fat object). | ||
| 2. Disassembles the functions that can hold LL poll loads. | ||
| 3. Finds every poll load by its shape: a 128-bit load whose two flag words are | ||
| both compared against the expected value (directly or via each other). Cache | ||
| bits are not used to find it, so a poll that lost them is still found. | ||
| 4. Asserts each poll carries one of the arch's expected modifier sets, e.g. | ||
| `nt` or `sc0 sc1` on gfx942. | ||
|
|
||
| It also fails if some LL function (`ProtoLL`, DDA LL or symmetric LL kernel) | ||
| has no recognisable poll at all, so a change in code shape can't make the | ||
| guard pass by finding nothing. | ||
|
|
||
| | File | Purpose | | ||
| |------|---------| | ||
| | `tests/ll_isa.py` | poll-load detector and ROCm LLVM tool wrappers | | ||
| | `tests/test_ll_poll_cache_bits.py` | the guard, run against a built `librccl.so` | | ||
| | `tests/test_ll_isa_detector.py` | detector unit tests on hand-written ISA (no ROCm needed) | | ||
|
|
||
| Arches with an expectation: **gfx942, gfx950, gfx1250**. Other arches in the | ||
| library are reported as skipped, not passed. | ||
|
|
||
| ## Running locally | ||
|
|
||
| Needs a built RCCL and the ROCm LLVM tools. No GPU. | ||
|
|
||
| ```bash | ||
| cd projects/rccl/test/ll-cache-bits | ||
| python3 -m pip install -r requirements.txt | ||
| python3 -m pytest -v -rs | ||
| ``` | ||
|
|
||
| | Variable | Default | Description | | ||
| |----------|---------|-------------| | ||
| | `RCCL_LIB` | `$RCCL_BUILD/librccl.so` | library to inspect | | ||
| | `RCCL_BUILD` | `<rccl>/build/release`, else `build/debug` | RCCL build dir | | ||
| | `ROCM_PATH` | `/opt/rocm` | ROCm install root | | ||
| | `RCCL_LL_GUARD_REQUIRED` | unset | `1`: fail instead of skip if the library, tools or all checked arches are missing | | ||
|
|
||
| The whole suite skips if the library or tools are missing. | ||
|
|
||
| ## CI | ||
|
|
||
| - The TheRock RCCL build job (`.github/workflows/therock-rccl-ci-linux.yml`) | ||
| runs the full suite on the built `librccl.so` with `RCCL_LL_GUARD_REQUIRED=1`. | ||
| That job runs nightly and on manual dispatch, not per PR. | ||
| - `test/host/run_host_tests.sh guards` runs the detector tests (`-m detector`). | ||
|
|
||
| ## When it fails | ||
|
|
||
| The failure lists the offending loads and the functions they're in. Find out | ||
| why the bits changed (compiler, source, or build flags) and fix that. Do not | ||
| just edit `EXPECTED_POLL_MODIFIERS` to match. |
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,7 @@ | ||
| # pytest.ini | ||
| [pytest] | ||
| testpaths = tests | ||
| addopts = --import-mode=importlib | ||
| markers = | ||
| detector: unit tests for the LL poll-load detector (no ROCm or build needed) | ||
| isa: checks the device ISA inside a built librccl.so |
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,4 @@ | ||
| # Testing dependencies for the LL cache-bit guard. | ||
| # The guard itself only uses the Python standard library plus the ROCm LLVM | ||
| # tools; pytest is the only external dependency. | ||
| pytest==9.1.1 |
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.