-
Notifications
You must be signed in to change notification settings - Fork 195
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
support for active_cells_map in kernels #3920
base: main
Are you sure you want to change the base?
Conversation
Probably this is very hacky, a better way to go about it would be to add a map to the |
….jl into ss/active-index-macro
src/Utils/kernel_launching.jl
Outdated
##### | ||
|
||
struct IndexMap{M} | ||
imap :: M |
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.
imap :: M | |
index_map :: M |
src/Utils/kernel_launching.jl
Outdated
|
||
struct MappedFunction{F, M} <: Function | ||
f::F | ||
imap::M |
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.
index_map?
src/Utils/kernel_launching.jl
Outdated
#### | ||
|
||
struct MappedFunction{F, M} <: Function | ||
f::F |
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.
f::F | |
func::F |
src/Utils/kernel_launching.jl
Outdated
@inline function (m::MappedFunction)(_ctx_) | ||
m.f(_ctx_) | ||
return nothing | ||
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.
isn't this case covered by the case with args...
?
param = get_kernel_parameters(loop) | ||
M = typeof(func) | ||
loop = Kernel{param..., M}(dev, func) | ||
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.
doesn't it make more sense to put this in the first if-statement in this function?
|
||
grid = RectilinearGrid(arch, size = (3, 3, 3), extent = (1, 1, 1)) | ||
array = zeros(arch, 3, 3, 3) | ||
imap = on_architecture(arch, [(i, j, k) for i in 1:3, j in 1:3, k in 1:2]) |
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.
imap = on_architecture(arch, [(i, j, k) for i in 1:3, j in 1:3, k in 1:2]) | |
imap = on_architecture(arch, [(i, j, k) for i in 1:3, j in 1:3, k in 1:3]) |
|
||
# Very dangerous override of mkcontext which will not work if we are not | ||
# carefull with making sure that indices are correct when launching a `MappedKernel` |
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.
# carefull with making sure that indices are correct when launching a `MappedKernel` | |
# careful with making sure that indices are correct when launching a `MappedKernel` |
I am not sure how hacky this is or if it will work throughout the board, but this is supposed to achieve what was discussed in #3918:
for example, the current script:
returns