[npu/ttx] feat: add DeepSeekV4 hc_post operator on Triton - #382
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the hc_post operator to the Mojo opset, including its NPU backend Triton kernel implementation, registration as a PyTorch custom operator, and corresponding accuracy, performance, and graph compilation tests. A critical issue was identified in the Triton kernel where the use of tl.extract_slice will cause compilation failures on Ascend NPUs. It is recommended to use tl.static_range to unroll the loop and perform standard slicing instead.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Summary
Add the DeepSeekV4
hc_post(Head Combination Post-processing) operator with Triton NPU kernel implementation.Changes
mojo_opset/backends/ttx/kernels/npu/hc_post.py— Triton kernel for fused head combination post-processing (post * x + comb @ residual)mojo_opset/core/operators/hc_post.py— MojoHcPost operator with torch reference implementationmojo_opset/backends/ttx/operators/hc_post.py— TTX backend bindingregister_fake+custom_opregistration for torch.compile(fullgraph=True)Performance (Device Latency, 910B, HC=4, dtype=bf16)
Accuracy (bf16, HC=4, atol=5e-3, rtol=5e-3)