get_rocm_version() spawns hipconfig on every call, and get_num_xcc() calls it every time
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- performance
Research direction
Start with get_rocm_version() and get_num_xcc() in iris/host/platform/hip.py (around lines 153 and 215), then the callers in iris/ccl/config.py:101 and iris/host/tracing/core.py:115-116. Check how get_num_xcc handles device_id=None through get_device_id() before caching. Done means both functions are cached without changing results, and Config() construction is timed before and after.
Written by the indexing model from the issue text.
Description
get_rocm_version() spawns hipconfig on every call, and get_num_xcc() calls it every time
What
iris/host/platform/hip.py:153:
def get_rocm_version():
...
# Try hipconfig --path first
try:
result = subprocess.run(["hipconfig", "--path"], capture_output=True, text=True, check=True)
Unconditional, uncached subprocess on every call, followed by opening
$ROCM_PATH/.info/version.
get_num_xcc() at hip.py:215 calls it every time, for a single branch:
rocm_major, _ = get_rocm_version()
if rocm_major < 7:
return 8
Both answers are constants for the lifetime of the process — the installed ROCm
version and the XCC count of a device do not change.
Cost
hipconfig --path, hpcfund login node, ROCm 7.1.0, /opt/rocm-7.1.0/bin/hipconfig:
median 15.6 ms min 14.0 max 17.7 (n=10)
Per call. It varies by host and ROCm install — a measurement during an earlier
MI355X sweep put it near 7 ms on that node — so treat this as the order of
magnitude, not a constant.
Where it is called
iris/ccl/config.py:101— inConfig.__post_init__, so everyConfig()
construction wherenum_xcdsis not passed explicitly.iris/host/tracing/core.py:115-116— both functions, per trace record.- ~18 sites across
examples/. Most are module scope and pay it once;
examples/08_gemm_all_reduce_atomics/matmul_wrapper.py:53is inside a function.
Config is the one that matters: a benchmark or a framework integration that
builds a config per call pays a process spawn per collective.
Fix
functools.lru_cache on get_rocm_version(), and on get_num_xcc() keyed by
device_id. functools is not currently imported in hip.py.
Use lru_cache, not functools.cache — pyproject.toml:19 has
requires-python = ">=3.8" and functools.cache is 3.9+.
Work
-
@lru_cacheonget_rocm_version() -
@lru_cacheonget_num_xcc(device_id)— note it callsget_device_id()
whendevice_id is None, so either normalise the argument before caching or
cache the inner body - Confirm no caller depends on re-reading either value after a device or
environment change - Time
Config()construction before and after
Note
This was measured and written during the October CCL optimization sweep but lives
on the exploration branch muhaawad/allreduce-scaling and was never upstreamed.
main @ 6462f028 still has the unguarded version.
- Dominant language
- Python
- Stars
- 202
- Forks
- 52
- Avg merge
- 5d 2h
- Merged PRs (30d)
- 23
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
-
benchmarks bug examples iris test
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 2 days
-
bug examples invalid iris
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 2 days
-
SDMA is Triton-only, and no collective uses itPossibly taken @ariscript claimed this 1 day ago. Openenhancement gluon help wanted iris
Difficulty 5/5 Over a week Newbie friendliness 18/100
ROCm/iris#593 · 1 comment · 1 assignee ·
Maintainers usually reply within 2 days
-
good first issue help wanted iris
Difficulty 3/5 Half a day Newbie friendliness 62/100
Maintainers usually reply within 2 days
-
gluon good first issue help wanted iris python
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Maintainers usually reply within 2 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
NousResearch/hermes-agent#140958 ·
Maintainers usually reply within 1 day
-
Bisect issue233186Openbisect
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
dtcxzyw/llvm-bisect-service#548 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
sallowayma-git/IELTS-practice#248 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
anthropics/claude-plugins-official#6763 · 10 comments · 10 reactions ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day