Skip to content

don't return reshaped array from mapreducedim! - #1004

Merged
luraess merged 1 commit into
JuliaGPU:mainfrom
simeonschaub:sds/no_reshape
Jul 29, 2026
Merged

don't return reshaped array from mapreducedim!#1004
luraess merged 1 commit into
JuliaGPU:mainfrom
simeonschaub:sds/no_reshape

Conversation

@simeonschaub

Copy link
Copy Markdown
Member

`mapreducedim!` reshapes the output container to match the number of
dimensions of the input, but then returned that reshaped array instead of
the one it was handed. Keep a reference to the original and return that.

Same as JuliaGPU/CUDA.jl#3219, discovered in
JuliaGPU/GPUArrays.jl#754.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AMDGPU.jl Benchmarks

Details
Benchmark suite Current: 74626e8 Previous: f39609f Ratio
amdgpu/synchronization/context/device 572.5 ns 577.5 ns 0.99
amdgpu/synchronization/stream/blocking 237.5 ns 242.5 ns 0.98
amdgpu/synchronization/stream/nonblocking 327.5 ns 327.5 ns 1
array/accumulate/Float32/1d 71748.5 ns 72208.5 ns 0.99
array/accumulate/Float32/dims=1 251706.25 ns 273376.5 ns 0.92
array/accumulate/Float32/dims=1L 77708.75 ns 79091 ns 0.98
array/accumulate/Float32/dims=2 71488.5 ns 73971.25 ns 0.97
array/accumulate/Float32/dims=2L 2621822.75 ns 2625672 ns 1.00
array/accumulate/Int64/1d 75803.5 ns 78243.75 ns 0.97
array/accumulate/Int64/dims=1 245016.25 ns 245298.5 ns 1.00
array/accumulate/Int64/dims=1L 83688.75 ns 83871 ns 1.00
array/accumulate/Int64/dims=2 81073.5 ns 80931.25 ns 1.00
array/accumulate/Int64/dims=2L 2866528.75 ns 2865473 ns 1.00
array/broadcast 73581.25 ns 73611 ns 1.00
array/construct 2202.5 ns 2300.25 ns 0.96
array/copy 36890.75 ns 35548 ns 1.04
array/copyto!/cpu_to_gpu 112201.75 ns 112059 ns 1.00
array/copyto!/gpu_to_cpu 105589 ns 104761.5 ns 1.01
array/copyto!/gpu_to_gpu 35578 ns 49765.75 ns 0.71
array/iteration/findall/bool 136204.25 ns 141354.5 ns 0.96
array/iteration/findall/int 149397 ns 156922.25 ns 0.95
array/iteration/findfirst/bool 120581.5 ns 124271.75 ns 0.97
array/iteration/findfirst/int 123874.25 ns 124834.25 ns 0.99
array/iteration/findmin/1d 109854.25 ns 114066.75 ns 0.96
array/iteration/findmin/2d 96911.5 ns 108581.5 ns 0.89
array/iteration/logical 246273.75 ns 256408.5 ns 0.96
array/iteration/scalar 295689.25 ns 296556.5 ns 1.00
array/permutedims/2d 71793.5 ns 71528.5 ns 1.00
array/permutedims/3d 70966 ns 71013.5 ns 1.00
array/permutedims/4d 74128.75 ns 74041 ns 1.00
array/random/rand/Float32 45115.5 ns 45140.5 ns 1.00
array/random/rand/Int64 54613.25 ns 55005.75 ns 0.99
array/random/rand!/Float32 65173.5 ns 65316 ns 1.00
array/random/rand!/Int64 70856 ns 73568.5 ns 0.96
array/random/randn/Float32 76241 ns 77641.25 ns 0.98
array/random/randn!/Float32 81081.25 ns 75446.25 ns 1.07
array/reductions/mapreduce/Float32/1d 95931.5 ns 88421.25 ns 1.08
array/reductions/mapreduce/Float32/dims=1 84986.25 ns 84406.25 ns 1.01
array/reductions/mapreduce/Float32/dims=1L 782346.25 ns 782181 ns 1.00
array/reductions/mapreduce/Float32/dims=2 84338.75 ns 83961.25 ns 1.00
array/reductions/mapreduce/Float32/dims=2L 143072 ns 142397 ns 1.00
array/reductions/mapreduce/Int64/1d 96124 ns 88046.25 ns 1.09
array/reductions/mapreduce/Int64/dims=1 84561.25 ns 84006 ns 1.01
array/reductions/mapreduce/Int64/dims=1L 787096.25 ns 791836.25 ns 0.99
array/reductions/mapreduce/Int64/dims=2 83973.75 ns 84366 ns 1.00
array/reductions/mapreduce/Int64/dims=2L 143324.5 ns 143969.5 ns 1.00
array/reductions/reduce/Float32/1d 88228.75 ns 88223.75 ns 1.00
array/reductions/reduce/Float32/dims=1 84628.75 ns 83906.25 ns 1.01
array/reductions/reduce/Float32/dims=1L 782741.25 ns 786496.25 ns 1.00
array/reductions/reduce/Float32/dims=2 84058.75 ns 84028.75 ns 1.00
array/reductions/reduce/Float32/dims=2L 142632 ns 142229.5 ns 1.00
array/reductions/reduce/Int64/1d 88468.75 ns 88981.25 ns 0.99
array/reductions/reduce/Int64/dims=1 83926.25 ns 84336.25 ns 1.00
array/reductions/reduce/Int64/dims=1L 790876.5 ns 789723.75 ns 1.00
array/reductions/reduce/Int64/dims=2 83943.75 ns 84358.75 ns 1.00
array/reductions/reduce/Int64/dims=2L 143332 ns 143122 ns 1.00
array/reverse/1d 43338 ns 43295.5 ns 1.00
array/reverse/1dL 71173.5 ns 71186 ns 1.00
array/reverse/1dL_inplace 78806.25 ns 70888.5 ns 1.11
array/reverse/1d_inplace 59848.5 ns 59876 ns 1.00
array/reverse/2d 49208.25 ns 48905.75 ns 1.01
array/reverse/2dL 79771.25 ns 79303.5 ns 1.01
array/reverse/2dL_inplace 91249 ns 91751.25 ns 0.99
array/reverse/2d_inplace 62396 ns 62295.75 ns 1.00
array/sorting/1d 337515 ns 341022.25 ns 0.99
integration/byval/reference 39410 ns 39651 ns 0.99
integration/byval/slices=1 40501 ns 40960 ns 0.99
integration/byval/slices=2 140342 ns 152982 ns 0.92
integration/byval/slices=3 236574 ns 247524 ns 0.96
integration/volumerhs 5051703 ns 5045271 ns 1.00
kernel/indexing 57478.5 ns 47473.25 ns 1.21
kernel/indexing_checked 58885.75 ns 58823.25 ns 1.00
kernel/launch 1552.5 ns 1552.5 ns 1
kernel/rand 98108.75 ns 98511.5 ns 1.00
latency/import 1720869481 ns 1720954000 ns 1.00
latency/precompile 37413313176 ns 37438172352 ns 1.00
latency/ttfp 5739159769 ns 5748382815 ns 1.00

This comment was automatically generated by workflow using github-action-benchmark.

@luraess
luraess merged commit 724d15f into JuliaGPU:main Jul 29, 2026
4 checks passed
@luraess

luraess commented Jul 29, 2026

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants