Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
nn.Linear with BSR inputs: spare the user from explicit Triton kernel registrations #98403
nn.Linear with BSR inputs: spare the user from explicit Triton kernel registrations #98403
Changes from 16 commits
51146ac
7daa9a9
cc85de7
a24e2a7
9b755ca
96e60fa
8d42793
ff1a274
613f509
f9a17aa
6c328e8
2c07540
8b51bc6
b81cf98
7ab8829
c066f2e
fec4a83
d111c12
7a33b0e
08f7a6a
6f9af1d
cec539a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be removed now that it is done during cuda init?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is needed for the tests below:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we should move this to another file, maybe
torch.backends.triton
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikitaved - Can you address this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we should move all of this to triton specific code.
It makes sense to me to have this file check the triton backends file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this has nothing to do with Triton, i.e. it should be called something like
IsCallableInvokedWrapper
, because it can be attached to any callable to inspect whether or not it was called by anyone.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have a generic util file we can put that there for sure. If we only use it within these triton bindings, it's fine to put it there for now I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@albanD @malfet - How should @nikitaved best address this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you plan to remove it in the final version of PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to? Otherwise how could I test that the dispatch in
nn.Linear
actually worked? Unfortunately,Library
does not provide any query interface...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But otherwise, this introduces overhead in the actual usecases of the the kernel, outside of test, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but my opinion on that:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, please help me understand the logic here: we would only register the kernel if somebody imported trition previously, which would not be the case for any of the eager workflows, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the registration takes place if triton is importable.
And then
triton
will be imported upon the need.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For context, this is basically what
import triton
does on the first time:find_spec
searches for the module, thenexec_module
is where the module's initialization code is actually run . So this checks that a module named "triton" exists, but doesn't run any code or guarantee that it will import successfully.