Skip to content

Add PyTorch support to TPU Raiden H2D/D2H presubmit performance gating. - #925

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_981433715
Open

copybara-service[bot] wants to merge 1 commit into
mainfrom
test_981433715

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Sep 14, 2026

Copy link
Copy Markdown

Add PyTorch support to TPU Raiden H2D/D2H presubmit performance gating.

Implement automated presubmit performance regression gating for the PyTorch path in TPU Raiden (third_party/tpu_raiden/tpu_sync/benchmarks/), establishing parity with JAX.

Key changes:

  • Decouple perf_core.py under a unified, narrow public function measure(...) that supports both framework="jax" and framework="torch". Callers do not need to know about framework-specific runtime setups, memory pinning, or worker multi-processing.
  • Add PyTorch SPMD multi-processing transfer execution (_torch_worker_fn) using torch.multiprocessing.spawn, rank synchronization via dist.all_reduce (MIN/MAX wall-clock timing across ranks), and pre-measurement byte-integrity verification.
  • Update h2d_d2h_benchmark_gating.py to default to --framework=all (with selective --framework=jax|torch support), gating both frameworks in a single unified run on physical TPU hardware.
  • Unify test shapes and baselines in h2d_d2h_gating_baselines.json under a single hardware configs list, holding both JAX and PyTorch to the same physical DMA throughput floors without artificial branching.
  • Update h2d_d2h_gating in benchmark_registry.pbtxt and h2d_d2h_record in benchmark_registry_record.pbtxt with symmetrical JAX (jax_...) and PyTorch (torch_...) metrics, plus legacy un-prefixed aliases to maintain continuous tracking on go/tpu-sync-oss-mlcompass.
  • Register h2d_d2h_benchmark_gating_torch_gl and h2d_d2h_benchmark_gating_gl test targets and add PyTorch dependencies to BUILD.
  • Update H2D_D2H_GATING_TEST.md documentation.

Tested:

  • blaze-for-agents build -c opt //third_party/tpu_raiden/tpu_sync/benchmarks:all passed.
  • Formatted via hg fix.

@google-cla

google-cla Bot commented Sep 14, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Implement automated presubmit performance regression gating for the PyTorch path in TPU Raiden (`third_party/tpu_raiden/tpu_sync/benchmarks/`), establishing parity with JAX.

Key changes:
- Decouple `perf_core.py` under a unified, narrow public function `measure(...)` that supports both `framework="jax"` and `framework="torch"`. Callers do not need to know about framework-specific runtime setups, memory pinning, or worker multi-processing.
- Add PyTorch SPMD multi-processing transfer execution (`_torch_worker_fn`) using `torch.multiprocessing.spawn`, rank synchronization via `dist.all_reduce` (MIN/MAX wall-clock timing across ranks), and pre-measurement byte-integrity verification.
- Update `h2d_d2h_benchmark_gating.py` to default to `--framework=all` (with selective `--framework=jax|torch` support), gating both frameworks in a single unified run on physical TPU hardware.
- Unify test shapes and baselines in `h2d_d2h_gating_baselines.json` under a single hardware `configs` list, holding both JAX and PyTorch to the same physical DMA throughput floors without artificial branching.
- Update `h2d_d2h_gating` in `benchmark_registry.pbtxt` and `h2d_d2h_record` in `benchmark_registry_record.pbtxt` with symmetrical JAX (`jax_...`) and PyTorch (`torch_...`) metrics, plus legacy un-prefixed aliases to maintain continuous tracking on `go/tpu-sync-oss-mlcompass`.
- Register `h2d_d2h_benchmark_gating_torch_gl` and `h2d_d2h_benchmark_gating_gl` test targets and add PyTorch dependencies to `BUILD`.
- Update `H2D_D2H_GATING_TEST.md` documentation.

Tested:
- `blaze-for-agents build -c opt //third_party/tpu_raiden/tpu_sync/benchmarks:all` passed.
- Formatted via `hg fix`.
PiperOrigin-RevId: 981433715
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants