accessor#

group Accessor types

Accessors provide an interface to access values in stores. Access modes are encoded in the accessor types so that the compiler can catch invalid accesses. Accessors also provide bounds checks (which can be turned on with a compile flag).

All accessors have a ptr method that returns a raw pointer to the underlying allocation. The caller can optionally pass an array to query strides of dimensions, necessary for correct accesse. Unlike the accesses mediated by accessors, raw pointer accesses are not protected by Legate, and thus the developer should make sure of safety of the accesses.

The most common mistake with raw pointers from reduction accessors are that the code overwrites values to the elements, instead of reducing them. The key contract with reduction is that the values must be reduced to the elements in the store. So, any client code that uses a raw pointer to a reduction store should make sure that it makes updates to the effect of reducing its contributions to the original elements. Not abiding by this contract can lead to non-deterministic conrrectness issues.

Typedefs

template<typename FT, int N, typename T = coord_t>
using AccessorRO = Legion::FieldAccessor<LEGION_READ_ONLY, FT, N, T, Realm::AffineAccessor<FT, N, T>>#

Read-only accessor.

See legion.h for a complete list of supported operators.

template<typename FT, int N, typename T = coord_t>
using AccessorWO = Legion::FieldAccessor<LEGION_WRITE_DISCARD, FT, N, T, Realm::AffineAccessor<FT, N, T>>#

Write-only accessor.

See legion.h for a complete list of supported operators.

template<typename FT, int N, typename T = coord_t>
using AccessorRW = Legion::FieldAccessor<LEGION_READ_WRITE, FT, N, T, Realm::AffineAccessor<FT, N, T>>#

Read-write accessor.

See legion.h for a complete list of supported operators.

template<typename REDOP, bool EXCLUSIVE, int N, typename T = coord_t>
using AccessorRD = Legion::ReductionAccessor<REDOP, EXCLUSIVE, N, T, Realm::AffineAccessor<typename REDOP::RHS, N, T>>#

Reduction accessor.

Unlike the other accessors, an index expression on a reduction accessor allows the client to perform only two operations, <<= and reduce, both of which reduce a value to the chosen element.

See legion.h for details about the reduction accessor.