Skip to content

[SYCL][NFC] Fix warnings coming out of SYCL headers. #3978

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
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
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/sycl_span.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ using byte = unsigned char;
#if defined(__SYCL_DEVICE_ONLY__)
#define _SYCL_SPAN_ASSERT(x, m) ((void)0)
#else
#define _SYCL_SPAN_ASSERT(x, m) assert((x && m))
#define _SYCL_SPAN_ASSERT(x, m) assert(((x) && m))
#endif

inline constexpr size_t dynamic_extent = SIZE_MAX;
Expand Down
4 changes: 2 additions & 2 deletions sycl/include/CL/sycl/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,8 @@ __SYCL_GENERATE_CONVERT_IMPL_FOR_ROUNDING_MODE(rtn, Rtn)
typename OpenCLT, typename OpenCLR> \
detail::enable_if_t<is_float_to_int<T, R>::value && \
(std::is_same<OpenCLR, cl_##DestType>::value || \
std::is_same<OpenCLR, signed char>::value && \
std::is_same<DestType, char>::value) && \
(std::is_same<OpenCLR, signed char>::value && \
std::is_same<DestType, char>::value)) && \
RoundingModeCondition<roundingMode>::value, \
R> \
convertImpl(T Value) { \
Expand Down
31 changes: 28 additions & 3 deletions sycl/test/warnings/warnings.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
// RUN: %clangxx -fsycl --no-system-header-prefix=CL/sycl -fsyntax-only -Wall -Wextra -Wno-ignored-attributes -Wno-deprecated-declarations -Wpessimizing-move -Wunused-variable -Wmismatched-tags -Wunneeded-internal-declaration -Werror -Wno-unknown-cuda-version -Wno-unused-parameter %s -o %t.out

// RUN: %clangxx -fsycl --no-system-header-prefix=CL/sycl -fsyntax-only -Wall -Wextra -Werror -Wno-ignored-attributes -Wno-deprecated-declarations -Wpessimizing-move -Wunused-variable -Wmismatched-tags -Wunneeded-internal-declaration -Wno-unknown-cuda-version -Wno-unused-parameter %s
// RUN: %clangxx -fsycl -E --no-system-header-prefix=CL/sycl %s -o %t.ii
// RUN: %clangxx -fsycl -fsyntax-only -Wall -Wextra -Werror -Wno-ignored-attributes -Wno-deprecated-declarations -Wpessimizing-move -Wunused-variable -Wmismatched-tags -Wunneeded-internal-declaration -Wno-unknown-cuda-version -Wno-unused-parameter %t.ii
#include <CL/sycl.hpp>

using namespace cl::sycl;
int main() {
vec<long, 4> newVec;
queue myQueue;
buffer<vec<long, 4>, 1> resultBuf{&newVec, range<1>{1}};
myQueue.submit([&](handler &cgh) {
auto event = myQueue.submit([&](handler &cgh) {
auto writeResult = resultBuf.get_access<access::mode::write>(cgh);
cgh.single_task<class kernel_name>([=]() {
writeResult[0] = (vec<int, 4>{1, 2, 3, 4}).template convert<long>();
});
});
(void)event;
return 0;
}

// explicitly instantiate a few more classes to check if there are some issues
// with them:

namespace sycl {

template class buffer<vec<int, 3>, 2>;

template class accessor<int, 1>;
template class accessor<vec<float, 2>, 2, access_mode::read>;

template class marray<double, 7>;
template class marray<short, 3>;

template class kernel_bundle<bundle_state::input>;
template class kernel_bundle<bundle_state::object>;
template class kernel_bundle<bundle_state::executable>;

template class device_image<bundle_state::input>;
template class device_image<bundle_state::object>;
template class device_image<bundle_state::executable>;

}