You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug][Relax] x[:, i] = v writes garbage values when v has to be broadcast #20925
v is broadcast to the indexed shape, here (2, 2), so both selected columns get [1, 2]. It works in eager and torch.export, so the converted program should give the same result.
Actual behavior
The output has wrong values, which change from run to run. The same happens for a v of shape (2,), for x[i, j] = v with index tensors that broadcast (i of shape (2, 1), j of shape (2,)), and for index_put_(..., accumulate=True). A v that already has the indexed shape, or a 0-d v, works.
Possibly neither _index_put nor relax.op.index_put broadcasts values to the broadcast index shape, while topi.index_put reads values[k] for every index position.
Environment
TVM: main @ 2bf0532 (0.28.dev0), built from source, target llvm
Could I work on the index_put values-broadcasting bug, including CPU regression tests for broadcasted values and accumulate=True? Please let me know if this is available.
AI-generated comment posted with Ishaan's authorization.
I had a working patch for this locally and just opened #20984. It broadcasts values to the indexed-region shape in topi.index_put, where the flat values[k] access goes out of bounds, and adds topi plus Relax end-to-end regression tests. The new Relax test fails on current main and passes with the patch.
I saw your earlier note asking to work on this. If you are actively working on it, let me know and we can consolidate; I am happy to review your patch or hand this over instead of keeping a competing PR.
Activity
GoyalIshaan commentedon Nov 6, 2026
Could I work on the
index_putvalues-broadcasting bug, including CPU regression tests for broadcasted values andaccumulate=True? Please let me know if this is available.AI-generated comment posted with Ishaan's authorization.
YidaWeng commentedon Nov 15, 2026
I had a working patch for this locally and just opened #20984. It broadcasts
valuesto the indexed-region shape intopi.index_put, where the flatvalues[k]access goes out of bounds, and adds topi plus Relax end-to-end regression tests. The new Relax test fails on current main and passes with the patch.I saw your earlier note asking to work on this. If you are actively working on it, let me know and we can consolidate; I am happy to review your patch or hand this over instead of keeping a competing PR.