Class ReorderingContext¶
Defined in File reordering_context.hpp
Inheritance Relationships¶
Base Type¶
public sequant::ExportContext(Class ExportContext)
Derived Types¶
public sequant::ItfContext(Class ItfContext)public sequant::JuliaTensorOperationsGeneratorContext(Class JuliaTensorOperationsGeneratorContext)public sequant::PythonEinsumGeneratorContext(Class PythonEinsumGeneratorContext)
Class Documentation¶
-
class ReorderingContext : public sequant::ExportContext¶
An export context class that implements functionality for reordering indices in tensors for better cache locality during access, assuming the full tensor will be held in memory and all elements will be iterated over.
In other words, this class will use existing tensor symmetries to move the slot belonging to the largest index space into the slot with highest cache-locality (depending on the chosen memory layout).
Subclassed by sequant::ItfContext, sequant::JuliaTensorOperationsGeneratorContext, sequant::PythonEinsumGeneratorContext
Public Functions
-
inline explicit ReorderingContext(MemoryLayout layout)¶
-
inline MemoryLayout memory_layout() const¶
-
inline void set_memory_layout(MemoryLayout layout)¶
-
virtual bool rewrite(Tensor &tensor) const override¶
Performs necessary (backend-specific) modifications (if any) on the given Tensor in-place
- Parameters:
tensor – The Tensor to be modified
- Returns:
Whether any modification has been performed
-
inline bool rewriting_enabled() const¶
-
inline void enable_rewriting(bool enable)¶
Protected Functions
-
bool is_less(const IndexSpace &lhs, const IndexSpace &rhs) const¶
-
bool is_ordered(const IndexSpace &lhs, const IndexSpace &rhs) const¶
-
bool needs_swap(const IndexSpace &lhs, const IndexSpace &rhs) const¶
-
inline explicit ReorderingContext(MemoryLayout layout)¶