Repository navigation
TFU timing fix - #584
Open
jel221 wants to merge 2 commits into
Open
TFU timing fix#584jel221 wants to merge 2 commits into
jel221 wants to merge 2 commits into
Conversation
The PE's two deepest paths were not the polynomial: stage 1 was the ex2
and sin/cos range reduction (a subtract, compares and two barrel shifts,
then a full-width negate or add), and stage 5 was the lg2 sum followed by
a 41-bit add and a 40-bit negate in series. Beacon put the tfu DUT at 24
logic levels and a core with the TFU at 23, against 15 for the rest of
the core.
- ex2 and sin/cos share one shift of x_sig by x_e - 96, which over the
exponents that matter is {x_e[7], x_e[4:0]}: no subtract, no compare.
- The ex2 negation becomes ~mag; its +1 is registered as two carries and
applied in stage 2 (6-bit index, 18-bit fraction, exponent).
- The sin/cos exact +-1 test uses the registered ~idx/~xl in stage 2;
only u[5:0] is tested in stage 1. The cos phase is two XORs.
- lg2 sums k * 2^30 + p and its negation in parallel instead of
negating after the sum.
Results stay bit-identical to sw/common/tfu.cpp and the pipeline stays
7 stages, so SimX, cycles and perf baselines do not move. Beacon: tfu
24 -> 13 levels; 8-thread 16-warp core with TFU 23 -> 15. ASIC: Beacon
913 -> 1239 MHz, Yosys/STA 1055 -> 1252 MHz.
gate_asic judges tfu IMPROVED after the PE path rework (cells 15150 -> 14074, -7.1%, past the 5% band), so the win is recorded to lock it in. Fmax 913.2 -> 1239.2 MHz, 36 -> 24 stages, flip-flops 1813 -> 1816. Command: ci/logic_gate.py --tool beacon_asic -b tfu --update-baseline (beacon 134d03b9e, CIRCT 90c5fd313, TOOLCHAIN_REV v3.0.4). Re-recorded by: agent, authorized by jel221 2026-12-03.
jel221
marked this pull request as ready for review
December 3, 2026 21:51
This was referenced Dec 4, 2026
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.
Human comment: fixing TFU timing
Summary
The TFU PE's two deepest paths were not in the table or polynomial math:
The rest of the core is 15 levels deep (the LSU).
This PR shortens both paths. Results stay bit-identical and the pipeline stays 7 stages. Everything is in
VX_tfu_pe.sv:x_sig * 2^(x_e - 96)overx_ein [96, 159]. On that range the shift amount is just{x_e[7], x_e[4:0]}, so there is no subtract and no compare. Outside that range the result is 0, as before.~magand two carries. Stage 2 adds them to the 18-bit fraction, the 6-bit table index and the exponent, in front of the ROM.u[29:6] == 0part reads the registered~idx/~xl, and stage 1 tests onlyu[5:0]. The cos phase offset becomes two XORs.k·2^30 + pand its negation are each one sum of the polynomial terms, computed in parallel and selected by sign.Everything that reaches the result is the same function of the input, so SimX, cycle counts and perf baselines do not move.
Why now: Vivado already closes the
tfuDUT at 317.9 MHz against its 300 MHz target. The gain is ASIC Fmax, where the TFU is the slowest unit in the ASIC baselines, plus FPGA margin for every configuration that enables the TFU.Results
tfuDUT (16 threads), max levelstfuLUT / FFgate_asic(Beacon ASAP7)tfuFmaxgate_asiccells / FFsasic_gate(Yosys + OpenSTA)tfuFmaxasic_gatearea / powerfpga_gate(Vivado 2024.2, U55C, 300 MHz)tfuFmax / LUT / FFAfter the change, the TFU's worst Vivado path is a one-level enable net in the lane serializer, not the PE. Vivado's flip-flop count rises by 112 even though the RTL adds only 3 registers (Beacon: 1,813 → 1,816). Over the same build, Vivado's LUT-RAM count, which includes shift-register LUTs, falls from 64 to 41. So most likely about 23 shift-register LUTs in the serializer's delay line are now built from flip-flops instead. The ASIC area is under the 2,073 µm² budget. The +12% power comes from the second parallel sum in stage 5 and the stage-2 carry logic, measured at the gate's fixed clock.
Baseline re-record
gate_asicjudgestfuIMPROVED, because cells moved −7%, past its ±5% band. That fails until the baseline records the gain. The second commit re-recordsci/baselines/synthesis/beacon_asic/tfu.jsonwithci/logic_gate.py --tool beacon_asic -b tfu --update-baseline, on the CI toolchain pin (TOOLCHAIN_REV). It was run by the agent and authorized by jel221. No other baseline moves.Impact and evidence
Impact class: R2 (
path:rtl,evidence:simx-rtl-lockstep; fromci/change_impact.py). The lockstep warning is covered by the parity row below: cycles are identical, so no SimX change is needed.Contracts touched: none
hw/unittest/tfu_unit(RTL vssw/common/tfu.cpp, bit-exact): default sweep (659k checks) and a stride-17 sweep of all 2^32 inputs per function plus 4M random (1,772,516,204 checks), 0 errors.tfuapp (checks every result against the golden model), all PASSED: simx default; rtlsim default,-DVX_CFG_NUM_THREADS=16 -DVX_CFG_NUM_WARPS=16,-DVX_CFG_NUM_TFU_LANES=4. xrt not run (no card used).model_parityparity-tfu,parity-tfu-nt8,parity-tfu-nt16shapes on rtlsim with this PE and with master's PE: identical instructions and cycles (612,647 / 544,839 / 531,120). SimX against them: 612,634 / 545,141 / 531,056, gap ≤ 0.06%.perf_gatelogic_gatetfuDUT and an NT8/16-warp core withVX_CFG_EXT_TFU_ENABLE, before/after above; no unit deeper. The defaultlogic_gatebuilds do not enable the TFU.fpga_gate/asic_gate)fpga_gate -b tfu,asic_gate -b tfu,logic_gate --tool beacon_asic -b tfu(results above)Self-check:
ci/precheck.shsummary: precheck: 7 pass, 0 with findings, 0 fail, 0 not runDepartures from SHOULD rules: none
Design note: n/a
known_issue:, wider tolerance, smaller args, removed case) without a root-cause plan.