This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Add a forward compatibility guard to writePropertiesSection
ClosedPublic

Authored by burmako on May 25 2023, 8:12 PM.

Details

Summary

Since https://reviews.llvm.org/D151065, we noticed that StableHLO forward compatibility tests (e.g. line #4 in https://github.com/openxla/stablehlo/blob/aac89de63ba020d26b7afad7af6b127e7184890c/stablehlo/tests/stablehlo_legalize_to_vhlo.0_9_0.mlir) started failing.

To reproduce:

  1. Change build_tools/llvm_version.txt to 837d1ce0dc8eec5b17255291b3462e6296cb369b.
  2. Build using instructions from README.md.
  3. Run tests using the same instructions.

The test failures are not super informative at the moment - they just say stuff like "Binary files ~/burmako/stablehlo/stablehlo/tests/stablehlo_legalize_to_vhlo.0_9_0.mlir.bc and /dev/fd/63 differ". However, further manual investigation via serializing stablehlo_legalize_to_vhlo.0_9_0.mlir at https://reviews.llvm.org/D151065 and then deserializing it at an earlier version of MLIR produces an actionable error message:

~/burmako/stablehlo_legalize_to_vhlo.0_9_0.mlirbc:0:0: error: invalid section ID: 8
~/burmako/stablehlo_legalize_to_vhlo.0_9_0.mlirbc:0:0: note: in bytecode version 0 produced by: StableHLO_v0.9.0

The fix appears to as easy as adding a config.bytecodeVersion guard around writePropertiesSection. I have verified that the failing StableHLO tests from above no longer fail with this patch.

We are planning to upstream our backward and forward compatibility tests in some form (we'll start a discussion on Discourse to align on details), but we didn't have the time for that yet. Looking forward to working on that in the near future.

Diff Detail

Event Timeline

burmako created this revision.May 25 2023, 8:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2023, 8:12 PM
burmako requested review of this revision.May 25 2023, 8:12 PM
mehdi_amini accepted this revision.May 25 2023, 8:27 PM
This revision is now accepted and ready to land.May 25 2023, 8:27 PM
jpienaar accepted this revision.May 25 2023, 8:31 PM

Thanks!

This revision was landed with ongoing or failed builds.May 25 2023, 8:32 PM
This revision was automatically updated to reflect the committed changes.