Skip to content

Commit 2bec6e7

Browse files
authored
Merge pull request #1812 from shuoniu-intel/development
Adapt to the `get_pointer` return type change from upstream intel/llvm
2 parents 69c5938 + f4a90d0 commit 2bec6e7

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

DirectProgramming/C++SYCL_FPGA/Tutorials/Features/experimental/latency_control/src/latency_control.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ void KernelRun(const std::vector<int> &in_data, std::vector<int> &out_data,
4545
sycl::no_init);
4646

4747
h.single_task<LatencyControl>([=]() [[intel::kernel_args_restrict]] {
48-
auto in_ptr = in_accessor.get_pointer();
49-
auto out_ptr = out_accessor.get_pointer();
48+
auto in_ptr =
49+
in_accessor.template get_multi_ptr<sycl::access::decorated::no>();
50+
auto out_ptr =
51+
out_accessor.template get_multi_ptr<sycl::access::decorated::no>();
5052

5153
for (size_t i = 0; i < size; i++) {
5254
// The following load has a label 0.

DirectProgramming/C++SYCL_FPGA/Tutorials/Features/lsu_control/README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This sample is an FPGA tutorial that demonstrates how to configure the load-stor
1010

1111
## Purpose
1212

13-
The compiler creates load-store units (LSU) to access off-chip data. The compiler has many options to choose from when configuring each LSU. The SYCL*-compliant LSU controls extension allows you to override the compiler's internal heuristics and control the architecture of each LSU. An introduction to the extension in this tutorial will explain the available options, extension defaults, appropriate use cases, and area trade-offs.
13+
The compiler creates load-store units (LSU) to access memories, both on-chip and off-chip. The compiler has many options to choose from when configuring each LSU. The SYCL*-compliant LSU controls extension allows you to override the compiler's internal heuristics and control the architecture of individual LSUs that are used to access variable-latency off-chip memory. An introduction to the extension in this tutorial will explain the available options, extension defaults, appropriate use cases, and area trade-offs.
1414

1515
## Prerequisites
1616

@@ -63,7 +63,7 @@ The sample illustrates the following important concepts.
6363

6464
### LSUs and LSU Styles
6565

66-
An LSU is a block that handles loading and storing data to and from memory. Off-chip memory can have variable latency. To mitigate this, different LSU implementations, referred to as styles, are available.
66+
An LSU is a block that handles loading and storing data to and from memory. Off-chip memory can have variable latency. To mitigate this, different LSU styles are available.
6767

6868
The two LSU styles used in this tutorial are listed below:
6969

@@ -77,11 +77,15 @@ The best LSU style depends on the memory access pattern in your design. There ar
7777

7878
In addition to these two styles, there are also LSU modifiers. LSU modifiers are add-ons that can be combined with LSU styles, such as caching, which can be combined with the burst-coalesced LSU style.
7979

80-
For more details on LSU modifiers and LSU styles, refer to the Memory Accesses section in the [FPGA Optimization Guide for Intel® oneAPI Toolkits Developer Guide](https://software.intel.com/content/www/us/en/develop/documentation/oneapi-fpga-optimization-guide).
80+
For more details on LSU modifiers and LSU styles, refer to the *Memory Accesses* section in the [FPGA Optimization Guide for Intel® oneAPI Toolkits Developer Guide](https://www.intel.com/content/www/us/en/docs/oneapi-fpga-add-on/optimization-guide/current/memory-accesses.html).
8181

8282
### Introduction to the LSU Control Extension
8383

84-
The class: ```ext::intel::lsu``` enables you to control the architecture of the LSU. The class has two member functions, `load()` and `store()`, which allow loading from and storing to a global pointer.
84+
The class: ```ext::intel::lsu``` enables you to control the architecture of the LSU. The class has two member functions, `load()` and `store()`, which allow loading from and storing to a global pointer (via `sycl::multi_ptr` rather than raw pointer).
85+
86+
There are two steps to use the LSU control extension to optimize LSU behaviour:
87+
1. Get a `sycl::multi_ptr` representation of the memory you wish to access using the `get_multi_ptr<>()` function.
88+
2. Access this `sycl::multi_ptr` using one of the LSU control functions.
8589

8690
The table below summarizes the LSU control extension parameters. The parameters will be respected to the extent possible.
8791

@@ -97,17 +101,17 @@ If the default options are used, a pipelined LSU is implemented.
97101
#### Example: Controlling the `prefetch` and `statically_coalesce` Parameters
98102

99103
```c++
100-
//Creating typedefs using the LSU controls class
101-
//for each combination of LSU options desired.
104+
// Creating typedefs using the LSU controls class
105+
// for each combination of LSU options desired.
102106
using PrefetchingLSU = ext::intel::lsu<ext::intel::prefetch<true>,
103-
ext::intel::statically_coalesce<false>>;
107+
ext::intel::statically_coalesce<false>>;
104108
// ...
105109
q.submit([&](handler &h) {
106110
h.single_task<Kernel>([=] {
107-
//Pointer to external memory
108-
auto input_ptr = input_accessor.get_pointer();
111+
// Pointer to external memory
112+
auto input_ptr = input_accessor.template get_multi_ptr<access::decorated::no>();
109113

110-
//Compiler will use a Prefetch LSU for this load
114+
// Compiler will use a Prefetch LSU for this load
111115
int in_data = PrefetchingLSU::load(input_ptr);
112116

113117
//...
@@ -116,7 +120,7 @@ q.submit([&](handler &h) {
116120
```
117121

118122
Currently, not every combination of parameters is valid in the compiler.
119-
For more details on the descriptions of LSU controls, styles, and modifiers refer to the *FPGA LSU Controls* section in the [FPGA Optimization Guide for Intel® oneAPI Toolkits Developer Guide](https://software.intel.com/content/www/us/en/develop/documentation/oneapi-fpga-optimization-guide).
123+
For more details on the descriptions of LSU controls, styles, and modifiers refer to the *Load-Store Unit Controls* section in the [FPGA Optimization Guide for Intel® oneAPI Toolkits Developer Guide](https://www.intel.com/content/www/us/en/docs/oneapi-fpga-add-on/optimization-guide/current/load-store-unit-controls.html).
120124

121125
### Tutorial Overview
122126

DirectProgramming/C++SYCL_FPGA/Tutorials/Features/lsu_control/src/lsu_control.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ void KernelRun(const std::vector<int> &input_data, const size_t &input_size,
7979

8080
// Kernel that uses the prefetch LSU
8181
h.single_task<KernelPrefetch>([=]() [[intel::kernel_args_restrict]] {
82-
auto input_ptr = input_a.get_pointer();
82+
auto input_ptr =
83+
input_a.template get_multi_ptr<access::decorated::no>();
8384
auto output_ptr = output_a.get_pointer();
8485

8586
int total = 0;
@@ -96,7 +97,8 @@ void KernelRun(const std::vector<int> &input_data, const size_t &input_size,
9697

9798
// Kernel that uses the burst-coalesced LSU
9899
h.single_task<KernelBurst>([=]() [[intel::kernel_args_restrict]] {
99-
auto input_ptr = input_a.get_pointer();
100+
auto input_ptr =
101+
input_a.template get_multi_ptr<access::decorated::no>();
100102
auto output_ptr = output_a.get_pointer();
101103

102104
int total = 0;

0 commit comments

Comments
 (0)