Skip to content

Commit 0635ff3

Browse files
Merge pull request #2049 from CliMA/ck/dss_less_internals
Use less DataLayouts internals in DSS
2 parents 78894fc + 372aea2 commit 0635ff3

File tree

3 files changed

+139
-89
lines changed

3 files changed

+139
-89
lines changed

ext/cuda/data_layouts_threadblock.jl

+14
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,20 @@ end
170170
##### Custom partitions
171171
#####
172172

173+
##### linear partition
174+
@inline function linear_partition(nitems::Integer, n_max_threads::Integer)
175+
threads = min(nitems, n_max_threads)
176+
blocks = cld(nitems, threads)
177+
return (; threads, blocks)
178+
end
179+
@inline function linear_universal_index(us::UniversalSize)
180+
inds = DataLayouts.universal_size(us)
181+
CI = CartesianIndices(map(x -> Base.OneTo(x), inds))
182+
return CI
183+
end
184+
@inline linear_is_valid_index(i::Integer, us::UniversalSize) =
185+
1 i DataLayouts.get_N(us)
186+
173187
##### Column-wise
174188
@inline function columnwise_partition(
175189
us::DataLayouts.UniversalSize,

0 commit comments

Comments
 (0)