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

Add check for non-contiguous memory access when lowering to async dma… #13613

Merged
merged 4 commits into from
Dec 16, 2022

Conversation

nverke
Copy link
Contributor

@nverke nverke commented Dec 14, 2022

… copies.

Currently we do not support non contiguous memory copies for async dma so this adds a check to error out in the case that either load or store is non contiguous. Unfortunately if we do not throw an error in this case then we get inaccurate outputs. Added a test to verify that we are indeed throwing an error in this case that should be removed once support is added.

@adstraw @masahi

@tvm-bot
Copy link
Collaborator

tvm-bot commented Dec 14, 2022

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

  • No users to auto-tag found, no teams are specified in PR title See #10317 for details

Generated by tvm-bot

Copy link
Contributor

@adstraw adstraw left a comment

Choose a reason for hiding this comment

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

LGTM. Just one nit.

auto store_iter_map = DetectIterMap(store_index, input_iters, 1, arith::IterMapLevel::NoCheck,
&analyzer, false);
if (!store_iter_map->errors.empty()) {
LOG(FATAL) << "Unable to lower async dma for non contiguous memory access with index: "
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: You might differentiate the error message by including something text indicating that the "buffer store" contained the non contiguous access.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added!

auto load_iter_map =
DetectIterMap(load_index, input_iters, 1, arith::IterMapLevel::NoCheck, &analyzer, false);
if (!load_iter_map->errors.empty()) {
LOG(FATAL) << "Unable to lower async dma for non contiguous memory access with index: "
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Same as above. Add text indicating "buffer load" contained non contiguous access.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added!

@masahi
Copy link
Member

masahi commented Dec 15, 2022

once support is added.

What support is being planed? 2D DMA or breaking up into contiguous copies?

@nverke
Copy link
Contributor Author

nverke commented Dec 15, 2022

We are still discussing the pros and cons of the potential options but the possible solutions are.

  1. Lower the copy into n x 1D dma copies.
  2. Lower to 2D dma copies.
  3. Use tensorize to make synchronous dma copies then in the lower_async_dma pass add the necessary asynchronous pieces.

Copy link
Member

@masahi masahi left a comment

Choose a reason for hiding this comment

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

Need to fix the lint

@masahi masahi merged commit 7674ea8 into apache:main Dec 16, 2022
fzi-peccia pushed a commit to fzi-peccia/tvm that referenced this pull request Mar 27, 2023
apache#13613)

* Add check for non-contiguous memory access when lowering to async dma copies.

* lint

* lint and nits

* lint
mikeseven pushed a commit to mikeseven/tvm that referenced this pull request Sep 27, 2023
apache#13613)

* Add check for non-contiguous memory access when lowering to async dma copies.

* lint

* lint and nits

* lint
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.

4 participants