Skip to content

feat(compile-hlo)!: strict-by-default conversion errors, indexSelect routing, createBasic parity (#1247) - #1248

Merged
michalharakal merged 1 commit into
developfrom
feat/1247-hlo-strict-conversion
Sep 2, 2026
Merged

michalharakal merged 1 commit into
developfrom
feat/1247-hlo-strict-conversion

Conversation

@michalharakal

Copy link
Copy Markdown
Contributor

Part of #1247 (the comment's ask 1: operand-linkage failures must be a hard error).

Converter failures were MLIR comments: a graph whose first node failed to lower cascaded through every downstream node and still emitted a compute-free module with an empty return and exit 0.

  • New ConversionErrorPolicy (default STRICT) on StableHloConverter and every factory entry point: an unconvertible node throws HloConversionException; ConversionContext.resolveOperands throws MissingOperandException instead of mapNotNull-dropping unresolved operands (which also shifted later operands into earlier positional slots — the gather cascade). LENIENT restores comment-and-continue.
  • GatherOperationsConverter routes indexSelect (the spelling the KSP tracing wrapper actually emits; only index_select was registered) — both in supportedOperations and the lowercased dispatch ("indexselect" ≠ "index_select").
  • createBasic registers NeuralNetOperationsConverter, at createExtended's relative position so last-writer-wins op-name precedence is unchanged.

Testing: new ConversionStrictnessTest (named-exception on unresolved producer, LENIENT drop/shift contract, strict throw on unknown op / Failure result, createBasic rmsNorm routing) + indexSelect case in GatherConverterTest. All 219 pre-existing module tests pass unchanged under STRICT; downstream skainet-test-java / skainet-io-iree-params suites green; apiDump updated.

Verified against the gemma3n repro (composite build, full E2B): the export now fails loudly at its first real gap — clamp has no converter at all (follow-up) — instead of emitting a 190+-arg module with exit 0, and the old first failure (n0_gather operand linkage) no longer occurs.

…routing, createBasic parity (#1247)

Converter failures were MLIR comments: a graph whose first node failed to
lower cascaded through every downstream node and still emitted a
compute-free module with an empty return and exit 0. Conversion now aborts
by default — ConversionErrorPolicy.STRICT throws HloConversionException on
any unconvertible node, and resolveOperands throws MissingOperandException
instead of silently dropping unresolved operands and shifting later ones
into earlier positional slots (the gather-cascade defect). LENIENT restores
the historical comment-and-continue behavior.

Also closes two registry gaps the gemma3n export tripped over: the KSP
tracing wrapper emits 'indexSelect' but only 'index_select' was routable,
and createBasic never registered NeuralNetOperationsConverter (registered
in createExtended's relative position so op-name precedence is unchanged).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@michalharakal
michalharakal merged commit 52c76f6 into develop Sep 2, 2026
14 checks passed
michalharakal added a commit that referenced this pull request Sep 2, 2026
…exception (#1247)

Written before #1248 made Failure results throw by default.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@michalharakal
michalharakal deleted the feat/1247-hlo-strict-conversion branch September 2, 2026 10:12
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.

1 participant