Skip to content

Commit

Permalink
bug[next]: Add assert for OOB access (#1571)
Browse files Browse the repository at this point in the history
In case a stencil contains an Out-Of-Bounds accesses the derivation of
the dtype in ITIR embedded can fail with an obscure error like
```
ValueError: DType 'DType(scalar_type=<class 'numpy.object_'>, tensor_shape=())' not supported.
```
This PR adds an assert to catch this earlier and fail more gracefully.
  • Loading branch information
tehrengruber committed Jul 5, 2024
1 parent 6bbedb1 commit 1ee610e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/gt4py/next/iterator/embedded.py
Original file line number Diff line number Diff line change
Expand Up @@ -1582,6 +1582,7 @@ def _get_output_type(
pos_in_domain = next(iter(_domain_iterator(domain)))
with embedded_context.new_context(closure_column_range=col_range) as ctx:
single_pos_result = ctx.run(_compute_at_position, fun, args, pos_in_domain, col_dim)
assert single_pos_result is not _UNDEFINED, "Stencil contains an Out-Of-Bound access."
dtype = _elem_dtype(single_pos_result)
return _structured_dtype_to_typespec(dtype)

Expand Down

0 comments on commit 1ee610e

Please sign in to comment.