Skip to content

PerfModel: unify kernel library classification - #984

Open
ajassani wants to merge 17 commits into
mainfrom
ajassani/kernel-library-unify
Open

PerfModel: unify kernel library classification#984
ajassani wants to merge 17 commits into
mainfrom
ajassani/kernel-library-unify

Conversation

@ajassani

Copy link
Copy Markdown
Collaborator

Summary

Tracks #983.

Addresses Kyle's #674 review on TraceIndex/utils.py: replace inline kernel-library heuristics with shared classification used by agent analysis.

  • New TraceLens/PerfModel/kernel_library.pyclassify_kernel_library (extracted from analysis_utils)
  • GEMM detectors from kernel_name_parser (is_rocm_gemm, is_cuda_gemm); extend when Improve GEMM kernel parsing #805 merges
  • TraceIndex kernel_flags delegates to shared classifier; passes parent op name during import
  • analysis_utils imports shared module (no duplicate rules)

Stacked on #674 so kernel-library refactor lands separately from TraceIndex core.

Test plan

  • pytest tests/test_kernel_library.py
  • pytest tests/test_analysis_agent_utils.py::test_classify_kernel_library
  • pytest tests/test_trace_index.py

ajassani and others added 17 commits August 24, 2026 14:25
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Map Kernel stream and category kernel-time_ms columns, cover import with checked-in report fixtures, and Black-format the new files.
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Parse perf_params and kernel_details_summary from Python repr into JSON so
they are queryable. Kernel rows now come from each unified op's
kernel_details_summary with a unified_row_id FK, replacing the flat
kernel_summary.csv import. Add gemm_perf, sdpa_perf, and conv_perf satellite
tables keyed on unified_row_id for shape-based SQL. Update the how-to schema
diagram and tests accordingly.

Co-authored-by: Cursor <cursoragent@cursor.com>
The table holds one row per kernel belonging to a specific op (via
unified_row_id), not the aggregate kernel_summary.csv sheet. Rename it to
op_kernels to avoid colliding with that report sheet name and to reflect that
each row is a per-op kernel. Update indexes, ingest, docs diagram, and tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
Document what each test in test_trace_index.py verifies so the suite reads as a
table of contents for the catalog behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add an example-queries section to the trace-index how-to showing depthwise
convolution and longest-context attention lookups against the shape satellite
tables, so shape questions are SQL filters rather than trace reopens.

Co-authored-by: Cursor <cursoragent@cursor.com>
Include sample result tables and short takeaways for the depthwise-convolution
and longest-attention example queries so the how-to shows the payoff of the
shape satellite tables, not just the SQL.

Co-authored-by: Cursor <cursoragent@cursor.com>
Catalog ingest is append/build only. Remove the unused directory scanner and
stop exporting import_report_dir; existing CSV reports go through append
--report-dir. Tests for real report fixtures now use that public path.

Co-authored-by: Cursor <cursoragent@cursor.com>
The HTTP query server and sqlite-sql intentionally run caller-provided SELECT
statements. They are already restricted to a single read-only statement and
opened with SQLite query_only/mode=ro. Add CodeQL suppressions so that
expected use is not reported as SQL injection.

Co-authored-by: Cursor <cursoragent@cursor.com>
Cover health, tables, GET/POST /query, write rejection, 404s, and result
truncation. Close SQLite connections in the handler; a connection context
manager does not close the DB and leaked handles in tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
Extract write_stub_trace/write_mini_report fixtures, use a query_server context manager for HTTP server lifecycle, and merge the two server test functions. Drop redundant store-boundary test covered by append/import paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
gabeweisz
gabeweisz previously approved these changes Aug 31, 2026
tsrikris
tsrikris previously approved these changes Aug 31, 2026
Base automatically changed from ajassani/traceindex-feature to main September 2, 2026 20:43
@ajassani
ajassani dismissed stale reviews from tsrikris and gabeweisz September 2, 2026 20:43

The base branch was changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants