Skip to content

[FIX][LLVM] Emit Float6 literals as integer payloads - #247

Open
DiadkoShmek wants to merge 1 commit into
apache:mainfrom
DiadkoShmek:DiadkoShmek/fix-llvm-float6-literals
Open

DiadkoShmek wants to merge 1 commit into
apache:mainfrom
DiadkoShmek:DiadkoShmek/fix-llvm-float6-literals

Conversation

@DiadkoShmek

Copy link
Copy Markdown

Fixes #104.

The LLVM backend represents both Float6 formats as i6. Lowering a Float6 literal through ConstantFP therefore uses the wrong LLVM constant kind, even though the other arm of a Select has the correct TIRx dtype.

Convert the literal with the matching LLVM APFloat semantics using nearest-even rounding, then emit its bits as an integer constant. LLVM versions earlier than 19 do not have these APFloat formats, so report that limitation before materializing a constant.

The two Float6 regressions fail on the locally built base 6569e2a181d686b2e0d1ba36c84786ff7c449c2d with LLVM 19. On the rebuilt patch the compiled selects reproduce all 64 encodings and four midpoint checks per format, with exact results on the load arm too. The original typed tensor pattern was also checked with both branches on both formats. The final LLVM run passed 398 tests, including all 396 existing tests in the selected modules.

AI assistance (Codex) was used for the patch, tests, and verification.

Use nearest-even APFloat conversion and emit the six-bit payload as an LLVM integer constant, matching the representation of the other Select arm.

This branch has not been deployed

No deployments
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][Fuzz][LLVM] Float6 literal/load Select emits mismatched LLVM operand types

1 participant