tritonparse 0.3.1.dev20251018071448__tar.gz → 0.3.2.dev20251113071521__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/CHANGELOG.md +86 -0
  2. {tritonparse-0.3.1.dev20251018071448/tritonparse.egg-info → tritonparse-0.3.2.dev20251113071521}/PKG-INFO +2 -2
  3. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/README.md +1 -1
  4. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tests/test_add.py +0 -1
  5. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tests/test_tritonparse.py +121 -1
  6. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/__main__.py +2 -0
  7. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/cli.py +9 -2
  8. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/common.py +2 -3
  9. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/context_manager.py +5 -4
  10. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/event_diff.py +2 -0
  11. tritonparse-0.3.2.dev20251113071521/tritonparse/ir_analysis.py +427 -0
  12. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/ir_parser.py +147 -2
  13. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/mapper.py +2 -0
  14. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/reproducer/cli.py +7 -0
  15. tritonparse-0.3.2.dev20251113071521/tritonparse/reproducer/function_extractor.py +222 -0
  16. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/reproducer/ingestion/ndjson.py +4 -2
  17. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/reproducer/orchestrator.py +5 -4
  18. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/reproducer/placeholder_replacer.py +46 -16
  19. tritonparse-0.3.2.dev20251113071521/tritonparse/reproducer/templates/example.py +34 -0
  20. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/reproducer/templates/loader.py +2 -0
  21. tritonparse-0.3.2.dev20251113071521/tritonparse/reproducer/templates/tritonbench.py +103 -0
  22. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/reproducer/types.py +2 -0
  23. tritonparse-0.3.1.dev20251018071448/tritonparse/reproducer/templates/example.py → tritonparse-0.3.2.dev20251113071521/tritonparse/reproducer/utils.py +164 -89
  24. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/shared_vars.py +1 -0
  25. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/sourcemap_utils.py +24 -0
  26. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/structured_logging.py +102 -9
  27. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/tools/decompress_bin_ndjson.py +2 -0
  28. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/tools/format_fix.py +2 -0
  29. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/tools/load_tensor.py +2 -0
  30. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/tools/prettify_ndjson.py +2 -0
  31. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/trace_processor.py +50 -15
  32. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521/tritonparse.egg-info}/PKG-INFO +2 -2
  33. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse.egg-info/SOURCES.txt +6 -0
  34. tritonparse-0.3.2.dev20251113071521/website/index.html +24 -0
  35. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/package-lock.json +343 -400
  36. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/package.json +16 -16
  37. tritonparse-0.3.2.dev20251113071521/website/scripts/update_deps.sh +53 -0
  38. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/App.tsx +28 -2
  39. tritonparse-0.3.2.dev20251113071521/website/src/components/CodeComparisonView.tsx +566 -0
  40. tritonparse-0.3.2.dev20251113071521/website/src/components/CodeViewer.css +95 -0
  41. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/components/CodeViewer.tsx +192 -72
  42. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/pages/CodeView.tsx +2 -2
  43. tritonparse-0.3.2.dev20251113071521/website/src/pages/IRAnalysis.tsx +169 -0
  44. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/pages/KernelOverview.tsx +4 -2
  45. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/utils/dataLoader.ts +26 -0
  46. tritonparse-0.3.1.dev20251018071448/tritonparse/reproducer/utils.py +0 -365
  47. tritonparse-0.3.1.dev20251018071448/website/index.html +0 -14
  48. tritonparse-0.3.1.dev20251018071448/website/src/components/CodeComparisonView.tsx +0 -419
  49. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/.ci/README.md +0 -0
  50. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/.ci/install-project.sh +0 -0
  51. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/.ci/install-triton.sh +0 -0
  52. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/.ci/run-tests.sh +0 -0
  53. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/.ci/setup.sh +0 -0
  54. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/.github/PAGES_SETUP.md +0 -0
  55. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/.github/workflows/deploy-pages-standalone.yml +0 -0
  56. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/.github/workflows/deploy-pages.yml +0 -0
  57. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/.github/workflows/nightly-pypi.yml +0 -0
  58. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/.github/workflows/test.yml +0 -0
  59. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/.gitignore +0 -0
  60. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/CODE_OF_CONDUCT.md +0 -0
  61. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/CONTRIBUTING.md +0 -0
  62. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/LICENSE +0 -0
  63. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/Makefile +0 -0
  64. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/__init__.py +0 -0
  65. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/pyproject.toml +0 -0
  66. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/run.py +0 -0
  67. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/setup.cfg +0 -0
  68. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tests/README.md +0 -0
  69. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tests/__init__.py +0 -0
  70. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tests/example_output/logs/dedicated_log_triton_trace_findhao_.ndjson +0 -0
  71. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tests/example_output/parsed_output/dedicated_log_triton_trace_findhao__mapped.ndjson.gz +0 -0
  72. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tests/example_output/parsed_output/f0_fc0_a0_cai-.ndjson.gz +0 -0
  73. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tests/example_output/parsed_output/log_file_list.json +0 -0
  74. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tests/example_output/parsed_output_complex/dedicated_log_triton_trace_findhao__mapped.ndjson.gz +0 -0
  75. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tests/example_output/parsed_output_complex/log_file_list.json +0 -0
  76. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/__init__.py +0 -0
  77. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/extract_source_mappings.py +0 -0
  78. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/reproducer/__init__.py +0 -0
  79. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/reproducer/templates/__init__.py +0 -0
  80. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/source_type.py +0 -0
  81. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/tools/__init__.py +0 -0
  82. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/tools/disasm.py +0 -0
  83. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/tools/readme.md +0 -0
  84. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/tp_logger.py +0 -0
  85. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse/utils.py +0 -0
  86. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse.egg-info/dependency_links.txt +0 -0
  87. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse.egg-info/entry_points.txt +0 -0
  88. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse.egg-info/requires.txt +0 -0
  89. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/tritonparse.egg-info/top_level.txt +0 -0
  90. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/eslint.config.js +0 -0
  91. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/public/dedicated_log_triton_trace_findhao__mapped.ndjson.gz +0 -0
  92. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/public/f0_fc0_a0_cai-.ndjson +0 -0
  93. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/public/favicon.ico +0 -0
  94. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/public/logo.svg +0 -0
  95. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/scripts/inline-html.js +0 -0
  96. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/App.css +0 -0
  97. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/assets/react.svg +0 -0
  98. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/components/ArgumentViewer.tsx +0 -0
  99. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/components/Callstack.tsx +0 -0
  100. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/components/CompilationInfo.tsx +0 -0
  101. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/components/CopyCodeButton.tsx +0 -0
  102. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/components/DataSourceSelector.tsx +0 -0
  103. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/components/DiffComparisonView.tsx +0 -0
  104. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/components/DiffViewer.tsx +0 -0
  105. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/components/ExternalLink.tsx +0 -0
  106. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/components/SingleCodeViewer.tsx +0 -0
  107. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/components/StackDiffViewer.tsx +0 -0
  108. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/components/ToggleSwitch.tsx +0 -0
  109. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/components/TritonIRs.tsx +0 -0
  110. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/components/WelcomeScreen.tsx +0 -0
  111. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/context/FileDiffSession.tsx +0 -0
  112. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/index.css +0 -0
  113. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/main.tsx +0 -0
  114. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/pages/FileDiffView.tsx +0 -0
  115. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/utils/fbDetection.ts +0 -0
  116. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/utils/safeImport.ts +0 -0
  117. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/utils/tensor.ts +0 -0
  118. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/src/vite-env.d.ts +0 -0
  119. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/tsconfig.app.json +0 -0
  120. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/tsconfig.json +0 -0
  121. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/tsconfig.node.json +0 -0
  122. {tritonparse-0.3.1.dev20251018071448 → tritonparse-0.3.2.dev20251113071521}/website/vite.config.ts +0 -0
@@ -5,6 +5,92 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.1] - 2025-11-03
9
+
10
+ ### TritonParse Release Notes (last 24 commits)
11
+
12
+ - **Date range**: 2025-10-14 — 2025-11-03
13
+ - **Scope**: IR Analysis enhancements (beta), Reproducer template extensions, code viewer improvements, bug fixes.
14
+
15
+ ### Highlights
16
+
17
+ - **📊 IR Analysis (Beta)**: New analysis capabilities for visualizing Software Pipelining (SWP), BufferOps statistics, and loop schedules in Triton IR. **Note: This is a beta feature.**
18
+ - **🏷️ Variable Location Tracking**: Complete location alias tracking system for mapping IR locations back to source code with frontend visualization.
19
+ - **🔧 TritonBench Template**: New reproducer template for easy TritonBench integration and kernel benchmarking.
20
+ - **🎨 Code Viewer Enhancements**: Full Python source extraction, function highlighting, and performance optimizations.
21
+ - **🔄 Reproducer Refactoring**: AST-based function extraction eliminates code duplication and simplifies template maintenance.
22
+
23
+ ### Changes by area
24
+
25
+ #### 📊 **IR Analysis (Beta)**
26
+ - **Software Pipelining (SWP) visualization** (PR #189):
27
+ - Analyzes inner `scf.for` loops and identifies prologue, loop_body, and epilogue stages
28
+ - Tracks `tt.load` and `tt.dot` operations through TTIR → TTGIR → Python source mappings
29
+ - Frontend displays simplified source code with SWP stage information
30
+ - **Limitations**: Does not support Warp Specialization or Blackwell operators yet
31
+ - **BufferOps backend information** (PR #181):
32
+ - Statistical analysis of buffer operations (tt.load/store, amdgpu.buffer_load/store, global_load/store) at TTGIR and AMDGCN levels
33
+ - Useful for AMD GPU backend optimization analysis
34
+ - **Web frontend IR Analysis page** (PR #184):
35
+ - New dedicated page at `/ir-analysis` route with integrated display for loop schedules and BufferOps statistics
36
+
37
+ #### 🏷️ **Variable Location Tracking**
38
+ Complete three-part implementation (PR #186, #187, #188):
39
+ - Fixed #loc storage key conflict in IR parser
40
+ - Added location alias parsing support in `ir_parser.py` and `trace_processor.py`
41
+ - Frontend visualization with CSS styling and interactive location display in Code Viewer
42
+
43
+ #### 🔄 **Reproducer System**
44
+ - **TritonBench template support** (commit 3493ac8):
45
+ - New template: `tritonparse/reproducer/templates/tritonbench.py`
46
+ - CLI option: `--template tritonbench` for TritonBench-compatible reproducers
47
+ - Integrates with TritonBench's `BenchmarkOperator` and benchmark harness
48
+ - **AST-based refactoring** (PR #178):
49
+ - New module: `tritonparse/reproducer/function_extractor.py` using Python AST
50
+ - Simplified `example.py` template from ~370 lines to ~20 lines
51
+ - **Bug fixes**:
52
+ - Fixed 1-based to 0-based line number conversion (PR #185)
53
+ - Corrected output key typo: `repo_*` → `repro_*` (PR #175)
54
+ - CUDA device normalization to `cuda:0` format (PR #177)
55
+
56
+ #### 📝 **Callsite Location Support**
57
+ - **TTIR/TTGIR callsite location** (PR #190):
58
+ - Extended IR parser to extract callsite location information
59
+ - Better debugging with call graph information and test coverage
60
+
61
+ #### 💻 **Code Viewer & Frontend**
62
+ - **Full Python source extraction** (commit 2976887):
63
+ - Enhanced `structured_logging.py` to extract complete Python source files
64
+ - **Full file display with function highlighting** (commit 220d5a4):
65
+ - CodeViewer now supports displaying entire source files with function-level highlighting
66
+ - **CodeComparisonView performance optimization** (commit c17e584):
67
+ - Significant rendering performance improvements for large files
68
+ - Reduced re-renders and improved memory efficiency
69
+
70
+ #### 🌐 **Website & Maintenance**
71
+ - **Dependency updates** (PR #179): Added automation script `website/scripts/update_deps.sh`
72
+ - **Copyright updates** (PR #183): Updated copyright headers across source files
73
+
74
+ ### Compatibility notes
75
+
76
+ - **No breaking changes**: All updates are backward compatible with v0.3.0.
77
+ - **IR Analysis (Beta)**: New optional feature accessible through web UI.
78
+ - **TritonBench template**: Optional, does not impact existing reproducer generation.
79
+
80
+ ### Upgrade guidance
81
+
82
+ 1. **Using IR Analysis (Beta)**:
83
+ - Open web UI and navigate to IR Analysis page after parsing
84
+ - View SWP stage information (prologue/loop_body/epilogue) and BufferOps statistics
85
+ - Note: Beta feature with some limitations on advanced pipelining patterns
86
+
87
+ 2. **Generating TritonBench reproducers**:
88
+ ```bash
89
+ tritonparseoss reproduce trace.ndjson.gz --line <N> --template tritonbench --out-dir <output>
90
+ ```
91
+
92
+ 3. **Code viewer enhancements**: Automatically enabled with full source display and function highlighting
93
+
8
94
  ## [0.3.0] - 2025-10-14
9
95
 
10
96
  ### TritonParse Release Notes (last 44 commits)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tritonparse
3
- Version: 0.3.1.dev20251018071448
3
+ Version: 0.3.2.dev20251113071521
4
4
  Summary: TritonParse: A Compiler Tracer, Visualizer, and mini-Reproducer Generator for Triton Kernels
5
5
  Author-email: Yueming Hao <yhao@meta.com>
6
6
  License-Expression: BSD-3-Clause
@@ -134,7 +134,7 @@ from tritonparse.reproducer.orchestrator import reproduce
134
134
 
135
135
  result = reproduce(
136
136
  input_path="./parsed_output/trace.ndjson.gz",
137
- line_index=1, # Which launch event (1-based)
137
+ line_index=0, # 0-based index (first event is 0)
138
138
  out_dir="repro_output"
139
139
  )
140
140
  ```
@@ -116,7 +116,7 @@ from tritonparse.reproducer.orchestrator import reproduce
116
116
 
117
117
  result = reproduce(
118
118
  input_path="./parsed_output/trace.ndjson.gz",
119
- line_index=1, # Which launch event (1-based)
119
+ line_index=0, # 0-based index (first event is 0)
120
120
  out_dir="repro_output"
121
121
  )
122
122
  ```
@@ -12,7 +12,6 @@ import os
12
12
  import torch
13
13
  import triton
14
14
  import triton.language as tl
15
-
16
15
  import tritonparse.structured_logging
17
16
  import tritonparse.utils
18
17
 
@@ -24,7 +24,6 @@ import tritonparse.context_manager
24
24
  import tritonparse.structured_logging
25
25
  import tritonparse.utils
26
26
  from triton import knobs # @manual=//triton:triton
27
-
28
27
  from triton.compiler import ASTSource, IRSource # @manual=//triton:triton
29
28
  from triton.knobs import CompileTimes # @manual=//triton:triton
30
29
  from tritonparse.common import is_fbcode
@@ -139,6 +138,63 @@ def clear_all_caches(*kernels):
139
138
  class TestTritonparseCPU(unittest.TestCase):
140
139
  """CPU-only tests (no CUDA required)"""
141
140
 
141
+ def test_callsite_parsing(self):
142
+ """Test parsing of callsite locations in TTIR/TTGIR"""
143
+ from tritonparse.ir_parser import extract_loc_definitions
144
+ from tritonparse.trace_processor import generate_source_mappings
145
+
146
+ # Test MLIR callsite location definitions
147
+ ir_with_callsite = """
148
+ module {
149
+ #loc7 = loc("/tmp/test.py":1091:8)
150
+ #loc57 = loc("/tmp/test.py":421:16)
151
+ #loc58 = loc("/tmp/test.py":853:16)
152
+ #loc190 = loc(callsite(#loc58 at #loc7))
153
+ #loc220 = loc(callsite(#loc57 at #loc190))
154
+ %0 = tt.load %ptr loc(#loc220)
155
+ }
156
+ """
157
+ # Extract loc definitions
158
+ locs = extract_loc_definitions(ir_with_callsite)
159
+
160
+ # Verify loc220 (nested callsite)
161
+ self.assertIn("220", locs)
162
+ self.assertEqual(locs["220"]["file"], "/tmp/test.py")
163
+ self.assertEqual(locs["220"]["line"], 421) # Inherited from callee loc57
164
+ self.assertEqual(locs["220"]["column"], 16)
165
+ self.assertTrue(locs["220"].get("is_callsite"))
166
+ self.assertEqual(locs["220"]["callsite_callee"], "57")
167
+ self.assertEqual(locs["220"]["callsite_caller"], "190")
168
+
169
+ # Verify loc190 (simple callsite)
170
+ self.assertIn("190", locs)
171
+ self.assertEqual(locs["190"]["line"], 853) # Inherited from callee loc58
172
+ self.assertTrue(locs["190"].get("is_callsite"))
173
+ self.assertEqual(locs["190"]["callsite_callee"], "58")
174
+ self.assertEqual(locs["190"]["callsite_caller"], "7")
175
+
176
+ # Test source mappings generation
177
+ mappings = generate_source_mappings(ir_with_callsite, "ttir")
178
+
179
+ # Find the line with tt.load
180
+ line_with_load = None
181
+ for line_num, content in enumerate(ir_with_callsite.split("\n"), start=1):
182
+ if "tt.load" in content:
183
+ line_with_load = str(line_num)
184
+ break
185
+
186
+ self.assertIsNotNone(line_with_load)
187
+ self.assertIn(line_with_load, mappings)
188
+
189
+ mapping = mappings[line_with_load]
190
+ self.assertEqual(mapping["file"], "/tmp/test.py")
191
+ self.assertEqual(mapping["line"], 421) # From loc220 -> loc57
192
+ self.assertTrue(mapping.get("is_callsite"))
193
+ self.assertEqual(mapping["callsite_callee"], "57")
194
+ self.assertEqual(mapping["callsite_caller"], "190")
195
+
196
+ print("✓ Callsite parsing tests passed")
197
+
142
198
  def test_convert(self):
143
199
  """Test convert function with various data types"""
144
200
  # Test with primitive types
@@ -187,6 +243,70 @@ class TestTritonparseCPU(unittest.TestCase):
187
243
 
188
244
  assert convert(nested_structure) == expected_nested
189
245
 
246
+ def test_loc_alias_parsing(self):
247
+ """Test parsing of location aliases in TTIR/TTGIR"""
248
+ from tritonparse.ir_parser import extract_loc_definitions
249
+
250
+ # Test case 1: Bare #loc reference (no number)
251
+ ir_with_bare_loc = """
252
+ module {
253
+ #loc = loc("/tmp/test.py":10:5)
254
+ #loc13 = loc("x_ptr"(#loc))
255
+ func @kernel(%arg0: !tt.ptr<f32> loc(#loc13)) {
256
+ return loc(#loc)
257
+ }
258
+ }
259
+ """
260
+ locs = extract_loc_definitions(ir_with_bare_loc)
261
+ # Main #loc should be stored with "" key
262
+ assert "" in locs, "Main #loc not found"
263
+ assert locs[""]["file"] == "/tmp/test.py"
264
+ assert locs[""]["line"] == 10
265
+ # Alias #loc13 should resolve to same location
266
+ assert "13" in locs, "#loc13 not found"
267
+ assert locs["13"]["file"] == "/tmp/test.py"
268
+ assert locs["13"]["line"] == 10
269
+ assert locs["13"]["alias_name"] == "x_ptr"
270
+ assert locs["13"]["alias_of"] == ""
271
+
272
+ # Test case 2: Named alias with numbered reference
273
+ ir_with_numbered_alias = """
274
+ #loc = loc("/tmp/test.py":5:0)
275
+ #loc2 = loc("/tmp/test.py":20:28)
276
+ #loc16 = loc("pid"(#loc2))
277
+ %0 = tt.get_program_id x : i32 loc(#loc16)
278
+ """
279
+ locs = extract_loc_definitions(ir_with_numbered_alias)
280
+ assert "2" in locs
281
+ assert locs["2"]["line"] == 20
282
+ assert "16" in locs
283
+ assert locs["16"]["file"] == "/tmp/test.py"
284
+ assert locs["16"]["line"] == 20
285
+ assert locs["16"]["alias_name"] == "pid"
286
+ assert locs["16"]["alias_of"] == "2"
287
+
288
+ # Test case 3: Simple alias (no name)
289
+ ir_with_simple_alias = """
290
+ #loc = loc("/tmp/test.py":1:1)
291
+ #loc1 = loc("/tmp/test.py":15:10)
292
+ #loc20 = loc(#loc1)
293
+ %1 = arith.constant 0 : i32 loc(#loc20)
294
+ """
295
+ locs = extract_loc_definitions(ir_with_simple_alias)
296
+ assert "1" in locs
297
+ assert "20" in locs
298
+ assert locs["20"]["file"] == "/tmp/test.py"
299
+ assert locs["20"]["line"] == 15
300
+ assert locs["20"]["alias_of"] == "1"
301
+ assert "alias_name" not in locs["20"]
302
+
303
+ # Test case 4: Definition line tracking
304
+ assert "def_line" in locs[""]
305
+ assert "def_line" in locs["1"]
306
+ assert "def_line" in locs["20"]
307
+
308
+ print("✓ All loc alias parsing tests passed")
309
+
190
310
 
191
311
  class TestTritonparseCUDA(unittest.TestCase):
192
312
  """CUDA tests (require GPU)"""
@@ -1,3 +1,5 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
1
3
  from .cli import main
2
4
 
3
5
 
@@ -68,17 +68,24 @@ def main():
68
68
  }
69
69
  unified_parse(**parse_args)
70
70
  elif args.func == "reproduce":
71
+ replacer = None
72
+ if args.use_fbcode:
73
+ from tritonparse.fb.reproducer.replacer import FBCodePlaceholderReplacer
74
+
75
+ replacer = FBCodePlaceholderReplacer()
76
+ print(f"Using FBCode placeholder replacer for template: {args.template}")
77
+
71
78
  reproduce(
72
79
  input_path=args.input,
73
- line_index=args.line,
80
+ line_index=args.line - 1, # Convert 1-based line number to 0-based index
74
81
  out_dir=args.out_dir,
75
82
  template=args.template,
76
83
  kernel_import=args.kernel_import,
84
+ replacer=replacer,
77
85
  )
78
86
  else:
79
87
  raise RuntimeError(f"Unknown command: {args.func}")
80
88
 
81
89
 
82
90
  if __name__ == "__main__":
83
- # Do not add code here, it won't be run. Add them to the function called below.
84
91
  main() # pragma: no cover
@@ -1,7 +1,6 @@
1
1
  # Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  import gzip
4
-
5
4
  import importlib
6
5
  import importlib.util
7
6
  import json
@@ -25,9 +24,9 @@ def is_fbcode():
25
24
 
26
25
 
27
26
  if is_fbcode():
28
- from tritonparse.fb.source_type import SourceType
27
+ from .fb.source_type import SourceType
29
28
  else:
30
- from tritonparse.source_type import SourceType
29
+ from .source_type import SourceType
31
30
 
32
31
 
33
32
  class Rank:
@@ -1,11 +1,12 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
1
3
  import os
2
4
  import shutil
3
5
  import tempfile
4
6
 
5
- from tritonparse.shared_vars import TEST_KEEP_OUTPUT
6
-
7
- from tritonparse.structured_logging import clear_logging_config, init
8
- from tritonparse.utils import unified_parse
7
+ from .shared_vars import TEST_KEEP_OUTPUT
8
+ from .structured_logging import clear_logging_config, init
9
+ from .utils import unified_parse
9
10
 
10
11
 
11
12
  def createUniqueTempDirectory():
@@ -1,3 +1,5 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
1
3
  import json
2
4
  from collections import defaultdict
3
5
  from typing import Any, Dict, List, Tuple