[PR #287] feat: add w4afp8 on Hopper GPUs #346

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

📋 Pull Request Information

Original PR: https://github.com/deepseek-ai/DeepGEMM/pull/287
Author: @foreverrookie
Created: 2/9/2026
Status: 🔄 Open

Base: main ← Head: feat/w4a8


📝 Commits (1)

  • 59ef1df feat: SM90 INT4xFP8 (W4AFP8) GEMM support with performance optimizations

📊 Changes

13 files changed (+885 additions, -147 deletions)

View changed files

📝 README.md (+5 -0)
📝 csrc/apis/gemm.hpp (+120 -0)
📝 csrc/jit_kernels/heuristics/config.hpp (+7 -1)
📝 csrc/jit_kernels/heuristics/sm90.hpp (+87 -35)
📝 csrc/jit_kernels/impls/sm90_fp8_gemm_1d2d.hpp (+51 -21)
📝 csrc/utils/layout.hpp (+2 -1)
📝 deep_gemm/__init__.py (+4 -0)
📝 deep_gemm/include/deep_gemm/impls/sm90_fp8_gemm_1d2d.cuh (+217 -87)
📝 deep_gemm/include/deep_gemm/mma/sm90.cuh (+65 -0)
📝 deep_gemm/include/deep_gemm/ptx/ld_st.cuh (+49 -2)
📝 deep_gemm/testing/bench.py (+7 -0)
📝 tests/generators.py (+167 -0)
➕ tests/test_w4afp8.py (+104 -0)

📄 Description

Hi, from novita.ai team.

test perf(W4Afp8 vs FP8) on H200. nvcc: 13.0.

groups m/grp n k W4 us W4 GB/s FP8 us FP8 GB/s Speedup
8 16 4096 7168 48 2649 68 3477 1.42x
8 24 4096 7168 48 2667 68 3493 1.42x
8 32 4096 7168 48 2685 68 3500 1.42x
8 40 4096 7168 48 2727 68 3516 1.42x
8 48 4096 7168 48 2721 68 3530 1.42x
8 56 4096 7168 62 2115 72 3368 1.16x
8 64 4096 7168 62 2122 72 3393 1.16x
8 16 7168 2048 32 2029 40 3012 1.25x
8 24 7168 2048 31 2071 40 3034 1.29x
8 32 7168 2048 32 2096 40 3061 1.25x
8 40 7168 2048 31 2149 40 3085 1.29x
8 48 7168 2048 31 2187 40 3118 1.29x
8 56 7168 2048 31 2259 42 2991 1.35x
8 64 7168 2048 42 1657 42 2981 1.00x
16 16 4096 7168 93 2724 127 3741 1.37x
16 24 4096 7168 93 2748 127 3760 1.37x
16 32 4096 7168 93 2758 127 3772 1.37x
16 40 4096 7168 93 2793 127 3794 1.37x
16 48 4096 7168 93 2797 127 3806 1.37x
16 56 4096 7168 131 2010 137 3542 1.05x
16 64 4096 7168 130 2036 138 3527 1.06x
16 16 7168 2048 57 2262 71 3362 1.25x
16 24 7168 2048 57 2317 71 3394 1.25x
16 32 7168 2048 57 2344 71 3420 1.25x
16 40 7168 2048 56 2392 71 3462 1.27x
16 48 7168 2048 57 2420 71 3486 1.25x
16 56 7168 2048 68 2062 75 3307 1.10x
16 64 7168 2048 69 2048 76 3292 1.10x

🔄 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/deepseek-ai/DeepGEMM/pull/287 **Author:** [@foreverrookie](https://github.com/foreverrookie) **Created:** 2/9/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/w4a8` --- ### 📝 Commits (1) - [`59ef1df`](https://github.com/deepseek-ai/DeepGEMM/commit/59ef1df18b2b6dda7cdf7dcfe5d998bc864b4b6b) feat: SM90 INT4xFP8 (W4AFP8) GEMM support with performance optimizations ### 📊 Changes **13 files changed** (+885 additions, -147 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+5 -0) 📝 `csrc/apis/gemm.hpp` (+120 -0) 📝 `csrc/jit_kernels/heuristics/config.hpp` (+7 -1) 📝 `csrc/jit_kernels/heuristics/sm90.hpp` (+87 -35) 📝 `csrc/jit_kernels/impls/sm90_fp8_gemm_1d2d.hpp` (+51 -21) 📝 `csrc/utils/layout.hpp` (+2 -1) 📝 `deep_gemm/__init__.py` (+4 -0) 📝 `deep_gemm/include/deep_gemm/impls/sm90_fp8_gemm_1d2d.cuh` (+217 -87) 📝 `deep_gemm/include/deep_gemm/mma/sm90.cuh` (+65 -0) 📝 `deep_gemm/include/deep_gemm/ptx/ld_st.cuh` (+49 -2) 📝 `deep_gemm/testing/bench.py` (+7 -0) 📝 `tests/generators.py` (+167 -0) ➕ `tests/test_w4afp8.py` (+104 -0) </details> ### 📄 Description Hi, from [novita.ai](https:novita.ai) team. - Algorithm compatible with https://huggingface.co/Barrrrry/DeepSeek-R1-W4AFP8, but uses a custom weight layout (see `convert_fp8_to_int4` in `tests/generators.py`). test perf(W4Afp8 vs FP8) on H200. nvcc: 13.0. | groups | m/grp | n | k | W4 us | W4 GB/s | FP8 us | FP8 GB/s | Speedup | |-------:|------:|-----:|-----:|------:|--------:|------:|---------:|--------:| | 8 | 16 | 4096 | 7168 | 48 | 2649 | 68 | 3477 | **1.42x** | | 8 | 24 | 4096 | 7168 | 48 | 2667 | 68 | 3493 | **1.42x** | | 8 | 32 | 4096 | 7168 | 48 | 2685 | 68 | 3500 | **1.42x** | | 8 | 40 | 4096 | 7168 | 48 | 2727 | 68 | 3516 | **1.42x** | | 8 | 48 | 4096 | 7168 | 48 | 2721 | 68 | 3530 | **1.42x** | | 8 | 56 | 4096 | 7168 | 62 | 2115 | 72 | 3368 | **1.16x** | | 8 | 64 | 4096 | 7168 | 62 | 2122 | 72 | 3393 | **1.16x** | | 8 | 16 | 7168 | 2048 | 32 | 2029 | 40 | 3012 | **1.25x** | | 8 | 24 | 7168 | 2048 | 31 | 2071 | 40 | 3034 | **1.29x** | | 8 | 32 | 7168 | 2048 | 32 | 2096 | 40 | 3061 | **1.25x** | | 8 | 40 | 7168 | 2048 | 31 | 2149 | 40 | 3085 | **1.29x** | | 8 | 48 | 7168 | 2048 | 31 | 2187 | 40 | 3118 | **1.29x** | | 8 | 56 | 7168 | 2048 | 31 | 2259 | 42 | 2991 | **1.35x** | | 8 | 64 | 7168 | 2048 | 42 | 1657 | 42 | 2981 | 1.00x | | 16 | 16 | 4096 | 7168 | 93 | 2724 | 127 | 3741 | **1.37x** | | 16 | 24 | 4096 | 7168 | 93 | 2748 | 127 | 3760 | **1.37x** | | 16 | 32 | 4096 | 7168 | 93 | 2758 | 127 | 3772 | **1.37x** | | 16 | 40 | 4096 | 7168 | 93 | 2793 | 127 | 3794 | **1.37x** | | 16 | 48 | 4096 | 7168 | 93 | 2797 | 127 | 3806 | **1.37x** | | 16 | 56 | 4096 | 7168 | 131 | 2010 | 137 | 3542 | **1.05x** | | 16 | 64 | 4096 | 7168 | 130 | 2036 | 138 | 3527 | **1.06x** | | 16 | 16 | 7168 | 2048 | 57 | 2262 | 71 | 3362 | **1.25x** | | 16 | 24 | 7168 | 2048 | 57 | 2317 | 71 | 3394 | **1.25x** | | 16 | 32 | 7168 | 2048 | 57 | 2344 | 71 | 3420 | **1.25x** | | 16 | 40 | 7168 | 2048 | 56 | 2392 | 71 | 3462 | **1.27x** | | 16 | 48 | 7168 | 2048 | 57 | 2420 | 71 | 3486 | **1.25x** | | 16 | 56 | 7168 | 2048 | 68 | 2062 | 75 | 3307 | **1.10x** | | 16 | 64 | 7168 | 2048 | 69 | 2048 | 76 | 3292 | **1.10x** | --- <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
deepseek-ai/DeepGEMM#346
No description provided.