Skip to content

Commit f6f8874

Browse files
[SYCL] Prohibit usage of <sycl/sycl.hpp> in E2E tests (#13875)
Fine-grained includes should be used instead for the benefits of compile-time. So far, the feature is still internal, customer code should continue using standard header files only. We can consider adding a Nightly workflow running E2E tests with extra compilation flag `-include sycl/sycl.hpp` if people think that would be important to have. I personally think that any potential discrepancies between full `sycl.hpp` and individual includes can be caught in compile-time and it should be enough to have tests in `sycl/test`.
1 parent ee1b2f2 commit f6f8874

File tree

7 files changed

+30
-12
lines changed

7 files changed

+30
-12
lines changed

sycl/test-e2e/DeviceLib/math_fp64_windows_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "math_utils.hpp"
1010
#include <iostream>
1111
#include <math.h>
12-
#include <sycl/sycl.hpp>
12+
#include <sycl/detail/core.hpp>
1313

1414
namespace s = sycl;
1515
constexpr s::access::mode sycl_read = s::access::mode::read;

sycl/test-e2e/DeviceLib/math_windows_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "math_utils.hpp"
99
#include <iostream>
1010
#include <math.h>
11-
#include <sycl/sycl.hpp>
11+
#include <sycl/detail/core.hpp>
1212

1313
namespace s = sycl;
1414
constexpr s::access::mode sycl_read = s::access::mode::read;

sycl/test-e2e/QueueFlushing/queue_flushing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %t.out
33

44
#include <stdlib.h>
5-
#include <sycl/sycl.hpp>
5+
#include <sycl/detail/core.hpp>
66
#include <vector>
77

88
using namespace sycl;

sycl/test-e2e/README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,13 @@ llvm-lit --param dpcpp_compiler=path/to/clang++ --param dump_ir=True \
291291
While SYCL specification dictates that the only user-visible interface is
292292
`<sycl/sycl.hpp>` header file we found out that as the implementation and
293293
multiple extensions grew, the compile time was getting worse and worse,
294-
negatively affecting our CI turnaround time. We are just starting some efforts
295-
to create a much smaller set of basic feature needed for every SYCL end-to-end
296-
test/program so that this issue could be somewhat mitigated. This activity is in
297-
its early stage and NO production code should rely on it. It WILL be changed as
298-
we go with our experiments. For any code outside of this project only the
299-
`<sycl/sycl.hpp>` must be used until we feel confident to propose an extension
300-
that can provide an alternative.
294+
negatively affecting our CI turnaround time. As such, we decided to use
295+
finer-grained includes for the end-to-end tests used in this project (under
296+
`sycl/test-e2e/` folder).
297+
298+
At this moment all the tests have been updated to include a limited set of
299+
headers only. However, the work of eliminating unnecessary dependencies between
300+
implementation header files is still in progress and the final set of these
301+
"fine-grained" includes that might be officially documented and suggested for
302+
customers to use isn't determined yet. **Until then, code outside of this project
303+
must keep using `<sycl/sycl.hpp>` provided by the SYCL2020 specification.**

sycl/test-e2e/Regression/compile_on_win_with_mdd.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// the compile line. In that case, user application will crash during launching
1111
// with abort() message.
1212

13-
#include <sycl/sycl.hpp>
13+
#include <sycl/queue.hpp>
1414

1515
#include <iostream>
1616

sycl/test-e2e/SubGroup/generic_reduce.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
#include "helper.hpp"
1111
#include <complex>
12-
#include <sycl/sycl.hpp>
12+
#include <sycl/detail/core.hpp>
13+
#include <sycl/group_algorithm.hpp>
1314

1415
using namespace sycl;
1516

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// REQUIRES: linux
2+
//
3+
// RUN: grep -r -l 'sycl.hpp' %S | FileCheck %s
4+
// RUN: grep -r -l 'sycl.hpp' %S | wc -l | FileCheck %s --check-prefix CHECK-NUM-MATCHES
5+
//
6+
// CHECK-DAG: README.md
7+
// CHECK-DAG: no_sycl_hpp_in_e2e_tests.cpp
8+
// CHECK-DAG: lit.cfg.py
9+
//
10+
// CHECK-NUM-MATCHES: 3
11+
//
12+
// This test verifies that `<sycl/sycl.hpp>` isn't used in E2E tests. Instead,
13+
// fine-grained includes should used, see
14+
// https://github.com/intel/llvm/tree/sycl/sycl/test-e2e#sycldetailcorehpp

0 commit comments

Comments
 (0)