-
Notifications
You must be signed in to change notification settings - Fork 70
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
KernelIntrinsics #562
base: vc/pocl
Are you sure you want to change the base?
KernelIntrinsics #562
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
module KernelIntrinsics | ||
|
||
""" | ||
get_global_size()::@NamedTuple{x::Int32, y::Int32, z::Int32} | ||
Return the number of global work-items specified. | ||
!!! note | ||
1-based. | ||
""" | ||
function get_global_size end | ||
|
||
""" | ||
get_global_id()::@NamedTuple{x::Int32, y::Int32, z::Int32} | ||
Returns the unique global work-item ID. | ||
""" | ||
function get_global_id end | ||
|
||
""" | ||
get_local_size()::@NamedTuple{x::Int32, y::Int32, z::Int32} | ||
Return the number of local work-items specified. | ||
""" | ||
function get_local_size end | ||
|
||
""" | ||
get_local_id()::@NamedTuple{x::Int32, y::Int32, z::Int32} | ||
Returns the unique local work-item ID. | ||
""" | ||
function get_local_id end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So IIUC, backends should implement these like below, right? function get_local_id()
return (threadIdx().x, threadIdx().y, threadIdx().z)
end There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah basically, and my goal is to replace the old internal functions the people had to override with definitions based on these functions. |
||
|
||
""" | ||
get_num_groups()::@NamedTuple{x::Int32, y::Int32, z::Int32} | ||
Returns the number of groups. | ||
""" | ||
function get_num_groups end | ||
|
||
""" | ||
get_group_id()::@NamedTuple{x::Int32, y::Int32, z::Int32} | ||
Returns the unique group ID. | ||
""" | ||
function get_group_id end | ||
|
||
function localmemory end | ||
function barrier end | ||
function print end | ||
|
||
end |
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.
Should this be Int32 or Int64?
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.
OpenCL defines these as
Csize_t
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 there any way to allow the platform to define the specific
<:Integer
index type? Metal uses uint3 by default, which are three UInt32 values. I liked that CUDA Thrust allowed the indices to be templated, so I could use Int64 only when dealing with billions of datapoints.