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

[CUDNN] Add cuDNN as a Relay partitioning target (BYOC) #10871

Merged
merged 3 commits into from
Apr 8, 2022

Conversation

mbaret
Copy link
Contributor

@mbaret mbaret commented Apr 1, 2022

This adds infrastructure to support offloading of Relay patterns to cuDNN. In this initial commit, only softmax is supported. Later PRs will include support for more operators, including some limited fused patterns.

@mbaret
Copy link
Contributor Author

mbaret commented Apr 1, 2022

cc @mikepapadim @mbs-octoml

Copy link
Contributor

@mbs-octoml mbs-octoml left a comment

Choose a reason for hiding this comment

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

LGTM modulo two nits.

assert isinstance(partition.body.op, relay.Function)

global_name = str(partition.attrs.global_symbol)
target = tvm.target.cuda()
Copy link
Contributor

Choose a reason for hiding this comment

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

Just notice this, I think Target.current() is better so that cuda params are not lost.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had a go using this based on your suggestion, but it seems the Target only ends up in the context if you use the 'with' way of specifying targets (not just directly passing them to relay.build). In an ideal world, this somehow gets plumbed directly through the BYOC/partitioning mechanism - but I think that exceeds the immediate scope of this PR. Perhaps we could leave as a future improvement for now?

return _register


@tvm._ffi.register_func("relay.ext.cudnn")
Copy link
Contributor

Choose a reason for hiding this comment

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

Now would be a good time to hoist this boilerplate into a library_byoc.py helper or something similar?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done - let me know what you think.

Copy link
Contributor

@mikepapadim mikepapadim 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 trigger again CI. It looks like a random fail

@mbaret mbaret force-pushed the cudnn-relay branch 2 times, most recently from 5c2e300 to 0e06391 Compare April 6, 2022 11:54
@mikepapadim
Copy link
Contributor

it looks like some flaky test in aarch64

This adds infrastructure to support offloading of Relay
patterns to cuDNN. In this initial commit, only softmax
is supported.
@mbaret
Copy link
Contributor Author

mbaret commented Apr 8, 2022

cc @masahi @mbrookhart @junrushao1994 PTAL and merge if you're happy :)

Copy link
Member

@junrushao junrushao left a comment

Choose a reason for hiding this comment

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

SGTM!

@masahi masahi merged commit 81d72e3 into apache:main Apr 8, 2022
mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request Apr 11, 2022
* [CUDNN] Add cuDNN as a Relay partitioning target (BYOC)

This adds infrastructure to support offloading of Relay
patterns to cuDNN. In this initial commit, only softmax
is supported.

* Refactor common TE BYOC code into separate file

* Add test guard
Lucien0 pushed a commit to Lucien0/tvm that referenced this pull request Apr 19, 2022
* [CUDNN] Add cuDNN as a Relay partitioning target (BYOC)

This adds infrastructure to support offloading of Relay
patterns to cuDNN. In this initial commit, only softmax
is supported.

* Refactor common TE BYOC code into separate file

* Add test guard
altanh pushed a commit to altanh/tvm that referenced this pull request Apr 28, 2022
* [CUDNN] Add cuDNN as a Relay partitioning target (BYOC)

This adds infrastructure to support offloading of Relay
patterns to cuDNN. In this initial commit, only softmax
is supported.

* Refactor common TE BYOC code into separate file

* Add test guard
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.

5 participants