openxla / stablehlo

Backward compatible ML compute opset inspired by HLO/MHLO
Apache License 2.0
408 stars 112 forks source link

Add C++/Python API for determining forward compatible version based on time window #1298

Open GleasonK opened 1 year ago

GleasonK commented 1 year ago

Request description

Thinking something like:

# E.g. if we want to put StableHLO into SavedModel, we want artifacts to comply with TF compatibility policy.
# Per https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/compat/compat.py
# this means a 3-week forward compatibility window.
latest_compatible_date = datetime.now() - timedelta(weeks=3)
latest_compatible_version = stablehlo.lookup_known_version(latest_compatible_date)
stablehlo.serialize_portable_artifact(stablehlo_module, latest_compatible_version)

This will allow users to programmatically target the earliest supported version.

GleasonK commented 1 year ago

Received an additional request for a Python API to determine the current version of StableHLO. Can add alongside this API.

burmako commented 1 year ago

See https://github.com/openxla/stablehlo/issues/1319#issuecomment-1478770397 for some more details of the related brainstorming session, in addition to what's already called out in the first comment of this issue.

burmako commented 1 year ago

Some of the open questions that we dicussed recently: 1) lookupKnownVersion vs lookupPreviousVersion (main topic) 2) Should we start returning prerelease versions from getCurrentVersion? 3) Should we change compatibility.md to be based on tagged commits? 4) Should we start storing target_version in serializePortableArtifact artifacts?