Tauri IPC Contract¶
Refreshed 2026-04-29 to match pccx-lab HEAD. Sources:
ui/src-tauri/src/lib.rs, crates/schema/src/lib.rs.
The pccx-lab frontend and Rust backend communicate via the Tauri v2
invoke mechanism. All commands are registered in the
tauri::generate_handler![] list inside ui/src-tauri/src/lib.rs.
The full catalogue of 48 registered commands follows.
Command catalogue¶
Load / trace¶
Command |
Args |
Return |
Purpose |
|---|---|---|---|
|
|
|
Parse a |
|
|
|
Load a second trace into the |
|
— |
|
Return the cached 24-byte struct-array flat buffer for zero-copy TypedArray mapping on the JS side. |
|
— |
|
Return the flat buffer for |
|
|
|
Enumerate |
mmap streaming (large traces)¶
Command |
Args |
Return |
Purpose |
|---|---|---|---|
|
|
|
Open a |
|
|
|
Return events overlapping |
|
— |
|
Return the total event count of the mmap trace. |
|
|
|
Return a raw byte slice from the mmap payload for zero-copy TypedArray transfer. |
Analytics¶
Command |
Args |
Return |
Purpose |
|---|---|---|---|
|
— |
|
Run roofline analysis on the cached trace. Returns a single-tier result. |
|
— |
|
Return one |
|
|
|
Sliding-window bottleneck detection. Defaults: 256 cycles / 0.5 threshold. |
|
— |
|
Return per-core MAC utilisation percentages, total cycles, total microseconds, and peak TOPS as JSON. |
|
|
|
Reduce the cached trace into a |
|
|
|
Return the deterministic |
|
— |
|
Compress the trace into an LLM-friendly context string via |
Reports¶
Command |
Args |
Return |
Purpose |
|---|---|---|---|
|
|
|
Render a trace-derived report. |
|
|
|
Build a report from caller-supplied sections and render it. |
|
|
|
Render a Markdown report. Both paths may be empty to omit the synth section. |
Verification¶
Command |
Args |
Return |
Purpose |
|---|---|---|---|
|
|
|
Spawn |
|
|
|
Merge multiple JSONL coverage-run files. Empty |
|
|
|
Sanitise input (NUL removal, BOM/CRLF normalisation, trailing-comma forgiveness). Never fails. |
|
|
|
Compare a candidate |
|
|
|
Render a |
|
|
|
Parse a Spike |
|
— |
|
Enumerate |
Synthesis / hardware¶
Command |
Args |
Return |
Purpose |
|---|---|---|---|
|
|
|
Parse Vivado |
|
|
|
Parse a Vivado timing-summary text file. Returns per-clock WNS/TNS/period. |
|
|
|
Return a |
LSP (SystemVerilog)¶
Command |
Args |
Return |
Purpose |
|---|---|---|---|
|
— |
|
Return the full SV keyword completion set from |
|
|
|
Position-aware hover info. Returns |
|
|
|
Position-aware completions combining keyword and user-defined symbol items. |
|
|
|
SV source diagnostics mapped to Monaco MarkerSeverity integers (8/4/2/1). |
|
|
|
Parse an SV file and return the structured result as JSON. |
|
|
|
Generate a Mermaid block diagram from parsed module connections. |
|
|
|
Return one Mermaid state diagram per extracted FSM plus dead-state lists. |
|
|
|
Return a Mermaid subgraph diagram for the named module. |
|
|
|
Generate module documentation from SV source. |
AI copilot¶
Command |
Args |
Return |
Purpose |
|---|---|---|---|
|
— |
|
Return the available extension list from |
|
|
|
Generate a SV UVM sequence stub for the named strategy ( |
|
— |
|
Return the strategy names accepted by the UVM sequence generator. |
File system / utility¶
Command |
Args |
Return |
Purpose |
|---|---|---|---|
|
|
|
Recursively read a directory tree from |
|
|
|
Read a text file for the Monaco editor buffer. |
|
|
|
Write a text file (Ctrl+S save). |
|
|
|
Parse an IEEE 1364-2005 VCD file. Returns signal metadata plus the full value-change stream. |
|
|
|
Write the cached trace as a VCD file. Returns the absolute path. |
|
|
|
Write the cached trace as a Google Trace Event Format JSON. |
|
— |
|
Return the Apache-2.0 license string for the status bar. |
DTO schema¶
crates/schema/src/lib.rs defines the shared Rust-TypeScript wire DTOs.
All types derive ts-rs’s #[derive(TS)] + #[ts(export)]; TypeScript
interfaces are auto-generated under cargo test.
// crates/schema/src/lib.rs (excerpt)
/// Frontend -> backend: request a window of trace data.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)]
#[ts(export)]
pub struct ViewportRequest {
pub start_cycle: u64,
pub end_cycle: u64,
pub generation_id: u32,
}
/// A single event inside a viewport tile.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)]
#[ts(export)]
pub struct TileEvent {
pub core_id: u32,
pub start_cycle: u64,
pub duration: u64,
pub type_id: u32,
}
/// Backend -> frontend: a batch of events for one viewport generation.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)]
#[ts(export)]
pub struct ViewportTile {
pub events: Vec<TileEvent>,
pub generation_id: u32,
pub total_events: u64,
}
/// Summary of a loaded trace file.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)]
#[ts(export)]
pub struct TraceInfo {
pub total_cycles: u64,
pub total_events: u64,
pub num_cores: u32,
pub encoding: String,
}
The MmapViewportResponse (defined inline in lib.rs) also carries
generation_id: u32, which mmap_viewport echoes:
#[derive(serde::Serialize)]
struct MmapViewportResponse {
events: Vec<NpuEvent>,
generation_id: u32,
}
The schema crate carries no dependency on ui/, uvm_bridge/, or
ai_copilot/. Wire DTOs are thin data carriers with no domain logic.
Boundary rules¶
Rules derived from CLAUDE.md §5.5 and the lib.rs implementation.
u64 fields¶
u64 fields that may exceed 2^53 must be serialised as String over
IPC; passing them as JSON numbers loses precision in JavaScript.
Fields in this category include TileEvent.start_cycle,
TileEvent.duration, TraceInfo.total_cycles, and
TraceInfo.total_events. JS code deserialises these string fields
via BigInt or a precision-preserving library before arithmetic use.
generation_id¶
Every async viewport response must carry a generation_id: u32. The
frontend compares the returned ID against the current generation on
receipt and discards stale responses. This prevents a slow IPC
round-trip from overwriting newer state during rapid scroll or zoom.
Both ViewportRequest and MmapViewportResponse carry the field:
pub struct ViewportRequest {
pub start_cycle: u64,
pub end_cycle: u64,
pub generation_id: u32, // caller-supplied
}
struct MmapViewportResponse {
events: Vec<NpuEvent>,
generation_id: u32, // echoed back verbatim
}
Large binary¶
Large binary data is represented as Vec<u8> on the Rust side and
mapped to TypedArray on the JS side. fetch_trace_payload,
fetch_trace_payload_b, and mmap_tile all follow this pattern,
serialising a 24-byte struct array or a raw mmap slice respectively:
#[tauri::command]
async fn fetch_trace_payload(state: State<'_, AppState>) -> Result<Vec<u8>, String> {
let buf = state.trace_flat_buffer.lock().unwrap().clone();
Ok(buf)
}
The JS receiver wraps the returned value in a Uint8Array or
Float32Array view and accesses struct fields via byte offsets.
Raw trace data never crosses IPC¶
Raw trace data (NpuTrace, full NpuEvent arrays) does not cross the
IPC boundary directly. Only the flat buffer returned by
fetch_trace_payload, tiled slices from mmap_viewport, and
aggregated results from commands such as analyze_roofline may cross.
This is a design decision stated in CLAUDE.md §5.5 and motivated in
docs/design/architecture_adoption.md Section 4.
Cite this page¶
@misc{pccx_lab_ipc_2026,
title = {pccx-lab Tauri IPC contract: 48 commands, DTO schema,
and boundary rules},
author = {Kim, Hyunwoo},
year = {2026},
howpublished = {\url{https://pccxai.github.io/pccx/en/docs/Lab/ipc.html}},
note = {Part of pccx: \url{https://pccxai.github.io/pccx/}}
}
Command source is at https://github.com/pccxai/pccx-lab/blob/main/ui/src-tauri/src/lib.rs; DTO schema is at https://github.com/pccxai/pccx-lab/blob/main/crates/schema/src/lib.rs.