Skip to content

Commit

Permalink
[SYCL][E2E] Add some compile-time "tracking" tests (#16648)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aelovikov-intel authored Jan 16, 2025
1 parent 69cbf2a commit f0d0f7c
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
6 changes: 6 additions & 0 deletions sycl/test-e2e/PerformanceTests/CompileTime/core_hpp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// RUN: time -f "Elapsed real time: %es" %{build} -fsycl-device-only -fsyntax-only
// RUN: time -f "Elapsed real time: %es" %{build} -o %t.out

#include <sycl/detail/core.hpp>

int main() { return 0; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// RUN: time -f "Elapsed real time: %es" %{build} -fsycl-device-only -fsyntax-only
// RUN: time -f "Elapsed real time: %es" %{build} -fsycl-device-only -fsyntax-only -DSUBMIT

#include <sycl/detail/core.hpp>

template <int N, int M> struct compile_time_heavy_krn {
static void foo(int x = N) { compile_time_heavy_krn<N - 1, M>::foo(x); }
};

template <int M> struct compile_time_heavy_krn<0, M> {
static void foo(int x = 0) { std::ignore = x; }
};

int main() {
sycl::queue q;
q.single_task([]() { std::ignore = 42; });
sycl::detail::loop<2>([&](auto outer_idx) {
sycl::detail::loop<200>([&](auto idx) {
auto krn = [=]() {
compile_time_heavy_krn<idx * 5, outer_idx * 1000 + idx>::foo();
};
auto s = [&](sycl::handler &cgh) {
#if SUBMIT
cgh.single_task(krn);
#endif
};
#if SUBMIT
q.submit(s);
#endif
});
});
return 0;
}
6 changes: 6 additions & 0 deletions sycl/test-e2e/PerformanceTests/CompileTime/sycl_hpp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// RUN: time -f "Elapsed real time: %es" %{build} -fsycl-device-only -fsyntax-only
// RUN: time -f "Elapsed real time: %es" %{build} -o %t.out

#include <sycl/sycl.hpp>

int main() { return 0; }
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// REQUIRES: linux
//
// RUN: grep -r -l 'sycl.hpp' %S/../../test-e2e | FileCheck %s
// RUN: grep -r -l 'sycl.hpp' %S/../../test-e2e | wc -l | FileCheck %s --check-prefix CHECK-NUM-MATCHES
// RUN: grep -r -l 'sycl.hpp' %S/../../test-e2e | grep -v 'test-e2e/PerformanceTests/' | wc -l | FileCheck %s --check-prefix CHECK-NUM-MATCHES
//
// CHECK-DAG: README.md
// CHECK-DAG: lit.cfg.py
Expand Down

0 comments on commit f0d0f7c

Please sign in to comment.