Separate the language Type from the ABI halide_type_t#9205
Separate the language Type from the ABI halide_type_t#9205alexreinking wants to merge 4 commits into
Conversation
0bd2e30 to
3f1f8c9
Compare
| std::scoped_lock lock(handle_type_intern_mutex()); | ||
| auto &table = handle_type_intern_table(); | ||
| internal_assert(index <= table.size()) << "invalid handle-type intern index"; | ||
| return table[index - 1]; |
There was a problem hiding this comment.
Wondering if we need to lock here
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9205 +/- ##
=======================================
Coverage ? 70.37%
=======================================
Files ? 255
Lines ? 78617
Branches ? 18809
=======================================
Hits ? 55323
Misses ? 17742
Partials ? 5552 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
8c26c6f to
89ab379
Compare
- ABI halide_type_t drops `lanes` -> {code, bits, reserved} (still 4 bytes;
halide_buffer_t layout unchanged). Halide::Type is decoupled and stores
its own fields; must be explicitly erased with `as_abi` (asserts scalar),
Trace event/packet carry their own `lanes`.
- Halide::Type is reduced to 8 bytes: the handle_type pointer is replaced
by a 4-byte index into a process-wide handle-type intern table.
- The IR matcher / constant folder uses Halide::Type directly; This keeps
handle C++-type metadata fidelity through matcher reconstruction.
- CodeGen intrinsic tables (ARM/X86/Hexagon/PowerPC/WebAssembly) use
Halide::Type.
- Added ostream operator<< support for halide_type_t directly.
Some open problems remain:
- d3d12 buffer element types treated as scalar (multi-channel texture format
selection is a follow-up).
- A few instances call for invalid/uninitialized `Type`s, which goes against
the overarching goal of making Type always coherent.
Fixes #9202
Fixes #9203
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
89ab379 to
cd20a61
Compare
IIRC, the no-scalar buffer formats would only be applicable in specific instances of vectorized inputs/outputs. |
I wonder whether they actually work on |
| /** Compare ordering of two types so they can be used in certain containers and algorithms */ | ||
| bool operator<(const Type &other) const { | ||
| if (type < other.type) { | ||
| if (std::tie(type_code, type_bits, type_lanes) < |
lanes-> {code, bits, reserved} (still 4 bytes; halide_buffer_t layout unchanged). Halide::Type is decoupled and stores its own fields; must be explicitly erased withas_abi(asserts scalar), Trace event/packet carry their ownlanes.Some open problems remain:
Fixes #9202
Fixes #9203
Breaking changes
The
Typeandhalide_type_targuments have been significantly reworked. This is both an ABI and an API break.Checklist