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

[SPIR-V] Fix pushconstants offset calculation for 32 bit values #7620

Merged
merged 6 commits into from
Mar 10, 2021

Conversation

masahi
Copy link
Member

@masahi masahi commented Mar 9, 2021

I found a cool bug from #7572: It only works when pushconstants are one or more 64 bit values. #7572 didn't change the codegen but load offset needs to be adjusted for 32 bit values (since all pushconstants occupy 64 bit after #7572). In particular, dynamic shape workload requires passing the shape size as 32 bit pushconstants, so currently VK/SPIR-V backend is completely broken for dynamic shape.

I updated load offset calculation and now dynamic shape started working with VK/SPIR-V. Dynamic shape sort, which involves mixed 32 and 64 bit pushconstants, is also working using a patch from #7607. But one test I added, dynamic cumsum, is still not working for some reason.

cc @tqchen @vinx13 I'm not sure if Metal backend has this problem.

@masahi masahi marked this pull request as draft March 9, 2021 12:36
@masahi masahi changed the title [SPIR-V] Fix pushconstants offset calculation for 32 bit and mixed 32 / 64 bit constants [SPIR-V] Fix pushconstants offset calculation for 32 bit values Mar 9, 2021
@masahi masahi force-pushed the fix-vk-pushconstants-offset branch from 98d618b to d7f983c Compare March 9, 2021 19:19
@masahi masahi marked this pull request as ready for review March 9, 2021 19:35
@masahi
Copy link
Member Author

masahi commented Mar 9, 2021

Replaced dynamic cumsum test with dynamic argsort, since our GPU cumsum seems to have issues with dynamic input in general (doesn't work on rocm either). The dynamic argsort also exercises mixed 64 and 32 bit pushconstants.

@masahi masahi force-pushed the fix-vk-pushconstants-offset branch from c3b8c96 to 4b1d615 Compare March 9, 2021 21:36
@masahi masahi force-pushed the fix-vk-pushconstants-offset branch from 4b1d615 to 815255c Compare March 10, 2021 01:50
@masahi masahi merged commit 3a0e3a5 into apache:main Mar 10, 2021
@masahi
Copy link
Member Author

masahi commented Mar 10, 2021

Thanks @tqchen

trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
…he#7620)

* Fix push constant offset for 32 bit value

* add test

* remove unused function from test

* add dynamic cumsum test

* skip if vulkan is not enabled

* replace dynamic cumsum test with dynamic argsort for now

Co-authored-by: Masahiro Masuda <masahi@[email protected]>
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request May 11, 2021
…he#7620)

* Fix push constant offset for 32 bit value

* add test

* remove unused function from test

* add dynamic cumsum test

* skip if vulkan is not enabled

* replace dynamic cumsum test with dynamic argsort for now

Co-authored-by: Masahiro Masuda <masahi@[email protected]>
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