Vote

sm86.sail

VOTE and UVOTE: NAK's OpVote, the ballot of the predicate at 87-90 into the destination, and ALL (0), ANY (1) or EQ (2, bits 72-73) of it into the predicate at 81-83. The ballot, and the vote, are of the invocation's 32 lanes, from the ballots of the predicate and of the active lanes: a vote of the subgroup takes both warps of a subgroup of 64

function Vote(u : bool) -> unit = {
    let pred = PredRead(UInt(Field(87, 3)), UInt(Field(90, 1)), 0);
    let how = UInt(Field(72, 2));
    if not_bool(Lone()) then Capability(64);
    let ballot = Ballot32(pred);
    if u then U_write(UInt(Field(16, 6)), ballot) else R_write(Dst(), ballot);
    if how > 2 then throw(Unsupported("VOTE mode %u", how));
    let active = Ballot32(true);
    let all = ballot == active;
    let none = ballot == 0x00000000;
    let vote = match how { 0 => all, 1 => not_bool(none), _ => all | none };
    PredWrite(UInt(Field(81, 3)), vote, if u then 1 else 0)
}

Used by


Made from ScarletNX's Sail at 166ad3910f80. The Sail and the encodings' file are ScarletNX's (GPL-3.0-or-later); its encodings are from Mesa's NAK (sm70_encode.rs, MIT) and CuAssembler's sm_86 records.