diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/package.json b/plugins/tensorboard-plugins/tb_graph_ascend/fe/package.json
index 787f5b5549c7379d9e5750d7800ec31706df6f6c..6f948a941f03f44e3c7f5f8c8274f333e82339bd 100644
--- a/plugins/tensorboard-plugins/tb_graph_ascend/fe/package.json
+++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/package.json
@@ -63,6 +63,11 @@
"@polymer/paper-tooltip": "^3.0.1",
"@polymer/polymer": "^3.5.1",
"@types/lodash": "^4.17.1",
+ "@vaadin/notification": "^23.5.11",
+ "@vaadin/tabs": "^23.5.11",
+ "@vaadin/tabsheet": "^23.5.11",
+ "@vaadin/tooltip": "^23.5.11",
+ "@vaadin/vaadin-grid": "^23.5.11",
"clean-webpack-plugin": "^4.0.0",
"cross-env": "^7.0.3",
"css-loader": "^7.1.2",
diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph/tf-graph-scene.html.ts b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph/tf-graph-scene.html.ts
index b8250e300a67b5e5abf409fb54a0a7315024699e..e0f378303f21925f323d51150115f06657aebeb0 100644
--- a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph/tf-graph-scene.html.ts
+++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph/tf-graph-scene.html.ts
@@ -552,7 +552,7 @@ export const template = html`
#minimap {
position: absolute;
right: 20px;
- bottom: 20px;
+ bottom: 28%;
}
.context-menu {
diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_board/tf-graph-board.ts b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_board/tf-graph-board.ts
index f43273d7b8f529d106f2726497886f776df25628..6f79db5d416ae40c9c68d23db36579f826db9b51 100644
--- a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_board/tf-graph-board.ts
+++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_board/tf-graph-board.ts
@@ -21,6 +21,7 @@ import * as tf_graph from '../tf_graph_common/graph';
import * as tf_graph_hierarchy from '../tf_graph_common/hierarchy';
import * as tf_graph_render from '../tf_graph_common/render';
import '../tf_graph_info/tf-graph-info';
+import '../tf_graph_node_info/index';
import * as _ from 'lodash';
/**
@@ -48,6 +49,8 @@ class TfGraphBoard extends LegacyElementMixin(PolymerElement) {
width: 100%;
height: 100%;
opacity: 1;
+ display: flex;
+ flex-direction: column;
}
.container.loading {
@@ -94,6 +97,12 @@ class TfGraphBoard extends LegacyElementMixin(PolymerElement) {
height: 100%;
}
+ #tab-info {
+ /* height: 30%; */
+ background-color: #ffffff;
+ border-top: 2px solidrgb(153, 152, 152);
+ }
+
#progress-bar {
display: flex;
flex-direction: column;
@@ -173,40 +182,17 @@ class TfGraphBoard extends LegacyElementMixin(PolymerElement) {
auto-extract-nodes="[[autoExtractNodes]]"
>
-
`;
@@ -297,49 +283,6 @@ class TfGraphBoard extends LegacyElementMixin(PolymerElement) {
ready() {
super.ready();
-
- const handle = this.shadowRoot?.getElementById('resize-handle') as HTMLElement;
-
- if (handle) {
- let isResizing = false;
- let lastDownX = 0;
- let lastDownY = 0;
-
- handle.addEventListener('mousedown', (e: MouseEvent) => {
- e.preventDefault();
- isResizing = true;
- lastDownX = e.clientX;
- lastDownY = e.clientY;
- document.addEventListener('mousemove', handleMouseMove);
- document.addEventListener('mouseup', handleMouseUp);
- });
-
- const handleMouseMove = (e: MouseEvent) => {
- if (isResizing) {
- const graphInfoDiv = this.shadowRoot?.getElementById('graph-info') as HTMLElement;
- if (graphInfoDiv) {
- const rect = graphInfoDiv.getBoundingClientRect();
- const width = rect.width + (lastDownX - e.clientX);
- const height = rect.height + (e.clientY - lastDownY);
- graphInfoDiv.style.width = `${Math.max(width, 100)}px`;
- graphInfoDiv.style.height = `${Math.max(height, 65)}px`;
- lastDownX = e.clientX;
- lastDownY = e.clientY;
- }
- }
- };
-
- const handleMouseUp = () => {
- isResizing = false;
- //鼠标抬起重新渲染一遍组件
- this.selectNodeCopy = _.cloneDeep(this.selectedNode);
- this.set('selectedNode', 'refresh'); // 临时切换到指定node名称,触发信息看板临时刷新
- this.set('selectedNode', this.selectNodeCopy); // 恢复原值
-
- document.removeEventListener('mousemove', handleMouseMove);
- document.removeEventListener('mouseup', handleMouseUp);
- };
- }
}
fit() {
(this.$.graph as any).fit();
diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_common/node.ts b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_common/node.ts
index 2b1e6d889a2806c2848860972ddc8d6bd148fb07..f3b44a0965a04dd3faa202a5018576a87f709277 100644
--- a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_common/node.ts
+++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_common/node.ts
@@ -1466,10 +1466,18 @@ export function getColors(colors) {
colorStorage = colors;
}
-export function getMatched(matched) {
+export function setMatched(matched) {
matchStorage = matched;
}
-export function getUnMatched(unmatched) {
+export function setUnMatched(unmatched) {
unMatchStorage = unmatched;
}
+
+export function getMatched() {
+ return matchStorage;
+}
+
+export function getUnMatched() {
+ return unMatchStorage;
+}
diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_controls/tf-graph-controls.ts b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_controls/tf-graph-controls.ts
index 6f92ca8c16a3fdbc9654016a28e932583be9f079..26242802f597fef5988cd484a860ab9997471650 100644
--- a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_controls/tf-graph-controls.ts
+++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_controls/tf-graph-controls.ts
@@ -34,6 +34,8 @@ import * as tf_graph_parser from '../tf_graph_common/parser';
import * as tf_graph_node from '../tf_graph_common/node';
import * as tf_node_info from '../tf_graph_info/tf-node-info';
+import type { MactchResult } from '../types/service';
+
export interface Selection {
run: string;
tag: string | null;
@@ -1028,7 +1030,7 @@ class TfGraphControls extends LegacyElementMixin(DarkModeMixin(PolymerElement))
_selectedBenchMatchMenu: number = -1;
_selectedUnMatchMenu: number = -1;
- ready() {
+ override ready() {
super.ready();
document.addEventListener('contextMenuTag-changed', this._getTagChanged.bind(this));
}
@@ -1378,6 +1380,7 @@ class TfGraphControls extends LegacyElementMixin(DarkModeMixin(PolymerElement))
this.showDynamicDialog('节点不可匹配');
return;
}
+ // 请求参数
const params = new URLSearchParams();
const run = this.datasets[this._selectedRunIndex].name;
const tag = this.datasets[this._selectedRunIndex].tags[this._selectedTagIndex].tag;
@@ -1385,33 +1388,24 @@ class TfGraphControls extends LegacyElementMixin(DarkModeMixin(PolymerElement))
if (tag) params.set('tag', tag);
params.set('NPU', this.selectedNPUNode);
params.set('Bench', this.selectedBenchNode);
+ // 接口请求
const precisionPath = getRouter().pluginRouteForSrc('graph_ascend', '/match', params);
const precisionStr = await tf_graph_parser.fetchPbTxt(precisionPath); // 获取异步的 ArrayBuffer
const decoder = new TextDecoder();
const decodedStr = decoder.decode(precisionStr); // 解码 ArrayBuffer 到字符串
- const dialogMessageMap: { [key: string]: string } = {
- inputshape: '匹配失败,inputshape不匹配',
- outputshape: '匹配失败,outputshape不匹配',
- inputNone: '匹配失败,input中包含None值',
- outputNone: '匹配失败,output中包含None值',
- };
+ // 接口返回
+ const mactchResult: MactchResult = JSON.parse(decodedStr);
- const message = dialogMessageMap[decodedStr];
- if (message) {
- this.showDynamicDialog(message); // 使用动态生成的对话框
- }
- let resultArray: any[] = [];
- resultArray = JSON.parse(decodedStr) as any[];
- if (resultArray.length !== 0) {
- this.push('matchednodeset', resultArray);
+ if (mactchResult.success) {
+ const mactchData = mactchResult.data;
+ this.push('matchednodeset', mactchData);
if (this.unMatchednodeset.length !== 0) {
const has = this.unMatchednodeset.indexOf(this.selectedNPUNode);
if (has !== -1) {
this.unMatchednodeset = [...this.unMatchednodeset.slice(0, has), ...this.unMatchednodeset.slice(has + 1)];
}
}
- tf_graph_node.getMatched(this.matchednodeset);
- tf_node_info.getMatched(this.matchednodeset);
+ tf_graph_node.setMatched(this.matchednodeset); //节点上色
const index_N = this.NPU_unmatched.indexOf(this.selectedNPUNode.slice(4));
if (index_N !== -1) {
this.splice('NPU_unmatched', index_N, 1);
@@ -1433,7 +1427,7 @@ class TfGraphControls extends LegacyElementMixin(DarkModeMixin(PolymerElement))
this.selectedNPUNode = '';
this.selectedBenchNode = '';
} else {
- this.showDynamicDialog('节点不可匹配');
+ this.showDynamicDialog(mactchResult.error);
}
}
@@ -1490,10 +1484,8 @@ class TfGraphControls extends LegacyElementMixin(DarkModeMixin(PolymerElement))
const precisionStr = await tf_graph_parser.fetchPbTxt(precisionPath); // 获取异步的 ArrayBuffer
const decoder = new TextDecoder();
const decodedStr = decoder.decode(precisionStr); // 解码 ArrayBuffer 到字符串
- tf_graph_node.getMatched(this.matchednodeset);
- tf_node_info.getMatched(this.matchednodeset);
- tf_graph_node.getUnMatched(this.unMatchednodeset);
- tf_node_info.getUnMatched(this.unMatchednodeset);
+ tf_graph_node.setMatched(this.matchednodeset);
+ tf_graph_node.setUnMatched(this.unMatchednodeset);
this.set('selectedNode', '');
this.showDynamicDialog('已取消匹配');
}
diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_node_info/components/tf_resize_height/index.ts b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_node_info/components/tf_resize_height/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..dd6ce05800b24766f6eff77e6c6180390d6c9924
--- /dev/null
+++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_node_info/components/tf_resize_height/index.ts
@@ -0,0 +1,99 @@
+import { PolymerElement, html } from '@polymer/polymer';
+import { customElement, property, observe } from '@polymer/decorators';
+
+@customElement('tf-resize-height')
+class ResizableTabsheet extends PolymerElement {
+ static get template() {
+ return html`
+
+
+
+
+
+
+ `;
+ }
+
+ @property({
+ type: Number,
+ notify: true,
+ })
+ height: number = 300;
+
+ _resize!: (event: MouseEvent) => void;
+ _stopResize!: (this: Document, ev: MouseEvent) => any;
+
+ override ready() {
+ super.ready();
+ this._initResizeHandle();
+ }
+
+ _initResizeHandle() {
+ const tabsheet = this.$.tabsheet;
+ const resizeHandle = this.$.resizeHandle;
+
+ let isResizing = false;
+ let startY = 0;
+ let startHeight = 0;
+
+ // 开始拖拽
+ resizeHandle.addEventListener('mousedown', (event) => {
+ isResizing = true;
+ //@ts-ignore
+ startY = event.clientY;
+ //@ts-ignore
+ startHeight = tabsheet.offsetHeight;
+ document.body.style.cursor = 'ns-resize';
+ document.addEventListener('mousemove', this._resize);
+ document.addEventListener('mouseup', this._stopResize);
+ });
+
+ // 拖拽过程
+ this._resize = (event) => {
+ if (!isResizing) return;
+ const deltaY = startY - event.clientY; // 向上拖拽为正
+ this.set('height', Math.max(10, startHeight + deltaY)); // 更新高度
+ };
+
+ // 停止拖拽
+ this._stopResize = () => {
+ isResizing = false;
+ document.body.style.cursor = '';
+ document.removeEventListener('mousemove', this._resize);
+ document.removeEventListener('mouseup', this._stopResize);
+ };
+ }
+
+ @observe('height')
+ _updateHeight(newHeight) {
+ this.updateStyles({ '--tabsheet-height': `${newHeight}px` });
+ }
+}
diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_node_info/components/tf_vaadin_table/index.ts b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_node_info/components/tf_vaadin_table/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..1f9e98ef4a550630ae648523ead0db445748a6cc
--- /dev/null
+++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/tf_graph_node_info/components/tf_vaadin_table/index.ts
@@ -0,0 +1,152 @@
+import { PolymerElement, html } from '@polymer/polymer';
+import { customElement, property, query } from '@polymer/decorators';
+import '@vaadin/grid'; // 引入新的 Vaadin Grid 组件
+import '@vaadin/tooltip';
+import type { GridEventContext } from '@vaadin/grid';
+@customElement('tf-vaadin-table')
+class TfVaadinTable extends PolymerElement {
+ static get template() {
+ return html`
+
+
+
+
+
+
+ [[item[header]]]
+
+
+
+
+
+
+ 当前节点暂无IO数据
+
+ `;
+ }
+
+ renderDefaultValue!: (root: HTMLElement, column: any, rowData: any) => void;
+ tooltipGenerator!: (context: GridEventContext<{}>) => string;
+
+ @property({ type: Object })
+ syncGrid!: HTMLElement; // 点击高亮需要同步的表格元素
+
+ @property({ type: Object })
+ handleCellClick!: (e: MouseEvent, syncGrid: HTMLElement) => void;
+
+ @property({
+ type: Array,
+ computed: '_computeHeaders(ioDataset)',
+ })
+ headers!: any[];
+
+ @property({
+ type: Boolean,
+ computed: '_isEmptyGrid(ioDataset)',
+ })
+ isEmptyGrid!: false;
+
+ override connectedCallback() {
+ super.connectedCallback();
+ this.renderDefaultValue = this._renderDefaultValue.bind(this);
+ // this.tooltipGenerator = this._tooltipGenerator.bind(this);
+ }
+ /**
+ * 计算表头(所有唯一的键)
+ * @param {Array