[Bug]: 00_load and 02_all_load validate against arange but fill the source with ones/zeros — validation can never pass
Maintainers usually reply within 4 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- performance, testing
Research direction
Look at examples/00_load/load_bench.py line 253 (shmem.ones) and line 175 (torch.arange), and examples/02_all_load/all_load_bench.py line 345 (shmem.zeros) and line 213 (torch.arange). The fix is to make the validation reference match the source buffer fill: either change the fill to arange or change the validation to ones/zeros. Run the examples with --validate to see the mismatch, then adjust the test files tests/examples/test_load_bench.py and tests/examples/test_all_load_bench.py to re-enable them after the fix.
Written by the indexing model from the issue text.
Description
Describe the bug
The load/store benchmarks validate their results against a tensor they never
wrote. expected is built with torch.arange(...), but the source buffer is
filled with shmem.ones(...) (00_load) or shmem.zeros(...) (02_all_load), so
the comparison fails by construction regardless of whether the data movement
worked.
This is the underlying cause of #119 — the tests that were skipped citing #119
(tests/examples/test_load_bench.py, tests/examples/test_all_load_bench.py)
are skipped because of this, not because of measurement accuracy.
The two symptoms are independent and both real:
- correctness: validation compares against the wrong reference, so
--validatereports failure no matter what. (this issue) - measurement: bandwidth is inflated because the benchmark doesn't
subtract cached reads / use appropriate cache modifiers. (#119)
Fixing this one does not fix #119; it makes --validate mean something so
that #119 can then be worked on with a trustworthy pass/fail signal.
To Reproduce
$ python examples/00_load/load_bench.py --num_ranks 1 --validate --datatype fp32 \
--buffer_size 536870912 --block_size 1024 --heap_size 4294967296 \
--num_experiments 5 --num_warmup 1
INFO [Iris] [0/1] Max absolute difference: 134217728.0
$ python examples/02_all_load/all_load_bench.py --num_ranks 1 --validate --verbose \
--datatype fp32 --buffer_size_min 268435456 --buffer_size_max 268435456 \
--block_size 1024 --heap_size 4294967296 --num_experiments 3 --num_warmup 1 \
--active_ranks 1
INFO [Iris] [0/1] Max absolute difference: 67108864.0
ERROR [Iris] [0/1] Mismatch at index (2,): C=0.0, expected=2.0
ERROR [Iris] [0/1] Validation failed.
That last line is the giveaway: index 2 contains 0.0 (the buffer was zeroed)
and is compared to 2.0 (the arange reference). The data movement may be
perfect; the reference is simply not what was stored.
Measured on ROCm 7.14 / torch 2.12.0+rocm7.14, RX 9070 XT (gfx1201).
Where
| file | fills source with | validates against |
|---|---|---|
examples/00_load/load_bench.py |
shmem.ones(...) (line 253) |
torch.arange(n_elements,...) (line 175) |
examples/02_all_load/all_load_bench.py |
shmem.zeros(...) (line 345) |
torch.arange(n_elements,...) (line 213) |
Compare examples/01_store/store_bench.py, which is self-consistent: its
kernel stores the index (iris.store(target_buffer + offsets, offsets, ...),
line 43), so validating against arange is correct there. That is presumably
where the arange reference was copied from.
examples/03_all_store/all_store_bench.py stores the same way and is likewise
consistent. So the bug is confined to the two *_load benchmarks.
Expected behavior
--validate passes when the data movement is correct, i.e. the reference
matches what is actually in the source buffer.
Suggested fix
Make the reference match the fill, per example. For 00_load:
source_buffer = shmem.arange(
args["buffer_size"] // element_size_bytes, device="cuda", dtype=dtype
)
(then the existing expected = torch.arange(...) is correct), or alternatively
compare against torch.ones(...) to match the existing fill. Either is a
one-line change; I don't know which the maintainers prefer for a bandwidth
benchmark, which is why I haven't opened a patch.
Consequence worth noting
Because these two examples always fail validation, the two test files covering
them were disabled with pytest.skip(...) citing #119 — so the load and
all-load paths currently have no effective test coverage at all, and their
CI entries report as skipped rather than failed. Fixing the reference is a
prerequisite to re-enabling them.
Related
- #119 — the measurement-accuracy issue these skips cite (separate cause)
- I have a PR open (#555) that fixes a different example's exit code, which had
the same "logs a failure and exits 0" shape. That is why this one stood out:
02_all_loadalso exits 0 despite printingValidation failed.
- Dominant language
- Python
- Stars
- 202
- Forks
- 52
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 18
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ROCm/iris
-
bug examples invalid iris
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 4 days
-
iris python test
Difficulty 3/5 Half a day Newbie friendliness 58/100
Maintainers usually reply within 4 days
-
iris
Difficulty 5/5 Over a week Newbie friendliness 15/100
Maintainers usually reply within 4 days
-
benchmarks gluon iris
Difficulty 5/5 Over a week Newbie friendliness 30/100
Maintainers usually reply within 4 days
-
bug iris test
Difficulty 4/5 3-5 days Newbie friendliness 40/100
Maintainers usually reply within 4 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
common-workflow-language/cwl-utils#477 ·
Maintainers usually reply within 1 day
-
Add dependabotOpenfeat
Difficulty 2/5 Under an hour Newbie friendliness 72/100
open-nudge/opentemplate#204 ·
Maintainers usually reply within 1 day
-
github-stale-ci-pr-closer: KV state is double-wrapped, never persists, and hits the depth-32 limitPossibly taken @VascoSch92 claimed this today. Openpriority:medium ready-for-dev
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OpenHands/extensions#781 ·
Maintainers usually reply within 1 day
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
curriculum documentation quality
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
githubnext/gh-aw-workshop#4638 ·
Maintainers usually reply within 1 day