diff --git a/sycl/test/basic_tests/accessor/accessor_property_list_rt.cpp b/sycl/test/basic_tests/accessor/accessor_property_list_rt.cpp index 1fc8384407043..2c28b0bc4a4cf 100644 --- a/sycl/test/basic_tests/accessor/accessor_property_list_rt.cpp +++ b/sycl/test/basic_tests/accessor/accessor_property_list_rt.cpp @@ -1,5 +1,5 @@ // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: %RUN_ON_HOST %t.out +// RUN: %t.out #include diff --git a/sycl/test/basic_tests/built-ins.cpp b/sycl/test/basic_tests/built-ins.cpp deleted file mode 100644 index 9b13464678e51..0000000000000 --- a/sycl/test/basic_tests/built-ins.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: %RUN_ON_HOST %t.out - -// CUDA does not support printf. -// UNSUPPORTED: cuda -// -// Hits an assertion with AMD: -// XFAIL: hip_amd - -#include - -#include - -namespace s = sycl; - -// According to OpenCL C spec, the format string must be in constant address -// space -#ifdef __SYCL_DEVICE_ONLY__ -#define CONSTANT __attribute__((opencl_constant)) -#else -#define CONSTANT -#endif - -static const CONSTANT char format[] = "Hello, World! %d %f\n"; - -int main() { - s::queue q{}; - - // Test printf - q.submit([&](s::handler &CGH) { - CGH.single_task([=]() { - s::ext::oneapi::experimental::printf(format, 123, 1.23); - // CHECK: {{(Hello, World! 123 1.23)?}} - }); - }).wait(); - - s::ext::oneapi::experimental::printf(format, 321, 3.21); - // CHECK: {{(Hello, World! 123 1.23)?}} - - // Test common - { - s::buffer BufMin(s::range<1>(1)); - s::buffer BufMax(s::range<1>(1)); - q.submit([&](s::handler &cgh) { - auto AccMin = BufMin.get_access(cgh); - auto AccMax = BufMax.get_access(cgh); - cgh.single_task([=]() { - AccMax[0] = s::max(s::cl_float2{0.5f, 2.5}, s::cl_float2{2.3f, 2.3}); - AccMin[0] = s::min(s::cl_float{0.5f}, s::cl_float{2.3f}); - }); - }); - - auto AccMin = BufMin.template get_access(); - auto AccMax = BufMax.template get_access(); - - assert(AccMin[0] == 0.5); - assert(AccMax[0].x() == 2.3f && AccMax[0].y() == 2.5f); - assert(s::min(0.5f, 2.3f) == 0.5); - auto Res = s::max(s::int4{5, 2, 1, 5}, s::int4{3, 3, 4, 2}); - assert(Res.x() == 5 && Res.y() == 3 && Res.z() == 4 && Res.w() == 5); - } - - return 0; -} diff --git a/sycl/test/basic_tests/context.cpp b/sycl/test/basic_tests/context.cpp deleted file mode 100644 index 38b8dcbab5d1f..0000000000000 --- a/sycl/test/basic_tests/context.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// RUN: %clangxx -fsycl %s -o %t.out -// RUN: %RUN_ON_HOST %t.out - -// This test performs basic check of the SYCL context class. - -#include -#include - -using namespace sycl; - -int main() { - try { - context c; - } catch (device_error e) { - std::cout << "Failed to create device for context" << std::endl; - } - - auto devices = device::get_devices(); - device &deviceA = devices[0]; - device &deviceB = (devices.size() > 1 ? devices[1] : devices[0]); - { - std::cout << "move constructor" << std::endl; - context Context(deviceA); - size_t hash = std::hash()(Context); - context MovedContext(std::move(Context)); - assert(hash == std::hash()(MovedContext)); - assert(deviceA.is_host() == MovedContext.is_host()); - } - { - std::cout << "move assignment operator" << std::endl; - context Context(deviceA); - size_t hash = std::hash()(Context); - context WillMovedContext(deviceB); - WillMovedContext = std::move(Context); - assert(hash == std::hash()(WillMovedContext)); - assert(deviceA.is_host() == WillMovedContext.is_host()); - } - { - std::cout << "copy constructor" << std::endl; - context Context(deviceA); - size_t hash = std::hash()(Context); - context ContextCopy(Context); - assert(hash == std::hash()(Context)); - assert(hash == std::hash()(ContextCopy)); - assert(Context == ContextCopy); - assert(Context.is_host() == ContextCopy.is_host()); - } - { - std::cout << "copy assignment operator" << std::endl; - context Context(deviceA); - size_t hash = std::hash()(Context); - context WillContextCopy(deviceB); - WillContextCopy = Context; - assert(hash == std::hash()(Context)); - assert(hash == std::hash()(WillContextCopy)); - assert(Context == WillContextCopy); - assert(Context.is_host() == WillContextCopy.is_host()); - } - { - auto AsyncHandler = [](const sycl::exception_list &EL) {}; - sycl::context Context1(sycl::property_list{}); - sycl::context Context2(AsyncHandler, sycl::property_list{}); - sycl::context Context3(deviceA, sycl::property_list{}); - sycl::context Context4(deviceA, AsyncHandler, sycl::property_list{}); - sycl::context Context5(deviceA.get_platform(), sycl::property_list{}); - sycl::context Context6(deviceA.get_platform(), AsyncHandler, - sycl::property_list{}); - sycl::context Context7(std::vector{deviceA}, - sycl::property_list{}); - sycl::context Context8( - std::vector{deviceA}, AsyncHandler, - sycl::property_list{ - sycl::ext::oneapi::cuda::property::context::use_primary_context{}}); - - if (!Context8.has_property< - sycl::ext::oneapi::cuda::property::context::use_primary_context>()) { - std::cerr << "Line " << __LINE__ << ": Property was not found" - << std::endl; - return 1; - } - - auto Prop = Context8.get_property(); - } -} diff --git a/sycl/test/basic_tests/device.cpp b/sycl/test/basic_tests/device.cpp deleted file mode 100644 index b313fcf8c173c..0000000000000 --- a/sycl/test/basic_tests/device.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// RUN: %clangxx -fsycl %s -o %t.out -// RUN: %RUN_ON_HOST %t.out - -// This test performs basic check of the SYCL device class. - -#include -#include -#include -#include - -using namespace sycl; - -std::string get_type(const device &dev) { - if (dev.is_host()) { - return "host"; - } else if (dev.is_gpu()) { - return "OpenCL.GPU"; - } else if (dev.is_accelerator()) { - return "OpenCL.ACC"; - } else { - return "OpenCL.CPU"; - } -} - -int main() { - device d; - std::cout << "Default device type: " << get_type(d) << std::endl; - - int i = 1; - std::cout << "Get all devices in the system" << std::endl; - for (const auto &dev : device::get_devices()) { - std::cout << "Device " << i++ << " is available: " << get_type(dev) - << std::endl; - } - i = 1; - std::cout << "Get host devices in the system" << std::endl; - for (const auto &dev : device::get_devices(info::device_type::host)) { - std::cout << "Device " << i++ << " is available: " << get_type(dev) - << std::endl; - } - i = 1; - std::cout << "Get OpenCL.CPU devices in the system" << std::endl; - for (const auto &dev : device::get_devices(info::device_type::cpu)) { - std::cout << "Device " << i++ << " is available: " << get_type(dev) - << std::endl; - } - i = 1; - std::cout << "Get OpenCL.GPU devices in the system" << std::endl; - for (const auto &dev : device::get_devices(info::device_type::gpu)) { - std::cout << "Device " << i++ << " is available: " << get_type(dev) - << std::endl; - } - i = 1; - std::cout << "Get OpenCL.ACC devices in the system" << std::endl; - for (const auto &dev : device::get_devices(info::device_type::accelerator)) { - std::cout << "Device " << i++ << " is available: " << get_type(dev) - << std::endl; - } - - auto devices = device::get_devices(); - device &deviceA = devices[0]; - device &deviceB = (devices.size() > 1 ? devices[1] : devices[0]); - { - std::cout << "move constructor" << std::endl; - device Device(deviceA); - size_t hash = std::hash()(Device); - device MovedDevice(std::move(Device)); - assert(hash == std::hash()(MovedDevice)); - assert(deviceA.is_host() == MovedDevice.is_host()); - } - { - std::cout << "move assignment operator" << std::endl; - device Device(deviceA); - size_t hash = std::hash()(Device); - device WillMovedDevice(deviceB); - WillMovedDevice = std::move(Device); - assert(hash == std::hash()(WillMovedDevice)); - assert(deviceA.is_host() == WillMovedDevice.is_host()); - } - { - std::cout << "copy constructor" << std::endl; - device Device(deviceA); - size_t hash = std::hash()(Device); - device DeviceCopy(Device); - assert(hash == std::hash()(Device)); - assert(hash == std::hash()(DeviceCopy)); - assert(Device == DeviceCopy); - assert(Device.is_host() == DeviceCopy.is_host()); - } - { - std::cout << "copy assignment operator" << std::endl; - device Device(deviceA); - size_t hash = std::hash()(Device); - device WillDeviceCopy(deviceB); - WillDeviceCopy = Device; - assert(hash == std::hash()(Device)); - assert(hash == std::hash()(WillDeviceCopy)); - assert(Device == WillDeviceCopy); - assert(Device.is_host() == WillDeviceCopy.is_host()); - } -} - diff --git a/sycl/test/basic_tests/event_async_exception.cpp b/sycl/test/basic_tests/event_async_exception.cpp deleted file mode 100644 index 5064952341261..0000000000000 --- a/sycl/test/basic_tests/event_async_exception.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// RUN: %clangxx -fsycl %s -o %t.out -// RUN: %RUN_ON_HOST %t.out - -//==---- event_async_exception.cpp - Test for event async exceptions -------==// -// -// 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 - -// This test checks that if there is a submit failure, the asynchronous -// exception is associated with the returned event. - -using namespace sycl; - -class KernelName; - -int main() { - auto asyncHandler = [](exception_list el) { - for (auto &e : el) { - std::rethrow_exception(e); - } - }; - - queue q(asyncHandler); - - try { - // Check that submitting a CG with no kernel or memory operation doesn't produce - // an async exception - event e = q.submit([&](handler &cgh) {}); - - e.wait_and_throw(); - return 0; - } catch (runtime_error e) { - return 1; - } -} diff --git a/sycl/test/basic_tests/exceptions-SYCL-2020.cpp b/sycl/test/basic_tests/exceptions-SYCL-2020.cpp index 6821fde06eefd..4b351880c7b63 100644 --- a/sycl/test/basic_tests/exceptions-SYCL-2020.cpp +++ b/sycl/test/basic_tests/exceptions-SYCL-2020.cpp @@ -1,5 +1,5 @@ // RUN: %clangxx -fsycl %s -o %t.out -// RUN: %RUN_ON_HOST %t.out +// RUN: %t.out #include diff --git a/sycl/test/basic_tests/host_image_accessor_read.cpp b/sycl/test/basic_tests/host_image_accessor_read.cpp index eb53b730dfdcb..b70e1a3a76761 100644 --- a/sycl/test/basic_tests/host_image_accessor_read.cpp +++ b/sycl/test/basic_tests/host_image_accessor_read.cpp @@ -1,5 +1,5 @@ -// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: %RUN_ON_HOST %t.out +// RUN: %clangxx -fsycl %s -o %t.out +// RUN: %t.out //==---- host_image_accessor_read.cpp - SYCL host image accessor check ----==// // @@ -22,7 +22,6 @@ int foo(float *image_data) { sycl::range<3> r(3, 3, 3); { sycl::buffer ResultBuf(result, sycl::range<1>(2)); - sycl::queue Q; sycl::image<3> Image(image_data, channelOrder, channelType, r); sycl::range<2> pitch = Image.get_pitch(); diff --git a/sycl/test/basic_tests/known_identity.cpp b/sycl/test/basic_tests/known_identity.cpp index edfc8810eb33a..e047928a286af 100644 --- a/sycl/test/basic_tests/known_identity.cpp +++ b/sycl/test/basic_tests/known_identity.cpp @@ -1,5 +1,5 @@ // RUN: %clangxx -fsycl -Xclang -verify %s -Xclang -verify-ignore-unexpected=note,warning -o %t.out -std=c++17 -// RUN: %RUN_ON_HOST %t.out +// RUN: %t.out // expected-no-diagnostics // This test performs basic checks of has_known_identity and known_identity diff --git a/sycl/test/basic_tests/linear-host-dev.cpp b/sycl/test/basic_tests/linear-host-dev.cpp deleted file mode 100644 index 75e80c3461ef6..0000000000000 --- a/sycl/test/basic_tests/linear-host-dev.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// RUN: %clangxx -fsycl %s -o %t.out -// RUN: %RUN_ON_HOST %t.out | FileCheck %s - -#include -#include -#include -#include - -// Check that linear id is monotonically increased on host device. -// Only there we can reliable check that. Since the kernel has a restriction -// regarding usage of global variables, use stream to log the linear id -// and ensure that they're monotonically increased. -// -// Note: This test heavily relies on the current implementation of -// host device(single-threaded ordered execution). So if the implementation -// is somehow changed so it's no longer possible to run this test reliable -// it can be removed. - -namespace s = sycl; - -int main(int argc, char *argv[]) { - s::queue q; - - const size_t outer = 3; - const size_t inner = 2; - const s::range<2> rng = {outer, inner}; - - q.submit([&](s::handler &h) { - s::stream out(1024, 80, h); - - h.parallel_for(s::range<2>(rng), [=](s::item<2> item) { - // CHECK: 0 - // CHECK-NEXT: 1 - // CHECK-NEXT: 2 - // CHECK-NEXT: 3 - // CHECK-NEXT: 4 - // CHECK-NEXT: 5 - out << item.get_linear_id() << sycl::endl; - }); - }); - q.wait(); - - return 0; -} diff --git a/sycl/test/basic_tests/marray/marray.cpp b/sycl/test/basic_tests/marray/marray.cpp index 3e69d98ad61a8..40905edc4e078 100755 --- a/sycl/test/basic_tests/marray/marray.cpp +++ b/sycl/test/basic_tests/marray/marray.cpp @@ -1,5 +1,5 @@ // RUN: %clangxx -fsycl %s -o %t.out -// RUN: %RUN_ON_HOST %t.out +// RUN: %t.out //==--------------- marray.cpp - SYCL marray test --------------------------==// // diff --git a/sycl/test/basic_tests/offset-accessor-get_pointer.cpp b/sycl/test/basic_tests/offset-accessor-get_pointer.cpp deleted file mode 100644 index e0b6941e4787e..0000000000000 --- a/sycl/test/basic_tests/offset-accessor-get_pointer.cpp +++ /dev/null @@ -1,113 +0,0 @@ -// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: %RUN_ON_HOST %t.out - -// Per the SYCL 2020 spec (4.7.6.12 and others) -// accessor::get_pointer() returns a pointer to the start of this accessor’s -// memory. For a buffer accessor this is a pointer to the start of the -// underlying buffer, even if this is a ranged accessor whose range does not -// start at the beginning of the buffer. - -// This is a departure from how get_pointer() was interpreted with offset -// accessors in the past. Not relevant for images, which do not support offset -// accessors. - -#include -#include -using namespace sycl; - -void test_across_ranges() { - constexpr auto r_w = access::mode::read_write; - constexpr unsigned long width = 4; - constexpr unsigned long count = width * width; - constexpr unsigned long count3D = width * width * width; // 64 - std::vector v1(count); // for 1D testing. - std::vector v2(count); // for 2D testing. - std::vector v3(count3D); // 3D - - range<1> range_1D(count); - range<2> range_2D(width, width); - range<3> range_3D(width, width, width); - - queue myQueue; - { - // 1D, 2D, 3D - buffer buf_1D(v1.data(), count); - buffer buf_2D(v2.data(), range_2D); - buffer buf_3D(v3.data(), range_3D); - - myQueue.submit([&](handler &cgh) { - auto acc_1D = buf_1D.get_access(cgh, {2}, {10}); - auto acc_2D = buf_2D.get_access(cgh, {2, 2}, {1, 1}); - auto acc_3D = buf_3D.get_access(cgh, {2, 2, 2}, {1, 1, 1}); - cgh.single_task([=] { - acc_1D.get_pointer()[0] = 5; // s.b. offset 0 - acc_1D[0] = 15; // s.b. offset 10 - - // 2D - acc_2D.get_pointer()[0] = 7; // s.b. offset 0 - acc_2D[{0, 0}] = 17; // s.b. offset {1,1} aka 5 if linear. - - // 3D - acc_3D.get_pointer()[0] = 9; // s.b. offset 0 - acc_3D[{0, 0, 0}] = 19; // s.b. offset {1,1,1} aka 21 if linear. - }); - }); - myQueue.wait(); - // now host access - we offset by one more than the device test - auto acc_1D = buf_1D.get_access({2}, {11}); - auto acc_2D = buf_2D.get_access({2, 2}, {1, 2}); - auto acc_3D = buf_3D.get_access({2, 2, 2}, {1, 1, 2}); - acc_1D.get_pointer()[1] = 4; // s.b. offset 1 - acc_1D[0] = 14; // s.b. offset 11 - - // 2D - acc_2D.get_pointer()[1] = 6; // s.b. offset 1 - acc_2D[{0, 0}] = 16; // s.b. offset {1,2} aka 6 if linear. - - // 3D - acc_3D.get_pointer()[1] = 8; // s.b. offset 1 - acc_3D[{0, 0, 0}] = 18; // s.b. offset {1,1,2} aka 22 if linear. - } //~buffer - // always nice to have some feedback - std::cout << "DEVICE" << std::endl; - std::cout << "1D CHECK: v1[0] should be 5: " << v1[0] - << ", and v1[10] s.b. 15: " << v1[10] << std::endl; - std::cout << "2D CHECK: v2[0] should be 7: " << v2[0] - << ", and v2[5] s.b. 17: " << v2[5] << std::endl; - std::cout << "3D CHECK: v3[0] should be 9: " << v3[0] - << ", and v3[21] s.b. 19: " << v3[21] << std::endl - << std::endl; - - std::cout << "HOST" << std::endl; - std::cout << "1D CHECK: v1[1] should be 4: " << v1[1] - << ", and v1[11] s.b. 14: " << v1[11] << std::endl; - std::cout << "2D CHECK: v2[1] should be 6: " << v2[1] - << ", and v2[6] s.b. 16: " << v2[6] << std::endl; - std::cout << "3D CHECK: v3[1] should be 8: " << v3[1] - << ", and v3[22] s.b. 17: " << v3[22] << std::endl - << std::endl; - - // device - assert(v1[0] == 5); - assert(v1[10] == 15); - assert(v2[0] == 7); - assert(v2[5] == 17); // offset {1,1} in a 4x4 field is linear offset 5 - assert(v3[0] == 9); - assert(v3[21] == 19); // offset {1,1,1} in a 4x4x4 field is linear offset 21 - - // host - assert(v1[1] == 4); - assert(v1[11] == 14); - assert(v2[1] == 6); - assert(v2[6] == 16); // offset {1,2} in a 4x4 field is linear offset 6 - assert(v3[1] == 8); - assert(v3[22] == 18); // offset {1,1,2} in a 4x4x4 field is linear offset 22 -} - -int main() { - test_across_ranges(); - - std::cout << "OK!" << std::endl; - - return 0; -} diff --git a/sycl/test/basic_tests/parallel_for_range_host.cpp b/sycl/test/basic_tests/parallel_for_range_host.cpp deleted file mode 100644 index 81f14ec55920a..0000000000000 --- a/sycl/test/basic_tests/parallel_for_range_host.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// RUN: %clangxx -fsycl %s -o %t.out -// RUN: %RUN_ON_HOST %t.out - -#include - -#include - -using namespace sycl; - -int main() { - auto AsyncHandler = [](exception_list ES) { - for (auto& E : ES) { - std::rethrow_exception(E); - } - }; - - queue Q(AsyncHandler); - - // parallel_for, offset - try { - Q.submit([&](handler &CGH) { - CGH.parallel_for(range<1>(1), id<1>(16), - [=](id<1> ID) { assert(ID == 16); }); - }); - Q.submit([&](handler &CGH) { - CGH.parallel_for(range<2>(1, 1), id<2>(16, 17), - [=](id<2> ID) { - assert(ID[0] == 16); - assert(ID[1] == 17); - }); - }); - Q.submit([&](handler &CGH) { - CGH.parallel_for(range<3>(1, 1, 1), id<3>(16, 17, 18), - [=](id<3> ID) { - assert(ID[0] == 16); - assert(ID[1] == 17); - assert(ID[2] == 18); - }); - }); - Q.wait_and_throw(); - } catch (nd_range_error) { - std::cerr << "Test case 'offset' failed: exception has been thrown" - << std::endl; - return 1; - } - - // parallel_for, 100 global, 3 local -> fail. - try { - Q.submit([&](handler &CGH) { - CGH.parallel_for(nd_range<1>(range<1>(100), range<1>(3)), - [=](nd_item<1>) {}); - }); - Q.wait_and_throw(); - std::cerr << "Test case 'a' failed: no exception has been thrown" - << std::endl; - return 1; - } catch (nd_range_error) { - // We expect an error to be thrown! - } - - // parallel_for, 100 global, 4 local -> pass. - try { - Q.submit([&](handler &CGH) { - CGH.parallel_for(nd_range<1>(range<1>(100), range<1>(4)), - [=](nd_item<1>) {}); - }); - Q.wait_and_throw(); - } catch (nd_range_error) { - std::cerr << "Test case 'b' failed: exception has been thrown" << std::endl; - return 1; - } - - // parallel_for, (100, 33, 16) global, (2, 3, 4) local -> pass. - try { - Q.submit([&](handler &CGH) { - CGH.parallel_for(nd_range<3>(range<3>(100, 33, 16), - range<3>(2, 3, 4)), - [=](nd_item<3>) {}); - }); - Q.wait_and_throw(); - } catch (nd_range_error) { - std::cerr << "Test case 'c' failed: exception has been thrown" << std::endl; - return 1; - } - - // parallel_for, (100, 33, 16) global, (2, 3, 5) local -> fail. - try { - Q.submit([&](handler &CGH) { - CGH.parallel_for(nd_range<3>(range<3>(100, 33, 16), - range<3>(2, 3, 5)), - [=](nd_item<3>) {}); - }); - Q.wait_and_throw(); - std::cerr << "Test case 'd' failed: no exception has been thrown" - << std::endl; - return 1; - } catch (nd_range_error) { - } - - // local size has a 0-based range -- no SIGFPEs, we hope. - try { - Q.submit([&](handler &CGH) { - CGH.parallel_for(nd_range<2>(range<2>(5, 33), range<2>(1, 0)), - [=](nd_item<2>) {}); - }); - Q.wait_and_throw(); - std::cerr << "Test case 'e' failed: no exception has been thrown" - << std::endl; - return 1; - } catch (nd_range_error) { - } - - // parallel_for_work_group with 0-based local range. - try { - Q.submit([&](handler &CGH) { - CGH.parallel_for_work_group(range<2>(5, 33), range<2>(1, 0), - [=](group<2>) {}); - }); - Q.wait_and_throw(); - std::cerr << "Test case 'f' failed: no exception has been thrown" - << std::endl; - return 1; - } catch (nd_range_error) { - } - - // parallel_for, 30 global, 1(implicit) local -> pass. - try { - Q.submit([&](handler &CGH) { - CGH.parallel_for(range<1>(30), - [=](id<1>) {}); - }); - Q.wait_and_throw(); - } catch (nd_range_error) { - std::cerr << "Test case 'g' failed: exception has been thrown" << std::endl; - return 1; - } - return 0; -} diff --git a/sycl/test/basic_tests/parallel_for_user_types.cpp b/sycl/test/basic_tests/parallel_for_user_types.cpp index b050ed2b778d4..c04749f36c1db 100644 --- a/sycl/test/basic_tests/parallel_for_user_types.cpp +++ b/sycl/test/basic_tests/parallel_for_user_types.cpp @@ -1,5 +1,4 @@ -// RUN: %clangxx -fsycl %s -o %t.out -// RUN: %RUN_ON_HOST %t.out +// RUN: %clangxx -fsycl %s -c -o %t.o // This test performs basic check of supporting user defined class that are // implicitly converted from sycl::item/sycl::nd_item in parallel_for. diff --git a/sycl/test/basic_tests/property_list.cpp b/sycl/test/basic_tests/property_list.cpp index d28b98cca9d2d..199870b0c8829 100644 --- a/sycl/test/basic_tests/property_list.cpp +++ b/sycl/test/basic_tests/property_list.cpp @@ -1,7 +1,5 @@ // RUN: %clangxx -fsycl %s -o %t.out -// RUN: %RUN_ON_HOST %t.out -// -// CHECK: PASSED +// RUN: %t.out // This test performs basic check of the SYCL property_list class. diff --git a/sycl/test/basic_tests/reduction_ctor.cpp b/sycl/test/basic_tests/reduction_ctor.cpp deleted file mode 100644 index 655be96e023d9..0000000000000 --- a/sycl/test/basic_tests/reduction_ctor.cpp +++ /dev/null @@ -1,166 +0,0 @@ -// RUN: %clangxx -fsycl %s -o %t.out -// RUN: %RUN_ON_HOST %t.out - -// This performs basic checks such as reduction creation, getIdentity() method, -// and the combine() method of the aux class 'reducer'. - -#include "reduction_utils.hpp" -#include -#include - -using namespace sycl; - -bool toBool(bool V) { return V; } -bool toBool(vec V) { return V.x() && V.y(); } -bool toBool(vec V) { return V.x() && V.y() && V.z() && V.w(); } - -template -void test_reducer(Reduction &Redu, T A, T B) { - typename Reduction::reducer_type Reducer; - Reducer.combine(A); - Reducer.combine(B); - - typename Reduction::binary_operation BOp; - T ExpectedValue = BOp(A, B); - assert(ExpectedValue == Reducer.MValue && - "Wrong result of binary operation."); -} - -template -void test_reducer(Reduction &Redu, T Identity, BinaryOperation BOp, T A, T B) { - typename Reduction::reducer_type Reducer(Identity, BOp); - Reducer.combine(A); - Reducer.combine(B); - - T ExpectedValue = BOp(A, B); - assert(toBool(ExpectedValue == Reducer.MValue) && - "Wrong result of binary operation."); -} - -template class KernelNameGroup; - -template -void testKnown(T Identity, BinaryOperation BOp, T A, T B) { - static_assert(has_known_identity::value); - queue Q; - buffer ReduBuf(1); - T *ReduUSMPtr = malloc_host(1, Q); - - Q.submit([&](handler &CGH) { - // Reduction needs a device accessor as a parameter. - // This accessor is not really used in this test. - accessor - ReduRWAcc(ReduBuf, CGH); - accessor - ReduDWAcc(ReduBuf, CGH); - auto Redu = sycl::reduction(ReduBuf, CGH, BOp); - auto ReduUSM = sycl::reduction(ReduUSMPtr, BOp); - - assert(toBool(Redu.getIdentity() == Identity) && - toBool(ReduUSM.getIdentity() == Identity) && - toBool(known_identity::value == Identity) && - "Failed getIdentity() check()."); - test_reducer(Redu, A, B); - test_reducer(ReduUSM, A, B); - - test_reducer(Redu, Identity, BOp, A, B); - test_reducer(ReduUSM, Identity, BOp, A, B); - - // Command group must have at least one task in it. Use an empty one. - CGH.single_task([=]() {}); - }); - free(ReduUSMPtr, Q); -} - -template -void testUnknown(T Identity, BinaryOperation BOp, T A, T B) { - queue Q; - buffer ReduBuf(1); - T *ReduUSMPtr = malloc_host(1, Q); - Q.submit([&](handler &CGH) { - // Reduction needs a device accessor as a parameter. - // This accessor is not really used in this test. - accessor - ReduRWAcc(ReduBuf, CGH); - accessor - ReduDWAcc(ReduBuf, CGH); - auto Redu = sycl::reduction(ReduBuf, CGH, Identity, BOp); - auto ReduUSM = sycl::reduction(ReduUSMPtr, Identity, BOp); - assert(toBool(Redu.getIdentity() == Identity) && - toBool(ReduUSM.getIdentity() == Identity) && - "Failed getIdentity() check()."); - test_reducer(Redu, Identity, BOp, A, B); - test_reducer(ReduUSM, Identity, BOp, A, B); - - // Command group must have at least one task in it. Use an empty one. - CGH.single_task([=]() {}); - }); - free(ReduUSMPtr, Q); -} - -template -void testBoth(T Identity, BinaryOperation BOp, T A, T B) { - testKnown, - T, 0>(Identity, BOp, A, B); - testKnown< - KernelNameGroup, - T, 1>(Identity, BOp, A, B); - testUnknown< - KernelNameGroup, T, - 0>(Identity, BOp, A, B); - testUnknown, - T, 1>(Identity, BOp, A, B); -} - -int main() { - testBoth( - 0, ext::oneapi::plus(), 1, 7); - testBoth(1, std::multiplies(), 1, 7); - testBoth( - 0, ext::oneapi::bit_or(), 1, 8); - testBoth( - 0, ext::oneapi::bit_xor(), 7, 3); - testBoth( - ~0, ext::oneapi::bit_and(), 7, 3); - testBoth( - (std::numeric_limits::max)(), ext::oneapi::minimum(), 7, 3); - testBoth((std::numeric_limits::min)(), - ext::oneapi::maximum(), 7, 3); - - testBoth( - 0, ext::oneapi::plus(), 1, 7); - testBoth( - 1, std::multiplies(), 1, 7); - testBoth( - getMaximumFPValue(), ext::oneapi::minimum(), 7, 3); - testBoth( - getMinimumFPValue(), ext::oneapi::maximum(), 7, 3); - - testUnknown, 0, - CustomVecPlus>(CustomVec(0), CustomVecPlus(), - CustomVec(1), CustomVec(7)); - testUnknown, 1>( - CustomVec(0), CustomVecPlus(), CustomVec(1), - CustomVec(7)); - - testUnknown( - 0, [](auto a, auto b) { return a | b; }, 1, 8); - - int2 IdentityI2 = {0, 0}; - int2 AI2 = {1, 2}; - int2 BI2 = {7, 13}; - testUnknown(IdentityI2, ext::oneapi::plus(), AI2, - BI2); - - float4 IdentityF4 = {0, 0, 0, 0}; - float4 AF4 = {1, 2, -1, -34}; - float4 BF4 = {7, 13, 0, 35}; - testUnknown(IdentityF4, ext::oneapi::plus<>(), AF4, - BF4); - - std::cout << "Test passed\n"; - return 0; -} diff --git a/sycl/test/basic_tests/reduction_utils.hpp b/sycl/test/basic_tests/reduction_utils.hpp deleted file mode 100644 index 88198d6cb146b..0000000000000 --- a/sycl/test/basic_tests/reduction_utils.hpp +++ /dev/null @@ -1,68 +0,0 @@ -#include - -using namespace sycl; - -// Initializes 'InBuf' buffer with pseudo-random values, computes the reduction -// value for the buffer and writes it to 'ExpectedOut'. -template -void initInputData(buffer &InBuf, T &ExpectedOut, T Identity, - BinaryOperation BOp, size_t N) { - ExpectedOut = Identity; - auto In = InBuf.template get_access(); - for (int I = 0; I < N; ++I) { - if (std::is_same>::value) - In[I] = 1 + (((I % 37) == 0) ? 1 : 0); - else - In[I] = ((I + 1) % 5) + 1.1; - ExpectedOut = BOp(ExpectedOut, In[I]); - } -}; - -// This type is needed only to check that custom types are properly handled -// in parallel_for() with reduction. For simplicity it needs a default -// constructor, a constructor with one argument, operators ==, != and -// printing to a stream. -template -struct CustomVec { - CustomVec() : X(0), Y(0) {} - CustomVec(T X, T Y) : X(X), Y(Y) {} - CustomVec(T V) : X(V), Y(V) {} - bool operator==(const CustomVec &V) const { - return V.X == X && V.Y == Y; - } - bool operator!=(const CustomVec &V) const { - return !(*this == V); - } - T X; - T Y; -}; -template -bool operator==(const CustomVec &A, const CustomVec &B) { - return A.X == B.X && A.Y == B.Y; -} -template -std::ostream &operator<<(std::ostream &OS, const CustomVec &V) { - return OS << "(" << V.X << ", " << V.Y << ")"; -} - -template -struct CustomVecPlus { - using CV = CustomVec; - CV operator()(const CV &A, const CV &B) const { - return CV(A.X + B.X, A.Y + B.Y); - } -}; - -template -T getMinimumFPValue() { - return std::numeric_limits::has_infinity - ? static_cast(-std::numeric_limits::infinity()) - : std::numeric_limits::lowest(); -} - -template -T getMaximumFPValue() { - return std::numeric_limits::has_infinity - ? std::numeric_limits::infinity() - : (std::numeric_limits::max)(); -} diff --git a/sycl/test/basic_tests/vector_cross.cpp b/sycl/test/basic_tests/vector_cross.cpp index e6938f2618528..6e2da96b81055 100644 --- a/sycl/test/basic_tests/vector_cross.cpp +++ b/sycl/test/basic_tests/vector_cross.cpp @@ -1,5 +1,5 @@ // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: %RUN_ON_HOST %t.out +// RUN: %t.out #include #include @@ -10,29 +10,20 @@ bool isEqualTo(double x, double y, double epsilon = 0.001) { } int main(int argc, const char **argv) { - sycl::cl_double4 r{0}; - { - sycl::buffer BufR(&r, sycl::range<1>(1)); - sycl::queue myQueue; - myQueue.submit([&](sycl::handler &cgh) { - auto AccR = BufR.get_access(cgh); - cgh.single_task([=]() { - AccR[0] = sycl::cross( - sycl::cl_double4{ - 2.5, - 3.0, - 4.0, - 0.0, - }, - sycl::cl_double4{ - 5.2, - 6.0, - 7.0, - 0.0, - }); + sycl::cl_double4 r = sycl::cross( + sycl::cl_double4{ + 2.5, + 3.0, + 4.0, + 0.0, + }, + sycl::cl_double4{ + 5.2, + 6.0, + 7.0, + 0.0, }); - }); - } + sycl::cl_double r1 = r.x(); sycl::cl_double r2 = r.y(); sycl::cl_double r3 = r.z(); diff --git a/sycl/test/esimd/vadd.cpp b/sycl/test/esimd/vadd.cpp deleted file mode 100644 index af8c82c4020d2..0000000000000 --- a/sycl/test/esimd/vadd.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// RUN: %clangxx -fsycl -fno-legacy-pass-manager %s -o %t.out -// RUN: %RUN_ON_HOST %t.out - -// Check that the code compiles with -O0 and -g -// Managers -// RUN: %clangxx -I %sycl_include %s -o %t.out -fsycl -fno-legacy-pass-manager -O0 -// RUN: %clangxx -I %sycl_include %s -o %t.out -fsycl -fno-legacy-pass-manager -O0 -g - -// Check that the code compiles with device code instrumentation enabled -// RUN: %clangxx -I %sycl_include %s -o %t.out -fsycl -fno-legacy-pass-manager \ -// RUN: -fsycl-instrument-device-code - -#include -#include -#include -#include - -using namespace sycl; - -class ESIMDSelector : public device_selector { - // Require GPU device unless HOST is requested in SYCL_DEVICE_FILTER env - virtual int operator()(const device &device) const { - if (const char *dev_filter = getenv("SYCL_DEVICE_FILTER")) { - std::string filter_string(dev_filter); - if (filter_string.find("gpu") != std::string::npos) - return device.is_gpu() ? 1000 : -1; - if (filter_string.find("host") != std::string::npos) - return device.is_host() ? 1000 : -1; - std::cerr - << "Supported 'SYCL_DEVICE_FILTER' env var values are 'gpu' and " - "'host', '" - << filter_string << "' does not contain such substrings.\n"; - return -1; - } - // If "SYCL_DEVICE_FILTER" not defined, only allow gpu device - return device.is_gpu() ? 1000 : -1; - } -}; - -auto exception_handler = [](exception_list l) { - for (auto ep : l) { - try { - std::rethrow_exception(ep); - } catch (sycl::exception &e0) { - std::cout << "sycl::exception: " << e0.what() << std::endl; - } catch (std::exception &e) { - std::cout << "std::exception: " << e.what() << std::endl; - } catch (...) { - std::cout << "generic exception\n"; - } - } -}; - -int main(void) { - constexpr unsigned Size = 256; - constexpr unsigned VL = 32; - constexpr unsigned GroupSize = 2; - - struct Deleter { - queue Q; - void operator()(int *Ptr) { - if (Ptr) { - sycl::free(Ptr, Q); - } - } - }; - - queue q(ESIMDSelector{}, exception_handler); - - std::unique_ptr BufA(sycl::malloc_shared(Size, q), - Deleter{q}); - std::unique_ptr BufB( - sycl::aligned_alloc_shared(16u, Size, q), Deleter{q}); - std::unique_ptr BufC( - sycl::aligned_alloc_shared(16u, Size, q), Deleter{q}); - - int *A = BufA.get(); - int *B = BufB.get(); - int *C = BufC.get(); - - for (unsigned i = 0; i < Size; ++i) { - A[i] = B[i] = i; - } - - { - // We need that many task groups - sycl::range<1> GroupRange{Size / VL}; - - // We need that many tasks in each group - sycl::range<1> TaskRange{GroupSize}; - - sycl::nd_range<1> Range{GroupRange, TaskRange}; - - q.submit([&](sycl::handler &cgh) { - cgh.parallel_for( - Range, [=](nd_item<1> ndi) SYCL_ESIMD_KERNEL { - using namespace sycl::ext::intel::esimd; - - int i = ndi.get_global_id(0); - constexpr int ESIZE = sizeof(int); - simd offsets(0, ESIZE); - - simd va = gather(A + i * VL, offsets); - simd vb = block_load(B + i * VL); - simd vc = va + vb; - - block_store(C + i * VL, vc); - }); - }); - } - for (unsigned i = 0; i < Size; ++i) { - if (A[i] + B[i] != C[i]) { - std::cout << "failed at index " << i << ", " << C[i] << " != " << A[i] - << " + " << B[i] << "\n"; - return 1; - } - } - - std::cout << "Passed\n"; - return 0; -} diff --git a/sycl/test/extensions/bfloat16_host.cpp b/sycl/test/extensions/bfloat16_host.cpp index 3304587e61b9d..acd02d2829b40 100644 --- a/sycl/test/extensions/bfloat16_host.cpp +++ b/sycl/test/extensions/bfloat16_host.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// // RUN: %clangxx -fsycl %s -o %t.out -// RUN: %RUN_ON_HOST %t.out +// RUN: %t.out #include #include diff --git a/sycl/test/extensions/usm/usm_alloc_utility.cpp b/sycl/test/extensions/usm/usm_alloc_utility.cpp deleted file mode 100644 index 7c587df097b2b..0000000000000 --- a/sycl/test/extensions/usm/usm_alloc_utility.cpp +++ /dev/null @@ -1,112 +0,0 @@ -// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out -// RUN: %RUN_ON_HOST %t1.out - -//==------ usm_alloc_utility.cpp - USM malloc and aligned_alloc 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 - -#include - -using namespace sycl; - -constexpr int N = 8; - -static void check_and_free(int *array, const device &dev, const context &ctxt) { - // host device treats all allocations as host allocations - assert((get_pointer_type(array, ctxt) == usm::alloc::host) && - "Allocation pointer should be host type"); - assert((get_pointer_device(array, ctxt) == dev) && - "Allocation pointer should be host type"); - free(array, ctxt); -} - -int main() { - queue q; - auto dev = q.get_device(); - auto ctxt = q.get_context(); - int *array; - - if (dev.get_info()) { - array = (int *)malloc(N * sizeof(int), q, usm::alloc::host); - check_and_free(array, dev, ctxt); - - array = - (int *)malloc(N * sizeof(int), q, usm::alloc::host, property_list{}); - check_and_free(array, dev, ctxt); - - array = (int *)aligned_alloc(alignof(long long), N * sizeof(int), q, - usm::alloc::host); - check_and_free(array, dev, ctxt); - - array = (int *)aligned_alloc(alignof(long long), N * sizeof(int), q, - usm::alloc::host, property_list{}); - check_and_free(array, dev, ctxt); - - array = (int *)malloc_host(N * sizeof(int), q); - check_and_free(array, dev, ctxt); - - array = (int *)malloc_host( - N * sizeof(int), q, - property_list{ - ext::intel::experimental::property::usm::buffer_location{2}}); - check_and_free(array, dev, ctxt); - - array = - (int *)aligned_alloc_host(alignof(long long), N * sizeof(int), ctxt); - check_and_free(array, dev, ctxt); - - array = (int *)aligned_alloc_host( - alignof(long long), N * sizeof(int), ctxt, - property_list{ - ext::intel::experimental::property::usm::buffer_location{2}}); - check_and_free(array, dev, ctxt); - } - - if (dev.get_info()) { - array = (int *)malloc_shared(N * sizeof(int), q); - check_and_free(array, dev, ctxt); - - array = (int *)malloc_shared( - N * sizeof(int), q, - property_list{ - ext::intel::experimental::property::usm::buffer_location{2}}); - check_and_free(array, dev, ctxt); - - array = (int *)aligned_alloc_shared(alignof(long long), N * sizeof(int), - dev, ctxt); - check_and_free(array, dev, ctxt); - - array = (int *)aligned_alloc_shared( - alignof(long long), N * sizeof(int), dev, ctxt, - property_list{ - ext::intel::experimental::property::usm::buffer_location{2}}); - check_and_free(array, dev, ctxt); - } - - if (dev.get_info()) { - array = (int *)malloc_device(N * sizeof(int), q); - check_and_free(array, dev, ctxt); - - array = malloc_device( - N, q, - property_list{ - ext::intel::experimental::property::usm::buffer_location(2)}); - check_and_free(array, dev, ctxt); - - array = (int *)aligned_alloc_device(alignof(long long), N * sizeof(int), - dev, ctxt); - check_and_free(array, dev, ctxt); - - array = (int *)aligned_alloc_device(alignof(long long), N * sizeof(int), - dev, ctxt, property_list{}); - check_and_free(array, dev, ctxt); - } - - return 0; -} diff --git a/sycl/test/extensions/usm/usm_allocator.cpp b/sycl/test/extensions/usm/usm_allocator.cpp deleted file mode 100644 index 7890673740809..0000000000000 --- a/sycl/test/extensions/usm/usm_allocator.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t1.out -// RUN: %RUN_ON_HOST %t1.out - -//==--------- usm_allocator.cpp - USM allocator construction 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 - -#include - -using namespace sycl; - -int main() { - queue q; - auto dev = q.get_device(); - auto ctxt = q.get_context(); - - { - // Test usm_allocator - if (dev.get_info() && - dev.get_info()) { - usm_allocator alloc11(ctxt, dev); - usm_allocator alloc12(ctxt, dev, - property_list{}); - usm_allocator alloc21(q); - usm_allocator alloc22(alloc21); - usm_allocator alloc23(q, property_list{}); - - // usm::alloc::device is not supported by usm_allocator - - assert((alloc11 != alloc22) && "Allocators should NOT be equal."); - assert((alloc11 == alloc12) && "Allocators should be equal."); - assert((alloc21 == alloc22) && "Allocators should be equal."); - assert((alloc21 == alloc23) && "Allocators should be equal."); - } - } - - return 0; -} diff --git a/sycl/test/lit.cfg.py b/sycl/test/lit.cfg.py index e90c426f5f7b5..3fa183ff86b1c 100644 --- a/sycl/test/lit.cfg.py +++ b/sycl/test/lit.cfg.py @@ -90,10 +90,6 @@ llvm_config.add_tool_substitutions(['llvm-spirv'], [config.sycl_tools_dir]) -config.substitutions.append( ('%RUN_ON_HOST', "env SYCL_DEVICE_FILTER=host ") ) - -# Every SYCL implementation provides a host implementation. -config.available_features.add('host') triple=lit_config.params.get('SYCL_TRIPLE', 'spir64-unknown-unknown') lit_config.note("Triple: {}".format(triple)) config.substitutions.append( ('%sycl_triple', triple ) ) diff --git a/sycl/test/regression/builtins_vector1.cpp b/sycl/test/regression/builtins_vector1.cpp index 7c42884d14204..9b027d939ebec 100644 --- a/sycl/test/regression/builtins_vector1.cpp +++ b/sycl/test/regression/builtins_vector1.cpp @@ -1,20 +1,16 @@ -// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: %RUN_ON_HOST %t.out +// RUN: %clangxx -fsycl %s -o %t.out +// RUN: %t.out #include int main() { - sycl::queue().submit([&](sycl::handler &h) { - h.single_task([=]() { - sycl::vec A{1}, B{2}, C{3}; - sycl::vec res = sycl::mad(A, B, C); - assert(res.x() - 5.0f < 1e-5); + sycl::vec A{1}, B{2}, C{3}; + sycl::vec res = sycl::mad(A, B, C); + assert(res.x() - 5.0f < 1e-5); - res = sycl::clamp(A, B, C); - assert(res.x() - 2.0f < 1e-5); + res = sycl::clamp(A, B, C); + assert(res.x() - 2.0f < 1e-5); - float scalarRes = sycl::length(A); - assert(scalarRes - 1.0f < 1e-5); - }); - }); + float scalarRes = sycl::length(A); + assert(scalarRes - 1.0f < 1e-5); } diff --git a/sycl/test/regression/check_vector_of_opencl_event.cpp b/sycl/test/regression/check_vector_of_opencl_event.cpp deleted file mode 100644 index f6cbaf6ad17f6..0000000000000 --- a/sycl/test/regression/check_vector_of_opencl_event.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// RUN: %clangxx -fsycl %s -o %t.out -// RUN: %RUN_ON_HOST %t.out -// -//===----------------------------------------------------------------------===// -// This test verifies that sycl::get_native and -// sycl::make_event work according to the SYCL™ 2020 -// Specification (revision 4) -//===----------------------------------------------------------------------===// - -#include - -int main() { - sycl::queue Queue; - if (Queue.get_backend() == sycl::backend::opencl) { - sycl::event event = Queue.submit([&](sycl::handler &cgh) { - cgh.single_task([]() {}); - }); - // Check that get_native function returns a vector - std::vector ClEventVec = get_native(event); - // Check that make_event is working properly with vector as a - // param - sycl::event SyclEvent = sycl::make_event( - ClEventVec, Queue.get_context()); - std::vector ClEventVecFromMake = - sycl::get_native(SyclEvent); - if (ClEventVec[0] != ClEventVecFromMake[0]) - throw std::runtime_error("Cl events are not the same"); - } - return 0; -} diff --git a/sycl/test/regression/fsycl-host-compiler-win.cpp b/sycl/test/regression/fsycl-host-compiler-win.cpp deleted file mode 100644 index bf855f1899d93..0000000000000 --- a/sycl/test/regression/fsycl-host-compiler-win.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// RUN: %clang_cl -fsycl -fsycl-host-compiler=cl -DDEFINE_CHECK -fsycl-host-compiler-options="-DDEFINE_CHECK /std:c++17 /Zc:__cplusplus" /Fe%t1.exe %s -// RUN: %RUN_ON_HOST %t1.exe -// REQUIRES: system-windows -// -//==------- fsycl-host-compiler-win.cpp - external host compiler 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 -// -//===----------------------------------------------------------------------===// -// -// Uses -fsycl-host-compiler= on a simple test, requires 'cl' - -#include - -#ifndef DEFINE_CHECK -#error predefined macro not set -#endif // DEFINE_CHECK - -using namespace sycl; - -int main() { - int data[] = {0, 0, 0}; - - { - buffer b(data, range<1>(3), {property::buffer::use_host_ptr()}); - queue q; - q.submit([&](handler &cgh) { - auto B = b.get_access(cgh); - cgh.parallel_for(range<1>(3), [=](id<1> idx) { - B[idx] = 1; - }); - }); - } - - bool isSuccess = true; - - for (int i = 0; i < 3; i++) - if (data[i] != 1) isSuccess = false; - - if (!isSuccess) - return -1; - - return 0; -} diff --git a/sycl/test/regression/fsycl-host-compiler.cpp b/sycl/test/regression/fsycl-host-compiler.cpp deleted file mode 100644 index 9e82e0ccff888..0000000000000 --- a/sycl/test/regression/fsycl-host-compiler.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// RUN: %clangxx -fsycl -fsycl-host-compiler=g++ -DDEFINE_CHECK -fsycl-host-compiler-options="-DDEFINE_CHECK -std=c++17" -o %t1.exe %s -// RUN: %RUN_ON_HOST %t1.exe -// REQUIRES: system-linux -//==------- fsycl-host-compiler.cpp - external host compiler 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 -// -//===----------------------------------------------------------------------===// -// -// Uses -fsycl-host-compiler= on a simple test, requires 'g++' - -#include - -#ifndef DEFINE_CHECK -#error predefined macro not set -#endif // DEFINE_CHECK - -using namespace sycl; - -int main() { - int data[] = {0, 0, 0}; - - { - buffer b(data, range<1>(3), {property::buffer::use_host_ptr()}); - queue q; - q.submit([&](handler &cgh) { - auto B = b.get_access(cgh); - cgh.parallel_for(range<1>(3), [=](id<1> idx) { - B[idx] = 1; - }); - }); - } - - bool isSuccess = true; - - for (int i = 0; i < 3; i++) - if (data[i] != 1) isSuccess = false; - - { - buffer b(1); - queue q; - q.submit([&](handler &cgh) { - accessor a{b, cgh}; - cgh.single_task([=] { a[0] = 42; }); - }).wait(); - host_accessor a{b}; - isSuccess &= (a[0] == 42); - } - - if (!isSuccess) - return -1; - - return 0; -} diff --git a/sycl/test/regression/half_union.cpp b/sycl/test/regression/half_union.cpp index 14790a3b22944..1b67f8cb76c39 100644 --- a/sycl/test/regression/half_union.cpp +++ b/sycl/test/regression/half_union.cpp @@ -1,5 +1,5 @@ // RUN: %clangxx -fsycl %s -o %t.out -// RUN: %RUN_ON_HOST %t.out +// RUN: %t.out #include diff --git a/sycl/test/regression/sycl-include-gnu17.cpp b/sycl/test/regression/sycl-include-gnu17.cpp index f5abc7f82dd27..db9886610bf82 100644 --- a/sycl/test/regression/sycl-include-gnu17.cpp +++ b/sycl/test/regression/sycl-include-gnu17.cpp @@ -1,5 +1,5 @@ // RUN: %clangxx -std=gnu++17 -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -// RUN: %RUN_ON_HOST %t.out +// RUN: %t.out // UNSUPPORTED: system-windows diff --git a/sycl/test/scheduler/BasicSchedulerTests.cpp b/sycl/test/scheduler/BasicSchedulerTests.cpp index 9c91161851146..dc9815429e621 100644 --- a/sycl/test/scheduler/BasicSchedulerTests.cpp +++ b/sycl/test/scheduler/BasicSchedulerTests.cpp @@ -1,5 +1,5 @@ // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -I %sycl_source_dir %s -o %t.out -// RUN: %RUN_ON_HOST %t.out +// RUN: %t.out //==------------------- BasicSchedulerTests.cpp ----------------------------==// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. diff --git a/sycl/test/scheduler/ReleaseResourcesTest.cpp b/sycl/test/scheduler/ReleaseResourcesTest.cpp index ffed076bccc6f..08c0da5e0cd99 100644 --- a/sycl/test/scheduler/ReleaseResourcesTest.cpp +++ b/sycl/test/scheduler/ReleaseResourcesTest.cpp @@ -1,5 +1,5 @@ // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -I %sycl_source_dir %s -o %t.out -// RUN: %RUN_ON_HOST %t.out +// RUN: %t.out //==------------------- ReleaseResourcesTests.cpp --------------------------==// //