---
id: pr-tensorrt-llm-13328
repo: NVIDIA/TensorRT-LLM
pr: 13328
title: '[None][feat] Resubmission of the routing refactor in trtllmgen'
author: ChristinaZ
date: '2026-05-05'
url: https://github.com/NVIDIA/TensorRT-LLM/pull/13328
source_category: upstream-code
architectures:
- sm90
tags:
- benchmark kernel
- moe
- moe kernel
- sm90
techniques: []
hardware_features:
- hopper
kernel_types:
- moe
languages:
- cuda-cpp
captured_at: '2026-05-16'
status: merged
merge_sha: f8a9a296bcdea5d16e156651cbf963351853a01b
inclusion_reason: Search-matched CUDA kernel optimization PR; materialize diff/source before synthesis.
changed_paths:
- cpp/tensorrt_llm/kernels/communicationKernels/moeAllReduceFusionKernels.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/DevKernel.h
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingDeepSeek.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingRenormalize.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/IntFastDiv.h
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingCustom.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingCustomPolicy.cuh
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingDeepSeek.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingDevKernel.h
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingFromTopKIds.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingKernel.cuh
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingKernel.h
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingKernelTopK.cuh
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingLlama4.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingDeepSeek/RoutingDeepSeekCommon.cuh
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingDeepSeek/launchClusterKernel.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingDeepSeek/launchCoopKernel.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingDeepSeek/launchHistogramKernel.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingDeepSeek/launchInitExpertCounts.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingDeepSeek/launchMainKernel.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingDeepSeek/launchOffsetsKernel.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingRenormalize/RoutingRenormalizeCommon.cuh
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingRenormalize/launchClusterKernel.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingRenormalize/launchHistogramKernel.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingRenormalize/launchHistogramScoresKernel.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingRenormalize/launchInitExpertCounts.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingRenormalize/launchOffsetsKernel.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/runner.cu
- cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/runner.h
- cpp/tensorrt_llm/thop/cuteDslMoeUtilsOp.cpp
- cpp/tensorrt_llm/thop/fp4BlockScaleMoe.cpp
- cpp/tensorrt_llm/thop/fp8BlockScaleMoe.cpp
- cpp/tensorrt_llm/thop/fp8PerTensorScaleMoe.cpp
- cpp/tensorrt_llm/thop/mxFp4BlockScaleMoe.cpp
- cpp/tests/unit_tests/kernels/CMakeLists.txt
- cpp/tests/unit_tests/kernels/routing/routingCustomTest.cpp
- cpp/tests/unit_tests/kernels/routing/routingDeepSeekTest.cpp
- cpp/tests/unit_tests/kernels/routing/routingLlama4Test.cpp
- cpp/tests/unit_tests/kernels/routing/routingRenormalizeTest.cpp
- cpp/tests/unit_tests/kernels/routing/routingTest.cpp
- cpp/tests/unit_tests/kernels/routing/routingTest.h
- tensorrt_llm/_torch/custom_ops/trtllm_gen_custom_ops.py
- tensorrt_llm/_torch/models/modeling_deepseekv3.py
- tensorrt_llm/_torch/modules/fused_moe/__init__.py
- tensorrt_llm/_torch/modules/fused_moe/fused_moe_trtllm_gen.py
- tensorrt_llm/_torch/modules/fused_moe/moe_op_backend.py
- tensorrt_llm/_torch/modules/fused_moe/routing.py
- tests/integration/defs/accuracy/test_llm_api_pytorch.py
- tests/unittest/_torch/modules/moe/moe_test_utils.py
- tests/unittest/_torch/modules/moe/test_moe_module.py
artifact_dir: evidence/pull-bundles/tensorrt-llm/gh-13328
head_ref_oid: 8d50c57cb94d246d1057ced2cbdd3ee490008f2d
---
# [None][feat] Resubmission of the routing refactor in trtllmgen

- Repository: `NVIDIA/TensorRT-LLM`
- PR: [13328](https://github.com/NVIDIA/TensorRT-LLM/pull/13328)
- Decision: `Search-matched CUDA kernel optimization PR; materialize diff/source before synthesis.`
- Reason: Search-matched CUDA kernel optimization PR; materialize diff/source before synthesis.

## Changed Paths

- `cpp/tensorrt_llm/kernels/communicationKernels/moeAllReduceFusionKernels.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/DevKernel.h`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingDeepSeek.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/RoutingRenormalize.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/IntFastDiv.h`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingCustom.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingCustomPolicy.cuh`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingDeepSeek.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingDevKernel.h`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingFromTopKIds.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingKernel.cuh`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingKernel.h`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingKernelTopK.cuh`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routing/RoutingLlama4.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingDeepSeek/RoutingDeepSeekCommon.cuh`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingDeepSeek/launchClusterKernel.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingDeepSeek/launchCoopKernel.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingDeepSeek/launchHistogramKernel.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingDeepSeek/launchInitExpertCounts.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingDeepSeek/launchMainKernel.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingDeepSeek/launchOffsetsKernel.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingRenormalize/RoutingRenormalizeCommon.cuh`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingRenormalize/launchClusterKernel.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingRenormalize/launchHistogramKernel.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingRenormalize/launchHistogramScoresKernel.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingRenormalize/launchInitExpertCounts.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/routingRenormalize/launchOffsetsKernel.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/runner.cu`
- `cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/runner.h`
- `cpp/tensorrt_llm/thop/cuteDslMoeUtilsOp.cpp`
- `cpp/tensorrt_llm/thop/fp4BlockScaleMoe.cpp`
- `cpp/tensorrt_llm/thop/fp8BlockScaleMoe.cpp`
- `cpp/tensorrt_llm/thop/fp8PerTensorScaleMoe.cpp`
- `cpp/tensorrt_llm/thop/mxFp4BlockScaleMoe.cpp`
- `cpp/tests/unit_tests/kernels/CMakeLists.txt`
- `cpp/tests/unit_tests/kernels/routing/routingCustomTest.cpp`
- `cpp/tests/unit_tests/kernels/routing/routingDeepSeekTest.cpp`
- `cpp/tests/unit_tests/kernels/routing/routingLlama4Test.cpp`
- `cpp/tests/unit_tests/kernels/routing/routingRenormalizeTest.cpp`
- `cpp/tests/unit_tests/kernels/routing/routingTest.cpp`
- `cpp/tests/unit_tests/kernels/routing/routingTest.h`
- `tensorrt_llm/_torch/custom_ops/trtllm_gen_custom_ops.py`
- `tensorrt_llm/_torch/models/modeling_deepseekv3.py`
- `tensorrt_llm/_torch/modules/fused_moe/__init__.py`
- `tensorrt_llm/_torch/modules/fused_moe/fused_moe_trtllm_gen.py`
- `tensorrt_llm/_torch/modules/fused_moe/moe_op_backend.py`
- `tensorrt_llm/_torch/modules/fused_moe/routing.py`
- `tests/integration/defs/accuracy/test_llm_api_pytorch.py`
- `tests/unittest/_torch/modules/moe/moe_test_utils.py`
- `tests/unittest/_torch/modules/moe/test_moe_module.py`

## Evidence Bundle

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