Skip to content

Commit

Permalink
Merge branch 'master' into compare_commit_performance
Browse files Browse the repository at this point in the history
  • Loading branch information
roversch committed Aug 13, 2024
2 parents 64fae3c + 1b0925d commit 7934dfe
Show file tree
Hide file tree
Showing 99 changed files with 1,289 additions and 968 deletions.
2 changes: 2 additions & 0 deletions bench/analysis/dgemm_performance.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import json
import glob
Expand Down
2 changes: 2 additions & 0 deletions bench/analysis/dgemm_performance_ratio.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import json

Expand Down
16 changes: 10 additions & 6 deletions bench/blas/Gemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#include <bench/Gemm.hpp>


#include <benchmark/benchmark.h>
#include <test/Randomize.hpp>

#include <blaze/Math.h>

Expand All @@ -28,13 +28,17 @@ namespace blast :: benchmark
blaze::DynamicMatrix<Real, blaze::columnMajor> C(m, m);
randomize(C);

Real alpha, beta;
randomize(alpha);
randomize(beta);

for (auto _ : state)
gemm(C, trans(A), B, 1.0, 1.0);
gemm(C, trans(A), B, alpha, beta);

state.counters["flops"] = Counter(2 * m * m * m, Counter::kIsIterationInvariantRate);
setCounters(state.counters, complexityGemm(m, m, m));
state.counters["m"] = m;
}

BENCHMARK_TEMPLATE(BM_gemm, double)->DenseRange(1, 50);
BENCHMARK_TEMPLATE(BM_gemm, float)->DenseRange(1, 50);
BENCHMARK_TEMPLATE(BM_gemm, double)->DenseRange(1, BENCHMARK_MAX_GEMM);
BENCHMARK_TEMPLATE(BM_gemm, float)->DenseRange(1, BENCHMARK_MAX_GEMM);
}
2 changes: 1 addition & 1 deletion bench/blas/Iamax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace blast :: benchmark
static void BM_iamax(State& state)
{
size_t const N = state.range(0);
DynamicVector<Real> x(N);
blaze::DynamicVector<Real> x(N);
randomize(x);

for (auto _ : state)
Expand Down
2 changes: 1 addition & 1 deletion bench/blas/Syrk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


#include <bench/Benchmark.hpp>
#include <bench/Complexity.hpp>
#include <bench/Syrk.hpp>

#include <blaze/Math.h>

Expand Down
3 changes: 1 addition & 2 deletions bench/blasfeo/Gemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <bench/Gemm.hpp>

#include <random>
#include <memory>


namespace blast :: benchmark
Expand Down Expand Up @@ -53,7 +52,7 @@ namespace blast :: benchmark
for (auto _ : state)
gemm_nt(m, n, k, 1., A, 0, 0, B, 0, 0, 1., C, 0, 0, C, 0, 0);

state.counters["flops"] = Counter(2 * m * n * k + 3 * m * n, Counter::kIsIterationInvariantRate);
setCounters(state.counters, complexityGemm(m, n, k));
state.counters["m"] = m;
}

Expand Down
4 changes: 1 addition & 3 deletions bench/blasfeo/Syrk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@

#include <blasfeo/Blasfeo.hpp>



#include <bench/Benchmark.hpp>
#include <bench/Complexity.hpp>
#include <bench/Syrk.hpp>


namespace blast :: benchmark
Expand Down
15 changes: 8 additions & 7 deletions bench/blast/math/dense/DynamicGemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
// license that can be found in the LICENSE file.

#include <blast/math/dense/Gemm.hpp>

#include <blaze/math/DynamicMatrix.h>
#include <blast/math/Matrix.hpp>
#include <blast/blaze/Math.hpp>

#include <bench/Gemm.hpp>
#include <test/Randomize.hpp>

#include <random>
#include <memory>
#include <test/Randomize.hpp>


namespace blast :: benchmark
Expand All @@ -26,21 +24,24 @@ namespace blast :: benchmark
DynamicMatrix<Real, columnMajor> B(N, K);
DynamicMatrix<Real, columnMajor> C(M, N);
DynamicMatrix<Real, columnMajor> D(M, N);
Real alpha, beta;

randomize(A);
randomize(B);
randomize(C);
randomize(alpha);
randomize(beta);

for (auto _ : state)
{
gemm(1., A, trans(B), 1., C, D);
gemm(alpha, A, trans(B), beta, C, D);
DoNotOptimize(A);
DoNotOptimize(B);
DoNotOptimize(C);
DoNotOptimize(D);
}

state.counters["flops"] = Counter(2 * M * N * K, Counter::kIsIterationInvariantRate);
setCounters(state.counters, complexityGemm(M, N, K));
state.counters["m"] = M;
}

Expand Down
5 changes: 1 addition & 4 deletions bench/blast/math/dense/DynamicSyrk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
#include <blaze/math/DynamicMatrix.h>

#include <bench/Benchmark.hpp>
#include <bench/Complexity.hpp>
#include <bench/Syrk.hpp>

#include <test/Randomize.hpp>

#include <random>
#include <memory>


namespace blast :: benchmark
{
Expand Down
17 changes: 9 additions & 8 deletions bench/blast/math/dense/StaticGemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
// license that can be found in the LICENSE file.

#include <blast/math/dense/Gemm.hpp>

#include <blaze/math/StaticMatrix.h>
#include <blast/math/Matrix.hpp>
#include <blast/blaze/Math.hpp>

#include <bench/Gemm.hpp>
#include <test/Randomize.hpp>

#include <random>
#include <memory>
#include <test/Randomize.hpp>


namespace blast :: benchmark
Expand All @@ -22,24 +20,27 @@ namespace blast :: benchmark
size_t constexpr K = M;

StaticMatrix<Real, M, K, columnMajor> A;
StaticMatrix<Real, N, K, columnMajor> B;
StaticMatrix<Real, K, N, columnMajor> B;
StaticMatrix<Real, M, N, columnMajor> C;
StaticMatrix<Real, M, N, columnMajor> D;
Real alpha, beta;

randomize(A);
randomize(B);
randomize(C);
randomize(alpha);
randomize(beta);

for (auto _ : state)
{
gemm(0.5, A, B, 0.1, C, D);
gemm(alpha, A, trans(B), beta, C, D);
DoNotOptimize(A);
DoNotOptimize(B);
DoNotOptimize(C);
DoNotOptimize(D);
}

state.counters["flops"] = Counter(2 * M * N * K + 3 * M * N, Counter::kIsIterationInvariantRate);
setCounters(state.counters, complexityGemm(M, N, K));
state.counters["m"] = M;
}

Expand Down
2 changes: 1 addition & 1 deletion bench/blast/math/dense/StaticIamax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <blast/math/dense/Iamax.hpp>

#include <blaze/math/DynamicVector.h>
#include <blast/blaze/Math.hpp>

#include <bench/Iamax.hpp>
#include <bench/Complexity.hpp>
Expand Down
5 changes: 2 additions & 3 deletions bench/blast/math/dense/StaticSyrk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
#include <blaze/math/StaticMatrix.h>

#include <bench/Benchmark.hpp>
#include <bench/Complexity.hpp>
#include <bench/Syrk.hpp>

#include <random>
#include <memory>
#include <test/Randomize.hpp>


namespace blast :: benchmark
Expand Down
7 changes: 2 additions & 5 deletions bench/blast/math/dense/StaticTrmm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
// license that can be found in the LICENSE file.

#include <blast/math/dense/Trmm.hpp>

#include <blaze/math/StaticMatrix.h>
#include <blast/math/Matrix.hpp>
#include <blast/blaze/Math.hpp>

#include <bench/Gemm.hpp>
#include <test/Randomize.hpp>

#include <random>
#include <memory>


namespace blast :: benchmark
{
Expand Down
19 changes: 10 additions & 9 deletions bench/blast/math/panel/DynamicGemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
#include <blast/math/panel/Gemm.hpp>

#include <bench/Gemm.hpp>
#include <test/Randomize.hpp>

#include <random>
#include <memory>
#include <test/Randomize.hpp>


namespace blast :: benchmark
Expand All @@ -21,25 +19,28 @@ namespace blast :: benchmark
size_t const N = M;
size_t const K = M;

DynamicPanelMatrix<Real> A(M, K);
DynamicPanelMatrix<Real> B(N, K);
DynamicPanelMatrix<Real> C(M, N);
DynamicPanelMatrix<Real> D(M, N);
DynamicPanelMatrix<Real, columnMajor> A(M, K);
DynamicPanelMatrix<Real, columnMajor> B(N, K);
DynamicPanelMatrix<Real, columnMajor> C(M, N);
DynamicPanelMatrix<Real, columnMajor> D(M, N);
Real alpha, beta;

randomize(A);
randomize(B);
randomize(C);
randomize(alpha);
randomize(beta);

for (auto _ : state)
{
gemm_nt(A, B, C, D);
gemm(alpha, A, trans(B), beta, C, D);
DoNotOptimize(A);
DoNotOptimize(B);
DoNotOptimize(C);
DoNotOptimize(D);
}

state.counters["flops"] = Counter(2 * M * N * K, Counter::kIsIterationInvariantRate);
setCounters(state.counters, complexityGemm(M, N, K));
state.counters["m"] = M;
}

Expand Down
21 changes: 12 additions & 9 deletions bench/blast/math/panel/StaticGemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
// license that can be found in the LICENSE file.

#include <blast/math/StaticPanelMatrix.hpp>
#include <blast/math/Matrix.hpp>
#include <blast/math/panel/Gemm.hpp>
#include <blast/blaze/Math.hpp>

#include <bench/Gemm.hpp>
#include <test/Randomize.hpp>

#include <random>
#include <memory>
#include <test/Randomize.hpp>


namespace blast :: benchmark
Expand All @@ -20,25 +20,28 @@ namespace blast :: benchmark
size_t constexpr N = M;
size_t constexpr K = M;

StaticPanelMatrix<Real, M, K> A;
StaticPanelMatrix<Real, N, K> B;
StaticPanelMatrix<Real, M, N> C;
StaticPanelMatrix<Real, M, N> D;
StaticPanelMatrix<Real, M, K, columnMajor> A;
StaticPanelMatrix<Real, N, K, columnMajor> B;
StaticPanelMatrix<Real, M, N, columnMajor> C;
StaticPanelMatrix<Real, M, N, columnMajor> D;
Real alpha, beta;

randomize(A);
randomize(B);
randomize(C);
randomize(alpha);
randomize(beta);

for (auto _ : state)
{
gemm_nt(A, B, C, D);
gemm(alpha, A, trans(B), beta, C, D);
DoNotOptimize(A);
DoNotOptimize(B);
DoNotOptimize(C);
DoNotOptimize(D);
}

state.counters["flops"] = Counter(2 * M * N * K, Counter::kIsIterationInvariantRate);
setCounters(state.counters, complexityGemm(M, N, K));
state.counters["m"] = M;
}

Expand Down
3 changes: 2 additions & 1 deletion bench/blast/math/simd/Load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#include <blast/math/RegisterMatrix.hpp>
#include <blast/math/DynamicPanelMatrix.hpp>
#include <blast/math/dense/DynamicMatrixPointer.hpp>
#include <blast/math/dense/StaticMatrixPointer.hpp>
Expand Down Expand Up @@ -92,4 +93,4 @@ namespace blast :: benchmark
BENCHMARK_TEMPLATE(BM_RegisterMatrix_load_static_dense, double, 8, 4, columnMajor);
BENCHMARK_TEMPLATE(BM_RegisterMatrix_load_static_dense, double, 12, 4, columnMajor);
BENCHMARK_TEMPLATE(BM_RegisterMatrix_load_static_dense, double, 8, 8, columnMajor);
}
}
3 changes: 2 additions & 1 deletion bench/blast/math/simd/Store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <blast/math/DynamicPanelMatrix.hpp>
#include <blast/math/dense/DynamicMatrixPointer.hpp>
#include <blast/math/dense/StaticMatrixPointer.hpp>
#include <blast/math/RegisterMatrix.hpp>

#include <bench/Benchmark.hpp>

Expand Down Expand Up @@ -98,4 +99,4 @@ namespace blast :: benchmark
BENCHMARK_TEMPLATE(BM_RegisterMatrix_store_static_dense, double, 8, 4, columnMajor);
BENCHMARK_TEMPLATE(BM_RegisterMatrix_store_static_dense, double, 12, 4, columnMajor);
BENCHMARK_TEMPLATE(BM_RegisterMatrix_store_static_dense, double, 8, 8, columnMajor);
}
}
6 changes: 3 additions & 3 deletions bench/blast/math/simd/Trmm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#include <blast/math/dense/StaticMatrixPointer.hpp>
#include <blast/math/Matrix.hpp>
#include <blast/math/RegisterMatrix.hpp>

#include <bench/Benchmark.hpp>

#include <test/Randomize.hpp>

#include <blaze/math/StaticMatrix.h>
#include <blast/blaze/Math.hpp>


namespace blast :: benchmark
Expand Down Expand Up @@ -81,4 +81,4 @@ namespace blast :: benchmark
BENCHMARK_TEMPLATE(BM_RegisterMatrix_trmmRightLower, float, 24, 4, columnMajor);
BENCHMARK_TEMPLATE(BM_RegisterMatrix_trmmRightLower, float, 16, 5, columnMajor);
BENCHMARK_TEMPLATE(BM_RegisterMatrix_trmmRightLower, float, 16, 6, columnMajor);
}
}
Loading

0 comments on commit 7934dfe

Please sign in to comment.