## Coverage Report

#### Created: 2026-01-25 15:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)

    /home/noah/src/trueno/src/tiling/packing.rs

    Line
    Count
    Source
    1
    //! Memory packing layout utilities.
    2
    3
    4
    /// Memory layout for packed matrices
    5
    #[derive(Debug, Clone, Copy, PartialEq, Eq)]
    6
    pub enum PackingLayout {
    7
        /// Row-major (C-style)
    8
        RowMajor,
    9
        /// Column-major (Fortran-style)
    10
        ColumnMajor,
    11
        /// Panel-major for A (Goto algorithm)
    12
        PanelMajorA,
    13
        /// Panel-major for B (Goto algorithm)
    14
        PanelMajorB,
    15
    }
    16
    17
    /// Calculate packed index for panel-major A layout
    18
    ///
    19
    /// Panel-major stores micro-panels contiguously for sequential access.
    20
    #[must_use]
    21
    #[inline]
    22
    0
    pub fn pack_a_index(row: usize, col: usize, mr: usize, kc: usize, _mc: usize) -> usize {
    23
    0
        let panel = row / mr;
    24
    0
        let row_in_panel = row % mr;
    25
    0
        panel * mr * kc + col * mr + row_in_panel
    26
    0
    }
    27
    28
    /// Calculate packed index for panel-major B layout
    29
    #[must_use]
    30
    #[inline]
    31
    0
    pub fn pack_b_index(row: usize, col: usize, nr: usize, kc: usize, _nc: usize) -> usize {
    32
    0
        let panel = col / nr;
    33
    0
        let col_in_panel = col % nr;
    34
    0
        panel * kc * nr + row * nr + col_in_panel
    35
    0
    }
    36
    37
    /// Apply XOR swizzling for shared memory bank conflict avoidance
    38
    ///
    39
    /// Pattern: idx_swizzled = idx ^ (idx >> 5) for 32-bank architectures.
    40
    #[must_use]
    41
    #[inline]
    42
    0
    pub fn swizzle_index(idx: usize) -> usize {
    43
    0
        idx ^ (idx >> 5)
    44
    0
    }