From f52839fe6e50aaa5a5b6d37d6d4b8f2dbfe924d6 Mon Sep 17 00:00:00 2001 From: = <=> Date: Thu, 2 Jan 2025 16:33:14 -0800 Subject: [PATCH] add compute overhead check --- benchmark/benchmarks.jl | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/benchmark/benchmarks.jl b/benchmark/benchmarks.jl index 753b7d7d3..0e7c8e989 100644 --- a/benchmark/benchmarks.jl +++ b/benchmark/benchmarks.jl @@ -70,29 +70,31 @@ for (scheduler_name, scheduler) in [ end let - N = 10000 + N = 100000 function generate_kernel_defs() - for nnz1 in [4, 4^2, 4^3, 4^4, 4^5, 4^6, 4^7, 4^8] - for nnz2 in [4, 4^2, 4^3, 4^4, 4^5, 4^6, 4^7, 4^8] - D = fsprand(N, N, nnz1) - E = fsprand(N, N, nnz2) - F = fsprand(N, N, 4) - @einsum F[i, j] += D[i, k] * E[k, j] + for nnz1 in reverse([4, 4^2, 4^3, 4^4]) + for nnz2 in reverse([4, 4^2, 4^3, 4^4]) + for nnz3 in reverse([4, 4^2, 4^3, 4^4]) + A = lazy(fsprand(N, N, nnz1)) + B = lazy(fsprand(N, N, nnz2)) + C = lazy(fsprand(N, N, nnz3)) + compute(A * B * C) + end end end end - - SUITE["high-level"]["einsum_matmul_adaptive_overhead"][scheduler_name] = @benchmarkable( + + SUITE["high-level"]["matchain_adaptive_overhead"][scheduler_name] = @benchmarkable( begin - @einsum C[i, j] += A[i, k] * B[k, j] + compute(A * B * C) end, setup = begin Finch.set_scheduler!($scheduler) N = $N $generate_kernel_defs() - A = fsprand(N, N, 4) - B = fsprand(N, N, 4) - C = fsprand(N, N, 4) + A = lazy(fsprand(N, N, 4)) + B = lazy(fsprand(N, N, 4)) + C = lazy(fsprand(N, N, 4)) end, evals = 1 ) @@ -112,6 +114,19 @@ for (scheduler_name, scheduler) in [ ) end + let + A = Tensor(Dense(SparseList(Element(0.0))), fsprand(1, 1, 1)) + x = rand(1) + SUITE["high-level"]["compute_spmv_call_overhead"][scheduler_name] = @benchmarkable( + begin + A, x = (lazy($A), lazy($x)) + compute(A * x) + end, + setup = (Finch.set_scheduler!($scheduler);), + evals = 1 + ) + end + let N = 1_000 K = 1_000