[Bug]: AutoTuner load_cache crashes on a non-string tactic entry: warning_once(key=<list>) raises TypeError: unhashable type
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
tensorrt_llm/_torch/autotuner.py の _deserialize_cache_data から始めます。ここでは、警告のキーとして tactic の raw 値が渡されています。tensorrt_llm/logger.py の Logger.log_once を読んで、キーが hashable である必要があることを確認し、既存の AutoTuner のデシリアライズテストを確認します。リストまたは辞書の tactic エントリが意図された警告とともにスキップされ、キャッシュの残りの部分は引き続き読み込める状態になれば完了です。
索引モデルが issue の本文から書いたものです。
説明
System info
- TensorRT-LLM
mainat f65df75fcd (tensorrt_llm/version.py: 1.4.0rc3). The code path is unchanged since #9835. - Pure Python logic, independent of GPU and driver. Reproduced with Python 3.12.
Reproduction
Load an AutoTuner cache file in which one entry's "tactic" is not a string, for example a list or a dict. A cache written before #9835 stored the raw tactic ("tactic": tactic), so a list tactic is what an old-format or hand-merged cache contains:
{"<shared key>": {"('op', 0, ((16, 128),))": {"runner_id": 0, "tactic": [1, 2], "min_time": 0.1}}}
The same thing happens when calling _deserialize_cache_data directly with that entry.
Expected
The entry is skipped with the "Could not deserialize tactic ... skipping entry" warning, as the comment above that except intends ("so one bad entry can't crash the whole load").
Actual
ast.literal_eval raises on the non-string value, and the handler then raises while logging the warning, so load_cache logs Failed to load cache with JSON and re-raises:
Traceback (most recent call last):
File "tensorrt_llm/_torch/autotuner.py", line 872, in _deserialize_cache_data
tactic = ast.literal_eval(value["tactic"])
...
ValueError: malformed node or string: [1, 2]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "tensorrt_llm/_torch/autotuner.py", line 879, in _deserialize_cache_data
logger.warning_once(
File "tensorrt_llm/logger.py", line 343, in warning_once
self.log_once(self.WARNING, *msg, key=key)
File "tensorrt_llm/logger.py", line 320, in log_once
if key not in self._appeared_keys:
TypeError: unhashable type: 'list'
A dict tactic fails the same way (unhashable type: 'dict').
Location
tensorrt_llm/_torch/autotuner.py, _deserialize_cache_data (line 879 on f65df75fcd):
logger.warning_once(
f"[AutoTuner] Could not deserialize tactic: {value['tactic']} for cache key {key_str}; skipping entry.",
key=value["tactic"])
Logger.log_once stores key in a set, so the key must be hashable. The raw JSON value is not hashable when it is a list or a dict.
Suggested fix
Use a hashable key, for example key=("autotuner_deserialize_tactic", repr(value["tactic"])). The serialize-side warning_once(..., key=tactic_str) is already a string and is fine.
- 主要言語
- 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]: MPIPoolExecutor is not defined with ENABLE_MULTI_DEVICE=OFF対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンLLM API
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
NVIDIA/TensorRT-LLM#20647 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: trtllm-gen FMHA CudaArchDecl.h numbers Sm107a as 4, but the prebuilt libTrtLlmGen archives use 4 for 105a and 5 for 107a対応中かも @lucifer1004 が 46 日前に担当しました。 オープンCustomized kernels
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
NVIDIA/TensorRT-LLM#20507 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
NVIDIA/TensorRT-LLM の issue をすべて見る
似ている issue
-
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 日以内に返信
-
changelog investigate
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
ramnes/notion-sdk-py#523 ·
-
feature-request
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
open-telemetry/opentelemetry-python#5994 ·
メンテナーはふだん 2 日以内に返信