Skip to content

[SYCL][CUDA] Fix LIT fails on machines without non-NVIDIA OpenCL #1613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sycl/test/Unit/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ def find_shlibpath_var():
else:
lit_config.warning("unable to inject shared library path on '{}'"
.format(platform.system()))

config.environment['SYCL_BE'] = lit_config.params.get('SYCL_BE', "PI_OPENCL")
lit_config.note("Backend (SYCL_BE): {}".format(config.environment['SYCL_BE']))
28 changes: 14 additions & 14 deletions sycl/test/basic_tests/diagnostics/device-check.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: env SYCL_DEVICE_TYPE=cpu %t.out
// RUN: env SYCL_DEVICE_TYPE=gpu %t.out
// RUN: env SYCL_DEVICE_TYPE=acc %t.out
// RUN: env SYCL_DEVICE_TYPE=host %t.out
// RUN: env SYCL_DEVICE_TYPE=CPU %t.out
// RUN: env SYCL_DEVICE_TYPE=GPU %t.out
// RUN: env SYCL_DEVICE_TYPE=ACC %t.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
// RUN: env SYCL_DEVICE_TYPE=Cpu %t.out
// RUN: env SYCL_DEVICE_TYPE=Gpu %t.out
// RUN: env SYCL_DEVICE_TYPE=Acc %t.out
// RUN: env SYCL_DEVICE_TYPE=Host %t.out
// RUN: env SYCL_DEVICE_TYPE=XPU %t.out
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=cpu %t.out
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=gpu %t.out
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=acc %t.out
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=host %t.out
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=CPU %t.out
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=GPU %t.out
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=ACC %t.out
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=HOST %t.out
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=Cpu %t.out
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=Gpu %t.out
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=Acc %t.out
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=Host %t.out
// RUN: env SYCL_BE=%sycl_be SYCL_DEVICE_TYPE=XPU %t.out

//==------------------- device-check.cpp --------------------------==//
// This is a diagnostic test which ensures that
Expand Down
13 changes: 6 additions & 7 deletions sycl/test/basic_tests/diagnostics/handler.cpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %t.out | FileCheck %s
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: env SYCL_BE=%sycl_be %t.out | FileCheck %s
//==------------------- handler.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
//
//===----------------------------------------------------------------------===//

#include <CL/sycl.hpp>
#include <cassert>

using namespace cl;

int main() {

bool Failed = false;

sycl::queue Queue([](sycl::exception_list ExceptionList) {
if (ExceptionList.size() != 1) {
std::cerr << "Should be one exception in exception list" << std::endl;
Expand All @@ -30,8 +28,9 @@ int main() {
CGH.single_task<class Dummy2>([]() {});
});
Queue.throw_asynchronous();
} catch (sycl::exception &E) {
assert(!"Expected exception not caught");
} catch (sycl::exception &ExpectedException) {
// CHECK: Attempt to set multiple actions for the command group
std::cout << E.what() << std::endl;
std::cout << ExpectedException.what() << std::endl;
}
}
6 changes: 3 additions & 3 deletions sycl/test/basic_tests/get_nonhost_devices.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %t.out

// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: env SYCL_BE=%sycl_be %t.out
//
// Check that the host device is not included in devices returned by
// get_devices() if a non-host device type is specified.

Expand Down
3 changes: 1 addition & 2 deletions sycl/test/basic_tests/queue.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
// RUN: %t.out
// RUN: env SYCL_BE=%sycl_be %t.out
//==--------------- queue.cpp - SYCL queue test ----------------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Expand Down
3 changes: 2 additions & 1 deletion sycl/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
llvm_config.add_tool_substitutions(['llvm-spirv'], [config.sycl_tools_dir])

backend=lit_config.params.get('SYCL_BE', "PI_OPENCL")
lit_config.note("Backend: {BACKEND}".format(BACKEND=backend))
lit_config.note("Backend (SYCL_BE): {}".format(backend))
config.substitutions.append( ('%sycl_be', backend) )

get_device_count_by_type_path = os.path.join(config.llvm_tools_dir, "get_device_count_by_type")

Expand Down