[PR #265] [MERGED] HIP port of #260: group norm stats override and row stride #268

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

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/comfy-kitchen/pull/265
Author: @0xDELUXA
Created: 10/21/2026
Status: ✅ Merged
Merged: 10/21/2026
Merged by: @comfyanonymous

Base: main ← Head: amd/hip-group-norm-stats


📝 Commits (1)

  • 2a66efa HIP port of #260: group norm stats override and row stride

📊 Changes

4 files changed (+236 additions, -66 deletions)

View changed files

📝 comfy_kitchen/backends/hip/__init__.py (+60 -10)
📝 comfy_kitchen/backends/hip/dlpack_bindings.cpp (+86 -20)
📝 comfy_kitchen/backends/hip/ops/group_norm_pad3d.hip (+86 -32)
📝 tests/test_hip_wmma.py (+4 -4)

📄 Description

The HIP GroupNorm kernels now take caller-supplied per-frame stats from a new group_norm_stats3d, so row strips of a frame normalize with that frame's statistics, and both ops read row-interleaved views in place through a row stride. Previously HIP sent every stats= call to eager, which also failed test_strips_with_stats_equal_whole_frame on HIP. The stats block size is now the largest multiple of C/8 that fits, so any multiple of 8 channels up to 2048 is served, as on CUDA. The binding checks a strided x against the span its own strides cover, not its element count.

test_hip_wmma.py follows the new binding signature, and its declined-channels case moves from C=96 (now served) to C=2056.

Measured on gfx1200 with the Flux2 VAE through https://github.com/Comfy-Org/ComfyUI/pull/17196 with its ROCm gate lifted for fp16: decode at 1024^2 goes from 836 ms on main to 412 ms (stock path 497 ms), peak VRAM 1.10 GiB vs 5.85 GiB stock.


🔄 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/265 **Author:** [@0xDELUXA](https://github.com/0xDELUXA) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/21/2026 **Merged by:** [@comfyanonymous](https://github.com/comfyanonymous) **Base:** `main` ← **Head:** `amd/hip-group-norm-stats` --- ### 📝 Commits (1) - [`2a66efa`](https://github.com/Comfy-Org/comfy-kitchen/commit/2a66efaf7d402c4bbef9bc3e96aff26bf5f6c0ec) HIP port of #260: group norm stats override and row stride ### 📊 Changes **4 files changed** (+236 additions, -66 deletions) <details> <summary>View changed files</summary> 📝 `comfy_kitchen/backends/hip/__init__.py` (+60 -10) 📝 `comfy_kitchen/backends/hip/dlpack_bindings.cpp` (+86 -20) 📝 `comfy_kitchen/backends/hip/ops/group_norm_pad3d.hip` (+86 -32) 📝 `tests/test_hip_wmma.py` (+4 -4) </details> ### 📄 Description The HIP GroupNorm kernels now take caller-supplied per-frame `stats` from a new `group_norm_stats3d`, so row strips of a frame normalize with that frame's statistics, and both ops read row-interleaved views in place through a row stride. Previously HIP sent every `stats=` call to eager, which also failed `test_strips_with_stats_equal_whole_frame` on HIP. The stats block size is now the largest multiple of C/8 that fits, so any multiple of 8 channels up to 2048 is served, as on CUDA. The binding checks a strided `x` against the span its own strides cover, not its element count. `test_hip_wmma.py` follows the new binding signature, and its declined-channels case moves from C=96 (now served) to C=2056. Measured on gfx1200 with the Flux2 VAE through https://github.com/Comfy-Org/ComfyUI/pull/17196 with its ROCm gate lifted for fp16: decode at 1024^2 goes from 836 ms on main to 412 ms (stock path 497 ms), peak VRAM 1.10 GiB vs 5.85 GiB stock. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-26 22:22:17 +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#268
No description provided.