tritonparse 0.3.1.dev20251023071548__tar.gz → 0.3.1.dev20251025071457__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.

Potentially problematic release.


This version of tritonparse might be problematic. Click here for more details.

Files changed (116) hide show
  1. {tritonparse-0.3.1.dev20251023071548/tritonparse.egg-info → tritonparse-0.3.1.dev20251025071457}/PKG-INFO +1 -1
  2. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/__main__.py +2 -0
  3. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/context_manager.py +2 -0
  4. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/event_diff.py +2 -0
  5. tritonparse-0.3.1.dev20251025071457/tritonparse/ir_analysis.py +74 -0
  6. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/ir_parser.py +2 -0
  7. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/mapper.py +2 -0
  8. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/reproducer/cli.py +2 -0
  9. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/reproducer/function_extractor.py +2 -0
  10. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/reproducer/ingestion/ndjson.py +2 -0
  11. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/reproducer/orchestrator.py +2 -0
  12. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/reproducer/placeholder_replacer.py +2 -0
  13. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/reproducer/templates/loader.py +2 -0
  14. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/reproducer/types.py +2 -0
  15. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/reproducer/utils.py +2 -0
  16. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/shared_vars.py +1 -0
  17. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/sourcemap_utils.py +24 -0
  18. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/tools/decompress_bin_ndjson.py +2 -0
  19. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/tools/format_fix.py +2 -0
  20. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/tools/load_tensor.py +2 -0
  21. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/tools/prettify_ndjson.py +2 -0
  22. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/trace_processor.py +13 -13
  23. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457/tritonparse.egg-info}/PKG-INFO +1 -1
  24. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse.egg-info/SOURCES.txt +1 -0
  25. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/.ci/README.md +0 -0
  26. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/.ci/install-project.sh +0 -0
  27. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/.ci/install-triton.sh +0 -0
  28. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/.ci/run-tests.sh +0 -0
  29. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/.ci/setup.sh +0 -0
  30. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/.github/PAGES_SETUP.md +0 -0
  31. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/.github/workflows/deploy-pages-standalone.yml +0 -0
  32. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/.github/workflows/deploy-pages.yml +0 -0
  33. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/.github/workflows/nightly-pypi.yml +0 -0
  34. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/.github/workflows/test.yml +0 -0
  35. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/.gitignore +0 -0
  36. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/CHANGELOG.md +0 -0
  37. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/CODE_OF_CONDUCT.md +0 -0
  38. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/CONTRIBUTING.md +0 -0
  39. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/LICENSE +0 -0
  40. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/Makefile +0 -0
  41. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/README.md +0 -0
  42. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/__init__.py +0 -0
  43. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/pyproject.toml +0 -0
  44. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/run.py +0 -0
  45. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/setup.cfg +0 -0
  46. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tests/README.md +0 -0
  47. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tests/__init__.py +0 -0
  48. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tests/example_output/logs/dedicated_log_triton_trace_findhao_.ndjson +0 -0
  49. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tests/example_output/parsed_output/dedicated_log_triton_trace_findhao__mapped.ndjson.gz +0 -0
  50. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tests/example_output/parsed_output/f0_fc0_a0_cai-.ndjson.gz +0 -0
  51. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tests/example_output/parsed_output/log_file_list.json +0 -0
  52. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tests/example_output/parsed_output_complex/dedicated_log_triton_trace_findhao__mapped.ndjson.gz +0 -0
  53. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tests/example_output/parsed_output_complex/log_file_list.json +0 -0
  54. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tests/test_add.py +0 -0
  55. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tests/test_tritonparse.py +0 -0
  56. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/__init__.py +0 -0
  57. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/cli.py +0 -0
  58. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/common.py +0 -0
  59. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/extract_source_mappings.py +0 -0
  60. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/reproducer/__init__.py +0 -0
  61. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/reproducer/templates/__init__.py +0 -0
  62. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/reproducer/templates/example.py +0 -0
  63. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/source_type.py +0 -0
  64. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/structured_logging.py +0 -0
  65. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/tools/__init__.py +0 -0
  66. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/tools/disasm.py +0 -0
  67. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/tools/readme.md +0 -0
  68. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/tp_logger.py +0 -0
  69. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse/utils.py +0 -0
  70. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse.egg-info/dependency_links.txt +0 -0
  71. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse.egg-info/entry_points.txt +0 -0
  72. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse.egg-info/requires.txt +0 -0
  73. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/tritonparse.egg-info/top_level.txt +0 -0
  74. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/eslint.config.js +0 -0
  75. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/index.html +0 -0
  76. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/package-lock.json +0 -0
  77. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/package.json +0 -0
  78. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/public/dedicated_log_triton_trace_findhao__mapped.ndjson.gz +0 -0
  79. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/public/f0_fc0_a0_cai-.ndjson +0 -0
  80. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/public/favicon.ico +0 -0
  81. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/public/logo.svg +0 -0
  82. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/scripts/inline-html.js +0 -0
  83. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/scripts/update_deps.sh +0 -0
  84. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/App.css +0 -0
  85. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/App.tsx +0 -0
  86. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/assets/react.svg +0 -0
  87. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/components/ArgumentViewer.tsx +0 -0
  88. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/components/Callstack.tsx +0 -0
  89. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/components/CodeComparisonView.tsx +0 -0
  90. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/components/CodeViewer.tsx +0 -0
  91. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/components/CompilationInfo.tsx +0 -0
  92. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/components/CopyCodeButton.tsx +0 -0
  93. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/components/DataSourceSelector.tsx +0 -0
  94. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/components/DiffComparisonView.tsx +0 -0
  95. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/components/DiffViewer.tsx +0 -0
  96. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/components/ExternalLink.tsx +0 -0
  97. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/components/SingleCodeViewer.tsx +0 -0
  98. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/components/StackDiffViewer.tsx +0 -0
  99. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/components/ToggleSwitch.tsx +0 -0
  100. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/components/TritonIRs.tsx +0 -0
  101. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/components/WelcomeScreen.tsx +0 -0
  102. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/context/FileDiffSession.tsx +0 -0
  103. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/index.css +0 -0
  104. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/main.tsx +0 -0
  105. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/pages/CodeView.tsx +0 -0
  106. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/pages/FileDiffView.tsx +0 -0
  107. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/pages/KernelOverview.tsx +0 -0
  108. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/utils/dataLoader.ts +0 -0
  109. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/utils/fbDetection.ts +0 -0
  110. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/utils/safeImport.ts +0 -0
  111. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/utils/tensor.ts +0 -0
  112. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/src/vite-env.d.ts +0 -0
  113. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/tsconfig.app.json +0 -0
  114. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/tsconfig.json +0 -0
  115. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/tsconfig.node.json +0 -0
  116. {tritonparse-0.3.1.dev20251023071548 → tritonparse-0.3.1.dev20251025071457}/website/vite.config.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tritonparse
3
- Version: 0.3.1.dev20251023071548
3
+ Version: 0.3.1.dev20251025071457
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
@@ -1,3 +1,5 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
1
3
  from .cli import main
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
1
3
  import os
2
4
  import shutil
3
5
  import tempfile
@@ -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
@@ -0,0 +1,74 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ import logging
4
+
5
+ from .sourcemap_utils import load_ir_contents
6
+
7
+
8
+ logger = logging.getLogger("IRAnalysis")
9
+
10
+
11
+ def process_amd_bufferop(ir_content: str, io_keys: list[str]) -> dict[str, int]:
12
+ def make_key(prefix: str) -> str:
13
+ return f"{prefix}_count"
14
+
15
+ io_keys = [(make_key(prefix), prefix) for prefix in io_keys]
16
+ output: dict[str, int] = {}
17
+ for dict_key, _ in io_keys:
18
+ output[dict_key] = 0
19
+ if ir_content:
20
+ for line in ir_content.split("\n"):
21
+ for dict_key, code_key in io_keys:
22
+ if code_key in line:
23
+ output[dict_key] += 1
24
+ return output
25
+
26
+
27
+ def process_amd_ttgir_bufferops(
28
+ key: str,
29
+ file_content: dict[str, str],
30
+ file_path: dict[str, str],
31
+ ) -> dict[str, int]:
32
+ ir_content = load_ir_contents(key, file_content, file_path)
33
+ # TODO: Add atomics
34
+ io_keys = ["tt.load", "tt.store", "amdgpu.buffer_load", "amdgpu.buffer_store"]
35
+ return process_amd_bufferop(ir_content, io_keys)
36
+
37
+
38
+ def process_amd_gcn_bufferops(
39
+ key: str,
40
+ file_content: dict[str, str],
41
+ file_path: dict[str, str],
42
+ ) -> dict[str, int]:
43
+ ir_content = load_ir_contents(key, file_content, file_path)
44
+ # TODO: Add atomics
45
+ io_keys = ["global_load_", "global_store_", "buffer_load_", "buffer_store_"]
46
+ return process_amd_bufferop(ir_content, io_keys)
47
+
48
+
49
+ def _generate_ir_analysis(entry: str):
50
+ payload = entry.setdefault("payload", {})
51
+ file_content = payload.get("file_content", {})
52
+ file_path = payload.get("file_path", {})
53
+
54
+ # Find the IR file keys
55
+ ttgir_key = next((k for k in file_content if k.endswith(".ttgir")), None)
56
+ amdgcn_key = next((k for k in file_content if k.endswith(".amdgcn")), None)
57
+ # Skip if no IR files found
58
+ if not (ttgir_key or amdgcn_key):
59
+ logger.debug("No AMD IR found")
60
+ return {}
61
+ ir_analysis = {}
62
+ if amdgcn_key:
63
+ ttgir_bufferops_info = process_amd_ttgir_bufferops(
64
+ ttgir_key, file_content, file_path
65
+ )
66
+ gcn_bufferops_info = process_amd_gcn_bufferops(
67
+ amdgcn_key, file_content, file_path
68
+ )
69
+ # NDJSON format requires a newline at the end of each line
70
+ if ttgir_bufferops_info:
71
+ ir_analysis["amd_ttgir_bufferops_count"] = ttgir_bufferops_info
72
+ if gcn_bufferops_info:
73
+ ir_analysis["amd_gcn_bufferops_count"] = gcn_bufferops_info
74
+ return {"ir_analysis": ir_analysis}
@@ -1,3 +1,5 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
1
3
  import logging
2
4
  import os
3
5
  import re
@@ -1,3 +1,5 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
1
3
  import logging
2
4
  from collections import defaultdict
3
5
  from typing import Any, Dict, List, Tuple
@@ -1,3 +1,5 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
1
3
  import argparse
2
4
 
3
5
  from tritonparse.reproducer.types import KernelImportMode
@@ -1,3 +1,5 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
1
3
  """
2
4
  Function extractor for reproducer utility functions.
3
5
 
@@ -1,3 +1,5 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
1
3
  from dataclasses import dataclass
2
4
  from typing import Any, Dict, List, Optional, Tuple
3
5
 
@@ -1,3 +1,5 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
1
3
  from pathlib import Path
2
4
  from typing import Optional
3
5
 
@@ -1,3 +1,5 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
1
3
  from abc import ABC
2
4
 
3
5
  from typing import Any, Dict, Protocol
@@ -1,3 +1,5 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
1
3
  from importlib.resources import files as pkg_files
2
4
  from pathlib import Path
3
5
  from typing import List
@@ -1,3 +1,5 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
1
3
  from enum import Enum
2
4
 
3
5
 
@@ -1,3 +1,5 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
1
3
  import importlib
2
4
  import importlib.util
3
5
  import json
@@ -1,3 +1,4 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
1
2
  # We'd like to sperate structured logging module and tritonparse module as much as possible. So, put the shared variables here.
2
3
  import os
3
4
 
@@ -1,5 +1,10 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ import logging
1
4
  from typing import Any, Dict, List
2
5
 
6
+ logger = logging.getLogger("SourceMapping")
7
+
3
8
 
4
9
  def get_file_extension(filename: str) -> str:
5
10
  """
@@ -70,3 +75,22 @@ def _to_ranges(indices: List[int]) -> List[Dict[str, int]]:
70
75
 
71
76
  ranges.append({"start": start, "end": end})
72
77
  return ranges
78
+
79
+
80
+ def load_ir_contents(
81
+ key: str,
82
+ file_content: dict[str, str],
83
+ file_path: dict[str, str],
84
+ ):
85
+ if not key:
86
+ return {}
87
+ logger.debug(f"Processing {key}")
88
+ ir_content = file_content.get(key, None)
89
+ if not ir_content:
90
+ ir_file_path = file_path.get(key, None)
91
+ if not ir_file_path:
92
+ logger.warning(f"No content found for {key}")
93
+ return {}
94
+ with open(ir_file_path, "r") as f:
95
+ ir_content = f.read()
96
+ return ir_content
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env python3
2
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
3
+
2
4
  """
3
5
  Script to decompress .bin.ndjson files back to regular .ndjson format.
4
6
 
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env python3
2
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
3
+
2
4
  """
3
5
  Format fix script for tritonparse project.
4
6
 
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env python3
2
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
3
+
2
4
  """
3
5
  Simple tensor loading utility for tritonparse saved tensors.
4
6
  Usage:
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env python3
2
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
3
+
2
4
  """
3
5
  Convert an NDJSON file to a prettified JSON file.
4
6
 
@@ -1,3 +1,5 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
1
3
  import gzip
2
4
  import json
3
5
  import logging
@@ -6,6 +8,7 @@ from collections import defaultdict
6
8
  from typing import Any, Dict, List
7
9
 
8
10
  from .event_diff import _generate_launch_diff
11
+ from .ir_analysis import _generate_ir_analysis
9
12
 
10
13
  from .ir_parser import (
11
14
  extract_code_locations,
@@ -13,7 +16,7 @@ from .ir_parser import (
13
16
  extract_ptx_amdgcn_mappings,
14
17
  )
15
18
  from .mapper import create_bidirectional_mapping, create_python_mapping
16
- from .sourcemap_utils import get_file_extension
19
+ from .sourcemap_utils import get_file_extension, load_ir_contents
17
20
 
18
21
  logger = logging.getLogger("SourceMapping")
19
22
 
@@ -84,19 +87,9 @@ def process_ir(
84
87
  file_path: Dict[str, str],
85
88
  other_mappings: List[Any] = None,
86
89
  ):
87
- # Generate source mappings for each IR type
88
- # the key should be the full file name with extension for the IR files
89
- if not key:
90
- return {}
91
- logger.debug(f"Processing {key}")
92
- ir_content = file_content.get(key, None)
90
+ ir_content = load_ir_contents(key, file_content, file_path)
93
91
  if not ir_content:
94
- ir_file_path = file_path.get(key, None)
95
- if not ir_file_path:
96
- logger.warning(f"No content found for {key}")
97
- return {}
98
- with open(ir_file_path, "r") as f:
99
- ir_content = f.read()
92
+ return {}
100
93
  mapping = generate_source_mappings(ir_content, key.split(".")[1], other_mappings)
101
94
  logger.debug(f"Generated source mapping for {key}")
102
95
  return mapping
@@ -307,6 +300,13 @@ def parse_single_file(
307
300
  json.dumps(launch_event, separators=(",", ":")) + "\n"
308
301
  )
309
302
 
303
+ if compilation_event:
304
+ ir_analysis_event = _generate_ir_analysis(compilation_event)
305
+ if ir_analysis_event:
306
+ all_output_lines[output_file].append(
307
+ json.dumps(ir_analysis_event, separators=(",", ":")) + "\n"
308
+ )
309
+
310
310
  if compilation_event and launches_with_indices:
311
311
  sames, diffs, launch_index_map = _generate_launch_diff(
312
312
  launches_with_indices
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tritonparse
3
- Version: 0.3.1.dev20251023071548
3
+ Version: 0.3.1.dev20251025071457
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
@@ -35,6 +35,7 @@ tritonparse/common.py
35
35
  tritonparse/context_manager.py
36
36
  tritonparse/event_diff.py
37
37
  tritonparse/extract_source_mappings.py
38
+ tritonparse/ir_analysis.py
38
39
  tritonparse/ir_parser.py
39
40
  tritonparse/mapper.py
40
41
  tritonparse/shared_vars.py