Skip to content

Add iris.bench benchmarking framework - #484

Merged
mawad-amd merged 11 commits into
mainfrom
muhaawad/iris-bench
Mar 26, 2026
Merged

Add iris.bench benchmarking framework#484
mawad-amd merged 11 commits into
mainfrom
muhaawad/iris-bench

Conversation

@mawad-amd

Copy link
Copy Markdown
Collaborator

Summary

  • Add iris.bench, a declarative GPU benchmarking framework inspired by NVBench and Google Benchmark
  • Write ~25 lines instead of ~350 to benchmark a kernel — framework handles distributed init, parameter sweeps, timing via do_bench(), and output formatting
  • Supports console table, JSON, and CSV output formats
  • Axis sweeps with cartesian product, CLI overrides (--axis_M=pow2:8:13), and skip filters (--skip_dtype=bf16)
  • num_ranks is a special axis that controls process spawning via elastic_launch
  • Includes sample all-gather benchmark at benchmark/examples/bench_all_gather.py

Usage

@bench.register
@bench.axis("M", bench.power_of_two(8, 13))
@bench.axis("dtype", [torch.float16, torch.float32])
def all_gather(state, ctx):
    inp = ctx.zeros((state["M"], 1024), dtype=state["dtype"])
    out = ctx.zeros((ctx.get_num_ranks() * state["M"], 1024), dtype=state["dtype"])
    state.set_bytes((ctx.get_num_ranks() - 1) * state["M"] * 1024 * inp.element_size())
    state.exec(lambda: ctx.ccl.all_gather(out, inp, config=config))

if __name__ == "__main__":
    bench.main()
python bench_all_gather.py --axis_num_ranks=2 --axis_M=1024,4096

Test plan

  • Tested on MI300X (alola cluster, 2 ranks)
  • Console table output with bandwidth
  • JSON output format
  • CSV output format
  • Axis overrides (explicit lists, pow2 ranges)
  • Skip filters
  • File output (--benchmark_out)
  • CI green

🤖 Generated with Claude Code

mawad-amd and others added 11 commits March 25, 2026 11:52
Declarative framework that reduces benchmark boilerplate from ~350 lines
to ~25 lines. Handles distributed init, parameter sweeps, timing via
iris.do_bench(), and output formatting (console/JSON/CSV).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- num_ranks is a special axis that drives process spawning: the
  framework does a separate mp.spawn per unique value. Default 8
  when no axis is declared.
- Add --skip_<axis>=<values> CLI to exclude axis values (mirrors
  --axis_<axis>=<values> for overrides).
- Remove -r/--num_ranks CLI flag and torchrun detection — the
  benchmark script is always a plain `python bench.py` invocation.
- Rename shmem -> ctx in benchmark function signature.
- Fix copyright to 2026 for new files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Explains the three phases (setup, preamble, timed kernel), that
preamble_fn is not timed and can be heavyweight, how num_ranks
drives process spawning, and CLI override/skip syntax.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Matches CI pattern (rdzv-endpoint=localhost:0). file:// rendezvous
needs no port at all — uses a temp file for coordination, cleaned
up after each spawn.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Uses torch.distributed.launcher.api.elastic_launch with c10d
rendezvous on localhost:0 — same as CI's torchrun invocation.

Eliminates: pickle temp files for result collection, file://
rendezvous, manual init_process_group parameters. Workers return
results directly via elastic_launch's return value mechanism.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added in-progress We are working on it iris Iris project issue labels Mar 25, 2026
@mawad-amd
mawad-amd marked this pull request as ready for review March 26, 2026 03:48
@mawad-amd
mawad-amd requested review from BKP and neoblizz as code owners March 26, 2026 03:48
Copilot AI review requested due to automatic review settings March 26, 2026 03:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds iris.bench, a declarative distributed GPU benchmarking framework with axis sweeps, CLI overrides, and multi-format output.

Changes:

  • Introduces core benchmark registry/types (State, decorators, range helpers) and a distributed runner using elastic_launch.
  • Adds console/JSON/CSV result formatting plus CLI parsing for axis overrides and skip filters.
  • Includes a sample all-gather benchmark and exposes iris.bench from the top-level package.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
iris/bench/_runner.py Implements distributed execution, CLI parsing, and output formatting for benchmarks.
iris/bench/_core.py Defines benchmark/state abstractions, registry, decorators, and axis-range helpers.
iris/bench/init.py Public API exports and extensive usage documentation for the new framework.
iris/init.py Exposes bench as a top-level iris submodule.
benchmark/examples/bench_all_gather.py Demonstrates an all-gather benchmark written with iris.bench.

Comment thread iris/bench/_runner.py
Comment thread iris/bench/_runner.py
Comment thread iris/bench/_runner.py
Comment thread iris/bench/_runner.py
Comment thread iris/bench/_runner.py
Comment thread iris/bench/_runner.py
Comment thread iris/bench/_runner.py
Comment thread iris/bench/__init__.py
@mawad-amd
mawad-amd merged commit 460cf76 into main Mar 26, 2026
47 of 50 checks passed
@mawad-amd
mawad-amd deleted the muhaawad/iris-bench branch March 26, 2026 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in-progress We are working on it iris Iris project issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants