Skip to content

strided-kernel: incremental offsets in erased reduce and indexed replay hot loops #213

Description

@shinaoka

Part of #199 (Phase 3, performance). All file:line references are pinned to origin/main at 9da9b9f.

Per-element offset recomputation in tensor-sized loops, against the layout rule (avoid per-element flat-to-multi-index decoding; hot loops must not repeat post-validation checks):

  • erased.rs:3378 and :3436 (erased axis reduction, serial and parallel): checked_strided_offset(...)? per element, a rank-length checked mul/add chain, plus src_idx rebuild per output element; runs dest_total * reduce_total times.

  • Same pattern across static_indexing_plan.rs (:497, :528, :611, :661, :713, :763) and gather_plan.rs (:373, :453, :688, :787, :976, :1075, :1371).

  • erased.rs:2376 raw_any: full div/mod flat-to-multi decode per element.

  • Hoist validation, precompute stride tables, and step offsets incrementally (the elem_loops! traversal in kernel.rs:244 and advance_col_major_index already do this correctly; reuse them).

  • Benchmark before/after across sizes and ranks per the repository benchmark rules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions