![]() |
StencilStream v3.0.0
SYCL-based Stencil Simulation Framework Targeting FPGAs
|
A grid class for the monotile architecture. More...
#include <Grid.hpp>
Classes | |
class | GridAccessor |
An accessor for the monotile grid. More... | |
Public Member Functions | |
Grid (uindex_t grid_width, uindex_t grid_height) | |
Create a new, uninitialized grid with the given dimensions. | |
Grid (sycl::range< 2 > range) | |
Create a new, uninitialized grid with the given dimensions. | |
Grid (sycl::buffer< Cell, 2 > buffer) | |
Create a new grid with the same size and contents as the given SYCL buffer. | |
Grid (Grid const &other_grid) | |
Create a new reference to the given grid. | |
Grid | make_similar () const |
Create an new, uninitialized grid with the same size as the current one. | |
uindex_t | get_grid_width () const |
Return the width, or number of columns, of the grid. | |
uindex_t | get_grid_height () const |
Return the height, or number of rows, of the grid. | |
void | copy_from_buffer (sycl::buffer< Cell, 2 > input_buffer) |
Copy the contents of the SYCL buffer into the grid. | |
void | copy_to_buffer (sycl::buffer< Cell, 2 > output_buffer) |
Copy the contents of the grid into the SYCL buffer. | |
template<typename in_pipe > | |
sycl::event | submit_read (sycl::queue queue) |
Submit a kernel that sends the contents of the grid into a pipe. | |
template<typename out_pipe > | |
sycl::event | submit_write (sycl::queue queue) |
Submit a kernel that receives cells from the pipe and writes them to the grid. | |
Static Public Attributes | |
static constexpr uindex_t | dimensions = 2 |
The number of dimensions of the grid. | |
A grid class for the monotile architecture.
This grid, which fullfils the Grid concept, contains a two-dimensional buffer of cells to be used together with the StencilUpdate class.
The contents of the grid can be accessed by a host-side program using the GridAccessor class template. For example, one can write the contents of a grid
object as follows:
Alternatively, one may write their data into a SYCL buffer and copy it into the grid using the method copy_from_buffer. The method copy_to_buffer does the reverse: It writes the contents of the grid into a SYCL buffer.
On the device side, the data can be read or written with the help of the method templates submit_read and submit_write. Those take a SYCL pipe as a template argument and enqueue kernels that read/write the contents of the grid to/from the pipes.
Cell | The cell type to store. |
word_size | The word size of the memory system, in bytes. This is used to optimize the kernels submitted by submit_read and submit_write. |
|
inline |
Create a new, uninitialized grid with the given dimensions.
grid_width | The width, or number of columns, of the new grid. |
grid_height | The height, or number of rows, of the new grid. |
|
inline |
Create a new, uninitialized grid with the given dimensions.
range | The range of the new grid. The first index will be the width and the second index will be the height of the grid. |
|
inline |
Create a new grid with the same size and contents as the given SYCL buffer.
The contents of the buffer will be copied to the grid by the host. The SYCL buffer can later be used elsewhere.
buffer | The buffer with the contents of the new grid. |
|
inline |
Create a new reference to the given grid.
The newly created grid object will point to the same underlying data as the referenced grid. Changes made via the newly created grid object will also be visible to the old grid object, and vice-versa.
other_grid | The other grid the new grid should reference. |
|
inline |
Copy the contents of the SYCL buffer into the grid.
The SYCL buffer will be accessed read-only one the host; It may be used elsewhere too. The buffer however has to have the same size as the grid, otherwise a std::range_error is thrown.
input_buffer | The buffer to copy the data from. |
std::range_error | The size of the buffer does not match the grid. |
|
inline |
Copy the contents of the grid into the SYCL buffer.
The contents of the SYCL buffer will be overwritten on the host. The buffer also has to have the same size as the grid, otherwise a std::range_error is thrown.
output_buffer | The buffer to copy the data to. |
std::range_error | The size of the buffer does not match the grid. |
|
inline |
Return the height, or number of rows, of the grid.
|
inline |
Return the width, or number of columns, of the grid.
|
inline |
Create an new, uninitialized grid with the same size as the current one.
|
inline |
Submit a kernel that sends the contents of the grid into a pipe.
The entirety of the grid will be send into the pipe in column-major order, meaning that the last index (which denotes the row) will change the quickest. The method returns the event of the launched kernel immediately.
This method is explicitly part of the user-facing API: You are allowed and encouraged to use this method to feed custom kernels.
in_pipe | The pipe the data is sent into. |
queue | The queue to submit the kernel to. |
|
inline |
Submit a kernel that receives cells from the pipe and writes them to the grid.
The kernel expects that the entirety of the grid can be overwritten with the cells read from the pipe. Also, it expects that the cells are sent in column-major order, meaning that the last index (which denotes the row) will change the quickest. The method returns the event of the launched kernel immediately.
This method is explicitly part of the user-facing API: You are allowed and encouraged to use this method to feed custom kernels.
out_pipe | The pipe the data is received from. |
queue | The queue to submit the kernel to. |
|
staticconstexpr |
The number of dimensions of the grid.
May be changed in the future when other dimensions are supported.