-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix gemm() performance for panel matrices (#43)
* Correct alignment deduction for transposed manel matrices * Implement missing IsAligned and IsPadded type traits specializations * PanelPotrfTest decoupled from Blaze * PanelGemmTest decoupled from Blaze * Conditional use of unaligned matrix pointers in gemm(RegisterMatrix<...>, ...) * Fixed a typo * RegisterMatrixTest passes when compiled with GCC * Static panel matrix pointer benchmark * Added operator[] to matrix and vector pointers * Increased inlining threshold for Clang * Removed broadcast() from matrix and vector pointers * Explicitly convert B pointer to unaligned in gemm()
- Loading branch information
Showing
34 changed files
with
393 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) 2019-2020 Mikhail Katliar All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
#include <blast/math/StaticPanelMatrix.hpp> | ||
|
||
#include <bench/Benchmark.hpp> | ||
|
||
|
||
namespace blast :: benchmark | ||
{ | ||
template <typename Real, AlignmentFlag AF> | ||
static void BM_static_panel_matrix_pointer(State& state) | ||
{ | ||
size_t constexpr M = 8; | ||
size_t constexpr N = 4; | ||
|
||
StaticPanelMatrix<Real, M, N, columnMajor> A; | ||
auto pA = ptr<AF>(A, 0, 0); | ||
|
||
for (auto _ : state) | ||
{ | ||
for (size_t i = 0; i < M; ++i) | ||
for (size_t j = 0; j < N; ++j) | ||
DoNotOptimize(pA(i, j)); | ||
} | ||
} | ||
|
||
|
||
BENCHMARK_TEMPLATE(BM_static_panel_matrix_pointer, double, aligned); | ||
BENCHMARK_TEMPLATE(BM_static_panel_matrix_pointer, double, unaligned); | ||
BENCHMARK_TEMPLATE(BM_static_panel_matrix_pointer, float, aligned); | ||
BENCHMARK_TEMPLATE(BM_static_panel_matrix_pointer, float, unaligned); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2024 Mikhail Katliar. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
#pragma once | ||
|
||
#include <blast/math/typetraits/IsAligned.hpp> | ||
|
||
#include <blaze/math/typetraits/IsVector.h> | ||
#include <blaze/math/typetraits/IsMatrix.h> | ||
#include <blaze/math/typetraits/IsAligned.h> | ||
|
||
|
||
namespace blast | ||
{ | ||
/** | ||
* @brief Specialization for Blaze matrix and vector types | ||
* | ||
* @tparam T matrix or vector type | ||
*/ | ||
template <typename T> | ||
requires blaze::IsVector_v<T> || blaze::IsMatrix_v<T> | ||
struct IsAligned<T> : blaze::IsAligned<T> {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2024 Mikhail Katliar. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
#pragma once | ||
|
||
#include <blast/math/typetraits/IsPadded.hpp> | ||
|
||
#include <blaze/math/typetraits/IsVector.h> | ||
#include <blaze/math/typetraits/IsMatrix.h> | ||
#include <blaze/math/typetraits/IsPadded.h> | ||
|
||
|
||
namespace blast | ||
{ | ||
/** | ||
* @brief Specialization for Blaze matrix and vector types | ||
* | ||
* @tparam T matrix or vector type | ||
*/ | ||
template <typename T> | ||
requires blaze::IsVector_v<T> || blaze::IsMatrix_v<T> | ||
struct IsPadded<T> : blaze::IsPadded<T> {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,6 @@ | |
|
||
#include <blast/math/Simd.hpp> | ||
|
||
#include <cstdlib> | ||
|
||
|
||
namespace blast :: detail | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.