compilersutra-perf 0.1.2__tar.gz → 0.3.0__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 (257) hide show
  1. compilersutra_perf-0.3.0/NOTICE +20 -0
  2. compilersutra_perf-0.3.0/PKG-INFO +340 -0
  3. compilersutra_perf-0.3.0/README.md +279 -0
  4. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/CMakeLists.txt +18 -0
  5. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/native/NativeOptions.hpp +6 -0
  6. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/native/NativeRunner.hpp +10 -1
  7. compilersutra_perf-0.3.0/native/runtime/include/csperf/native/PapiCounters.hpp +56 -0
  8. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/opencl/OpenCLTypes.hpp +19 -0
  9. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/runtime/Process.hpp +11 -1
  10. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/vulkan/VulkanDeviceCatalog.hpp +1 -0
  11. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/Native/NativeApplication.cpp +31 -6
  12. compilersutra_perf-0.3.0/native/runtime/lib/Native/NativeArgumentParser.cpp +64 -0
  13. compilersutra_perf-0.3.0/native/runtime/lib/Native/NativeRunner.cpp +51 -0
  14. compilersutra_perf-0.3.0/native/runtime/lib/Native/PapiCounters.cpp +226 -0
  15. compilersutra_perf-0.3.0/native/runtime/lib/OpenCL/OpenCLApplication.cpp +82 -0
  16. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/OpenCL/OpenCLArgumentParser.cpp +4 -0
  17. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/OpenCL/OpenCLKernelExecutor.cpp +99 -42
  18. compilersutra_perf-0.3.0/native/runtime/lib/Runtime/Process.cpp +299 -0
  19. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/Vulkan/VulkanDeviceCatalog.cpp +28 -2
  20. compilersutra_perf-0.3.0/pyproject.toml +159 -0
  21. compilersutra_perf-0.3.0/setup.py +123 -0
  22. compilersutra_perf-0.3.0/src/compilersutra_perf.egg-info/PKG-INFO +340 -0
  23. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/compilersutra_perf.egg-info/SOURCES.txt +107 -1
  24. compilersutra_perf-0.3.0/src/compilersutra_perf.egg-info/entry_points.txt +5 -0
  25. compilersutra_perf-0.3.0/src/compilersutra_perf.egg-info/requires.txt +39 -0
  26. compilersutra_perf-0.3.0/src/csperf/__init__.py +38 -0
  27. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/backends/__init__.py +0 -1
  28. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/backends/base.py +1 -1
  29. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/backends/cpu.py +0 -2
  30. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/backends/gpu.py +7 -6
  31. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/backends/registry.py +25 -3
  32. compilersutra_perf-0.3.0/src/csperf/cli.py +1677 -0
  33. compilersutra_perf-0.3.0/src/csperf/cli_output.py +627 -0
  34. compilersutra_perf-0.3.0/src/csperf/config.py +147 -0
  35. compilersutra_perf-0.3.0/src/csperf/dashboard_app.py +228 -0
  36. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/detector.py +2 -2
  37. compilersutra_perf-0.3.0/src/csperf/doctor.py +423 -0
  38. compilersutra_perf-0.3.0/src/csperf/energy/__init__.py +31 -0
  39. compilersutra_perf-0.3.0/src/csperf/energy/backends/__init__.py +4 -0
  40. compilersutra_perf-0.3.0/src/csperf/energy/backends/amd_cpu.py +134 -0
  41. compilersutra_perf-0.3.0/src/csperf/energy/backends/amd_gpu.py +116 -0
  42. compilersutra_perf-0.3.0/src/csperf/energy/backends/macos_cpu.py +73 -0
  43. compilersutra_perf-0.3.0/src/csperf/energy/backends/stubs.py +73 -0
  44. compilersutra_perf-0.3.0/src/csperf/energy/base.py +81 -0
  45. compilersutra_perf-0.3.0/src/csperf/energy/manager.py +272 -0
  46. compilersutra_perf-0.3.0/src/csperf/energy/orchestrate.py +83 -0
  47. compilersutra_perf-0.3.0/src/csperf/energy/parsing.py +239 -0
  48. compilersutra_perf-0.3.0/src/csperf/energy/registry.py +84 -0
  49. compilersutra_perf-0.3.0/src/csperf/energy/result.py +60 -0
  50. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/execution/__init__.py +23 -3
  51. compilersutra_perf-0.3.0/src/csperf/execution/base.py +58 -0
  52. compilersutra_perf-0.3.0/src/csperf/execution/build.py +221 -0
  53. compilersutra_perf-0.3.0/src/csperf/execution/compile_flags.py +73 -0
  54. compilersutra_perf-0.3.0/src/csperf/execution/cpu.py +835 -0
  55. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/execution/gpu.py +12 -3
  56. compilersutra_perf-0.3.0/src/csperf/execution/hip.py +384 -0
  57. compilersutra_perf-0.3.0/src/csperf/execution/opencl.py +194 -0
  58. compilersutra_perf-0.3.0/src/csperf/execution/qemu_user.py +269 -0
  59. compilersutra_perf-0.3.0/src/csperf/execution/runners.py +920 -0
  60. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/execution/utils.py +58 -2
  61. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/execution/vulkan.py +77 -8
  62. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/experiments/__init__.py +9 -0
  63. compilersutra_perf-0.3.0/src/csperf/experiments/apply.py +80 -0
  64. compilersutra_perf-0.3.0/src/csperf/experiments/registry.py +94 -0
  65. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/hardware.py +89 -19
  66. compilersutra_perf-0.3.0/src/csperf/integration/__init__.py +5 -0
  67. compilersutra_perf-0.3.0/src/csperf/integration/csrun.py +603 -0
  68. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/lit/__init__.py +6 -1
  69. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/lit/runner.py +70 -14
  70. compilersutra_perf-0.3.0/src/csperf/models.py +104 -0
  71. compilersutra_perf-0.3.0/src/csperf/optimize_diff.py +267 -0
  72. compilersutra_perf-0.3.0/src/csperf/perf_env.py +49 -0
  73. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/pipelines/__init__.py +0 -1
  74. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/pipelines/base.py +0 -1
  75. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/pipelines/factory.py +15 -9
  76. compilersutra_perf-0.3.0/src/csperf/plugins/__init__.py +44 -0
  77. compilersutra_perf-0.3.0/src/csperf/plugins/contracts.py +88 -0
  78. compilersutra_perf-0.3.0/src/csperf/plugins/loader.py +68 -0
  79. compilersutra_perf-0.3.0/src/csperf/plugins/toolchains.py +95 -0
  80. compilersutra_perf-0.3.0/src/csperf/plugins/visualizers.py +66 -0
  81. compilersutra_perf-0.3.0/src/csperf/power/__init__.py +33 -0
  82. compilersutra_perf-0.3.0/src/csperf/power/collect.py +106 -0
  83. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/profile_summary.py +371 -58
  84. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/profiler/base.py +6 -1
  85. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/profiler/cpu/__init__.py +58 -4
  86. compilersutra_perf-0.3.0/src/csperf/profiler/cpu/affinity.py +23 -0
  87. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/profiler/cpu/base.py +8 -2
  88. compilersutra_perf-0.3.0/src/csperf/profiler/cpu/collectors/__init__.py +33 -0
  89. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/profiler/cpu/collectors/base.py +1 -1
  90. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/profiler/cpu/collectors/linux.py +32 -25
  91. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/profiler/cpu/collectors/macos.py +97 -23
  92. compilersutra_perf-0.3.0/src/csperf/profiler/cpu/collectors/papi.py +113 -0
  93. compilersutra_perf-0.3.0/src/csperf/profiler/cpu/collectors/registry.py +143 -0
  94. compilersutra_perf-0.3.0/src/csperf/profiler/cpu/factory.py +43 -0
  95. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/profiler/cpu/metrics/__init__.py +19 -2
  96. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/profiler/cpu/metrics/definitions.py +15 -2
  97. compilersutra_perf-0.3.0/src/csperf/profiler/cpu/metrics/events.py +72 -0
  98. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/profiler/cpu/metrics/mapping.py +15 -0
  99. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/profiler/cpu/metrics/registry.py +1 -1
  100. compilersutra_perf-0.3.0/src/csperf/profiler/cpu/papi_support.py +177 -0
  101. compilersutra_perf-0.3.0/src/csperf/profiler/gpu.py +94 -0
  102. compilersutra_perf-0.3.0/src/csperf/provenance.py +230 -0
  103. compilersutra_perf-0.3.0/src/csperf/quickstart.py +156 -0
  104. compilersutra_perf-0.3.0/src/csperf/report/__init__.py +6 -0
  105. compilersutra_perf-0.3.0/src/csperf/report/build.py +74 -0
  106. compilersutra_perf-0.3.0/src/csperf/report/charts.py +89 -0
  107. compilersutra_perf-0.3.0/src/csperf/report/comparison.py +420 -0
  108. compilersutra_perf-0.3.0/src/csperf/report/components.py +118 -0
  109. compilersutra_perf-0.3.0/src/csperf/report/constants.py +54 -0
  110. compilersutra_perf-0.3.0/src/csperf/report/export.py +39 -0
  111. compilersutra_perf-0.3.0/src/csperf/report/exporters/__init__.py +15 -0
  112. compilersutra_perf-0.3.0/src/csperf/report/exporters/html.py +31 -0
  113. compilersutra_perf-0.3.0/src/csperf/report/exporters/pdf.py +42 -0
  114. compilersutra_perf-0.3.0/src/csperf/report/formatting.py +149 -0
  115. compilersutra_perf-0.3.0/src/csperf/report/model.py +38 -0
  116. compilersutra_perf-0.3.0/src/csperf/report/quality.py +127 -0
  117. compilersutra_perf-0.3.0/src/csperf/report/registry.py +106 -0
  118. compilersutra_perf-0.3.0/src/csperf/report/render.py +8 -0
  119. compilersutra_perf-0.3.0/src/csperf/report/reproduction.py +224 -0
  120. compilersutra_perf-0.3.0/src/csperf/report/sections.py +550 -0
  121. compilersutra_perf-0.3.0/src/csperf/report/sections_plugins.py +68 -0
  122. compilersutra_perf-0.3.0/src/csperf/report/template.py +206 -0
  123. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/results.py +160 -18
  124. compilersutra_perf-0.3.0/src/csperf/runner_meta.py +189 -0
  125. compilersutra_perf-0.3.0/src/csperf/schema_export.py +141 -0
  126. compilersutra_perf-0.3.0/src/csperf/toolutils.py +27 -0
  127. compilersutra_perf-0.1.2/src/csperf/__init__.py → compilersutra_perf-0.3.0/src/csperf/visualize.py +3 -2
  128. compilersutra_perf-0.3.0/tests/test_backend_runners.py +59 -0
  129. compilersutra_perf-0.3.0/tests/test_bundled_runners.py +165 -0
  130. compilersutra_perf-0.3.0/tests/test_cli_functional.py +423 -0
  131. compilersutra_perf-0.3.0/tests/test_cli_helpers.py +131 -0
  132. compilersutra_perf-0.3.0/tests/test_cli_output.py +220 -0
  133. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/tests/test_cli_smoke.py +320 -25
  134. compilersutra_perf-0.3.0/tests/test_collector_registry.py +82 -0
  135. compilersutra_perf-0.3.0/tests/test_compile_flags.py +38 -0
  136. compilersutra_perf-0.3.0/tests/test_cpu_affinity_collect.py +46 -0
  137. compilersutra_perf-0.3.0/tests/test_cpu_arena.py +86 -0
  138. compilersutra_perf-0.3.0/tests/test_cpu_measurement.py +244 -0
  139. compilersutra_perf-0.3.0/tests/test_cross_platform_matrix.py +67 -0
  140. compilersutra_perf-0.3.0/tests/test_csrun_integration.py +495 -0
  141. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/tests/test_detector.py +0 -1
  142. compilersutra_perf-0.3.0/tests/test_diff_profiler_warnings.py +29 -0
  143. compilersutra_perf-0.3.0/tests/test_diff_significance.py +181 -0
  144. compilersutra_perf-0.3.0/tests/test_doctor.py +329 -0
  145. compilersutra_perf-0.3.0/tests/test_energy_framework.py +175 -0
  146. compilersutra_perf-0.3.0/tests/test_experiments_apply.py +39 -0
  147. compilersutra_perf-0.3.0/tests/test_hip_mocked.py +435 -0
  148. compilersutra_perf-0.3.0/tests/test_issue51_validation.py +79 -0
  149. compilersutra_perf-0.3.0/tests/test_lit_runner.py +89 -0
  150. compilersutra_perf-0.3.0/tests/test_macos_collector.py +72 -0
  151. compilersutra_perf-0.3.0/tests/test_measurement_validity.py +243 -0
  152. compilersutra_perf-0.3.0/tests/test_milestone3_gaps.py +120 -0
  153. compilersutra_perf-0.3.0/tests/test_milestone_reliability.py +122 -0
  154. compilersutra_perf-0.3.0/tests/test_opencl_inference.py +142 -0
  155. compilersutra_perf-0.3.0/tests/test_opencl_measure.py +142 -0
  156. compilersutra_perf-0.3.0/tests/test_optimize_diff.py +185 -0
  157. compilersutra_perf-0.3.0/tests/test_papi_collector.py +204 -0
  158. compilersutra_perf-0.3.0/tests/test_papi_fallback.py +449 -0
  159. compilersutra_perf-0.3.0/tests/test_papi_native.py +213 -0
  160. compilersutra_perf-0.3.0/tests/test_papi_support.py +101 -0
  161. compilersutra_perf-0.3.0/tests/test_perf_env.py +41 -0
  162. compilersutra_perf-0.3.0/tests/test_perf_events.py +43 -0
  163. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/tests/test_perf_fallback.py +18 -1
  164. compilersutra_perf-0.3.0/tests/test_plugins_loader.py +109 -0
  165. compilersutra_perf-0.3.0/tests/test_power_collect.py +109 -0
  166. compilersutra_perf-0.3.0/tests/test_process_timeout.py +53 -0
  167. compilersutra_perf-0.3.0/tests/test_profile_summary_security.py +28 -0
  168. compilersutra_perf-0.3.0/tests/test_provenance.py +147 -0
  169. compilersutra_perf-0.3.0/tests/test_qemu_user_riscv.py +66 -0
  170. compilersutra_perf-0.3.0/tests/test_quickstart.py +78 -0
  171. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/tests/test_registry.py +0 -1
  172. compilersutra_perf-0.3.0/tests/test_report_components.py +13 -0
  173. compilersutra_perf-0.3.0/tests/test_report_export.py +75 -0
  174. compilersutra_perf-0.3.0/tests/test_report_reproduction.py +103 -0
  175. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/tests/test_results_csv.py +91 -0
  176. compilersutra_perf-0.3.0/tests/test_runner_meta.py +77 -0
  177. compilersutra_perf-0.3.0/tests/test_toolutils.py +38 -0
  178. compilersutra_perf-0.3.0/tests/test_visualize.py +134 -0
  179. compilersutra_perf-0.3.0/tests/test_vulkaninfo_parse.py +25 -0
  180. compilersutra_perf-0.3.0/tests/test_workload_manifest.py +152 -0
  181. compilersutra_perf-0.1.2/NOTICE +0 -7
  182. compilersutra_perf-0.1.2/PKG-INFO +0 -651
  183. compilersutra_perf-0.1.2/README.md +0 -606
  184. compilersutra_perf-0.1.2/native/runtime/lib/Native/NativeArgumentParser.cpp +0 -30
  185. compilersutra_perf-0.1.2/native/runtime/lib/Native/NativeRunner.cpp +0 -16
  186. compilersutra_perf-0.1.2/native/runtime/lib/OpenCL/OpenCLApplication.cpp +0 -57
  187. compilersutra_perf-0.1.2/native/runtime/lib/Runtime/Process.cpp +0 -133
  188. compilersutra_perf-0.1.2/pyproject.toml +0 -74
  189. compilersutra_perf-0.1.2/setup.py +0 -22
  190. compilersutra_perf-0.1.2/src/compilersutra_perf.egg-info/PKG-INFO +0 -651
  191. compilersutra_perf-0.1.2/src/compilersutra_perf.egg-info/entry_points.txt +0 -2
  192. compilersutra_perf-0.1.2/src/compilersutra_perf.egg-info/requires.txt +0 -21
  193. compilersutra_perf-0.1.2/src/csperf/cli.py +0 -706
  194. compilersutra_perf-0.1.2/src/csperf/cli_output.py +0 -246
  195. compilersutra_perf-0.1.2/src/csperf/config.py +0 -67
  196. compilersutra_perf-0.1.2/src/csperf/dashboard_app.py +0 -118
  197. compilersutra_perf-0.1.2/src/csperf/execution/base.py +0 -23
  198. compilersutra_perf-0.1.2/src/csperf/execution/build.py +0 -110
  199. compilersutra_perf-0.1.2/src/csperf/execution/cpu.py +0 -289
  200. compilersutra_perf-0.1.2/src/csperf/execution/hip.py +0 -246
  201. compilersutra_perf-0.1.2/src/csperf/execution/opencl.py +0 -182
  202. compilersutra_perf-0.1.2/src/csperf/experiments/registry.py +0 -47
  203. compilersutra_perf-0.1.2/src/csperf/models.py +0 -50
  204. compilersutra_perf-0.1.2/src/csperf/profiler/cpu/collectors/__init__.py +0 -13
  205. compilersutra_perf-0.1.2/src/csperf/profiler/cpu/factory.py +0 -34
  206. compilersutra_perf-0.1.2/src/csperf/visualize.py +0 -208
  207. compilersutra_perf-0.1.2/tests/test_cli_output.py +0 -109
  208. compilersutra_perf-0.1.2/tests/test_lit_runner.py +0 -44
  209. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/CMakeLists.txt +0 -0
  210. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/LICENSE +0 -0
  211. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/MANIFEST.in +0 -0
  212. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/native/NativeApplication.hpp +0 -0
  213. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/native/NativeArgumentParser.hpp +0 -0
  214. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/opencl/OpenCLApplication.hpp +0 -0
  215. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/opencl/OpenCLArgumentParser.hpp +0 -0
  216. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/opencl/OpenCLDeviceCatalog.hpp +0 -0
  217. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/opencl/OpenCLDevicePolicy.hpp +0 -0
  218. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/opencl/OpenCLKernelExecutor.hpp +0 -0
  219. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/opencl/OpenCLSupport.hpp +0 -0
  220. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/runtime/Application.hpp +0 -0
  221. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/support/Debug.hpp +0 -0
  222. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/support/JSON.hpp +0 -0
  223. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/vulkan/VulkanApplication.hpp +0 -0
  224. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/vulkan/VulkanArgumentParser.hpp +0 -0
  225. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/vulkan/VulkanDevicePolicy.hpp +0 -0
  226. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/vulkan/VulkanLibraryPolicy.hpp +0 -0
  227. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/vulkan/VulkanLoader.hpp +0 -0
  228. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/vulkan/VulkanOptions.hpp +0 -0
  229. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/vulkan/VulkanQueueFamilyPolicy.hpp +0 -0
  230. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/vulkan/VulkanShaderValidator.hpp +0 -0
  231. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/csperf/vulkan/VulkanSupport.hpp +0 -0
  232. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/include/runtime.h +0 -0
  233. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/OpenCL/OpenCLDeviceCatalog.cpp +0 -0
  234. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/OpenCL/OpenCLDevicePolicy.cpp +0 -0
  235. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/OpenCL/OpenCLSupport.cpp +0 -0
  236. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/Runtime/Application.cpp +0 -0
  237. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/Runtime/RuntimeInfo.cpp +0 -0
  238. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/Support/JSON.cpp +0 -0
  239. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/Vulkan/VulkanApplication.cpp +0 -0
  240. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/Vulkan/VulkanArgumentParser.cpp +0 -0
  241. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/Vulkan/VulkanDevicePolicy.cpp +0 -0
  242. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/Vulkan/VulkanLibraryPolicy.cpp +0 -0
  243. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/Vulkan/VulkanLoader.cpp +0 -0
  244. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/Vulkan/VulkanQueueFamilyPolicy.cpp +0 -0
  245. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/Vulkan/VulkanShaderValidator.cpp +0 -0
  246. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/lib/Vulkan/VulkanSupport.cpp +0 -0
  247. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/tools/csperf-native-runner/main.cpp +0 -0
  248. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/tools/csperf-opencl-runner/main.cpp +0 -0
  249. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/native/runtime/tools/csperf-vulkan-runner/main.cpp +0 -0
  250. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/setup.cfg +0 -0
  251. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/compilersutra_perf.egg-info/dependency_links.txt +0 -0
  252. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/compilersutra_perf.egg-info/top_level.txt +0 -0
  253. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/profiler/__init__.py +0 -0
  254. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/profiler/cpu/detectors/__init__.py +0 -0
  255. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/profiler/cpu/detectors/architecture.py +0 -0
  256. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/profiler/cpu/detectors/platform.py +0 -0
  257. {compilersutra_perf-0.1.2 → compilersutra_perf-0.3.0}/src/csperf/profiler/cpu/detectors/vendor.py +0 -0
@@ -0,0 +1,20 @@
1
+ CompilerSutraPerfTool
2
+ Copyright 2026 CompilerSutraPerfTool
3
+
4
+ Maintained by Priya Pandey | CompilerSutra
5
+ Website: https://compilersutra.com
6
+ LinkedIn: https://www.linkedin.com/in/priya-pandey-54a5a22aa/
7
+ LinkedIn: https://www.linkedin.com/company/compilersutra/
8
+
9
+ Third-party components:
10
+
11
+ - PAPI (Performance Application Programming Interface)
12
+ https://icl.utk.edu/papi/
13
+ Used as an optional system dependency for CPU hardware counters; never
14
+ vendored or bundled in this repository. PAPI core is BSD-3-Clause
15
+ (https://raw.githubusercontent.com/icl-utk-edu/papi/master/LICENSE.txt).
16
+ When distributing binaries that link against libPAPI, include the PAPI
17
+ BSD-3-Clause license text alongside this notice. The native runner
18
+ (`csperf_native_runner`) links libPAPI only when configured with
19
+ `-DCSPERF_ENABLE_PAPI=ON`; without that option it is built PAPI-free and
20
+ reports `papi_not_built` for `--papi` runs.
@@ -0,0 +1,340 @@
1
+ Metadata-Version: 2.4
2
+ Name: compilersutra-perf
3
+ Version: 0.3.0
4
+ Summary: Alpha CLI for compiler and GPU performance experiments — compile, profile, diff, and export JSON/CSV results
5
+ Author-email: Priya Pandey <osc@compilersutra.com>, CompilerSutra <osc@compilersutra.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://www.compilersutra.com
8
+ Project-URL: Documentation, https://www.compilersutra.com/docs/project/compilersutra-perf/getting-started/
9
+ Project-URL: Author, https://www.linkedin.com/in/priya-pandey-54a5a22aa/
10
+ Keywords: benchmarking,compiler,gpu,hip,llvm,opencl,performance,profiling,systems,vulkan
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Scientific/Engineering
20
+ Classifier: Topic :: Software Development :: Compilers
21
+ Classifier: Topic :: System :: Benchmark
22
+ Classifier: Topic :: System :: Hardware
23
+ Classifier: Topic :: System :: Systems Administration
24
+ Requires-Python: >=3.11
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ License-File: NOTICE
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=9.0.3; extra == "dev"
30
+ Requires-Dist: pytest-cov>=5.0; extra == "dev"
31
+ Requires-Dist: coverage[toml]>=7.6; extra == "dev"
32
+ Requires-Dist: ruff>=0.9; extra == "dev"
33
+ Requires-Dist: mypy>=1.13; extra == "dev"
34
+ Requires-Dist: bandit>=1.8; extra == "dev"
35
+ Requires-Dist: pip-audit>=2.7; extra == "dev"
36
+ Requires-Dist: urllib3>=2.7; extra == "dev"
37
+ Requires-Dist: click>=8.3.3; extra == "dev"
38
+ Requires-Dist: cryptography>=50.0.0; extra == "dev"
39
+ Requires-Dist: GitPython>=3.1.59; extra == "dev"
40
+ Requires-Dist: idna>=3.15; extra == "dev"
41
+ Requires-Dist: Pillow>=12.3.0; extra == "dev"
42
+ Requires-Dist: Pygments>=2.20.0; extra == "dev"
43
+ Requires-Dist: requests>=2.33.0; extra == "dev"
44
+ Requires-Dist: tornado>=6.5.8; extra == "dev"
45
+ Provides-Extra: excel
46
+ Requires-Dist: openpyxl>=3.1; extra == "excel"
47
+ Provides-Extra: visualize
48
+ Requires-Dist: streamlit>=1.33; extra == "visualize"
49
+ Requires-Dist: plotly>=5.20; extra == "visualize"
50
+ Provides-Extra: pdf
51
+ Requires-Dist: weasyprint>=70.0; extra == "pdf"
52
+ Provides-Extra: track
53
+ Requires-Dist: mlflow>=2.11; extra == "track"
54
+ Provides-Extra: tune
55
+ Requires-Dist: optuna>=3.5; extra == "tune"
56
+ Requires-Dist: nevergrad>=1.0.5; extra == "tune"
57
+ Provides-Extra: distributed
58
+ Requires-Dist: ray>=2.10; extra == "distributed"
59
+ Requires-Dist: dask>=2024.3.1; extra == "distributed"
60
+ Dynamic: license-file
61
+
62
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
63
+ <!-- Copyright (c) 2026 CompilerSutraPerfTool -->
64
+ <!-- Author: Priya Pandey | https://www.linkedin.com/in/priya-pandey-54a5a22aa/ | CompilerSutra | https://www.linkedin.com/company/compilersutra/ | https://compilersutra.com -->
65
+
66
+ # CompilerSutraPerfTool
67
+
68
+ **Alpha** performance experimentation for C/C++ programs and GPU kernels (OpenCL, HIP, Vulkan shaders).
69
+
70
+ Compile, run, profile, compare, and export structured JSON/CSV/XLSX artifacts — from the CLI or `pip install compilersutra-perf`.
71
+
72
+ **Status:** Alpha MVP (0.2.0). Suitable for local experimentation; not yet validated for production CI regression gates. See [limitations](#limitations) and [docs/METHODOLOGY.md](docs/METHODOLOGY.md).
73
+
74
+ **Research goal:** a unified CPU/GPU hardware & compiler observatory layer — orchestrate existing toolchains, normalize results, and keep static vs measured evidence honest. See [docs/OBSERVATORY.md](docs/OBSERVATORY.md).
75
+
76
+ ---
77
+
78
+ ## Install
79
+
80
+ ```bash
81
+ pip install compilersutra-perf
82
+ ```
83
+
84
+ Optional extras:
85
+
86
+ ```bash
87
+ pip install 'compilersutra-perf[visualize]' # HTML reports + Streamlit dashboard
88
+ pip install 'compilersutra-perf[excel]' # XLSX result workbooks
89
+ pip install 'compilersutra-perf[pdf]' # PDF reports (WeasyPrint)
90
+ pip install 'compilersutra-perf[dev]' # pytest
91
+ ```
92
+
93
+ **Requirements:** Python 3.11+. Linux wheels ship prebuilt native runners for CPU (and Vulkan, where available), so CPU workloads run out of the box. Other platforms (or exotic Python builds) fall back to building the runner on demand, which needs a C/C++ toolchain and `cmake` on `PATH`; `perf` is also recommended for full CPU profiling on Linux. GPU backends need their respective runtimes (ROCm, OpenCL, Vulkan) installed separately.
94
+
95
+ **Platform wheels and old distributions:** release wheels use a `manylinux` tag (e.g. `manylinux_2_39_x86_64`) for the glibc they were built on, so a wheel built on Ubuntu 24.04 may fail to load its bundled runner on Ubuntu 22.04 or older (newer glibc). The loader probes the bundled runner at startup and automatically falls back to an on-demand local build, so only an older toolchain is needed there. Hardware counter events are probed per-CPU, so vendor-specific events never break collection on other vendors (Intel vs AMD).
96
+
97
+ **Native Windows:** not yet supported. The runner uses POSIX APIs (`fork`, `sched_setaffinity`) and won't build on Windows natively — use [WSL2](docs/WINDOWS_WSL2.md). Result artifacts (JSON/CSV/XLSX/HTML reports) open fine on Windows.
98
+
99
+ Check that every system tool csperf needs is present, and install whatever is missing:
100
+
101
+ ```bash
102
+ csperf quickstart --output-dir results/quickstart # doctor + example + report
103
+ csperf doctor # report missing tools; exit 1 if a required tool is missing
104
+ csperf doctor --install # install missing required tools (apt/dnf/pacman/apk/brew)
105
+ csperf doctor --install --all # also install optional GPU/profiling tools
106
+ ```
107
+
108
+ See [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) for perf, energy, and GPU fixes.
109
+
110
+ Develop from source (private checkout if you have access):
111
+
112
+ ```bash
113
+ cd CompilerSutraPerfTool
114
+ python3 -m venv .venv && source .venv/bin/activate
115
+ pip install -e '.[dev]'
116
+ # Native runners are compiled on demand at first run; build them explicitly with:
117
+ cmake -S native/runtime -B build/native && cmake --build build/native
118
+ ```
119
+
120
+ To produce a platform wheel that embeds prebuilt runners (used by the release pipeline):
121
+
122
+ ```bash
123
+ CSPERF_BUNDLE_NATIVE=1 python -m build --wheel
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Quick start
129
+
130
+ ```bash
131
+ csperf list-backends
132
+ csperf quickstart --output-dir results/quickstart
133
+ csperf list-energy-backends
134
+ csperf run --input examples/cpp/matrix_traversal.cpp --backend cpu \
135
+ --warmup-runs 1 --repeat-runs 3 --output results/cpu.json
136
+ csperf profile results/cpu.json
137
+ csperf diff results/run-a.json results/run-b.json --csv results/compare.csv
138
+ # Auto-compare -O0 / -O1 / -O2 / -O3 runtimes (writes results/optimize/ + comparison report):
139
+ csperf run --input examples/cpp/matrix_traversal.cpp --diff-optimize --no-perf --report-format both
140
+ # Energy (Linux RAPL / AMD GPU when available):
141
+ csperf run --input examples/cpp/matrix_traversal.cpp --backend cpu \
142
+ --energy-backend amd-cpu --output results/cpu-energy.json
143
+ ```
144
+
145
+ Each `run` writes `results/<name>.json`, `.csv`, and `.xlsx` (when `openpyxl` is installed).
146
+
147
+ ---
148
+
149
+ ## Backends
150
+
151
+ | Backend | Status | Notes |
152
+ | --- | --- | --- |
153
+ | **CPU** | Execute + profile | Native C++ runner, LLVM IR (clang), Linux `perf` counters, warmup/repeat, optional `--cpu-affinity` |
154
+ | **HIP** | Execute + profile | `hipcc` compile-and-run, ROCm devices, `rocprofv3` (then v2/v1) |
155
+ | **OpenCL** | Execute | Native kernel launch, device selection, warmup/repeat |
156
+ | **Vulkan** | Execute via csrun / validate | Prefer CompilerSutraRun YAML execute (`CSRUN_BIN`); else GLSL → SPIR-V + module validation |
157
+ | **`gpu` alias** | Auto-route | `.hip` → HIP, `.cl` → OpenCL, shaders → Vulkan |
158
+ | **CUDA / Metal** | Planned | Listed in registry but not executable |
159
+ | **macOS CPU** | Experimental | Execution works; profiling uses `powermetrics` (needs passwordless `sudo`) |
160
+
161
+ ---
162
+
163
+ ## Compiler selection and flags
164
+
165
+ Use `--compiler` to select the compiler explicitly, or select the toolchain with environment variables; pass optimization and language flags with `--compiler-flag`.
166
+
167
+ ### Choose compiler (CPU)
168
+
169
+ ```bash
170
+ # Default: clang / clang++
171
+ csperf run --input program.cpp --backend cpu --output results/clang.json
172
+
173
+ # GCC
174
+ CC=gcc CXX=g++ csperf run --input program.cpp --backend cpu --output results/gcc.json
175
+
176
+ # Explicit compiler override env vars (highest priority after CXX_COMPILER)
177
+ CXX=g++-13 csperf run --input program.cpp --backend cpu --output results/gpp13.json
178
+ ```
179
+
180
+ Resolution order: `CXX_COMPILER` / `C_COMPILER` → `CXX` / `CC` → default (`clang++` / `clang`).
181
+
182
+ HIP always uses `hipcc` when available.
183
+
184
+ ### Add compiler flags
185
+
186
+ Repeat `--compiler-flag` for each option. `-O3` is added by default unless you pass another `-O*` flag (for example `--compiler-flag=-O0`):
187
+
188
+ ```bash
189
+ csperf run --input program.cpp --backend cpu \
190
+ --compiler-flag=-march=native \
191
+ --compiler-flag=-funroll-loops \
192
+ --compiler-flag=-fopenmp \
193
+ --output results/optimized.json
194
+
195
+ csperf run --input program.cpp --compiler-flag=-std=c++20 --output results/cpp20.json
196
+ ```
197
+
198
+ `CXXFLAGS` / `CFLAGS` are **not** read — pass flags explicitly.
199
+
200
+ ### Compare two compilers (batch)
201
+
202
+ For a folder of `.c`/`.cpp` files, use the batch script with JSON compiler configs:
203
+
204
+ ```bash
205
+ python scripts/compiler_diff_batch.py examples/cpp \
206
+ --config1 configs/compiler_gcc.sample.json \
207
+ --config2 configs/compiler_clang.sample.json
208
+ ```
209
+
210
+ Sample config (`configs/compiler_gcc.sample.json`):
211
+
212
+ ```json
213
+ {
214
+ "compiler_family": "gcc",
215
+ "cc": "gcc",
216
+ "cxx": "g++",
217
+ "compiler_flags": ["-O3", "-march=native"]
218
+ }
219
+ ```
220
+
221
+ Outputs: per-file JSON/CSV diffs, `summary.csv`, and `summary.xlsx`.
222
+
223
+ ### Compare two saved runs
224
+
225
+ ```bash
226
+ csperf diff results/gcc.json results/clang.json \
227
+ --csv results/gcc-vs-clang.csv \
228
+ --derived-config configs/derived_metrics.sample.json
229
+ ```
230
+
231
+ ---
232
+
233
+ ## Common run options
234
+
235
+ | Flag | Purpose |
236
+ | --- | --- |
237
+ | `--warmup-runs N` | Warmup iterations before measurement (default `3`) |
238
+ | `--repeat-runs N` | Measured trials with summary stats (default `15`) |
239
+ | `--no-perf` | Skip hardware counter collection |
240
+ | `--plan-only` | Print compile/run commands without executing |
241
+ | `--build-dir PATH` | Output directory for binary and IR |
242
+ | `--cpu-affinity 0,1` | Pin CPU execution (Linux) |
243
+ | `--device-index N` | GPU device for HIP / OpenCL / Vulkan |
244
+ | `--backend gpu` | Auto-select GPU backend from file type |
245
+ | `--compiler=PATH` | Select the CPU compiler binary |
246
+ | `--compiler-flag=FLAG` | Append compile flag (repeatable) |
247
+ | `--program-arg ARG` | Pass an argument to the workload (repeatable) |
248
+ | `--stdin-file PATH` | Provide workload stdin |
249
+ | `--execution-timeout SECONDS` | Bound each workload execution |
250
+ | `--diff-optimize` | Run `-O0`…`-O3`, write per-level results and runtime comparison |
251
+ | `--energy` / `--no-energy` | Enable or disable energy measurement (on by default when backends exist) |
252
+ | `--energy-backend KEY` | Select backends (`auto`, `amd-cpu`, `amd-gpu`, …); see `list-energy-backends` |
253
+ | `--json` | Machine-readable stdout |
254
+ | `--version` | Print package version |
255
+
256
+ OpenCL kernel arguments:
257
+
258
+ ```bash
259
+ csperf run --input examples/opencl/saxpy.cl --backend opencl --device-index 0 \
260
+ --kernel-name saxpy \
261
+ --kernel-arg buffer:float:read:4096:1.0 \
262
+ --kernel-arg scalar:uint32:4096 \
263
+ --readback-arg 2
264
+ ```
265
+
266
+ Inspect planned commands:
267
+
268
+ ```bash
269
+ csperf run --input program.cpp --plan-only
270
+ ```
271
+
272
+ ---
273
+
274
+ ## Results and visualization
275
+
276
+ Artifacts per run:
277
+
278
+ - **JSON** — full structured result (metrics, execution with `host_platform` and `metrics_availability`, hardware, diagnostics)
279
+ - **CSV** — sectioned spreadsheet-friendly report with dotted metric paths and units
280
+ - **XLSX** — Results + Metadata sheets (requires `[excel]` extra)
281
+
282
+ ```bash
283
+ csperf profile results/cpu.json
284
+ csperf visualize results/cpu.json results/gpu.json --output report.html
285
+ csperf visualize results/cpu.json --format pdf --output report.pdf
286
+ csperf visualize results/cpu.json --format both --output report
287
+ csperf list-report-formats
288
+ pip install 'compilersutra-perf[visualize]' && csperf dashboard results/cpu.json
289
+ ```
290
+
291
+ Energy and power domains appear in the HTML/PDF report when the run collected a `power` block. See [docs/ENERGY.md](docs/ENERGY.md) and [docs/REPORT.md](docs/REPORT.md).
292
+
293
+ Failed runs exit non-zero (`1`) and include actionable hints when tooling is missing. See [exit codes](docs/USAGE.md#exit-codes) in USAGE.
294
+
295
+ ---
296
+
297
+ ## Limitations
298
+
299
+ Read these before trusting numbers in papers or CI:
300
+
301
+ - **Alpha** — methodology and backend coverage are still evolving.
302
+ - CPU runs support `--execution-timeout` to bound workload execution.
303
+ - CPU runs support repeated `--program-arg` values and `--stdin-file`; manifests can define the same settings.
304
+ - **`--experiment` / `--opt-config`** — apply compile macros and optional extra flags; plugin entry points remain planned for 0.3.0.
305
+ - Optional extras `track`, `tune`, and `distributed` are reserved for later releases and are not wired into the CLI.
306
+ - **OpenCL** — program may recompile each trial; interpret kernel times carefully.
307
+ - **CUDA / Metal** — not implemented despite registry entries.
308
+ - **Native runners** — Linux wheels bundle prebuilt native runners; other platforms build on demand from the bundled sources (needs a C/C++ toolchain and `cmake`).
309
+
310
+ Best supported today: **Linux CPU** compile/run/profile with `perf` configured, plus HIP/OpenCL exploration with manual interpretation.
311
+
312
+ ---
313
+
314
+ ## Documentation
315
+
316
+ Public getting started guide:
317
+
318
+ https://www.compilersutra.com/docs/project/compilersutra-perf/getting-started/
319
+
320
+ In-tree guides (source checkout):
321
+
322
+ | Doc | Topic |
323
+ | --- | --- |
324
+ | [docs/GETTING_STARTED.md](docs/GETTING_STARTED.md) | First workload |
325
+ | [docs/USAGE.md](docs/USAGE.md) | CLI reference |
326
+ | [docs/ENERGY.md](docs/ENERGY.md) | Energy / power backends |
327
+ | [docs/REPORT.md](docs/REPORT.md) | Modular HTML/PDF reports |
328
+ | [docs/METHODOLOGY.md](docs/METHODOLOGY.md) | What metrics mean and platform caveats |
329
+ | [docs/TESTING.md](docs/TESTING.md) | Validation |
330
+ | [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) | Design |
331
+ | [CONTRIBUTING.md](CONTRIBUTING.md) | Contributions |
332
+ | [CHANGELOG.md](CHANGELOG.md) | Release notes |
333
+
334
+ ---
335
+
336
+ ## License
337
+
338
+ Apache License 2.0 — see [LICENSE](LICENSE).
339
+
340
+ **Author:** [Priya Pandey](https://www.linkedin.com/in/priya-pandey-54a5a22aa/) · [CompilerSutra](https://compilersutra.com)
@@ -0,0 +1,279 @@
1
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
2
+ <!-- Copyright (c) 2026 CompilerSutraPerfTool -->
3
+ <!-- Author: Priya Pandey | https://www.linkedin.com/in/priya-pandey-54a5a22aa/ | CompilerSutra | https://www.linkedin.com/company/compilersutra/ | https://compilersutra.com -->
4
+
5
+ # CompilerSutraPerfTool
6
+
7
+ **Alpha** performance experimentation for C/C++ programs and GPU kernels (OpenCL, HIP, Vulkan shaders).
8
+
9
+ Compile, run, profile, compare, and export structured JSON/CSV/XLSX artifacts — from the CLI or `pip install compilersutra-perf`.
10
+
11
+ **Status:** Alpha MVP (0.2.0). Suitable for local experimentation; not yet validated for production CI regression gates. See [limitations](#limitations) and [docs/METHODOLOGY.md](docs/METHODOLOGY.md).
12
+
13
+ **Research goal:** a unified CPU/GPU hardware & compiler observatory layer — orchestrate existing toolchains, normalize results, and keep static vs measured evidence honest. See [docs/OBSERVATORY.md](docs/OBSERVATORY.md).
14
+
15
+ ---
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ pip install compilersutra-perf
21
+ ```
22
+
23
+ Optional extras:
24
+
25
+ ```bash
26
+ pip install 'compilersutra-perf[visualize]' # HTML reports + Streamlit dashboard
27
+ pip install 'compilersutra-perf[excel]' # XLSX result workbooks
28
+ pip install 'compilersutra-perf[pdf]' # PDF reports (WeasyPrint)
29
+ pip install 'compilersutra-perf[dev]' # pytest
30
+ ```
31
+
32
+ **Requirements:** Python 3.11+. Linux wheels ship prebuilt native runners for CPU (and Vulkan, where available), so CPU workloads run out of the box. Other platforms (or exotic Python builds) fall back to building the runner on demand, which needs a C/C++ toolchain and `cmake` on `PATH`; `perf` is also recommended for full CPU profiling on Linux. GPU backends need their respective runtimes (ROCm, OpenCL, Vulkan) installed separately.
33
+
34
+ **Platform wheels and old distributions:** release wheels use a `manylinux` tag (e.g. `manylinux_2_39_x86_64`) for the glibc they were built on, so a wheel built on Ubuntu 24.04 may fail to load its bundled runner on Ubuntu 22.04 or older (newer glibc). The loader probes the bundled runner at startup and automatically falls back to an on-demand local build, so only an older toolchain is needed there. Hardware counter events are probed per-CPU, so vendor-specific events never break collection on other vendors (Intel vs AMD).
35
+
36
+ **Native Windows:** not yet supported. The runner uses POSIX APIs (`fork`, `sched_setaffinity`) and won't build on Windows natively — use [WSL2](docs/WINDOWS_WSL2.md). Result artifacts (JSON/CSV/XLSX/HTML reports) open fine on Windows.
37
+
38
+ Check that every system tool csperf needs is present, and install whatever is missing:
39
+
40
+ ```bash
41
+ csperf quickstart --output-dir results/quickstart # doctor + example + report
42
+ csperf doctor # report missing tools; exit 1 if a required tool is missing
43
+ csperf doctor --install # install missing required tools (apt/dnf/pacman/apk/brew)
44
+ csperf doctor --install --all # also install optional GPU/profiling tools
45
+ ```
46
+
47
+ See [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) for perf, energy, and GPU fixes.
48
+
49
+ Develop from source (private checkout if you have access):
50
+
51
+ ```bash
52
+ cd CompilerSutraPerfTool
53
+ python3 -m venv .venv && source .venv/bin/activate
54
+ pip install -e '.[dev]'
55
+ # Native runners are compiled on demand at first run; build them explicitly with:
56
+ cmake -S native/runtime -B build/native && cmake --build build/native
57
+ ```
58
+
59
+ To produce a platform wheel that embeds prebuilt runners (used by the release pipeline):
60
+
61
+ ```bash
62
+ CSPERF_BUNDLE_NATIVE=1 python -m build --wheel
63
+ ```
64
+
65
+ ---
66
+
67
+ ## Quick start
68
+
69
+ ```bash
70
+ csperf list-backends
71
+ csperf quickstart --output-dir results/quickstart
72
+ csperf list-energy-backends
73
+ csperf run --input examples/cpp/matrix_traversal.cpp --backend cpu \
74
+ --warmup-runs 1 --repeat-runs 3 --output results/cpu.json
75
+ csperf profile results/cpu.json
76
+ csperf diff results/run-a.json results/run-b.json --csv results/compare.csv
77
+ # Auto-compare -O0 / -O1 / -O2 / -O3 runtimes (writes results/optimize/ + comparison report):
78
+ csperf run --input examples/cpp/matrix_traversal.cpp --diff-optimize --no-perf --report-format both
79
+ # Energy (Linux RAPL / AMD GPU when available):
80
+ csperf run --input examples/cpp/matrix_traversal.cpp --backend cpu \
81
+ --energy-backend amd-cpu --output results/cpu-energy.json
82
+ ```
83
+
84
+ Each `run` writes `results/<name>.json`, `.csv`, and `.xlsx` (when `openpyxl` is installed).
85
+
86
+ ---
87
+
88
+ ## Backends
89
+
90
+ | Backend | Status | Notes |
91
+ | --- | --- | --- |
92
+ | **CPU** | Execute + profile | Native C++ runner, LLVM IR (clang), Linux `perf` counters, warmup/repeat, optional `--cpu-affinity` |
93
+ | **HIP** | Execute + profile | `hipcc` compile-and-run, ROCm devices, `rocprofv3` (then v2/v1) |
94
+ | **OpenCL** | Execute | Native kernel launch, device selection, warmup/repeat |
95
+ | **Vulkan** | Execute via csrun / validate | Prefer CompilerSutraRun YAML execute (`CSRUN_BIN`); else GLSL → SPIR-V + module validation |
96
+ | **`gpu` alias** | Auto-route | `.hip` → HIP, `.cl` → OpenCL, shaders → Vulkan |
97
+ | **CUDA / Metal** | Planned | Listed in registry but not executable |
98
+ | **macOS CPU** | Experimental | Execution works; profiling uses `powermetrics` (needs passwordless `sudo`) |
99
+
100
+ ---
101
+
102
+ ## Compiler selection and flags
103
+
104
+ Use `--compiler` to select the compiler explicitly, or select the toolchain with environment variables; pass optimization and language flags with `--compiler-flag`.
105
+
106
+ ### Choose compiler (CPU)
107
+
108
+ ```bash
109
+ # Default: clang / clang++
110
+ csperf run --input program.cpp --backend cpu --output results/clang.json
111
+
112
+ # GCC
113
+ CC=gcc CXX=g++ csperf run --input program.cpp --backend cpu --output results/gcc.json
114
+
115
+ # Explicit compiler override env vars (highest priority after CXX_COMPILER)
116
+ CXX=g++-13 csperf run --input program.cpp --backend cpu --output results/gpp13.json
117
+ ```
118
+
119
+ Resolution order: `CXX_COMPILER` / `C_COMPILER` → `CXX` / `CC` → default (`clang++` / `clang`).
120
+
121
+ HIP always uses `hipcc` when available.
122
+
123
+ ### Add compiler flags
124
+
125
+ Repeat `--compiler-flag` for each option. `-O3` is added by default unless you pass another `-O*` flag (for example `--compiler-flag=-O0`):
126
+
127
+ ```bash
128
+ csperf run --input program.cpp --backend cpu \
129
+ --compiler-flag=-march=native \
130
+ --compiler-flag=-funroll-loops \
131
+ --compiler-flag=-fopenmp \
132
+ --output results/optimized.json
133
+
134
+ csperf run --input program.cpp --compiler-flag=-std=c++20 --output results/cpp20.json
135
+ ```
136
+
137
+ `CXXFLAGS` / `CFLAGS` are **not** read — pass flags explicitly.
138
+
139
+ ### Compare two compilers (batch)
140
+
141
+ For a folder of `.c`/`.cpp` files, use the batch script with JSON compiler configs:
142
+
143
+ ```bash
144
+ python scripts/compiler_diff_batch.py examples/cpp \
145
+ --config1 configs/compiler_gcc.sample.json \
146
+ --config2 configs/compiler_clang.sample.json
147
+ ```
148
+
149
+ Sample config (`configs/compiler_gcc.sample.json`):
150
+
151
+ ```json
152
+ {
153
+ "compiler_family": "gcc",
154
+ "cc": "gcc",
155
+ "cxx": "g++",
156
+ "compiler_flags": ["-O3", "-march=native"]
157
+ }
158
+ ```
159
+
160
+ Outputs: per-file JSON/CSV diffs, `summary.csv`, and `summary.xlsx`.
161
+
162
+ ### Compare two saved runs
163
+
164
+ ```bash
165
+ csperf diff results/gcc.json results/clang.json \
166
+ --csv results/gcc-vs-clang.csv \
167
+ --derived-config configs/derived_metrics.sample.json
168
+ ```
169
+
170
+ ---
171
+
172
+ ## Common run options
173
+
174
+ | Flag | Purpose |
175
+ | --- | --- |
176
+ | `--warmup-runs N` | Warmup iterations before measurement (default `3`) |
177
+ | `--repeat-runs N` | Measured trials with summary stats (default `15`) |
178
+ | `--no-perf` | Skip hardware counter collection |
179
+ | `--plan-only` | Print compile/run commands without executing |
180
+ | `--build-dir PATH` | Output directory for binary and IR |
181
+ | `--cpu-affinity 0,1` | Pin CPU execution (Linux) |
182
+ | `--device-index N` | GPU device for HIP / OpenCL / Vulkan |
183
+ | `--backend gpu` | Auto-select GPU backend from file type |
184
+ | `--compiler=PATH` | Select the CPU compiler binary |
185
+ | `--compiler-flag=FLAG` | Append compile flag (repeatable) |
186
+ | `--program-arg ARG` | Pass an argument to the workload (repeatable) |
187
+ | `--stdin-file PATH` | Provide workload stdin |
188
+ | `--execution-timeout SECONDS` | Bound each workload execution |
189
+ | `--diff-optimize` | Run `-O0`…`-O3`, write per-level results and runtime comparison |
190
+ | `--energy` / `--no-energy` | Enable or disable energy measurement (on by default when backends exist) |
191
+ | `--energy-backend KEY` | Select backends (`auto`, `amd-cpu`, `amd-gpu`, …); see `list-energy-backends` |
192
+ | `--json` | Machine-readable stdout |
193
+ | `--version` | Print package version |
194
+
195
+ OpenCL kernel arguments:
196
+
197
+ ```bash
198
+ csperf run --input examples/opencl/saxpy.cl --backend opencl --device-index 0 \
199
+ --kernel-name saxpy \
200
+ --kernel-arg buffer:float:read:4096:1.0 \
201
+ --kernel-arg scalar:uint32:4096 \
202
+ --readback-arg 2
203
+ ```
204
+
205
+ Inspect planned commands:
206
+
207
+ ```bash
208
+ csperf run --input program.cpp --plan-only
209
+ ```
210
+
211
+ ---
212
+
213
+ ## Results and visualization
214
+
215
+ Artifacts per run:
216
+
217
+ - **JSON** — full structured result (metrics, execution with `host_platform` and `metrics_availability`, hardware, diagnostics)
218
+ - **CSV** — sectioned spreadsheet-friendly report with dotted metric paths and units
219
+ - **XLSX** — Results + Metadata sheets (requires `[excel]` extra)
220
+
221
+ ```bash
222
+ csperf profile results/cpu.json
223
+ csperf visualize results/cpu.json results/gpu.json --output report.html
224
+ csperf visualize results/cpu.json --format pdf --output report.pdf
225
+ csperf visualize results/cpu.json --format both --output report
226
+ csperf list-report-formats
227
+ pip install 'compilersutra-perf[visualize]' && csperf dashboard results/cpu.json
228
+ ```
229
+
230
+ Energy and power domains appear in the HTML/PDF report when the run collected a `power` block. See [docs/ENERGY.md](docs/ENERGY.md) and [docs/REPORT.md](docs/REPORT.md).
231
+
232
+ Failed runs exit non-zero (`1`) and include actionable hints when tooling is missing. See [exit codes](docs/USAGE.md#exit-codes) in USAGE.
233
+
234
+ ---
235
+
236
+ ## Limitations
237
+
238
+ Read these before trusting numbers in papers or CI:
239
+
240
+ - **Alpha** — methodology and backend coverage are still evolving.
241
+ - CPU runs support `--execution-timeout` to bound workload execution.
242
+ - CPU runs support repeated `--program-arg` values and `--stdin-file`; manifests can define the same settings.
243
+ - **`--experiment` / `--opt-config`** — apply compile macros and optional extra flags; plugin entry points remain planned for 0.3.0.
244
+ - Optional extras `track`, `tune`, and `distributed` are reserved for later releases and are not wired into the CLI.
245
+ - **OpenCL** — program may recompile each trial; interpret kernel times carefully.
246
+ - **CUDA / Metal** — not implemented despite registry entries.
247
+ - **Native runners** — Linux wheels bundle prebuilt native runners; other platforms build on demand from the bundled sources (needs a C/C++ toolchain and `cmake`).
248
+
249
+ Best supported today: **Linux CPU** compile/run/profile with `perf` configured, plus HIP/OpenCL exploration with manual interpretation.
250
+
251
+ ---
252
+
253
+ ## Documentation
254
+
255
+ Public getting started guide:
256
+
257
+ https://www.compilersutra.com/docs/project/compilersutra-perf/getting-started/
258
+
259
+ In-tree guides (source checkout):
260
+
261
+ | Doc | Topic |
262
+ | --- | --- |
263
+ | [docs/GETTING_STARTED.md](docs/GETTING_STARTED.md) | First workload |
264
+ | [docs/USAGE.md](docs/USAGE.md) | CLI reference |
265
+ | [docs/ENERGY.md](docs/ENERGY.md) | Energy / power backends |
266
+ | [docs/REPORT.md](docs/REPORT.md) | Modular HTML/PDF reports |
267
+ | [docs/METHODOLOGY.md](docs/METHODOLOGY.md) | What metrics mean and platform caveats |
268
+ | [docs/TESTING.md](docs/TESTING.md) | Validation |
269
+ | [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) | Design |
270
+ | [CONTRIBUTING.md](CONTRIBUTING.md) | Contributions |
271
+ | [CHANGELOG.md](CHANGELOG.md) | Release notes |
272
+
273
+ ---
274
+
275
+ ## License
276
+
277
+ Apache License 2.0 — see [LICENSE](LICENSE).
278
+
279
+ **Author:** [Priya Pandey](https://www.linkedin.com/in/priya-pandey-54a5a22aa/) · [CompilerSutra](https://compilersutra.com)
@@ -2,6 +2,15 @@
2
2
  # Copyright (c) 2026 CompilerSutraPerfTool
3
3
  # Author: Priya Pandey | https://www.linkedin.com/in/priya-pandey-54a5a22aa/ | CompilerSutra | https://www.linkedin.com/company/compilersutra/ | https://compilersutra.com
4
4
 
5
+ option(CSPERF_ENABLE_PAPI "Link PAPI into the native runner when libpapi is available" ON)
6
+
7
+ if(CSPERF_ENABLE_PAPI)
8
+ find_package(PkgConfig QUIET)
9
+ if(PkgConfig_FOUND)
10
+ pkg_check_modules(CSPERF_PAPI QUIET IMPORTED_TARGET papi)
11
+ endif()
12
+ endif()
13
+
5
14
  add_library(csperfSupport STATIC
6
15
  lib/Support/JSON.cpp
7
16
  )
@@ -31,6 +40,7 @@ add_library(csperfNative STATIC
31
40
  lib/Native/NativeArgumentParser.cpp
32
41
  lib/Native/NativeApplication.cpp
33
42
  lib/Native/NativeRunner.cpp
43
+ lib/Native/PapiCounters.cpp
34
44
  )
35
45
 
36
46
  target_include_directories(csperfNative
@@ -43,6 +53,14 @@ target_link_libraries(csperfNative
43
53
  csperfRuntime
44
54
  )
45
55
 
56
+ if(CSPERF_ENABLE_PAPI AND CSPERF_PAPI_FOUND)
57
+ target_compile_definitions(csperfNative PRIVATE CSPERF_HAS_PAPI=1)
58
+ target_link_libraries(csperfNative PUBLIC PkgConfig::CSPERF_PAPI)
59
+ message(STATUS "PAPI found; native runner built with in-process PAPI counters")
60
+ elseif(CSPERF_ENABLE_PAPI)
61
+ message(STATUS "PAPI not found; native runner built without in-process counters")
62
+ endif()
63
+
46
64
  find_package(OpenCL QUIET)
47
65
  if(NOT OpenCL_FOUND AND NOT APPLE)
48
66
  find_library(CSPERF_OPENCL_LIBRARY