Skip to content
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

[SYCL] Fix EnableIfOutputIteratorT trait #12834

Open
wants to merge 13 commits into
base: sycl
Choose a base branch
from
28 changes: 13 additions & 15 deletions sycl/include/sycl/detail/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,32 @@

#pragma once

#include <array> // for array
#include <cassert> // for assert
#include <cstddef> // for size_t
#include <string> // for allocator, operator+
#include <sycl/detail/defines_elementary.hpp> // for __SYCL_ALWAYS_INLINE
#include <sycl/detail/export.hpp> // for __SYCL_EXPORT
#include <sycl/detail/pi.h> // for pi_int32

#include <array> // for array
#include <cassert> // for assert
#include <cstddef> // for size_t
#include <string> // for allocator, operator+
#include <type_traits> // for enable_if_t
#include <utility> // for index_sequence, make_i...
#include <sycl/detail/stl_type_traits.hpp> // for is_output_iteratior
#include <type_traits> // for enable_if_t
#include <utility> // for index_sequence, make_i...

// Default signature enables the passing of user code location information to
// public methods as a default argument.
namespace sycl {
inline namespace _V1 {
namespace detail {

// The check for output iterator is commented out as it blocks set_final_data
// with void * argument to be used.
// TODO: Align these checks with the SYCL specification when the behaviour
// with void * is clarified.
lbushi25 marked this conversation as resolved.
Show resolved Hide resolved
template <typename DataT>
using EnableIfOutputPointerT = std::enable_if_t<
/*is_output_iterator<DataT>::value &&*/ std::is_pointer_v<DataT>>;
using EnableIfOutputPointerT =
std::enable_if_t<is_output_iterator<DataT>::value &&
std::is_pointer_v<DataT>>;

template <typename DataT>
using EnableIfOutputIteratorT = std::enable_if_t<
/*is_output_iterator<DataT>::value &&*/ !std::is_pointer_v<DataT>>;
using EnableIfOutputIteratorT =
std::enable_if_t<is_output_iterator<DataT>::value &&
!std::is_pointer_v<DataT>>;

#if !defined(NDEBUG) && (_MSC_VER > 1929 || __has_builtin(__builtin_FILE))
#define __CODELOC_FILE_NAME __builtin_FILE()
Expand Down
6 changes: 6 additions & 0 deletions sycl/include/sycl/detail/stl_type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ struct is_output_iterator<T, output_iterator_requirements<T>> {
static constexpr bool value = true;
};

// the case when T = void * is hardcoded because of a reference to void error
// that is generated by the previous speialization
template <> struct is_output_iterator<void *> {
static constexpr bool value = true;
};

} // namespace detail
} // namespace _V1
} // namespace sycl
Loading