guan404ming opened a new pull request, #19964: URL: https://github.com/apache/tvm/pull/19964
## Why With `torch.compile(backend=relax_dynamo(), dynamic=True)`, dynamo lifts SymInt scalars (e.g. a symbolic batch size) as scalar graph inputs. `from_fx` skips these placeholders entirely (`# Ignore sym input`), so any op referencing one directly, such as `view(x.size(0), -1)`, fails during translation: ``` torch._dynamo.exc.BackendCompilerFailed: backend='tvm' raised: KeyError: s77 ``` The existing `test_relax_dynamo_dynamic` does not catch this because its graphs never reference the lifted SymInt placeholder as an op argument. ## How Bind such placeholders to the `tir.Var` of the same name already created for the input tensors' symbolic shapes (`relax_dynamo` builds `shape_vars` keyed by `str(SymInt)`, which matches the placeholder node name), so references resolve the same way `sym_size.int` results do. Placeholders with no matching shape var are still skipped as before. Added `test_relax_dynamo_dynamic_sym_input_reference` (conv + view over multiple batch sizes, checked against eager); it fails with `KeyError` without the fix. Authored with an AI assistant (Claude Code). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
