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

[Lang] Remove filename kwarg in aot Module save() #7085

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/scripts/aot-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ set -ex
export TI_SKIP_VERSION_CHECK=ON
export TI_CI=1

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

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

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

# Install taichi-python
Expand Down
9 changes: 2 additions & 7 deletions python/taichi/aot/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,11 @@ def add_kernel_template(self, kernel_fn):
kt = KernelTemplate(kernel_fn, self)
yield kt

def save(self, filepath, filename=None):
def save(self, filepath):
"""
Args:
filepath (str): path to a folder to store aot files.
filename (str): filename prefix for stored aot files.
"""
if filename is not None:
warnings.warn(
"Specifying filename is no-op and will be removed in release v1.4.0",
DeprecationWarning)
filepath = str(PurePosixPath(Path(filepath)))
self._aot_builder.dump(filepath, "")
with open(f"{filepath}/__content__", "w") as f:
Expand All @@ -238,7 +233,7 @@ def archive(self, filepath: str):

temp_dir = mkdtemp(prefix="tcm_")
# Save first as usual.
self.save(temp_dir, "")
self.save(temp_dir)

# Package all artifacts into a zip archive and attach contend data.
with ZipFile(tcm_path, "w") as z:
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/aot/python_scripts/bitmasked_aot_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def check_value_1():

m.add_field("x", x)

m.save(dir_name, 'whatever')
m.save(dir_name)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/aot/python_scripts/comet_aot.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def save_kernels(arch):
assert "TAICHI_AOT_FOLDER_PATH" in os.environ.keys()
tmpdir = str(os.environ["TAICHI_AOT_FOLDER_PATH"])

mod.save(tmpdir, 'whatever')
mod.save(tmpdir)


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/aot/python_scripts/dense_field_aot_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def ret() -> ti.f32:
m.add_kernel(init)
m.add_kernel(ret)
m.add_field("place", place)
m.save(dir_name, 'whatever')
m.save(dir_name)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/aot/python_scripts/dynamic_aot_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def check_value_1():
assert "TAICHI_AOT_FOLDER_PATH" in os.environ.keys()
tmpdir = str(os.environ["TAICHI_AOT_FOLDER_PATH"])

m.save(tmpdir, 'whatever')
m.save(tmpdir)


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions tests/cpp/aot/python_scripts/field_aot_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def check_activate_pointer_fields():
m.add_field("y", y)

m.add_graph('run_graph', run_graph)
m.save(dir_name, '')
m.save(dir_name)
else:
m = ti.aot.Module()

Expand All @@ -127,7 +127,7 @@ def check_activate_pointer_fields():
m.add_field("x", x)
m.add_field("y", y)

m.save(dir_name, 'whatever')
m.save(dir_name)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/aot/python_scripts/graph_aot_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def run2(base: int, arr: ti.types.ndarray(ndim=1, dtype=ti.i32)):

mod = ti.aot.Module()
mod.add_graph('run_graph', run_graph)
mod.save(tmpdir, '')
mod.save(tmpdir)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/aot/python_scripts/kernel_aot_test1.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def run(base: int, arr: ti.types.ndarray(), v: ti.types.vector(3, ti.i32)):

m = ti.aot.Module()
m.add_kernel(run, template_args={'arr': arr})
m.save(dir_name, 'whatever')
m.save(dir_name)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/aot/python_scripts/kernel_aot_test2.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def ker2(arr: ti.types.ndarray(), n: ti.i32):
arr = ti.ndarray(ti.i32, shape=(10, ))
m.add_kernel(ker1, template_args={'arr': arr})
m.add_kernel(ker2, template_args={'arr': arr})
m.save(dir_name, 'whatever')
m.save(dir_name)


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions tests/cpp/aot/python_scripts/mpm88_graph_aot.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def init_particles(x: ti.any_arr(field_dim=1), v: ti.any_arr(field_dim=1),
mod = ti.aot.Module()
mod.add_graph('init', g_init)
mod.add_graph('update', g_update)
mod.save(tmpdir, '')
mod.save(tmpdir)
else:
pos = ti.Vector.ndarray(3, ti.f32, n_particles)
x = ti.Vector.ndarray(2, ti.f32, shape=(n_particles))
Expand Down Expand Up @@ -226,7 +226,7 @@ def init_particles(x: ti.any_arr(field_dim=1), v: ti.any_arr(field_dim=1),
'pos': pos
})

mod.save(tmpdir, '')
mod.save(tmpdir)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/aot/python_scripts/sph_aot.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,4 @@ def copy_data_from_ndarray_to_field(src: ti.template(), dst: ti.any_arr()):
assert "TAICHI_AOT_FOLDER_PATH" in os.environ.keys()
tmpdir = str(os.environ["TAICHI_AOT_FOLDER_PATH"])

mod.save(tmpdir, '')
mod.save(tmpdir)
2 changes: 1 addition & 1 deletion tests/cpp/aot/python_scripts/taichi_sparse_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def save_kernels(arch):
assert "TAICHI_AOT_FOLDER_PATH" in os.environ.keys()
dir_name = str(os.environ["TAICHI_AOT_FOLDER_PATH"])

m.save(dir_name, 'whatever')
m.save(dir_name)


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/aot/python_scripts/texture_aot_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def run2(tex0: ti.types.texture(num_dimensions=2),

mod = ti.aot.Module()
mod.add_graph('run_graph', run_graph)
mod.save(tmpdir, '')
mod.save(tmpdir)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion tests/python/test_aot.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def run(arr: ti.types.ndarray(), val1: ti.f32, val2: ti.template()):
x = ti.ndarray(dtype=ti.f32, shape=16)
m = ti.aot.Module()
m.add_kernel(run, template_args={'arr': x, 'val2': 42})
m.save(tmpdir, '')
m.save(tmpdir)
with open(os.path.join(tmpdir, 'metadata.json')) as json_file:
res = json.load(json_file)
for kernel in res['kernels']:
Expand Down
16 changes: 1 addition & 15 deletions tests/python/test_deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,6 @@
from tests import test_utils


@test_utils.test(arch=[ti.vulkan, ti.opengl, ti.cuda, ti.cpu])
def test_deprecated_aot_save_filename():
density = ti.field(float, shape=(4, 4))

with tempfile.TemporaryDirectory() as tmpdir:
m = ti.aot.Module()
m.add_field('density', density)
with pytest.warns(
DeprecationWarning,
match=
r'Specifying filename is no-op and will be removed in release v1.4.0'
):
m.save(tmpdir, 'filename')


@test_utils.test()
def test_deprecated_matrix_rotation2d():
with pytest.warns(
Expand Down Expand Up @@ -132,6 +117,7 @@ def ker(tex: ti.types.rw_texture(num_dimensions=2,
tex.store(ti.Vector([i, j]), ti.Vector([ret, 0.0, 0.0, 0.0]))


# Note: will be removed in v1.5.0
@test_utils.test(arch=ti.vulkan)
def test_incomplete_info_rwtexture():
n = 128
Expand Down