Skip to content

[ROCm][Inductor] New Inductor benchmarker based on Torch Profiler - #175097

Closed
naromero77amd wants to merge 2 commits into
pytorch:mainfrom
naromero77amd:inductor_torch_profile_benchmarker_with_rebase
Closed

naromero77amd wants to merge 2 commits into
pytorch:mainfrom
naromero77amd:inductor_torch_profile_benchmarker_with_rebase

Conversation

@naromero77amd

@naromero77amd naromero77amd commented Feb 16, 2026 •

Copy link
Copy Markdown
Collaborator

A new benchmarker method for timing Inductor kernels during autotuning. We use Torch Profiler to collect the kernel execution times. This is particularly important for short-duration kernels that are not accurate timed with hipEvents.

Based on the Inductor benchmarker class, but using Torch profiler to obtain timings instead of hipEvents. We still use hipEvents to cap the total warmup sampling time, but the final time for the kernel is collected from the Torch Profiler.

The buffer size used for flushing the data cache is different between ROCm and NVIDIA. See comments in code.

Will also work on NVIDIA platform.

Ran the inductor-perf-test-nightly-rocm-mi300 several times. There was more overhead with this Torch Profile benchmarker, but it was not significantly more. No test suite regressions.

Note that this feature is turned *off *by default, it must be activated using TORCHINDUCTOR_USE_TORCH_PROFILER_BENCHMARKER=1

Cursor was used to improve this PR.

cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @pragupta @jerrymannil @xinyazhang @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @mlazos

@naromero77amd
naromero77amd requested a review from a team as a code owner February 16, 2026 20:02
@pytorch-bot

pytorch-bot Bot commented Feb 16, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/175097

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 3 New Failures, 3 Unrelated Failures, 4 Unclassified Failures

As of commit e2b4a92 with merge base c1d7692 (image):

NEW FAILURES - The following jobs have failed:

UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added ciflow/inductor ciflow/rocm-mi300 Trigger "default" config CI on ROCm MI300 module: inductor module: rocm AMD GPU support for Pytorch release notes: releng release notes category labels Feb 16, 2026
@naromero77amd naromero77amd removed ciflow/inductor ciflow/rocm-mi300 Trigger "default" config CI on ROCm MI300 labels Feb 16, 2026
@naromero77amd naromero77amd added ciflow/inductor ciflow/inductor-rocm Trigger "inductor" config CI on ROCm labels Feb 16, 2026
@pytorch-bot

pytorch-bot Bot commented Feb 16, 2026

Copy link
Copy Markdown

Warning: Unknown label ciflow/inductor-rocm.
Currently recognized labels are

  • ciflow/b200
  • ciflow/b200-distributed
  • ciflow/b200-symm-mem
  • ciflow/binaries
  • ciflow/binaries_libtorch
  • ciflow/binaries_wheel
  • ciflow/dynamo
  • ciflow/h100
  • ciflow/h100-cutlass-backend
  • ciflow/h100-distributed
  • ciflow/h100-symm-mem
  • ciflow/inductor
  • ciflow/inductor-cu126
  • ciflow/inductor-micro-benchmark
  • ciflow/inductor-micro-benchmark-cpu-x86
  • ciflow/inductor-pallas
  • ciflow/inductor-perf-compare
  • ciflow/inductor-perf-test-nightly-rocm-mi300
  • ciflow/inductor-perf-test-nightly-rocm-mi355
  • ciflow/inductor-perf-test-nightly-x86-zen
  • ciflow/inductor-perf-test-nightly-xpu
  • ciflow/inductor-periodic
  • ciflow/inductor-rocm-mi200
  • ciflow/inductor-rocm-mi300
  • ciflow/inductor-rocm-mi355
  • ciflow/linux-aarch64
  • ciflow/mps
  • ciflow/nightly
  • ciflow/op-benchmark
  • ciflow/periodic
  • ciflow/periodic-rocm-mi200
  • ciflow/periodic-rocm-mi300
  • ciflow/periodic-rocm-mi355
  • ciflow/pull
  • ciflow/quantization-periodic
  • ciflow/riscv64
  • ciflow/rocm-mi200
  • ciflow/rocm-mi300
  • ciflow/rocm-mi355
  • ciflow/rocm-navi31
  • ciflow/s390
  • ciflow/slow
  • ciflow/slow-rocm-mi200
  • ciflow/torchbench
  • ciflow/triton_binaries
  • ciflow/trunk
  • ciflow/unstable
  • ciflow/vllm
  • ciflow/win-arm64
  • ciflow/xpu

Please add the new label to .github/pytorch-probot.yml

@naromero77amd naromero77amd added ciflow/inductor-rocm-mi300 Trigger "inductor" config CI on ROCm MI300/MI325 release notes: inductor and removed ciflow/inductor-rocm Trigger "inductor" config CI on ROCm release notes: releng release notes category labels Feb 16, 2026
@pytorch-bot pytorch-bot Bot added the ciflow/rocm-mi300 Trigger "default" config CI on ROCm MI300 label Feb 16, 2026
@naromero77amd naromero77amd added ciflow/inductor-perf-test-nightly-rocm-mi300 Trigger inductor perf tests on ROCm MI300 and removed ciflow/inductor-perf-test-nightly-rocm-mi300 Trigger inductor perf tests on ROCm MI300 labels Feb 16, 2026
@naromero77amd naromero77amd added the keep-going Don't stop on first failure, keep running tests until the end label Feb 16, 2026
@naromero77amd
naromero77amd marked this pull request as draft February 16, 2026 20:50
@naromero77amd naromero77amd added the ciflow/inductor-perf-test-nightly-rocm-mi300 Trigger inductor perf tests on ROCm MI300 label Feb 18, 2026
@pytorch-bot pytorch-bot Bot added the ciflow/torchtitan Run TorchTitan integration tests label Mar 10, 2026
@naromero77amd

Copy link
Copy Markdown
Collaborator Author

@pytorchbot rebase

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Rebase failed due to Command git -C /home/runner/work/pytorch/pytorch rebase refs/remotes/origin/viable/strict pull/175097/head returned non-zero exit code 1

Rebasing (1/53)
Rebasing (2/53)
Rebasing (3/53)
Rebasing (4/53)
Rebasing (5/53)
Rebasing (6/53)
Rebasing (7/53)
Rebasing (8/53)
Rebasing (9/53)
Rebasing (10/53)
Rebasing (11/53)
Rebasing (12/53)
Rebasing (13/53)
Rebasing (14/53)
Rebasing (15/53)
Rebasing (16/53)
Rebasing (17/53)
Auto-merging test/inductor/test_benchmarking.py
CONFLICT (content): Merge conflict in test/inductor/test_benchmarking.py
error: could not apply 1f42f69cefa... Add profiler benchmarker helper coverage.
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Could not apply 1f42f69cefa... # Add profiler benchmarker helper coverage.

Raised by https://github.com/pytorch/pytorch/actions/runs/23818875999

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label May 14, 2026
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@naromero77amd

Copy link
Copy Markdown
Collaborator Author

@pytorchbot rebase

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

Use torch.profiler as an optional Inductor benchmarking backend so short ROCm kernels can be timed from profiler GPU events instead of HIP event elapsed time.
Cover the profiler benchmarker helper behavior and max-autotune path so the optional backend remains wired into Inductor benchmarking.
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Successfully rebased inductor_torch_profile_benchmarker_with_rebase onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout inductor_torch_profile_benchmarker_with_rebase && git pull --rebase)

@pytorchmergebot
pytorchmergebot force-pushed the inductor_torch_profile_benchmarker_with_rebase branch from 42da0d0 to e2b4a92 Compare May 14, 2026 18:10
@jansel

jansel commented May 15, 2026

Copy link
Copy Markdown
Contributor

@claude explain those CI failures, are they related?

@claude

claude Bot commented May 15, 2026 •

Copy link
Copy Markdown

Claude finished @jansel's task in 3m 35s —— View job


CI Failures Analysis

  • Check current CI status for this PR
  • Analyze each failure to determine if related to PR changes
  • Provide summary

None of these CI failures are related to this PR. They fall into two categories: GPU infrastructure issues and pre-existing flaky tests.


1. Inductor benchmark tests (huggingface, timm, torchbench) - GPU Infrastructure Issue

Jobs:

  • inductor-test / test (inductor_huggingface, 1, 1, linux.g5.4xlarge.nvidia.gpu)
  • inductor-test / test (inductor_timm, 2, 2, linux.g5.4xlarge.nvidia.gpu)
  • inductor-test / test (inductor_torchbench, 1, 2, linux.g5.4xlarge.nvidia.gpu)

Root cause: All three failures share the exact same error: RuntimeError: No CUDA GPUs are available. The GPU became unavailable on the runner mid-test. Every model that attempted to load after this point failed with eager_fail_to_run. This is a transient runner infrastructure problem where the CUDA device disappeared.

Evidence: The logs show 21+ models in huggingface, 6+ in timm, and multiple in torchbench all failing with the identical error - if the PR code had caused this, it would fail consistently on a specific model, not suddenly on all models after a point.

Why unrelated: This PR modifies torch/_inductor/runtime/benchmarking.py and torch/_inductor/config.py. The benchmarker code is gated behind TORCHINDUCTOR_USE_TORCH_PROFILER_BENCHMARKER=1 (off by default) and has no effect on model loading or basic CUDA initialization.


2. ROCm MI300 - Known Flaky Test

Job: inductor-rocm-mi300 / linux-noble-rocm-py3.12-mi300 / test (inductor, 1, 2)

Failed test: test/inductor/test_origami.py::TestOrigami::test_origami_module_gate_when_env_var_unset

Root cause: This is a known flaky test. DrCI already identified it as FLAKY and linked to a similar failure on trunk. The test is about the origami module gating mechanism, completely unrelated to benchmarking code.


3. Limited CI on H100 - Unclassified (pre-existing)

Job: Limited CI on H100 / linux-jammy-cuda13.0-py3.10-gcc11-sm90 / test (smoke, 1, 1)

Failed test: test/inductor/test_fp8.py::TestFP8LoweringCUDA::test_tensorwise_scaling_tma_template_float32_shape_16,32,32_use_fast_accum_True_cuda_float32

Why unrelated: FP8 TMA template tests are exercising CUDA sm90-specific codepaths that have zero overlap with the profiler benchmarker added in this PR. DrCI notes this didn't run on the merge base so can't determine if it's pre-existing.


4. B200 Smoke Tests - Unclassified (pre-existing)

Job: B200 Smoke Tests / linux-jammy-cuda13.0-py3.10-gcc11-sm100 / test (smoke_b200, 1, 1)

Failed test: test/inductor/test_torchinductor.py::GPUTests::test_conv2d_backward_parametrized_dilation_2_stride_1_padding_1_kernel_1_channels_groups5_nhwc_True_cuda

Why unrelated: This is a conv2d backward pass test on B200 hardware (sm100). Completely unrelated to the benchmarking infrastructure.


5. Trunk aarch64 - Known Flaky Test

Job: trunk / linux-jammy-aarch64-py3.10 / test (default, 2, 5)

Failed test: test/inductor/test_fused_attention.py::SDPAPatternRewriterCpuDynamicTests::test_sdpa_rewriter_5_cpu

Root cause: DrCI identifies this as FLAKY with a similar failure on trunk. An attention pattern rewriter test on CPU/aarch64 - unrelated to GPU benchmarking.


Summary: All failures are unrelated to this PR. The three "new failures" (inductor huggingface/timm/torchbench) are caused by a single GPU infrastructure issue where the CUDA device became unavailable on the g5 runner. The remaining failures are either known flaky tests or pre-existing issues on new hardware (B200/H100).

@jeffdaily

Copy link
Copy Markdown
Collaborator

@pytorchbot merge -f "claude says the failing tests are not related"

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

pytorchmergebot pushed a commit that referenced this pull request May 30, 2026
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…torch#175097)

A new benchmarker method for timing Inductor kernels during autotuning. We use Torch Profiler to collect the kernel execution times. This is particularly important for short-duration kernels that are not accurate timed with hipEvents.

Based on the Inductor benchmarker class, but using Torch profiler to obtain timings instead of hipEvents. We still use hipEvents to cap the total warmup sampling time, but the final time for the kernel is collected from the Torch Profiler.

The buffer size used for flushing the data cache is different between ROCm and NVIDIA. See comments in code.

Will also work on NVIDIA platform.

Ran the `inductor-perf-test-nightly-rocm-mi300` several times. There was more overhead with this Torch Profile benchmarker, but it was not significantly more. No test suite regressions.

Note that this feature is turned *off *by default, it must be activated using `TORCHINDUCTOR_USE_TORCH_PROFILER_BENCHMARKER=1`

Cursor was used to improve this PR.

Pull Request resolved: pytorch#175097
Approved by: https://github.com/jeffdaily, https://github.com/jansel, https://github.com/eellison, https://github.com/nmacchioni
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…torch#175097)

A new benchmarker method for timing Inductor kernels during autotuning. We use Torch Profiler to collect the kernel execution times. This is particularly important for short-duration kernels that are not accurate timed with hipEvents.

Based on the Inductor benchmarker class, but using Torch profiler to obtain timings instead of hipEvents. We still use hipEvents to cap the total warmup sampling time, but the final time for the kernel is collected from the Torch Profiler.

The buffer size used for flushing the data cache is different between ROCm and NVIDIA. See comments in code.

Will also work on NVIDIA platform.

Ran the `inductor-perf-test-nightly-rocm-mi300` several times. There was more overhead with this Torch Profile benchmarker, but it was not significantly more. No test suite regressions.

Note that this feature is turned *off *by default, it must be activated using `TORCHINDUCTOR_USE_TORCH_PROFILER_BENCHMARKER=1`

Cursor was used to improve this PR.

Pull Request resolved: pytorch#175097
Approved by: https://github.com/jeffdaily, https://github.com/jansel, https://github.com/eellison, https://github.com/nmacchioni
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
daydayup-lh pushed a commit to ROCm/pytorch that referenced this pull request Nov 26, 2026
…torch#175097)

A new benchmarker method for timing Inductor kernels during autotuning. We use Torch Profiler to collect the kernel execution times. This is particularly important for short-duration kernels that are not accurate timed with hipEvents.

Based on the Inductor benchmarker class, but using Torch profiler to obtain timings instead of hipEvents. We still use hipEvents to cap the total warmup sampling time, but the final time for the kernel is collected from the Torch Profiler.

The buffer size used for flushing the data cache is different between ROCm and NVIDIA. See comments in code.

Will also work on NVIDIA platform.

Ran the `inductor-perf-test-nightly-rocm-mi300` several times. There was more overhead with this Torch Profile benchmarker, but it was not significantly more. No test suite regressions.

Note that this feature is turned *off *by default, it must be activated using `TORCHINDUCTOR_USE_TORCH_PROFILER_BENCHMARKER=1`

Cursor was used to improve this PR.

Pull Request resolved: pytorch#175097
Approved by: https://github.com/jeffdaily, https://github.com/jansel, https://github.com/eellison, https://github.com/nmacchioni
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/b200 ciflow/h100 ciflow/inductor ciflow/inductor-rocm-mi300 Trigger "inductor" config CI on ROCm MI300/MI325 ciflow/rocm-mi300 Trigger "default" config CI on ROCm MI300 ciflow/torchtitan Run TorchTitan integration tests ciflow/trunk Trigger trunk jobs on your pull request keep-going Don't stop on first failure, keep running tests until the end Merged module: inductor module: rocm AMD GPU support for Pytorch open source release notes: inductor triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants