20 template <
typename Matrix>
32 template <
typename V = default_vec>
193 template <
typename V = default_vec>
195 return value.template load<V>(i);
204 template <
typename V = default_vec>
206 return value.template loadu<V>(i);
215 template <
typename V = default_vec>
217 value.template stream<V>(in, i);
226 template <
typename V = default_vec>
228 value.template store<V>(in, i);
237 template <
typename V = default_vec>
239 value.template storeu<V>(in, i);
247 template <
typename E>
248 bool alias(
const E& rhs)
const noexcept {
249 return value.
alias(rhs);
256 template <
typename Y>
258 value.ensure_gpu_up_to_date();
266 template <
typename Y>
268 value.ensure_gpu_up_to_date();
278 template <
typename L>
287 template <
typename L>
296 template <
typename L>
305 template <
typename L>
314 template <
typename L>
323 template <
typename L>
384 value.ensure_gpu_allocated();
391 value.ensure_gpu_up_to_date();
399 value.ensure_cpu_up_to_date();
407 value.gpu_copy_from(gpu_memory);
void validate_gpu() const noexcept
Validates the GPU memory.
Definition: adapter.hpp:375
bool is_gpu_up_to_date() const noexcept
Indicates if the GPU memory is up to date.
Definition: adapter.hpp:422
void visit([[maybe_unused]] const detail::evaluator_visitor &visitor) const
Apply the given visitor to this expression and its descendants.
Definition: adapter.hpp:334
const value_type & operator()(size_t i, size_t j) const noexcept
Access the (i, j) element of the 2D matrix.
Definition: adapter.hpp:111
void ensure_gpu_allocated() const
Ensures that the GPU memory is allocated and that the GPU memory is up to date (to undefined value)...
Definition: adapter.hpp:383
void assign_to(L &&lhs) const
Assign to the given left-hand-side expression.
Definition: adapter.hpp:279
const value_type & operator[](size_t i) const noexcept
Returns the element at the given index.
Definition: adapter.hpp:120
auto & gpu_compute_hint([[maybe_unused]] Y &y)
Return a GPU computed version of this expression.
Definition: adapter.hpp:257
value_type & operator[](size_t i) noexcept
Returns the element at the given index.
Definition: adapter.hpp:129
value_type * gpu_memory() const noexcept
Return GPU memory of this expression, if any.
Definition: adapter.hpp:340
void std_assign_evaluate(Expr &&expr, Result &&result)
Evaluation of the expr into result.
Definition: evaluator.hpp:1176
memory_type memory_start() noexcept
Returns a pointer to the first element in memory.
Definition: adapter.hpp:150
typename V::template vec_type< value_type > vec_type
The vectorization type for V.
Definition: adapter.hpp:33
void store(vec_type< V > in, size_t i) noexcept
Store several elements in the matrix at once.
Definition: adapter.hpp:227
adapter() noexcept
Construct a new matrix and fill it with zeros.
Definition: adapter.hpp:44
void storeu(vec_type< V > in, size_t i) noexcept
Store several elements in the matrix at once.
Definition: adapter.hpp:238
void assign_mod_to(L &&lhs) const
Modulo the given left-hand-side expression.
Definition: adapter.hpp:324
const_memory_type memory_end() const noexcept
Returns a pointer to the past-the-end element in memory.
Definition: adapter.hpp:183
void assign_div_to(L &&lhs) const
Divide the given left-hand-side expression.
Definition: adapter.hpp:315
static constexpr size_t dimensions() noexcept
Returns the number of dimensions of the matrix.
Definition: adapter.hpp:430
void ensure_gpu_up_to_date() const
Allocate memory on the GPU for the expression and copy the values into the GPU.
Definition: adapter.hpp:390
const value_type * const_memory_type
The const memory type.
Definition: adapter.hpp:27
value_t< matrix_t > value_type
The value type.
Definition: adapter.hpp:25
vec_type< V > load(size_t i) const noexcept
Load several elements of the matrix at once.
Definition: adapter.hpp:194
void assign_sub_to(L &&lhs) const
Sub from the given left-hand-side expression.
Definition: adapter.hpp:297
const_memory_type memory_start() const noexcept
Returns a pointer to the first element in memory.
Definition: adapter.hpp:161
adapter(size_t dim, value_type value) noexcept
Construct a new adapter matrix and fill it witht the given value.
Definition: adapter.hpp:73
void assign_add_to(L &&lhs) const
Add to the given left-hand-side expression.
Definition: adapter.hpp:288
Root namespace for the ETL library.
Definition: adapter.hpp:15
adapter & operator=(const adapter &rhs)=default
Assign to the matrix by copy.
void ensure_cpu_up_to_date() const
Copy back from the GPU to the expression memory if necessary.
Definition: adapter.hpp:398
auto dim(E &&value, size_t i) -> detail::identity_helper< E, dim_view< detail::build_identity_type< E >, D >>
Return a view representing the ith Dth dimension.
Definition: view_expression_builder.hpp:25
value_type * memory_type
The memory type.
Definition: adapter.hpp:26
A base class for adapters.
Definition: adapter.hpp:21
Visitor to perform local evaluation when necessary.
Definition: eval_visitors.hpp:23
matrix_t value
The adapted matrix.
Definition: adapter.hpp:36
void std_mod_evaluate(Expr &&expr, Result &&result)
Compound modulo evaluation of the expr into result.
Definition: evaluator.hpp:1271
void invalidate_cpu() const noexcept
Invalidates the CPU memory.
Definition: adapter.hpp:354
const auto & gpu_compute_hint([[maybe_unused]] Y &y) const
Return a GPU computed version of this expression.
Definition: adapter.hpp:267
void std_mul_evaluate(Expr &&expr, Result &&result)
Compound multiply evaluation of the expr into result.
Definition: evaluator.hpp:1233
memory_type memory_end() noexcept
Returns a pointer to the past-the-end element in memory.
Definition: adapter.hpp:172
void gpu_evict() const noexcept
Evict the expression from GPU.
Definition: adapter.hpp:347
matrix_t expr_t
The wrapped expression type.
Definition: adapter.hpp:23
bool alias(const E &rhs) const noexcept
Test if this expression aliases with the given expression.
Definition: adapter.hpp:248
void validate_cpu() const noexcept
Validates the CPU memory.
Definition: adapter.hpp:368
void assign_mul_to(L &&lhs) const
Multiply the given left-hand-side expression.
Definition: adapter.hpp:306
void gpu_copy_from(const value_type *gpu_memory) const
Copy from GPU to GPU.
Definition: adapter.hpp:406
void std_sub_evaluate(Expr &&expr, Result &&result)
Compound subtract evaluation of the expr into result.
Definition: evaluator.hpp:1214
adapter(value_type value) noexcept
Construct a new adapter matrix and fill it witht the given value.
Definition: adapter.hpp:55
adapter(size_t dim) noexcept
Construct a new adapter matrix and fill it with zeros.
Definition: adapter.hpp:63
typename decay_traits< E >::value_type value_t
Traits to extract the value type out of an ETL type.
Definition: tmp.hpp:81
void std_div_evaluate(Expr &&expr, Result &&result)
Compound divide evaluation of the expr into result.
Definition: evaluator.hpp:1252
bool is_cpu_up_to_date() const noexcept
Indicates if the CPU memory is up to date.
Definition: adapter.hpp:414
vec_type< V > loadu(size_t i) const noexcept
Load several elements of the matrix at once.
Definition: adapter.hpp:205
void invalidate_gpu() const noexcept
Invalidates the GPU memory.
Definition: adapter.hpp:361
value_type read_flat(size_t i) const noexcept
Definition: adapter.hpp:139
void stream(vec_type< V > in, size_t i) noexcept
Store several elements in the matrix at once, using non-temporal stores.
Definition: adapter.hpp:216
Matrix matrix_t
The adapted matrix type.
Definition: adapter.hpp:22
void std_add_evaluate(Expr &&expr, Result &&result)
Compound add evaluation of the expr into result.
Definition: evaluator.hpp:1195