Skip to content

Commit 5b94c4f

Browse files
committed
LowPrecArray tests
1 parent 1db9477 commit 5b94c4f

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/lowprecarrays.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import LinearAlgebra: generic_matmatmul!
3737
function generic_matmatmul!(C::AbstractMatrix{Float32}, ta, tb,
3838
A::Union{LowPrecArray, AbstractMatrix{BFloat16}},
3939
B::Union{LowPrecArray, AbstractMatrix{BFloat16}})
40+
@info "hello"
4041
generic_matmatmul!(C, ta, tb,
4142
MatMulView(A), MatMulView(B))
4243
end
@@ -46,5 +47,6 @@ end
4647
function LinearAlgebra.BLAS.gemv!(trans::AbstractChar, alpha::Float32,
4748
A::AbstractVecOrMat{Float32}, X::AbstractVector{Float32},
4849
beta::Float32, Y::LowPrecArray)
50+
@info "hello"
4951
LinearAlgebra.BLAS.gemv!(trans, alpha, A, X, beta, Y.storage)
5052
end

test/lowprecarrays.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@testset "lowprecarrays" begin
2+
A = rand(Float32, 10,10)
3+
lpA = LowPrecArray(A)
4+
5+
@test lpA isa LowPrecArray
6+
@test size(A) == size(lpA)
7+
8+
lpA[3] = 4
9+
@test lpA[3] == A[3]
10+
11+
a = BFloat16s.ExpandingBFloat16(1f0)
12+
b = BFloat16s.ExpandingBFloat16(1f0)
13+
14+
@test a isa BFloat16s.ExpandingBFloat16
15+
@test a.a isa BFloat16
16+
17+
B = LowPrecArray(rand(Float32, 10,10))
18+
C = LowPrecArray(rand(Float32, 10,10))
19+
20+
lpA .= B*C
21+
22+
end # @testset "lowprecarrays"

0 commit comments

Comments
 (0)