Skip to content

Commit

Permalink
Fixes #710: Fixed the comparison operators for `launch_configuration_…
Browse files Browse the repository at this point in the history
…t`, `composite_dimensions_t` and some inner classes
  • Loading branch information
eyalroz-gehc committed Jan 26, 2025
1 parent a2bd131 commit 946d32b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/cuda/api/launch_configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,13 @@ struct launch_configuration_t {
* on it, rather than the beginning of scheduling of the launched kernel and its
* dependence on antecedents.
*/
struct {
struct programmatic_completion_t {
event_t* event { nullptr };
// unsigned flags; WHAT ABOUT THE FLAGS?
bool trigger_event_at_block_start { true };
#if __cplusplus >= 202002L
constexpr bool operator==(const programmatic_completion_t&) const noexcept = default;
#endif
} programmatic_completion;

/**
Expand All @@ -129,14 +132,17 @@ struct launch_configuration_t {
* Dimensions of each part in the partition of the grid blocks into clusters, which
* can pool their shared memory together.
*/
struct {
struct clustering_t {
grid::dimensions_t cluster_dimensions { 1, 1, 1 };
cluster_scheduling_policy_t scheduling_policy { cluster_scheduling_policy_t::default_ };
#if __cplusplus >= 202002L
constexpr bool operator==(const clustering_t &) const noexcept = default;
#endif
} clustering;
#endif // CUDA_VERSION >= 12000

#if __cplusplus >= 202002L
constexpr auto operator<=>(const launch_configuration_t&) const noexcept = default;
constexpr bool operator==(const launch_configuration_t&) const noexcept = default;
#endif
public: // non-mutators

Expand Down Expand Up @@ -223,8 +229,9 @@ constexpr bool operator==(const launch_configuration_t lhs, const launch_configu
and lhs.block_cooperation == rhs.block_cooperation
#if CUDA_VERSION >= 12000
and lhs.programmatically_dependent_launch == rhs.programmatically_dependent_launch
and lhs.programmatic_completion.event == rhs.programmatic_completion.event
and lhs.in_remote_memory_synchronization_domain == rhs.in_remote_memory_synchronization_domain
and lhs.programmatic_completion.event == rhs.programmatic_completion.event
and lhs.programmatic_completion.trigger_event_at_block_start == rhs.programmatic_completion.trigger_event_at_block_start
and lhs.in_remote_memory_synchronization_domain == rhs.in_remote_memory_synchronization_domain
and lhs.clustering.cluster_dimensions == rhs.clustering.cluster_dimensions
and lhs.clustering.scheduling_policy == rhs.clustering.scheduling_policy
#endif // CUDA_VERSION >= 12000
Expand Down
9 changes: 9 additions & 0 deletions src/cuda/api/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,16 @@ struct composite_dimensions_t {
{
return { dimensions_t::point(), block_dimensions_t::point() };
}

///@cond
#if __cplusplus >= 202002L
constexpr bool operator==(const composite_dimensions_t&) const noexcept = default;
constexpr bool operator!=(const composite_dimensions_t&) const noexcept = default;
#endif
///@endcond
};

#if __cplusplus < 202002L
///@cond
constexpr bool operator==(composite_dimensions_t lhs, composite_dimensions_t rhs) noexcept
{
Expand All @@ -537,6 +545,7 @@ constexpr bool operator!=(composite_dimensions_t lhs, composite_dimensions_t rhs
return not (lhs == rhs);
}
///@endcond
#endif // __cplusplus < 202002L

} // namespace grid

Expand Down

0 comments on commit 946d32b

Please sign in to comment.