-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow users to control iteration via the concept of iteration spaces. #80
base: main
Are you sure you want to change the base?
Allow users to control iteration via the concept of iteration spaces. #80
Conversation
Changes in the work include: - [x] Internally use linear_space for iterating - [x] Simplify type and value iteration in `state_iterator::build_axis_configs` - [x] Store the iteration space in `axes_metadata` - [x] Expose `tie` and `user` spaces to user - [x] Add tests for `linear`, `tie`, and `user` - [x] Add examples for `tie` and `user`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re: naming, I'd stick with zip
as opposed to tie
.
I think "zip" is more intuitive and descriptive based on the precedence of things like thrust::zip_iterator
and std::ranges::zip_view
.
nvbench/axis_iteration_space.cuh
Outdated
virtual std::unique_ptr<axis_space_base> do_clone() const = 0; | ||
virtual detail::axis_space_iterator do_iter(axes_info info) const = 0; | ||
virtual std::size_t do_size(const axes_info &info) const = 0; | ||
virtual std::size_t do_valid_count(const axes_info &info) const = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice to get some docs on the concept of a "axis space" as well as the semantics of these functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, same for the linear_axis_space
and other subclasses below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added more documentation
182f1da
to
a25f578
Compare
0a2130f
to
c3c86e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did an initial round of review, but didn't finish -- sharing my comments so far. Will give this a closer look later.
In the meantime, can you go through this and add documentation for the new interfaces?
Having a high-level overview of how these pieces fit together would also be helpful, maybe include that in the class docs for nvbench::detail::axes_iterator
.
Co-authored-by: Allison Vacanti <[email protected]>
Co-authored-by: Allison Vacanti <[email protected]>
Co-authored-by: Allison Vacanti <[email protected]>
Co-authored-by: Allison Vacanti <[email protected]>
Co-authored-by: Allison Vacanti <[email protected]>
Co-authored-by: Allison Vacanti <[email protected]>
Co-authored-by: Allison Vacanti <[email protected]>
Co-authored-by: Allison Vacanti <[email protected]>
Co-authored-by: Allison Vacanti <[email protected]>
5dc6c83
to
d8d80e4
Compare
d8d80e4
to
ba8356f
Compare
f66cca3
to
f4396bd
Compare
f4396bd
to
e7b4800
Compare
nvbench/iteration_space_base.cuh
Outdated
* Construct a new derived iteration_space | ||
* | ||
* @param[input_indices] | ||
* @param[output_indices] | ||
*/ | ||
iteration_space_base(std::vector<std::size_t> input_indices, | ||
std::vector<std::size_t> output_indices); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not obvious what the input_indices/output_indices
represent here and could use docs to explain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the docs with more information, does that help clarify it?
* The input_indices and output_indices combine together to allow the iteration space to know | ||
* what axi they should query from axes_metadata and where each of those map to in the output | ||
* iteration space. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So input_indices
determines which elements from the std::vector<std::unique_ptr<nvbench::axis_base>>
inside axes_metadata
are referenced by the iteration_space
?
What do the output_indices
reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So input_indices determines which elements from the std::vector<std::unique_ptrnvbench::axis_base> inside axes_metadata are referenced by the iteration_space?
Correct.
What do the output_indices reference?
The location in the detail::state_iterator
vector of results for a given entry in the cross produce of both type and value axis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has been awhile since I wrote this class, and with the removal of adding abitrary zips the output_indices
might be unneeded if we have the number of type axis. I will see if I can refactor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the PR and was able to both remove output_indices
and simplify the interator update logic.
std::size_t active_size; | ||
}; | ||
|
||
struct axis_space_iterator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given this is a pretty central piece of new machinery, this could use some docs for what is going on here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, given this isn't really an iterator
in the sense that it doesn't satisfy any std::iterator
concepts, I think the iterator
name is confusing (it confused me anyways).
I'd either make it satisfy an appropriate iterator concept or give it a different name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class matches the naming pattern of the existing state_iterator
( https://github.com/NVIDIA/nvbench/blob/main/nvbench/detail/state_generator.cuh#L74 ) which calls the axis_iterator.
* std::move(output_indices)) | ||
* {} | ||
* | ||
* nvbench::detail::axis_space_iterator do_get_iterator(axes_info info) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having things in the detail
namespace appear in something called user_axis_space
seems incongruous.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the implementation around here, so it would be good to review again. If we are happy with axis_space_iterator
I will promote it to nvbench::
0ade18a
to
282754b
Compare
282754b
to
5708e6c
Compare
Can we revive this PR? Are there blockers? |
Changes in the work include:
state_iterator::build_axis_configs
axes_metadata
zip
anduser
spaces to userlinear
,zip
, anduser
zip
anduser
Fixes #68