Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ steps:
- JuliaCI/julia#v1:
version: "{{matrix.julia}}"
- JuliaCI/julia-test#v1: ~
- JuliaCI/julia-coverage#v1: ~
- JuliaCI/julia-coverage#v1:
coverage: "{{matrix.coverage}}"
agents:
queue: "juliagpu"
cuda: "*"
Expand All @@ -31,12 +32,16 @@ steps:
- "1.6"
- "1.7"
- "1.8"
- "1.9"
# - "nightly"
# adjustments:
# - with:
# julia: "nightly"
# soft_fail: true
coverage:
- "false"
adjustments:
- with:
julia: "1.9"
coverage: true
# - with:
# julia: "nightly"
# coverage: "false"
# soft_fail: true

- group: ":racehorse: Benchmarks"
steps:
Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Octavian = "6fd5a793-0b7e-452c-907f-f8bfe9c57db4"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
XUnit = "3e3c03f2-1a94-11e9-2981-050a4ca824ab"
35 changes: 27 additions & 8 deletions test/matmul.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
using CUDA
using ForwardDiff
using GemmKernels
using LinearAlgebra
import Octavian, LinearAlgebra

# for large, non-BLAS-compatible matrices, use Octavian.
matmul!(C, A, B, alpha=true, beta=false) = LinearAlgebra.mul!(C, A, B, alpha, beta)
function matmul!(C::Array,
A::Union{Array, LinearAlgebra.Transpose{<:Any, <:Array},
LinearAlgebra.Adjoint{<:Any, <:Array}},
B::Union{Array, LinearAlgebra.Transpose{<:Any, <:Array},
LinearAlgebra.Adjoint{<:Any, <:Array}},
alpha::Bool=true, beta::Bool=false)
supported = eltype(C) <: LinearAlgebra.BlasFloat &&
eltype(A) <: LinearAlgebra.BlasFloat &&
eltype(B) <: LinearAlgebra.BlasFloat &&
eltype(C) == eltype(A) == eltype(B)
if !supported && (sizeof(C) > 2^20 || sizeof(A) > 2^20 || sizeof(B) > 2^20)
Octavian.matmul!(C, A, B, alpha, beta)
else
LinearAlgebra.mul!(C, A, B, alpha, beta)
end
end

################################################################################

Expand Down Expand Up @@ -63,7 +82,7 @@ using LinearAlgebra
new_a_h = transpose_a ? transpose(a_h) : a_h
new_b_h = transpose_b ? transpose(b_h) : b_h

mul!(c_h, new_a_h, new_b_h, alpha, beta)
matmul!(c_h, new_a_h, new_b_h, alpha, beta)
if A_type <: Integer
@test c_h ≈ Array(d)
else
Expand Down Expand Up @@ -121,7 +140,7 @@ using LinearAlgebra
new_a_h = transpose_a ? transpose(a_h) : a_h
new_b_h = transpose_b ? transpose(b_h) : b_h

mul!(c_h, new_a_h, new_b_h, alpha, beta)
matmul!(c_h, new_a_h, new_b_h, alpha, beta)
@test c_h ≈ Array(d) rtol=sqrt(eps(A_type))
end
end
Expand Down Expand Up @@ -222,7 +241,7 @@ using LinearAlgebra
new_a_h = transpose_a ? transpose(a_h) : a_h
new_b_h = transpose_b ? transpose(b_h) : b_h

mul!(c_h, new_a_h, new_b_h, alpha, beta)
matmul!(c_h, new_a_h, new_b_h, alpha, beta)
@test c_h ≈ Array(d) rtol=sqrt(eps(AB_type))
end
end
Expand Down Expand Up @@ -274,7 +293,7 @@ using LinearAlgebra
new_a_h = transpose_a ? transpose(a_h) : a_h
new_b_h = transpose_b ? transpose(b_h) : b_h

mul!(c_h, new_a_h, new_b_h, true, true)
matmul!(c_h, new_a_h, new_b_h, true, true)
@test c_h .+ Array(bias) ≈ Array(d) rtol=sqrt(eps(Float16))
end
end
Expand Down Expand Up @@ -319,7 +338,7 @@ using LinearAlgebra
new_a_h = transpose_a ? transpose(a_h) : a_h
new_b_h = transpose_b ? transpose(b_h) : b_h

mul!(c_h, Diagonal(new_a_h), new_b_h, true, true)
matmul!(c_h, Diagonal(new_a_h), new_b_h, true, true)
@test c_h ≈ Array(d) rtol=sqrt(eps(Float16))
end
end
Expand Down Expand Up @@ -383,7 +402,7 @@ using LinearAlgebra
new_a_h = transpose_a ? transpose(new_a_h) : new_a_h
new_b_h = transpose_b ? transpose(new_b_h) : new_b_h

mul!(c_h, new_a_h, new_b_h, true, true)
matmul!(c_h, new_a_h, new_b_h, true, true)
@test c_h ≈ Array(d) rtol=sqrt(eps(Float16))
end
end
Expand Down Expand Up @@ -436,7 +455,7 @@ using LinearAlgebra
c_dual = reinterpret(ForwardDiff.Dual{Float32,Float32,1}, c_h)
d_dual = reinterpret(ForwardDiff.Dual{Float32,Float32,1}, Array(d))

mul!(c_dual, a_dual, b_dual, true, true)
matmul!(c_dual, a_dual, b_dual, true, true)
@test c_dual ≈ d_dual rtol=sqrt(eps(Float16))
end
end
Expand Down