From 8d3c0bdfa659a1139a1055167ed58d03f2fba8de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thimot=C3=A9=20Dupuch?= <50801309+thimotedupuch@users.noreply.github.com> Date: Sun, 19 Oct 2025 22:17:51 +0200 Subject: [PATCH 1/2] Update matmul.jl More idiomatic handling of indices --- examples/matmul.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/matmul.jl b/examples/matmul.jl index aec4fb2b..9734a80b 100644 --- a/examples/matmul.jl +++ b/examples/matmul.jl @@ -7,7 +7,7 @@ include(joinpath(dirname(pathof(KernelAbstractions)), "../examples/utils.jl")) # # creating a temporary sum variable for matrix multiplication tmp_sum = zero(eltype(output)) - for k in 1:size(a)[2] + for k in axes(a,2) tmp_sum += a[i, k] * b[k, j] end @@ -16,7 +16,7 @@ end # Creating a wrapper kernel for launching with error checks function matmul!(output, a, b) - if size(a)[2] != size(b)[1] + if size(a,2) != size(b,1) println("Matrix size mismatch!") return nothing end From d2017e9f2244de4f66a52beb6d2943ba0cf155ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thimot=C3=A9=20Dupuch?= <50801309+thimotedupuch@users.noreply.github.com> Date: Sun, 19 Oct 2025 22:25:46 +0200 Subject: [PATCH 2/2] fixed formatting --- examples/matmul.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/matmul.jl b/examples/matmul.jl index 9734a80b..0f846c35 100644 --- a/examples/matmul.jl +++ b/examples/matmul.jl @@ -7,7 +7,7 @@ include(joinpath(dirname(pathof(KernelAbstractions)), "../examples/utils.jl")) # # creating a temporary sum variable for matrix multiplication tmp_sum = zero(eltype(output)) - for k in axes(a,2) + for k in axes(a, 2) tmp_sum += a[i, k] * b[k, j] end @@ -16,7 +16,7 @@ end # Creating a wrapper kernel for launching with error checks function matmul!(output, a, b) - if size(a,2) != size(b,1) + if size(a, 2) != size(b, 1) println("Matrix size mismatch!") return nothing end