Commit Graph

7 Commits

Author SHA1 Message Date
Jason Ansel
24ae50bcc7 Add config option to reduce warnings in inductor (#94413)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94413
Approved by: https://github.com/ezyang
2023-02-10 15:44:15 +00:00
Aaron Gokaslan
8fce9a09cd [BE]: pyupgrade Python to 3.8 - imports and object inheritance only (#94308)
Apply parts of pyupgrade to torch (starting with the safest changes).
This PR only does two things: removes the need to inherit from object and removes unused future imports.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/94308
Approved by: https://github.com/ezyang, https://github.com/albanD
2023-02-07 21:10:56 +00:00
Jason Ansel
24b501903c Minor sympy usage fix in fbcode (#93171)
Summary: To supports older versions of sympy.

Test Plan:
```
buck2 run @//mode/opt @//mode/inplace -c python.package_style=inplace -c fbcode.enable_gpu_sections=true //caffe2/benchmarks/dynamo:torchbench -- -dcuda --performance --inductor --only hf_T5
```

Differential Revision: D42812188

Pull Request resolved: https://github.com/pytorch/pytorch/pull/93171
Approved by: https://github.com/eellison
2023-01-30 23:34:22 +00:00
Horace He
19c9b09449 Replace IndexingDiv with FloorDiv in Inductor (#92878)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/92878
Approved by: https://github.com/ezyang
2023-01-24 15:06:22 +00:00
lezcano
353e9f883f Add name attribute to ValueRangeAnalysis (#92121)
This is expected when used within InterpreterShim.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/92121
Approved by: https://github.com/eellison
2023-01-14 12:07:52 +00:00
lezcano
fd0030fe74 Fix indexing_dtype_strength_reduction (#91601)
Many of the previous inductive cases were wrong (e.g. `abs`, `sq`, `div` and `truediv`).
We rewrite it using the mathematical terms that allow to prove the relevant upper
and lower bounds.

Note that the inductive step can be seen as a not-too-difficult optimisation problem
with constraints, hence the naming of the functions.

For many of the other functions, we also simplify the formulas, which will be useful
when this code is generalised to work with symbolic shapes.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/91601
Approved by: https://github.com/jansel, https://github.com/eellison
2023-01-10 23:39:30 +00:00
Elias Ellison
8b3d31cfc5 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
2022-12-22 20:04:26 +00:00