[PR #133] fix(eager): fallback int8 matmul on ROCm/HIP to prevent access violation on RDNA2 #169

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

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/comfy-kitchen/pull/133
Author: @niklastheiler
Created: 8/23/2026
Status: 🔄 Open

Base: main ← Head: patch-1


📝 Commits (2)

  • 536b2d3 fix(eager): fallback int8 matmul on ROCm/HIP to prevent crash on RDNA2
  • 19c9aad fix(eager): preserve exact INT32 accumulation on ROCm/HIP via bounded K chunking

📊 Changes

1 file changed (+9 additions, -0 deletions)

View changed files

📝 comfy_kitchen/backends/eager/quantization.py (+9 -0)

📄 Description

Summary

Fixes an access violation crash (0xC0000005 in torch_hip.dll / ?_int_mm@cuda@at@@...) when running INT8 quantized models (e.g. SeedVR2 / ConvRot / INT8 tensorwise) on AMD RDNA2 (e.g. RX 6700 XT / gfx1031) under ROCm on Windows.

Root Cause

In PyTorch with ROCm/HIP on Windows, torch._int_mm attempts to dispatch to hardware matrix cores (WMMA / MFMA) in torch_hip.dll. On AMD RDNA2 architectures (gfx1031, gfx1032, etc.), these INT8 matrix cores are not present, resulting in an immediate native access violation (0xC0000005) during _int8_matmul_accumulate.

Solution

In fast_int8_mm, check getattr(torch.version, "hip", None) and compute the INT8 matrix multiplication via GPU float matmul (lhs.to(torch.float32) @ rhs.to(torch.float32)).to(torch.int32).

Verification

Tested on:

  • GPU: AMD Radeon RX 6700 XT (gfx1031, 12 GB VRAM)
  • OS: Windows 11 Pro
  • Stack: PyTorch 2.10.0+rocm7.14, ROCm 7.14
  • Model: seedvr2_3b_int8_convrot.safetensors
  • Result: Full 32-block transformer forward pass and sampling steps execute successfully on GPU with no crashes.

🔄 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/133 **Author:** [@niklastheiler](https://github.com/niklastheiler) **Created:** 8/23/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `patch-1` --- ### 📝 Commits (2) - [`536b2d3`](https://github.com/Comfy-Org/comfy-kitchen/commit/536b2d3f03c28c9aae6c59b279db0c87ef966dd8) fix(eager): fallback int8 matmul on ROCm/HIP to prevent crash on RDNA2 - [`19c9aad`](https://github.com/Comfy-Org/comfy-kitchen/commit/19c9aad6381aa95254a48ebc4eb8f2832f40c831) fix(eager): preserve exact INT32 accumulation on ROCm/HIP via bounded K chunking ### 📊 Changes **1 file changed** (+9 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `comfy_kitchen/backends/eager/quantization.py` (+9 -0) </details> ### 📄 Description ### Summary Fixes an access violation crash (`0xC0000005` in `torch_hip.dll` / `?_int_mm@cuda@at@@...`) when running INT8 quantized models (e.g. SeedVR2 / ConvRot / INT8 tensorwise) on AMD RDNA2 (e.g. RX 6700 XT / `gfx1031`) under ROCm on Windows. ### Root Cause In PyTorch with ROCm/HIP on Windows, `torch._int_mm` attempts to dispatch to hardware matrix cores (WMMA / MFMA) in `torch_hip.dll`. On AMD RDNA2 architectures (`gfx1031`, `gfx1032`, etc.), these INT8 matrix cores are not present, resulting in an immediate native access violation (`0xC0000005`) during `_int8_matmul_accumulate`. ### Solution In `fast_int8_mm`, check `getattr(torch.version, "hip", None)` and compute the INT8 matrix multiplication via GPU float matmul `(lhs.to(torch.float32) @ rhs.to(torch.float32)).to(torch.int32)`. ### Verification Tested on: - GPU: AMD Radeon RX 6700 XT (`gfx1031`, 12 GB VRAM) - OS: Windows 11 Pro - Stack: PyTorch 2.10.0+rocm7.14, ROCm 7.14 - Model: `seedvr2_3b_int8_convrot.safetensors` - Result: Full 32-block transformer forward pass and sampling steps execute successfully on GPU with no crashes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#169
No description provided.