Skip to content

[Op][Topi] 5 ops can accept unsigned integers as indices#10098

Merged
AndrewZhaoLuo merged 7 commits into
apache:mainfrom
yuanfz98:ops-indexing-support-uint
Jan 30, 2022
Merged

[Op][Topi] 5 ops can accept unsigned integers as indices#10098
AndrewZhaoLuo merged 7 commits into
apache:mainfrom
yuanfz98:ops-indexing-support-uint

Conversation

@yuanfz98

Copy link
Copy Markdown
Contributor

Hello community,

This PR links to #10064. 5 ops (scatter, scatter_add, scatter_nd, unravel_index, adv_index) accept unsigned integers as indices. Somehow unravel_index with uint indices may raise

Check failed: y != 0 (0 vs. 0) 

in function

ICHECK_NE(y, 0);
.

I tried to figure out why shape[v] can be 0 in

cur_val = indexdiv(indices_divs.back(), shape[v]);
,
but I failed to understand.

Thank reviewers for your help and your time speeding in CR.

cc @AndrewZhaoLuo

@AndrewZhaoLuo

AndrewZhaoLuo commented Jan 28, 2022

Copy link
Copy Markdown
Contributor

Debugging I've worked the issue to likely src/tir/transforms/narrow_datatype.cc, my guess analysis here does not take into account uint types

@AndrewZhaoLuo

Copy link
Copy Markdown
Contributor

#10102 <-- fix here. There is another error now with unravel index now though. You can try digging more, or you can drop unravel_index for later PR (which I recommend)

@AndrewZhaoLuo AndrewZhaoLuo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM mostly, just lmk the plan to deal with unravel_index

@yuanfz98

yuanfz98 commented Jan 29, 2022

Copy link
Copy Markdown
Contributor Author

LGTM mostly, just lmk the plan to deal with unravel_index

Thanks for your help! I prefer to drop unravel_index and open a PR later.

@AndrewZhaoLuo AndrewZhaoLuo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AndrewZhaoLuo AndrewZhaoLuo merged commit 1f9c76b into apache:main Jan 30, 2022
ylc pushed a commit to ylc/tvm that referenced this pull request Feb 16, 2022
* tests passed

* reformat

* add uint test for unravel_index
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.

2 participants