Found while sweeping #847. Spec registry-downcast-sweep.md §3.3 and mutation M4.
PR #868 added two ModelAs overloads to include/vllm/model_executor/models/model_registry.h:
template <typename Model> Model& ModelAs(LoadedModel& model, std::string_view architecture);
template <typename Model> const Model& ModelAs(const LoadedModel& model, std::string_view architecture);
The second one is never selected. Both #847's own text and the dispatch that opened the sweep assumed the 14 sites that bind their downcast to a const auto& would select it. They do not: every registered prepare/forward takes a non-const LoadedModel& model, so overload resolution picks the non-const ModelAs at all 35 call sites, and its Model& result simply binds to the const auto&.
Measured, not argued
Deleting the const overload from the header and running -fsyntax-only over all 30 swept translation units compiles all 30, including every const auto& site:
TUs that stopped compiling without the const overload: NONE
(header restored byte-for-byte afterwards, sha256 verified)
Why it matters
It is dead code on a shared header, and it is dead in the specific way that reads as covered: the sweep's brief cited its existence as the reason the 14 const sites needed no thought. The conclusion happened to be right and the reason was wrong, which is worse than an open question.
What is owed
Either a caller appears — an entry point that genuinely takes a const LoadedModel& — or the overload goes. Not decided in the #847 sweep because the seam is #868's and deleting another row's seam half inside a mechanical sweep is not reviewable as either change.
Found while sweeping #847. Spec
registry-downcast-sweep.md§3.3 and mutation M4.PR #868 added two
ModelAsoverloads toinclude/vllm/model_executor/models/model_registry.h:The second one is never selected. Both #847's own text and the dispatch that opened the sweep assumed the 14 sites that bind their downcast to a
const auto&would select it. They do not: every registeredprepare/forwardtakes a non-constLoadedModel& model, so overload resolution picks the non-constModelAsat all 35 call sites, and itsModel&result simply binds to theconst auto&.Measured, not argued
Deleting the const overload from the header and running
-fsyntax-onlyover all 30 swept translation units compiles all 30, including everyconst auto&site:(header restored byte-for-byte afterwards, sha256 verified)
Why it matters
It is dead code on a shared header, and it is dead in the specific way that reads as covered: the sweep's brief cited its existence as the reason the 14
constsites needed no thought. The conclusion happened to be right and the reason was wrong, which is worse than an open question.What is owed
Either a caller appears — an entry point that genuinely takes a
const LoadedModel&— or the overload goes. Not decided in the #847 sweep because the seam is #868's and deleting another row's seam half inside a mechanical sweep is not reviewable as either change.