Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR adds a new API endpoint `/api/profiler/perf-results/report`, which takes the `ops_perf_results_*.csv` file, and returns a report generated with tt-perf-report. It uses the same input CSV file that is used by the `/profiler/perf-results/raw` endpoint, and it makes use of the existing code to download that file. But instead of returning the original CSV file, it runs it through tt-perf-report, and takes the output CSV file, and turns it into a JSON response, where each line of the CSV is represented as an object. You can get the report from cURL like this: `curl 'http://localhost:5173/api/profiler/perf-results/report?tabId=r5lr5xs95ai'` Where the `tabId` would be the same `tabId` already used by the frontend for other features. There is nowhere in this PR that takes a new csv parameter, since the source file is already there and can already be uploaded from the UI. Except now it processes it with the `tt-perf-report` package from PyPI, instead of returning the raw data from the `ops_perf_results_*.csv` file. The following is truncated output from the new endpoint to show the format of its response: ``` curl -s 'http://localhost:5173/api/profiler/perf-results/report?tabId=r5lr5xs95ai' \ -H 'Accept: application/json, text/plain, */*' \ -H 'Accept-Language: en-US,en;q=0.9' \ -H 'Connection: keep-alive' \ -H 'Referer: http://localhost:5173/performance' \ -H 'Sec-Fetch-Dest: empty' \ -H 'Sec-Fetch-Mode: cors' \ -H 'Sec-Fetch-Site: same-origin' \ -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36' \ -H 'sec-ch-ua: "Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'sec-ch-ua-platform: "macOS"' | python -m json.tool [ { "bound": "", "cores": "1", "device_time": "4.534", "dram": "None", "dram_percent": "None", "dram_sharded": "BFLOAT16", "flops": "None", "flops_percent": "None", "id": "2", "inner_dim_block_size": "DEV_0_DRAM_INTERLEAVED", "input_0_datatype": "BFLOAT16", "input_0_memory": "False", "input_1_datatype": "UINT32", "math_fidelity": "UINT32", "op_code": "Embeddings", "op_to_op_gap": "None", "output_datatype": " BF16 => BF16", "output_subblock_h": "None", "output_subblock_w": "None", "total_percent": "8.537923423325384e-06" }, { "bound": "", "cores": "1", "device_time": "4.641", "dram": "None", "dram_percent": "None", "dram_sharded": "BFLOAT16", "flops": "None", "flops_percent": "None", "id": "4", "inner_dim_block_size": "DEV_0_DRAM_INTERLEAVED", "input_0_datatype": "BFLOAT16", "input_0_memory": "False", "input_1_datatype": "UINT32", "math_fidelity": "UINT32", "op_code": "Embeddings", "op_to_op_gap": "18755.338", "output_datatype": " BF16 => BF16", "output_subblock_h": "None", "output_subblock_w": "None", "total_percent": "0.035326701395057857" }, { "bound": "", "cores": "64", "device_time": "9.557", "dram": "None", "dram_percent": "None", "dram_sharded": "False", "flops": "None", "flops_percent": "None", "id": "7", "inner_dim_block_size": "None", "input_0_datatype": "BFLOAT16", "input_0_memory": "DEV_1_DRAM_INTERLEAVED", "input_1_datatype": "nan", "math_fidelity": "BF16 => BF16", "op_code": "Transpose", "op_to_op_gap": "708678.341", "output_datatype": "BFLOAT16", "output_subblock_h": "None", "output_subblock_w": "None", "total_percent": "1.3345220564978897" }, ... ```
- Loading branch information