-
Notifications
You must be signed in to change notification settings - Fork 80
KernelIntrinsics API #635
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
base: main
Are you sure you want to change the base?
KernelIntrinsics API #635
Conversation
|
Your PR requires formatting changes to meet the project's style guidelines. Click here to view the suggested changes.diff --git a/src/pocl/backend.jl b/src/pocl/backend.jl
index 055e1c7d..abf0f803 100644
--- a/src/pocl/backend.jl
+++ b/src/pocl/backend.jl
@@ -149,9 +149,9 @@ end
function (obj::KI.Kernel{POCLBackend})(args...; numworkgroups = 1, workgroupsize = 1)
KI.check_launch_args(numworkgroups, workgroupsize)
- local_size = (workgroupsize..., ntuple(_->1, 3-length(workgroupsize))...,)
+ local_size = (workgroupsize..., ntuple(_ -> 1, 3 - length(workgroupsize))...)
- numworkgroups = (numworkgroups..., ntuple(_->1, 3-length(numworkgroups))...,)
+ numworkgroups = (numworkgroups..., ntuple(_ -> 1, 3 - length(numworkgroups))...)
global_size = local_size .* numworkgroups
event = obj.kern(args...; local_size, global_size) |
c16a665 to
b166baa
Compare
|
Can you rebase? |
b166baa to
928e6fd
Compare
This comment was marked as outdated.
This comment was marked as outdated.
928e6fd to
cd7476e
Compare
|
@christiangnrd do you think we need a lower-level kernel launch interface? Otherwise the three-dimensional indices would be superflous. |
cd7476e to
84d0c68
Compare
I'd been thinking about that and I think so. Would something that, assuming you wrote the whole kernel with |
Modified from initial Claude code
vchuravy
left a comment
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.
Nice! Maybe we can also add some simple shuffle operations?
src/KernelAbstractions.jl
Outdated
|
|
||
| return quote | ||
| $SharedMemory($(esc(T)), Val($(esc(dims))), Val($(QuoteNode(id)))) | ||
| $SharedMemory($(esc(T)), Val($(esc(dims)))) |
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.
This is technically an ABI break, which I had avoided so far.
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 ca11482 sufficient or do we still need to require backends to take in a third unused argument on the KI side?
|
I'm thinking we should either directly rename |
|
I am okay with providing the alias! |
|
One additional thing to consider is what intrinsics do we need to implement something like #559 Can we add some primitive shuffles? Or add a test kernel that implements a reduction correctly? |
I think this should be a follow-up PR since it'll probably generate quite a bit of discussion, but I feel like Otherwise, I believe the only things left to resolve for this PR are the module docstring, #635 (comment), and I'm not sure if we should at least start considering dynamic local memory API to make sure we don't need to release another breaking version or if you think the current api can definitely fit the addition of local memory. |
Do we really need to, given the |
I felt like we might as well include it since it'll be written so much, and I found fully qualifying I don't feel that strongly about this though so I'll defer to you for the final decision |
The goal is to allow for kernels to be written without relying on KernelAbstractions macros
See #562 for initial discussion
@vchuravy @maleadt