Repository navigation
Description
System Info
- TensorRT-LLM main @ e88d19c
- Affects SM107 builds (the trtllm-gen FMHA target is compiled with
TLLM_RUBIN_FEATURES, seecpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/CMakeLists.txt). The reproduction below is CPU-only and uses the checked-in prebuilt archives, on both x86_64 and aarch64.
Who can help?
Related: #18518 and #19038 (enable TLLM_RUBIN_FEATURES for the FMHA target and refresh the archives), #18758 (maps SM107 to Sm100f for NVRTC), #20054 (latest archive update).
Reproduction
cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/trtllmGen_fmha_export/trtllm/gen/CudaArchDecl.h declares:
enum class CudaArch {
Sm90a = 0, // 0
Sm100a, // 1
Sm100f, // 2
Sm103a, // 3
#ifdef TLLM_RUBIN_FEATURES
Sm107a, // 4
#endif
};The prebuilt fmha/lib/<arch>/libTrtLlmGen.a and libTrtLlmGenFmhaLib.a were compiled with an enum that also has 105a. Value 4 is 105a there, and 107a is 5:
strings libTrtLlmGen.acontains90a 100a 100f 103a 105a 107a.- In the archive's
trtllm::gen::cudaArchToString, the jump table covers 0..5. - In the archive's
trtllm::gen::getMaxNumTmemCols, values 1..3 return 512, 5 returns 576, and anything else goes to the "unsupported" error path.
Minimal CPU-only reproduction, from the repository root:
// repro.cpp
#include "CudaArchDecl.h"
#include <cstdio>
#include <exception>
namespace trtllm { namespace gen { int getMaxNumTmemCols(CudaArch); } }
using trtllm::gen::CudaArch;
int main() {
std::printf("header: Sm103a=%d Sm107a=%d\n", int(CudaArch::Sm103a), int(CudaArch::Sm107a));
for (int v : {1, 2, 3, 5})
std::printf("libTrtLlmGen getMaxNumTmemCols(%d) = %d\n", v, trtllm::gen::getMaxNumTmemCols(CudaArch(v)));
try {
std::printf("getMaxNumTmemCols(CudaArch::Sm107a) = %d\n", trtllm::gen::getMaxNumTmemCols(CudaArch::Sm107a));
} catch (std::exception const& e) {
std::printf("getMaxNumTmemCols(CudaArch::Sm107a) threw: %s\n", e.what());
}
}D=cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha
g++ -std=c++17 -DTLLM_RUBIN_FEATURES -I$D/trtllmGen_fmha_export/trtllm/gen repro.cpp \
$D/lib/$(uname -m)-linux-gnu/libTrtLlmGen.a -o repro && ./reproOutput (identical on x86_64 and aarch64):
header: Sm103a=3 Sm107a=4
libTrtLlmGen getMaxNumTmemCols(1) = 512
libTrtLlmGen getMaxNumTmemCols(2) = 512
libTrtLlmGen getMaxNumTmemCols(3) = 512
libTrtLlmGen getMaxNumTmemCols(5) = 576
getMaxNumTmemCols(CudaArch::Sm107a) threw: Unsupported CUDA arch: 105a
[E] [TmemTile.cpp:46]: Unsupported CUDA arch: 105a
So CudaArch::Sm107a, as compiled into TensorRT-LLM, is 105a to the archive.
Expected behavior
CudaArch values passed across the boundary to the prebuilt archives mean the same architecture on both sides.
Actual behavior
On SM107, TllmGenFmhaKernel sets options.mCudaArch = intToCudaArch(107) = Sm107a (4) in checkIfKernelExist, warmupOneKernel and run (fmha/fmhaKernels.h). It then hands those FmhaOptions to archive code that reads mCudaArch:
fmha::FmhaAutoTuner::selectKernel()(throughselectKernelAutotuned), on every path;fmha::FmhaInterface::generateAndCompileKernel(), on the NVRTC path.
run() rewrites mCudaArch to Sm100f before NVRTC compilation for non-spcompress kernels (added in #18518). warmupOneKernel() does not. So the JIT warmup path, and every autotuner call, gives the archive 105a instead of 107a. Any SM107-specific branches in the archive are therefore not taken, and the archive's TMEM limit lookup for that value is the error path shown above.
Additional notes
Suggested fix: make the header match the archives. The smallest change is:
#ifdef TLLM_RUBIN_FEATURES
// SM107. 4 is Sm105a in the prebuilt trtllm-gen archives.
Sm107a = 5,
#endifA more robust alternative is to export the archive's value (or the enum header itself) together with the archives, and add a CPU-only check. Something like the reproduction above, run as a unit test, would catch the next drift when the archives are refreshed.
The other CudaArchDecl.h copies (batchedGemm/trtllm/gen/, batchedGemm/trtllmGen_bmm_export/trtllm/gen/) also number Sm107a as 4. As far as I can tell, they do not pass the value into a prebuilt archive.
What is verified: the reproduction above, on x86_64 and aarch64 against the archives at e88d19c, and the code paths listed under "Actual behavior". Our SM107 builds carry Sm107a = 5. I have not run an SM107 build with the unpatched value end to end, so I cannot say exactly which kernel selections change with 4.
I have the one-line fix and can open a PR.
Activity
lucifer1004 commentedon Oct 17, 2026
Cross-reference: #20515 covers another problem in the same prebuilt archive (
libTrtLlmGen.a): the FMHA JIT requires/usr/local/cuda/bin/nvccfor its version query, even with NVRTC. The serving JIT warmup hits it inwarmupOneKernel, the path described here. There the printed config has"smVersion": "107a"; therun()path rewrites it to"100f".