Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ public:
*/
template <typename... P>
explicit thread_hierarchy_spec(const P&... p)
: inner(only_convertible_or(thread_hierarchy_spec<lower_levels...>(), p...))
, dynamic_width(only_convertible_or(decltype(dynamic_width)(), p...))
, sync_scope(only_convertible_or(hw_scope::all, p...))
, mem_bytes(only_convertible_or(mem(0), p...))
: inner(reserved::only_convertible_or(thread_hierarchy_spec<lower_levels...>(), p...))
, dynamic_width(reserved::only_convertible_or(decltype(dynamic_width)(), p...))
, sync_scope(reserved::only_convertible_or(hw_scope::all, p...))
, mem_bytes(reserved::only_convertible_or(mem(0), p...))
{
shuffled_args_check<P...>(inner, dynamic_width, sync_scope, mem_bytes);
if constexpr (sizeof...(lower_levels) > 0)
Expand Down
12 changes: 6 additions & 6 deletions cudax/include/cuda/experimental/__stf/utility/traits.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ T only_convertible(P0&& p0, [[maybe_unused]] P&&... p)
* @tparam T The target type to which the elements of the parameter pack should be convertible.
* @tparam P Variadic template representing the types in the parameter pack.
* @param p The parameter pack containing elements to be checked for convertibility and potentially added to the array.
* @return `::std::array<T, N>` An array of type `T` containing all elements from the parameter pack that are
* @return `std::array<T, N>` An array of type `T` containing all elements from the parameter pack that are
* convertible to `T`.
*
* @note The size of the returned array, `N`, is determined at compile time based on the number of convertible elements
Expand Down Expand Up @@ -388,7 +388,9 @@ auto all_convertible(P&&... p)
return mv(result);
}

/*
namespace reserved
{
/**
* @brief Chooses a parameter from `P...` of a type convertible to `T`. If found, it is returned. If no such parameter
* is found, returns `default_v`.
*
Expand All @@ -413,8 +415,6 @@ T only_convertible_or([[maybe_unused]] T default_v, [[maybe_unused]] P&&... p)
}
}

namespace reserved
{
/* Checks whether a collection of `DataTypes` objects can be unambiguously initialized (in some order)
from a collection of `ArgTypes` objects. Not all objects must be initialized,
e.g. `check_initialization<int, int*>(1)` passes. */
Expand Down Expand Up @@ -449,7 +449,7 @@ struct check_initialization
*
* @tparam ArgTypes The types to check the convertibility of.
* @tparam DataTypes The types to check the convertibility to.
* @param unused The data of the types to check the convertibility to.
* @param ... The data of the types to check the convertibility to.
*
* @note A static_assert error occurs if a type is not convertible to exactly one type.
*
Expand Down Expand Up @@ -523,7 +523,7 @@ template <typename... DataTypes, typename... ArgTypes>
::std::tuple<DataTypes...> shuffled_tuple(ArgTypes... args)
{
reserved::check_initialization<DataTypes...>::template from<ArgTypes...>();
return ::std::tuple<DataTypes...>{only_convertible_or(DataTypes(), mv(args)...)...};
return ::std::tuple<DataTypes...>{reserved::only_convertible_or(DataTypes(), mv(args)...)...};
}

/**
Expand Down
6 changes: 3 additions & 3 deletions cudax/include/cuda/experimental/__stf/utility/unittest.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -655,11 +655,11 @@ UNITTEST("all_convertible")
UNITTEST("shuffled arguments")
{
using namespace cuda::experimental::stf;
auto x0 = only_convertible_or(42);
auto x0 = reserved::only_convertible_or(42);
EXPECT(x0 == 42);
auto x1 = only_convertible_or(42, 23);
auto x1 = reserved::only_convertible_or(42, 23);
EXPECT(x1 == 23);
auto x2 = only_convertible_or(42, "23", ::std::tuple{1});
auto x2 = reserved::only_convertible_or(42, "23", ::std::tuple{1});
EXPECT(x2 == 42);
// Note that a needs to be iniliazed because shuffled_args_check takes a const ref
int a = 0;
Expand Down
Loading