Skip to content

Conversation

Lunderberg
Copy link
Contributor

Prior to this commit, the axis_separators field of a TIR buffer wasn't validated until the tir.FlattenBuffer legalization pass. Delaying the error until this point makes it difficult to determine where it invalid axis_separators were initially defined.

This commit updates the tir::Buffer constructor to validate the axis_separators field immediately, allowing these invalid values to be caught on construction.

Closes #17215

Prior to this commit, the `axis_separators` field of a TIR buffer
wasn't validated until the `tir.FlattenBuffer` legalization pass.
Delaying the error until this point makes it difficult to determine
where it invalid `axis_separators` were initially defined.

This commit updates the `tir::Buffer` constructor to validate the
`axis_separators` field immediately, allowing these invalid values to
be caught on construction.

Closes apache#17215
@Lunderberg
Copy link
Contributor Author

And it was definitely good to move the validation, as it exposed an inconsistency in how the metaschedule sch.set_axis_separator gets applied. When applied to a buffer view, which may have different extents/dimensionality than the backing allocation, it could produce a buffer with invalid axis_separators for its shape.

Copy link
Contributor

@quic-sanirudh quic-sanirudh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, apart from a small doubt about expected use case.

@quic-sanirudh quic-sanirudh merged commit bd7f1f8 into apache:main Aug 5, 2024
@Lunderberg Lunderberg deleted the tir_validate_axis_separators_on_buffer_construction branch August 5, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [Relax] InternalError: Check failed: last_sep < self->shape.size() Last output axis must contain at least one input axis

2 participants