Skip to content

Commit 44b7e73

Browse files
committed
[SYCL] Query pipe name from registration
The pipe name is generated in integration footer and will be available to the runtime during device image registration. The runtime then store host pipe information in host piep map entry, which is kept track of in program manager. The host pipe information can be queried from the program manager through getHostPipeEntry using the host pipe pointer that is determined by its class member __pipe.
1 parent 12e9e85 commit 44b7e73

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

sycl/include/sycl/ext/intel/experimental/host_pipes.hpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,19 @@ class
4949
host_pipe<_name, _dataT, _propertiesT,
5050
std::enable_if_t<sycl::ext::oneapi::experimental::
5151
is_property_list_v<_propertiesT>>> {
52-
static_assert(
53-
sycl::ext::oneapi::experimental::is_property_list_v<_propertiesT>,
54-
"Host pipe is available only through new property list");
52+
53+
struct
54+
#ifdef __SYCL_DEVICE_ONLY__
55+
[[__sycl_detail__::add_ir_global_variable_attributes(
56+
"sycl-host-pipe",
57+
nullptr
58+
)]]
59+
[[__sycl_detail__::host_pipe]]
60+
[[__sycl_detail__::global_variable_allowed]] // may not be needed
61+
#endif
62+
__pipeType { const char __p; };
63+
64+
static constexpr __pipeType __pipe = {0};
5565

5666
public:
5767
using value_type = _dataT;

sycl/source/detail/host_pipe.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
//===----------------------------------------------------------------------===//
88

99
#include <sycl/ext/intel/experimental/host_pipes.hpp>
10+
#include <detail/host_pipe_map_entry.hpp>
11+
#include <detail/program_manager/program_manager.hpp>
1012

1113
__SYCL_INLINE_NAMESPACE(cl) {
1214
namespace sycl {
@@ -27,7 +29,9 @@ host_pipe<_name, _dataT, _propertiesT,
2729
}
2830
// TODO: get pipe name from the pipe registration
2931
_dataT data;
30-
const std::string pipe_name = "pipename";
32+
const void* HostPipePtr = &__pipe;
33+
detail::HostPipeMapEntry hostPipeEntry = detail::ProgramManager::getInstance().getHostPipeEntry(HostPipePtr);
34+
const std::string pipe_name = hostPipeEntry.MUniqueId;
3135
size_t size = 4;
3236
event e = q.submit([=](handler &CGH) {
3337
CGH.read_write_host_pipe(pipe_name, (void *)(&data), (size_t)size, false,
@@ -50,7 +54,9 @@ void host_pipe<
5054
return;
5155
}
5256
// TODO: get pipe name from the pipe registration
53-
const std::string pipe_name = "pipename";
57+
const void* HostPipePtr = &__pipe;
58+
detail::HostPipeMapEntry hostPipeEntry = detail::ProgramManager::getInstance().getHostPipeEntry(HostPipePtr);
59+
const std::string pipe_name = hostPipeEntry.MUniqueId;
5460
const void *data_ptr = &data;
5561
size_t size = 4;
5662
event e = q.submit([=](handler &CGH) {

0 commit comments

Comments
 (0)