Skip to content

[SYCL][NFC] Reduce amount of includes in in-tree tests #7438

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

Closed
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
4 changes: 4 additions & 0 deletions sycl/include/sycl/specialization_id.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@

#pragma once

#include <sycl/detail/defines_elementary.hpp>

namespace sycl {
__SYCL_INLINE_VER_NAMESPACE(_V1) {

enum class bundle_state : char;

/// Declaring a specialization constant
///
/// \ingroup sycl_api
Expand Down
2 changes: 2 additions & 0 deletions sycl/include/sycl/sycl_span.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ template<class Container>
#define _SYCL_SPAN_TEMPLATE_VIS
#define _SYCL_SPAN_INLINE_VISIBILITY inline

#include <sycl/detail/defines_elementary.hpp>

namespace sycl {
__SYCL_INLINE_VER_NAMESPACE(_V1) {

Expand Down
58 changes: 26 additions & 32 deletions sycl/test/basic_tests/address_space_traits.cpp
Original file line number Diff line number Diff line change
@@ -1,38 +1,32 @@
// RUN: %clangxx -fsycl -fsycl-device-only -D__ENABLE_USM_ADDR_SPACE__ -fsycl-targets=%sycl_triple %s -c

#include <cassert>
#include <sycl/sycl.hpp>
#include <sycl/access/access.hpp>

using namespace sycl;
int main() {

queue myQueue;
myQueue.submit([&](handler &cgh) {
cgh.single_task<class dummy>([=]() {
static_assert(
detail::deduce_AS<__attribute__((opencl_global)) int>::value ==
access::address_space::global_space,
"Unexpected address space");
static_assert(
detail::deduce_AS<__attribute__((opencl_local)) int>::value ==
access::address_space::local_space,
"Unexpected address space");
static_assert(
detail::deduce_AS<__attribute__((opencl_private)) int>::value ==
access::address_space::private_space,
"Unexpected address space");
static_assert(
detail::deduce_AS<__attribute__((opencl_constant)) int>::value ==
access::address_space::constant_space,
"Unexpected address space");
static_assert(
detail::deduce_AS<__attribute__((opencl_global_device)) int>::value ==
access::address_space::ext_intel_global_device_space,
"Unexpected address space");
static_assert(
detail::deduce_AS<__attribute__((opencl_global_host)) int>::value ==
access::address_space::ext_intel_global_host_space,
"Unexpected address space");
});
});
int main() {
static_assert(
detail::deduce_AS<__attribute__((opencl_global)) int>::value ==
access::address_space::global_space,
"Unexpected address space");
static_assert(
detail::deduce_AS<__attribute__((opencl_local)) int>::value ==
access::address_space::local_space,
"Unexpected address space");
static_assert(
detail::deduce_AS<__attribute__((opencl_private)) int>::value ==
access::address_space::private_space,
"Unexpected address space");
static_assert(
detail::deduce_AS<__attribute__((opencl_constant)) int>::value ==
access::address_space::constant_space,
"Unexpected address space");
static_assert(
detail::deduce_AS<__attribute__((opencl_global_device)) int>::value ==
access::address_space::ext_intel_global_device_space,
"Unexpected address space");
static_assert(
detail::deduce_AS<__attribute__((opencl_global_host)) int>::value ==
access::address_space::ext_intel_global_host_space,
"Unexpected address space");
}
4 changes: 2 additions & 2 deletions sycl/test/basic_tests/aliases.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -fsyntax-only -o %t.out
//==------------ aliases.cpp - SYCL type aliases test ----------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Expand All @@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//

#include <sycl/sycl.hpp>
#include <sycl/aliases.hpp>

#include <type_traits>

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/define_vendors.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -c -o %t.out
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -fsyntax-only -o %t.out
#include <sycl/sycl.hpp>

#if !defined(SYCL_IMPLEMENTATION_ONEAPI)
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/generic_type_traits.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -fsyntax-only -o %t.out

#include <cassert>
#include <iostream>
Expand Down
4 changes: 3 additions & 1 deletion sycl/test/basic_tests/id.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include <sycl/id.hpp>
#include <sycl/item.hpp>

#include <cassert>
#include <iostream>
#include <sycl/sycl.hpp>

using sycl::detail::Builder;

Expand Down
4 changes: 3 additions & 1 deletion sycl/test/basic_tests/id_ctad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include <sycl/sycl.hpp>
#include <sycl/id.hpp>

#include <type_traits>

using namespace std;
int main() {
Expand Down
6 changes: 5 additions & 1 deletion sycl/test/basic_tests/known_identity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
// This test performs basic checks of has_known_identity and known_identity
// type traits.

#include <sycl/functional.hpp>
#include <sycl/known_identity.hpp>
#include <sycl/marray.hpp>
#include <sycl/types.hpp>

#include <cassert>
#include <cstddef>
#include <sycl/sycl.hpp>

using namespace sycl;

Expand Down
1 change: 1 addition & 0 deletions sycl/test/basic_tests/marray/marray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//===----------------------------------------------------------------------===//

#include <sycl/sycl.hpp>

using namespace sycl;

int main() {
Expand Down
3 changes: 2 additions & 1 deletion sycl/test/basic_tests/nd_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include <sycl/nd_item.hpp>

#include <cassert>
#include <iostream>
#include <sycl/sycl.hpp>

using namespace std;
using sycl::detail::Builder;
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/range.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//===----------------------------------------------------------------------===//
#include <cassert>
#include <iostream>
#include <sycl/sycl.hpp>
#include <sycl/range.hpp>

using namespace std;
int main() {
Expand Down
6 changes: 4 additions & 2 deletions sycl/test/basic_tests/range_ctad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include <sycl/sycl.hpp>
#include <sycl/range.hpp>
#include <sycl/nd_range.hpp>

#include <type_traits>

using namespace std;
int main() {
sycl::range one_dim_range(64);
sycl::range two_dim_range(64, 1);
Expand Down
25 changes: 1 addition & 24 deletions sycl/test/basic_tests/range_error.cpp
Original file line number Diff line number Diff line change
@@ -1,31 +1,8 @@
// RUN: %clangxx %s %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning
#include <cassert>
#include <iostream>
#include <sycl/sycl.hpp>
#include <sycl/range.hpp>

using namespace std;
int main() {
sycl::range<1> one_dim_range(64);
sycl::range<2> two_dim_range(64, 1);
sycl::range<3> three_dim_range(64, 1, 2);
assert(one_dim_range.size() ==64);
assert(one_dim_range.get(0) ==64);
assert(one_dim_range[0] ==64);
cout << "one_dim_range passed " << endl;
assert(two_dim_range.size() ==64);
assert(two_dim_range.get(0) ==64);
assert(two_dim_range[0] ==64);
assert(two_dim_range.get(1) ==1);
assert(two_dim_range[1] ==1);
cout << "two_dim_range passed " << endl;
assert(three_dim_range.size() ==128);
assert(three_dim_range.get(0) ==64);
assert(three_dim_range[0] ==64);
assert(three_dim_range.get(1) ==1);
assert(three_dim_range[1] ==1);
assert(three_dim_range.get(2) ==2);
assert(three_dim_range[2] ==2);
cout << "three_dim_range passed " << endl;
// expected-error@+1 {{no matching constructor for initialization of 'sycl::range<1>'}}
sycl::range<1> one_dim_range_f1(64, 2, 4);
// expected-error@+1 {{no matching constructor for initialization of 'sycl::range<2>'}}
Expand Down
6 changes: 4 additions & 2 deletions sycl/test/basic_tests/span.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -c %s
// RUN: %clangxx -fsycl -fsyntax-only %s

//==--------------- span.cpp - SYCL span test ------------------------------==//
//
Expand All @@ -8,7 +8,9 @@
//
//===----------------------------------------------------------------------===//

#include <sycl/sycl.hpp>
#include <sycl/sycl_span.hpp>

#include <vector>

int main() {
// test the various span declarations, especially unspecialized ones.
Expand Down
6 changes: 4 additions & 2 deletions sycl/test/basic_tests/types.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -fsyntax-only -o %t.out
//==--------------- types.cpp - SYCL types test ----------------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Expand All @@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//

#include <sycl/sycl.hpp>
#include <sycl/marray.hpp>
#include <sycl/specialization_id.hpp>
#include <sycl/types.hpp>

#include <cfloat>
#include <cstdint>
Expand Down
4 changes: 3 additions & 1 deletion sycl/test/basic_tests/vectors/ctad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include <sycl/sycl.hpp>
#include <sycl/types.hpp>

#include <type_traits>

int main() {
sycl::vec v1(1);
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/vectors/ctad_fail.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected %s
#include <sycl/sycl.hpp>
#include <sycl/types.hpp>

int main() {
sycl::vec v(1, .1); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'vec'}}
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/extensions/fpga.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s -o %t.out

#include <sycl/ext/intel/fpga_extensions.hpp>
#include <sycl/sycl.hpp>
Expand Down
79 changes: 0 additions & 79 deletions sycl/test/extensions/inline_asm.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion sycl/test/matrix/query.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -o query %s
// RUN: %clangxx -fsycl -fsyntax-only -o query %s
#include <iostream>
#include <sycl/sycl.hpp>

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/regression/copy-with-unnamed-lambda.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda %s -o %t.out
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda %s -fsyntax-only -o %t.out
// The purpose of this test is to check that the following code can be
// successfully compiled
#include <sycl/sycl.hpp>
Expand Down
4 changes: 2 additions & 2 deletions sycl/test/regression/unnamed-lambda.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clangxx -fsycl -c %s -o %t.temp
// RUN: %clangxx -fsycl -sycl-std=1.2.1 -c %s -o %t.temp
// RUN: %clangxx -fsycl -fsyntax-only %s -o %t.temp
// RUN: %clangxx -fsycl -sycl-std=1.2.1 -fsyntax-only %s -o %t.temp

#include "sycl.hpp"

Expand Down
Loading