Skip to content

Commit b26e59a

Browse files
committed
Fix for GPUs
1 parent f985875 commit b26e59a

File tree

1 file changed

+16
-1
lines changed
  • src/blocksparsearrayinterface

1 file changed

+16
-1
lines changed

src/blocksparsearrayinterface/map.jl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,22 @@ function map_blockwise!(f, a_dest::AbstractArray, a_srcs::AbstractArray...)
1111
BlockRange(a_dest)
1212
end
1313
for I in Is
14-
map!(f, view(a_dest, I), map(Base.Fix2(view, I), a_srcs)...)
14+
# TODO: Use:
15+
# block_dest = @view a_dest[I]
16+
# or:
17+
# block_dest = @view! a_dest[I]
18+
block_dest = blocks_maybe_single(a_dest)[Int.(Tuple(I))...]
19+
# TODO: Use:
20+
# block_srcs = map(a_src -> @view(a_src[I]), a_srcs)
21+
block_srcs = map(a_srcs) do a_src
22+
return blocks_maybe_single(a_src)[Int.(Tuple(I))...]
23+
end
24+
# TODO: Use `map!!` to handle immutable blocks.
25+
map!(f, block_dest, block_srcs...)
26+
# Replace the entire block, handles initializing new blocks
27+
# or if blocks are immutable.
28+
# TODO: Use `a_dest[I] = block_dest`.
29+
blocks(a_dest)[Int.(Tuple(I))...] = block_dest
1530
end
1631
return a_dest
1732
end

0 commit comments

Comments
 (0)