From 87d74c9999980b6045d22c0db492efb5d87286b4 Mon Sep 17 00:00:00 2001 From: Ashley Milsted Date: Fri, 31 Mar 2023 11:13:35 -0700 Subject: [PATCH 1/2] Add (broken) tests for allocation in 5-arg mul!() See https://github.com/JuliaLang/julia/pull/47206 for a fix proposal. --- stdlib/LinearAlgebra/test/matmul.jl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/stdlib/LinearAlgebra/test/matmul.jl b/stdlib/LinearAlgebra/test/matmul.jl index 0150c4c2efdc8..9913a092e47be 100644 --- a/stdlib/LinearAlgebra/test/matmul.jl +++ b/stdlib/LinearAlgebra/test/matmul.jl @@ -978,5 +978,18 @@ end @test *(a, b, c, 99.9) ≈ (a * b) * (c * 99.9) end end + +@testset "Issue #46865: mul!() with non-const alpha, beta" begin + f!(C,A,B,alphas,betas) = mul!(C, A, B, alphas[1], betas[1]) + alphas = [1.0] + betas = [0.5] + for d in [2,3,4] # test native small-matrix cases as well as BLAS + A = rand(d,d) + B = copy(A) + C = copy(A) + f!(C, A, B, alphas, betas) + @test_broken (@allocated f!(C, A, B, alphas, betas)) == 0 + end +end end # module TestMatmul From 8073a72979e00a626cf2e7de0f1d5d8ab64c0d53 Mon Sep 17 00:00:00 2001 From: Ashley Milsted Date: Fri, 31 Mar 2023 13:01:19 -0700 Subject: [PATCH 2/2] Fix whitespace --- stdlib/LinearAlgebra/test/matmul.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/LinearAlgebra/test/matmul.jl b/stdlib/LinearAlgebra/test/matmul.jl index 9913a092e47be..ed55610396c18 100644 --- a/stdlib/LinearAlgebra/test/matmul.jl +++ b/stdlib/LinearAlgebra/test/matmul.jl @@ -978,7 +978,7 @@ end @test *(a, b, c, 99.9) ≈ (a * b) * (c * 99.9) end end - + @testset "Issue #46865: mul!() with non-const alpha, beta" begin f!(C,A,B,alphas,betas) = mul!(C, A, B, alphas[1], betas[1]) alphas = [1.0]