Repository navigation
Conversation
rtlsim aborts a run that stops making progress for VX_DBG_STALL_TIMEOUT cycles. VX_scheduler.sv aborts when every active warp is stalled and VX_scoreboard.sv when a staged instruction never issues. SimX had neither, so a deadlock in the model spun forever. Add both checks to the SimX core. The scheduler check counts consecutive cycles with every active warp stalled, armed by the first decode unlock and overridable with EXT_SCHED_STALL_TIMEOUT as in VX_scheduler, and reports the active-warp mask and each warp's PC and thread mask. The issue check measures how long a warp's staged instruction has waited and reports its warp, PC, thread mask, the scoreboard registers it waits on and the instruction. Both abort the simulation. Both only read pipeline state, so timing is unchanged.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rtlsim aborts a stalled run after
VX_DBG_STALL_TIMEOUTcycles (100k, scaled by the L2/L3 count) and says what stalled. SimX does not check this, so a deadlock in the model spins forever.This PR mirrors both RTL watchdogs in the SimX core:
VX_scheduler.sv:568-603STALL_TIMEOUTcyclesscheduler timeout: active_warps=…, then each active warp's PC and tmaskVX_scoreboard.sv:234-257STALL_TIMEOUTcyclesissue timeout: wid=…, PC=…, tmask=…, cycles=…, inuse={…}, then the instructionThe messages carry the same information as RTL. There is a minor divergence since thread masks print little-endian in SimX (
BitVectororder) while RTL prints big-endian, so each message clarifies.Both read
VX_DBG_STALL_TIMEOUTfromVX_config.h.Symptom
An example is that a cluster that can't be co-resident deadlocks, which is noted in
docs/designs/cta_dispatch_architecture.md§10.2. A one-line change totests/regression/cta_cluster/main.cppturns it into 2-warp CTAs, so aK = NUM_WARPScluster needs twice the core's warps:CONFIGS="-DVX_CFG_EXT_DXA_ENABLE" ./ci/blackbox.sh --driver=simx --app=cta_cluster[VXDRV] Warning: CP has not retired a command in 10sand spins until killed.VX_scheduler.sv:603: ... timeout: active_warps=1111, stalled_warps=1111. By default rtlsim prints only that line. Its per-warp detail requiresEXT_SCHED_TIMEOUT_DUMP, which dumps the per-warp PCs and thread masks that SimX prints unconditionally.Change
sim/simx/core.cpp:schedule(): counts consecutive cycles in whichactive_warps == stalled_warps(with at least one active warp) and aborts at the scheduler timeout, dumping every active warp. As inVX_scheduler.sv, the counter is armed by the first decode unlock, so cold-start fetch misses don't count. It resets when no warp is active or some warp is unstalled, andEXT_SCHED_STALL_TIMEOUToverrides the limit. Warps parked at a barrier are stalled so barrier deadlocks are caught.issue()(VX_scoreboard.sv): for each warp with a staged instruction, measures the wait frommax(last_issue_, ibuf_time)and aborts atVX_DBG_STALL_TIMEOUT. It fires on any reason the instruction can't issue, not only the scoreboard.The thresholds are the same as RTL, so anything that trips the SimX watchdog would also trip rtlsim's. Deliberate differences from RTL:
EXT_SCHED_TIMEOUT_DUMP.widfollowed by(issue<iw>, w=<w>).wis the slice-local index the RTL prints aswid=, andiwis the slice that the RTL carries in its instance path (g_slices[iw]).SIMULATION-only.Testing
xlen32, default 4x4 SimX:
cta_clusterchange above aborts as shown. Another non-co-resident cluster, 4 one-warp CTAs × 8 KB LMEM against a 16 KB LMEM, aborts withactive_warps=0011. In both cases the masks, PCs and thread masks match rtlsim's-DEXT_SCHED_TIMEOUT_DUMPoutput.pytest ci -m simx, 267 cases, xlen32): all 267 pass on thev3.0.1toolchain with the Vulkan host packages installed, and the watchdog fires on none of them.demo,sgemm,dotproduct,vecadd,sort,fence,diverge,sgemm2,conv3andcta_cluster(DXA) report identical instruction and cycle counts with and without the change, and none trips the watchdog.-DVX_DBG_STALL_TIMEOUT=40 -DEXT_SCHED_STALL_TIMEOUT=100000000,sgemmaborts on its inner-loop FMA waiting on the previous one (rd and rs3 =f15):VX_scoreboard.sv:257: Assertion failed in …g_scoreboard[0]: timeout: wid=0, PC=0x80000118, tmask=1111, cycles=40, inuse=0100 (#0).It trips on a different instruction because at a 40-cycle limit the first stall to cross it depends on cycle-level timing. uuids are only assigned in debug builds; release builds always set them to 0.