From 3e3fcd49ec5d22d3b620b342b3afecb9186c143f Mon Sep 17 00:00:00 2001 From: leeliu103 Date: Mon, 8 Dec 2025 20:19:30 +0000 Subject: [PATCH] Add "Show in Linear Layout" projection for WMMA and MFMA tabs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extends the cross-tab layout projection system to support WMMA and MFMA tabs, with shared infrastructure to eliminate code duplication and comprehensive bug fixes. Key additions: - Shared projection helpers in CanvasTab base class (setupLinearLayoutProjection, prepareLinearLayoutSnapshot, normalizeLaneDimensionNames) - WMMA tab projection with dimension reordering (dimM/dimK/dimN) per operand type - MFMA tab projection with tensor shape clamping for small layouts (fixes 4×16 bug) - "Show in Linear Layout" buttons added to WMMA and MFMA tab UIs Bug fixes: - Fixed WMMA dimension ordering bug (dimensions now reordered to match tensor axes) - Fixed MFMA 4×16 conversion bug (layouts clamped to actual tensor size) - Fixed test organization (moved stray tests inside describe blocks) - Eliminated code duplication between Block/WMMA/MFMA tabs Test coverage: - Added CanvasTab.test.ts for shared projection helper testing - Added WMMALayoutTab.test.ts (4 tests) with dimension ordering and alert coverage - Added MFMALayoutTab.test.ts (5 tests) with 4×16 regression test - Added LinearLayoutProjection.integration.test.ts for end-to-end validation - Enhanced BlockLayoutTab.test.ts with missing edge case coverage - Total: 166 tests passing (up from 154) All three layout tabs now provide consistent projection UX with automatic dimension filtering, name normalization, and helpful error messages. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- index.html | 2 + src/main.tabs.test.ts | 12 + src/tabs/BlockLayoutTab.test.ts | 76 ++++-- src/tabs/BlockLayoutTab.ts | 74 ++---- src/tabs/CanvasTab.test.ts | 141 +++++++++++ src/tabs/CanvasTab.ts | 102 ++++++++ ...LinearLayoutProjection.integration.test.ts | 201 +++++++++++++++ src/tabs/MFMALayoutTab.test.ts | 239 ++++++++++++++++++ src/tabs/MFMALayoutTab.ts | 183 +++++++++++++- src/tabs/WMMALayoutTab.test.ts | 213 ++++++++++++++++ src/tabs/WMMALayoutTab.ts | 68 +++++ 11 files changed, 1231 insertions(+), 80 deletions(-) create mode 100644 src/tabs/CanvasTab.test.ts create mode 100644 src/tabs/LinearLayoutProjection.integration.test.ts create mode 100644 src/tabs/MFMALayoutTab.test.ts create mode 100644 src/tabs/WMMALayoutTab.test.ts diff --git a/index.html b/index.html index 78ac43f..72247cc 100644 --- a/index.html +++ b/index.html @@ -162,6 +162,7 @@

Operand

+
@@ -220,6 +221,7 @@

Operand

+
diff --git a/src/main.tabs.test.ts b/src/main.tabs.test.ts index 98381ca..874ca80 100644 --- a/src/main.tabs.test.ts +++ b/src/main.tabs.test.ts @@ -296,6 +296,12 @@ const setupDom = () => { ` form.appendChild(operandSelect) + const showLinearButton = document.createElement('button') + showLinearButton.type = 'button' + showLinearButton.id = 'wmma-show-linear-layout' + showLinearButton.textContent = 'Show in Linear Layout' + form.appendChild(showLinearButton) + sidebar.appendChild(form) const controls = document.createElement('div') @@ -346,6 +352,12 @@ const setupDom = () => { ` form.appendChild(operandSelect) + const showLinearButton = document.createElement('button') + showLinearButton.type = 'button' + showLinearButton.id = 'mfma-show-linear-layout' + showLinearButton.textContent = 'Show in Linear Layout' + form.appendChild(showLinearButton) + sidebar.appendChild(form) const controls = document.createElement('div') diff --git a/src/tabs/BlockLayoutTab.test.ts b/src/tabs/BlockLayoutTab.test.ts index a2f0fb2..fbb0e70 100644 --- a/src/tabs/BlockLayoutTab.test.ts +++ b/src/tabs/BlockLayoutTab.test.ts @@ -4,7 +4,6 @@ import { BlockLayoutTab } from './BlockLayoutTab' import { createBlockLayout } from '../layouts/BlockLayout' import { LinearLayout } from '../core/LinearLayout' import { layoutProjectionBus, LINEAR_LAYOUT_TAB_ID } from '../integration/LayoutProjectionBus' -import type { SnapshotFilterResult } from '../core/filterSnapshotDimensions' type ParameterFormStub = { getParams: ReturnType @@ -82,7 +81,11 @@ vi.mock('../visualization/CanvasRenderer', () => ({ }), })) -const buildBlockLayoutDom = (): void => { +const buildBlockLayoutDom = (options: { includeButton?: boolean } = {}): void => { + const { includeButton = true } = options + const buttonMarkup = includeButton + ? '' + : '' document.body.innerHTML = `
@@ -90,7 +93,7 @@ const buildBlockLayoutDom = (): void => {