Skip to content

Commit

Permalink
0.18.2 (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
aidemsined authored Jan 22, 2025
2 parents 8b69c4b + 94b3462 commit 6a0489d
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ttnn-visualzer",
"private": true,
"version": "0.18.1",
"version": "0.18.2",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "ttnn_visualizer"
authors = []
version = "0.18.1"
version = "0.18.2"
description = "TT Visualizer"
readme = "README.md"
requires-python = ">=3.12"
Expand Down
20 changes: 10 additions & 10 deletions src/components/performance/PerfTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ const analyze_op = (row: RowData, prevRow: RowData | null): ProcessedRow => {
Bound: bound,
'OP Code': { raw_value: op_code },
'Device Time': { raw_value: device_time_val, unit: 'µs', decimals: 0 },
'Dispatch Time': { raw_value: dispatch_time_val, unit: 'µs', decimals: 0 },
'Op-to-Op Gap': { raw_value: dispatch_time_val, unit: 'µs', decimals: 0 },
Cores: { raw_value: Number(row['CORE COUNT']) },
DRAM: dram_speed,
'DRAM %': dram_percentage,
Expand All @@ -195,7 +195,7 @@ const analyze_op = (row: RowData, prevRow: RowData | null): ProcessedRow => {
Bound: bound,
'OP Code': { raw_value: op_code_val },
'Device Time': { raw_value: device_time_val || null, unit: 'µs', decimals: 0 },
'Dispatch Time': { raw_value: dispatch_time_val, unit: 'µs', decimals: 0 },
'Op-to-Op Gap': { raw_value: dispatch_time_val, unit: 'µs', decimals: 0 },
Cores: { raw_value: Number(row['CORE COUNT']) || null },
DRAM: dram_speed,
'DRAM %': dram_percentage,
Expand All @@ -216,13 +216,13 @@ const analyze_op = (row: RowData, prevRow: RowData | null): ProcessedRow => {
const add_derived_columns = (rows: ProcessedRow[]) => {
const total_duration = rows.reduce(
(acc, r) =>
acc + ((r['Device Time'].raw_value as number) || 0) + ((r['Dispatch Time'].raw_value as number) || 0),
acc + ((r['Device Time'].raw_value as number) || 0) + ((r['Op-to-Op Gap'].raw_value as number) || 0),
0,
);

rows.forEach((r) => {
const device_time = (r['Device Time'].raw_value as number) || 0;
const dispatch_time = (r['Dispatch Time'].raw_value as number) || 0;
const dispatch_time = (r['Op-to-Op Gap'].raw_value as number) || 0;
if (total_duration > 0) {
r['Total %'] = {
raw_value: ((device_time + dispatch_time) / total_duration) * 100,
Expand Down Expand Up @@ -307,7 +307,7 @@ export const PerformanceReport: FC<PerformanceReportProps> = ({ data, minPercent

if (hiliteHighDispatch) {
rows.forEach((op_data: ProcessedRow) => {
const val = op_data['Dispatch Time'].raw_value;
const val = op_data['Op-to-Op Gap'].raw_value;
const highDispatch = val !== null && val !== undefined && typeof val === 'number' && val > 6.5;
op_data.Slow = {
raw_value: null,
Expand All @@ -327,7 +327,7 @@ export const PerformanceReport: FC<PerformanceReportProps> = ({ data, minPercent
'Bound',
'OP Code',
'Device Time',
'Dispatch Time',
'Op-to-Op Gap',
'Cores',
'DRAM',
'DRAM %',
Expand All @@ -343,7 +343,7 @@ export const PerformanceReport: FC<PerformanceReportProps> = ({ data, minPercent
const highDispatchOps = rows
.map((op_data: ProcessedRow, idx: number) => [idx + 1, op_data] as [number, ProcessedRow])
.filter(([_, op_data]) => {
const val = op_data['Dispatch Time'].raw_value;
const val = op_data['Op-to-Op Gap'].raw_value;
return val !== null && val !== undefined && typeof val === 'number' && val > 6.5;
});

Expand All @@ -353,17 +353,17 @@ export const PerformanceReport: FC<PerformanceReportProps> = ({ data, minPercent

// Compute the max dispatch overhead
const max_dispatch_overhead = highDispatchOps.reduce((acc, [_, op_data]) => {
const val = op_data['Dispatch Time'].raw_value as number;
const val = op_data['Op-to-Op Gap'].raw_value as number;
return acc + (val - 6);
}, 0);

// Compute total_duration as sum of device times + dispatch times
// Compute total_duration as sum of device times + Op-to-Op Gaps
const total_device_time = rows.reduce((acc, r) => {
const val = r['Device Time'].raw_value;
return acc + (typeof val === 'number' ? val : 0);
}, 0);
const total_dispatch_time = rows.reduce((acc, r) => {
const val = r['Dispatch Time'].raw_value;
const val = r['Op-to-Op Gap'].raw_value;
return acc + (typeof val === 'number' ? val : 0);
}, 0);

Expand Down
6 changes: 3 additions & 3 deletions src/functions/perfFunctions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@ export const color_row = (op_data: ProcessedRow, min_percentage: number) => {
op_data.Bound.color = 'red';
}

// Dispatch time >6.5us?
const dispatch_time = op_data['Dispatch Time'].raw_value as number | null;
// Op-to-Op Gap >6.5us?
const dispatch_time = op_data['Op-to-Op Gap'].raw_value as number | null;
if (dispatch_time != null && dispatch_time > 6.5) {
op_data['Dispatch Time'].color = 'red';
op_data['Op-to-Op Gap'].color = 'red';
}

// Math Fidelity evaluation
Expand Down
31 changes: 26 additions & 5 deletions src/hooks/useAPI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -355,15 +355,37 @@ export const useGetDeviceOperationsList = (): DeviceOperationMapping[] => {
const { data: operations } = useOperationsList();
const { data: devices } = useDevices();

/**
* TODO: update when device op data is device bound
* @description Collapse multi-device operations into single entry temporary logic, this can under certain circumstances lead to false positives
* @param data
* @param numDevices
*/
const collapseMultideviceOPs = (data: DeviceOperationMapping[], numDevices: number): DeviceOperationMapping[] => {
const lookup = new Map<string, DeviceOperationMapping>();
if (numDevices === 1) {
return data;
}
const result: DeviceOperationMapping[] = [];
let count = 0;
let previousKey = '';

data.forEach((item) => {
const key = `${item.name}-${item.id}`;
if (!lookup.has(key)) {
lookup.set(key, item);

if (key === previousKey) {
count++;
} else {
count = 1;
}

if (count !== numDevices) {
result.push(item);
}

previousKey = key;
});
return Array.from(lookup.values());

return result;
};

return useMemo(() => {
Expand Down Expand Up @@ -429,7 +451,6 @@ export const useGetDeviceOperationListPerf = () => {
}
return false;
});

return isValid ? deviceOperations : [];
}, [data, deviceOperations]);
};
Expand Down

0 comments on commit 6a0489d

Please sign in to comment.