|
| 1 | +//===-- fpga_pipes_mixed_usage.cpp -- Using pipe and experimental::pipe ---===// |
| 2 | +// |
| 3 | +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | +// See https://llvm.org/LICENSE.txt for license information. |
| 5 | +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | +// |
| 7 | +//===----------------------------------------------------------------------===// |
| 8 | +// REQUIRES: accelerator |
| 9 | +// RUN: %{build} -o %t.out |
| 10 | +// RUN: %{run} %t.out |
| 11 | + |
| 12 | +// https://github.com/intel/llvm/issues/13887 |
| 13 | +// XFAIL: * |
| 14 | +// If users need to use host pipe feature provided by experimental::pipe, all |
| 15 | +// pipes in their design should use the experimental::pipe (as a workround). |
| 16 | + |
| 17 | +#include <iostream> |
| 18 | +#include <sycl/detail/core.hpp> |
| 19 | +#include <sycl/ext/intel/fpga_extensions.hpp> |
| 20 | +#include <sycl/pipes.hpp> |
| 21 | + |
| 22 | +// Test for using sycl::ext::intel::pipe and |
| 23 | +// sycl::ext::intel::experimental::pipe in the same kernel. |
| 24 | +using NonExpPipe = sycl::ext::intel::pipe<class PipeA, int>; |
| 25 | +using ExpPipe = sycl::ext::intel::experimental::pipe<class PipeB, short>; |
| 26 | + |
| 27 | +int main() { |
| 28 | + sycl::queue q(sycl::ext::intel::fpga_emulator_selector_v); |
| 29 | + |
| 30 | + q.submit([&](sycl::handler &cgh) { |
| 31 | + cgh.single_task<class SimplePipeWrite>([=]() { |
| 32 | + NonExpPipe::write(42); |
| 33 | + ExpPipe::write(24); |
| 34 | + }); |
| 35 | + }); |
| 36 | + q.wait(); |
| 37 | + |
| 38 | + int a = 0; |
| 39 | + short b = 0; |
| 40 | + sycl::buffer<int, 1> buf_a(&a, 1); |
| 41 | + sycl::buffer<short, 1> buf_b(&b, 1); |
| 42 | + q.submit([&](sycl::handler &cgh) { |
| 43 | + auto acc_a = buf_a.get_access<sycl::access::mode::write>(cgh); |
| 44 | + auto acc_b = buf_b.get_access<sycl::access::mode::write>(cgh); |
| 45 | + cgh.single_task<class SimplePipeRead>([=]() { |
| 46 | + acc_a[0] = NonExpPipe::read(); |
| 47 | + acc_b[0] = ExpPipe::read(); |
| 48 | + }); |
| 49 | + }); |
| 50 | + q.wait(); |
| 51 | + |
| 52 | + if (a != 42 || b != 24) { |
| 53 | + std::cout << "Failed\n"; |
| 54 | + return 1; |
| 55 | + } |
| 56 | + |
| 57 | + std::cout << "Passed\n"; |
| 58 | + return 0; |
| 59 | +} |
0 commit comments