add fused mhc_post_pre kernel - #41536
Conversation
|
This pull request has merge conflicts that must be resolved before it can be |
There was a problem hiding this comment.
Code Review
This pull request introduces Multi-Head-Channel (MHC) fused kernels, including a fused pmap and GEMM operation, to optimize the DeepSeek-V4 model. The feedback highlights a missing source file for the mhc_fused_hc binding, an inconsistency in token count thresholds for kernel selection, and the use of non-flattened tensors in a kernel call. Additionally, a potential UnboundLocalError was identified in the model's forward loop when no layers are processed.
| else: | ||
| hidden_states = layer.hc_post(hidden_states, residual, post_mix, res_mix) |
There was a problem hiding this comment.
The else block of the for loop uses the layer variable, which will raise an UnboundLocalError if the loop is empty (e.g., if start_layer == end_layer). This can happen in certain tensor parallel or pipeline parallel configurations. A check should be added to ensure layer is defined before use, or better, check if residual is not None to ensure at least one layer was processed.
| else: | |
| hidden_states = layer.hc_post(hidden_states, residual, post_mix, res_mix) | |
| if residual is not None: | |
| hidden_states = layer.hc_post(hidden_states, residual, post_mix, res_mix) |
86a11bc to
9b9340d
Compare
Signed-off-by: george <george@inferact.ai>
Signed-off-by: george <george@inferact.ai>
Signed-off-by: george <george@inferact.ai>
|
If tilelang kernel is here to stay, can we add warmup logic in the engine? So that it won't trigger compile in realtime. It should be similar to deepgemm and flashinfer |
Signed-off-by: george <george@inferact.ai> Co-authored-by: george <george@inferact.ai>
Signed-off-by: george <george@inferact.ai> Co-authored-by: george <george@inferact.ai>
Signed-off-by: george <george@inferact.ai> Co-authored-by: george <george@inferact.ai>
Signed-off-by: george <george@inferact.ai> Co-authored-by: george <george@inferact.ai>
Signed-off-by: george <george@inferact.ai> Co-authored-by: george <george@inferact.ai> Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Signed-off-by: george <george@inferact.ai> Co-authored-by: george <george@inferact.ai>
Signed-off-by: george <george@inferact.ai> Co-authored-by: george <george@inferact.ai>
Purpose
This PR adds a new mHC kernel, which fuses the
hc_postoperation with theprenorm_gemmportion ofhc_pre. The approach is adapted from TRTLLM, and performs the GEMM using FMA (rather than tensor cores), improving speed at low concurrency.Benchmarks
Benchmark results with deepseek-ai/DeepSeek-V4-Flash at concurrency 4.
Before this PR:
With this PR:
Accuracy Evals
Still Pending