---
id: pr-tensorrt-llm-7761
repo: NVIDIA/TensorRT-LLM
pr: 7761
title: '[TRTLLM-8637][feat] Optimize the routing kernel for DeepseekV3 (MoE CUTLASS backend); Add support for 384 experts (MoE TRTLLM backend)'
author: ChristinaZ
date: '2025-10-20'
url: https://github.com/NVIDIA/TensorRT-LLM/pull/7761
source_category: upstream-code
architectures:
- sm100
tags:
- attention_kv
- blockScaleMoe
- gemm_quant
- moe_routing
techniques:
- fine-grained-quantization
hardware_features:
- fp4
- fp8
- mxfp4
kernel_types:
- attention
- gemm
- moe
- norm
- reduction
languages:
- cuda-cpp
- cute-dsl
captured_at: '2026-05-16'
status: merged
merge_sha: c8b9998acb8b958607f39199cc3a0ddc66b492af
inclusion_reason: Separate routing, permutation, top-k, and expert GEMM costs; keep tail-token and expert-layout tests attached to the idea.
changed_paths:
- cpp/tensorrt_llm/kernels/moeTopKFuncs.cuh
- cpp/tensorrt_llm/kernels/noAuxTcKernels.cu
- cpp/tensorrt_llm/kernels/noAuxTcKernels.h
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/DevKernel.h
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingDeepSeek.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingKernel.cuh
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingKernel.h
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingKernelTopK.cuh
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingLlama4.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingRenormalize.cu
- cpp/tensorrt_llm/thop/fp4BlockScaleMoe.cpp
- cpp/tensorrt_llm/thop/fp8BlockScaleMoe.cpp
- cpp/tensorrt_llm/thop/mxFp4BlockScaleMoe.cpp
- cpp/tensorrt_llm/thop/noAuxTcOp.cpp
- cpp/tests/unit_tests/kernels/routing/routingDeepSeekTest.cpp
- cpp/tests/unit_tests/kernels/routing/routingRenormalizeTest.cpp
- tests/unittest/_torch/thop/parallel/test_moe.py
- tests/unittest/_torch/thop/parallel/test_noaux_tc.py
artifact_dir: evidence/pull-bundles/tensorrt-llm/gh-7761
head_ref_oid: d2202e8e99e1713754969b6817fb2bde64f1afd3
---
# [TRTLLM-8637][feat] Optimize the routing kernel for DeepseekV3 (MoE CUTLASS backend); Add support for 384 experts (MoE TRTLLM backend)

- Repository: `NVIDIA/TensorRT-LLM`
- PR: [7761](https://github.com/NVIDIA/TensorRT-LLM/pull/7761)
- Decision: `Separate routing, permutation, top-k, and expert GEMM costs; keep tail-token and expert-layout tests attached to the idea.`
- Reason: Separate routing, permutation, top-k, and expert GEMM costs; keep tail-token and expert-layout tests attached to the idea.

## Changed Paths

- `cpp/tensorrt_llm/kernels/moeTopKFuncs.cuh`
- `cpp/tensorrt_llm/kernels/noAuxTcKernels.cu`
- `cpp/tensorrt_llm/kernels/noAuxTcKernels.h`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/DevKernel.h`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingDeepSeek.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingKernel.cuh`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingKernel.h`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingKernelTopK.cuh`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingLlama4.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingRenormalize.cu`
- `cpp/tensorrt_llm/thop/fp4BlockScaleMoe.cpp`
- `cpp/tensorrt_llm/thop/fp8BlockScaleMoe.cpp`
- `cpp/tensorrt_llm/thop/mxFp4BlockScaleMoe.cpp`
- `cpp/tensorrt_llm/thop/noAuxTcOp.cpp`
- `cpp/tests/unit_tests/kernels/routing/routingDeepSeekTest.cpp`
- `cpp/tests/unit_tests/kernels/routing/routingRenormalizeTest.cpp`
- `tests/unittest/_torch/thop/parallel/test_moe.py`
- `tests/unittest/_torch/thop/parallel/test_noaux_tc.py`

## Evidence Bundle

`evidence/pull-bundles/tensorrt-llm/gh-7761`
