Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/26094
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 4 PendingAs of commit 20f4f8d with merge base 2123b48 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
digantdesai
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
…4w CUDA exports Pull Request resolved: #26094 `replace_8da4w_weights` gains a `packed_gated_linear` hook. It replaces each fused [gate; up] MLP with a module that passes the MLP norm's unquantized output and `gate_up_proj`'s buffers (codes as rewritten by `pack_codes`) to the hook, which returns `silu(gate) * up` in BF16 and so takes the place of the gate/up linear and the gating. The hook requires `quantize_activations=False` and a fused MLP. `replace_8da4w_weights_for_cuda` passes `q4_zpf16_a8_gated_linear`, so each layer's gate/up runs the fused W4A8 gate/up kernels with their SiLU/mul epilogue instead of a linear, a BF16 output of both halves and the eager gating, with the same rounding (gate and up rounded to BF16 before the gating). On A100 for the Muse Glimmer gate/up shape the fused kernels take 0.89-0.95x the time of the unfused linear followed by the eager gating. ghstack-source-id: 491036514 @exported-using-ghexport Differential Revision: [D136090757](https://our.internmc.facebook.com/intern/diff/D136090757/)
Stack from ghstack (oldest at bottom):
replace_8da4w_weightsgains apacked_gated_linearhook. It replaces each fused [gate; up] MLP with a module that passes the MLP norm's unquantized output andgate_up_proj's buffers (codes as rewritten bypack_codes) to the hook, which returnssilu(gate) * upin BF16 and so takes the place of the gate/up linear and the gating. The hook requiresquantize_activations=Falseand a fused MLP.replace_8da4w_weights_for_cudapassesq4_zpf16_a8_gated_linear, so each layer's gate/up runs the fused W4A8 gate/up kernels with their SiLU/mul epilogue instead of a linear, a BF16 output of both halves and the eager gating, with the same rounding (gate and up rounded to BF16 before the gating). On A100 for the Muse Glimmer gate/up shape the fused kernels take 0.89-0.95x the time of the unfused linear followed by the eager gating.Differential Revision: D136090757