-
Notifications
You must be signed in to change notification settings - Fork 331
Do not pretend to default initialize a device lambda #5015
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
Changes from all commits
f07b9ca
d89db11
8b95898
84cef60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2020-2024, NVIDIA CORPORATION. | ||
* Copyright (c) 2020-2025, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
|
@@ -35,9 +35,9 @@ namespace detail { | |
|
||
template <typename vertex_t, typename VertexValueInputIterator, typename VertexOp> | ||
struct count_if_call_v_op_t { | ||
vertex_t local_vertex_partition_range_first{}; | ||
VertexValueInputIterator vertex_value_input_first{}; | ||
VertexOp v_op{}; | ||
vertex_t local_vertex_partition_range_first; | ||
VertexValueInputIterator vertex_value_input_first; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't we default initialize iterators as well? Or is this because of possible thrust::transform_iterator with lambda? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My reasoning with removing all default initializers is that partially initializing the struct does not make any sense and it is only ever initialized in a single place, so it feels "cleaner" to initialize all or nothing Nothing I feel strongly about though There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, I am more inclined to default initializing variables that can be default initialized (it helps to prevent random non-deterministic behaviors due to garbage values), but I also don't feel strongly, either. |
||
VertexOp v_op; | ||
|
||
__device__ bool operator()(vertex_t i) | ||
{ | ||
|
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 think we can default initializing vertex_t (which is either int32_t or int64_t) or can this be also problematic?
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 believe we should be consistent, we only construct these types in one place