<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="820" viewBox="0 0 1200 820" role="img" aria-label="TINTERLEAVE tile operation diagram">
<defs>
  <marker id="arrow" markerWidth="8" markerHeight="8" refX="7" refY="4" orient="auto"><path d="M0,0 L0,8 L8,4 z" fill="#2D8B57"/></marker>
  <marker id="axisArrow" markerWidth="8" markerHeight="8" refX="7" refY="4" orient="auto"><path d="M0,0 L0,8 L8,4 z" fill="#64748b"/></marker>
</defs>
<style>
svg { font-family: Arial, Helvetica, sans-serif; }
.title { font-size: 28px; font-weight: 700; fill: #0f172a; }
.subtitle { font-size: 13px; fill: #334155; }
.meta { font-size: 11px; fill: #64748b; }
.frame { fill: white; }
.panel { fill: #E8F5E9; stroke: #e2e8f0; stroke-width: 1.5; rx: 14; }
.tileLabel { font-size: 13px; font-weight: 700; fill: #0f172a; }
.tileBorder { fill: none; stroke: #475569; stroke-width: 1.5; }
.cell { fill: #ffffff; stroke: #94a3b8; stroke-width: 1; }
.cellSrc0 { fill: #dbeafe; stroke: #94a3b8; stroke-width: 1; }
.cellSrc1 { fill: #fed7aa; stroke: #94a3b8; stroke-width: 1; }
.cellMasked { fill: #e2e8f0; stroke: #94a3b8; stroke-width: 1; }
.cellHL0 { stroke-width: 2; stroke: #2563eb; }
.cellHL1 { stroke-width: 2; stroke: #ea580c; }
.cellText { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 10px; fill: #0f172a; }
.arrow { stroke-width: 1.5; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.axisLine { stroke: #64748b; stroke-width: 1.5; fill: none; }
.axisText { font-size: 9px; fill: #64748b; font-weight: 700; }
.opBox { fill: #ffffff; stroke: #2D8B57; stroke-width: 2; rx: 10; }
.opText { font-size: 11px; font-weight: 800; fill: #0f172a; }
.procBox { fill: #f8fafc; stroke: #cbd5e1; stroke-width: 1.5; rx: 12; }
.procTitle { font-size: 13px; font-weight: 700; fill: #0f172a; }
.procText { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 11px; fill: #0f172a; }
.validBox { fill: none; stroke-width: 2; stroke-dasharray: 6 4; }
.streamLabel { font-size: 12px; fill: #334155; font-weight: 600; }
.posLabel { font-size: 9px; fill: #64748b; font-weight: 600; }
.splitLine { stroke: #475569; stroke-width: 2; stroke-dasharray: 4 2; }
.halfLabel { font-size: 11px; fill: #334155; font-weight: 600; }
.streamBorder { fill: none; stroke: #94a3b8; stroke-width: 1; rx: 4; }
</style>
<rect x="0" y="0" width="1200" height="820" class="frame" />
<rect x="24" y="24" width="1152" height="772" class="panel" />
<text x="40" y="46" class="title">TINTERLEAVE</text>
<text x="40" y="72" class="subtitle">Interleave two source tiles into two destination tiles (even/odd split).</text>
<text x="40" y="92" class="meta">Two-source form: src0, src1 &#x2192; interleaved stream &#x2192; dst0 (first half), dst1 (second half)</text>
<text x="1160" y="92" class="meta" text-anchor="end">Legend: blue=src0; orange=src1; dashed=valid region; shaded=masked</text>
<line x1="36" y1="104" x2="1164" y2="104" stroke="#e2e8f0" stroke-width="1.5" />
<text x="600" y="130" class="subtitle" text-anchor="middle" fill="#2D8B57">interleaved[2k] = src0[i,k];  interleaved[2k+1] = src1[i,k]</text>
<text x="600" y="150" class="subtitle" text-anchor="middle" fill="#2D8B57">dst0[i,j] = interleaved[j];  dst1[i,j] = interleaved[Cv+j]</text>

<text x="225" y="168" class="tileLabel" text-anchor="middle">src0</text>
<rect x="170" y="180" width="110" height="110" class="tileBorder" />
<rect x="170" y="180" width="22" height="22" class="cell" />
<rect x="192" y="180" width="22" height="22" class="cell" />
<rect x="214" y="180" width="22" height="22" class="cell" />
<rect x="236" y="180" width="22" height="22" class="cell" />
<rect x="258" y="180" width="22" height="22" class="cell cellMasked" />
<rect x="170" y="200" width="22" height="22" class="cellSrc0 cellHL0" />
<rect x="192" y="200" width="22" height="22" class="cellSrc0 cellHL0" />
<rect x="214" y="200" width="22" height="22" class="cellSrc0 cellHL0" />
<rect x="236" y="200" width="22" height="22" class="cellSrc0 cellHL0" />
<rect x="258" y="200" width="22" height="22" class="cell cellMasked" />
<text x="181" y="215" class="cellText" text-anchor="middle">a&#x2080;</text>
<text x="203" y="215" class="cellText" text-anchor="middle">a&#x2081;</text>
<text x="225" y="215" class="cellText" text-anchor="middle">a&#x2082;</text>
<text x="247" y="215" class="cellText" text-anchor="middle">a&#x2083;</text>
<rect x="170" y="222" width="22" height="22" class="cell" />
<rect x="192" y="222" width="22" height="22" class="cell" />
<rect x="214" y="222" width="22" height="22" class="cell" />
<rect x="236" y="222" width="22" height="22" class="cell" />
<rect x="258" y="222" width="22" height="22" class="cell cellMasked" />
<rect x="170" y="244" width="22" height="22" class="cell" />
<rect x="192" y="244" width="22" height="22" class="cell" />
<rect x="214" y="244" width="22" height="22" class="cell" />
<rect x="236" y="244" width="22" height="22" class="cell" />
<rect x="258" y="244" width="22" height="22" class="cell cellMasked" />
<rect x="170" y="266" width="22" height="22" class="cell cellMasked" />
<rect x="192" y="266" width="22" height="22" class="cell cellMasked" />
<rect x="214" y="266" width="22" height="22" class="cell cellMasked" />
<rect x="236" y="266" width="22" height="22" class="cell cellMasked" />
<rect x="258" y="266" width="22" height="22" class="cell cellMasked" />
<rect x="170" y="180" width="88" height="88" class="validBox" stroke="#2563eb" />
<text x="174" y="264" class="axisText" fill="#2563eb">Rv</text>
<text x="254" y="192" class="axisText" text-anchor="end" fill="#2563eb">Cv</text>
<path d="M 180 190 L 246 190" class="axisLine" marker-end="url(#axisArrow)" />
<path d="M 180 190 L 180 256" class="axisLine" marker-end="url(#axisArrow)" />
<text x="248" y="194" class="axisText">c</text>
<text x="178" y="258" class="axisText" text-anchor="end">r</text>

<text x="855" y="168" class="tileLabel" text-anchor="middle">src1</text>
<rect x="800" y="180" width="110" height="110" class="tileBorder" />
<rect x="800" y="180" width="22" height="22" class="cell" />
<rect x="822" y="180" width="22" height="22" class="cell" />
<rect x="844" y="180" width="22" height="22" class="cell" />
<rect x="866" y="180" width="22" height="22" class="cell" />
<rect x="888" y="180" width="22" height="22" class="cell cellMasked" />
<rect x="800" y="200" width="22" height="22" class="cellSrc1 cellHL1" />
<rect x="822" y="200" width="22" height="22" class="cellSrc1 cellHL1" />
<rect x="844" y="200" width="22" height="22" class="cellSrc1 cellHL1" />
<rect x="866" y="200" width="22" height="22" class="cellSrc1 cellHL1" />
<rect x="888" y="200" width="22" height="22" class="cell cellMasked" />
<text x="811" y="215" class="cellText" text-anchor="middle">b&#x2080;</text>
<text x="833" y="215" class="cellText" text-anchor="middle">b&#x2081;</text>
<text x="855" y="215" class="cellText" text-anchor="middle">b&#x2082;</text>
<text x="877" y="215" class="cellText" text-anchor="middle">b&#x2083;</text>
<rect x="800" y="222" width="22" height="22" class="cell" />
<rect x="822" y="222" width="22" height="22" class="cell" />
<rect x="844" y="222" width="22" height="22" class="cell" />
<rect x="866" y="222" width="22" height="22" class="cell" />
<rect x="888" y="222" width="22" height="22" class="cell cellMasked" />
<rect x="800" y="244" width="22" height="22" class="cell" />
<rect x="822" y="244" width="22" height="22" class="cell" />
<rect x="844" y="244" width="22" height="22" class="cell" />
<rect x="866" y="244" width="22" height="22" class="cell" />
<rect x="888" y="244" width="22" height="22" class="cell cellMasked" />
<rect x="800" y="266" width="22" height="22" class="cell cellMasked" />
<rect x="822" y="266" width="22" height="22" class="cell cellMasked" />
<rect x="844" y="266" width="22" height="22" class="cell cellMasked" />
<rect x="866" y="266" width="22" height="22" class="cell cellMasked" />
<rect x="888" y="266" width="22" height="22" class="cell cellMasked" />
<rect x="800" y="180" width="88" height="88" class="validBox" stroke="#ea580c" />
<text x="804" y="264" class="axisText" fill="#ea580c">Rv</text>
<text x="884" y="192" class="axisText" text-anchor="end" fill="#ea580c">Cv</text>
<path d="M 810 190 L 876 190" class="axisLine" marker-end="url(#axisArrow)" />
<path d="M 810 190 L 810 256" class="axisLine" marker-end="url(#axisArrow)" />
<text x="878" y="194" class="axisText">c</text>
<text x="808" y="258" class="axisText" text-anchor="end">r</text>

<rect x="540" y="305" width="120" height="36" class="opBox" />
<text x="600" y="328" class="opText" text-anchor="middle">TINTERLEAVE</text>
<path d="M 225 290 L 225 323 L 540 323" class="arrow" stroke="#2D8B57" marker-end="url(#arrow)" />
<path d="M 855 290 L 855 323 L 660 323" class="arrow" stroke="#2D8B57" marker-end="url(#arrow)" />
<path d="M 600 341 L 600 365" class="arrow" stroke="#2D8B57" marker-end="url(#arrow)" />

<text x="600" y="360" class="streamLabel" text-anchor="middle">Interleaved stream (per row)</text>
<rect x="512" y="370" width="176" height="22" class="streamBorder" />
<rect x="512" y="370" width="22" height="22" class="cellSrc0" />
<rect x="534" y="370" width="22" height="22" class="cellSrc1" />
<rect x="556" y="370" width="22" height="22" class="cellSrc0" />
<rect x="578" y="370" width="22" height="22" class="cellSrc1" />
<rect x="600" y="370" width="22" height="22" class="cellSrc0" />
<rect x="622" y="370" width="22" height="22" class="cellSrc1" />
<rect x="644" y="370" width="22" height="22" class="cellSrc0" />
<rect x="666" y="370" width="22" height="22" class="cellSrc1" />
<text x="523" y="366" class="posLabel" text-anchor="middle">0</text>
<text x="545" y="366" class="posLabel" text-anchor="middle">1</text>
<text x="567" y="366" class="posLabel" text-anchor="middle">2</text>
<text x="589" y="366" class="posLabel" text-anchor="middle">3</text>
<text x="611" y="366" class="posLabel" text-anchor="middle">4</text>
<text x="633" y="366" class="posLabel" text-anchor="middle">5</text>
<text x="655" y="366" class="posLabel" text-anchor="middle">6</text>
<text x="677" y="366" class="posLabel" text-anchor="middle">7</text>
<text x="523" y="385" class="cellText" text-anchor="middle">a&#x2080;</text>
<text x="545" y="385" class="cellText" text-anchor="middle">b&#x2080;</text>
<text x="567" y="385" class="cellText" text-anchor="middle">a&#x2081;</text>
<text x="589" y="385" class="cellText" text-anchor="middle">b&#x2081;</text>
<text x="611" y="385" class="cellText" text-anchor="middle">a&#x2082;</text>
<text x="633" y="385" class="cellText" text-anchor="middle">b&#x2082;</text>
<text x="655" y="385" class="cellText" text-anchor="middle">a&#x2083;</text>
<text x="677" y="385" class="cellText" text-anchor="middle">b&#x2083;</text>
<line x1="600" y1="370" x2="600" y2="392" class="splitLine" />
<text x="545" y="405" class="halfLabel" text-anchor="middle" fill="#2563eb">First half &#x2192; dst0</text>
<text x="655" y="405" class="halfLabel" text-anchor="middle" fill="#ea580c">Second half &#x2192; dst1</text>

<path d="M 544 398 L 544 432 L 225 432 L 225 460" class="arrow" stroke="#2563eb" marker-end="url(#arrow)" />
<path d="M 656 398 L 656 432 L 855 432 L 855 460" class="arrow" stroke="#ea580c" marker-end="url(#arrow)" />

<text x="225" y="458" class="tileLabel" text-anchor="middle">dst0</text>
<rect x="170" y="470" width="110" height="110" class="tileBorder" />
<rect x="170" y="470" width="22" height="22" class="cellSrc0" />
<rect x="192" y="470" width="22" height="22" class="cellSrc1" />
<rect x="214" y="470" width="22" height="22" class="cellSrc0" />
<rect x="236" y="470" width="22" height="22" class="cellSrc1" />
<rect x="258" y="470" width="22" height="22" class="cell cellMasked" />
<rect x="170" y="492" width="22" height="22" class="cellSrc0 cellHL0" />
<rect x="192" y="492" width="22" height="22" class="cellSrc1 cellHL1" />
<rect x="214" y="492" width="22" height="22" class="cellSrc0 cellHL0" />
<rect x="236" y="492" width="22" height="22" class="cellSrc1 cellHL1" />
<rect x="258" y="492" width="22" height="22" class="cell cellMasked" />
<text x="181" y="507" class="cellText" text-anchor="middle">a&#x2080;</text>
<text x="203" y="507" class="cellText" text-anchor="middle">b&#x2080;</text>
<text x="225" y="507" class="cellText" text-anchor="middle">a&#x2081;</text>
<text x="247" y="507" class="cellText" text-anchor="middle">b&#x2081;</text>
<rect x="170" y="514" width="22" height="22" class="cellSrc0" />
<rect x="192" y="514" width="22" height="22" class="cellSrc1" />
<rect x="214" y="514" width="22" height="22" class="cellSrc0" />
<rect x="236" y="514" width="22" height="22" class="cellSrc1" />
<rect x="258" y="514" width="22" height="22" class="cell cellMasked" />
<rect x="170" y="536" width="22" height="22" class="cellSrc0" />
<rect x="192" y="536" width="22" height="22" class="cellSrc1" />
<rect x="214" y="536" width="22" height="22" class="cellSrc0" />
<rect x="236" y="536" width="22" height="22" class="cellSrc1" />
<rect x="258" y="536" width="22" height="22" class="cell cellMasked" />
<rect x="170" y="558" width="22" height="22" class="cell cellMasked" />
<rect x="192" y="558" width="22" height="22" class="cell cellMasked" />
<rect x="214" y="558" width="22" height="22" class="cell cellMasked" />
<rect x="236" y="558" width="22" height="22" class="cell cellMasked" />
<rect x="258" y="558" width="22" height="22" class="cell cellMasked" />
<rect x="170" y="470" width="88" height="88" class="validBox" stroke="#2D8B57" />
<text x="174" y="554" class="axisText">Rv</text>
<text x="254" y="482" class="axisText" text-anchor="end">Cv</text>
<path d="M 180 480 L 246 480" class="axisLine" marker-end="url(#axisArrow)" />
<path d="M 180 480 L 180 546" class="axisLine" marker-end="url(#axisArrow)" />
<text x="248" y="484" class="axisText">c</text>
<text x="178" y="548" class="axisText" text-anchor="end">r</text>

<text x="855" y="458" class="tileLabel" text-anchor="middle">dst1</text>
<rect x="800" y="470" width="110" height="110" class="tileBorder" />
<rect x="800" y="470" width="22" height="22" class="cellSrc0" />
<rect x="822" y="470" width="22" height="22" class="cellSrc1" />
<rect x="844" y="470" width="22" height="22" class="cellSrc0" />
<rect x="866" y="470" width="22" height="22" class="cellSrc1" />
<rect x="888" y="470" width="22" height="22" class="cell cellMasked" />
<rect x="800" y="492" width="22" height="22" class="cellSrc0 cellHL0" />
<rect x="822" y="492" width="22" height="22" class="cellSrc1 cellHL1" />
<rect x="844" y="492" width="22" height="22" class="cellSrc0 cellHL0" />
<rect x="866" y="492" width="22" height="22" class="cellSrc1 cellHL1" />
<rect x="888" y="492" width="22" height="22" class="cell cellMasked" />
<text x="811" y="507" class="cellText" text-anchor="middle">a&#x2082;</text>
<text x="833" y="507" class="cellText" text-anchor="middle">b&#x2082;</text>
<text x="855" y="507" class="cellText" text-anchor="middle">a&#x2083;</text>
<text x="877" y="507" class="cellText" text-anchor="middle">b&#x2083;</text>
<rect x="800" y="514" width="22" height="22" class="cellSrc0" />
<rect x="822" y="514" width="22" height="22" class="cellSrc1" />
<rect x="844" y="514" width="22" height="22" class="cellSrc0" />
<rect x="866" y="514" width="22" height="22" class="cellSrc1" />
<rect x="888" y="514" width="22" height="22" class="cell cellMasked" />
<rect x="800" y="536" width="22" height="22" class="cellSrc0" />
<rect x="822" y="536" width="22" height="22" class="cellSrc1" />
<rect x="844" y="536" width="22" height="22" class="cellSrc0" />
<rect x="866" y="536" width="22" height="22" class="cellSrc1" />
<rect x="888" y="536" width="22" height="22" class="cell cellMasked" />
<rect x="800" y="558" width="22" height="22" class="cell cellMasked" />
<rect x="822" y="558" width="22" height="22" class="cell cellMasked" />
<rect x="844" y="558" width="22" height="22" class="cell cellMasked" />
<rect x="866" y="558" width="22" height="22" class="cell cellMasked" />
<rect x="888" y="558" width="22" height="22" class="cell cellMasked" />
<rect x="800" y="470" width="88" height="88" class="validBox" stroke="#2D8B57" />
<text x="804" y="554" class="axisText">Rv</text>
<text x="884" y="482" class="axisText" text-anchor="end">Cv</text>
<path d="M 810 480 L 876 480" class="axisLine" marker-end="url(#axisArrow)" />
<path d="M 810 480 L 810 546" class="axisLine" marker-end="url(#axisArrow)" />
<text x="878" y="484" class="axisText">c</text>
<text x="808" y="548" class="axisText" text-anchor="end">r</text>

<rect x="40" y="590" width="1120" height="220" class="procBox" />
<text x="56" y="614" class="procTitle">Procedure (conceptual)</text>
<text x="56" y="640" class="procText" xml:space="preserve">
  <tspan x="56" dy="0">for r in 0..Rv-1:</tspan>
  <tspan x="56" dy="16">  for k in 0..Cv-1:             # interleave src0 and src1</tspan>
  <tspan x="56" dy="16">    interleaved[2k]   = src0[r,k]  # even positions from src0</tspan>
  <tspan x="56" dy="16">    interleaved[2k+1] = src1[r,k]  # odd positions from src1</tspan>
  <tspan x="56" dy="16">  for j in 0..Cv-1:             # split interleaved stream</tspan>
  <tspan x="56" dy="16">    dst0[r,j] = interleaved[j]       # first half</tspan>
  <tspan x="56" dy="16">    dst1[r,j] = interleaved[Cv+j]    # second half</tspan>
</text>
<text x="56" y="790" class="meta">Constraints: validCols must be even; all tiles same DType and valid shape; row-major layout. TInterleave is the inverse of TDeInterleave.</text>
</svg>