You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add reinterpret as interface to bitcast, pack, and unpack (#238)
* Add `reinterpret` as interface to `bitcast`, `pack`, and `unpack`
* reinterpret: centralize validation in emit so invalid casts fail cleanly
The shape helpers and pack/unpack tfuncs ran inside the kernel-inferred
path, where two failure modes produced confusing errors:
- A tfunc returning `nothing` on an indivisible width left the result
untypable, surfacing downstream as `internal error: invalid terminators`.
- A `throw(ArgumentError(...))` in a shape helper became an unsupported
`String` in kernel IR (`format_string`/`unsupported String` error),
masking the intended message.
Make both layers total: pack/unpack tfuncs always return a concrete type
(via `fld`), and the shape helpers are pure arithmetic. Validation now
lives solely in the pack/unpack/reshape emit, which throws a clear
`IRError` (e.g. "unpack: 1 bytes do not evenly divide into Float32").
Valid reinterprets are unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* cleanup
* Make bytes in 2D narrowing test ascending
* Move `Base.reinterpret` methods to operations.jl
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments