Skip to content

Conversation

@jikechao
Copy link
Member

@jikechao jikechao commented May 22, 2025

Fix #17947

This PR fixes an index calculation bug in topi.expand_like where incorrect indexing could lead to out-of-bounds access when expanding along specified axes.

If a.shape[src_dim] == 1, we use indice=0 because broadcasting rules require replicating the single value across the expanded dimension, and indexing with 0 ensures correct behavior without bounds violations.

@jikechao
Copy link
Member Author

@tvm-bot rerun!

@jikechao
Copy link
Member Author

@tvm-bot rerun

@jikechao jikechao marked this pull request as draft May 23, 2025 02:51
@jikechao jikechao marked this pull request as ready for review May 23, 2025 06:38
@jikechao jikechao marked this pull request as draft May 23, 2025 08:12
@jikechao jikechao marked this pull request as ready for review May 26, 2025 05:37
@jikechao
Copy link
Member Author

@tvm-bot rerun

@jikechao
Copy link
Member Author

jikechao commented Jun 1, 2025

@mshr-h mshr-h merged commit 55b8980 into apache:main Jun 1, 2025
12 of 13 checks passed
@sunzj
Copy link
Contributor

sunzj commented Jun 13, 2025

@jikechao is that issue happens when apply the schedule or generate the schedule? i mean, if i already tuned the schedule, do i need re-tune the schedule after apply the patch, or just re-generate the model library?

@jikechao
Copy link
Member Author

@sunzj, you need not re-tune the schedule after applying this patch. Just regenerating the model library is enough.

@jikechao
Copy link
Member Author

@sunzj BTW, this patch specifically addresses a special case: the topi.expand_like operator when a.shape[src_dim] == 1. If your model doesn't encounter this edge case, you can safely ignore this patch, as it won't impact your model's behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Meta schedule produce inconsistant inference results

3 participants