Create info/ Module (Core Query Layer)
#208
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR creates the
info/module as the core query layer for kernel information from NDJSON trace files. This is an internal infrastructure PR that will be used by PR4 (reproduce--kernel/--launch-id) and PR5 (info CLI).Changes
tritonparse/info/__init__.py: Module initialization, exports core functionstritonparse/info/kernel_query.py: Core query functions:KernelSummarydataclass: kernel name, hash, total launchesLaunchInfodataclass: launch ID, line index, grid (for PR5)list_kernels(events): List all kernels with their launch countsfind_launch_index_by_kernel(events, kernel_name, launch_id): Find 0-based line index for a kernel's N-th launchtests/test_tritonparse.py: Added 6 unit tests inTestTritonparseCPU:test_list_kernels_empty(): Empty events listtest_list_kernels_single(): Single kernel with multiple launchestest_list_kernels_multiple(): Multiple different kernelstest_find_launch_index_valid(): Valid kernel name and launch_idtest_find_launch_index_kernel_not_found(): Raises ValueError when kernel not foundtest_find_launch_index_out_of_range(): Raises ValueError with valid range hintTesting
Tests use real data from
tests/example_output/parsed_output_complex/dedicated_log_triton_trace_findhao__mapped.ndjson.gzwhen possible, mock data for edge cases (empty list, non-existent kernel, out-of-range launch_id).Notes