Binary size improvement: use device functors instead of lambdas - #5641
Binary size improvement: use device functors instead of lambdas#5641ChuckHastings wants to merge 4 commits into
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
| // Shared device functors for sampling local neighbor indices. Named functors deduplicate | ||
| // thrust/CUB instantiations across sample_and_compute_local_nbr_indices entry points. | ||
| template <typename bias_t> | ||
| struct negate_positive_bias_op_t { |
There was a problem hiding this comment.
We need to keep sampling specific functors here, for more generic functors, we may use the ones from device_functors.cuh (https://github.com/rapidsai/cugraph/blob/main/cpp/include/cugraph/utilities/device_functors.cuh); if missing there, better define there.
This basically inverts a value. Sounds very generic.
Should we better define something like
template <typename T>
struct invert_t {
...
};
in device_functors.cuh?
| }; | ||
|
|
||
| template <typename bias_t> | ||
| struct nonzero_bias_op_t { |
There was a problem hiding this comment.
Similar here, we can either use the existing is_not_equal_t or create is_nonzero_t.
There was a problem hiding this comment.
Or as I mentioned elsewhere, this can be is_not_equal_to_const_t with compare = 0.
| }; | ||
|
|
||
| template <typename T> | ||
| struct less_than_op_t { |
There was a problem hiding this comment.
Sounds generic.
We may rename this to less_than_t and place next to is_equal_t and is_not_equal_t?
| }; | ||
|
|
||
| template <typename edge_t> | ||
| struct valid_local_nbr_idx_op_t { |
There was a problem hiding this comment.
This is is_not_equal(_to)_t.
| } | ||
| }; | ||
|
|
||
| struct segment_idx_from_prefix_offsets_op_t { |
There was a problem hiding this comment.
We have segment_id_t in device_functors.cuh (note that this functor takes lasts, not offsets).
| }; | ||
|
|
||
| template <typename T> | ||
| struct local_idx_from_prefix_offsets_op_t { |
There was a problem hiding this comment.
segment_local_idx_t?
We may update this based on the existing segment_id_t.
| vertex_t const* visited_minors{}; | ||
| size_t visited_minors_size{}; |
There was a problem hiding this comment.
Better take this as a span.
| vertex_t const* minors{}; | ||
| label_t const* labels{}; | ||
| vertex_t const* visited_minors{}; | ||
| label_t const* visited_labels{}; | ||
| size_t visited_minors_size{}; |
| time_stamp_t const* edge_times{}; | ||
| time_stamp_t const* per_edge_window_starts{}; | ||
| time_stamp_t const* per_edge_window_ends{}; |
There was a problem hiding this comment.
In functors, we may better take spans instead of raw pointers where-ever applicable.
| } | ||
| }; | ||
|
|
||
| struct edge_type_gather_filter_op_t { |
There was a problem hiding this comment.
double_indirection_t or nested_indirection_t?
Convert to using device functors in places in the code where the same device logic is executed in different places or different instantiations of a template so that the device kernels can be reused.