Skip to content
Merged
15 changes: 11 additions & 4 deletions sycl/test-e2e/AOT/multiple-devices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,34 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// End-to-End test for testing appropriate AOT-compiled device image got selected
// correctly from a fat binary built for multiple device targets

// UNSUPPORTED: *
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if its UNSUPPORTED: * is it better to just delete the test?

Copy link
Contributor Author

@YixingZhang007 YixingZhang007 Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure about this approach because in our previous "new offloading model meeting and sync ..." meeting, I think @YuriPlyakhin mentioned that we should mark this test as unsupported and add an explanation. This is because the feature being tested (AOT compilation for GPU without specifying the device name) is supported in the old offloading model but not in the new offloading model (that was a mistake in the old offloading model and should not be supported). Therefore, I thought we should keep this test so that after we switch to the new offloading model, if users wonder why we no longer support this feature or this test, they can find the explanation in the test. We could also wait until @YuriPlyakhin returns later this week to see if he has additional insights.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't usually leave disabled tests for removed features, from the meeting I thought the test was still going to run in build-only or something, maybe I misunderstood

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Yury's comment below suggested that we should mark this test as UNSUPPORTED: new-offload-model, and the test will be removed after old offloading model support is removed (since this feature is supported for old offloading model but not for new offloading model, and the current default offloading model is still the old offloading model). I have created an UNSUPPORTED-TRACKER at #20988 to track this.

// This test should not be supported because device name should be specified
// at the same time when compiling AOT of fat binary for GPU or generic SPIR-V.
// A modified test can be found at NewOffloadDriver/aot-multiple-device.cpp

// REQUIRES: opencl-aot, ocloc, any-device-is-cpu, any-device-is-gpu, target-spir, opencl-cpu-rt

// Produce a fat object for all targets (generic SPIR-V, CPU, GPU)
// RUN: %clangxx -fsycl -fsycl-targets=spir64,spir64_x86_64,spir64_gen %S/Inputs/aot.cpp -c -o %t.o

// CPU, GPU
// AOT image selection with CPU and GPU targets available
// RUN: %{run-aux} %clangxx -fsycl -fsycl-targets=spir64_x86_64,spir64_gen -Xsycl-target-backend=spir64_gen %gpu_aot_target_opts %t.o -o %t_cpu_gpu.out
// RUN: %{run} %t_cpu_gpu.out

// No AOT-compiled image for CPU
// AOT image selection with generic SPIR-V and GPU target available
// RUN: %clangxx -fsycl -fsycl-targets=spir64,spir64_gen -Xsycl-target-backend=spir64_gen %gpu_aot_target_opts %t.o -o %t_spv_gpu.out
// Check that execution on AOT-compatible devices is unaffected
// RUN: env ONEAPI_DEVICE_SELECTOR="*:gpu" %{run-unfiltered-devices} %t_spv_gpu.out

// No AOT-compiled image for GPU
// AOT image selection with generic SPIR-V and CPU target available
// RUN: %{run-aux} %clangxx -fsycl -fsycl-targets=spir64,spir64_x86_64 %t.o -o %t_spv_cpu.out
// Check that execution on AOT-compatible devices is unaffected
// RUN: env ONEAPI_DEVICE_SELECTOR="*:cpu" %{run-unfiltered-devices} %t_spv_cpu.out

// No AOT-compiled image for FPGA
// AOT image selection with all targets available (SPIR-V, CPU, GPU)
// RUN: %{run-aux} %clangxx -fsycl -fsycl-targets=spir64,spir64_x86_64,spir64_gen -Xsycl-target-backend=spir64_gen %gpu_aot_target_opts %t.o -o %t_spv_cpu_gpu.out
// Check that execution on AOT-compatible devices is unaffected
// RUN: %{run} %t_spv_cpu_gpu.out
36 changes: 36 additions & 0 deletions sycl/test-e2e/NewOffloadDriver/aot-multiple-device.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//==--------------- aot-multiple-device.cpp -------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// End-to-End test for testing appropriate AOT-compiled device image got
// selected correctly from a fat binary built for multiple device targets

// This test is copied from AOT/multiple_devices.cpp
// and modified to test with the New Offloading Model.

// REQUIRES: opencl-aot, ocloc, any-device-is-cpu, any-device-is-gpu, target-spir, opencl-cpu-rt

// Produce a fat object for all targets (generic SPIR-V, CPU, GPU)
// RUN: %{run-aux} %clangxx --offload-new-driver -fsycl -fsycl-targets=spir64,spir64_x86_64,spir64_gen -Xsycl-target-backend=spir64_gen %gpu_aot_target_opts %S/Inputs/aot.cpp -c -o %t.o

// AOT image selection with CPU and GPU targets available
// RUN: %{run-aux} %clangxx --offload-new-driver -fsycl -fsycl-targets=spir64_x86_64,spir64_gen %t.o -o %t_cpu_gpu.out
// RUN: %{run} %t_cpu_gpu.out

// AOT image selection with generic SPIR-V and GPU target available
// RUN: %{run-aux} %clangxx --offload-new-driver -fsycl -fsycl-targets=spir64,spir64_gen %t.o -o %t_spv_gpu.out
// Check that execution on AOT-compatible devices is unaffected
// RUN: env ONEAPI_DEVICE_SELECTOR="*:gpu" %{run-unfiltered-devices} %t_spv_gpu.out

// AOT image selection with generic SPIR-V and CPU target available
// RUN: %{run-aux} %clangxx --offload-new-driver -fsycl -fsycl-targets=spir64,spir64_x86_64 %t.o -o %t_spv_cpu.out
// Check that execution on AOT-compatible devices is unaffected
// RUN: env ONEAPI_DEVICE_SELECTOR="*:cpu" %{run-unfiltered-devices} %t_spv_cpu.out

// AOT image selection with all targets available (SPIR-V, CPU, GPU)
// RUN: %{run-aux} %clangxx --offload-new-driver -fsycl -fsycl-targets=spir64,spir64_x86_64,spir64_gen -Xsycl-target-backend=spir64_gen %gpu_aot_target_opts %t.o -o %t_spv_cpu_gpu.out
// Check that execution on AOT-compatible devices is unaffected
// RUN: %{run} %t_spv_cpu_gpu.out
Loading