Download tools/startup_split.py from jburtoft/nki-kernel-bench: direct link, hf CLI and curl.
- Browser
- Download file 849 Bytes
-
https://huggingface.co/datasets/jburtoft/nki-kernel-bench/resolve/main/tools/startup_split.py
- Command line
-
hf download hf://datasets/jburtoft/nki-kernel-bench/tools/startup_split.py
-
curl -L -o startup_split.py https://huggingface.co/datasets/jburtoft/nki-kernel-bench/resolve/main/tools/startup_split.py
849 Bytes
| """Split a profile's total_time into start-up wait and kernel body. | |
| start-up = time until the first non-control instruction (not EVENT_SEMAPHORE/NOP/DRAIN/NOTIFY/ | |
| TENSOR_LOAD/COMPARE_BRANCH) or first DMA packet, whichever is earlier.""" | |
| import pandas as pd | |
| CTRL = {"EVENT_SEMAPHORE", "NOP", "DRAIN", "NOTIFY", "TENSOR_LOAD", "COMPARE_BRANCH", "PSEUDO_CORE_BARRIER"} | |
| def split(pdir): | |
| I = pd.read_parquet(pdir + "/Instruction.parquet", columns=["opcode", "start_ts", "end_ts"]) | |
| D = pd.read_parquet(pdir + "/DmaPacketAggregated.parquet", columns=["start_ts"]) | |
| S = pd.read_parquet(pdir + "/Summary.parquet", columns=["total_time"]).iloc[0] | |
| t0 = I.start_ts.min() | |
| w = I[~I.opcode.isin(CTRL)].start_ts.min() | |
| if len(D): w = min(w, D.start_ts.min()) | |
| st = max(0.0, (w - t0) / 1e3); tot = S.total_time * 1e6 | |
| return st, tot - st | |