Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Intrinsic] lower_bound and upper_bound for binary search in Sparse TIR. #483

Merged
merged 25 commits into from
Oct 3, 2021

Conversation

yzh119
Copy link
Collaborator

@yzh119 yzh119 commented Oct 3, 2021

Implement the intrinsic on CUDA for Sparse TIR (#466 ).

cc @junrushao1994 @MasterJH5574 .

@yzh119 yzh119 requested review from junrushao and MasterJH5574 and removed request for junrushao and MasterJH5574 October 3, 2021 00:21
python/tvm/tir/op.py Outdated Show resolved Hide resolved
@MasterJH5574
Copy link
Collaborator

Another question is, how shall we implement binary search for llvm?

Copy link
Collaborator

@MasterJH5574 MasterJH5574 left a comment

Choose a reason for hiding this comment

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

LGTM!

@masahi
Copy link
Collaborator

masahi commented Oct 22, 2021

Hi @yzh119 @MasterJH5574, I merged a PR apache/tvm#9184 that implements binary search in TIR using while loop. Specifically, this function https://github.com/masahi/tvm/blob/431db6b3f450e6ff61056e632d2413903d7411e0/python/tvm/topi/searchsorted.py#L25 generates binary search IR that is used by both CPU and GPU backends. Probably we don't have to implement the intrinsic specifically for CUDA.

I hope TIR while loop is generally useful for sparse-related projects.

@yzh119
Copy link
Collaborator Author

yzh119 commented Oct 23, 2021

@masahi thank you! Yes I noticed that file before, but it's inside topi folder.
How about I refactor the code and make it an intrinsic in TIR in apache/tvm? I'll invite you to review the PR.

@masahi
Copy link
Collaborator

masahi commented Oct 23, 2021

How about I refactor the code and make it an intrinsic in TIR in apache/tvm?

Yes! That sounds great. I added binary_search IR solely for implementing searchsorted, but if it can be reused for other purpose, I'd be very happy.

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.

3 participants