Skip to content

Autotune with fusion panics for output position out of bounds #5024

@laggui

Description

@laggui

Describe the bug

Fusion autotune panics for reduce:

2026-05-29T17:21:58.972579Z  INFO burn_train::learner::supervised::strategies::single::epoch: Executing training step for epoch 1
2026-05-29T17:21:58.972630Z  INFO bunsen_preview_chat_dataloader::arrow::parquet: Loading Parquet: "/media/Data/nanochat/shard_00016.parquet"
2026-05-29T17:21:58.997351Z  INFO burn_train::learner::supervised::strategies::single::epoch: Iteration 1
2026-05-29T17:21:59.001445Z  INFO cubecl_runtime::tune::tune_cache: Load autotune cache ...
2026-05-29T17:21:59.001544Z  INFO cubecl_runtime::tune::tune_cache: Loaded 0 autotune cached entries
2026-05-29T17:21:59.001556Z  INFO cubecl_runtime::tune::tuner: Tuning FusedReduceAutotuneKey - ReduceKey: ReduceAutotuneKey { elem_input: Float(F32), elem_output: Float(F32), elem_acc: Float(F32), axis_is_contiguous: true, vector_size: 1024, vector_count: 4096 }, FuseNumReads: 1, FuseNumWrites: 8, FuseNumOps: 8
2026-05-29T17:21:59.136427Z  INFO cubecl_runtime::tune::tune_cache: Load autotune cache ...
2026-05-29T17:21:59.136496Z  INFO cubecl_runtime::tune::tune_cache: Loaded 0 autotune cached entries
2026-05-29T17:21:59.136503Z  INFO cubecl_runtime::tune::tuner: Tuning ReduceAutotuneKey - ElemInput: Float(F32), ElemOutput: Float(F32), ElemAcc: Float(F32), AxisIsContiguous: true, VectorSize: 1024, VectorCount: 4096
2026-05-29T17:21:59.668041Z ERROR burn_train::learner::application_logger: PANIC => panicked at /home/crutcher/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/burn-cubecl-fusion-0.21.0/src/engine/codegen/ir.rs:500:63:
index out of bounds: the len is 1 but the index is 1

Somehow the registered output position is out of bounds in the global args?

To reproduce

you have to pick a data dir you can drop some shards in.

Expected behavior
Should executed successfully.

Additional context
Originally reported on discord.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfusion

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions