|
| 1 | +// RUN: %clang_cc1 -fsycl-is-device -std=c++17 -internal-isystem %S/Inputs -triple spir64-unknown-unknown -fsycl-int-footer=%t.footer.h -fsycl-int-header=%t.header.h -fsycl-unique-prefix=THE_PREFIX %s -emit-llvm -o %t.ll |
| 2 | +// RUN: FileCheck -input-file=%t.footer.h %s --check-prefix=CHECK-FOOTER |
| 3 | +// RUN: FileCheck -input-file=%t.header.h %s --check-prefix=CHECK-HEADER |
| 4 | +#include "sycl.hpp" |
| 5 | + |
| 6 | +// Test cases below show that 'sycl-unique-id' LLVM IR attribute is attached to the |
| 7 | +// global variable whose type is decorated with host_pipe attribute, and that a |
| 8 | +// unique string is generated. |
| 9 | + |
| 10 | +using namespace sycl::ext::intel::experimental; |
| 11 | +using namespace sycl; |
| 12 | +queue q; |
| 13 | + |
| 14 | +void foo() { |
| 15 | + q.submit([&](handler &h) { |
| 16 | + h.single_task<class kernel_name_1>([=]() { |
| 17 | + host_pipe<class HPInt, int>::read(); |
| 18 | + host_pipe<class HPFloat, int>::read(); |
| 19 | + }); |
| 20 | + }); |
| 21 | +} |
| 22 | + |
| 23 | +// CHECK-HEADER: namespace sycl { |
| 24 | +// CHECK-HEADER-NEXT: __SYCL_INLINE_VER_NAMESPACE(_V1) { |
| 25 | +// CHECK-HEADER-NEXT: namespace detail { |
| 26 | +// CHECK-HEADER-NEXT: namespace { |
| 27 | +// CHECK-HEADER-NEXT: class __sycl_host_pipe_registration { |
| 28 | +// CHECK-HEADER-NEXT: public: |
| 29 | +// CHECK-HEADER-NEXT: __sycl_host_pipe_registration() noexcept; |
| 30 | +// CHECK-HEADER-NEXT: }; |
| 31 | +// CHECK-HEADER-NEXT: __sycl_host_pipe_registration __sycl_host_pipe_registrar; |
| 32 | +// CHECK-HEADER-NEXT: } // namespace |
| 33 | +// CHECK-HEADER: } // namespace detail |
| 34 | +// CHECK-HEADER: } // __SYCL_INLINE_VER_NAMESPACE(_V1) |
| 35 | +// CHECK-HEADER: } // namespace sycl |
| 36 | + |
| 37 | +// CHECK-FOOTER: #include <sycl/detail/defines_elementary.hpp> |
| 38 | +// CHECK-FOOTER: #include <sycl/detail/host_pipe_map.hpp> |
| 39 | +// CHECK-FOOTER-NEXT: namespace sycl::detail { |
| 40 | +// CHECK-FOOTER-NEXT: namespace { |
| 41 | +// CHECK-FOOTER-NEXT: __sycl_host_pipe_registration::__sycl_host_pipe_registration() noexcept { |
| 42 | + |
| 43 | +// CHECK-FOOTER: host_pipe_map::add((void *)&::sycl::ext::intel::experimental::host_pipe<HPInt, int>::__pipe, "THE_PREFIX____ZN4sycl3_V13ext5intel12experimental9host_pipeIZZZ3foovENKUlRNS0_7handlerEE_clES6_ENKUlvE_clEvE5HPIntiE6__pipeE"); |
| 44 | +// CHECK-FOOTER: host_pipe_map::add((void *)&::sycl::ext::intel::experimental::host_pipe<HPFloat, int>::__pipe, "THE_PREFIX____ZN4sycl3_V13ext5intel12experimental9host_pipeIZZZ3foovENKUlRNS0_7handlerEE_clES6_ENKUlvE_clEvE7HPFloatiE6__pipeE"); |
| 45 | + |
| 46 | +// CHECK-FOOTER: } // namespace (unnamed) |
| 47 | +// CHECK-FOOTER: } // namespace sycl::detail |
| 48 | + |
0 commit comments