Skip to content

Commit ec1449b

Browse files
committed
Update the namespace of latency control properties and correct namings in extension docs
1 parent f4968f8 commit ec1449b

File tree

7 files changed

+196
-218
lines changed

7 files changed

+196
-218
lines changed

sycl/doc/extensions/supported/sycl_ext_intel_dataflow_pipes.asciidoc

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ A pipe type is a specialization of the pipe class:
110110

111111
[source,c++,Pipe type def,linenums]
112112
----
113-
template <typename _name,
114-
typename _dataT,
115-
size_t _min_capacity = 0>
113+
template <typename Name,
114+
typename DataT,
115+
size_t MinCapacity = 0>
116116
class pipe;
117117
----
118118

@@ -131,7 +131,7 @@ using pipe<class bar, float, 5>;
131131

132132
The interface of a pipe is through static member functions, and instances of a pipe class cannot be instantiated. Allowing instances of pipe objects, when their type defines connectivity, would introduce an error prone secondary mechanism of reference.
133133

134-
The first template parameter, `_name`, can be any type, and is typically expected to be a user defined class in a user namespace. The type only needs to be forward declared, and not defined.
134+
The first template parameter, `Name`, can be any type, and is typically expected to be a user defined class in a user namespace. The type only needs to be forward declared, and not defined.
135135

136136
Above this basic mechanism of {cpp} type being used to identify a pipe, additional layers can be built on top to contain the type in an object that can be passed by value. Because such mechanisms (e.g. `boost::hana::type`) can layer on top of the fundamental type-based mechanism described here, those mechanisms are not included in the extension specification.
137137

@@ -166,37 +166,37 @@ myQueue.submit([&](handler& cgh) {
166166

167167
== Read/write member functions, and pipe template parameters
168168

169-
The pipe class exposes static member functions for writing a data word to a pipe, and for reading a data word from a pipe. A data word in this context is the data type that the pipe contains (`_dataT` pipe template argument).
169+
The pipe class exposes static member functions for writing a data word to a pipe, and for reading a data word from a pipe. A data word in this context is the data type that the pipe contains (`DataT` pipe template argument).
170170

171171
Blocking and non-blocking forms of the read and write members are defined, with the form chosen based on overload resolution.
172172

173173
[source,c++,Read write members,linenums]
174174
----
175-
template <typename _name,
176-
typename _dataT,
177-
size_t _min_capacity = 0>
175+
template <typename Name,
176+
typename DataT,
177+
size_t MinCapacity = 0>
178178
class pipe {
179179
// Blocking
180-
static _dataT read();
181-
static void write( const _dataT &Data );
180+
static DataT read();
181+
static void write( const DataT &Data );
182182
183183
// Non-blocking
184-
static _dataT read( bool &Success );
185-
static void write( const _dataT &Data, bool &Success );
184+
static DataT read( bool &Success );
185+
static void write( const DataT &Data, bool &Success );
186186
187187
// Static members
188-
using value_type = _dataT;
189-
size_t min_capacity = _min_capacity;
188+
using value_type = DataT;
189+
size_t min_capacity = MinCapacity;
190190
}
191191
----
192192

193193
The read and write member functions may be invoked within device code, or within a SYCL host program. Some interfaces may not be available on all devices/implementations, but the pipe definition itself does not gate availability. Instead, implementations should error if an unsupported pipe is used. See section <<device_queries>> for information on querying the availability of specific pipe features relative to a device.
194194

195195
The template parameters of the device type are defined as:
196196

197-
* `_name`: Type that is the basis of pipe identification. Typically a user-defined class, in a user namespace. Forward declaration of the type is sufficient, and the type does not need to be defined.
198-
* `_dataT`: The type of data word/packet contained within a pipe. This is the data type that is read during a successful `pipe::read` operation, or written during a successful `pipe::write` operation. The type must be standard layout and trivially copyable. This template parameter can be queried by using the `value_type` type alias.
199-
* `_min_capacity`: User defined minimum number of words in units of `_dataT` that the pipe must be able to store without any being read out. A minimum capacity is required in some algorithms to avoid deadlock, or for performance tuning. An implementation can include more capacity than this parameter, but not less. This template parameter can be queried by using the `min_capacity` static member.
197+
* `Name`: Type that is the basis of pipe identification. Typically a user-defined class, in a user namespace. Forward declaration of the type is sufficient, and the type does not need to be defined.
198+
* `DataT`: The type of data word/packet contained within a pipe. This is the data type that is read during a successful `pipe::read` operation, or written during a successful `pipe::write` operation. The type must be standard layout and trivially copyable. This template parameter can be queried by using the `value_type` type alias.
199+
* `MinCapacity`: User defined minimum number of words in units of `DataT` that the pipe must be able to store without any being read out. A minimum capacity is required in some algorithms to avoid deadlock, or for performance tuning. An implementation can include more capacity than this parameter, but not less. This template parameter can be queried by using the `min_capacity` static member.
200200

201201
== Pipe types and {cpp} scope
202202

@@ -260,12 +260,12 @@ Pipes expose two additional static member functions that are available within ho
260260

261261
[source,c++,Read write members,linenums]
262262
----
263-
template <typename _name,
264-
typename _dataT,
265-
size_t _min_capacity = 0>
263+
template <typename Name,
264+
typename DataT,
265+
size_t MinCapacity = 0>
266266
class pipe {
267267
template <pipe_property::writeable host_writeable>
268-
static _dataT* map(size_t requested_size, size_t &mapped_size);
268+
static DataT* map(size_t requested_size, size_t &mapped_size);
269269
270270
static size_t unmap(T* mapped_ptr, size_t size_to_unmap);
271271
}
@@ -284,11 +284,11 @@ The APIs are defined as:
284284
|Function |Description
285285
|`template <pipe_property::writeable host_writeable> +
286286
dataT* map(size_t requested_size, size_t &mapped_size);`
287-
|Returns a _dataT *_ in the host address space. The host can write data to this pointer for reading by a device pipe endpoint, if it was created with template parameter `host_writeable = true`. Alternatively, the host can read data from this pointer if it was created with template parameter `host_writeable = false`.
287+
|Returns a DataT *_ in the host address space. The host can write data to this pointer for reading by a device pipe endpoint, if it was created with template parameter `host_writeable = true`. Alternatively, the host can read data from this pointer if it was created with template parameter `host_writeable = false`.
288288

289289
The value returned in the mapped_size argument specifies the maximum number of bytes that the host can access. The value specified by _mapped_size_ is less than or equal to the value of the _requested_size_ argument that the caller specifies. _mapped_size_ does not impact the _min_capacity_ property of the pipe.
290290

291-
After writing to or reading from the returned _dataT *_, the host must execute one or more `unmap` calls on the same pipe, to signal to the runtime that data is ready for transfer to the device (on a write), and that the runtime can reclaim the memory for reuse (on a read or write). If `map` is called on a pipe before `unmap` has been used to unmap all memory mapped by a previous `map` operation, the buffer returned by the second `map` call will not overlap with that returned by the first call.
291+
After writing to or reading from the returned DataT *_, the host must execute one or more `unmap` calls on the same pipe, to signal to the runtime that data is ready for transfer to the device (on a write), and that the runtime can reclaim the memory for reuse (on a read or write). If `map` is called on a pipe before `unmap` has been used to unmap all memory mapped by a previous `map` operation, the buffer returned by the second `map` call will not overlap with that returned by the first call.
292292

293293
|`static size_t unmap(T* mapped_ptr, size_t size_to_unmap);`
294294
|Signals to the runtime that the host is no longer using _size_to_unmap_ bytes of the host allocation that was returned previously from a call to `map`. In the case of a writeable host pipe, calling `unmap` allows the unmapped data to become available to the kernel. If the _size_to_unmap_ value is smaller than the _mapped_size_ value specified to `map`, then multiple `unmap` function calls are necessary to unmap the full capacity of the host allocation. It is legal to perform multiple `unmap` function calls to unmap successive bytes in the buffer returned by `map`, up to the _mapped_size_ value defined in the `map` operation.
@@ -382,22 +382,22 @@ The pipe class described above exposes both read and write static member functio
382382

383383
[source,c++,iopipes,linenums]
384384
----
385-
template <typename _name,
386-
typename _dataT,
387-
size_t _min_capacity = 0>
385+
template <typename Name,
386+
typename DataT,
387+
size_t MinCapacity = 0>
388388
class kernel_readable_io_pipe {
389389
public:
390-
static _dataT read(); // Blocking
391-
static _dataT read( bool &Success ); // Non-blocking
390+
static DataT read(); // Blocking
391+
static DataT read( bool &Success ); // Non-blocking
392392
};
393393
394-
template <typename _name,
395-
typename _dataT,
396-
size_t _min_capacity = 0>
394+
template <typename Name,
395+
typename DataT,
396+
size_t MinCapacity = 0>
397397
class kernel_writeable_io_pipe {
398398
public:
399-
static void write( _dataT Data ); // Blocking
400-
static void write( _dataT Data, bool &Success ); // Non-blocking
399+
static void write( DataT Data ); // Blocking
400+
static void write( DataT Data, bool &Success ); // Non-blocking
401401
}
402402
----
403403

@@ -642,10 +642,12 @@ Automated mechanisms are possible to provide uniquification across calls, and co
642642

643643
*NOTE*: The APIs described in this section are experimental. Future versions of this extension may change these APIs in ways that are incompatible with the versions described here.
644644

645+
The Intel FPGA experimental `pipe` class is implemented in `sycl/ext/intel/experimental/pipes.hpp` which is included in `sycl/ext/intel/fpga_extensions.hpp`.
646+
645647
In the experimental API version, read/write methods take in a property list as function argument, which can contain the latency control properties `latency_anchor_id` and/or `latency_constraint`.
646648

647-
* `sycl::ext::oneapi::experimental::latency_anchor_id<N>`, where `N` is an integer: An ID to associate with the current read/write function call, which can then be referenced by other `latency_constraint` properties elsewhere in the program to define relative latency constaints. ID must be unique within the application, and a diagnostic is required if that condition is not met.
648-
* `sycl::ext::oneapi::experimental::latency_constraint<A, B, C>`: A tuple of three values which cause the current read/write function call to act as an endpoint of a latency constraint relative to a specified `latency_anchor_id` defined by a different instruction.
649+
* `sycl::ext::intel::experimental::latency_anchor_id<N>`, where `N` is an integer: An ID to associate with the current read/write function call, which can then be referenced by other `latency_constraint` properties elsewhere in the program to define relative latency constaints. ID must be unique within the application, and a diagnostic is required if that condition is not met.
650+
* `sycl::ext::intel::experimental::latency_constraint<A, B, C>`: A tuple of three values which cause the current read/write function call to act as an endpoint of a latency constraint relative to a specified `latency_anchor_id` defined by a different instruction.
649651
** `A` is an integer: The ID of the target anchor defined on a different instruction through a `latency_anchor_id` property.
650652
** `B` is an enum value: The type of control from the set {`latency_control_type::exact`, `latency_control_type::max`, `latency_control_type::min`}.
651653
** `C` is an integer: The relative clock cycle difference between the target anchor and the current function call, that the constraint should infer subject to the type of the control (exact, max, min).
@@ -655,7 +657,7 @@ In the experimental API version, read/write methods take in a property list as f
655657
[source,c++]
656658
----
657659
// Added in version 2 of this extension.
658-
namespace sycl::ext::oneapi::experimental {
660+
namespace sycl::ext::intel::experimental {
659661
enum class latency_control_type {
660662
none, // default
661663
exact,
@@ -665,17 +667,17 @@ enum class latency_control_type {
665667
666668
struct latency_anchor_id_key {
667669
template <int Anchor>
668-
using value_t = property_value<latency_anchor_id_key,
669-
std::integral_constant<int, Anchor>>;
670+
using value_t =
671+
oneapi::experimental::property_value<latency_anchor_id_key,
672+
std::integral_constant<int, Anchor>>;
670673
};
671674
672675
struct latency_constraint_key {
673676
template <int Target, latency_control_type Type, int Cycle>
674-
using value_t =
675-
property_value<latency_constraint_key,
676-
std::integral_constant<int, Target>,
677-
std::integral_constant<latency_control_type, Type>,
678-
std::integral_constant<int, Cycle>>;
677+
using value_t = oneapi::experimental::property_value<
678+
latency_constraint_key, std::integral_constant<int, Target>,
679+
std::integral_constant<latency_control_type, Type>,
680+
std::integral_constant<int, Cycle>>;
679681
};
680682
681683
template <int Anchor>
@@ -684,34 +686,32 @@ inline constexpr latency_anchor_id_key::value_t<Anchor> latency_anchor_id;
684686
template <int Target, latency_control_type Type, int Cycle>
685687
inline constexpr latency_constraint_key::value_t<Target, Type, Cycle>
686688
latency_constraint;
687-
} // namespace sycl::ext::oneapi::experimental
688689
689-
namespace sycl::ext::intel::experimental {
690-
template <typename _name,
691-
typename _dataT,
692-
size_t _min_capacity = 0>
690+
template <typename Name,
691+
typename DataT,
692+
size_t MinCapacity = 0>
693693
class pipe {
694694
// Blocking
695-
static _dataT read();
695+
static DataT read();
696696
697-
template <typename _propertiesT>
698-
static _dataT read( _propertiesT Properties );
697+
template <typename PropertiesT>
698+
static DataT read( PropertiesT Properties );
699699
700-
static void write( const _dataT &Data);
700+
static void write( const DataT &Data);
701701
702-
template <typename _propertiesT>
703-
static void write( const _dataT &Data, _propertiesT Properties );
702+
template <typename PropertiesT>
703+
static void write( const DataT &Data, PropertiesT Properties );
704704
705705
// Non-blocking
706-
static _dataT read( bool &Success );
706+
static DataT read( bool &Success );
707707
708-
template <typename _propertiesT>
709-
static _dataT read( bool &Success, _propertiesT Properties );
708+
template <typename PropertiesT>
709+
static DataT read( bool &Success, PropertiesT Properties );
710710
711-
static void write( const _dataT &Data, bool &Success );
711+
static void write( const DataT &Data, bool &Success );
712712
713-
template <typename _propertiesT>
714-
static void write( const _dataT &Data, bool &Success, _propertiesT Properties );
713+
template <typename PropertiesT>
714+
static void write( const DataT &Data, bool &Success, PropertiesT Properties );
715715
}
716716
} // namespace sycl::ext::intel::experimental
717717
----
@@ -730,20 +730,20 @@ using Pipe3 = ext::intel::experimental::pipe<class PipeClass2, int, 8>;
730730
myQueue.submit([&](handler &cgh) {
731731
cgh.single_task<class foo>([=] {
732732
// The following Pipe1::read is anchor 0
733-
int value = Pipe1::read(ext::oneapi::experimental::properties(
734-
ext::oneapi::experimental::latency_anchor_id<0>));
733+
int value = Pipe1::read(
734+
ext::oneapi::experimental::properties(latency_anchor_id<0>));
735735
736736
// The following Pipe2::write is anchor 1
737737
// The following Pipe2::write occurs exactly 2 cycles after anchor 0
738-
Pipe2::write(value, ext::oneapi::experimental::properties(
739-
ext::oneapi::experimental::latency_anchor_id<1>,
740-
ext::oneapi::experimental::latency_constraint<
741-
0, ext::oneapi::experimental::latency_control_type::exact, 2>));
738+
Pipe2::write(value,
739+
ext::oneapi::experimental::properties(
740+
latency_anchor_id<1>,
741+
latency_constraint<0, latency_control_type::exact, 2>));
742742
743743
// The following Pipe3::write occurs at least 2 cycles after anchor 1
744-
Pipe3::write(value, ext::oneapi::experimental::properties(
745-
ext::oneapi::experimental::latency_constraint<
746-
1, ext::oneapi::experimental::latency_control_type::min, 2>));
744+
Pipe3::write(value,
745+
ext::oneapi::experimental::properties(
746+
latency_constraint<1, latency_control_type::min, 2>));
747747
});
748748
});
749749
----

0 commit comments

Comments
 (0)