← Back to events
ActiveAIRelease

trunk/200b41a7408de59bc55e10c808f26b652b9275a0: [inductor] Handle full randperm in index_add pattern (#196873)

Photo: PyTorch Releases

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

Why it's spreading

Sources