Skip to content

Commit f0d0f7c

Browse files
[SYCL][E2E] Add some compile-time "tracking" tests (#16648)
We run `test-e2e/PerformanceTests` in post-commit and that can be used for * tracking the compilation time on these tests over time * running them in pre-commit to measure expected improvements I also think that since PerformanceTests are "opt-in" in precommit, there is little sense in enforcing no `<sycl/sycl.hpp>` header in them.
1 parent 69cbf2a commit f0d0f7c

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: time -f "Elapsed real time: %es" %{build} -fsycl-device-only -fsyntax-only
2+
// RUN: time -f "Elapsed real time: %es" %{build} -o %t.out
3+
4+
#include <sycl/detail/core.hpp>
5+
6+
int main() { return 0; }
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// RUN: time -f "Elapsed real time: %es" %{build} -fsycl-device-only -fsyntax-only
2+
// RUN: time -f "Elapsed real time: %es" %{build} -fsycl-device-only -fsyntax-only -DSUBMIT
3+
4+
#include <sycl/detail/core.hpp>
5+
6+
template <int N, int M> struct compile_time_heavy_krn {
7+
static void foo(int x = N) { compile_time_heavy_krn<N - 1, M>::foo(x); }
8+
};
9+
10+
template <int M> struct compile_time_heavy_krn<0, M> {
11+
static void foo(int x = 0) { std::ignore = x; }
12+
};
13+
14+
int main() {
15+
sycl::queue q;
16+
q.single_task([]() { std::ignore = 42; });
17+
sycl::detail::loop<2>([&](auto outer_idx) {
18+
sycl::detail::loop<200>([&](auto idx) {
19+
auto krn = [=]() {
20+
compile_time_heavy_krn<idx * 5, outer_idx * 1000 + idx>::foo();
21+
};
22+
auto s = [&](sycl::handler &cgh) {
23+
#if SUBMIT
24+
cgh.single_task(krn);
25+
#endif
26+
};
27+
#if SUBMIT
28+
q.submit(s);
29+
#endif
30+
});
31+
});
32+
return 0;
33+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: time -f "Elapsed real time: %es" %{build} -fsycl-device-only -fsyntax-only
2+
// RUN: time -f "Elapsed real time: %es" %{build} -o %t.out
3+
4+
#include <sycl/sycl.hpp>
5+
6+
int main() { return 0; }

sycl/test/e2e_test_requirements/no_sycl_hpp_in_e2e_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// REQUIRES: linux
22
//
33
// RUN: grep -r -l 'sycl.hpp' %S/../../test-e2e | FileCheck %s
4-
// RUN: grep -r -l 'sycl.hpp' %S/../../test-e2e | wc -l | FileCheck %s --check-prefix CHECK-NUM-MATCHES
4+
// RUN: grep -r -l 'sycl.hpp' %S/../../test-e2e | grep -v 'test-e2e/PerformanceTests/' | wc -l | FileCheck %s --check-prefix CHECK-NUM-MATCHES
55
//
66
// CHECK-DAG: README.md
77
// CHECK-DAG: lit.cfg.py

0 commit comments

Comments
 (0)