Skip guards on unused constant ops (#189642)
Summary:
## Related Issue
Part of #187590
## Why
Using a constant in an op (e.g. `a + b`) guards on the operand values, even if the result is never used in graph computation. Changing those values then recompiles for no reason.
## How
- Add `ComputedLazyConstantVariable`: compute the result at trace time but skip the guards; output bytecode recomputes it from the inputs at runtime, so value changes do not recompile
- Fall back to the normal guarded path as soon as the result actually affects tracing (control flow, tensor math, etc.)
- Always on, no config flag; `test_unbacked_sources_scalar` updated so its scalar still flows into the graph
Authored with an AI assistant (Claude Code).
X-link: https://github.com/pytorch/pytorch/pull/189642
Approved by: https://github.com/rtimpe
Reviewed By: georgehong
Differential Revision: D113643215
fbshipit-source-id: 79a111cb80c780abb03f6946d9696349e8ace467
Author
generatedunixname499836121