some notes on asynchronous instruction / correctness tracking
tracking program 'correctness' of gpus stems from the fact we have many different threads sharing program memory spaces^1 ( on nvidia blackwell / rubin, each thread has access to a local register space, parameter space , shared register mem , shared mem , global mem , and tensor mem ). with multiple accesses to the shared spaces (smem , tmem , gmem, and rmem at a warp level ), we get read after write (raw) , write after read (war ) , and write after write (waw ) conflicts from one thread to another .
This modular blog post explains this quite well .
https://www.modular.com/blog/software-pipelining-for-gpu-kernels-part-1-the-pipeline-problem
conflicts are local only to the shared access of the memory each threads are accessing, so correctness needs to track conflicts with respect to the cells they actually touch only , or we risk oversynchronizing
( early 2026 llms -
syncthreads();
syncthreadsagain();
syncdatacenter();
syncwarp();
syncelectricitygrids();
syncthreadsagainjustincase();
) .
war / waw are synchronization conflicts - the writing thread needs to ensure it is not overwriting before the other thread has read/ written the same mem area. we can represent these generically with signal() and wait() , and each instantiated counter being explicitly referenceable throughout . brief example -
sync threads - 1 signal(&all_ithreads(new_counter) + 1) 2 wait(@1(new_counter) - 1)
& makes a new counter shared by every ithread, and @1 refers to the counter made by row 1 - so every thread adds 1, then waits until all of them have.
raw is a sync + also a mem ordering problem . by ordering , both threads need to share the same local view of the memspace where the conflict is. because of non deterministic instruction order, threads have different local views of the global memspaces at what are, in execution order programmatically equivalent times. many of the weird looking semantics in the ptx isa, i.e , fence/ proxy / acquire / relax / release, relate to terminology about ordering.
for raw , the read thread needs to ensure it 'acquires' in ptx terms, a reference of the write threads local view of the memstate it writes before reading the overlapping mem cells, or we risk reading stale data. snapshot() captures a threads view , and publish() releases this to another thread, with optional memspace tagging of the space we tag.
op types are either synchronous ( ordered with respect to future ops in their thread ) , asynchronous ( not ordered ) , or fifo conditional ( ordered with respect to some or not others, and async , like the tcgen pipeline ops ) . For my version , we split ops up into registries that map there specific dataflow and async primitive effects , and then cross check these against the imported source.
Actually capturing this, we need to model ptx / whatever language in a replay form that allows us to explicitly query every distinct point along every thread / execution track or , another way , we need to be able to view for every op , its sync / visibility relation with all of its neighbouring ops (neighbouring = same cell access ) .
We also need a way of verifying that data dependent addressing is manageable - in practice , most kernels that appear to have dda usually can be tracked to a similar static shape ( sparse gathers reliably follow the same replay format, persistent fixed weights allow reliable moe decode, e.t.c) . this can probably be improved to allow more advanced tracking / equivalence so long as certain conditions are met, but , for now , we need the tracker to prove equivalent shapes to a mappable static graph .
once we actually have a dataflow op registry that describes each ops reads / writes, we need a memory tracker that derives all ops that share neighbouring reads / writes with other ops to have their war/waw/raw deps derived, and output this in a .clobber file . we only need to track ops that actually have local accesses with respect to other ops for this .
overall , we go from src corpus , -> raw ptx form -> replay form -> registries form -> clobber analysis -> final per op analysis, and each step is queryable along the way . The full steps for some corpus is baked in to a web cli, and a basic chat window. ( the chat can also run commands ) , and some example corpus that i got to lower thru this .
^1 because recent gpus / accelerators rely on executing on a tensor core that doesnt map neatly to one 'thread' model , i use vthread (virtual thread ) to describe a unique execution track - i.e , the tcgen pipeline , or asynchronous threads. ithreads is the physical execution thread ( instruction thread ) , that actually issues instructions, and carries all counters.