Skip to content

Commit

Permalink
Fix the launch heuristic. (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt authored Jul 10, 2022
1 parent ef72706 commit ca5cb76
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/gpuarrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ struct mtlKernelContext <: AbstractKernelContext end
kernel = @metal launch=false f(mtlKernelContext(), args...)

# The pipeline state automatically computes occupancy stats
threads_needed = cld(elements, elements_per_thread)

# Limit the threadgroup size
threads = min(threads_needed, kernel.pipeline_state.maxTotalThreadsPerThreadgroup)
blocks = cld(threads_needed, threads)
threads = min(elements, kernel.pipeline_state.maxTotalThreadsPerThreadgroup)
blocks = cld(elements, threads)

return (; threads, blocks)
end
Expand Down

0 comments on commit ca5cb76

Please sign in to comment.