[PR #192] [MERGED] Add zero_pad and strided NDHWC views to conv3d and GroupNorm #209

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

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/comfy-kitchen/pull/192
Author: @kijai
Created: 9/23/2026
Status: ✅ Merged
Merged: 9/24/2026
Merged by: @comfyanonymous

Base: main ← Head: zero-pad-mode


📝 Commits (10+)

📊 Changes

14 files changed (+601 additions, -81 deletions)

View changed files

📝 comfy_kitchen/__init__.py (+19 -5)
📝 comfy_kitchen/backends/cuda/__init__.py (+102 -25)
📝 comfy_kitchen/backends/cuda/dlpack_bindings.cpp (+21 -7)
📝 comfy_kitchen/backends/cuda/ops/cutlass_conv3d_fp16.cu (+32 -12)
📝 comfy_kitchen/backends/cuda/ops/group_norm_pad3d.cu (+33 -16)
📝 comfy_kitchen/backends/cuda/ops/int8_linear.cu (+69 -4)
📝 comfy_kitchen/backends/eager/__init__.py (+8 -2)
📝 comfy_kitchen/backends/eager/conv3d.py (+38 -0)
📝 comfy_kitchen/backends/eager/group_norm_pad3d.py (+54 -5)
📝 comfy_kitchen/backends/hip/__init__.py (+19 -0)
📝 comfy_kitchen/constraints.py (+8 -1)
📝 tests/test_fp16_conv3d.py (+72 -2)
📝 tests/test_group_norm_silu_pad3d.py (+103 -2)
📝 tests/test_int8.py (+23 -0)

📄 Description

Three additions the SeedVR2 VAE benefits from:

  • group_norm_silu_pad3d(zero_pad=True): zero spatial border instead of reflect,
    for models whose convolutions pad with zeros. Default is unchanged.
  • out= on both ops. The conv launcher now takes NDHWC strides for x and out, so a
    memory-tiled convolution reads and writes views of the full tensors with no per-tile
    copies. Row windows of the output can't be expressed by the packed epilogue, so those
    decline to torch. For a batch of one, GroupNorm's out may be a frame-offset view,
    which lets a caller keep room in front for a real temporal halo.
    Implemented as separate mutating _out ops, since custom ops can't return input aliases.
  • fp16-accumulate depth gate 8192 → 16384, so 512-channel 3x3x3 stages qualify. 1.58x over
    cuDNN there, but costs the SeedVR2 decoder 65.5 -> 57.8 dB against an fp32 reference, the same
    opt-in numerics fp16_conv3d already carries.

🔄 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/192 **Author:** [@kijai](https://github.com/kijai) **Created:** 9/23/2026 **Status:** ✅ Merged **Merged:** 9/24/2026 **Merged by:** [@comfyanonymous](https://github.com/comfyanonymous) **Base:** `main` ← **Head:** `zero-pad-mode` --- ### 📝 Commits (10+) - [`b1fffd4`](https://github.com/Comfy-Org/comfy-kitchen/commit/b1fffd438c64af0abe9dc2a269ad640265994b9c) group_norm_silu_pad3d - [`8067dea`](https://github.com/Comfy-Org/comfy-kitchen/commit/8067deae1b9226fb49fe7e1381142030aac5981d) cleanup - [`95d1558`](https://github.com/Comfy-Org/comfy-kitchen/commit/95d155858c3fb62340d5b36a3ad0d2932a488a7b) cleanup comments - [`2d5e785`](https://github.com/Comfy-Org/comfy-kitchen/commit/2d5e7858c89d40d0a15e94516effc9ad6153cb18) ruff fix - [`94f01c2`](https://github.com/Comfy-Org/comfy-kitchen/commit/94f01c26054099667f26d4093c6e07a605bf9389) Adjustments - [`c5862b6`](https://github.com/Comfy-Org/comfy-kitchen/commit/c5862b654a41a2dd2eef5e3c95e891262c5f0c87) harden - [`2883be8`](https://github.com/Comfy-Org/comfy-kitchen/commit/2883be84881f10970730bfca905df252e332cd25) Fix dtype - [`83ff31f`](https://github.com/Comfy-Org/comfy-kitchen/commit/83ff31f7578cb51fadcf1e520665dd618f8cb18e) Handle dtype better - [`716f42b`](https://github.com/Comfy-Org/comfy-kitchen/commit/716f42bb27c9dedea0c45da43942ced5c4d91818) Group size 64 dequant kernel - [`bad6fb6`](https://github.com/Comfy-Org/comfy-kitchen/commit/bad6fb699b103d730658552ab33d0b7ad2b5f412) gate test ### 📊 Changes **14 files changed** (+601 additions, -81 deletions) <details> <summary>View changed files</summary> 📝 `comfy_kitchen/__init__.py` (+19 -5) 📝 `comfy_kitchen/backends/cuda/__init__.py` (+102 -25) 📝 `comfy_kitchen/backends/cuda/dlpack_bindings.cpp` (+21 -7) 📝 `comfy_kitchen/backends/cuda/ops/cutlass_conv3d_fp16.cu` (+32 -12) 📝 `comfy_kitchen/backends/cuda/ops/group_norm_pad3d.cu` (+33 -16) 📝 `comfy_kitchen/backends/cuda/ops/int8_linear.cu` (+69 -4) 📝 `comfy_kitchen/backends/eager/__init__.py` (+8 -2) 📝 `comfy_kitchen/backends/eager/conv3d.py` (+38 -0) 📝 `comfy_kitchen/backends/eager/group_norm_pad3d.py` (+54 -5) 📝 `comfy_kitchen/backends/hip/__init__.py` (+19 -0) 📝 `comfy_kitchen/constraints.py` (+8 -1) 📝 `tests/test_fp16_conv3d.py` (+72 -2) 📝 `tests/test_group_norm_silu_pad3d.py` (+103 -2) 📝 `tests/test_int8.py` (+23 -0) </details> ### 📄 Description Three additions the SeedVR2 VAE benefits from: - `group_norm_silu_pad3d(zero_pad=True)`: zero spatial border instead of reflect, for models whose convolutions pad with zeros. Default is unchanged. - `out=` on both ops. The conv launcher now takes NDHWC strides for x and out, so a memory-tiled convolution reads and writes views of the full tensors with no per-tile copies. Row windows of the output can't be expressed by the packed epilogue, so those decline to torch. For a batch of one, GroupNorm's `out` may be a frame-offset view, which lets a caller keep room in front for a real temporal halo. Implemented as separate mutating `_out` ops, since custom ops can't return input aliases. - fp16-accumulate depth gate 8192 → 16384, so 512-channel 3x3x3 stages qualify. 1.58x over cuDNN there, but costs the SeedVR2 decoder 65.5 -> 57.8 dB against an fp32 reference, the same opt-in numerics `fp16_conv3d` already carries. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-26 22:21:35 +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#209
No description provided.