StencilStream v3.0.0
SYCL-based Stencil Simulation Framework Targeting FPGAs
Loading...
Searching...
No Matches
Helpers.hpp
Go to the documentation of this file.
1/*
2 * Copyright © 2020-2024 Jan-Oliver Opdenhövel, Paderborn Center for Parallel Computing, Paderborn
3 * University
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
6 * associated documentation files (the “Software”), to deal in the Software without restriction,
7 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
8 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in all copies or
12 * substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
15 * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 */
20#pragma once
21#include "Index.hpp"
22#include <numeric>
23
24namespace stencil {
25
34inline constexpr uindex_t n_cells_to_n_words(uindex_t n_cells, uindex_t word_length) {
35 return n_cells / word_length + (n_cells % word_length == 0 ? 0 : 1);
36}
37
45template <typename T> struct Padded {
47} __attribute__((aligned(std::bit_ceil(sizeof(T)))));
48
49} // namespace stencil
Definition AccessorSubscript.hpp:24
BOOST_PP_CAT(BOOST_PP_CAT(uint, STENCIL_INDEX_WIDTH), _t) uindex_t
An unsigned integer of configurable width.
Definition Index.hpp:42
constexpr uindex_t n_cells_to_n_words(uindex_t n_cells, uindex_t word_length)
Compute the number of words necessary to store a given number of cells.
Definition Helpers.hpp:34
struct stencil::Padded __attribute__((aligned(std::bit_ceil(sizeof(T)))))
A container with padding to the next power of two.
Definition Helpers.hpp:45
T value
Definition Helpers.hpp:46