#5886·burn

vision: GPU connected_components never runs, plane-size gate rejects every device

Author: antimoraCreated Sep 28, 2026Updated Sep 29, 2026
Labelsbugperformance

The GPU path for connected_components / connected_components_with_stats never runs, on any cube backend. It always falls back to the CPU implementation, with a host round trip.

crates/burn-vision/src/backends/cube/connected_components/hardware_accelerated.rs:493-502:

rust
if props.plane_size_min == 32 && props.plane_size_max == 32 {
    return Err("Requires plane size of at least 32".into());
}
// Somehow the kernel doesn't work on AMD and Apple Silicon.
if props.plane_size_max != 32 {
    return Err("Requires plane size of at least 32".into());
}

The first check rejects exactly 32/32 (CUDA, Apple), and the second rejects everything else, so hardware_accelerated always returns Err. The callers in backends/cube/ops.rs:25,62 then use cpu::connected_components after reading the image back to the host. It has been like this since #3234; the comment suggests the kernel was being disabled on purpose, but the combined condition turns it off everywhere, including NVIDIA.

Either:

  • restore the intended gate (e.g. only plane_size_min == 32 && plane_size_max == 32) and check the kernel on CUDA; or
  • if it's known broken, remove the dead GPU path or make the fallback explicit, so it's clear the op runs on the CPU.