MORI-VIZ Kernel Profiler
MORI-VIZ is a warp-level GPU kernel profiler with Perfetto integration. It captures fine-grained timing data from dispatch/combine kernels.
Requirements
Build MORI with profiling enabled:
ENABLE_PROFILER=ON pip install .
Usage
Capture and export traces:
import mori
from mori.kernel_profiler import export_to_perfetto
# Run dispatch/combine operations first, then:
if hasattr(mori.cpp, "get_debug_time_buf"):
trace_buffer = mori.cpp.get_debug_time_buf(op._handle)
export_to_perfetto(trace_buffer, "ep_trace.json")
Visualize: Open the JSON file at ui.perfetto.dev.
export_to_perfetto
export_to_perfetto(
trace_buffer,
filename="trace.json",
slot_map=None,
gpu_freq_ghz=None,
validate_pairs=True,
sanitize_orphans=True,
)
Parameters:
Parameter |
Default |
Description |
|---|---|---|
|
Raw trace buffer from |
|
|
|
Output file path (Perfetto JSON format) |
|
|
Custom slot name mapping (uses built-in profiler slots if None) |
|
|
GPU clock frequency; auto-detected via |
|
|
Validate begin/end event pairs |
|
|
Remove unpaired events |
C++ Profiler APIs
Available via mori.cpp when built with ENABLE_PROFILER=ON:
Function |
Description |
|---|---|
|
Get raw trace buffer from an EP handle |
|
Get current write offset in the trace buffer |
|
Get GPU wall clock frequency in MHz |
See PROFILER.md for full profiler documentation.