pytorch
1ea20cdb - workaround for indexing formulas with negative terms (#89933)

Commit
2 years ago
workaround for indexing formulas with negative terms (#89933) Fixes https://github.com/pytorch/torchdynamo/issues/1928 For `ModularIndexing` we generate indexing code with `//` and `%` operators. When `ModularIndexing` base is negative (that can happen after valid simplifications), `//` in triton produces wrong results https://github.com/openai/triton/issues/619/. For `//` op coming from pytorch, we have codegen workarounds, but I'm reluctant to apply these workarounds to very common indexing computation patterns, both for code readability and perf considerations. Similarly, we replace `ModularIndexing` with `IndexingDiv` when we can prove that base is small, but those assumptions break when `ModularIndexing` base is negative (`ModularIndexing` is always positive, `IndexingDiv` isn't). Pull Request resolved: https://github.com/pytorch/pytorch/pull/89933 Approved by: https://github.com/jansel
Author
Natalia Gimelshein
Committer
Parents
Loading