Skip to content

Fix stale TorchScript and Windows references in trim compilers - #7

Merged
cyyever merged 2 commits into
trimfrom
fix/dynamo-without-scriptfunction
Oct 30, 2026
Merged

cyyever merged 2 commits into
trimfrom
fix/dynamo-without-scriptfunction

Conversation

@cyyever

@cyyever cyyever commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Linked issue or supporting maintainer

Fork maintainer's instruction: “开pr for fixes”. This targets BakeLab trim.

BC-breaking?

No new public API change. TorchScript's ScriptFunction was already removed from this fork.

Summary (human written only)

“开pr for fixes”

Agent details (AI-generated)

Dynamo's wrapper-call path still checks torch.jit.ScriptFunction, which no longer exists in trim. Calling a cached helper from a compiled Llama forward raises InternalTorchDynamoError: AttributeError before execution.

Remove the obsolete type check while preserving the special handling of nested torch.compile calls and their fullgraph semantics. Inductor's CPU binding path also still references the deleted _IS_WINDOWS constant when preparing precompiled headers; remove that stale guard for the supported non-Windows builds. This does not restore TorchScript or suppress compiler failures.

Validation: the unmodified package fails during real TP2 Llama server compilation at this lookup. With this isolated Python-only fix, the same CUDA server starts and two prompts produce 16 greedy tokens, with matching text and logprobs across the vLLM loader and compilation-policy comparisons. This uses actual RTX PRO 5000 hardware and the Rust/OpenAI entry point; no mock engine or GPU.

Using isolated copies of both fixed Python modules, all 10 vLLM compilation-policy regressions pass, including real CPU Inductor kernel compilation followed by the expected recompilation-limit exception. The unfixed package fails at _IS_WINDOWS before the initial CPU kernel can run.

lintrunner -a runs using the existing PyTorch virtual environment. No full PyTorch rebuild or broad Dynamo suite was run. AI assistance was used. This is a fork compatibility fix, not an upstream TorchScript deprecation proposal.

cyyever and others added 2 commits October 29, 2026 14:42
TorchScript's ScriptFunction was removed from trim, but tracing a wrapped
callable still accessed the missing type. Remove that unreachable branch
while preserving fullgraph handling for nested torch.compile calls.

Test Plan

```sh
lintrunner -a
```

Real CUDA TP2 Llama serving fails at the obsolete type lookup without the
fix and generates matching text and logprobs for two 8-token prompts with
the isolated fix. Tested through the Rust/OpenAI server; no full rebuild
or broad Dynamo suite was run.

Co-authored-by: Codex <[email protected]>
Signed-off-by: Yuanyuan Chen <[email protected]>
The trim build no longer defines _IS_WINDOWS. CPU Inductor bindings still referenced it while preparing precompiled headers, raising NameError before a kernel could execute. Remove the stale guard for supported non-Windows builds.

Test Plan: lintrunner -a passed. With isolated fixed PyTorch modules, the 10 vLLM compilation-policy regressions passed, including a real CPU Inductor kernel and the expected recompilation-limit exception.

Co-authored-by: Codex <[email protected]>
Signed-off-by: Yuanyuan Chen <[email protected]>
@cyyever cyyever changed the title Remove stale ScriptFunction dispatch from Dynamo Fix stale TorchScript and Windows references in trim compilers Oct 29, 2026
@cyyever
cyyever marked this pull request as ready for review October 30, 2026 00:00
@cyyever
cyyever merged commit f996883 into trim Oct 30, 2026
16 checks passed
cyyever added a commit that referenced this pull request Oct 31, 2026
* Remove stale ScriptFunction dispatch from Dynamo

TorchScript's ScriptFunction was removed from trim, but tracing a wrapped
callable still accessed the missing type. Remove that unreachable branch
while preserving fullgraph handling for nested torch.compile calls.

Test Plan

```sh
lintrunner -a
```

Real CUDA TP2 Llama serving fails at the obsolete type lookup without the
fix and generates matching text and logprobs for two 8-token prompts with
the isolated fix. Tested through the Rust/OpenAI server; no full rebuild
or broad Dynamo suite was run.

Co-authored-by: Codex <[email protected]>
Signed-off-by: Yuanyuan Chen <[email protected]>

* Remove stale Windows guard from Inductor header preparation

The trim build no longer defines _IS_WINDOWS. CPU Inductor bindings still referenced it while preparing precompiled headers, raising NameError before a kernel could execute. Remove the stale guard for supported non-Windows builds.

Test Plan: lintrunner -a passed. With isolated fixed PyTorch modules, the 10 vLLM compilation-policy regressions passed, including a real CPU Inductor kernel and the expected recompilation-limit exception.

Co-authored-by: Codex <[email protected]>
Signed-off-by: Yuanyuan Chen <[email protected]>

---------

Signed-off-by: Yuanyuan Chen <[email protected]>
Co-authored-by: Codex <[email protected]>
cyyever added a commit that referenced this pull request Oct 31, 2026
* Remove stale ScriptFunction dispatch from Dynamo

TorchScript's ScriptFunction was removed from trim, but tracing a wrapped
callable still accessed the missing type. Remove that unreachable branch
while preserving fullgraph handling for nested torch.compile calls.

Test Plan

```sh
lintrunner -a
```

Real CUDA TP2 Llama serving fails at the obsolete type lookup without the
fix and generates matching text and logprobs for two 8-token prompts with
the isolated fix. Tested through the Rust/OpenAI server; no full rebuild
or broad Dynamo suite was run.

Co-authored-by: Codex <[email protected]>
Signed-off-by: Yuanyuan Chen <[email protected]>

* Remove stale Windows guard from Inductor header preparation

The trim build no longer defines _IS_WINDOWS. CPU Inductor bindings still referenced it while preparing precompiled headers, raising NameError before a kernel could execute. Remove the stale guard for supported non-Windows builds.

Test Plan: lintrunner -a passed. With isolated fixed PyTorch modules, the 10 vLLM compilation-policy regressions passed, including a real CPU Inductor kernel and the expected recompilation-limit exception.

Co-authored-by: Codex <[email protected]>
Signed-off-by: Yuanyuan Chen <[email protected]>

---------

Signed-off-by: Yuanyuan Chen <[email protected]>
Co-authored-by: Codex <[email protected]>
cyyever added a commit that referenced this pull request Oct 31, 2026
* Remove stale ScriptFunction dispatch from Dynamo

TorchScript's ScriptFunction was removed from trim, but tracing a wrapped
callable still accessed the missing type. Remove that unreachable branch
while preserving fullgraph handling for nested torch.compile calls.

Test Plan

```sh
lintrunner -a
```

Real CUDA TP2 Llama serving fails at the obsolete type lookup without the
fix and generates matching text and logprobs for two 8-token prompts with
the isolated fix. Tested through the Rust/OpenAI server; no full rebuild
or broad Dynamo suite was run.

Co-authored-by: Codex <[email protected]>
Signed-off-by: Yuanyuan Chen <[email protected]>

* Remove stale Windows guard from Inductor header preparation

The trim build no longer defines _IS_WINDOWS. CPU Inductor bindings still referenced it while preparing precompiled headers, raising NameError before a kernel could execute. Remove the stale guard for supported non-Windows builds.

Test Plan: lintrunner -a passed. With isolated fixed PyTorch modules, the 10 vLLM compilation-policy regressions passed, including a real CPU Inductor kernel and the expected recompilation-limit exception.

Co-authored-by: Codex <[email protected]>
Signed-off-by: Yuanyuan Chen <[email protected]>

---------

Signed-off-by: Yuanyuan Chen <[email protected]>
Co-authored-by: Codex <[email protected]>
cyyever added a commit that referenced this pull request Oct 31, 2026
* Remove stale ScriptFunction dispatch from Dynamo

TorchScript's ScriptFunction was removed from trim, but tracing a wrapped
callable still accessed the missing type. Remove that unreachable branch
while preserving fullgraph handling for nested torch.compile calls.

Test Plan

```sh
lintrunner -a
```

Real CUDA TP2 Llama serving fails at the obsolete type lookup without the
fix and generates matching text and logprobs for two 8-token prompts with
the isolated fix. Tested through the Rust/OpenAI server; no full rebuild
or broad Dynamo suite was run.

Co-authored-by: Codex <[email protected]>
Signed-off-by: Yuanyuan Chen <[email protected]>

* Remove stale Windows guard from Inductor header preparation

The trim build no longer defines _IS_WINDOWS. CPU Inductor bindings still referenced it while preparing precompiled headers, raising NameError before a kernel could execute. Remove the stale guard for supported non-Windows builds.

Test Plan: lintrunner -a passed. With isolated fixed PyTorch modules, the 10 vLLM compilation-policy regressions passed, including a real CPU Inductor kernel and the expected recompilation-limit exception.

Co-authored-by: Codex <[email protected]>
Signed-off-by: Yuanyuan Chen <[email protected]>

---------

Signed-off-by: Yuanyuan Chen <[email protected]>
Co-authored-by: Codex <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant