ATOMG, ATOMG.NOU and RED: NAK's OpAtom on global memory, AtomicOpcode's operation at 87-90, the data at 32; RED returns nothing. Of type 3 (F32, .FTZ.RN) the ADD alone, AtomicFAdd: one game's compute programs sum positions into a buffer with RED.E.ADD.F32.FTZ.RN
function Atomg(red : bool, uniform_form : bool) -> unit = {
let how = if red then UInt(Field(87, 3)) else UInt(Field(87, 4));
let kind = UInt(Field(73, 3));
let opcode = AtomicOpcode(kind, how);
let fadd = kind == 3 & how == 0;
if opcode == 0 & not_bool(fadd) then throw(Unsupported("%s of type %u, operation %u", OpName(), kind, how));
if AddressFromMemory() then GlobalDynamic(2, opcode, if fadd then 1 else 0) else {
let buffer = GlobalAddress(if uniform_form then 1 else 0, 1);
if buffer != 0 then {
MarkRead();
MarkWritten(4);
let old = if fadd then AtomicFAdd(buffer, R_read(UInt(Field(32, 8))))
else AtomicU32(opcode, buffer, R_read(UInt(Field(32, 8))));
if not_bool(red) then R_write(Dst(), old)
}
}
}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.