Skip to content

Commit 2af069d

Browse files
authored
[SYCL][Fusion] Improve kernel fusion e2e tests (#14366)
Improve the kernel fusion end-to-end tests: * Remove the flag to embed IR on CUDA and AMD backend from the tests that abort execution before requiring access to IR. * Check for the number of kernel launches to make sure fusion did not fail silently. --------- Signed-off-by: Lukas Sommer <[email protected]>
1 parent 403cea0 commit 2af069d

23 files changed

+61
-43
lines changed

sycl/test-e2e/KernelFusion/cancel_fusion.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
// RUN: %{build} %{embed-ir} -o %t.out
2-
// RUN: %{run} %t.out
1+
// RUN: %{build} -o %t.out
2+
// RUN: env SYCL_PI_TRACE=2 %{run} %t.out 2>&1 | FileCheck %s
33

44
// Test cancel fusion
55

6+
// As fusion is cancelled, this test launches two kernels.
7+
// CHECK-COUNT-2: piEnqueueKernelLaunch
8+
// CHECK-NOT: piEnqueueKernelLaunch
9+
610
#include <sycl/detail/core.hpp>
711
#include <sycl/ext/codeplay/experimental/fusion_wrapper.hpp>
812
#include <sycl/properties/all_properties.hpp>

sycl/test-e2e/KernelFusion/complete_fusion.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
// RUN: %{build} %{embed-ir} -o %t.out
2-
// RUN: %{run} %t.out
2+
// RUN: env SYCL_PI_TRACE=2 %{run} %t.out 2>&1 | FileCheck %s
33

44
// Test complete fusion without any internalization
55

6+
// The two kernels are fused, so only a single, fused kernel is launched.
7+
// CHECK-COUNT-1: piEnqueueKernelLaunch
8+
// CHECK-NOT: piEnqueueKernelLaunch
9+
610
#include <sycl/detail/core.hpp>
711
#include <sycl/ext/codeplay/experimental/fusion_wrapper.hpp>
812
#include <sycl/properties/all_properties.hpp>

sycl/test-e2e/KernelFusion/cooperative_kernel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} %{embed-ir} -o %t.out
1+
// RUN: %{build} -o %t.out
22
// RUN: env SYCL_RT_WARNING_LEVEL=2 %{run} %t.out 2>&1 | FileCheck %s
33

44
// Test cooperative kernels are not fused

sycl/test-e2e/KernelFusion/different_nd_ranges.cpp

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
// RUN: %{build} -o %t.out
2-
// RUN: env SYCL_RT_WARNING_LEVEL=1 SYCL_PARALLEL_FOR_RANGE_ROUNDING_PARAMS=16:32:64 \
3-
// RUN: %{run} %t.out 2>&1 | FileCheck %s
1+
// RUN: %{build} %{embed-ir} -o %t.out
2+
// RUN: env SYCL_PI_TRACE=2 env SYCL_RT_WARNING_LEVEL=1 \
3+
// RUN: SYCL_PARALLEL_FOR_RANGE_ROUNDING_PARAMS=16:32:64 %{run} %t.out 2>&1 \
4+
// RUN: | FileCheck %s --implicit-check-not "ERROR: JIT compilation for kernel fusion failed with message:"
45

56
// Test complete fusion of kernels with different ND-ranges.
67

78
// Kernels with different ND-ranges should be fused.
8-
// CHECK-NOT: Cannot fuse kernels with different offsets or local sizes
9+
// CHECK-COUNT-26: piEnqueueKernelLaunch
10+
// CHECK-NOT: piEnqueueKernelLaunch
911

1012
#include <sycl/detail/core.hpp>
1113

@@ -252,22 +254,6 @@ int main() {
252254
const auto R5 = {5ul};
253255
test({RangeDesc{{10}, R5}, RangeDesc{{20}, R5}, RangeDesc{{30}, R5}});
254256

255-
// Two 1-D kernels with different global sizes and a 2-D kernel with more
256-
// work-items and specified (equal) local size.
257-
test({RangeDesc{{10}, R2}, RangeDesc{{20}, R2}, RangeDesc{{10, 10}, {2, 1}}});
258-
259-
// Three 2-D kernels with different global sizes.
260-
test({RangeDesc{{10, 15}, {2, 5}}, RangeDesc{{20, 10}, {2, 5}},
261-
RangeDesc{{10, 5}, {2, 5}}});
262-
263-
// Three 3-D kernels with different global sizes.
264-
test({RangeDesc{{10, 4, 2}, {5, 2, 1}}, RangeDesc{{20, 2, 4}, {5, 2, 1}},
265-
RangeDesc{{10, 2, 4}, {5, 2, 1}}});
266-
267-
// 1-D, 2-D and 3-D kernels with different global sizes.
268-
test({RangeDesc{{10}, R5}, RangeDesc{{10, 1}, {5, 1}},
269-
RangeDesc{{10, 1, 1}, {5, 1, 1}}});
270-
271257
// Test global sizes that trigger the rounded range kernel insertion.
272258
// Note that we lower the RR threshold when running this test.
273259
test({RangeDesc{67}, RangeDesc{87}, RangeDesc{64}});

sycl/test-e2e/KernelFusion/event_wait_cancel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// REQUIRES: aspect-usm_shared_allocations
2-
// RUN: %{build} %{embed-ir} -o %t.out
2+
// RUN: %{build} -o %t.out
33
// RUN: %{run} %t.out
44

55
// Test validity of events after cancel_fusion.

sycl/test-e2e/KernelFusion/internal_explicit_dependency.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
// REQUIRES: aspect-usm_shared_allocations
22
// RUN: %{build} %{embed-ir} -o %t.out
3-
// RUN: %{run} %t.out
3+
// RUN: env SYCL_PI_TRACE=2 %{run} %t.out | FileCheck %s
44

55
// Test complete fusion where one kernel in the fusion list specifies an
66
// explicit dependency (via events) on another kernel in the fusion list.
77

8+
// The two kernels are fused, so only a single, fused kernel is launched.
9+
// CHECK-COUNT-1: piEnqueueKernelLaunch
10+
// CHECK-NOT: piEnqueueKernelLaunch
11+
812
#include "fusion_event_test_common.h"
913

1014
#include <sycl/detail/core.hpp>

sycl/test-e2e/KernelFusion/jit_caching_multitarget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// REQUIRES: (gpu && (hip || cuda)), cpu
2-
// RUN: %{build} -fsycl-embed-ir -O2 -o %t.out
2+
// RUN: %{build} %{embed-ir} -O2 -o %t.out
33
// RUN: env SYCL_RT_WARNING_LEVEL=1 %{run-unfiltered-devices} %t.out 2>&1 | FileCheck %s --implicit-check-not "WRONG a VALUE" --implicit-check-not "WRONG b VALUE"
44

55
// Test caching for JIT fused kernels when devices with different architectures

sycl/test-e2e/KernelFusion/math_function.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
// RUN: %{build} %{embed-ir} -o %t.out
2-
// RUN: %{run} %t.out
2+
// RUN: env SYCL_PI_TRACE=2 %{run} %t.out | FileCheck %s
33

44
// Test fusion of a kernel using a math function.
55

6+
// The two kernels are fused, so only a single, fused kernel is launched.
7+
// CHECK-COUNT-1: piEnqueueKernelLaunch
8+
// CHECK-NOT: piEnqueueKernelLaunch
9+
610
#include <sycl/detail/core.hpp>
711

812
#include <sycl/builtins.hpp>

sycl/test-e2e/KernelFusion/non-kernel-cg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} %{embed-ir} -o %t.out
1+
// RUN: %{build} -o %t.out
22
// RUN: env SYCL_RT_WARNING_LEVEL=2 %{run} %t.out 2>&1 | FileCheck %s
33

44
// Test non-kernel device command groups are not fused

sycl/test-e2e/KernelFusion/non_unit_local_size.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
// RUN: %{build} %{embed-ir} -o %t.out
2-
// RUN: %{run} %t.out
2+
// RUN: env SYCL_PI_TRACE=2 %{run} %t.out | FileCheck %s
33

44
// Test complete fusion with local internalization specified on the
55
// accessors, where each work-item processes multiple data-items.
66

7+
// The two kernels are fused, so only a single, fused kernel is launched.
8+
// CHECK-COUNT-1: piEnqueueKernelLaunch
9+
// CHECK-NOT: piEnqueueKernelLaunch
10+
711
#include <sycl/detail/core.hpp>
812
#include <sycl/ext/codeplay/experimental/fusion_wrapper.hpp>
913
#include <sycl/properties/all_properties.hpp>

sycl/test-e2e/KernelFusion/sync_acc_mem_op.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} %{embed-ir} -o %t.out
1+
// RUN: %{build} -o %t.out
22
// RUN: env SYCL_RT_WARNING_LEVEL=1 %{run} %t.out 2>&1 | FileCheck %s
33

44
// Windows doesn't yet have full shutdown().

sycl/test-e2e/KernelFusion/sync_buffer_destruction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} %{embed-ir} -o %t.out
1+
// RUN: %{build} -o %t.out
22
// RUN: env SYCL_RT_WARNING_LEVEL=1 %{run} %t.out 2>&1 | FileCheck %s
33

44
// Windows doesn't yet have full shutdown().

sycl/test-e2e/KernelFusion/sync_event_wait.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} %{embed-ir} -o %t.out
1+
// RUN: %{build} -o %t.out
22
// RUN: env SYCL_RT_WARNING_LEVEL=1 %{run} %t.out 2>&1 | FileCheck %s
33

44
// Test fusion cancellation on event::wait() happening before

sycl/test-e2e/KernelFusion/sync_host_accessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} %{embed-ir} -o %t.out
1+
// RUN: %{build} -o %t.out
22
// RUN: env SYCL_RT_WARNING_LEVEL=1 %{run} %t.out 2>&1 | FileCheck %s
33

44
// Windows doesn't yet have full shutdown().

sycl/test-e2e/KernelFusion/sync_host_task.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} %{embed-ir} -o %t.out
1+
// RUN: %{build} -o %t.out
22
// RUN: env SYCL_RT_WARNING_LEVEL=1 %{run} %t.out 2>&1 | FileCheck %s
33

44
// Windows doesn't yet have full shutdown().

sycl/test-e2e/KernelFusion/sync_queue_destruction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} %{embed-ir} -o %t.out
1+
// RUN: %{build} -o %t.out
22
// RUN: env SYCL_RT_WARNING_LEVEL=1 %{run} %t.out 2>&1 | FileCheck %s
33

44
// Windows doesn't yet have full shutdown().

sycl/test-e2e/KernelFusion/sync_queue_wait.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} %{embed-ir} -o %t.out
1+
// RUN: %{build} -o %t.out
22
// RUN: env SYCL_RT_WARNING_LEVEL=1 %{run} %t.out 2>&1 | FileCheck %s
33

44
// Windows doesn't yet have full shutdown().

sycl/test-e2e/KernelFusion/sync_second_queue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} %{embed-ir} -o %t.out
1+
// RUN: %{build} -o %t.out
22
// RUN: env SYCL_RT_WARNING_LEVEL=1 %{run} %t.out 2>&1 | FileCheck %s
33

44
// Windows doesn't yet have full shutdown().

sycl/test-e2e/KernelFusion/sync_two_queues_requirement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// For this test, complete_fusion must be supported.
2-
// RUN: %{build} %{embed-ir} -o %t.out
2+
// RUN: %{build} -o %t.out
33
// RUN: env SYCL_RT_WARNING_LEVEL=1 %{run} %t.out 2>&1 | FileCheck %s
44

55
// Test fusion cancellation for requirement between two active fusions.

sycl/test-e2e/KernelFusion/sync_usm_mem_op.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %{build} %{embed-ir} -o %t.out
1+
// RUN: %{build} -o %t.out
22
// RUN: env SYCL_RT_WARNING_LEVEL=1 %{run} %t.out 2>&1 | FileCheck %s
33
// Windows doesn't yet have full shutdown().
44
// UNSUPPORTED: ze_debug && windows

sycl/test-e2e/KernelFusion/usm_no_dependencies.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
// REQUIRES: aspect-usm_shared_allocations
22
// RUN: %{build} %{embed-ir} -o %t.out
3-
// RUN: %{run} %t.out
3+
// RUN: env SYCL_PI_TRACE=2 %{run} %t.out | FileCheck %s
44

55
// Test complete fusion using USM pointers.
66

7+
// The two kernels are fused, so only a single, fused kernel is launched.
8+
// CHECK-COUNT-1: piEnqueueKernelLaunch
9+
// CHECK-NOT: piEnqueueKernelLaunch
10+
711
#include <sycl/detail/core.hpp>
812
#include <sycl/ext/codeplay/experimental/fusion_wrapper.hpp>
913
#include <sycl/properties/all_properties.hpp>

sycl/test-e2e/KernelFusion/work_group_barrier.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
// RUN: %{build} %{embed-ir} -o %t.out
2-
// RUN: %{run} %t.out
2+
// RUN: env SYCL_PI_TRACE=2 %{run} %t.out | FileCheck %s
33

44
// Test complete fusion with a combination of kernels that require a work-group
55
// barrier to be inserted by fusion.
66

7+
// The two kernels are fused, so only a single, fused kernel is launched.
8+
// CHECK-COUNT-1: piEnqueueKernelLaunch
9+
// CHECK-NOT: piEnqueueKernelLaunch
10+
711
#include <sycl/detail/core.hpp>
812
#include <sycl/ext/codeplay/experimental/fusion_wrapper.hpp>
913
#include <sycl/properties/all_properties.hpp>

sycl/test-e2e/KernelFusion/wrapped_usm.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
// REQUIRES: aspect-usm_shared_allocations
22
// RUN: %{build} %{embed-ir} -o %t.out
3-
// RUN: %{run} %t.out
3+
// RUN: env SYCL_PI_TRACE=2 %{run} %t.out | FileCheck %s
44

55
// Test complete fusion using an wrapped USM pointer as kernel functor argument.
66

7+
// The two kernels are fused, so only a single, fused kernel is launched.
8+
// CHECK-COUNT-1: piEnqueueKernelLaunch
9+
// CHECK-NOT: piEnqueueKernelLaunch
10+
711
#include <sycl/detail/core.hpp>
812
#include <sycl/ext/codeplay/experimental/fusion_wrapper.hpp>
913
#include <sycl/properties/all_properties.hpp>

0 commit comments

Comments
 (0)