Skip to content

VX_fpu_fpnew completes the group on lane 0's handshake, so other lanes can return zero #437

Closed

Description

@docluka77

Hello,

Thank you for maintaining Vortex. I have been using it as a second GPU target.

I would like to report a handshake problem in VX_fpu_fpnew that produces zero results in lanes other than the one that releases the group. It is reproducible with a small directed test. I am currently requesting a CVE ID for it through MITRE in its role as CNA of Last Resort, which asks for an issue link for tracking; CWE-1298 is a suggested mapping, and the CNA decides whether it qualifies. I would rather have your assessment first and will follow whatever timeline you prefer.

What the RTL does
VX_fpu_fpnew instantiates one fpnew_top per lane inside the generate loop at line 198 (the instance itself is at line 208), but the wrapper takes the group's response handshake, tag, exception flags and input ready from lane 0 only, inside the if (i == 0) block at lines 236 to 241:

// abridged: port list shortened, control flow unchanged; label spelling as in the tree
for (genvar i = 0; i < NUM_LANES; ++i) begin : g_fpnew_coreses
fpnew_top ... (.in_valid_i(fpu_valid_in), .in_ready_o(fpu_ready_in_uq),
.result_o(fpu_result[i]), .out_valid_o(fpu_valid_out_uq),
.out_ready_i(fpu_ready_out), .status_o(fpu_status_uq));
if (i == 0) begin : g_output_0
assign {fpu_tag_out, fpu_has_fflags_out} = fpu_tag;
assign fpu_valid_out = fpu_valid_out_uq;
assign fpu_ready_in = fpu_ready_in_uq;
assign fpu_status = fpu_status_uq;
end
end

Two things then hold at once. The group is released by lane 0's out_valid, and every lane sees the same downstream out_ready_i (line 232). DIVSQRT is configured as MERGED with a distributed pipeline, so per-lane latency depends on the operands and the lanes do not finish together. A lane that finishes before lane 0 can therefore complete its own handshake while the group is still open, and a lane still running when lane 0 releases the group is read before it has produced anything. In both cases the final result observed for that lane is zero. I have not instrumented the buffer itself, so the step from the early release to that zero is inferred from the RTL and from the symptom, not traced.

mask_in is declared at line 35 and marked unused at line 197 (UNUSED_VAR), so masking lane 0 does not suppress the early release either.

Line numbers follow master at 2026-10-27 (265 lines). The measured commit b8c5a24 carries the same code at 165, 166 and 204 to 208; only the offsets differ, the structure is identical.

What I measured
Configuration: upstream commit b8c5a24, XLEN 64, 8 lanes, 4 warps, FPnew backend. The RTL above is unchanged on master.

11-case directed suite: SimX 0 mismatches, the default DPI FPU backend 0 mismatches, and 16 mismatches on the FPnew backend
of those 16: 13 zero results in lanes other than the releasing one (cases B, C, D, F and G), 1 NaN-boxing difference (case I), and 2 exception-flag differences (cases J and K)
32-program campaign, 22,564 div/sqrt issues: the bound property (out_valid && out_ready) |-> (&lane_valid) fails 6,352 times. The property is written over all lanes; for a masked group it should be read as &(lane_valid | ~mask), which is the form used in the suggestion.
in a separate run of the same campaign with an experimental wrapper that waits for every active lane: 0 failures over 22,516 issues. Re-running the directed suite under the same wrapper also removes the 13 zero results. The two campaign runs are not event-paired; the wrapper changes when a group retires, so the issue count differs slightly.
The two directions both appear in the suite, which is why I read this as an asymmetric handshake rather than simply "lane 0 is early". In cases B, D, F and G the releasing lane is the fast one — a special-value divide in B, F and G, a masked lane holding 0/0 in D — and lanes 1 to 3 come back zero. In case C it is the reverse: lane 0 computes an ordinary divide, lane 2 computes x/0 and completes first, and it is lane 2 that comes back zero instead of +inf.

Suggested direction
Aggregate the active lanes instead of trusting lane 0. This is a direction, not a complete patch: the mask must belong to the in-flight instruction, the fast lanes' results have to be held, and the input side must not accept a new group while the current one is still open. The aggregate on its own is not enough: every lane sees the same downstream out_ready_i, so a fast lane would complete its own handshake and drop its valid before the group is complete, and the aggregate would never be asserted. The ready path has to be gated as well, for example:

assign fpu_valid_out = &(fpu_valid_out_vec | ~mask_in);

with each lane's out_ready_i held low until the aggregated group valid is asserted, and fpu_ready_in taken from the AND of the active per-lane in_ready_o. Small per-lane skid buffers are the alternative if the extra latency is not acceptable. This is the form I tested, as an experiment; I am not proposing it as the final fix.

Scope
This report covers the handshake defect only. I do see numerical differences on a different fixture, but I have not traced their cause and they are outside this report.

Reachability: the defect is reachable from ordinary user-mode code — no privileged access, no timing manipulation, and no fault injection. The div/sqrt operand values alone determine each lane's completion latency relative to lane 0, and therefore whether non-zero lanes finish too late (still in flight when lane 0 releases the group, as in Cases B, D, F, and G) or too early (retiring before lane 0 releases the group, as in Case C) and are read back as zero. A caller that supplies or influences div/sqrt operands can therefore deterministically select which non-zero lanes are corrupted.

For operand combinations where lane 0 itself raises no IEEE exception (for example, 0.0 / 2.0 in Case B, or ordinary operands in lane 0 with a faster lane elsewhere as in Case C), the corruption is silent and deterministic: no trap, exception, or fflags bit reaches the caller, so a downstream consumer cannot distinguish a zeroed lane from a valid result. That operand-controlled, silent replacement of non-zero lane outputs with zero is what separates this from an ordinary rounding or precision error.

The 11-case test, the traces and the experimental patch are available, and I am happy to send them in whatever form is convenient.

Thank you for your time.

Best regards,
Yiran He
University of Chinese Academy of Sciences

Activity

  1. tinebp commented on Nov 19, 2026

    @tinebp
    Collaborator

    Fixed by #486.

  2. docluka77 commented on Nov 20, 2026

    @docluka77
    Author

    Hi,

    Thanks for #486 — separating the fixed-latency lockstep path from the fork/join div/sqrt path addresses the handshake defect directly, and catching the shared fflags accumulator and STD/DSP unboxing issues in the same pass is a nice bonus.

    I just re-ran my directed tests against PR #486 (a99ecc7c, Verilator 5.050, XLEN 64) in an identical before/after RTL comparison (reverting only hw/rtl/fpu/ from #486 for the baseline):

    • 11-case FPnew lane suite (fpnew_lanes, 4 active threads): 16 mismatches before #486 -> 0 mismatches on #486 (33/33 checks ok), including reverse Case C (lane 2 x/0 finishing ahead of lane 0), masked lane 0 (Cases D/E/K), fflags (Cases J/K), and NaN-boxing (Case I). Also 0 mismatches on 8-thread/8-lane (4 active threads in an 8-lane warp) and 4-thread/2-FPU-lane partial-bandwidth builds.
    • 26-case F32 NaN-boxing suite: 2 mismatches on FPnew and 10 on STD before #486 -> 0 mismatches across SimX, DPI, FPnew, STD, and DSP on #486 (26/26 ok).

    One administrative question, and please feel free to say no.

    When I filed #437 I noted that I was requesting a CVE through MITRE as CNA of Last Resort. Before going further on the MITRE side, I wanted to ask about a cleaner option: since GitHub is itself a CNA, a repository security advisory (created under the Security tab once #486 is merged, with a CVE requested from the draft) is typically reviewed by GitHub in about 72 hours. The CVE then attaches cleanly to the project rather than sitting as a free-floating MITRE record.

    Two things worth weighing before you decide:

    If you do want to go the advisory route, I can share the draft text — impact statement, affected and patched ranges, CVSS vector, and CWE mapping — so the only work left for you is review and publish. Say the word and it is yours to edit.

    Either way, thank you for taking the report seriously and for the fix.

    Best,
    Yiran He
    University of Chinese Academy of Sciences

  3. added a commit that references this issue on Nov 23, 2026
    aec8d04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions