Commit 8b49b4b
Extend _json_compat with load/dump and migrate CUTracer to orjson
Summary:
Extend tritonparse's `_json_compat.py` compatibility layer with file-based
`load(f)` and `dump(obj, f)` convenience wrappers, then migrate all 14 CUTracer
production Python files from stdlib `json` to use `tritonparse._json_compat`.
This gives CUTracer a free performance upgrade via orjson for JSON parsing and
serialization (3-10x faster), while maintaining graceful degradation to stdlib
json in environments where orjson is unavailable.
Key changes:
- `_json_compat.py`: Add `load()` and `dump()` functions that delegate to the
existing `loads()`/`dumps()` with file I/O wrapping
- CUTracer: Replace `import json` with `from tritonparse._json_compat import ...`
across query/, analyze/, reduce/, and validation/ modules
- No changes to test files (consistent with tritonparse convention)
- No changes to `scripts/parse_instr_hist_trace.py` (standalone, no tritonparse dep)
CUTracer already depends on tritonparse (Buck + pip), so no new dependencies needed.
___
overriding_review_checks_triggers_an_audit_and_retroactive_review
Oncall Short Name: triton
Differential Revision: D99939361
fbshipit-source-id: 1ad5f9bce150e0aba8d7f55406e217d52cb923d21 parent fa507b3 commit 8b49b4b
1 file changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
0 commit comments