[v1] refactor NPU kernel matching by model type#10643
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the NPU kernel implementations (including MoE, SwiGLU, RMSNorm, and RoPE) to select and apply patches based on model types rather than class names or architectures, and introduces corresponding unit tests. Feedback on the changes highlights a critical issue in the SwiGLU kernel where MLP submodules typically lack a config attribute, causing the patch check to fail. It is recommended to pass the top-level model.config to _get_patch_forward and update the unit tests accordingly.
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.
3c13c20 to
8956429
Compare
What does this PR do?
Refactors v1 NPU kernels to use explicit
model_type-based matching for RoPE, RMSNorm, SwiGLU, and Fused MoE. It also separates Transformers v4/v5 MoE mappings.Before submitting