Skip to content

Studio ROCm TunableOp: label the results file with the HIP build string, not a raw read - #17325

Merged
danielhanchen merged 1 commit into
mainfrom
fix/tunableop-results-tag-labels-hip
Nov 9, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix/tunableop-results-tag-labels-hip

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

(Python 3.13, a-f) is red on main and on every PR based on it since #17299 merged:

studio/backend/tests/test_diffusion_rocm_tag_detect.py::test_no_diffusion_or_video_gate_reads_version_hip_directly
E   AssertionError: use core.inference.rocm_bf16.is_rocm_torch(torch): AMD SDK / Radeon wheels leave torch.version.hip unset. Raw reads: {'diffusion_rocm_tunableop.py': [128]}

#17299's results_file() folds torch.version.hip into the TunableOp results filename. That is a label, not a gate: the gate in the same module already goes through is_rocm_torch(torch). The guard exempts exactly this kind of read when it sits inside an f-string ("the read labels a cache key with the build string; it gates nothing"). Here the read sat in a plain tuple, so the guard flagged it.

The read now goes into an f-string, hip = f"{getattr(torch.version, 'hip', None)}", before it is joined into the tag. The filename is byte-for-byte the same, so existing tuned results stay valid. getattr also avoids an AttributeError on a torch build whose torch.version has no hip attribute.

Changes

  • studio/backend/core/inference/diffusion_rocm_tunableop.py: results_file() reads the HIP build string inside an f-string.

Testing

  • pytest tests/test_diffusion_rocm_tunableop.py tests/test_diffusion_rocm_tag_detect.py: 27 passed. On main, test_diffusion_rocm_tag_detect.py fails (1 failed, 7 passed).
  • The tag string is the same as before for both a ROCm build (gfx1151_2.10.0-rocm7.1_7.1.25424) and a build without HIP (..._None).

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T21:19:55.032996Z 83e4ba0 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 83e4ba0f99

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 1ae69bf into main Nov 9, 2026
@danielhanchen
danielhanchen deleted the fix/tunableop-results-tag-labels-hip branch November 9, 2026 21:25
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.

1 participant