Skip to content

Commit 03c040d

Browse files
committed
Don't reshape in generic_mul to avoid mul_wide::Int128.
1 parent 78afd1a commit 03c040d

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
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)

0 commit comments

Comments
 (0)