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

[SYCL] Add test for device default c-tor and creating a host device #845

Draft
wants to merge 1 commit into
base: intel
Choose a base branch
from
Draft
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
33 changes: 33 additions & 0 deletions SYCL/Basic/device-ctor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out
// RUN: %HOST_RUN_PLACEHOLDER %t1.out host
// RUN: %CPU_RUN_PLACEHOLDER %t1.out
// RUN: %GPU_RUN_PLACEHOLDER %t1.out
// RUN: %ACC_RUN_PLACEHOLDER %t1.out
// RUN: %t1.out

//==------ device-ctor.cpp - SYCL device default c-tor 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
//
//===----------------------------------------------------------------------===//

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

int main(int argc, const char **argv) {
bool isHost = false;

if (argc > 1)
isHost = !std::string("host").compare(argv[1]);

sycl::device Dev;
sycl::device HostDev(sycl::host_device{});

assert(!Dev.is_host() || isHost);
assert(HostDev.is_host());

return 0;
}