[Bug]: trtllm-gen FMHA CudaArchDecl.h numbers Sm107a as 4, but the prebuilt libTrtLlmGen archives use 4 for 105a and 5 for 107a
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- cpp
- 領域
- backend, performance
調査の方向性
cpp/tensorrt_llm/kernels/trtllmGenKernels/fmha/trtllmGen_fmha_export/trtllm/gen/CudaArchDecl.hを読み、そのCudaArchの値をビルド済みFMHAアーカイブと比較してください。まず、リポジトリのルートからissueにあるCPUのみの再現手順を実行してください。ヘッダーのSm107aの値がアーカイブと一致し、再現手順で105aとして扱われなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 15.1k
- フォーク
- 3k
- 平均マージ
- 3日 1時間
- マージ済み PR(30日)
- 474
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NVIDIA/TensorRT-LLM のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
NVIDIA/TensorRT-LLM#23273 ·
メンテナーはふだん 1 日以内に返信
-
Trace-replay Pareto window includes the drain when sessions finish out of admission order対応中かも @sbeierle が 1 日前に担当しました。 オープンTesting
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
NVIDIA/TensorRT-LLM#23077 ·
メンテナーはふだん 1 日以内に返信
-
LongBench V2 blog command breaks on inline comments after continuations対応中かも @ddlw が 24 日前に担当しました。 オープンDoc
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
NVIDIA/TensorRT-LLM#21879 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: AutoTuner load_cache crashes on a non-string tactic entry: warning_once(key=<list>) raises TypeError: unhashable type対応中かも @Gloria72 が 34 日前に担当しました。 オープンCustomized kernels
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NVIDIA/TensorRT-LLM#21218 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: MPIPoolExecutor is not defined with ENABLE_MULTI_DEVICE=OFF対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンLLM API
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
NVIDIA/TensorRT-LLM#20647 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
NVIDIA/TensorRT-LLM の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
nael5x/creative-ai#130 ·
-
Make the "%" unit spacing the same in the web and in A10対応中かも @kragent66-glitch が今日担当しました。 オープンbug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
maiychrus25/OpenTea-DX-OS#226 · コメント 1 件 ·
-
ci severity: low
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
TMHSDigital/Spackle#205 ·
メンテナーはふだん 1 日以内に返信
-
pkg:lgm type:chore upstream-gaussx
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
jejjohnson/pyrox#610 ·
メンテナーはふだん 1 日以内に返信