Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions _extra/demo/tile_distributed.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ <h2>GPU Mesh (2×2)</h2>
// ── Mapping functions ──────────────────────────────────────────

// Fully Sharded (S0S1):
// S[(2, 4, 2, 4) : (1@gpuid_y, 4@m, 1@gpuid_x, 1@m)]
// S[(2, 2, 4, 4) : (1@gpuid_y, 1@gpuid_x, 4@m, 1@m)]
// rows split by 2 → gpuid_y, cols split by 2 → gpuid_x
function shardGpus(r, c) {
const gy = Math.floor(r / 4), gx = Math.floor(c / 4);
Expand Down Expand Up @@ -185,7 +185,7 @@ <h2>GPU Mesh (2×2)</h2>

// Layout notations
const notations = {
shard: 'Layout: S[(2,4,2,4) : (1@gpuid_y, 4@m, 1@gpuid_x, 1@m)]',
shard: 'Layout: S[(2,2,4,4) : (1@gpuid_y, 1@gpuid_x, 4@m, 1@m)]',
replica: 'Layout: S[(2,4,8) : (1@gpuid_y, 8@m, 1@m)] + R[2 : 1@gpuid_x]',
offset: 'Layout: S[(2,4,8) : (1@gpuid_y, 8@m, 1@m)] + O[1@gpuid_x]',
};
Expand Down Expand Up @@ -313,8 +313,8 @@ <h2>GPU Mesh (2×2)</h2>
const addr = localAddr(gpus[0], loc.lr, loc.lc);
html = `<div class="ftitle">Element ${r*N+c} at (row=${r}, col=${c})</div>`;
html += '<div class="fcontent">';
html += `addr = (row // 4) × 1@gpuid_y + (row % 4) × 4@m + (col // 4) × 1@gpuid_x + (col % 4) × 1@m<br>`;
html += `&nbsp;&nbsp;&nbsp;&nbsp; = (${r} // 4) × 1@gpuid_y + (${r} % 4) × 4@m + (${c} // 4) × 1@gpuid_x + (${c} % 4) × 1@m<br>`;
html += `addr = (row // 4) × 1@gpuid_y + (col // 4) × 1@gpuid_x + (row % 4) × 4@m + (col % 4) × 1@m<br>`;
html += `&nbsp;&nbsp;&nbsp;&nbsp; = (${r} // 4) × 1@gpuid_y + (${c} // 4) × 1@gpuid_x + (${r} % 4) × 4@m + (${c} % 4) × 1@m<br>`;
html += `&nbsp;&nbsp;&nbsp;&nbsp; = <b>${gy}</b>@gpuid_y + <b>${gx}</b>@gpuid_x + <b>${addr}</b>@m`;
html += '</div>';
} else if (ST.mode === 'replica') {
Expand Down
8 changes: 4 additions & 4 deletions zh/_extra/demo_zh/tile_distributed.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ <h2>GPU Mesh (2×2)</h2>
// ── Mapping functions ──────────────────────────────────────────

// Fully Sharded (S0S1):
// S[(2, 4, 2, 4) : (1@gpuid_y, 4@m, 1@gpuid_x, 1@m)]
// S[(2, 2, 4, 4) : (1@gpuid_y, 1@gpuid_x, 4@m, 1@m)]
// rows split by 2 → gpuid_y, cols split by 2 → gpuid_x
function shardGpus(r, c) {
const gy = Math.floor(r / 4), gx = Math.floor(c / 4);
Expand Down Expand Up @@ -185,7 +185,7 @@ <h2>GPU Mesh (2×2)</h2>

// Layout notations
const notations = {
shard: 'Layout: S[(2,4,2,4) : (1@gpuid_y, 4@m, 1@gpuid_x, 1@m)]',
shard: 'Layout: S[(2,2,4,4) : (1@gpuid_y, 1@gpuid_x, 4@m, 1@m)]',
replica: 'Layout: S[(2,4,8) : (1@gpuid_y, 8@m, 1@m)] + R[2 : 1@gpuid_x]',
offset: 'Layout: S[(2,4,8) : (1@gpuid_y, 8@m, 1@m)] + O[1@gpuid_x]',
};
Expand Down Expand Up @@ -313,8 +313,8 @@ <h2>GPU Mesh (2×2)</h2>
const addr = localAddr(gpus[0], loc.lr, loc.lc);
html = `<div class="ftitle">Element ${r*N+c} 位于 (row=${r}, col=${c})</div>`;
html += '<div class="fcontent">';
html += `addr = (row // 4) × 1@gpuid_y + (row % 4) × 4@m + (col // 4) × 1@gpuid_x + (col % 4) × 1@m<br>`;
html += `&nbsp;&nbsp;&nbsp;&nbsp; = (${r} // 4) × 1@gpuid_y + (${r} % 4) × 4@m + (${c} // 4) × 1@gpuid_x + (${c} % 4) × 1@m<br>`;
html += `addr = (row // 4) × 1@gpuid_y + (col // 4) × 1@gpuid_x + (row % 4) × 4@m + (col % 4) × 1@m<br>`;
html += `&nbsp;&nbsp;&nbsp;&nbsp; = (${r} // 4) × 1@gpuid_y + (${c} // 4) × 1@gpuid_x + (${r} % 4) × 4@m + (${c} % 4) × 1@m<br>`;
html += `&nbsp;&nbsp;&nbsp;&nbsp; = <b>${gy}</b>@gpuid_y + <b>${gx}</b>@gpuid_x + <b>${addr}</b>@m`;
html += '</div>';
} else if (ST.mode === 'replica') {
Expand Down