Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

get_rocm_version() spawns hipconfig on every call, and get_num_xcc() calls it every time

Open Beginner friendly
#590 0 comments 0 reactions 0 assignees View on GitHub

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

core examples good first issue help wanted iris python

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 — in Config.__post_init__, so every Config()
    construction
    where num_xcds is 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:53 is 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_cache on get_rocm_version()
  • @lru_cache on get_num_xcc(device_id) — note it calls get_device_id()
    when device_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

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ROCm/iris

All issues in ROCm/iris

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.