-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
337 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors | ||
// | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#include <ginkgo/core/base/work_estimate.hpp> | ||
|
||
|
||
namespace gko { | ||
|
||
|
||
compute_bound_work_estimate operator+(compute_bound_work_estimate a, | ||
compute_bound_work_estimate b) | ||
{ | ||
return {a.flops + b.flops}; | ||
} | ||
|
||
|
||
compute_bound_work_estimate& compute_bound_work_estimate::operator+=( | ||
compute_bound_work_estimate other) | ||
{ | ||
*this = *this + other; | ||
return *this; | ||
} | ||
|
||
|
||
memory_bound_work_estimate operator+(memory_bound_work_estimate a, | ||
memory_bound_work_estimate b) | ||
{ | ||
return {a.bytes_read + b.bytes_read, a.bytes_written + b.bytes_written}; | ||
} | ||
|
||
|
||
memory_bound_work_estimate& memory_bound_work_estimate::operator+=( | ||
memory_bound_work_estimate other) | ||
{ | ||
*this = *this + other; | ||
return *this; | ||
} | ||
|
||
|
||
custom_work_estimate operator+(custom_work_estimate a, custom_work_estimate b) | ||
{ | ||
GKO_ASSERT(a.operation_count_name == b.operation_count_name); | ||
return {a.operation_count_name, a.operations + b.operations}; | ||
} | ||
|
||
|
||
custom_work_estimate& custom_work_estimate::operator+=( | ||
custom_work_estimate other) | ||
{ | ||
*this = *this + other; | ||
return *this; | ||
} | ||
|
||
|
||
kernel_work_estimate operator+(kernel_work_estimate a, kernel_work_estimate b) | ||
{ | ||
// this fails with std::bad_variant_access if the two estimates are of | ||
// different types | ||
return std::visit( | ||
[b](auto a) -> kernel_work_estimate { | ||
return a + std::get<decltype(a)>(b); | ||
}, | ||
a); | ||
} | ||
|
||
|
||
} // namespace gko |
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
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.