ruff
b708d72b - [ty] Add dedicated TDDs for narrowing constraints (#25834)

Commit
157 days ago
[ty] Add dedicated TDDs for narrowing constraints (#25834) ## Summary This started as the structural half of #25787: move narrowing constraints out of the reachability graph into a dedicated ternary decision diagram, where `if_uncertain` is a lazy "don't care" edge. Duboc OR and AND can then combine formulas without copying one path into both outcomes of another predicate, and projected narrowing uses the same representation for each place. This PR now also includes #25835. Its cofactor-absorption reductions simplify formulas such as `A or (not A and B)` to `A or B`, so successful `if`/`elif` branches stay compact without continuation-specific predicate removal. The same reductions apply when constructing the semantic-index TDD and the projected graph used during narrowing. #25836 was split out as the continuation-specific follow-up from #25787. With #25835 now incorporated here, its remaining branch-specific reductions and benchmarks need to be reevaluated against this updated base. ## Benchmarks Using the original `charlie/rebench` structural checkpoint: - PyTorch: 7.79s -> 1.87s (4.18x faster) For `isort`, comparing ty binaries on the benchmark project with 5 warmups and 20 runs: - before PR (`7c645a9a1`): 254.5ms ± 1.6ms - dedicated TDDs (`698e44a`): 306.9ms ± 2.3ms (1.21x slower) - cofactor absorption (`4a91655`): 258.9ms ± 2.4ms (1.02x slower) - restored fast paths (`40a99f3`): 256.1ms ± 1.8ms (1.01x slower) So the initial structural checkpoint regressed `isort`, but the current PR state is effectively back to baseline. --------- Co-authored-by: Douglas Creager <dcreager@dcreager.net>
Author
Parents
Loading