trunk/200b41a7408de59bc55e10c808f26b652b9275a0: [inductor] Handle full randperm in index_add pattern (#196873)
- PyTorch: 1882 events in the last 90 days
- PyTorch: 1858th Release in the last 90 days
- Previous: earlier the same day · trunk/94705d5841150618c9de1468727580412bc592f8: [MPS] Fix linalg.lstsq on empty inputs (#199694)
What happened
Fixes #196631 Summary TorchInductor already optimizes index_add when the index is a sliced permutation: index = torch . randperm ( x . shape [ 0 ], device = x . device )[: y . shape [ 0 ]] result = torch . index_add ( x , dim = 0 , source = y , index = index ) Because the indices are unique and in bounds, the accumulating update can be rewritten using unsafe indexing and a non-accumulating index_put . The full-permu…
Summary assembled by rule from the sources below