-
Notifications
You must be signed in to change notification settings - Fork 13.7k
[mlir] Prepare convert-gpu-to-spirv for OpenCL support #69941
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7ca3f97
[MLIR] Update convert-gpu-to-spirv pass to prepare using GPU compilat…
silee2 02ff96c
Address reviewer comments.
silee2 561af5d
Run clang formatter.
silee2 6417cb7
Address reviewers suggestions.
silee2 d73edae
Merge branch 'main' into opencl_memspace
silee2 57c0d76
Check for spirv::MemoryModel only if mapping MemRef memory space to S…
silee2 4241a60
Remove redundant namespace resolution.
silee2 7f0efa4
Another reviewer suggestion.
silee2 dfb3fcb
Merge branch 'main' into opencl_memspace
silee2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
Is this gpu.func->func.func necessary? Can you just keep the original gpu.func instead?
Uh oh!
There was an error while loading. Please reload this page.
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.
Keeping the original gpu.func causes legality check error later in the gpu compile pipeline.
If target attr is set for a gpu.module, gpu-to-llvm pass doesn't lower gpu.launch_func
Instead, it is replaced with another gpu.launch_func that has lowered argument types (llvm ptrs).
If a gpu.func remains as an input to gpu-to-llvm pass, there is an argument mismatch between the new gpu.launch_func and the gpu.func. And an error is fired.
The reason for putting a dummy func.func here is to work around that check.
For func types other than gpu.func, argument types are not checked against gpu.launch_func. A func.func is still need as there will be a symbol check.
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.
I think the problem is, the lack of spirv support in gpu dialect. For example, gpu.func needs to be able to wrap spirv.func so gpu-to-llvm pass (for the host code) can properly handle the relation between gpu.launch_func and spirv.func.
Basically, using dummy
func.func
looks little hacky and it'd be also nice if the divergence between Vulkan/OpenCL IR structures could be avoided. However, considering the progress of this commit, we can discuss this later for the future enhancement.Really appreciate this work and look forward to seeing it merged.