Skip to content

cubek-convolution: f16 1x1 conv returns wrong results when in_channels=96 and spatial positions >= 32768 #519

Description

@zachelnet

Describe the bug

On the wgpu backend (Vulkan, AMD RADV/RDNA4) a f16 1x1 convolution returns
numerically wrong results (not just rounded) for a specific shape: input
channels = 96 and H*W >= 32768. The same conv is bit-exact against a f32
reference for every other shape tested.

To Reproduce

// burn 0.21 / burn-wgpu Vulkan, Backend = Vulkan<f16>
let mut conv = Conv2dConfig::new([96, 48], [1, 1]).init(&device);
// load any f16 weights + bias, e.g. random normal(0, 0.08)
let x = /* [1, 96, 128, 256] f16 input */;
let out = conv.forward(x); // wrong: mean abs err ~1.0 vs f32 reference

Shapes that reproduce (f16): [1, 96, 128, 256] (N=32768), [1, 96, 240, 320]
(N=76800), [1, 96, 256, 256] (N=65536).
Shapes that are correct: [1, 96, 128, 128] (N=16384), and [1, K, 240, 320]
for K in {48, 64, 80, 97, 112, 128}.

Expected behavior

f16 conv with f32 accumulation should match the f32 reference to ~1 ULP,
independent of the shape.

Environment

  • burn / burn-wgpu / burn-cubecl 0.21.0, wgpu Vulkan on RADV
  • GPU: AMD RX 9070 XT (gfx1201)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions