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:
- Change build_tools/llvm_version.txt to 837d1ce0dc8eec5b17255291b3462e6296cb369b.
- Build using instructions from README.md.
- 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.