tracel-ai/burn · error

Input must be concrete

Error message

Input must be concrete

What it means

In the fused matmul's `global_view`, the tensor argument (`FuseArg`) must be a concrete `FuseArg::Input`; the kernel builds a `View` by indexing `inputs.tensors` by position, which only works for actual input tensors. Any other FuseArg variant (output, constant, etc.) cannot be viewed.

Source

Thrown at crates/burn-cubecl-fusion/src/optim/matmul/args.rs:253

    ) {
    }
}

#[cube]
#[allow(clippy::missing_transmute_annotations)]
fn global_view<E: CubePrimitive>(
    inputs: &GlobalArgs,
    locals: &LocalArgs,
    batch_shape: &Sequence<FastDivmod<u32>>,
    #[comptime] arg: MatmulArg,
    #[comptime] config: FuseBlockConfig,
    #[comptime] layout_config: GlobalLayoutConfig,
) -> View<'static, E, BatchedCoords> {
    let rank = comptime![config.rank];
    let data = comptime![arg.data().clone()];
    let data_tensor = match comptime![data.clone()] {
        FuseArg::Input(pos, ..) => inputs.tensors.index(pos),
        _ => panic!("Input must be concrete"),
    };

    let mut shape_row = data_tensor.tensor.shape(rank - 2) as u32;
    let mut shape_col = data_tensor.tensor.shape(rank - 1) as u32;
    let mut packing = comptime![1];

    if arg.scheme().is_some() {
        let scheme = arg.scheme().unwrap();
        let num_quants = scheme.num_quants() as u32;
        comptime![packing = num_quants];
        match comptime![layout_config.matrix_layout] {
            MatrixLayout::RowMajor => shape_col *= num_quants,
            MatrixLayout::ColMajor => shape_row *= num_quants,
        };
    }

    let shape = (shape_row, shape_col);

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Ensure all matmul operand args (lhs, rhs, acc) resolve to FuseArg::Input
  2. If you need an intermediate result as an operand, materialize it as a proper input tensor in the fusion graph
  3. Report a reproducible case to burn maintainers if triggered by standard APIs
Defensive patterns

Strategy: validation

Validate before calling

assert!(matches!(arg.data(), FuseArg::Input(..)), "matmul operand must be a fusion input tensor");

Type guard

fn is_input_arg(a: &FuseArg) -> bool { matches!(a, FuseArg::Input(..)) }

Prevention

When it happens

Trigger: Launching the fused matmul kernel with a matmul arg (lhs/rhs/acc) whose data is not `FuseArg::Input` — e.g. an output tensor or virtual arg passed where a concrete input is required.

Common situations: Writing custom fused matmul optimizations that wire an output as an operand; fusion graph construction bugs inside burn-cubecl-fusion.

Related errors


AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05). Data as JSON: /api/errors/9e76206ff406bcbe. Report an issue: GitHub.