Profiling
Stack: torch-spyre (new, Inductor-based).
Scope: performance — why is it slow? For correctness questions (why is the result wrong?) see Debugging.
Torch-Spyre provides tooling to measure the performance of PyTorch workloads running on the Spyre accelerator. The full design of the planned toolkit is in RFC 0601 — Spyre Profiling Toolkit.
The in-tree torch_spyre.profiler package is importable and exports
FFDC retrieval (get_diagnostic_report). Device presence is
torch.spyre.is_available(). Day-to-day performance work still goes
through torch.profiler plus the integrations on this page (upstream
Kineto with libaiupti, aiu-smi, aiu-trace-analyzer). Broader
in-tree profiling APIs will land with RFC 0601.
What can be profiled today
Capability |
Status |
Where |
|---|---|---|
Compiler pipeline logs |
Available |
|
FFDC diagnostic reports on Spyre compile/runtime/unimplemented failures |
Available ( |
FFDC user guide · API: |
CPU-side timing with |
Available |
|
Device telemetry (power, temperature, bandwidth) |
Available — PF and VF mode (IBM-internal distribution; public release tracked in #1335) |
|
Device-side kernel timing via |
Merged and built by default (#1856) via upstream Kineto and |
|
Trace post-processing (aiu-trace-analyzer) |
Available, known gaps |
|
|
Available — delegates to |
|
Scratchpad utilization metrics |
Planned |
|
IR-instrumentation-based fine-grained profiler |
Planned |
FFDC quick example
When TORCH_SPYRE_FFDC=1, frontend-compile, backend-compile,
kernel-launch, and unimplemented-operation failures write a JSON
diagnostic report. Retrieve the newest valid report with:
import torch
import torch_spyre
report = torch.spyre.get_diagnostic_report()
if report is not None:
print(report["failure"]["category"], report["failure"]["message"])
print(report["failure"]["file"], report["failure"]["lineno"])
print(report["_report_path"])
See the FFDC user guide for failure categories, report locations, pod/CI workflow, and JSON triage. The API reference documents the function contract.
Memory API quick example
torch.spyre.memory re-exports torch.accelerator.memory, so the
same memory-query calls used on CUDA apply to Spyre. The example
below allocates a tensor, frees it, and reads the current and peak
allocations:
import torch
# Reset the peak counter so max_memory_allocated() starts from zero.
torch.spyre.memory.reset_peak_memory_stats()
# Allocate on the device; memory_allocated() reflects the new total.
x = torch.rand((64, 64), dtype=torch.float16, device="spyre")
print(torch.spyre.memory.memory_allocated()) # bytes currently allocated
# Free the tensor. memory_allocated() drops back, but the peak persists.
del x
print(torch.spyre.memory.memory_allocated()) # current allocation
print(torch.spyre.memory.max_memory_allocated()) # peak since reset
The module also exposes reset_accumulated_memory_stats() and
memory_stats().
Toolkit layers
Layer |
Tool |
Granularity |
|---|---|---|
Application / PyTorch |
|
Kernel-level |
Compiler frontend |
Inductor logging |
Pass-level |
Compiler backend |
IR instrumentation (planned) |
Intra-kernel |
Runtime |
|
Kernel + memory |
Device / HW |
|
Device-level telemetry |
Post-processing |
Derived metrics |
Profiling topics
Environment variables — logging, device enumeration, runtime/driver variables used by
aiu-smiandaiu-trace-analyzerFFDC (First Failure Data Capture) — automatic failure reports, report locations, and triage workflow
PyTorch Profiler —
torch.profilerusage, CPU today, device-side previewDevice monitoring —
aiu-smisetupTrace analysis — Chrome / Perfetto / TensorBoard viewing and
aiu-trace-analyzerpost-processingPerformance analysis methodology — bounding a region and pairing traces with telemetry
Toolkit usage matrix — which tool for which metric
End-to-end example — profiling a Granite model on Spyre, gluing all four tools into one workflow
See also
Debugging — correctness-focused workflow, including
TORCH_COMPILE_DEBUGartifacts and FFDC captureRunning Models —
torch.compileusageCompiler Architecture — pipeline overview
RFC 0601 — full profiling toolkit design
Contributing to the Profiler — branch / commit conventions, build flag, test layout, and review process for the profiling squad
Work in Progress
Some subsystems above are labelled Planned and are under active development as part of RFC 0601. The APIs reflect planned design and may change.