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

Automatically update WEEK_4 WEEK_12 versions #2585

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

apivovarov
Copy link
Contributor

@apivovarov apivovarov commented Oct 10, 2024

This PR adds update_version_h.sh script

The script will:

  • Automatically calculate WEEK_4 and WEEK_12 versions based on Version tag date and current date.
  • Bump CurrentVersion by increasing patch version by 1

This script should be executed at the beginning of the next development cycle, after performing the git tagging.

This script updates versions in the following lines in stablehlo/dialect/Version.h

  static Version getCurrentVersion() { return Version(x, y, z); }
  static Version getWeek4Version() { return Version(a, b, c); }
  static Version getWeek12Version() { return Version(m, n, p); }
  • getCurrentVersion() will be (x, y, z + 1)
  • getWeek4Version() - The most recent git tag that was created at least 28 days ago.
  • getWeek12Version() - The most recent git tag that was created at least 84 days ago.

Usage Example:

$ build_tools/update_version_h.sh

Next Current Version: 1, 7, 9
WEEK_4 Version: 1, 7, 1
WEEK_12 Version: 1, 4, 0
Saving...
Done

Result:

$ git diff
diff --git a/stablehlo/dialect/Version.h b/stablehlo/dialect/Version.h
index 74e8df74..5828ced7 100644
--- a/stablehlo/dialect/Version.h
+++ b/stablehlo/dialect/Version.h
@@ -38,13 +38,13 @@ class Version {
   static FailureOr<Version> fromString(llvm::StringRef versionRef);
 
   /// Return a Version representing the current VHLO dialect version.
-  static Version getCurrentVersion() { return Version(1, 7, 8); }
+  static Version getCurrentVersion() { return Version(1, 7, 9); }
 
   /// Return CompatibilityRequirement::WEEK_4 VHLO dialect version.
-  static Version getWeek4Version() { return Version(1, 7, 0); }
+  static Version getWeek4Version() { return Version(1, 7, 1); }
 
   /// Return CompatibilityRequirement::WEEK_12 VHLO dialect version.
-  static Version getWeek12Version() { return Version(1, 3, 0); }
+  static Version getWeek12Version() { return Version(1, 4, 0); }
 
   /// Return a Version representing the minimum supported VHLO dialect version.
   static Version getMinimumVersion() { return Version(0, 9, 0); }

Copy link
Member

@GleasonK GleasonK left a comment

Choose a reason for hiding this comment

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

Ahh.. I'd coded something like this before and deleted it because it scared me a little.

My fear is that something will break in the middle of the night, not directly correlatable to a CL because the return value changed due to the datetime. I.e. maybe you have a plugin that doesn't support TanOp, we find that when we try to bump the MIN version and run CI.

With this change, we'd find it at 1AM when CI on a JAX PR starts failing for unrelated reasons.. open to discussing further but time APIs seem super risky IMO.

@apivovarov
Copy link
Contributor Author

apivovarov commented Oct 11, 2024

For convenience we can use this py script to get WEEK_4 and WEEK_12 tag / tag date / days ago

Maybe add it to one of the documents?

@GleasonK
Copy link
Member

Actually this is super useful! We can add this to our weekly integrate / version bump script. Tag the latest release, check if the values should be updated, bump the Version.h value.

Mind sending this PR as a .sh file in buid_tools? When we get a chance we'll integrate it into the process

@apivovarov apivovarov force-pushed the auto_ver branch 2 times, most recently from 049622f to e06da83 Compare October 12, 2024 06:22
@apivovarov
Copy link
Contributor Author

apivovarov commented Oct 12, 2024

Actually this is super useful! We can add this to our weekly integrate / version bump script. Tag the latest release, check if the values should be updated, bump the Version.h value.

Mind sending this PR as a .sh file in buid_tools? When we get a chance we'll integrate it into the process

Added build_tools/update_version_h.sh
This script updates CurrentVersion, Week4Version and Week12Version in stablehlo/dialect/Version.h

See Usage Example in the PR description above

@apivovarov apivovarov changed the title Automatically calculate Version Automatically calculate WEEK_4 WEEK_12 versions Oct 12, 2024
@apivovarov apivovarov changed the title Automatically calculate WEEK_4 WEEK_12 versions Automatically fetch WEEK_4 WEEK_12 versions Oct 12, 2024
@apivovarov apivovarov changed the title Automatically fetch WEEK_4 WEEK_12 versions Automatically update WEEK_4 WEEK_12 versions Oct 12, 2024
@apivovarov
Copy link
Contributor Author

Updated the script to use the following git command to get tag_ts and tag_name

git for-each-ref --sort=taggerdate --format '%(taggerdate:unix),%(refname:short)' refs/tags

This command retrieves the actual tagger date, which represents the date the tag was created, rather than the date of the last commit in the tag.

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

Successfully merging this pull request may close these issues.

2 participants