Skip to content

Feature/dxa overlap - #502

Open
jel221 wants to merge 2 commits into
masterfrom
feature/dxa-overlap
Open

jel221 wants to merge 2 commits into
masterfrom
feature/dxa-overlap

Conversation

@jel221

@jel221 jel221 commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Human comment:
IMPORTANT: This is something added on TOP of the TMEM branch, so ideally that should be added before this one.

In the new profiles you created like h100, the modeled memory latency is a lot bigger than the default. This makes the DXA the bottleneck for WGMMA/TMEM. So first, the number of in flight DXA transfers is sized as a function of the memory latency and BW. Also, the DXA doesn't need to complete requests in-order.

Lastly, there's a b200-like profile in there. This is a push on TOP of the TMEM PR, so I added it so that I can see how TMEM behaves under that profile.

AI-generated comment:

DXA: overlapping transfers, latency-sized read window, read slots and transfer contexts in RAM; B200 profile

Builds on #495 (feature/tmem-dataflow); the diff against that branch is the DXA change and the B200 profile.

A DXA worker used to run one transfer at a time with at most VX_CFG_DXA_MAX_INFLIGHT = 8 line reads in flight. Each transfer therefore cost a full memory round trip plus its drain, and behind a long memory latency the read window, not the tensor core, set the speed of DXA-fed kernels.

What changes

  • Overlapping transfers. A worker starts issuing the next transfer while earlier ones drain. A new transfer table (VX_dxa_xfer_table.sv) holds each transfer's context and counts its lines still to be written. A transfer completes when its last line lands, whichever line that is, so transfers can complete out of order. The SMEM writer's deferred last-line register is gone.

  • Read window sized from the configuration. The in-flight reads per worker follow Little's law, as the cache MSHRs do:

    VX_CFG_DXA_MAX_INFLIGHT = clamp(pow2_up(min(
          DXA's share of memory bytes in flight / line size,   // BW/clock × (mem latency + 2 × L2 link) / (cores × workers × line)
          mem latency + 2 × L2 link latency)), 8, 512)          // a worker issues at most one line per cycle
    VX_CFG_DXA_MAX_XFERS    = clamp(MAX_INFLIGHT / 16, 2, 16)
    
    Configuration Reads in flight Transfers
    Default (platform latency 0) 8 2
    H100 memory: 304 + 2 × 94 cycles, 3.35 TB/s, 1,980 MHz, 132 cores 128 8
    B200 memory: 445 + 2 × 102 cycles, 8 TB/s, 1,980 MHz, 148 cores 512 16
  • Read slots and transfer contexts in RAM. Read slots and tags come from a RAM and a free-list FIFO (block RAM at large windows). The transfer contexts sit in a RAM read one cycle ahead, so no cycle is added. The few fields needed as a line arrives sit in a small LUTRAM.

  • SimX: the DXA model follows the RTL. Separately, SimX's local memory now sleeps only when no request is queued toward it. Before, a request placed in the same cycle could wait for a later wake-up. This can make SimX slightly faster for any shared-memory kernel; RTL is unchanged.

  • B200 profile (profiles/b200.json): XLEN=32, 148 cores, TMEM (512 columns), FEDP2K, MX/FP4. It is here, on top of Tensor accumulator take 2 #495, to show how TMEM behaves under a Blackwell-like machine. Its L1, L2 and DRAM latencies are calibrated with ci/profile_check.py to the measured B200 values (39, 296 and 824 cycles). The B200 row of the sizing table and the 445-cycle runs below come from it.

Unchanged: the ISA, the descriptor format, expect_tx (still counts transfers) and the barrier path. No kernel changes.

Performance

Perf gates (rtlsim, default configuration, re-recorded):

Gate Before After Change
perf_gate-tmem 42,569 38,228 −10.2%
wgmma-sp-dxa 47,359 44,695 −5.6%
wgmma-dxa 28,003 26,903 −3.9%
wgmma-dxa-mcast-nt16 79,428 77,303 −2.7%
copy-nt16 1,829 1,795 −1.9%
sgemm2-dxa-mcast-nt4 9,969,042 9,923,859 −0.5%
wgmma-dxa-mcast-nt4 355,108 353,734 −0.4%
sgemm2-dxa-nt4 8,921,139 8,901,090 −0.2%
sgemm2-dxa-nt16 2,265,324 2,262,127 −0.1%
sgemm2-dxa-mcast-nt16 9,937,880 9,923,748 −0.1%
copy-mcast 3,437 3,439 +0.1%
copy-nt4 unchanged

The default configuration has no platform memory latency, so its window stays at 8 reads. The gains above come from overlapping transfers only.

Behind a real memory latency (rtlsim). These runs use the default 1-core model plus -DVX_CFG_PLATFORM_MEMORY_LATENCY=445, B200's DRAM latency. Both kernels use the same configuration: NT=8, 16 warps, issue width 4, FEDP2K, fp16 → fp32. At this latency the new DXA sizes itself to 512 reads and 16 transfers; the old one stays at 8 reads.

Kernel, 128×128×128 Before After Speedup
TMEM GEMM (sgemm_tcu_tmem) 977,073 67,849 14.4×
WGMMA GEMM (sgemm_tcu_wg_dxa, WGMMA_NRC=32) 676,142 115,289 5.9×
  • Each pair executes the same instructions (TMEM 20,080; WGMMA 50,576), so the gain is all in waiting on memory.
  • With the old DXA, TMEM was slower than WGMMA at this latency (977K vs 676K cycles): it is more DXA-bound. With the new DXA, TMEM is 1.7× faster than WGMMA, close to the 2.4× Tensor accumulator take 2 #495 measured at the default latency.

Area (Beacon, dxa DUT: NT=16, 16 warps)

Build Window LUT FF LUTRAM Block RAM Logic levels
Before (#495) 8 reads, 1 transfer 10,686 9,328 568 0 15
After, default 8 reads, 2 transfers 9,942 (−7.0%) 8,213 (−12.0%) 753 0 15
After, H100-sized 128 reads, 8 transfers 10,184 (−4.7%) 8,333 (−10.7%) 746 1
After, B200-sized 512 reads, 16 transfers 10,623 (−0.6%) 8,489 (−9.0%) 714 2
  • The default build is smaller than before. Removing the writer's deferred line register saves more than the transfer table costs.
  • A 512-read window costs about 700 LUTs over the default. The read slots and tag FIFOs go into block RAM, and the contexts into LUTRAM. With the 16 contexts still in flip-flops (an earlier revision of this change), the same window measured 13,824 LUT and 11,973 FF.
  • LUTRAM goes up (568 → 753) because the contexts now live in it. The DXA logic-gate baseline is re-recorded for this.
  • Logic depth: smem_wr goes from 15 to 13 levels and gmem_req from 9 to 8. The DXA's worst path stays at 15.

Tests

  • New parity case model_parity-tmem-lat300 (dxa.yaml): TMEM GEMM 64×64×256, 2 CTAs, 300-cycle memory latency, so several transfers overlap.
  • Perf baselines re-recorded for the 12 DXA and TMEM gates with pytest ci -m perf_gate -k 'dxa or tmem' --update-baselines. Every perf gate runs on rtlsim, and builds without the DXA are unchanged, so the other gates keep their baselines.
  • DXA logic-gate baseline re-recorded with ci/logic_gate.py -b dxa --update-baseline.

@jel221
jel221 requested a review from symmetryyyyy November 22, 2026 23:46
@jel221
jel221 force-pushed the feature/dxa-overlap branch from 6fd23e4 to 35b6554 Compare November 23, 2026 02:42
….cp/tc.commit, tmem.ld/st, tmem.alloc/dealloc), with VX_CFG_TCU_WMMA_ENABLE; perf baselines re-recorded with pytest ci -m perf_gate --update-baselines, Beacon baselines with ci/logic_gate.py --update-baseline [--tool beacon_asic] --against-rev 1061088
… x bandwidth, keep read slots and transfer contexts in RAM; add the B200 profile; perf baselines re-recorded with pytest ci -m perf_gate --update-baselines (DXA/TMEM cycles move, the rest only take the new config hash), Beacon dxa/tensor baselines with ci/logic_gate.py --update-baseline --against-rev 1061088
@jel221
jel221 force-pushed the feature/dxa-overlap branch from 35b6554 to 42f7aa5 Compare November 23, 2026 10:32

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant