-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor axis spaces into separate TUs
- Loading branch information
1 parent
40a6711
commit e7b4800
Showing
10 changed files
with
320 additions
and
117 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
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,37 @@ | ||
/* | ||
* Copyright 2022 NVIDIA Corporation | ||
* | ||
* Licensed under the Apache License, Version 2.0 with the LLVM exception | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. | ||
* | ||
* You may obtain a copy of the License at | ||
* | ||
* http://llvm.org/foundation/relicensing/LICENSE.txt | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <nvbench/axis_iteration_space.cuh> | ||
|
||
namespace nvbench | ||
{ | ||
|
||
struct linear_axis_space final : iteration_space_base | ||
{ | ||
linear_axis_space(std::size_t in, std::size_t out); | ||
~linear_axis_space(); | ||
|
||
std::unique_ptr<iteration_space_base> do_clone() const override; | ||
detail::axis_space_iterator do_get_iterator(axes_info info) const override; | ||
std::size_t do_get_size(const axes_info &info) const override; | ||
std::size_t do_get_active_count(const axes_info &info) const override; | ||
}; | ||
|
||
} // namespace nvbench |
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,60 @@ | ||
/* | ||
* Copyright 2022 NVIDIA Corporation | ||
* | ||
* Licensed under the Apache License, Version 2.0 with the LLVM exception | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. | ||
* | ||
* You may obtain a copy of the License at | ||
* | ||
* http://llvm.org/foundation/relicensing/LICENSE.txt | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "linear_axis_space.cuh" | ||
|
||
#include <nvbench/type_axis.cuh> | ||
|
||
namespace nvbench | ||
{ | ||
|
||
linear_axis_space::linear_axis_space(std::size_t in_index, | ||
std::size_t out_index) | ||
: iteration_space_base({in_index}, {out_index}) | ||
{} | ||
|
||
linear_axis_space::~linear_axis_space() = default; | ||
|
||
detail::axis_space_iterator linear_axis_space::do_get_iterator(axes_info info) const | ||
{ | ||
std::size_t loc(m_output_indices[0]); | ||
auto update_func = [=](std::size_t inc_index, | ||
std::vector<detail::axis_index> &indices) { | ||
indices[loc] = info[0]; | ||
indices[loc].index = inc_index; | ||
}; | ||
|
||
return detail::make_space_iterator(1, info[0].size, update_func); | ||
} | ||
|
||
std::size_t linear_axis_space::do_get_size(const axes_info &info) const | ||
{ | ||
return info[0].size; | ||
} | ||
|
||
std::size_t linear_axis_space::do_get_active_count(const axes_info &info) const | ||
{ | ||
return info[0].active_size; | ||
} | ||
|
||
std::unique_ptr<iteration_space_base> linear_axis_space::do_clone() const | ||
{ | ||
return std::make_unique<linear_axis_space>(*this); | ||
} | ||
|
||
} // namespace nvbench |
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,37 @@ | ||
/* | ||
* Copyright 2022 NVIDIA Corporation | ||
* | ||
* Licensed under the Apache License, Version 2.0 with the LLVM exception | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. | ||
* | ||
* You may obtain a copy of the License at | ||
* | ||
* http://llvm.org/foundation/relicensing/LICENSE.txt | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <nvbench/axis_iteration_space.cuh> | ||
|
||
namespace nvbench | ||
{ | ||
|
||
struct user_axis_space : iteration_space_base | ||
{ | ||
user_axis_space(std::vector<std::size_t> input_indices, | ||
std::vector<std::size_t> output_indices); | ||
~user_axis_space(); | ||
}; | ||
|
||
using make_user_space_signature = | ||
std::unique_ptr<iteration_space_base>(std::vector<std::size_t> input_indices, | ||
std::vector<std::size_t> output_indices); | ||
|
||
} // namespace nvbench |
Oops, something went wrong.