Skip to content

[SYCL] Aligned set_arg behaviour with SYCL specification #2159

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

Merged
merged 6 commits into from
Jul 28, 2020
Merged
Changes from 3 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
14 changes: 13 additions & 1 deletion sycl/include/CL/sycl/handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,19 @@ class __SYCL_EXPORT handler {
static_cast<int>(AccessTarget), ArgIndex);
}

template <typename T> void setArgHelper(int ArgIndex, T &&Arg) {
template <typename T> struct ShouldEnableSetArgHelper {
static constexpr bool value = std::is_trivially_copyable<T>::value
#ifdef CL_SYCL_LANGUAGE_VERSION
#if CL_SYCL_LANGUAGE_VERSION <= 121
&& std::is_standard_layout<T>::value
#endif
#endif
;
};

template <typename T>
typename std::enable_if<ShouldEnableSetArgHelper<T>::value, void>::type
setArgHelper(int ArgIndex, T &&Arg) {
void *StoredArg = (void *)storePlainArg(Arg);

if (!std::is_same<cl_mem, T>::value && std::is_pointer<T>::value) {
Expand Down