|
| 1 | +// RUN: %clang_cl -fsycl /MD -o %t1.exe %s |
| 2 | +// RUN: %CPU_RUN_PLACEHOLDER %t1.exe |
| 3 | +// RUN: %clang_cl -fsycl /MDd -o %t2.exe %s |
| 4 | +// RUN: %CPU_RUN_PLACEHOLDER %t2.exe |
| 5 | +// RUN: %clang_cl -fsycl /MT -o %t3.exe %s |
| 6 | +// RUN: %CPU_RUN_PLACEHOLDER %t3.exe |
| 7 | +// REQUIRES: system-windows |
| 8 | +//==-------------- msvc_crt.cpp - SYCL MSVC CRT test -----------------------==// |
| 9 | +// |
| 10 | +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 11 | +// See https://llvm.org/LICENSE.txt for license information. |
| 12 | +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 13 | +// |
| 14 | +//===----------------------------------------------------------------------===// |
| 15 | +// |
| 16 | +// MSVC provides two different incompatible variants of CRT: debug and release. |
| 17 | +// This test checks if clang driver is able to handle this properly. |
| 18 | + |
| 19 | +#include <CL/sycl.hpp> |
| 20 | + |
| 21 | +using namespace cl::sycl; |
| 22 | + |
| 23 | +int main() { |
| 24 | + int data[] = {0, 0, 0}; |
| 25 | + |
| 26 | + { |
| 27 | + buffer<int, 1> b(data, range<1>(3), {property::buffer::use_host_ptr()}); |
| 28 | + queue q; |
| 29 | + q.submit([&](handler &cgh) { |
| 30 | + auto B = b.get_access<access::mode::write>(cgh); |
| 31 | + cgh.parallel_for<class test>(range<1>(3), [=](id<1> idx) { |
| 32 | + B[idx] = 1; |
| 33 | + }); |
| 34 | + }); |
| 35 | + } |
| 36 | + |
| 37 | + bool isSuccess = true; |
| 38 | + |
| 39 | + for (int i = 0; i < 3; i++) |
| 40 | + if (data[i] != 1) isSuccess = false; |
| 41 | + |
| 42 | + if (!isSuccess) |
| 43 | + return -1; |
| 44 | + |
| 45 | + return 0; |
| 46 | +} |
0 commit comments