[PR #91] [MERGED] Fix HIP RoPE frequency length mismatch #137

Closed
opened 2026-10-26 22:20:44 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/comfy-kitchen/pull/91
Author: @derfasthirnlosenick
Created: 8/1/2026
Status: ✅ Merged
Merged: 8/2/2026
Merged by: @comfyanonymous

Base: main ← Head: rocm-rope-fix-only


📝 Commits (1)

  • 9a0f027 Fix HIP RoPE frequency length mismatch

📊 Changes

1 file changed (+4 additions, -1 deletions)

View changed files

📝 comfy_kitchen/backends/hip/__init__.py (+4 -1)

📄 Description

While testing with Flux.2 9b, I ran into a reproducible crash on my 6800xt: HIP apply_rope could fail when freqs_cis contained more sequence positions than the input tensor, because the extra frequencies were passed directly to the kernel.

This change trims freqs_cis before the HIP kernel call, matching the expected RoPE behavior used by the reference/eager path. The shared trim_rope_freqs utility is reused instead of adding HIP-specific slicing logic. Only the non-split-half path is changed, as split-half RoPE uses different frequency layout handling.

Validated with test_rope.py (non-Triton) and test_hip_wmma.py.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/comfy-kitchen/pull/91 **Author:** [@derfasthirnlosenick](https://github.com/derfasthirnlosenick) **Created:** 8/1/2026 **Status:** ✅ Merged **Merged:** 8/2/2026 **Merged by:** [@comfyanonymous](https://github.com/comfyanonymous) **Base:** `main` ← **Head:** `rocm-rope-fix-only` --- ### 📝 Commits (1) - [`9a0f027`](https://github.com/Comfy-Org/comfy-kitchen/commit/9a0f0272bcbff045f39207422822e588bbad4bd3) Fix HIP RoPE frequency length mismatch ### 📊 Changes **1 file changed** (+4 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `comfy_kitchen/backends/hip/__init__.py` (+4 -1) </details> ### 📄 Description While testing with Flux.2 9b, I ran into a reproducible crash on my 6800xt: HIP apply_rope could fail when freqs_cis contained more sequence positions than the input tensor, because the extra frequencies were passed directly to the kernel. This change trims freqs_cis before the HIP kernel call, matching the expected RoPE behavior used by the reference/eager path. The shared trim_rope_freqs utility is reused instead of adding HIP-specific slicing logic. Only the non-split-half path is changed, as split-half RoPE uses different frequency layout handling. Validated with test_rope.py (non-Triton) and test_hip_wmma.py. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-26 22:20:44 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/comfy-kitchen#137
No description provided.