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

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

apivovarov
Copy link
Contributor

@apivovarov apivovarov commented Oct 10, 2024

This PR adds update_version_h_cpp.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:

  1. Updates current version in stablehlo/dialect/Version.h
  static Version getCurrentVersion() { return Version(x, y, z); }

New version will be (x, y, z + 1)

  1. Replaces WEEK_4 and WEEK12 versions in stablehlo/dialect/Version.cpp
      return Version(a, b, c);  // WEEK_4 ANCHOR: DO NOT MODIFY
      return Version(m, n, p);  // WEEK_12 ANCHOR: DO NOT MODIFY
  • WEEK_4 version - The most recent git tag that was created at least 28 days ago.
  • WEEK_12 version - The most recent git tag that was created at least 84 days ago.

Usage Example:

$ build_tools/update_version_h_cpp.sh

Next Current Version: 1, 8, 3
WEEK_4 Version: 1, 7, 6
WEEK_12 Version: 1, 5, 1
Saving /local/home/user/workspace/stablehlo/build_tools/../stablehlo/dialect/Version.h...
  static Version getCurrentVersion() { return Version(1, 8, 3); }
Saving /local/home/user/workspace/stablehlo/build_tools/../stablehlo/dialect/Version.cpp...
      return Version(1, 7, 6);  // WEEK_4 ANCHOR: DO NOT MODIFY
      return Version(1, 5, 1);  // WEEK_12 ANCHOR: DO NOT MODIFY
Done

Result:

$ git diff
diff --git a/stablehlo/dialect/Version.cpp b/stablehlo/dialect/Version.cpp
index b4ea0d21..d107ba57 100644
--- a/stablehlo/dialect/Version.cpp
+++ b/stablehlo/dialect/Version.cpp
@@ -83,9 +83,9 @@ Version Version::fromCompatibilityRequirement(
     case CompatibilityRequirement::NONE:
       return Version::getCurrentVersion();
     case CompatibilityRequirement::WEEK_4:
-      return Version(1, 7, 5);  // WEEK_4 ANCHOR: DO NOT MODIFY
+      return Version(1, 7, 6);  // WEEK_4 ANCHOR: DO NOT MODIFY
     case CompatibilityRequirement::WEEK_12:
-      return Version(1, 5, 0);  // WEEK_12 ANCHOR: DO NOT MODIFY
+      return Version(1, 5, 1);  // WEEK_12 ANCHOR: DO NOT MODIFY
     case CompatibilityRequirement::MAX:
       return Version::getMinimumVersion();
   }
diff --git a/stablehlo/dialect/Version.h b/stablehlo/dialect/Version.h
index 2ea74427..a6fea6b3 100644
--- a/stablehlo/dialect/Version.h
+++ b/stablehlo/dialect/Version.h
@@ -38,7 +38,7 @@ class Version {
   static FailureOr<Version> fromString(llvm::StringRef versionRef);
 
   /// Return a Version representing the current VHLO dialect version.
-  static Version getCurrentVersion() { return Version(1, 8, 2); }
+  static Version getCurrentVersion() { return Version(1, 8, 3); }
 
   /// 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.

@apivovarov apivovarov force-pushed the auto_ver branch 2 times, most recently from f2e7bff to 5aeb452 Compare October 31, 2024 00:15
@GleasonK GleasonK merged commit 4d85f95 into openxla:main Nov 5, 2024
10 checks passed
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