Skip to content

Commit

Permalink
bump minor version, support new StridedViews
Browse files Browse the repository at this point in the history
  • Loading branch information
Jutho committed Jun 16, 2024
1 parent 9fc7903 commit b5bc609
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name = "Strided"
uuid = "5e0ebb24-38b0-5f93-81fe-25c709ecae67"
authors = ["Lukas Devos <[email protected]>", "Maarten Van Damme <[email protected]>", "Jutho Haegeman <[email protected]>"]
version = "2.0.4"
version = "2.1.0"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
StridedViews = "4db3bf67-4bd7-4b4e-b153-31dc3fb37143"
TupleTools = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6"

[compat]
StridedViews = "0.1,0.2"
StridedViews = "0.1,0.2,0.3"
TupleTools = "1.1"
julia = "1.6"
14 changes: 7 additions & 7 deletions src/mapreduce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ end
return _mapreducedim!(f, op, nothing, dims, (b, a1, A...))
end

function _mapreducedim!(@nospecialize(f), @nospecialize(op), @nospecialize(initop),
function _mapreducedim!((f), (op), (initop),
dims::Dims, arrays::Tuple{Vararg{StridedView}})
if any(isequal(0), dims)
if length(arrays[1]) != 0 && !isnothing(initop)
Expand All @@ -95,7 +95,7 @@ function _mapreducedim!(@nospecialize(f), @nospecialize(op), @nospecialize(inito
return arrays[1]
end

function _mapreduce_fuse!(@nospecialize(f), @nospecialize(op), @nospecialize(initop),
function _mapreduce_fuse!((f), (op), (initop),
dims::Dims, arrays::Tuple{Vararg{StridedView}})
# Fuse dimensions if possible: assume that at least one array, e.g. the output array in
# arrays[1], has its strides sorted
Expand All @@ -116,7 +116,7 @@ function _mapreduce_fuse!(@nospecialize(f), @nospecialize(op), @nospecialize(ini
return _mapreduce_order!(f, op, initop, dims, allstrides, arrays)
end

function _mapreduce_order!(@nospecialize(f), @nospecialize(op), @nospecialize(initop),
function _mapreduce_order!((f), (op), (initop),
dims, strides, arrays)
M = length(arrays)
N = length(dims)
Expand All @@ -139,7 +139,7 @@ function _mapreduce_order!(@nospecialize(f), @nospecialize(op), @nospecialize(in
end

const MINTHREADLENGTH = 1 << 15 # minimal length before any kind of threading is applied
function _mapreduce_block!(@nospecialize(f), @nospecialize(op), @nospecialize(initop),
function _mapreduce_block!((f), (op), (initop),
dims, strides, offsets, costs, arrays)
bytestrides = map((s, stride) -> s .* stride, sizeof.(eltype.(arrays)), strides)
strideorders = map(indexorder, strides)
Expand Down Expand Up @@ -192,7 +192,7 @@ end

# nthreads: number of threads spacing: extra addition to offset of array 1, to account for
# reduction
function _mapreduce_threaded!(@nospecialize(f), @nospecialize(op), @nospecialize(initop),
function _mapreduce_threaded!((f), (op), (initop),
dims, blocks, strides, offsets, costs, arrays, nthreads,
spacing, taskindex)
if nthreads == 1 || prod(dims) <= MINTHREADLENGTH
Expand Down Expand Up @@ -226,8 +226,8 @@ function _mapreduce_threaded!(@nospecialize(f), @nospecialize(op), @nospecialize
return nothing
end

@generated function _mapreduce_kernel!(@nospecialize(f), @nospecialize(op),
@nospecialize(initop), dims::NTuple{N,Int},
@generated function _mapreduce_kernel!((f), (op),
(initop), dims::NTuple{N,Int},
blocks::NTuple{N,Int},
arrays::NTuple{M,StridedView},
strides::NTuple{M,NTuple{N,Int}},
Expand Down

0 comments on commit b5bc609

Please sign in to comment.