Skip to content

Raise TileTypeError for non-broadcastable shapes in where - #155

Open
M-Colley wants to merge 1 commit into
NVIDIA:mainfrom
M-Colley:fix/issue-121-where-broadcast-error
Open

M-Colley wants to merge 1 commit into
NVIDIA:mainfrom
M-Colley:fix/issue-121-where-broadcast-error

Conversation

@M-Colley

@M-Colley M-Colley commented Dec 2, 2026

Copy link
Copy Markdown

Description

ct.where delegates shape and dtype resolution to promote_types in src/cuda/tile/_ir/ops_utils.py. When operand or condition shapes cannot broadcast, broadcast_shapes2 raised an uncaught BroadcastError that the IR pass wrapper converted into TileInternalError. Closes #121.

This change catches BroadcastError in promote_types and raises TileTypeError (f"Shapes {s1} and {s2} are not broadcastable"), matching the binary operator diagnostic. In addition, test_where_non_broadcastable_shapes in test/test_select.py verifies TileTypeError for incompatible x/y shapes and incompatible cond shapes.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Signed-off-by: Mark Colley <39366189+M-Colley@users.noreply.github.com>
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]: ct.where with non-broadcastable x / y tiles raises InternalError instead of TypeCheckingError (1.8.0 fixed this for +, *, comparisons)

1 participant