|
33 | 33 | - **GPU Memory Profiler**: Allocation tracking, leak detection, peak usage monitoring |
34 | 34 | - **CLI Tools**: Easy-to-use command-line interface for recording and viewing traces |
35 | 35 | - **GDB Integration** (v0.10.0): GPU-aware debugging via GDB Remote Serial Protocol (RSP) |
| 36 | +- **Tracy Profiler Integration** (v0.11.0): Real-time visualization with full GPU timeline support for Ascend/MetaX/ROCm |
36 | 37 |
|
37 | 38 | [](https://deepwiki.com/chenxingqiang/TraceSmith) |
38 | 39 |
|
|
72 | 73 | - `.json` - Perfetto JSON (chrome://tracing) |
73 | 74 | - `.perfetto` - Perfetto Protobuf (85% smaller) |
74 | 75 | - `.dot` - Graphviz dependency graph |
| 76 | +- `.tracy` - Tracy profiler format (via import) |
75 | 77 | - ASCII Timeline - Terminal visualization |
76 | 78 |
|
| 79 | +**Integrations:** |
| 80 | +- [Tracy Profiler](https://github.com/wolfpld/tracy) - Real-time visualization (v0.11.0+) |
| 81 | +- [Perfetto SDK](https://perfetto.dev/) - Native protobuf export |
| 82 | +- [LLVM XRay](https://llvm.org/docs/XRay.html) - Compiler-instrumented traces |
| 83 | +- [PyTorch Kineto](https://github.com/pytorch/kineto) - Compatible schema |
| 84 | + |
77 | 85 | ## Prerequisites & Dependencies |
78 | 86 |
|
79 | 87 | Before installing TraceSmith, install the required dependencies for your platform. |
@@ -847,6 +855,143 @@ if ts.is_ascend_available(): |
847 | 855 | ts.export_perfetto(events, "ascend_trace.json") |
848 | 856 | ``` |
849 | 857 |
|
| 858 | +#### Tracy Profiler Integration (v0.11.0) |
| 859 | + |
| 860 | +TraceSmith provides bidirectional integration with [Tracy Profiler](https://github.com/wolfpld/tracy), enabling real-time visualization of GPU profiling data alongside Tracy's existing CPU profiling capabilities. |
| 861 | + |
| 862 | +**Features:** |
| 863 | +- **Full GPU Timeline** for Ascend, MetaX, ROCm (not just messages!) |
| 864 | +- Export TraceSmith events to Tracy for real-time visualization |
| 865 | +- Import Tracy captures (`.tracy` files) into TraceSmith format |
| 866 | +- Unified profiling macros that work with both profilers |
| 867 | +- GPU zone emission for kernel timing visualization |
| 868 | +- Memory allocation tracking in Tracy |
| 869 | +- Counter/plot data for metrics visualization |
| 870 | +- Frame marking for game/real-time applications |
| 871 | + |
| 872 | +**GPU Timeline Support:** |
| 873 | + |
| 874 | +| GPU Platform | Tracy Native | TraceSmith Integration | |
| 875 | +|--------------|--------------|------------------------| |
| 876 | +| NVIDIA CUDA | ✅ Native | ✅ Full Timeline | |
| 877 | +| Vulkan | ✅ Native | ✅ Full Timeline | |
| 878 | +| Metal | ✅ Native | ✅ Full Timeline | |
| 879 | +| **Huawei Ascend** | ❌ None | ✅ **Full Timeline** | |
| 880 | +| **MetaX MACA** | ❌ None | ✅ **Full Timeline** | |
| 881 | +| **AMD ROCm** | ❌ None | ✅ **Full Timeline** | |
| 882 | + |
| 883 | +TraceSmith enables **full GPU timeline visualization** in Tracy for platforms that Tracy doesn't natively support, including Ascend NPUs and MetaX GPUs. |
| 884 | + |
| 885 | +**Quick Start:** |
| 886 | + |
| 887 | +```bash |
| 888 | +# Build with Tracy integration |
| 889 | +cmake .. -DTRACESMITH_ENABLE_TRACY=ON |
| 890 | +make -j$(nproc) |
| 891 | + |
| 892 | +# Run example (connect Tracy server for visualization) |
| 893 | +./bin/tracy_integration_example |
| 894 | +``` |
| 895 | + |
| 896 | +**Full GPU Timeline API (Ascend/MetaX/ROCm):** |
| 897 | + |
| 898 | +```cpp |
| 899 | +#include <tracesmith/tracy/tracy_gpu_context.hpp> |
| 900 | + |
| 901 | +using namespace tracesmith; |
| 902 | + |
| 903 | +// Create GPU context for Ascend NPU |
| 904 | +auto& ascend_ctx = tracy::getOrCreateGpuContext( |
| 905 | + "Ascend 910B NPU", tracy::GpuContextType::Ascend, 0); |
| 906 | + |
| 907 | +// Create GPU context for MetaX GPU |
| 908 | +auto& metax_ctx = tracy::getOrCreateGpuContext( |
| 909 | + "MetaX C500 GPU", tracy::GpuContextType::MACA, 0); |
| 910 | + |
| 911 | +// Method 1: Emit GPU zone directly (creates timeline bar in Tracy) |
| 912 | +ascend_ctx.emitGpuZone("AscendMatMul", |
| 913 | + cpu_start, cpu_end, // CPU timestamps |
| 914 | + gpu_start, gpu_end, // GPU timestamps |
| 915 | + thread_id, color); |
| 916 | + |
| 917 | +// Method 2: Use RAII macro |
| 918 | +{ |
| 919 | + TracySmithGpuZone(metax_ctx, "MetaXGEMM"); |
| 920 | + // ... kernel execution ... |
| 921 | +} // Zone emitted on scope exit |
| 922 | + |
| 923 | +// Method 3: Convert TraceSmith events to GPU timeline |
| 924 | +std::vector<TraceEvent> events; |
| 925 | +profiler->getEvents(events); |
| 926 | +ascend_ctx.emitGpuZones(events); // Batch convert to timeline |
| 927 | +``` |
| 928 | +
|
| 929 | +**Tracy Visualization Result:** |
| 930 | +
|
| 931 | +``` |
| 932 | +┌─────────────────────────────────────────────────────────┐ |
| 933 | +│ CPU Timeline │ |
| 934 | +│ ████ submit ████████████████████ submit ████ │ |
| 935 | +├─────────────────────────────────────────────────────────┤ |
| 936 | +│ Ascend 910B NPU │ |
| 937 | +│ ▓▓▓▓▓▓▓▓ AscendMatMul ▓▓▓▓▓▓ AscendConv2D │ |
| 938 | +├─────────────────────────────────────────────────────────┤ |
| 939 | +│ MetaX C500 GPU │ |
| 940 | +│ ▓▓▓▓ MetaXGEMM ▓▓▓▓▓▓▓▓▓▓▓▓ MetaXReduce │ |
| 941 | +└─────────────────────────────────────────────────────────┘ |
| 942 | +``` |
| 943 | +
|
| 944 | +**Basic C++ API:** |
| 945 | +
|
| 946 | +```cpp |
| 947 | +#include <tracesmith/tracy/tracy_client.hpp> |
| 948 | +#include <tracesmith/tracy/tracy_exporter.hpp> |
| 949 | +
|
| 950 | +using namespace tracesmith; |
| 951 | +
|
| 952 | +// Use unified profiling macros |
| 953 | +TracySmithZoneScopedC("MyKernel", tracy::colors::KernelLaunch); |
| 954 | +
|
| 955 | +// Create Tracy exporter |
| 956 | +tracy::TracyExporter exporter; |
| 957 | +exporter.initialize(); |
| 958 | +
|
| 959 | +// Export TraceSmith events to Tracy |
| 960 | +TraceEvent event; |
| 961 | +event.type = EventType::KernelLaunch; |
| 962 | +event.name = "matmul_f32"; |
| 963 | +event.duration = 1500000; // 1.5ms |
| 964 | +exporter.emitEvent(event); |
| 965 | +
|
| 966 | +// Frame marking |
| 967 | +tracy::markFrame("RenderFrame"); |
| 968 | +
|
| 969 | +// Plot metrics |
| 970 | +exporter.emitPlotValue("GPU Utilization %", 85.0); |
| 971 | +``` |
| 972 | + |
| 973 | +**Import Tracy Captures:** |
| 974 | + |
| 975 | +```cpp |
| 976 | +#include <tracesmith/tracy/tracy_importer.hpp> |
| 977 | + |
| 978 | +tracy::TracyImporter importer; |
| 979 | +auto result = importer.importFile("profile.tracy"); |
| 980 | + |
| 981 | +if (result.success()) { |
| 982 | + // Access TraceSmith events |
| 983 | + for (const auto& event : result.record.events()) { |
| 984 | + std::cout << event.name << ": " << event.duration << " ns\n"; |
| 985 | + } |
| 986 | +} |
| 987 | +``` |
| 988 | + |
| 989 | +**CMake Options:** |
| 990 | + |
| 991 | +| Option | Default | Description | |
| 992 | +|--------|---------|-------------| |
| 993 | +| `TRACESMITH_ENABLE_TRACY` | ON | Enable Tracy profiler integration | |
| 994 | + |
850 | 995 | #### GDB Integration (v0.10.0) |
851 | 996 |
|
852 | 997 | TraceSmith provides a GDB Remote Serial Protocol (RSP) backend for GPU-aware debugging, enabling developers to debug GPU applications with full visibility into GPU state. |
@@ -1337,6 +1482,7 @@ for (int i = 0; i < 10000; ++i) { |
1337 | 1482 |
|
1338 | 1483 | | Version | Date | Highlights | |
1339 | 1484 | |---------|------|------------| |
| 1485 | +| **v0.11.0** | 2026-01 | **Tracy Integration** - Bidirectional Tracy profiler integration, **full GPU timeline for Ascend/MetaX/ROCm**, real-time visualization, unified profiling macros, 45+ unit tests | |
1340 | 1486 | | **v0.10.0** | 2025-12 | **GDB Integration** - GPU-aware debugging via RSP, kernel breakpoints, trace replay debugging, 85 unit tests | |
1341 | 1487 | | **v0.9.0** | 2025-12 | **Huawei Ascend NPU** - Full CANN/ACL integration, msprof profiling, Multi-GPU simulation verified | |
1342 | 1488 | | **v0.8.2** | 2025-12 | **CLI Breaking Change** - Enforce --nsys/--mctracer for CUDA/MACA, record command blocked, clearer API limitation messages | |
@@ -1364,6 +1510,7 @@ TraceSmith draws inspiration from: |
1364 | 1510 | - [NVIDIA CUPTI](https://docs.nvidia.com/cupti/) |
1365 | 1511 | - [ROCm ROCProfiler](https://github.com/ROCm/rocprofiler) |
1366 | 1512 | - [Google Perfetto](https://perfetto.dev/) |
| 1513 | +- [Tracy Profiler](https://github.com/wolfpld/tracy) |
1367 | 1514 | - [LLVM XRay](https://llvm.org/docs/XRay.html) |
1368 | 1515 | - [RenderDoc](https://renderdoc.org/) |
1369 | 1516 | - [PyTorch Kineto](https://github.com/pytorch/kineto) |
|
0 commit comments