@@ -11,13 +11,9 @@ using PipeProps = decltype(sycl::ext::oneapi::experimental::properties(sycl::ext
1111// Pipe properties for host pipes. Host pipes connect to the data source DMA and sink DMA.
1212// They are connected to the first and the last layer to stream data into and out from the kernel.
1313using HostPipePropertiesT = decltype (sycl::ext::oneapi::experimental::properties(
14- sycl::ext::intel::experimental::ready_latency<0 >,
15- sycl::ext::intel::experimental::bits_per_symbol<8 >,
16- sycl::ext::intel::experimental::uses_valid<true >,
17- sycl::ext::intel::experimental::first_symbol_in_high_order_bits<true >,
18- sycl::ext::intel::experimental::protocol_avalon_streaming_uses_ready
19- ));
20-
14+ sycl::ext::intel::experimental::ready_latency<0 >, sycl::ext::intel::experimental::bits_per_symbol<8 >,
15+ sycl::ext::intel::experimental::uses_valid<true >, sycl::ext::intel::experimental::first_symbol_in_high_order_bits<true >,
16+ sycl::ext::intel::experimental::protocol_avalon_streaming_uses_ready));
2117
2218namespace nnet {
2319
@@ -27,30 +23,27 @@ inline constexpr unsigned kInputBufferLocation = 0;
2723inline constexpr unsigned kOutputBufferLocation = 1 ;
2824#endif
2925
30- // Implementation of a direct memory access kernel. Move data from source, convert,
26+ // Implementation of a direct memory access kernel. Move data from source, convert,
3127// and send to the sink. Adaptive to SYCL HLS and hardware acceleration flow.
32- template <class src_T , class dest_pipe >
33- struct DMA_convert_data {
28+ template <class src_T , class dest_pipe > struct DMA_convert_data {
3429#if !defined(IS_BSP)
35- // When targeting a device family, we instantiate an Avalon Memory Mapped Host for
30+ // When targeting a device family, we instantiate an Avalon Memory Mapped Host for
3631 // data transaction between host and the DMA kernel during emulation and simulation.
37- sycl::ext::oneapi::experimental::annotated_arg<src_T *,
38- decltype (sycl::ext::oneapi::experimental::properties{
39- sycl::ext::intel::experimental::latency<0 >,
40- sycl::ext::intel::experimental::dwidth<16 >,
41- sycl::ext::intel::experimental::buffer_location<kInputBufferLocation >,
42- sycl::ext::intel::experimental::read_write_mode_read,
43- sycl::ext::intel::experimental::wait_request_requested})>
32+ sycl::ext::oneapi::experimental::annotated_arg<
33+ src_T *,
34+ decltype (sycl::ext::oneapi::experimental::properties{
35+ sycl::ext::intel::experimental::latency<0 >, sycl::ext::intel::experimental::dwidth<16 >,
36+ sycl::ext::intel::experimental::buffer_location<kInputBufferLocation >,
37+ sycl::ext::intel::experimental::read_write_mode_read, sycl::ext::intel::experimental::wait_request_requested})>
4438#else
4539 // When targeting oneAPI BSP, we can use USM pointer to access host memory.
4640 src_T *const
4741#endif
4842 src;
4943 size_t num_iteration;
5044
51- [[intel::kernel_args_restrict]]
52- void operator ()() const {
53-
45+ [[intel::kernel_args_restrict]] void operator ()() const {
46+
5447#if defined(IS_BSP)
5548 // Access data using host pointer.
5649 sycl::ext::intel::host_ptr<src_T> src_ptr (src);
@@ -64,8 +57,7 @@ struct DMA_convert_data {
6457 using DstDataType = typename nnet::ExtractDataType<PipeDataType>::value_type;
6558 constexpr auto dstTypeSize = std::tuple_size<DstDataType>{};
6659
67- [[intel::fpga_register]]
68- typename nnet::ExtractPipeType<dest_pipe>::value_type packet;
60+ [[intel::fpga_register]] typename nnet::ExtractPipeType<dest_pipe>::value_type packet;
6961
7062 // Keep sending data to the input layer and keep the kernels running.
7163 for (size_t i = 0 ; i < num_iteration; i++) {
@@ -82,28 +74,25 @@ struct DMA_convert_data {
8274 }
8375};
8476
85- // Symmetrical to the DMA_convert_data above, this DMA drains the output pipe and
77+ // Symmetrical to the DMA_convert_data above, this DMA drains the output pipe and
8678// writes result to memory.
87- template <class src_pipe , class dst_T >
88- struct DMA_convert_data_back {
79+ template <class src_pipe , class dst_T > struct DMA_convert_data_back {
8980#if !defined(IS_BSP)
9081 // Without BSP, instantiate an Avalon Memory Mapped Host to write to host.
91- sycl::ext::oneapi::experimental::annotated_arg<dst_T *,
92- decltype (sycl::ext::oneapi::experimental::properties{
93- sycl::ext::intel::experimental::latency<0 >,
94- sycl::ext::intel::experimental::dwidth<16 >,
95- sycl::ext::intel::experimental::buffer_location<kOutputBufferLocation >,
96- sycl::ext::intel::experimental::read_write_mode_write,
97- sycl::ext::intel::experimental::wait_request_requested})>
82+ sycl::ext::oneapi::experimental::annotated_arg<
83+ dst_T *,
84+ decltype (sycl::ext::oneapi::experimental::properties{
85+ sycl::ext::intel::experimental::latency<0 >, sycl::ext::intel::experimental::dwidth<16 >,
86+ sycl::ext::intel::experimental::buffer_location<kOutputBufferLocation >,
87+ sycl::ext::intel::experimental::read_write_mode_write, sycl::ext::intel::experimental::wait_request_requested})>
9888#else
9989 // USM pointer, otherwise.
10090 dst_T *const
10191#endif
10292 dst;
10393 size_t num_iteration;
10494
105- [[intel::kernel_args_restrict]]
106- void operator ()() const {
95+ [[intel::kernel_args_restrict]] void operator ()() const {
10796#if defined(IS_BSP)
10897 sycl::ext::intel::host_ptr<dst_T> dst_ptr (dst);
10998#else
@@ -115,9 +104,8 @@ struct DMA_convert_data_back {
115104 using SrcDataType = typename nnet::ExtractDataType<PipeDataType>::value_type;
116105 constexpr auto srcTypeSize = std::tuple_size<SrcDataType>{};
117106
118- [[intel::fpga_register]]
119- typename nnet::ExtractPipeType<src_pipe>::value_type packet;
120-
107+ [[intel::fpga_register]] typename nnet::ExtractPipeType<src_pipe>::value_type packet;
108+
121109 // Drain the output pipe and write result to memory.
122110 for (size_t i = 0 ; i < num_iteration; i++) {
123111 packet = src_pipe::read ();
@@ -129,7 +117,7 @@ struct DMA_convert_data_back {
129117 }
130118};
131119
132- } // namespace nnet
120+ } // namespace nnet
133121
134122// Need to declare the input and output pipes
135123
0 commit comments