Conversation
fuse_mlir() addressed the consolidated arena with a hardcoded bf16 itemsize and used it to type every operator's view too. Those coincide only while every buffer is bf16, so any non-bf16 operator's buffer got its element count halved and tripped the size assert -- including IRON's own uint8-input Dequant. subbuffer_layout already stores byte offsets/lengths, so the arena is now i8 and addressed directly, no divisor. Each buffer is viewed at its operator's declared type via memref.view (subview+reinterpret_cast cannot change element type), and the size assert compares bytes on both sides. Declared types are re-parsed in the building context -- MLIR rejects a result type built in a different one, part of why the hardcode went unnoticed. Sub-byte types are rejected, not rounded: no element count describes a packed nibble buffer. Test: iron/tests/infrastructure/sequence.py was 20F/50P before, 20F/60P after (10 new Dequant cases; same unrelated pre-existing failures). New test fuses Dequant (uint8 input) directly through fuse_mlir and checks the size assert no longer fires.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fuse_mlirtypes the consolidated arena bf16 and divides every byte offset and length bynp.dtype(ml_dtypes.bfloat16).itemsize:subbuffer_layoutalready stores byte offsets and lengths, so that divisor is correct only whileevery buffer in the sequence is bf16. Any other dtype has its element count silently halved -- a
576-byte uint8 buffer (Dequant's packed input) is declared as 288 elements.
Added
element_size_bytes(ty), the single owner of this seam's byte<->element rate. Sub-byte types are refused rather than rounded: packed nibbles plus interleaved scales are not a whole number of elements of any single type, so such a buffer must declare the byte type it occupies.iron/tests/infrastructure/element_size.py, covering integer widths, the float types, i4/i1 refusal, and that the error names the unsupported type.Changed
int8, so byte offsets and lengths pass through unscaled; each operator's view is typed from its own element type.Removed
ml_dtypesimport, whose last use byte-addressing removes.Verified on
27cf75d:pytest iron/tests/infrastructure/element_size.py-> 70 passed, device-free;black --checkclean;ruff checkreports no diagnostic thatdeveldoes not already report on thisfile.
PR Merge Checklist
develcommit and pointing todevel.