[Bugfix] Register IR providers before hashing configuration (#58756)

Signed-off-by: Nils Matteson <nilsmatteson@icloud.com>

Nils Matteson committed Sep 30, 2026 at 19:34 UTC 9e6550bd058560bec5690b6c06474adf048a9b85
2 files changed +25
tests/config/test_config_utils.py
+22
@@ -168,6 +168,28 @@ def test_classes_are_types():
168 assert endswith_fqname(LocalDummy, ".LocalDummy")
169
170
171 +def test_ir_config_hash_initializes_provider_and_tracks_implementation(monkeypatch):
172 + from types import SimpleNamespace
173 +
174 + from vllm.config.kernel import IrOpPriorityConfig
175 + from vllm.ir.op import IrOp
176 + from vllm.platforms import current_platform
177 +
178 + op = IrOp.registry["rms_norm"]
179 + implementation = SimpleNamespace(uuid=lambda: "first-implementation")
180 +
181 + def import_ir_kernels():
182 + monkeypatch.setitem(op.impls, "test_lazy_provider", implementation)
183 +
184 + monkeypatch.setattr(current_platform, "import_ir_kernels", import_ir_kernels)
185 + config = IrOpPriorityConfig(rms_norm=["test_lazy_provider"])
186 + first_hash = config.compute_hash()
187 + assert config.compute_hash() == first_hash
188 +
189 + implementation.uuid = lambda: "changed-implementation"
190 + assert config.compute_hash() != first_hash
191 +
192 +
193 def test_envs_compile_factors_stable():
194 """Test that envs.compile_factors() hash is stable across fresh initializations.
195
vllm/config/kernel.py
+3
@@ -48,6 +48,9 @@ class IrOpPriorityConfig:
48 # Implementations are hidden from Dynamo,
49 # so they don't show up in the traced files list.
50 from vllm.ir.op import IrOp
51 + from vllm.platforms import current_platform
52 +
53 + current_platform.import_ir_kernels()
54
55 assert "_impls" not in factors
56 factors["_impls"] = {