pytorch
8b3d31cf - Add A ValueRange Analysis Pass to convert int64 indexing to int32 (#91028)

Commit
2 years ago
Add A ValueRange Analysis Pass to convert int64 indexing to int32 (#91028) Builds up sympy expressions computing the lower and upper bound of ranges, and then finds `op.to_dtype(x, torch.int64)` nodes whose dominated values can all be computed in a lower precision. I haven't gotten all the way to work with dynamic shapes but it should be a fairly small change. There's still additional work to get torchinductor to work with large tensors (see https://github.com/pytorch/torchdynamo/issues/1819) because we would need to add explicit dtype annotations to int64 which we're not doing right now. Fix for https://github.com/pytorch/torchdynamo/issues/1293. Performance Before OpBench aten.upsample_bilinear2d.vec float32: (25th %, 50th %, 75th %) Before [0.7521964636710751, 0.8645357996607477, 2.8746003906598494] After: [0.9511363478204263, 1.0295566597806718, 3.2662165264101755] Pull Request resolved: https://github.com/pytorch/pytorch/pull/91028 Approved by: https://github.com/jansel
Author
Committer
Parents
Loading