Skip to content

Add VHLO support for IREE - #16999

Merged
bviyer merged 27 commits into
iree-org:mainfrom
bviyer:balaji/331633589
Apr 24, 2024
Merged

bviyer merged 27 commits into
iree-org:mainfrom
bviyer:balaji/331633589

Conversation

@bviyer

@bviyer bviyer commented Apr 8, 2024

Copy link
Copy Markdown
Contributor

Added support to take in VHLO input. VHLO is converted to Stablehlo and then the StableHLO passes are run.

@MaheshRavishankar MaheshRavishankar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if we need to even have this in IREE? Can this be run somewhere before the IREE compilation kicks in? I think we decided that StableHLO is the surface are that IREE supports.

@jpienaar WDYT?

@ScottTodd ScottTodd added the integrations/stablehlo StableHLO (JAX/TensorFlow/etc) import and conversion label Apr 9, 2024
@ScottTodd

Copy link
Copy Markdown
Member

I am wondering if we need to even have this in IREE? Can this be run somewhere before the IREE compilation kicks in? I think we decided that StableHLO is the surface are that IREE supports.

@jpienaar WDYT?

My understanding of https://github.com/openxla/stablehlo/blob/main/docs/compatibility.md is that StableHLO itself is unstable (and it has broken compatibility multiple times recently). VHLO ("V" stands for "Versioned") has stronger compatibility properties - we'd accept VHLO and convert it to StableHLO (by "deserializing").

@MaheshRavishankar
MaheshRavishankar dismissed their stale review April 9, 2024 17:43

Defering to others.

@benvanik

Copy link
Copy Markdown
Collaborator

I think the issue with VHLO last we talked about it was that it didn't allow for custom ops in the way that was practically required so we didn't expect anyone to actually use it. @stellaraccident / @rsuderman may know more.

@stellaraccident

Copy link
Copy Markdown
Collaborator

I haven't been following it. But if people who are would like to have ingestion support for it, that makes sense to me. I think TF emits non VHLO ops so may not help there without more work, but that doesn't need to block this.

@bviyer
bviyer force-pushed the balaji/331633589 branch from 71e42f2 to 61708b4 Compare April 13, 2024 00:20
@jpienaar

Copy link
Copy Markdown
Member

I am wondering if we need to even have this in IREE? Can this be run somewhere before the IREE compilation kicks in? I think we decided that StableHLO is the surface are that IREE supports.
@jpienaar WDYT?

My understanding of https://github.com/openxla/stablehlo/blob/main/docs/compatibility.md is that StableHLO itself is unstable (and it has broken compatibility multiple times recently). VHLO ("V" stands for "Versioned") has stronger compatibility properties - we'd accept VHLO and convert it to StableHLO (by "deserializing").

Yeah if nothing else, this may be the only input type if one wants a decoupled input today. That being said, this conversion need not be cheap and enabling skipping it good.

bviyer added 3 commits April 16, 2024 17:01
Added support to take in VHLO input. VHLO is converted to Stablehlo
and then the StableHLO passes are run.
@bviyer
bviyer force-pushed the balaji/331633589 branch from 0efa82e to b36c955 Compare April 16, 2024 17:42
@bviyer
bviyer requested a review from pzread as a code owner April 17, 2024 00:24
@bviyer
bviyer requested review from jpienaar and kuhar April 18, 2024 19:03
@bviyer
bviyer force-pushed the balaji/331633589 branch from 1a800e4 to c357f30 Compare April 19, 2024 04:50
@bviyer
bviyer requested a review from kuhar April 23, 2024 18:32

@kuhar kuhar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the nice error message.

@bviyer
bviyer requested a review from ScottTodd April 23, 2024 21:20

@ScottTodd ScottTodd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good with a few commends addressed! Thanks for responding to the feedback!

// and VHLO in the same module causes undefined behavior. The pass below
// catches such scenarios and errors out.
passManager.addPass(stablehlo::createCheckVHLOStableHloMixUsage());
::mlir::stablehlo::createStablehloDeserializePipeline(passManager);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, do you know if we can use tools from StableHLO to serialize (not deserialize) our existing StableHLO MLIR test and model files from StableHLO to VHLO? We could keep testing both, but it would be nice to actually benefit from the "stable" part of the project name ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to convert a few stablehlo ops to vhlo (to understand what VHLO is and how it looks like) using the serialize function.

@bviyer
bviyer merged commit 38c0646 into iree-org:main Apr 24, 2024
@ScottTodd

Copy link
Copy Markdown
Member

ScottTodd added a commit that referenced this pull request Apr 24, 2024
ScottTodd added a commit that referenced this pull request Apr 24, 2024
Reverts #16999, since it breaks macOS and Windows compiler
builds.
LLITCHEV pushed a commit to LLITCHEV/iree that referenced this pull request Jul 30, 2024
Added support to take in VHLO input. VHLO is converted to Stablehlo and
then the StableHLO passes are run.

Signed-off-by: Lubo Litchev <[email protected]>
LLITCHEV pushed a commit to LLITCHEV/iree that referenced this pull request Jul 30, 2024
Reverts iree-org#16999, since it breaks macOS and Windows compiler
builds.

Signed-off-by: Lubo Litchev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integrations/stablehlo StableHLO (JAX/TensorFlow/etc) import and conversion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants