Struct DryRunOps

Struct Documentation

struct DryRunOps

Shared op bodies for the two DryRun Result concrete types.

Both ResultDryRun and ResultDryRunNested carry exactly an (index list, ExtentOverrides, CostModel) triple and differ only in what they additionally expose (ResultDryRunNested splits its index list into outer()/inner() views for CSV-composite-aware inspection/testing). Implemented once here so the two classes’ prod/sum/permute/slice_mode/ mode_batches bodies are one-line forwards, not near-duplicated logic.

Public Static Functions

static inline void record_op_cost(CostModel const &cm, double flops, double exec)

Publish one op’s realized-extent flops / exec: to the eval loop’s build tally (through last_op_flops/last_op_exec), to the eval trace, and to the replay cost sink if one is attached to cm. Called only when the eval trace is on.

static inline ResultPtr sum(container::svector<Index> const&, ExtentOverrides const &ov, std::shared_ptr<CostModel const> const &cm, Result const &other, std::array<std::any, 3> const &annot, ExtentOverrides const &lob = {})
static inline ResultPtr prod(container::svector<Index> const &idx, ExtentOverrides const &ov, std::shared_ptr<CostModel const> const &cm, Result const &other, std::array<std::any, 3> const &annot, ExtentOverrides const &lob = {})
static inline ResultPtr pow(container::svector<Index> const &idx, ExtentOverrides const &ov, std::shared_ptr<CostModel const> const &cm, ExtentOverrides const &lob = {})

Element-wise power: the result has the operand’s shape (and slicing). Its cost, one operation per element, is recorded like a product’s.

static inline ResultPtr broadcast(container::svector<Index> const &idx, ExtentOverrides const &ov, std::shared_ptr<CostModel const> const &cm, std::array<std::any, 2> const &ann, container::svector<ResultPtr> const &new_mode_ranges, ExtentOverrides const &lob = {})

Broadcast: the result is shaped by the result annotation ann[1]; a mode of the operand annotation ann[0] keeps the operand’s slicing (ov, lob), every other mode takes that of its rank-1 range in new_mode_ranges (in result mode order). Its cost, one write per result element, is recorded like a product’s.

static inline ResultPtr permute(ExtentOverrides const &ov, std::shared_ptr<CostModel const> const &cm, std::array<std::any, 2> const &ann, ExtentOverrides const &lob = {})
static inline ResultPtr slice_mode(container::svector<Index> const &idx, ExtentOverrides const &ov, std::shared_ptr<CostModel const> const &cm, std::size_t mode, std::size_t elem_lo, std::size_t elem_hi, ExtentOverrides const &lob = {})
static inline void write_into_slice(container::svector<Index> const &idx, ExtentOverrides &ov, AssembledCoverage &cov, std::shared_ptr<CostModel const> const &cm, Result const &block, std::size_t mode, std::size_t block_lo, std::size_t block_hi, ExtentOverrides const &lob)

Scatter block into the [block_lo, block_hi) element slice of the destination’s mode mode – the inverse of slice_mode(). Zero-data: updates only the destination’s modelled size and assembled-coverage bookkeeping. ov and cov are the destination’s (mutated in place), lob its lobounds.

static inline container::svector<std::pair<std::size_t, std::size_t>> mode_batches(container::svector<Index> const &idx, ExtentOverrides const &ov, std::shared_ptr<CostModel const> const &cm, std::size_t mode, std::size_t target_batch_size)