Cascadedocs

API reference

Types

This page is generated from cascade/models.py each time the docs build, so it matches the code. The web UI mirrors the same types in web/src/api/types.ts.

Types are Python annotations as written in the source. X | None means the field is always present and may be null. datetime is an ISO 8601 string in UTC. tuple[int, int, int] is a JSON array of three integers.

States#

TraceState#

valuemeaning
uploadingFiles are arriving. kernel_count and bytes grow on each scan, every 2 seconds.
processingThe upload is complete. The app is running the trace post-processor, unless the upload already has traces/kernelslist.g.
readyPost-processing produced traces/kernelslist.g. Runs can launch.
failedmetadata.json has status: "failed", or post-processing failed. error says which.

SimState#

valuemeaning
pendingCreated with the run. Waiting for the launcher.
launchingThe launcher is starting the sim's sandbox or process.
runningThe sim sent a running heartbeat.
lostNo heartbeat for CASCADE_HEARTBEAT_TIMEOUT_S. A later heartbeat brings it back.
succeededThe sim sent a succeeded heartbeat. Terminal.
failedThe sim sent a failed heartbeat, the launcher failed, or it stayed lost for 10 times the timeout. Terminal.
cancelledThe run was cancelled before this sim finished. Terminal.

RunState#

cascade/models.py
RunState = Literal["active", "succeeded", "partial", "failed", "cancelled"]
valuemeaning
activeAt least one sim has not finished.
succeededEvery sim succeeded.
partialEvery sim finished, at least one succeeded, and at least one did not.
failedEvery sim failed.
cancelledEvery sim finished, at least one was cancelled, and none succeeded.

RunState is not stored. run_state() in cascade/models.py derives it from the run's sim states each time a run is read.

Traces#

GpuConfig#

fieldtypedescription
namestrAccel-Sim tested-cfgs directory name, e.g. "SM90_H100".
archstrFor example, "sm_90".
core_clock_mhzfloatFirst value of -gpgpu_clock_domains in gpgpusim.config.

KernelLaunch#

One kernel launch from the trace's stats_ctx_* file (original hardware).

fieldtypedescription
kernel_idintMatches kernel-<N> in the trace filename.
namestrMangled kernel name.
gridtuple[int, int, int]Grid size, x, y and z.
blocktuple[int, int, int]Block size, x, y and z.
instructionsint | NoneInstructions the tracer counted. null if the kernel's trace was cut short.

TraceSummary#

fieldtypedescription
idstrThe profiler's run_name.
stateTraceStateWhere the trace is in its lifecycle.
errorstr | NoneWhy the trace failed. null unless state is failed.
created_atdatetimeWhen the first file of the trace landed.
updated_atdatetimeWhen the app last changed this trace.
modelstr | Nonemetadata.json model, such as facebook/opt-125m.
layerslist[str]metadata.json layers. Empty if missing or not a list.
source_gpustr | Nonemetadata.json "gpu".
trace_gpu_archstrmetadata.json "trace_gpu_arch", default "sm_90".
suggested_sim_configstr | Nonemetadata.json suggested_sim_config. The UI preselects it on the New run screen.
real_gpu_configstr | Nonemetadata.json: config of the GPU it was captured on. default null
sample_sim_configslist[str]metadata.json: preselected. default []
sample_setstr | Nonemetadata.json: traces compared side by side. default null
kernel_countintTraced kernels seen so far.
bytesintBytes on disk under the trace dir.
has_real_timingboolTrue when the trace has real per-kernel timings (real_timing.json). The profiler does not write them yet.
has_step_timelineboolcorrected_timeline.json + kernel_mapping.json are in the trace dir.
sampleboolTrue for the sample trace that cascade serve seeds from samples/ (see Introduction), unless CASCADE_SAMPLES is false. It is ready but has no instruction traces, so it can't start a run.

TraceDetail#

Every field of TraceSummary, plus these.

fieldtypedescription
metadatadict | NoneThe trace's metadata.json, parsed. null until it arrives.
kernelslist[KernelLaunch]Kernel launches from the trace's stats_ctx_* files, by kernel_id. Filled in when the trace becomes ready.

Runs and sims#

RunEntry#

fieldtypedescription
gpu_configstrA GpuConfig.name whose arch matches the trace's trace_gpu_arch.
countintHow many sims run this config. at least 1, at most 64

RunCreate#

fieldtypedescription
trace_idstrA trace in state ready.
entrieslist[RunEntry]One entry per config. Each fans out to count sims. at least 1 item

RunSummary#

fieldtypedescription
idstrGenerated, run- and 12 hex digits.
trace_idstrThe trace the run simulates.
created_atdatetimeWhen the run was created.
stateRunStateDerived from the sims. See RunState.
entrieslist[RunEntry]The entries the run was created with.
sim_countsdict[SimState, int]How many sims are in each state. States with no sims are left out.
sampleboolTrue for the sample run seeded with the sample trace. Its results were recorded when the run was made, not in this workspace, and cancelling it changes nothing.
replayboolReplays a sample's recorded Accel-Sim results. default false

RunDetail#

Every field of RunSummary, plus these.

fieldtypedescription
traceTraceSummaryThe run's trace.
simslist[SimSummary]Every sim, sorted by gpu_config and then replica.

SimSummary#

fieldtypedescription
idstrGenerated, sim- and 12 hex digits. The simulator receives it as CASCADE_SIM_ID.
run_idstrThe run this sim belongs to.
gpu_configstrThe config this sim simulates. The simulator receives it as CASCADE_GPU_CONFIG.
replicaint0-based index within its {gpu_config, count} entry.
stateSimStateWhere the sim is in its lifecycle.
errorstr | NoneWhy the sim failed or went lost, from a heartbeat or from the app. A running heartbeat clears it.
launcher_refstr | NoneSailbox id or local pid.
created_atdatetimeWhen the run was created.
started_atdatetime | NoneThe first running heartbeat.
finished_atdatetime | NoneWhen the sim reached a terminal state.
last_heartbeat_atdatetime | NoneThe last heartbeat. null before the first one.
exit_codeint | NoneFrom the final heartbeat, when the simulator sent one.
kernels_doneintKernel stats blocks parsed from the log so far.
kernels_totalintThe trace's kernel count when the run was created.
current_kernelstr | NoneThe kernel named by the last launching kernel name: line in the log.
latestSimMetricsThe most recent totals parsed from the log.
log_taillist[str]Last 20 lines.

SimMetrics#

fieldtypedescription
gpu_tot_sim_cyclefloat | NoneSimulated cycles so far, over every kernel. default null
gpu_tot_sim_insnfloat | NoneSimulated instructions so far, over every kernel. default null
gpu_tot_ipcfloat | NoneInstructions per cycle so far, over every kernel. default null
sim_rate_ipsfloat | Nonegpgpu_simulation_rate, instructions/sec. default null

Results#

KernelStat#

One per-kernel stats block parsed from Accel-Sim output.

fieldtypedescription
sim_idstrThe sim that ran this kernel.
kernel_indexint0-based order of completion within the sim.
kernel_namestrThe block's kernel_name.
kernel_launch_uidint | NoneThe block's kernel_launch_uid.
gpu_sim_cycleint | NoneCycles this kernel took on the simulated GPU.
gpu_sim_insnint | NoneInstructions this kernel ran.
gpu_ipcfloat | NoneThis kernel's instructions per cycle.
sim_time_nsfloat | Nonegpu_sim_cycle / core_clock_mhz * 1000.
statsdict[str, float | str]Every "key = value" line in the block.

ComparisonRow#

fieldtypedescription
kernel_indexintRow position. Kernels are matched by order.
kernel_namestrFrom real timing if present, otherwise from the first sim that finished this kernel.
real_nsfloat | Noneduration_ns from real timing. null without real timing.
sim_nsdict[str, float | None]gpu_config -> median sim_time_ns over replicas.

Comparison#

fieldtypedescription
has_real_timingboolFalse until the trace has real timing.
configslist[str]The run's configs, in entry order, without repeats.
rowslist[ComparisonRow]One row per kernel position.

SimResults#

fieldtypedescription
simSimSummaryThe sim as SimSummary.
trace_idstrThe trace the sim ran.
gpu_configGpuConfigThe full config. arch is unknown and the clock is 0 if the config disappeared since the run started.
kernelslist[KernelStat]Every kernel the sim finished, with the full stats map.
totalsSimMetricsSame as sim.latest.

RunResults#

fieldtypedescription
runRunSummaryThe run without its trace and sims, which are below.
traceTraceDetailThe full trace.
simslist[SimResults]One entry per sim.
comparisonComparisonSame as Compare real and simulated time.

SimStepTimeline#

fieldtypedescription
sim_idstrThe sim that sent it.
gpu_configstrThe sim's config.
replicaintThe sim's replica.
simulateddictAs sent in StepTimelineUpload.simulated.
comparedict | NoneAs sent in StepTimelineUpload.compare.

SimFile#

An output file a sim uploaded with PUT /api/sims/{id}/files/{name}.

fieldtypedescription
namestrMatches FILE_NAME_PATTERN; Accel-Sim's name, plus .gz when the worker gzipped it.
sizeintBytes as stored.
content_typestrFrom the name: text/csv for .csv, text/plain for .txt and .log, application/json for .json, application/gzip for .gz, and otherwise a guess, falling back to application/octet-stream.
created_atdatetimeWhen this version was stored; a re-put replaces the file.

RunFile#

Every field of SimFile, plus these.

fieldtypedescription
sim_idstrThe sim that uploaded the file.
gpu_configstrThe sim's config.
replicaintThe sim's replica.

Simulator calls#

Heartbeat#

fieldtypedescription
stateLiteral["running", "succeeded", "failed"]What the simulator reports. Send running while working and succeeded or failed once at the end.
exit_codeint | NoneYour process's exit code. Send it with the final heartbeat. default null
errorstr | NoneA short reason, with a failed heartbeat. default null

HeartbeatAck#

fieldtypedescription
stateSimStateThe sim's state after this heartbeat.
cancelboolTrue when main cancelled this sim; the simulator must stop.

LogChunk#

fieldtypedescription
seqintPer-sim, increasing; a repeated seq is ignored. at least 0
lineslist[str]Lines of simulator stdout, without trailing newlines.

StepTimelineUpload#

What a sim posts after step timing: cascade simulate and cascade compare output.

fieldtypedescription
simulateddict`cascade simulate` output (simulated_timeline.json), with steps and summary.
comparedict | None`cascade compare` output (compare.json) against the real timeline.

Events#

RunEvent#

cascade/models.py
RunEvent = SnapshotEvent | SimEvent | LogEvent | KernelEvent

One event on the run event stream. The type field says which model it is.

SnapshotEvent#

fieldtypedescription
typeLiteral["snapshot"]Always snapshot. default "snapshot"
runRunDetailThe run as it is at connect time.
kernelslist[KernelStat]Every sim's stats with `stats` emptied; full stats are ~30 KB each.

SimEvent#

fieldtypedescription
typeLiteral["sim"]Always sim. default "sim"
simSimSummaryThe sim after a change: state, heartbeat, progress or metrics.

LogEvent#

fieldtypedescription
typeLiteral["log"]Always log. default "log"
sim_idstrThe sim the lines came from.
lineslist[str]The new chunk, as the simulator sent it.

KernelEvent#

fieldtypedescription
typeLiteral["kernel"]Always kernel. default "kernel"
statKernelStatA kernel that just finished, with the full stats map.

Sim transitions#

SIM_TRANSITIONS lists every allowed move. The app ignores any other move, whether it comes from a heartbeat or from the app itself. The comment above it in the source says who makes each move.

Allowed sim transitions. Main owns pending/launching/cancelled/lost; heartbeats own the rest.
from ↓ to →pendinglaunchingrunninglostsucceededfailedcancelled
pending·✓···✓✓
launching··✓✓✓✓✓
running···✓✓✓✓
lost··✓·✓✓✓
succeeded·······
failed·······
cancelled·······

succeeded, failed and cancelled are TERMINAL_SIM_STATES. Nothing leaves them. Concepts draws the same table as a diagram.

Run state#

run_state() derives a run's state from its sims' states. These rows are computed by calling it during the build.

sim statesrun state
running, succeededactive
succeeded, succeededsucceeded
succeeded, failedpartial
failed, failedfailed
cancelled, failedcancelled
cancelled, succeededpartial
cancelled, cancelledcancelled