Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StableHLO Compatibility Tool #255

Closed
GleasonK opened this issue Oct 4, 2022 · 2 comments · Fixed by #278
Closed

StableHLO Compatibility Tool #255

GleasonK opened this issue Oct 4, 2022 · 2 comments · Fixed by #278
Assignees

Comments

@GleasonK
Copy link
Member

GleasonK commented Oct 4, 2022

Request description

Create a tool that allows maintenance of compatibility for changes within the StableHLO/CHLO dialects.

This will allow us to begin incorporating new ops, new op attributes/types, and op renames/moves into the StableHLO repo.

This tool will need to be accompanied by an adequate test infrastructure to detect incompatible changes.

@GleasonK
Copy link
Member Author

Tool/APIs are implemented in #278, but will be postponing full review. Primary focus is StableHLO Compatibility RFC v2 (#115) this week, since some implementation details may change as a result of recent compat feedback.

@GleasonK
Copy link
Member Author

Reworked #278 to match Compatibility RFC v2 (#115). Addressing feedback with the hopes of landing the PR this week. The initial implementation is landing with the VHLO versioned dialect and conversions between StableHLO <-> VLHO, and between versions of VHLO ops. After that, more evaluation will need to be put into a scalable test plan, enhancing user experience, and other minor finishing touches to make this tool production ready.

GleasonK added a commit that referenced this issue Dec 3, 2022
Add StableHLO compatibility dialect and passes for reading and writing with forward/backward compatibility guarantees.

**Note: This is still a prototype implementation and should not be used in production until RFCs have been approved and types have been forked.**

```bash
stablehlo-opt [flags] file.mlir
    --stablehlo-legalize-to-vhlo 
    --vhlo-to-version='target=[version]'    Translate versioned dialect to target version (current, 0.3.0, ...)
    --vhlo-legalize-to-stablehlo 
```

Change description:
- Introduce VHLO, the Versioned StableHLO Dialect.
  + This dialect is a shallow copy of StableHLO's in-memory layout. It does not include verifiers or constraints.
  + Once an op is added to VHLO it must remain unchanged so that it can be guaranteed that a VHLO op is identical across versions.
  + The first version of VHLO is `0.3.0`.
- Conversion passes for compatibility
  + StableHLO <--> VHLO legalizations. StableHLO is always able to be legalized to/from the latest version of VHLO.
  + VHLO-to-version. Target previous versions of VHLO ops for forward compatibility. Upgrade to the latest version of VHLO ops to emit StableHLO.
- Testing for legalizations and version conversions.

Future work (these items will be made into individual GH issues before submit):
- Think more about a scalable way to test this as StableHLO evolves.
- Additional feature work on the tool.. any missing flags? Pass pipeline for simplicity?
- Improve user experience.
- See open [compatibility issues](https://github.com/openxla/stablehlo/labels/Compatibility) 

Closes #255
GleasonK added a commit to GleasonK/stablehlo that referenced this issue Dec 6, 2022
Add StableHLO compatibility dialect and passes for reading and writing with forward/backward compatibility guarantees.

**Note: This is still a prototype implementation and should not be used in production until RFCs have been approved and types have been forked.**

```bash
stablehlo-opt [flags] file.mlir
    --stablehlo-legalize-to-vhlo 
    --vhlo-to-version='target=[version]'    Translate versioned dialect to target version (current, 0.3.0, ...)
    --vhlo-legalize-to-stablehlo 
```

Change description:
- Introduce VHLO, the Versioned StableHLO Dialect.
  + This dialect is a shallow copy of StableHLO's in-memory layout. It does not include verifiers or constraints.
  + Once an op is added to VHLO it must remain unchanged so that it can be guaranteed that a VHLO op is identical across versions.
  + The first version of VHLO is `0.3.0`.
- Conversion passes for compatibility
  + StableHLO <--> VHLO legalizations. StableHLO is always able to be legalized to/from the latest version of VHLO.
  + VHLO-to-version. Target previous versions of VHLO ops for forward compatibility. Upgrade to the latest version of VHLO ops to emit StableHLO.
- Testing for legalizations and version conversions.

Future work (these items will be made into individual GH issues before submit):
- Think more about a scalable way to test this as StableHLO evolves.
- Additional feature work on the tool.. any missing flags? Pass pipeline for simplicity?
- Improve user experience.
- See open [compatibility issues](https://github.com/openxla/stablehlo/labels/Compatibility) 

Closes openxla#255
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants