Skip to content

Kab1r/wgslbug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WGSL Bug

@group(0)
@binding(0)
var<storage, read_write> flow: array<u32, 2>;

@compute
@workgroup_size(1)
fn main() {
    var LOOP_COUNTER: u32 = 0u;
    loop {
        (flow)[0u] += 1u;
        if (LOOP_COUNTER >= 1u) {
            (flow)[1u] += 1u;
            break;
        }
        LOOP_COUNTER += 1u;
    }
}

Expected output is [2, 1] after executing break statement in second iteration of loop.

Results

/<><><><><><><>
VendorGPUDawn Vulkan LinuxwGPU Vulkan LinuxDawn Vulkan WindowswGPU Vulkan WindowsDawn DX12 WindowswGPU DX12 Windows
NvidiaRTX 2060 Max-QTimeoutND[fn:1]Zeros[fn:2]Zeros[fn:2]CorrectCorrect
NvidiaRTX 2060 SuperTimeoutND[fn:1]Zeros[fn:2]CorrectCorrect
NvidiaGTX 1050 TiTimeoutCorrectZeros[fn:2]CorrectCorrectCorrect
NvidiaQuadro 4000CorrectCorrect
AMDRyzen 9 4900HS (iGPU)CorrectCorrect
Inteli7-9700K (iGPU)CorrectInconsistent[fn:3]
Inteli5-7400 (iGPU)CorrectCorrect

[fn:1] Non Deterministic results where the first element is large and the second element is zero; produces correct result if either of the flow increments are removed.

[fn:2] Output is [0, 0], presumed to be as a result of a timeout.

[fn:3] Sometimes produces correct output, other times produces [0, 0] without timing out.