Skip to content
Draft
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
73 changes: 44 additions & 29 deletions media/MPQEditor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,33 @@
<body>
<div>
<div>
<div>
<vscode-radio-group id="DefaultDtype">
<label slot="label">Quantized Data Type</label>
<vscode-radio value="uint8">uint8</vscode-radio>
<vscode-radio value="int16">int16</vscode-radio>
</vscode-radio-group>
</div>
<div>
<vscode-radio-group id="DefaultGranularity">
<label slot="label">Granularity</label>
<vscode-radio value="layer">layer</vscode-radio>
<vscode-radio value="channel">channel</vscode-radio>
</vscode-radio-group>
</div>
<vscode-data-grid id="DefaultTable" generate-header="none" aria-label="Default Header"
grid-template-columns="1fr 110px 120px 40px">
<vscode-data-grid-row row-type="default">
<vscode-data-grid-cell grid-column="1">
<div>
<vscode-tag>Default Parameters</vscode-tag>
<span class="codicon codicon-question" style="cursor: pointer">
<span class="help">
Default quantization parameters: 'Quantized Data Type' and 'Granularity' respectively
</span>
</span>
</div>
</vscode-data-grid-cell>
<vscode-data-grid-cell grid-column="2">
<vscode-dropdown id="DefaultDtype">
<vscode-option>uint8</vscode-option>
<vscode-option>int16</vscode-option>
</vscode-dropdown>
</vscode-data-grid-cell>
<vscode-data-grid-cell grid-column="3">
<vscode-dropdown id="DefaultGranularity">
<vscode-option>layer</vscode-option>
<vscode-option>channel</vscode-option>
</vscode-dropdown>
</vscode-data-grid-cell>
</vscode-data-grid-row>
</vscode-data-grid>
</div>
</div>
<div>
Expand All @@ -58,27 +71,29 @@
</vscode-button>
</div>
<div class="rightbtns">
<vscode-text-field id="VisqInputPath" startIcon="true" placeholder="visq path" readonly="true">
<span slot="start" class="codicon codicon-question" style="cursor: pointer">
<span class="help">
visq.json file with layer-wise quantization errors
</span>
</span>
<span id="visq-file" slot="end" class="codicon codicon-search" style="cursor: pointer"></span>
<span id="visq-delete" slot="end" class="codicon codicon-chrome-close" style="cursor: pointer"></span>
</vscode-text-field>
<vscode-checkbox id="circle-graph">Show Graph</vscode-checkbox>
<vscode-checkbox class="rightbtns" id="circle-graph">Show Graph</vscode-checkbox>
</div>
</div>
<div>
<vscode-data-grid id="LayersTable" class="layers" generate-header="default" aria-label="Default Header" grid-template-columns="1fr 110px 120px 40px">
<vscode-data-grid-row row-type="header">
<div class="layers">
<vscode-data-grid id="LayersTable" generate-header="default" aria-label="Default Header" grid-template-columns="1fr 110px 120px 40px">
<vscode-data-grid-row row-type="header" id="LayersHeader">
<vscode-data-grid-cell cell-type="columnheader" grid-column="1">Name</vscode-data-grid-cell>
<vscode-data-grid-cell cell-type="columnheader" grid-column="2">Quantization</vscode-data-grid-cell>
<vscode-data-grid-cell cell-type="columnheader" grid-column="2">DType</vscode-data-grid-cell>
<vscode-data-grid-cell cell-type="columnheader" grid-column="3">Granularity</vscode-data-grid-cell>
<vscode-data-grid-cell cell-type="columnheader" grid-column="4">&nbsp;</vscode-data-grid-cell>
</vscode-data-grid-row>
</vscode-data-grid>
</div>
</div>
<div class="bottom">
<vscode-text-field class="rightbtns text" id="VisqInputPath" startIcon="true" placeholder="visq path" readonly="true">
<span slot="start" class="codicon codicon-question" style="cursor: pointer">
<span class="help">
visq.json file with layer-wise quantization errors
</span>
</span>
<span id="visq-file" slot="end" class="codicon codicon-search" style="cursor: pointer"></span>
<span id="visq-delete" slot="end" class="codicon codicon-chrome-close" style="cursor: pointer"></span>
</vscode-text-field>
</div>
</body>
</html>
12 changes: 6 additions & 6 deletions media/MPQEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function handleVisqFileLoaded(visqFile) {
function registerMainControls() {
document
.getElementById("DefaultDtype")
.addEventListener("click", function () {
.addEventListener("change", function () {
updateDefaultQuantization();
applyUpdates();
});
Expand Down Expand Up @@ -127,6 +127,7 @@ function registerMainControls() {
function displayMPQToEditor(mpqCfg) {
document.getElementById("DefaultDtype").value =
mpqCfg?.["default_quantization_dtype"];

document.getElementById("DefaultGranularity").value =
mpqCfg?.["default_granularity"];

Expand All @@ -142,7 +143,8 @@ function displayMPQToEditor(mpqCfg) {
}

const layersTable = document.getElementById("LayersTable");
layersTable.replaceChildren();
let header = document.getElementById("LayersHeader");
layersTable.replaceChildren(header);
addQuantizedNodes(names, quantization, granularity, false);
}

Expand Down Expand Up @@ -303,20 +305,18 @@ function updateSpecificGranularity(name) {
}

function updateDefaultQuantization() {
let value = document.getElementById("DefaultDtype").value;
vscode.postMessage({
type: "updateSection",
section: "default_quantization_dtype",
value: value,
value: document.getElementById("DefaultDtype").value,
});
}

function updateGranularity() {
let value = document.getElementById("DefaultGranularity").value;
vscode.postMessage({
type: "updateSection",
section: "default_granularity",
value: value,
value: document.getElementById("DefaultGranularity").value,
});
}

Expand Down
16 changes: 16 additions & 0 deletions media/MPQEditor/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ white-space: pre-wrap;
body {
min-width: 500px;
width: auto !important;
display: flex;
flex-flow: column;
height: 100vh;
}

.leftbtns {
Expand Down Expand Up @@ -49,3 +52,16 @@ font-family: var(--vscode-font-family);
.codicon.codicon-question:hover .help {
visibility: visible;
}

.layers {
flex: 1 1 auto;
overflow-y: auto;
}

.bottom {
flex: 0 1 auto;
}

.text {
margin-top: 10px;
}