Skip to content

error message improvement for hl.tile([x]) #787

@shunting314

Description

@shunting314

For this kernel

@helion.kernel(use_default_config=True)
def helion_sum(x):
    m, n = x.shape
    y = torch.empty(m, device=x.device, dtype=x.dtype)

    for tile in hl.tile([m]):
        y[tile] = x[tile, :].sum(dim=-1)
    return y

Helion reports the following error:

  File "/home/shunting/ws/helion/helion/_compiler/type_propagation.py", line 481, in _device_indexing_size
    raise exc.OverpackedTile(k)
helion.exc.OverpackedTile: Got a tile wrapped inside a container when indexing a tensor: SequenceType((TileIndexType(0), ))
Did you mix up `hl.tile([x])` and `hl.tile(x)`?
While processing:
  File "/home/shunting/gws/tutor/helion/sum.py", line 11, in helion_sum
    y[tile] = x[tile, :].sum(dim=-1)
              ^^^^^^^^^^

The error message is clear about how to fix. But it's not clear why hl.tile should not talke [m] as argument while a tensor.shape is a valid input in 2D case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions