29
29
30
30
REPO_ROOT = Path (__file__ ).parent .parent
31
31
REQUIREMENTS_IREE_PINNED_PATH = REPO_ROOT / "requirements-iree-pinned.txt"
32
+ SHORTFIN_CMAKELISTS_PATH = REPO_ROOT / "shortfin" / "CMakeLists.txt"
32
33
33
34
34
35
def get_current_version (package_name ):
@@ -82,12 +83,19 @@ def get_latest_version(package_name, extra_pip_args=[]):
82
83
return version
83
84
84
85
86
+ def get_current_git_tag ():
87
+ with open (SHORTFIN_CMAKELISTS_PATH , "r" ) as f :
88
+ text = f .read ()
89
+ return re .findall ('SHORTFIN_IREE_GIT_TAG "(.*)"' , text )[0 ]
90
+
91
+
85
92
def main ():
86
93
print ("Updating IREE version pins!" )
87
94
88
95
current_compiler_version = get_current_version ("iree-base-compiler" )
89
96
current_runtime_version = get_current_version ("iree-base-runtime" )
90
97
current_turbine_version = get_current_version ("iree-turbine" )
98
+ current_git_tag = get_current_git_tag ()
91
99
92
100
nightly_pip_args = [
93
101
"--pre" ,
@@ -97,16 +105,22 @@ def main():
97
105
latest_compiler_version = get_latest_version ("iree-base-compiler" , nightly_pip_args )
98
106
latest_runtime_version = get_latest_version ("iree-base-runtime" , nightly_pip_args )
99
107
latest_turbine_version = get_latest_version ("iree-turbine" , nightly_pip_args )
108
+ # TODO(scotttodd): Get this from git? It should generally be in sync with
109
+ # the python packages and follow a naming convention. If that isn't
110
+ # true, such as right after a stable release, then this may break.
111
+ latest_git_tag = f"iree-{ latest_runtime_version } "
100
112
101
113
print ("\n -------------------------------------------------------------------------" )
102
114
print ("Current versions:" )
103
115
print (f" iree-base-compiler=={ current_compiler_version } " )
104
116
print (f" iree-base-runtime=={ current_runtime_version } " )
105
117
print (f" iree-turbine=={ current_turbine_version } " )
118
+ print (f' SHORTFIN_IREE_GIT_TAG "{ current_git_tag } "' )
106
119
print ("Latest versions:" )
107
120
print (f" iree-base-compiler=={ latest_compiler_version } " )
108
121
print (f" iree-base-runtime=={ latest_runtime_version } " )
109
122
print (f" iree-turbine=={ latest_turbine_version } " )
123
+ print (f' SHORTFIN_IREE_GIT_TAG "{ latest_git_tag } "' )
110
124
111
125
# Write to GitHub Actions environment variables for future steps to use if they want.
112
126
github_env = os .getenv ("GITHUB_ENV" )
@@ -120,16 +134,19 @@ def main():
120
134
f"CURRENT_IREE_BASE_RUNTIME_VERSION={ current_runtime_version } " , file = fh
121
135
)
122
136
print (f"CURRENT_IREE_TURBINE_VERSION={ current_turbine_version } " , file = fh )
137
+ print (f"CURRENT_SHORTFIN_IREE_GIT_TAG={ current_git_tag } " , file = fh )
123
138
print (
124
139
f"LATEST_IREE_BASE_COMPILER_VERSION={ latest_compiler_version } " , file = fh
125
140
)
126
141
print (f"LATEST_IREE_BASE_RUNTIME_VERSION={ latest_runtime_version } " , file = fh )
127
142
print (f"LATEST_IREE_TURBINE_VERSION={ latest_turbine_version } " , file = fh )
143
+ print (f"LATEST_SHORTFIN_IREE_GIT_TAG={ latest_git_tag } " , file = fh )
128
144
129
145
if (
130
146
current_compiler_version == latest_compiler_version
131
147
and current_runtime_version == latest_runtime_version
132
148
and current_turbine_version == latest_turbine_version
149
+ and current_git_tag == latest_git_tag
133
150
):
134
151
print ("Already using the latest versions, exiting" )
135
152
return
@@ -159,6 +176,17 @@ def main():
159
176
with open (REQUIREMENTS_IREE_PINNED_PATH , "w" ) as f :
160
177
f .write (text )
161
178
179
+ print (f"Editing git tag in '{ SHORTFIN_CMAKELISTS_PATH } '" )
180
+ with open (SHORTFIN_CMAKELISTS_PATH , "r" ) as f :
181
+ text = f .read ()
182
+ text = re .sub (
183
+ 'SHORTFIN_IREE_GIT_TAG ".*"' ,
184
+ f'SHORTFIN_IREE_GIT_TAG "{ latest_git_tag } "' ,
185
+ text ,
186
+ )
187
+ with open (SHORTFIN_CMAKELISTS_PATH , "w" ) as f :
188
+ f .write (text )
189
+
162
190
print ("-------------------------------------------------------------------------" )
163
191
print ("Edits complete" )
164
192
0 commit comments