Skip to content

Commit 5a5293b

Browse files
ailzhanglin-hitonami
authored andcommitted
[Lang] Remove filename kwarg in aot Module save() (taichi-dev#7085)
Issue: # ### Brief Summary
1 parent 7cba757 commit 5a5293b

16 files changed

+20
-39
lines changed

.github/workflows/scripts/aot-demo.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ set -ex
44
export TI_SKIP_VERSION_CHECK=ON
55
export TI_CI=1
66

7-
export TAICHI_AOT_DEMO_URL=https://github.com/bobcao3/taichi-aot-demo
7+
# IF YOU PIN THIS TO A COMMIT/BRANCH, YOU'RE RESPONSIBLE TO REVERT IT BACK TO MASTER ONCE MERGED.
8+
export TAICHI_AOT_DEMO_URL=https://github.com/taichi-dev/taichi-aot-demo
89
export TAICHI_AOT_DEMO_BRANCH=master
910

1011
export TAICHI_UNITY2_URL=https://github.com/taichi-dev/taichi-unity2
@@ -27,7 +28,6 @@ function build-and-smoke-test-android-aot-demo {
2728
export TAICHI_REPO_DIR=$(pwd)/taichi
2829

2930
rm -rf taichi-aot-demo
30-
# IF YOU PIN THIS TO A COMMIT/BRANCH, YOU'RE RESPONSIBLE TO REVERT IT BACK TO MASTER ONCE MERGED.
3131
git clone --recursive --depth=1 -b "$TAICHI_AOT_DEMO_BRANCH" "$TAICHI_AOT_DEMO_URL"
3232

3333
# Install taichi-python

python/taichi/aot/module.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,11 @@ def add_kernel_template(self, kernel_fn):
208208
kt = KernelTemplate(kernel_fn, self)
209209
yield kt
210210

211-
def save(self, filepath, filename=None):
211+
def save(self, filepath):
212212
"""
213213
Args:
214214
filepath (str): path to a folder to store aot files.
215-
filename (str): filename prefix for stored aot files.
216215
"""
217-
if filename is not None:
218-
warnings.warn(
219-
"Specifying filename is no-op and will be removed in release v1.4.0",
220-
DeprecationWarning)
221216
filepath = str(PurePosixPath(Path(filepath)))
222217
self._aot_builder.dump(filepath, "")
223218
with open(f"{filepath}/__content__", "w") as f:
@@ -238,7 +233,7 @@ def archive(self, filepath: str):
238233

239234
temp_dir = mkdtemp(prefix="tcm_")
240235
# Save first as usual.
241-
self.save(temp_dir, "")
236+
self.save(temp_dir)
242237

243238
# Package all artifacts into a zip archive and attach contend data.
244239
with ZipFile(tcm_path, "w") as z:

tests/cpp/aot/python_scripts/bitmasked_aot_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def check_value_1():
6969

7070
m.add_field("x", x)
7171

72-
m.save(dir_name, 'whatever')
72+
m.save(dir_name)
7373

7474

7575
if __name__ == "__main__":

tests/cpp/aot/python_scripts/comet_aot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def save_kernels(arch):
155155
assert "TAICHI_AOT_FOLDER_PATH" in os.environ.keys()
156156
tmpdir = str(os.environ["TAICHI_AOT_FOLDER_PATH"])
157157

158-
mod.save(tmpdir, 'whatever')
158+
mod.save(tmpdir)
159159

160160

161161
if __name__ == '__main__':

tests/cpp/aot/python_scripts/dense_field_aot_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def ret() -> ti.f32:
3838
m.add_kernel(init)
3939
m.add_kernel(ret)
4040
m.add_field("place", place)
41-
m.save(dir_name, 'whatever')
41+
m.save(dir_name)
4242

4343

4444
if __name__ == "__main__":

tests/cpp/aot/python_scripts/dynamic_aot_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def check_value_1():
7171
assert "TAICHI_AOT_FOLDER_PATH" in os.environ.keys()
7272
tmpdir = str(os.environ["TAICHI_AOT_FOLDER_PATH"])
7373

74-
m.save(tmpdir, 'whatever')
74+
m.save(tmpdir)
7575

7676

7777
if __name__ == "__main__":

tests/cpp/aot/python_scripts/field_aot_test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def check_activate_pointer_fields():
110110
m.add_field("y", y)
111111

112112
m.add_graph('run_graph', run_graph)
113-
m.save(dir_name, '')
113+
m.save(dir_name)
114114
else:
115115
m = ti.aot.Module()
116116

@@ -127,7 +127,7 @@ def check_activate_pointer_fields():
127127
m.add_field("x", x)
128128
m.add_field("y", y)
129129

130-
m.save(dir_name, 'whatever')
130+
m.save(dir_name)
131131

132132

133133
if __name__ == "__main__":

tests/cpp/aot/python_scripts/graph_aot_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def run2(base: int, arr: ti.types.ndarray(ndim=1, dtype=ti.i32)):
5050

5151
mod = ti.aot.Module()
5252
mod.add_graph('run_graph', run_graph)
53-
mod.save(tmpdir, '')
53+
mod.save(tmpdir)
5454

5555

5656
if __name__ == "__main__":

tests/cpp/aot/python_scripts/kernel_aot_test1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def run(base: int, arr: ti.types.ndarray(), v: ti.types.vector(3, ti.i32)):
2222

2323
m = ti.aot.Module()
2424
m.add_kernel(run, template_args={'arr': arr})
25-
m.save(dir_name, 'whatever')
25+
m.save(dir_name)
2626

2727

2828
if __name__ == "__main__":

tests/cpp/aot/python_scripts/kernel_aot_test2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def ker2(arr: ti.types.ndarray(), n: ti.i32):
3939
arr = ti.ndarray(ti.i32, shape=(10, ))
4040
m.add_kernel(ker1, template_args={'arr': arr})
4141
m.add_kernel(ker2, template_args={'arr': arr})
42-
m.save(dir_name, 'whatever')
42+
m.save(dir_name)
4343

4444

4545
if __name__ == "__main__":

tests/cpp/aot/python_scripts/mpm88_graph_aot.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def init_particles(x: ti.any_arr(field_dim=1), v: ti.any_arr(field_dim=1),
184184
mod = ti.aot.Module()
185185
mod.add_graph('init', g_init)
186186
mod.add_graph('update', g_update)
187-
mod.save(tmpdir, '')
187+
mod.save(tmpdir)
188188
else:
189189
pos = ti.Vector.ndarray(3, ti.f32, n_particles)
190190
x = ti.Vector.ndarray(2, ti.f32, shape=(n_particles))
@@ -226,7 +226,7 @@ def init_particles(x: ti.any_arr(field_dim=1), v: ti.any_arr(field_dim=1),
226226
'pos': pos
227227
})
228228

229-
mod.save(tmpdir, '')
229+
mod.save(tmpdir)
230230

231231

232232
if __name__ == "__main__":

tests/cpp/aot/python_scripts/sph_aot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,4 +243,4 @@ def copy_data_from_ndarray_to_field(src: ti.template(), dst: ti.any_arr()):
243243
assert "TAICHI_AOT_FOLDER_PATH" in os.environ.keys()
244244
tmpdir = str(os.environ["TAICHI_AOT_FOLDER_PATH"])
245245

246-
mod.save(tmpdir, '')
246+
mod.save(tmpdir)

tests/cpp/aot/python_scripts/taichi_sparse_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def save_kernels(arch):
8686
assert "TAICHI_AOT_FOLDER_PATH" in os.environ.keys()
8787
dir_name = str(os.environ["TAICHI_AOT_FOLDER_PATH"])
8888

89-
m.save(dir_name, 'whatever')
89+
m.save(dir_name)
9090

9191

9292
if __name__ == '__main__':

tests/cpp/aot/python_scripts/texture_aot_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def run2(tex0: ti.types.texture(num_dimensions=2),
7474

7575
mod = ti.aot.Module()
7676
mod.add_graph('run_graph', run_graph)
77-
mod.save(tmpdir, '')
77+
mod.save(tmpdir)
7878

7979

8080
if __name__ == "__main__":

tests/python/test_aot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ def run(arr: ti.types.ndarray(), val1: ti.f32, val2: ti.template()):
518518
x = ti.ndarray(dtype=ti.f32, shape=16)
519519
m = ti.aot.Module()
520520
m.add_kernel(run, template_args={'arr': x, 'val2': 42})
521-
m.save(tmpdir, '')
521+
m.save(tmpdir)
522522
with open(os.path.join(tmpdir, 'metadata.json')) as json_file:
523523
res = json.load(json_file)
524524
for kernel in res['kernels']:

tests/python/test_deprecation.py

+1-15
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,6 @@
77
from tests import test_utils
88

99

10-
@test_utils.test(arch=[ti.vulkan, ti.opengl, ti.cuda, ti.cpu])
11-
def test_deprecated_aot_save_filename():
12-
density = ti.field(float, shape=(4, 4))
13-
14-
with tempfile.TemporaryDirectory() as tmpdir:
15-
m = ti.aot.Module()
16-
m.add_field('density', density)
17-
with pytest.warns(
18-
DeprecationWarning,
19-
match=
20-
r'Specifying filename is no-op and will be removed in release v1.4.0'
21-
):
22-
m.save(tmpdir, 'filename')
23-
24-
2510
@test_utils.test()
2611
def test_deprecated_matrix_rotation2d():
2712
with pytest.warns(
@@ -132,6 +117,7 @@ def ker(tex: ti.types.rw_texture(num_dimensions=2,
132117
tex.store(ti.Vector([i, j]), ti.Vector([ret, 0.0, 0.0, 0.0]))
133118

134119

120+
# Note: will be removed in v1.5.0
135121
@test_utils.test(arch=ti.vulkan)
136122
def test_incomplete_info_rwtexture():
137123
n = 128

0 commit comments

Comments
 (0)