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

[Runtime] Change default alignment to 64 bytes. #12586

Merged
merged 6 commits into from
Aug 25, 2022
Merged

Conversation

jwfromm
Copy link
Contributor

@jwfromm jwfromm commented Aug 24, 2022

One change made in #5252 (which added support for Hexagon to the runtime) was increasing the byte alignment from 64 to 128. This can cause problems when interacting with dlpack. For example tests/python/contrib/test_dlpack.py has a high chance of failing when run locally due to torch returning tensors with 64 rather than 128 byte alignment. I'm not sure why it doesnt fail in CI, perhaps the consistency of the environment always returns an appropriately aligned tensor.

Changing the default alignment allows interoperability with both torch and newer versions of numpy that support dlpack. I've slightly modified the torch test to run multiple times to make sure its behavior is consistent.

See previous discussion in #12564. I chatted with @vinx13 and it seems like default 64 byte alignment should be fine for CUDA, so this change wont break anything. I'm reopening this pull request (in a new pr as I did a rebase and it wont let me reopen the previous one). I think this change is still likely positive while we work out a long term target based solution.

cc @areusch

@jwfromm
Copy link
Contributor Author

jwfromm commented Aug 25, 2022

@vinx13 I think this should be ready to go. Can you give it another look over to make sure everything is in order?

@vinx13 vinx13 merged commit 8d60b3c into apache:main Aug 25, 2022
@areusch
Copy link
Contributor

areusch commented Aug 25, 2022

cc @kparzysz-quic

xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
* Change default alignment to 64 bits.

* Run dlpack test a few times.

* Update alignment in tests.

* Revert mma alignment change.

* Change default printing of buffer.

* Change crt runtime default allocation.
@jwfromm jwfromm deleted the 64_align branch April 12, 2023 15:54
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