Skip to content

Commit 5f97bfb

Browse files
authored
Merge pull request #331 from JuliaGPU/tb/int128
Don't rely on Int128
2 parents 60294ff + 03c040d commit 5f97bfb

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

src/host/linalg.jl

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,11 @@ function generic_matmatmul!(C::AnyGPUArray{R}, A::AnyGPUArray{T}, B::AnyGPUArray
110110
return fill!(C, zero(R))
111111
end
112112

113-
# reshape vectors to matrices
114-
A′ = reshape(A, (size(A,1), size(A,2)))
115-
B′ = reshape(B, (size(B,1), size(B,2)))
116-
C′= reshape(C, (size(C,1), size(C,2)))
117-
118-
gpu_call(C′, A′, B′; name="matmatmul!") do ctx, C, A, B
113+
gpu_call(C, A, B; name="matmatmul!") do ctx, C, A, B
119114
idx = @linearidx C
120-
i, j = Tuple(CartesianIndices(C)[idx])
115+
i, j = @inbounds Tuple(CartesianIndices(C)[idx])..., 1
121116

122-
if i <= size(A,1) && j <= size(B,2)
117+
@inbounds if i <= size(A,1) && j <= size(B,2)
123118
z2 = zero(A[i, 1]*B[1, j] + A[i, 1]*B[1, j])
124119
Ctmp = convert(promote_type(R, typeof(z2)), z2)
125120
for k in 1:size(A,2)

test/testsuite/mapreduce.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,21 @@ end
7070
@test compare(A->maximum(A; dims=dims), AT, rand(range, sz))
7171
end
7272
end
73-
OT = isbitstype(widen(ET)) ? widen(ET) : ET
7473
for (sz,red) in [(10,)=>(1,), (10,10)=>(1,1), (10,10,10)=>(1,1,1), (10,10,10)=>(10,10,10),
7574
(10,10,10)=>(1,10,10), (10,10,10)=>(10,1,10), (10,10,10)=>(10,10,1)]
7675
if !(ET <: Complex)
7776
@test compare((A,R)->minimum!(R, A), AT, rand(range, sz), fill(typemax(ET), red))
7877
@test compare((A,R)->maximum!(R, A), AT, rand(range, sz), fill(typemin(ET), red))
7978
end
8079
end
81-
# smaller-scale test to avoid very large values and roundoff issues
82-
for (sz,red) in [(2,)=>(1,), (2,2)=>(1,1), (2,2,2)=>(1,1,1), (2,2,2)=>(2,2,2),
83-
(2,2,2)=>(1,2,2), (2,2,2)=>(2,1,2), (2,2,2)=>(2,2,1)]
84-
@test compare((A,R)->sum!(R, A), AT, rand(range, sz), rand(OT, red))
85-
@test compare((A,R)->prod!(R, A), AT, rand(range, sz), rand(OT, red))
80+
OT = isbitstype(widen(ET)) ? widen(ET) : ET
81+
if OT in supported_eltypes()
82+
# smaller-scale test to avoid very large values and roundoff issues
83+
for (sz,red) in [(2,)=>(1,), (2,2)=>(1,1), (2,2,2)=>(1,1,1), (2,2,2)=>(2,2,2),
84+
(2,2,2)=>(1,2,2), (2,2,2)=>(2,1,2), (2,2,2)=>(2,2,1)]
85+
@test compare((A,R)->sum!(R, A), AT, rand(range, sz), rand(OT, red))
86+
@test compare((A,R)->prod!(R, A), AT, rand(range, sz), rand(OT, red))
87+
end
8688
end
8789
end
8890

0 commit comments

Comments
 (0)