[Bug]: trtllm-gen FMHA CudaArchDecl.h numbers Sm107a as 4, but the prebuilt libTrtLlmGen archives use 4 for 105a and 5 for 107a
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 68/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- cpp
- Área
- backend, performance
Línea de trabajo
Lee cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/trtllmGen_fmha_export/trtllm/gen/CudaArchDecl.h y compara sus valores de CudaArch con los archivos FMHA precompilados. Empieza ejecutando la reproducción solo con CPU del issue desde la raíz del repositorio. Se considera terminado cuando el valor Sm107a del encabezado coincide con el archivo, de modo que la reproducción ya no lo trate como 105a.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
System Info
- TensorRT-LLM main @ e88d19ca3b
- 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 && ./repro
Output (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,
#endif
A 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 e88d19ca3b, 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.
- Lenguaje dominante
- Python
- Estrellas
- 15.1k
- Forks
- 3k
- Merge medio
- 3 d 1 h
- PR fusionados (30 d)
- 474
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de NVIDIA/TensorRT-LLM
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
NVIDIA/TensorRT-LLM#23273 ·
Los mantenedores suelen responder en 1 día
-
Trace-replay Pareto window includes the drain when sessions finish out of admission orderPosiblemente ocupada @sbeierle la tomó hace 1 día. AbiertoTesting
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
NVIDIA/TensorRT-LLM#23077 ·
Los mantenedores suelen responder en 1 día
-
LongBench V2 blog command breaks on inline comments after continuationsPosiblemente ocupada @ddlw la tomó hace 24 días. AbiertoDoc
Dificultad 1/5 Menos de una hora Aptitud para principiantes 91/100
NVIDIA/TensorRT-LLM#21879 ·
Los mantenedores suelen responder en 1 día
-
[Bug]: AutoTuner load_cache crashes on a non-string tactic entry: warning_once(key=<list>) raises TypeError: unhashable typePosiblemente ocupada @Gloria72 la tomó hace 34 días. AbiertoCustomized kernels
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
NVIDIA/TensorRT-LLM#21218 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
[Bug]: MPIPoolExecutor is not defined with ENABLE_MULTI_DEVICE=OFFPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. AbiertoLLM API
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
NVIDIA/TensorRT-LLM#20647 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de NVIDIA/TensorRT-LLM
Issues similares
-
Make the "%" unit spacing the same in the web and in A10Posiblemente ocupada @kragent66-glitch la tomó hoy. Abiertobug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
maiychrus25/OpenTea-DX-OS#226 · 1 comentario ·
-
ci severity: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
TMHSDigital/Spackle#205 ·
Los mantenedores suelen responder en 1 día
-
pkg:lgm type:chore upstream-gaussx
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
jejjohnson/pyrox#610 ·
Los mantenedores suelen responder en 1 día
-
changelog investigate
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
ramnes/notion-sdk-py#523 ·
-
feature-request
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
open-telemetry/opentelemetry-python#5994 ·
Los mantenedores suelen responder en 2 días