Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL] Use host device explicitly and add default ctor tests #1169

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
21 changes: 21 additions & 0 deletions SYCL/Basic/default_device.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//==--------- default_device.cpp - SYCL device default ctor test -----------==//
//
// 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
//
//===----------------------------------------------------------------------===//

// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %HOST_RUN_PLACEHOLDER %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out

#include <sycl/sycl.hpp>

int main() {
sycl::device Dev;
assert(Dev == sycl::device{sycl::default_selector_v});
return 0;
}
21 changes: 21 additions & 0 deletions SYCL/Basic/default_platform.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//==------- default_platform.cpp - SYCL platform default ctor test ---------==//
//
// 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
//
//===----------------------------------------------------------------------===//

// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %HOST_RUN_PLACEHOLDER %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// RUN: %ACC_RUN_PLACEHOLDER %t.out

#include <sycl/sycl.hpp>

int main() {
sycl::platform Plt;
assert(Plt == sycl::platform{sycl::default_selector_v});
return 0;
}
4 changes: 2 additions & 2 deletions SYCL/Basic/device_equality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ int main() {
assert((dev1 == dev2) && "Device 1 == Device 2");
assert((plat1 == plat2) && "Platform 1 == Platform 2");

device h1;
device h2;
device h1{host_selector{}};
device h2{host_selector{}};

assert(h1.is_host() && "Device h1 is host");
assert(h2.is_host() && "Device h2 is host");
Expand Down
1 change: 0 additions & 1 deletion SYCL/FilterSelector/select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ int main() {
std::vector<device> GPUs;
std::vector<device> Accels;
std::vector<device> Devs;
device host;

CPUs = device::get_devices(info::device_type::cpu);
GPUs = device::get_devices(info::device_type::gpu);
Expand Down
3 changes: 1 addition & 2 deletions SYCL/USM/pointer_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ int main() {
return 0;

usm::alloc Kind;
device D;

// Test device allocs
array = (int *)malloc_device(N * sizeof(int), q);
Expand All @@ -48,7 +47,7 @@ int main() {
return 3;
}
}
D = get_pointer_device(array, ctxt);
device D = get_pointer_device(array, ctxt);
if (D != dev) {
return 4;
}
Expand Down