You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by tq...@apache.org on 2026/10/14 00:54:14 UTC
(tvm) branch main updated: [TVMScript] Default symbolic dimensions to int32 (#20710)
This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new e8773d49fe [TVMScript] Default symbolic dimensions to int32 (#20710)
e8773d49fe is described below
commit e8773d49febaf7e207d7da4c293ea0a250dc4e1d
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Tue Oct 13 20:54:08 2026 -0400
[TVMScript] Default symbolic dimensions to int32 (#20710)
Default shared TVMScript dynamic symbols and omitted or builtin-int
function type parameters to int32. Align function-header printing with
that default and spell explicit registered int64 bounds.
Preserve Relax shape requirements and width-dependent callers through
explicit int64 declarations, while retaining explicit scalar bounds and
registry-based annotation handling.
---
docs/arch/tvmscript.rst | 10 +-
docs/deep_dive/relax/tutorials/relax_creation.py | 2 +-
jvm/core/src/test/scripts/prepare_test_libs.py | 2 +-
python/tvm/relax/backend/gpu_generic/cumsum.py | 10 +-
python/tvm/relax/backend/gpu_generic/sampling.py | 12 +-
python/tvm/relax/block_builder.py | 8 +-
.../tvm/relax/frontend/nn/llm/_decode_kernels.py | 2 +-
python/tvm/relax/frontend/nn/llm/_page_kernels.py | 38 +-
.../tvm/relax/frontend/nn/llm/_prefill_kernels.py | 4 +-
.../relax/frontend/nn/llm/position_embedding.py | 12 +-
python/tvm/relax/frontend/nn/op.py | 14 +-
python/tvm/script/ir_builder/ir.py | 4 +-
python/tvm/script/parser/transpile.py | 2 +-
src/relax/script/printer/function.cc | 2 +-
src/tirx/script/printer/function.cc | 2 +-
.../python/codegen/test_codegen_error_handling.py | 2 +-
.../python/contrib/test_tir_triton_integration.py | 6 +-
tests/python/relax/backend/adreno/mod_utils.py | 6 +-
.../adreno/test_transform_annotate_custom_scope.py | 16 +-
...est_distributed_transform_propagate_sharding.py | 32 +-
.../relax/script/test_relax_script_basic_usage.py | 8 +-
.../script/test_relax_script_dynamic_shape.py | 18 +-
tests/python/relax/test_analysis.py | 18 +-
.../test_analysis_computable_at_compile_time.py | 16 +-
.../test_analysis_suggest_layout_transforms.py | 16 +-
tests/python/relax/test_analysis_type_analysis.py | 4 +-
tests/python/relax/test_analysis_well_formed.py | 32 +-
tests/python/relax/test_ast_printer.py | 14 +-
.../python/relax/test_backend_dispatch_sampling.py | 12 +-
.../relax/test_backend_dispatch_sort_scan.py | 30 +-
.../relax/test_backend_transform_shape_lower.py | 64 ++--
.../relax/test_base_py_module_symbolic_shape.py | 16 +-
tests/python/relax/test_bind_symbolic_vars.py | 52 +--
tests/python/relax/test_blockbuilder_core.py | 8 +-
tests/python/relax/test_blockbuilder_emit_te.py | 2 +-
tests/python/relax/test_codegen_cutlass.py | 16 +-
tests/python/relax/test_contrib_vllm.py | 16 +-
tests/python/relax/test_dataflow_inplace.py | 24 +-
tests/python/relax/test_dataflow_pattern.py | 14 +-
tests/python/relax/test_dataflow_rewriter.py | 30 +-
tests/python/relax/test_e2e_op_dynamic.py | 4 +-
.../relax/test_frontend_from_exported_program.py | 24 +-
tests/python/relax/test_frontend_nn_exporter.py | 24 +-
.../python/relax/test_frontend_nn_extern_module.py | 6 +-
tests/python/relax/test_frontend_nn_modules.py | 10 +-
tests/python/relax/test_frontend_nn_op.py | 46 +--
tests/python/relax/test_frontend_nn_subroutines.py | 6 +-
tests/python/relax/test_frontend_onnx.py | 152 ++++----
tests/python/relax/test_frontend_stablehlo.py | 8 +-
tests/python/relax/test_frontend_tflite.py | 18 +-
tests/python/relax/test_inline_functions.py | 12 +-
tests/python/relax/test_op_index.py | 8 +-
tests/python/relax/test_op_size.py | 4 +-
tests/python/relax/test_op_take.py | 2 +-
tests/python/relax/test_op_view.py | 20 +-
.../python/relax/test_optimize_layout_transform.py | 8 +-
tests/python/relax/test_pipeline.py | 4 +-
tests/python/relax/test_relax_operators.py | 14 +-
.../python/relax/test_relax_to_pyfunc_converter.py | 14 +-
tests/python/relax/test_testing_nn.py | 6 +-
tests/python/relax/test_tir_call_source_kernel.py | 6 +-
tests/python/relax/test_transform.py | 16 +-
.../relax/test_transform_adjust_matmul_order.py | 48 +--
tests/python/relax/test_transform_alter_op_impl.py | 4 +-
.../relax/test_transform_attach_global_symbol.py | 24 +-
tests/python/relax/test_transform_bind_params.py | 8 +-
.../relax/test_transform_bind_symbolic_vars.py | 78 ++--
.../relax/test_transform_canonicalize_bindings.py | 82 ++---
tests/python/relax/test_transform_codegen_pass.py | 10 +-
.../test_transform_combine_parallel_matmul.py | 16 +-
.../relax/test_transform_compute_prim_value.py | 8 +-
.../python/relax/test_transform_convert_layout.py | 142 +++----
tests/python/relax/test_transform_cse.py | 16 +-
.../relax/test_transform_dead_code_elimination.py | 18 +-
tests/python/relax/test_transform_decompose_ops.py | 6 +-
tests/python/relax/test_transform_fold_constant.py | 10 +-
tests/python/relax/test_transform_fuse_ops.py | 40 +-
.../relax/test_transform_fuse_ops_by_pattern.py | 14 +-
tests/python/relax/test_transform_fuse_tir.py | 58 +--
tests/python/relax/test_transform_gradient.py | 2 +-
.../relax/test_transform_gradient_te_register.py | 8 +-
.../relax/test_transform_ipc_allreduce_rewrite.py | 20 +-
tests/python/relax/test_transform_lambda_lift.py | 24 +-
.../relax/test_transform_lazy_transform_params.py | 18 +-
.../relax/test_transform_legalize_ops_binary.py | 360 +++++++++---------
.../test_transform_legalize_ops_create_datatype.py | 136 +++----
.../test_transform_legalize_ops_distributed.py | 2 +-
.../relax/test_transform_legalize_ops_grad.py | 18 +-
.../relax/test_transform_legalize_ops_image.py | 36 +-
..._transform_legalize_ops_index_linear_algebra.py | 140 +++----
.../test_transform_legalize_ops_manipulate.py | 260 ++++++-------
.../python/relax/test_transform_legalize_ops_nn.py | 408 ++++++++++-----------
.../relax/test_transform_legalize_ops_qdq.py | 12 +-
...st_transform_legalize_ops_search_statistical.py | 234 ++++++------
.../relax/test_transform_legalize_ops_unary.py | 8 +-
.../relax/test_transform_lift_transform_params.py | 48 +--
.../test_transform_lower_gpu_ipc_alloc_storage.py | 16 +-
tests/python/relax/test_transform_normalize.py | 4 +-
.../test_transform_remove_unused_parameters.py | 56 +--
.../test_transform_reorder_take_after_matmul.py | 28 +-
.../relax/test_transform_rewrite_cuda_graph.py | 18 +-
.../test_transform_rewrite_dataflow_reshape.py | 6 +-
.../test_transform_static_plan_block_memory.py | 64 ++--
tests/python/relax/test_utils.py | 2 +-
tests/python/relax/test_vm_build.py | 30 +-
tests/python/relax/test_vm_builtin_lower.py | 12 +-
tests/python/relax/test_vm_codegen_only.py | 6 +-
tests/python/s_tir/dlight/test_benchmark.py | 10 +-
tests/python/s_tir/dlight/test_cpu_gemv.py | 4 +-
tests/python/s_tir/dlight/test_gpu_gemv.py | 4 +-
.../s_tir/dlight/test_gpu_general_reduction.py | 28 +-
.../python/s_tir/dlight/test_gpu_low_batch_gemv.py | 20 +-
tests/python/s_tir/dlight/test_gpu_matmul.py | 20 +-
tests/python/s_tir/dlight/test_gpu_reduction.py | 12 +-
.../schedule/test_tir_schedule_compute_inline.py | 12 +-
.../s_tir/schedule/test_tir_schedule_tensorize.py | 6 +-
.../schedule/test_tir_schedule_transform_layout.py | 8 +-
.../s_tir/script/test_s_tir_script_printer.py | 4 +-
.../test_s_tir_transform_default_gpu_schedule.py | 8 +-
tests/python/script/minilang.py | 5 +-
tests/python/script/test_dynamic_shape.py | 6 +-
tests/python/te/test_te_create_function.py | 8 +-
...test_tir_transform_force_narrow_index_to_i32.py | 2 +-
.../tirx/script/test_tirx_script_dynamic_shape.py | 20 +-
.../python/tirx/script/test_tirx_script_tensors.py | 2 +-
web/tests/python/prepare_test_libs.py | 2 +-
126 files changed, 1876 insertions(+), 1871 deletions(-)
diff --git a/docs/arch/tvmscript.rst b/docs/arch/tvmscript.rst
index 8cfa26a3fd..76ae5ce4c3 100644
--- a/docs/arch/tvmscript.rst
+++ b/docs/arch/tvmscript.rst
@@ -65,12 +65,14 @@ are read only when needed, including conditional and optional annotations.
Annotations read concrete values from their definition scope, preserving missing-name
errors when a value is used. Create external symbols with ``n = I.dynamic("n")``
or the identical ``T.dynamic`` and ``Ts.dynamic`` constructors. Each call creates a
-fresh native variable, defaulting to int64. Reuse that object in ordinary Python shape,
+fresh native variable, defaulting to int32. Reuse that object in ordinary Python shape,
stride and offset expressions to share identity; strings in those fields are not
parsed as expressions. On Python 3.12+, explicit headers such as
-``def f[n, k: T.int32](...)`` declare local symbols; ``n: int`` retains the int64
-default. Use ``from __future__ import annotations`` to defer eager Python evaluation
-of header symbols. Explicit whole quoted annotations are rejected in script source;
+``def f[n, k: T.int64](...)`` declare local symbols; ``n: int`` retains the int32
+default. Relax symbolic shapes require explicit int64 symbols, such as
+``I.dynamic("n", "int64")`` or ``def f[n: T.int64](...)``; Relax integer shape
+constants continue to normalize to int64. Use ``from __future__ import annotations``
+to defer eager Python evaluation of header symbols. Explicit whole quoted annotations are rejected in script source;
normal string arguments inside annotation constructors remain valid. Captured runtime ``typing.TypeVar``
objects are not script symbols; ordinary Python typing uses remain unaffected.
diff --git a/docs/deep_dive/relax/tutorials/relax_creation.py b/docs/deep_dive/relax/tutorials/relax_creation.py
index 0e8bf82e8c..3d884e7942 100644
--- a/docs/deep_dive/relax/tutorials/relax_creation.py
+++ b/docs/deep_dive/relax/tutorials/relax_creation.py
@@ -43,7 +43,7 @@ from tvm.script import relax as R
from tvm.script import s_tir as Ts
from tvm.script import tirx as T
-n = T.dynamic("n")
+n = T.dynamic("n", "int64")
@I.ir_module
diff --git a/jvm/core/src/test/scripts/prepare_test_libs.py b/jvm/core/src/test/scripts/prepare_test_libs.py
index aa14514380..3b7f8206ca 100644
--- a/jvm/core/src/test/scripts/prepare_test_libs.py
+++ b/jvm/core/src/test/scripts/prepare_test_libs.py
@@ -27,7 +27,7 @@ from tvm.script import relax as R
def prepare_relax_lib(base_path):
pipeline = relax.get_pipeline()
- n = I.dynamic("n")
+ n = I.dynamic("n", "int64")
@tvm.script.ir_module
class Mod:
diff --git a/python/tvm/relax/backend/gpu_generic/cumsum.py b/python/tvm/relax/backend/gpu_generic/cumsum.py
index f873b37c0d..4a28396f60 100644
--- a/python/tvm/relax/backend/gpu_generic/cumsum.py
+++ b/python/tvm/relax/backend/gpu_generic/cumsum.py
@@ -174,8 +174,8 @@ def gpu_2d_continuous_cumsum(
bx > 0, source[by, src_offset + bx - 1], 0
)
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@Ts.function(private=True)
def cumsum(A: T.Tensor([m, n], dtype=in_dtype), Out: T.Tensor([m, n], dtype=out_dtype)):
@@ -254,9 +254,9 @@ def gpu_3d_axis_1_cumsum(
out_dtype = out_dtype or in_dtype
TX = T.int64(tx_len)
- outer = T.dynamic("outer")
- scan = T.dynamic("scan")
- inner = T.dynamic("inner")
+ outer = T.dynamic("outer", "int64")
+ scan = T.dynamic("scan", "int64")
+ inner = T.dynamic("inner", "int64")
@Ts.function(private=True)
def cumsum(
diff --git a/python/tvm/relax/backend/gpu_generic/sampling.py b/python/tvm/relax/backend/gpu_generic/sampling.py
index 3237dcee26..b7dc8421d7 100644
--- a/python/tvm/relax/backend/gpu_generic/sampling.py
+++ b/python/tvm/relax/backend/gpu_generic/sampling.py
@@ -259,9 +259,9 @@ def gpu_multinomial_from_uniform(
aggregate[()] += step_aggregate[()]
- n = T.dynamic("n")
- vocab_size = T.dynamic("vocab_size")
- batch_size = T.dynamic("batch_size")
+ n = T.dynamic("n", "int64")
+ vocab_size = T.dynamic("vocab_size", "int64")
+ batch_size = T.dynamic("batch_size", "int64")
@Ts.function
def parallel_sampling_from_prob(
@@ -318,9 +318,9 @@ def generic_get_sample_index(
):
"""Generate a generic get_sample_index kernel."""
- batch = T.dynamic("batch")
- vocab_size = T.dynamic("vocab_size")
- out_batch = T.dynamic("out_batch")
+ batch = T.dynamic("batch", "int64")
+ vocab_size = T.dynamic("vocab_size", "int64")
+ out_batch = T.dynamic("out_batch", "int64")
@Ts.function(private=True)
def _get_sample_index(
diff --git a/python/tvm/relax/block_builder.py b/python/tvm/relax/block_builder.py
index 5beaebb4fe..a4d82777fd 100644
--- a/python/tvm/relax/block_builder.py
+++ b/python/tvm/relax/block_builder.py
@@ -476,8 +476,8 @@ class BlockBuilder(Object):
.. code-block:: python
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Module:
@@ -527,8 +527,8 @@ class BlockBuilder(Object):
.. code-block:: python
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Module:
diff --git a/python/tvm/relax/frontend/nn/llm/_decode_kernels.py b/python/tvm/relax/frontend/nn/llm/_decode_kernels.py
index 165ad11915..c8471e22fc 100644
--- a/python/tvm/relax/frontend/nn/llm/_decode_kernels.py
+++ b/python/tvm/relax/frontend/nn/llm/_decode_kernels.py
@@ -206,7 +206,7 @@ def _attention_decode(num_kv_heads, num_qo_heads, head_dim, qkv_dtype, sliding_w
B = T.dynamic("B", "int32")
nnz_pages = T.dynamic("nnz_pages", "int32")
max_num_pages = T.dynamic("max_num_pages", "int32")
- pages_elem_offset = T.dynamic("pages_elem_offset")
+ pages_elem_offset = T.dynamic("pages_elem_offset", "int64")
page_indptr_elem_offset = T.dynamic("page_indptr_elem_offset", "int32")
page_values_elem_offset = T.dynamic("page_values_elem_offset", "int32")
k_rope_pos_offset_elem_offset = T.dynamic("k_rope_pos_offset_elem_offset", "int32")
diff --git a/python/tvm/relax/frontend/nn/llm/_page_kernels.py b/python/tvm/relax/frontend/nn/llm/_page_kernels.py
index a93b0512e2..863d944747 100644
--- a/python/tvm/relax/frontend/nn/llm/_page_kernels.py
+++ b/python/tvm/relax/frontend/nn/llm/_page_kernels.py
@@ -42,9 +42,9 @@ from ._kernel_common import get_max_num_threads_per_block
def _kv_cache_transpose_append(num_key_value_heads, head_dim, dtype, page_size: int = 16):
"""Return the TIR function that appends new k/v data to PagedKVCache."""
- ntoken = T.dynamic("ntoken")
- num_pages = T.dynamic("num_pages")
- pages_elem_offset = T.dynamic("pages_elem_offset")
+ ntoken = T.dynamic("ntoken", "int64")
+ num_pages = T.dynamic("num_pages", "int64")
+ pages_elem_offset = T.dynamic("pages_elem_offset", "int64")
position_map_elem_offset = T.dynamic("position_map_elem_offset", "int32")
@Ts.function
def tir_kv_cache_transpose_append(
@@ -75,9 +75,9 @@ def _kv_cache_transpose_append(num_key_value_heads, head_dim, dtype, page_size:
def _kv_cache_transpose_append_mla(d_qk: int, dtype, page_size: int = 16):
"""Return the TIR function that appends new compressed KV data to PagedKVCache for MLA."""
- ntoken = T.dynamic("ntoken")
- num_pages = T.dynamic("num_pages")
- pages_elem_offset = T.dynamic("pages_elem_offset")
+ ntoken = T.dynamic("ntoken", "int64")
+ num_pages = T.dynamic("num_pages", "int64")
+ pages_elem_offset = T.dynamic("pages_elem_offset", "int64")
position_map_elem_offset = T.dynamic("position_map_elem_offset", "int32")
@Ts.function
def tir_kv_cache_transpose_append_mla(
@@ -101,11 +101,11 @@ def _kv_cache_transpose_append_mla(d_qk: int, dtype, page_size: int = 16):
def _kv_cache_debug_get_kv(num_hidden_layers, num_key_value_heads, head_dim, dtype):
"""Return the TIR function that fetches the k/v data on given positions and layer."""
- seqlen = T.dynamic("seqlen")
- page_size = T.dynamic("page_size")
- num_pages = T.dynamic("num_pages")
- pages_elem_offset = T.dynamic("pages_elem_offset")
- position_map_elem_offset = T.dynamic("position_map_elem_offset")
+ seqlen = T.dynamic("seqlen", "int64")
+ page_size = T.dynamic("page_size", "int64")
+ num_pages = T.dynamic("num_pages", "int64")
+ pages_elem_offset = T.dynamic("pages_elem_offset", "int64")
+ position_map_elem_offset = T.dynamic("position_map_elem_offset", "int64")
@Ts.function
def tir_kv_cache_debug_get_kv(
pages: T.Tensor((num_pages, 2, num_key_value_heads, page_size, head_dim), dtype, elem_offset=pages_elem_offset),
@@ -130,11 +130,11 @@ def _kv_cache_debug_get_kv(num_hidden_layers, num_key_value_heads, head_dim, dty
def _kv_cache_debug_get_kv_mla(num_hidden_layers, d_qk, dtype):
"""Return the TIR function that fetches the k/v data on given positions and layer."""
- seqlen = T.dynamic("seqlen")
- page_size = T.dynamic("page_size")
- num_pages = T.dynamic("num_pages")
- pages_elem_offset = T.dynamic("pages_elem_offset")
- position_map_elem_offset = T.dynamic("position_map_elem_offset")
+ seqlen = T.dynamic("seqlen", "int64")
+ page_size = T.dynamic("page_size", "int64")
+ num_pages = T.dynamic("num_pages", "int64")
+ pages_elem_offset = T.dynamic("pages_elem_offset", "int64")
+ position_map_elem_offset = T.dynamic("position_map_elem_offset", "int64")
@Ts.function
def tir_kv_cache_debug_get_kv_mla(
pages: T.Tensor((num_pages, page_size, d_qk), dtype, elem_offset=pages_elem_offset),
@@ -158,7 +158,7 @@ def _copy_single_page(num_heads, page_size, head_dim, dtype, target: Target):
tx = get_max_num_threads_per_block(target)
num_pages = T.dynamic("num_pages", "int32")
- pages_elem_offset = T.dynamic("pages_elem_offset")
+ pages_elem_offset = T.dynamic("pages_elem_offset", "int64")
@Ts.function
def copy_single_page(pages: T.Tensor((num_pages, 2, num_heads, page_size, head_dim), dtype, elem_offset=pages_elem_offset), src_page_id: T.int64, tgt_page_id: T.int64, copy_length: T.int64):
T.func_attr({"tirx.is_scheduled": True})
@@ -179,7 +179,7 @@ def _copy_single_page_mla(page_size, head_dim, dtype, target: Target):
tx = get_max_num_threads_per_block(target)
num_pages = T.dynamic("num_pages", "int32")
- pages_elem_offset = T.dynamic("pages_elem_offset")
+ pages_elem_offset = T.dynamic("pages_elem_offset", "int64")
@Ts.function
def copy_single_page_mla(pages: T.Tensor((num_pages, page_size, head_dim), dtype, elem_offset=pages_elem_offset), src_page_id: T.int64, tgt_page_id: T.int64, copy_length: T.int64):
T.func_attr({"tirx.is_scheduled": True})
@@ -221,7 +221,7 @@ def _compact_kv_copy(num_heads, head_dim, dtype, target: Target, page_size: int
total_copy_length = T.dynamic("total_copy_length", "int32")
copy_length_indptr_elem_offset = T.dynamic("copy_length_indptr_elem_offset", "int32")
copy_src_dst_pos_elem_offset = T.dynamic("copy_src_dst_pos_elem_offset", "int32")
- pages_elem_offset = T.dynamic("pages_elem_offset")
+ pages_elem_offset = T.dynamic("pages_elem_offset", "int64")
@Ts.function
def compact_kv_copy(pages: T.Tensor((num_pages, 2, num_heads, page_size, head_dim), dtype, elem_offset=pages_elem_offset), copy_length_indptr: T.Tensor((batch_size + 1,), 'int32', elem_offset=copy_length_indptr_elem_offset), copy_src_dst_pos: T.Tensor((2, total_copy_length), 'int32', elem_offset=copy_src_dst_pos_elem_offset), batch_size: T.int32): # noqa: F821
T.func_attr({"tirx.is_scheduled": True})
diff --git a/python/tvm/relax/frontend/nn/llm/_prefill_kernels.py b/python/tvm/relax/frontend/nn/llm/_prefill_kernels.py
index 97e35a2d65..fd98fe83b3 100644
--- a/python/tvm/relax/frontend/nn/llm/_prefill_kernels.py
+++ b/python/tvm/relax/frontend/nn/llm/_prefill_kernels.py
@@ -226,7 +226,7 @@ def _attention_prefill(
total_len = T.dynamic("total_len", "int32")
nnz_pages = T.dynamic("nnz_pages", "int32")
max_num_pages = T.dynamic("max_num_pages", "int32")
- pages_elem_offset = T.dynamic("pages_elem_offset")
+ pages_elem_offset = T.dynamic("pages_elem_offset", "int64")
q_indptr_elem_offset = T.dynamic("q_indptr_elem_offset", "int32")
page_indptr_elem_offset = T.dynamic("page_indptr_elem_offset", "int32")
page_values_elem_offset = T.dynamic("page_values_elem_offset", "int32")
@@ -882,7 +882,7 @@ def _attention_prefill_mla(h_q, d_latent, d_rope, dtype, sliding_window: bool, t
total_len = T.dynamic("total_len", "int32")
nnz_pages = T.dynamic("nnz_pages", "int32")
max_num_pages = T.dynamic("max_num_pages", "int32")
- pages_elem_offset = T.dynamic("pages_elem_offset")
+ pages_elem_offset = T.dynamic("pages_elem_offset", "int64")
q_indptr_elem_offset = T.dynamic("q_indptr_elem_offset", "int32")
page_indptr_elem_offset = T.dynamic("page_indptr_elem_offset", "int32")
page_values_elem_offset = T.dynamic("page_values_elem_offset", "int32")
diff --git a/python/tvm/relax/frontend/nn/llm/position_embedding.py b/python/tvm/relax/frontend/nn/llm/position_embedding.py
index 181db2a62f..009d2da28d 100644
--- a/python/tvm/relax/frontend/nn/llm/position_embedding.py
+++ b/python/tvm/relax/frontend/nn/llm/position_embedding.py
@@ -391,8 +391,8 @@ def llama_rope( # pylint: disable=too-many-arguments
expr = tirx.Let(var, value, expr)
return expr
- batch_size = T.dynamic("batch_size")
- seq_len = T.dynamic("seq_len")
+ batch_size = T.dynamic("batch_size", "int64")
+ seq_len = T.dynamic("seq_len", "int64")
@Ts.function(private=True)
def fused_rope( # pylint: disable=too-many-locals
@@ -558,8 +558,8 @@ def llama_rope_with_position_map( # pylint: disable=too-many-arguments
else:
v[s, h - (num_q_heads + num_kv_heads), d] = qkv[s, h, d]
- seq_len = T.dynamic("seq_len")
- position_map_elem_offset = T.dynamic("position_map_elem_offset")
+ seq_len = T.dynamic("seq_len", "int64")
+ position_map_elem_offset = T.dynamic("position_map_elem_offset", "int64")
@Ts.function
def fused_rope_longrope_scaling( # pylint: disable=too-many-locals
@@ -783,8 +783,8 @@ def llama4_rope_with_position_map( # pylint: disable=too-many-arguments
else:
v[s, h - (num_q_heads + num_kv_heads), d] = qkv[s, h, d]
- seq_len = T.dynamic("seq_len")
- position_map_elem_offset = T.dynamic("position_map_elem_offset")
+ seq_len = T.dynamic("seq_len", "int64")
+ position_map_elem_offset = T.dynamic("position_map_elem_offset", "int64")
@Ts.function
def fused_rope_longrope_scaling( # pylint: disable=too-many-locals
diff --git a/python/tvm/relax/frontend/nn/op.py b/python/tvm/relax/frontend/nn/op.py
index 6c33c4199f..af7565f6d0 100644
--- a/python/tvm/relax/frontend/nn/op.py
+++ b/python/tvm/relax/frontend/nn/op.py
@@ -2801,8 +2801,8 @@ def sample_top_p_top_k_from_sorted_prob(
def _cumsum_mask(cumsum_sorted, top_p, top_k, i, j):
return _tir.all(cumsum_sorted[i, j] < top_p[i, 0], j + 1 < top_k[i, 0])
- batch = T.dynamic("batch")
- vocab_size = T.dynamic("vocab_size")
+ batch = T.dynamic("batch", "int64")
+ vocab_size = T.dynamic("vocab_size", "int64")
@Ts.function(private=True)
def _get_renorm_prob(
@@ -2822,9 +2822,9 @@ def sample_top_p_top_k_from_sorted_prob(
elif not _cumsum_mask(cumsum_sorted, top_p, top_k, v_ax0, v_ax1 + 1):
renorm_prob[v_ax0, 0] = cumsum_sorted[v_ax0, v_ax1 + 1]
- batch = T.dynamic("batch")
- vocab_size = T.dynamic("vocab_size")
- kernel_out_batch = T.dynamic("out_batch")
+ batch = T.dynamic("batch", "int64")
+ vocab_size = T.dynamic("vocab_size", "int64")
+ kernel_out_batch = T.dynamic("out_batch", "int64")
@Ts.function(private=True)
def _get_index_from_sorted(
@@ -2910,8 +2910,8 @@ def renormalize_top_p_top_k_prob(prob, sorted_prob, top_p, top_k):
def _cumsum_mask(cumsum_sorted, top_p, top_k, i, j):
return _tir.all(cumsum_sorted[i, j] < top_p[i, 0], j + 1 < top_k[i, 0])
- kernel_batch = T.dynamic("batch")
- vocab_size = T.dynamic("vocab_size")
+ kernel_batch = T.dynamic("batch", "int64")
+ vocab_size = T.dynamic("vocab_size", "int64")
@Ts.function(private=True)
def _get_renorm_cutoff(
diff --git a/python/tvm/script/ir_builder/ir.py b/python/tvm/script/ir_builder/ir.py
index 871d988655..fdac783ccf 100644
--- a/python/tvm/script/ir_builder/ir.py
+++ b/python/tvm/script/ir_builder/ir.py
@@ -40,7 +40,7 @@ def dtype(value: str | DataType) -> DataTypeImm:
return DataTypeImm(value)
-def dynamic(name: str, dtype: str = "int64", *, loc: LocationEntry | Location = UNKNOWN_LOC) -> Var:
+def dynamic(name: str, dtype: str = "int32", *, loc: LocationEntry | Location = UNKNOWN_LOC) -> Var:
"""Create a fresh primitive symbolic variable, independently of builder scope.
Parameters
@@ -48,7 +48,7 @@ def dynamic(name: str, dtype: str = "int64", *, loc: LocationEntry | Location =
name : str
The symbol's display name. Repeated names do not share identity.
dtype : str
- Primitive dtype, defaulting to int64.
+ Primitive dtype, defaulting to int32.
loc : LocationEntry or Location, optional
Source location of the symbol.
diff --git a/python/tvm/script/parser/transpile.py b/python/tvm/script/parser/transpile.py
index d0d1b69cba..9314cb44a7 100644
--- a/python/tvm/script/parser/transpile.py
+++ b/python/tvm/script/parser/transpile.py
@@ -1696,7 +1696,7 @@ class IRBuilderTranspiler(ast.NodeTransformer):
self._raise_error(parameter, "Only scalar type parameters are supported")
bound = getattr(parameter, "bound", None)
dtype = (
- "int64"
+ "int32"
if bound is None or (isinstance(bound, ast.Name) and bound.id == "int")
else protocol_registry.SCALAR_ANNOTATION_DTYPE.get(
self.module.prescan_ctx._match_special_func(bound)
diff --git a/src/relax/script/printer/function.cc b/src/relax/script/printer/function.cc
index a4a0824614..8cfa9055cb 100644
--- a/src/relax/script/printer/function.cc
+++ b/src/relax/script/printer/function.cc
@@ -128,7 +128,7 @@ ffi::Optional<ExprDoc> FunctionDocTranslate(DocTranslatorObj* d, ffi::AnyView in
for (const auto& [var, signature_id] : signature_candidates) {
if (!pending.count(var) || !var->ty.as<PrimTypeNode>()) continue;
IdDoc id = VarDoc(d, var);
- if (var->ty.as_or_throw<PrimType>()->dtype == (DLDataType{kDLInt, 64, 1})) {
+ if (var->ty.as_or_throw<PrimType>()->dtype == (DLDataType{kDLInt, 32, 1})) {
function->type_params.push_back(id);
} else {
function->type_params.push_back(
diff --git a/src/tirx/script/printer/function.cc b/src/tirx/script/printer/function.cc
index f5b04534ab..8033519a1f 100644
--- a/src/tirx/script/printer/function.cc
+++ b/src/tirx/script/printer/function.cc
@@ -136,7 +136,7 @@ void PrintFunction(DocTranslatorObj* d, const tirx::FunctionNode* func, ExprDoc
for (const auto& [var, signature_id] : signature_candidates) {
if (!pending.count(var) || !var->ty.as<PrimTypeNode>()) continue;
IdDoc id = VarDoc(d, var);
- if (var->ty.as_or_throw<PrimType>()->dtype == (DLDataType{kDLInt, 64, 1})) {
+ if (var->ty.as_or_throw<PrimType>()->dtype == (DLDataType{kDLInt, 32, 1})) {
doc->type_params.push_back(id);
} else {
doc->type_params.push_back(
diff --git a/tests/python/codegen/test_codegen_error_handling.py b/tests/python/codegen/test_codegen_error_handling.py
index c63dec7aa5..63c10f4453 100644
--- a/tests/python/codegen/test_codegen_error_handling.py
+++ b/tests/python/codegen/test_codegen_error_handling.py
@@ -388,7 +388,7 @@ def test_forward_reference_symbolic_shape(codegen_target):
message uses rendered access paths (e.g. "B.shape[0] + 1") for shape checks.
"""
- batch_size = T.dynamic("batch_size")
+ batch_size = T.dynamic("batch_size", "int64")
@T.function
def func(A: T.Tensor((batch_size + 1,), "int32"), B: T.Tensor((batch_size,), "int32")):
diff --git a/tests/python/contrib/test_tir_triton_integration.py b/tests/python/contrib/test_tir_triton_integration.py
index 287b9d8f36..1f5d9df627 100644
--- a/tests/python/contrib/test_tir_triton_integration.py
+++ b/tests/python/contrib/test_tir_triton_integration.py
@@ -64,8 +64,8 @@ def test_tir_triton_integration():
BLOCK_SIZE = 64
- add_m = T.dynamic("m")
- main_m = T.dynamic("m")
+ add_m = T.dynamic("m", "int64")
+ main_m = T.dynamic("m", "int64")
@I.ir_module
class Module:
@@ -107,7 +107,7 @@ def test_tir_triton_integration():
scratch_args.append(tvm.tirx.reinterpret("handle", tvm.tirx.IntImm("uint64", 0)))
# The thread extent is 256 because the kernel is compiled with num_warps=8.
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Parsed:
diff --git a/tests/python/relax/backend/adreno/mod_utils.py b/tests/python/relax/backend/adreno/mod_utils.py
index 9efa163677..8a36f3b377 100644
--- a/tests/python/relax/backend/adreno/mod_utils.py
+++ b/tests/python/relax/backend/adreno/mod_utils.py
@@ -727,7 +727,7 @@ def get_global_maxpool_expected_codegen(input_shape, pool_size, stride, padding,
def get_dequant_matmul_module(K, N):
- seq_len = T.dynamic("seq_len")
+ seq_len = T.dynamic("seq_len", "int64")
@I.ir_module
class DequantMatmul:
@@ -788,8 +788,8 @@ def get_dequant_matmul_module(K, N):
def get_dequant_vec_matmul_module(K, N):
- vocab_size_main = T.dynamic("vocab_size")
- vocab_size_dequantize = T.dynamic("vocab_size")
+ vocab_size_main = T.dynamic("vocab_size", "int64")
+ vocab_size_dequantize = T.dynamic("vocab_size", "int64")
@I.ir_module
class DequantVecMatmul:
diff --git a/tests/python/relax/backend/adreno/test_transform_annotate_custom_scope.py b/tests/python/relax/backend/adreno/test_transform_annotate_custom_scope.py
index 98f9976491..56ce341d6c 100644
--- a/tests/python/relax/backend/adreno/test_transform_annotate_custom_scope.py
+++ b/tests/python/relax/backend/adreno/test_transform_annotate_custom_scope.py
@@ -203,14 +203,14 @@ def test_conv2d_NHWC_sub_indexed():
def _test_conv2d_symbolic_sub_indexed():
- N, H, W = T.dynamic("N"), T.dynamic("H"), T.dynamic("W")
- Hw, Ww = T.dynamic("Hw"), T.dynamic("Ww")
-
- N = T.dynamic("N")
- H = T.dynamic("H")
- W = T.dynamic("W")
- Hw = T.dynamic("Hw")
- Ww = T.dynamic("Ww")
+ N, H, W = T.dynamic("N", "int64"), T.dynamic("H", "int64"), T.dynamic("W", "int64")
+ Hw, Ww = T.dynamic("Hw", "int64"), T.dynamic("Ww", "int64")
+
+ N = T.dynamic("N", "int64")
+ H = T.dynamic("H", "int64")
+ W = T.dynamic("W", "int64")
+ Hw = T.dynamic("Hw", "int64")
+ Ww = T.dynamic("Ww", "int64")
@I.ir_module
class Input:
diff --git a/tests/python/relax/distributed/test_distributed_transform_propagate_sharding.py b/tests/python/relax/distributed/test_distributed_transform_propagate_sharding.py
index 4e2e645add..c4e14dcd45 100644
--- a/tests/python/relax/distributed/test_distributed_transform_propagate_sharding.py
+++ b/tests/python/relax/distributed/test_distributed_transform_propagate_sharding.py
@@ -246,10 +246,10 @@ def test_mlp_const():
def test_mlp_dynamic_shape():
- m = T.dynamic("m")
- n = T.dynamic("n")
- k0 = T.dynamic("k0")
- k1 = T.dynamic("k1")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
+ k0 = T.dynamic("k0", "int64")
+ k1 = T.dynamic("k1", "int64")
@I.ir_module
class MLPDynamicShape:
@@ -275,10 +275,10 @@ def test_mlp_dynamic_shape():
lv3 = R.matmul(lv2, weight2)
return lv3
- m = T.dynamic("m")
- n = T.dynamic("n")
- k0 = T.dynamic("k0")
- k1 = T.dynamic("k1")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
+ k0 = T.dynamic("k0", "int64")
+ k1 = T.dynamic("k1", "int64")
@I.ir_module
class ShardedMLPDynamicShape:
@@ -1555,10 +1555,10 @@ def test_decoder_layer_tir():
def test_decoder_layer_dynamic_shape():
- rms_norm_n = T.dynamic("n")
- rotary_embedding_n = T.dynamic("n")
- foo_n = T.dynamic("n")
- m = T.dynamic("m")
+ rms_norm_n = T.dynamic("n", "int64")
+ rotary_embedding_n = T.dynamic("n", "int64")
+ foo_n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class LlamaAttentionLayerDynamicShape:
@@ -1767,10 +1767,10 @@ def test_decoder_layer_dynamic_shape():
return gv
- rms_norm_n = T.dynamic("n")
- rotary_embedding_n = T.dynamic("n")
- foo_n = T.dynamic("n")
- m = T.dynamic("m")
+ rms_norm_n = T.dynamic("n", "int64")
+ rotary_embedding_n = T.dynamic("n", "int64")
+ foo_n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class ShardedLlamaAttentionLayerDynamicShape:
diff --git a/tests/python/relax/script/test_relax_script_basic_usage.py b/tests/python/relax/script/test_relax_script_basic_usage.py
index f0c5741792..bbeaf3f03f 100644
--- a/tests/python/relax/script/test_relax_script_basic_usage.py
+++ b/tests/python/relax/script/test_relax_script_basic_usage.py
@@ -950,8 +950,8 @@ def test_empty_tuple():
@pytest.mark.skipif(sys.version_info < (3, 12), reason="PEP 695 requires Python 3.12")
def test_arith_operators():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@R.function
def foo(x: R.Tensor((m, n), "float32"), y: R.Tensor((m, n), "float32")):
@@ -1039,8 +1039,8 @@ def test_vm_ops():
@pytest.mark.skipif(sys.version_info < (3, 12), reason="PEP 695 requires Python 3.12")
def test_builtin_ops():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@R.function
def foo(x: R.Tensor((m, n), dtype="float32")):
diff --git a/tests/python/relax/script/test_relax_script_dynamic_shape.py b/tests/python/relax/script/test_relax_script_dynamic_shape.py
index d7c45f66e5..ca7db655cf 100644
--- a/tests/python/relax/script/test_relax_script_dynamic_shape.py
+++ b/tests/python/relax/script/test_relax_script_dynamic_shape.py
@@ -33,10 +33,10 @@ from tvm.script import relax as R
from tvm.script import s_tir as Ts
from tvm.script import tirx as T
-M = T.dynamic("M")
+M = T.dynamic("M", "int64")
-UNUSED_GENERIC = T.dynamic("UNUSED_GENERIC")
+UNUSED_GENERIC = T.dynamic("UNUSED_GENERIC", "int64")
@pytest.mark.skipif(sys.version_info < (3, 12), reason="PEP 695 requires Python 3.12")
@@ -49,13 +49,13 @@ def test_type_vars_roundtrip():
script = func.script()
assert script.startswith("from __future__ import annotations\n\n")
- assert "def main[M](" in script
+ assert "def main[M: T.int64](" in script
assert 'R.Tensor((M, M * 2), dtype="float32")' in script
assert "M = T.int64()" not in script
typed = tvm.script.from_source(
"""
@R.function(private=True)
-def func[M: int](x: R.Tensor((M, M * 2), "float32")):
+def func[M: T.int64](x: R.Tensor((M, M * 2), "float32")):
return x
""",
extra_vars={"I": tvm.script.ir, "R": tvm.script.relax, "T": tvm.script.tirx},
@@ -65,7 +65,7 @@ def func[M: int](x: R.Tensor((M, M * 2), "float32")):
repeated = func.script()
assert "from __future__ import annotations" in repeated
- assert "def main[M](" in repeated
+ assert "def main[M: T.int64](" in repeated
assert 'R.Tensor((M, M * 2), dtype="float32")' in repeated
assert "M = T.int64()" not in repeated
assert "UNUSED_GENERIC" not in script
@@ -87,8 +87,8 @@ def func[M: int](x: R.Tensor((M, M * 2), "float32")):
def test_dynamic_module_symbol_identity():
- shared = T.dynamic("n")
- independent = T.dynamic("n")
+ shared = T.dynamic("n", "int64")
+ independent = T.dynamic("n", "int64")
@R.function(private=True)
def first(x: R.Tensor((shared,), "float32")):
@@ -379,7 +379,7 @@ def test_erase_to_well_defined_infers_from_shape_expr():
def test_symbolic_vars_in_tensor_shape_with_usage_first():
"""A captured symbol can first appear inside a compound dimension."""
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@R.function
def foo(x: R.Tensor((m + 1,), "float32"), y: R.Tensor((m, 1), "float32")):
@@ -564,7 +564,7 @@ def test_function_symbolic_variables_are_annotated():
def test_non_declaration_prim_expr_emits_binding():
"""Dtype casts emit ordinary bindings without replacing shape symbols."""
- symbol = T.dynamic("extent")
+ symbol = T.dynamic("extent", "int64")
@R.function(private=True)
def func(A: R.Tensor([symbol], "float32")):
diff --git a/tests/python/relax/test_analysis.py b/tests/python/relax/test_analysis.py
index 28908f2d2f..fe3c7a743a 100644
--- a/tests/python/relax/test_analysis.py
+++ b/tests/python/relax/test_analysis.py
@@ -304,9 +304,9 @@ def test_edge_binding_block_fake_unused_remove_all_unused():
def test_edge_binding_block_fake_unused_remove_all_unused2():
- m = T.dynamic("m")
- n = T.dynamic("n")
- k = T.dynamic("k")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
+ k = T.dynamic("k", "int64")
@tvm.script.ir_module
class IdentityUnused:
@@ -402,7 +402,7 @@ def test_retain_impure_calls_unused_in_binding_block():
def test_retain_calls_to_impure_builtin_ops():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Module:
@@ -673,7 +673,7 @@ def test_reshape_pattern_expand_dims():
def test_reshape_pattern_dyn_1():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@Ts.function
def reshape(
@@ -701,7 +701,7 @@ def test_reshape_pattern_dyn_1():
def test_reshape_pattern_dyn_2():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@Ts.function
def reshape(A: T.Tensor((T.int64(1), n), "int32"), T_reshape: T.Tensor((n,), "int32")):
@@ -716,7 +716,7 @@ def test_reshape_pattern_dyn_2():
def test_reshape_pattern_dyn_3():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@Ts.function
def reshape(
@@ -738,7 +738,7 @@ def test_reshape_pattern_dyn_3():
def test_reshape_pattern_dyn_4():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@Ts.function
def reshape(
@@ -768,7 +768,7 @@ def test_reshape_pattern_dyn_4():
def test_reshape_pattern_dyn_5():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@Ts.function
def reshape(
diff --git a/tests/python/relax/test_analysis_computable_at_compile_time.py b/tests/python/relax/test_analysis_computable_at_compile_time.py
index c28c50d8be..e4956c3e9e 100644
--- a/tests/python/relax/test_analysis_computable_at_compile_time.py
+++ b/tests/python/relax/test_analysis_computable_at_compile_time.py
@@ -134,7 +134,7 @@ def test_dataflow_vars():
def test_compile_time_symbolic_shape():
"""Compile-time bindings may contain symbolic shapes"""
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@R.function
def func(A: R.Tensor([1], "int32"), B: R.Tensor([n], "int32")):
@@ -151,8 +151,8 @@ def test_compile_time_symbolic_shape():
def test_symbolic_variables_from_match_binding():
"""Symbolic vars may be inferred from compile-time bindings"""
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@R.function
def func(A: R.Tensor(ndim=1, dtype="int32"), B: R.Tensor(ndim=1, dtype="int32")):
@@ -179,8 +179,8 @@ def test_compile_time_expressions_may_not_use_runtime_symbolic_variables():
first knowing `A`, and is therefore unknown at compile-time.
"""
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@R.function
def func(A: R.Tensor([n], "int32"), B: R.Tensor([m], "int32")):
@@ -203,7 +203,7 @@ def test_compile_time_expressions_may_infer_same_variable_as_run_time():
can also be inferred from the compile-time parameter `B`.
"""
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@R.function
def func(A: R.Tensor([n], "int32"), B: R.Tensor([n], "int32")):
@@ -227,8 +227,8 @@ def test_compile_time_expressions_may_use_variables_from_match_cast():
first knowing `A`, and is therefore unknown at compile-time.
"""
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@R.function
def func(A: R.Tensor([n], "int32"), B: R.Tensor(ndim=1, dtype="int32")):
diff --git a/tests/python/relax/test_analysis_suggest_layout_transforms.py b/tests/python/relax/test_analysis_suggest_layout_transforms.py
index 8604fba2f7..1059a470a5 100644
--- a/tests/python/relax/test_analysis_suggest_layout_transforms.py
+++ b/tests/python/relax/test_analysis_suggest_layout_transforms.py
@@ -258,10 +258,10 @@ def test_SRSR_block():
def test_op_elemwise_symbolic():
- N = T.dynamic("N")
- C = T.dynamic("C")
- H = T.dynamic("H")
- W = T.dynamic("W")
+ N = T.dynamic("N", "int64")
+ C = T.dynamic("C", "int64")
+ H = T.dynamic("H", "int64")
+ W = T.dynamic("W", "int64")
@Ts.function(private=True)
def before(Arg: T.Tensor((N, C, H, W), "float32"), Relu: T.Tensor((N, C, H, W), "float32")):
@@ -272,10 +272,10 @@ def test_op_elemwise_symbolic():
Ts.writes(Relu[v_i0, v_i1, v_i2, v_i3])
Relu[v_i0, v_i1, v_i2, v_i3] = T.max(Arg[v_i0, v_i1, v_i2, v_i3], T.float32(0))
- N = T.dynamic("N")
- C = T.dynamic("C")
- H = T.dynamic("H")
- W = T.dynamic("W")
+ N = T.dynamic("N", "int64")
+ C = T.dynamic("C", "int64")
+ H = T.dynamic("H", "int64")
+ W = T.dynamic("W", "int64")
@Ts.function(private=True)
def expected(Arg: T.Tensor((N, H, W, C), "float32"), Relu: T.Tensor((N, H, W, C), "float32")):
diff --git a/tests/python/relax/test_analysis_type_analysis.py b/tests/python/relax/test_analysis_type_analysis.py
index 541a69b241..3c75fa64a0 100644
--- a/tests/python/relax/test_analysis_type_analysis.py
+++ b/tests/python/relax/test_analysis_type_analysis.py
@@ -758,8 +758,8 @@ def test_collect_symbolic_var_from_non_tensor_params(param_type, param_order):
def test_collect_nonnegative_expressions():
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@R.function
def func(
diff --git a/tests/python/relax/test_analysis_well_formed.py b/tests/python/relax/test_analysis_well_formed.py
index 15f4b6243c..38050ca99d 100644
--- a/tests/python/relax/test_analysis_well_formed.py
+++ b/tests/python/relax/test_analysis_well_formed.py
@@ -566,8 +566,8 @@ def test_ty_args_tir_var_used_before_define_call_tir():
def test_ty_erase_to_well_formed():
# Error: The return ty contains undefined symbolic vars
"""
- m, n = T.dynamic("m"), T.dynamic("n")
- m1, n1 = T.dynamic("m1"), T.dynamic("n1")
+ m, n = T.dynamic("m", "int64"), T.dynamic("n", "int64")
+ m1, n1 = T.dynamic("m1", "int64"), T.dynamic("n1", "int64")
@R.function
def foo(x: R.Tensor((m, n), dtype="float32")) -> R.Tensor((m1, n1), dtype="float32"):
@@ -1012,8 +1012,8 @@ def test_call_tir_with_correct_dynamic_output_shape():
"""
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@I.ir_module
class Module:
@@ -1044,8 +1044,8 @@ def test_call_tir_with_incorrect_dynamic_output_shape():
"""
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@I.ir_module(check_well_formed=False)
class Module:
@@ -1078,8 +1078,8 @@ def test_call_tir_incorrect_dimensionality_of_output_shape():
"""
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@I.ir_module(check_well_formed=False)
class Module:
@@ -1115,8 +1115,8 @@ def test_call_tir_output_shape_with_mixed_static_and_dynamic():
"""
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@I.ir_module(check_well_formed=False)
class Module:
@@ -1146,8 +1146,8 @@ def test_call_tir_with_correct_inferred_dynamic_output_shape():
"""
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@I.ir_module
class Module:
@@ -1182,8 +1182,8 @@ def test_call_tir_with_incorrect_inferred_dynamic_output_shape():
"""
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@I.ir_module(check_well_formed=False)
class Module:
@@ -1214,8 +1214,8 @@ def test_call_tir_with_dtensor_arguments():
# from tvm.script.parser import relax as R
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@I.ir_module
class Module:
diff --git a/tests/python/relax/test_ast_printer.py b/tests/python/relax/test_ast_printer.py
index c236cbac4f..69cc898c0c 100644
--- a/tests/python/relax/test_ast_printer.py
+++ b/tests/python/relax/test_ast_printer.py
@@ -351,7 +351,7 @@ def test_ty():
def test_call_packed():
# test case from test_parser
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@R.function(pure=False)
def f(
@@ -440,10 +440,10 @@ def test_op_attrs():
def test_call_tir():
# also from test_parser
- m_addone = T.dynamic("m")
- n_addone = T.dynamic("n")
- m_foo = T.dynamic("m")
- n_foo = T.dynamic("n")
+ m_addone = T.dynamic("m", "int64")
+ n_addone = T.dynamic("n", "int64")
+ m_foo = T.dynamic("m", "int64")
+ n_foo = T.dynamic("n", "int64")
@tvm.script.ir_module
class TestCallTIR:
@@ -511,8 +511,8 @@ def test_call_tir():
def test_call_dps_packed():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@R.function
def foo(x: R.Tensor((m, n), "float32")):
diff --git a/tests/python/relax/test_backend_dispatch_sampling.py b/tests/python/relax/test_backend_dispatch_sampling.py
index 81832cc185..0ddffd84b9 100644
--- a/tests/python/relax/test_backend_dispatch_sampling.py
+++ b/tests/python/relax/test_backend_dispatch_sampling.py
@@ -44,9 +44,9 @@ class MultiFromUniformModule:
def test_dispatch_multinomial_from_uniform_generic():
# fmt: off
- batch = T.dynamic("batch")
- vocab_size = T.dynamic("vocab_size")
- out_batch = T.dynamic("out_batch")
+ batch = T.dynamic("batch", "int64")
+ vocab_size = T.dynamic("vocab_size", "int64")
+ out_batch = T.dynamic("out_batch", "int64")
@I.ir_module
class Expected:
@@ -82,9 +82,9 @@ def test_dispatch_multinomial_from_uniform_generic():
def test_dispatch_multinomial_from_uniform_gpu():
# fmt: off
- n = T.dynamic("n")
- vocab_size = T.dynamic("vocab_size")
- batch_size = T.dynamic("batch_size")
+ n = T.dynamic("n", "int64")
+ vocab_size = T.dynamic("vocab_size", "int64")
+ batch_size = T.dynamic("batch_size", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_backend_dispatch_sort_scan.py b/tests/python/relax/test_backend_dispatch_sort_scan.py
index 809dbe25e1..f457ca554c 100644
--- a/tests/python/relax/test_backend_dispatch_sort_scan.py
+++ b/tests/python/relax/test_backend_dispatch_sort_scan.py
@@ -74,7 +74,7 @@ def test_dispatch_scanop_cuda():
lowered to the packed func `"gpu_2d_continuous_cumsum"`.
"""
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Before:
@@ -122,7 +122,7 @@ def test_dispatch_scanop_cuda():
def test_dispatch_sort():
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Before:
@@ -220,7 +220,7 @@ def test_dispatch_sort_cuda():
def test_dispatch_argsort():
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Before:
@@ -314,7 +314,7 @@ def test_dispatch_argsort_cuda():
def test_dispatch_topk():
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Before:
@@ -424,8 +424,8 @@ def test_dispatch_sort_cuda_large_batch(size):
if not tvm.testing.device_enabled(target):
pytest.skip(f"{target} not enabled")
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Module:
@@ -460,8 +460,8 @@ def test_dispatch_topk_cuda_large_batch():
if not tvm.testing.device_enabled(target):
pytest.skip(f"{target} not enabled")
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Module:
@@ -527,8 +527,8 @@ def test_dispatch_cumsum_gpu(target, index_bits):
if not tvm.testing.device_enabled(target):
pytest.skip(f"{target} not enabled")
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Module:
@@ -562,8 +562,8 @@ def test_dispatch_cumsum_index_width(target_kind, index_bits):
"""Respect the caller's index budget without restricting Metal's default."""
from tvm.relax.backend.gpu_generic import gpu_2d_continuous_cumsum
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Module:
@@ -592,8 +592,8 @@ def test_dispatch_cumprod_cuda_large_batch():
if not tvm.testing.device_enabled(target):
pytest.skip(f"{target} not enabled")
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Module:
@@ -698,7 +698,7 @@ def test_dispatch_cumsum_webgpu_axes_and_dtypes(
def test_dispatch_cumsum_webgpu_symbolic_non_contiguous_axis():
"""The serial WebGPU fallback accepts a symbolic scan extent."""
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Symbolic:
diff --git a/tests/python/relax/test_backend_transform_shape_lower.py b/tests/python/relax/test_backend_transform_shape_lower.py
index 588a38d8d5..e71eab3b18 100644
--- a/tests/python/relax/test_backend_transform_shape_lower.py
+++ b/tests/python/relax/test_backend_transform_shape_lower.py
@@ -118,8 +118,8 @@ def test_static_fn_check():
def test_simple_symbolic_shape():
MS = MatchShapeCode
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class Before:
@@ -133,8 +133,8 @@ def test_simple_symbolic_shape():
"m": 1,
}
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class Expected:
@@ -180,9 +180,9 @@ def test_symbolic_compute():
MS = MatchShapeCode
MK = MakeShapeCode
- m = T.dynamic("m")
- k = T.dynamic("k")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ k = T.dynamic("k", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Before:
@@ -198,9 +198,9 @@ def test_symbolic_compute():
# 0: n, 1: m, 2:k, 3: k+1
sindex = {"n": 0, "m": 1, "k": 2, "k+1": 3}
- m = T.dynamic("m")
- k = T.dynamic("k")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ k = T.dynamic("k", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -298,9 +298,9 @@ def test_symbolic_compute():
def test_tuple_handling():
MS = MatchShapeCode
- n = T.dynamic("n")
- m = T.dynamic("m")
- k = T.dynamic("k")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
+ k = T.dynamic("k", "int64")
@tvm.script.ir_module
class Before:
@@ -314,9 +314,9 @@ def test_tuple_handling():
# slot assignment:
sindex = {"n": 0, "m": 1, "k": 2}
- n = T.dynamic("n")
- m = T.dynamic("m")
- k = T.dynamic("k")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
+ k = T.dynamic("k", "int64")
@tvm.script.ir_module
class Expected:
@@ -391,8 +391,8 @@ def test_return_match_check():
"""Test when return body is not same as ret_ty, runtime match check needed."""
MS = MatchShapeCode
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class Before:
@@ -407,8 +407,8 @@ def test_return_match_check():
"m": 1,
}
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class Expected:
@@ -478,7 +478,7 @@ def test_return_match_check_with_new_expr():
"""
MS = MatchShapeCode
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Before:
@@ -494,7 +494,7 @@ def test_return_match_check_with_new_expr():
"n * n": 1,
}
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -561,10 +561,10 @@ def test_symbolic_shape_multiple_function():
MS = MatchShapeCode
MK = MakeShapeCode
- m_fn1 = T.dynamic("m")
- n_fn1 = T.dynamic("n")
- n_fn2 = T.dynamic("n")
- m_fn2 = T.dynamic("m")
+ m_fn1 = T.dynamic("m", "int64")
+ n_fn1 = T.dynamic("n", "int64")
+ n_fn2 = T.dynamic("n", "int64")
+ m_fn2 = T.dynamic("m", "int64")
@I.ir_module
class Before:
@@ -588,10 +588,10 @@ def test_symbolic_shape_multiple_function():
"m": 1,
}
- m_fn1 = T.dynamic("m")
- n_fn1 = T.dynamic("n")
- n_fn2 = T.dynamic("n")
- m_fn2 = T.dynamic("m")
+ m_fn1 = T.dynamic("m", "int64")
+ n_fn1 = T.dynamic("n", "int64")
+ n_fn2 = T.dynamic("n", "int64")
+ m_fn2 = T.dynamic("m", "int64")
@I.ir_module
class Expected:
@@ -757,7 +757,7 @@ def test_check_lifted_weights():
def test_check_weights_with_dynamic_shape():
MS = MatchShapeCode
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -771,7 +771,7 @@ def test_check_weights_with_dynamic_shape():
param_1 = params[1]
return (x, param_0, param_1)
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_base_py_module_symbolic_shape.py b/tests/python/relax/test_base_py_module_symbolic_shape.py
index 45c9120080..d8d5be8d10 100644
--- a/tests/python/relax/test_base_py_module_symbolic_shape.py
+++ b/tests/python/relax/test_base_py_module_symbolic_shape.py
@@ -63,8 +63,8 @@ def test_infer_concrete_shape_error_when_uninferrable():
bpm._infer_concrete_shape_from_args([k, 8], in_args=[])
-n_add_tir = T.dynamic("n")
-n_main_relax = T.dynamic("n")
+n_add_tir = T.dynamic("n", "int64")
+n_main_relax = T.dynamic("n", "int64")
@R.py_module
@@ -197,12 +197,12 @@ def test_infer_concrete_shape_wrong_ndim():
bpm._infer_concrete_shape_from_args(sym_shape, [x])
-m_matmul_tir = T.dynamic("m")
-n_matmul_tir = T.dynamic("n")
-k_matmul_tir = T.dynamic("k")
-m_matmul_relax = T.dynamic("m")
-k_matmul_relax = T.dynamic("k")
-n_matmul_relax = T.dynamic("n")
+m_matmul_tir = T.dynamic("m", "int64")
+n_matmul_tir = T.dynamic("n", "int64")
+k_matmul_tir = T.dynamic("k", "int64")
+m_matmul_relax = T.dynamic("m", "int64")
+k_matmul_relax = T.dynamic("k", "int64")
+n_matmul_relax = T.dynamic("n", "int64")
@R.py_module
diff --git a/tests/python/relax/test_bind_symbolic_vars.py b/tests/python/relax/test_bind_symbolic_vars.py
index bbd95a43d8..e4d6a8866f 100644
--- a/tests/python/relax/test_bind_symbolic_vars.py
+++ b/tests/python/relax/test_bind_symbolic_vars.py
@@ -33,9 +33,9 @@ def test_bind_static_value(replace_by_tir_var):
The replaced variables may be given either as strings, or as TIR variables
"""
- M = T.dynamic("M")
- K = T.dynamic("K")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ K = T.dynamic("K", "int64")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def before(A: R.Tensor((M, K)), B: R.Tensor((K, N))) -> R.Tensor((M, N)):
@@ -105,8 +105,8 @@ def test_string_var_when_other_var_has_duplicate_var_names():
def test_error_with_nonexisting_var_name():
"""A string name of a symbolic var must be used by the function"""
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def func(A: R.Tensor((M, N))):
@@ -119,8 +119,8 @@ def test_error_with_nonexisting_var_name():
def test_error_with_nonexisting_tir_var():
"""A TIR symbolic var must be a symbolic var of the function"""
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def func(A: R.Tensor([M, N])):
@@ -133,8 +133,8 @@ def test_error_with_nonexisting_tir_var():
def test_error_with_multiple_definitions():
"""The string/TIR var syntaxes may not define the same variable"""
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def func(A: R.Tensor([M, N])):
@@ -150,8 +150,8 @@ def test_error_with_multiple_definitions():
def test_error_if_output_has_undefined():
"""The replacements may not introduce undefined symbolic vars"""
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def func(A: R.Tensor([M, N])):
@@ -166,14 +166,14 @@ def test_error_if_output_has_undefined():
def test_replacements_may_produce_new_symbolic_vars():
"""The output may introduce symbolic vars, but they must be bound"""
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def before(A: R.Tensor([M, N])):
return A
- outside_var = T.dynamic("outside_var")
+ outside_var = T.dynamic("outside_var", "int64")
@R.function(private=True)
def expected(A: R.Tensor([outside_var * 2, outside_var])):
@@ -188,15 +188,15 @@ def test_replacements_may_produce_new_symbolic_vars():
def test_bind_symbolic_vars_in_tensor_shape():
"""The bound variable should be replaced when appearing in type"""
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def before(A: R.Tensor([M, N])):
B = R.call_dps_packed(_ExternFunc("dummy_func"), [A], ty_args=[R.Tensor([2 * M * N])])
return B
- M = T.dynamic("M")
+ M = T.dynamic("M", "int64")
@R.function(private=True)
def expected(A: R.Tensor([M, 16])):
@@ -210,15 +210,15 @@ def test_bind_symbolic_vars_in_tensor_shape():
def test_bind_symbolic_vars_in_shape_expr():
"""The bound variable should be replaced when appearing in R.Shape"""
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def before(A: R.Tensor([M * N]), x: R.Shape([M, N])):
B = R.call_dps_packed(_ExternFunc("dummy_func"), [A], ty_args=[R.Tensor([2 * M * N])])
return B
- M = T.dynamic("M")
+ M = T.dynamic("M", "int64")
@R.function(private=True)
def expected(A: R.Tensor([M * 16]), x: R.Shape([M, 16])):
@@ -232,15 +232,15 @@ def test_bind_symbolic_vars_in_shape_expr():
def test_bind_strided_slice():
"""relax.op.strided_slice stores Expr attributes"""
- N = T.dynamic("N")
- M = T.dynamic("M")
+ N = T.dynamic("N", "int64")
+ M = T.dynamic("M", "int64")
@R.function(private=True)
def before(A: R.Tensor([M, N])):
B = R.strided_slice(A, [1], [0], [N // 4])
return B
- M = T.dynamic("M")
+ M = T.dynamic("M", "int64")
@R.function(private=True)
def expected(A: R.Tensor([M, 32])):
@@ -256,8 +256,8 @@ def test_bind_strided_slice():
def test_bind_inside_match_cast():
"""Symbolic variables may occur within R.match_cast"""
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def before(A: R.Tensor([M, N]), B: R.Tensor(ndim=2)):
@@ -265,7 +265,7 @@ def test_bind_inside_match_cast():
D = R.add(A, C)
return D
- M = T.dynamic("M")
+ M = T.dynamic("M", "int64")
@R.function(private=True)
def expected(A: R.Tensor([M, 32]), B: R.Tensor(ndim=2)):
diff --git a/tests/python/relax/test_blockbuilder_core.py b/tests/python/relax/test_blockbuilder_core.py
index 12b7adb8ff..f053f46e1e 100644
--- a/tests/python/relax/test_blockbuilder_core.py
+++ b/tests/python/relax/test_blockbuilder_core.py
@@ -661,8 +661,8 @@ def test_emit_nested_tuple(emit_nested_tuple):
def make_expected(emit_nested_tuple: bool):
if emit_nested_tuple:
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@R.function
def func(
@@ -674,8 +674,8 @@ def test_emit_nested_tuple(emit_nested_tuple):
return ((n_1, m_1), x, y)
else:
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@R.function
def func(
diff --git a/tests/python/relax/test_blockbuilder_emit_te.py b/tests/python/relax/test_blockbuilder_emit_te.py
index 74739e5cc9..b0578a30f3 100644
--- a/tests/python/relax/test_blockbuilder_emit_te.py
+++ b/tests/python/relax/test_blockbuilder_emit_te.py
@@ -43,7 +43,7 @@ def test_emit_te_with_symbolic_arg():
after = bb.get()
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_codegen_cutlass.py b/tests/python/relax/test_codegen_cutlass.py
index 29e0701724..5900880b7b 100644
--- a/tests/python/relax/test_codegen_cutlass.py
+++ b/tests/python/relax/test_codegen_cutlass.py
@@ -1821,7 +1821,7 @@ def test_conv2d_cuda_graph():
def test_fp16A_int8B_gemm_batched():
- b = T.dynamic("b")
+ b = T.dynamic("b", "int64")
@I.ir_module
class Module:
@@ -1962,7 +1962,7 @@ def test_fp16A_int8B_gemm_batched():
def test_fp16A_int8B_gemm_batched_finegrained():
- b = T.dynamic("b")
+ b = T.dynamic("b", "int64")
@I.ir_module
class Module:
@@ -2245,8 +2245,8 @@ def _test_batched_var_len_attention(
def test_batched_var_len_attention():
- num_tokens = T.dynamic("num_tokens")
- num_seq = T.dynamic("num_seq")
+ num_tokens = T.dynamic("num_tokens", "int64")
+ num_seq = T.dynamic("num_seq", "int64")
@I.ir_module
class Module:
@@ -2299,8 +2299,8 @@ def test_batched_var_len_attention():
def test_batched_var_len_multi_query_attention():
- num_tokens = T.dynamic("num_tokens")
- num_seq = T.dynamic("num_seq")
+ num_tokens = T.dynamic("num_tokens", "int64")
+ num_seq = T.dynamic("num_seq", "int64")
@I.ir_module
class Module:
@@ -2395,8 +2395,8 @@ def test_sliding_window():
def test_batched_var_len_sliding_window():
- num_tokens = T.dynamic("num_tokens")
- num_seq = T.dynamic("num_seq")
+ num_tokens = T.dynamic("num_tokens", "int64")
+ num_seq = T.dynamic("num_seq", "int64")
@I.ir_module
class Module:
diff --git a/tests/python/relax/test_contrib_vllm.py b/tests/python/relax/test_contrib_vllm.py
index 51de3ec895..d76a4cc91d 100644
--- a/tests/python/relax/test_contrib_vllm.py
+++ b/tests/python/relax/test_contrib_vllm.py
@@ -65,9 +65,9 @@ def build_and_run(mod, inputs_np, target, legalize=True):
def test_attention():
- num_seqs = T.dynamic("num_seqs")
- num_blocks = T.dynamic("num_blocks")
- max_num_blocks_per_seq = T.dynamic("max_num_blocks_per_seq")
+ num_seqs = T.dynamic("num_seqs", "int64")
+ num_blocks = T.dynamic("num_blocks", "int64")
+ max_num_blocks_per_seq = T.dynamic("max_num_blocks_per_seq", "int64")
@I.ir_module
class ModulePagedAttentionV1:
@@ -105,9 +105,9 @@ def test_attention():
R.output(out)
return out
- num_seqs = T.dynamic("num_seqs")
- num_blocks = T.dynamic("num_blocks")
- max_num_blocks_per_seq = T.dynamic("max_num_blocks_per_seq")
+ num_seqs = T.dynamic("num_seqs", "int64")
+ num_blocks = T.dynamic("num_blocks", "int64")
+ max_num_blocks_per_seq = T.dynamic("max_num_blocks_per_seq", "int64")
@I.ir_module
class ModulePagedAttentionV2:
@@ -352,8 +352,8 @@ def test_attention():
def test_cache():
- num_tokens = T.dynamic("num_tokens")
- num_blocks = T.dynamic("num_blocks")
+ num_tokens = T.dynamic("num_tokens", "int64")
+ num_blocks = T.dynamic("num_blocks", "int64")
@I.ir_module
class Module:
diff --git a/tests/python/relax/test_dataflow_inplace.py b/tests/python/relax/test_dataflow_inplace.py
index c1f39f78b2..fe0baba550 100644
--- a/tests/python/relax/test_dataflow_inplace.py
+++ b/tests/python/relax/test_dataflow_inplace.py
@@ -540,8 +540,8 @@ def test_insert_inplace_calls():
def test_dynamic():
- a_dim = T.dynamic("a")
- b = T.dynamic("b")
+ a_dim = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
@I.ir_module
class DynamicTestCase:
@@ -561,12 +561,12 @@ def test_dynamic():
transform_pass = DataflowUseInplaceCalls()
new_mod = transform_pass(DynamicTestCase)
- a_add_inplace = T.dynamic("a")
- b_add_inplace = T.dynamic("b")
- a_subtract_inplace = T.dynamic("a")
- b_subtract_inplace = T.dynamic("b")
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
+ a_add_inplace = T.dynamic("a", "int64")
+ b_add_inplace = T.dynamic("b", "int64")
+ a_subtract_inplace = T.dynamic("a", "int64")
+ b_subtract_inplace = T.dynamic("b", "int64")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
@I.ir_module
class Expected:
@@ -635,10 +635,10 @@ def test_dynamic():
def test_dynamic_mismatch():
# cannot statically prove the shapes to be equal so the module should be unchanged
- a_dim = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a_dim = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@I.ir_module
class DynamicMistmatchTestCase:
diff --git a/tests/python/relax/test_dataflow_pattern.py b/tests/python/relax/test_dataflow_pattern.py
index 43dd771385..105b02085c 100644
--- a/tests/python/relax/test_dataflow_pattern.py
+++ b/tests/python/relax/test_dataflow_pattern.py
@@ -724,10 +724,10 @@ def test_concat_mm_split():
def test_self_attention():
# The example comes from.
# https://developer.nvidia.com/blog/nlu-with-tensorrt-bert/
- b = T.dynamic("b")
- s = T.dynamic("s")
- n = T.dynamic("n")
- h = T.dynamic("h")
+ b = T.dynamic("b", "int64")
+ s = T.dynamic("s", "int64")
+ n = T.dynamic("n", "int64")
+ h = T.dynamic("h", "int64")
@tvm.script.ir_module
class SelfAttention:
@@ -1603,7 +1603,7 @@ def test_same_shape_pattern(same_shape_func_type):
return out
elif same_shape_func_type == "same_dynamic_shape":
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@R.function(private=True)
def func(
@@ -1632,8 +1632,8 @@ def test_same_shape_pattern(same_shape_func_type):
return out
elif same_shape_func_type == "different_dynamic_shape":
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@R.function(private=True)
def func(
diff --git a/tests/python/relax/test_dataflow_rewriter.py b/tests/python/relax/test_dataflow_rewriter.py
index 57d2abb548..d24e2fd05d 100644
--- a/tests/python/relax/test_dataflow_rewriter.py
+++ b/tests/python/relax/test_dataflow_rewriter.py
@@ -1225,12 +1225,12 @@ def test_match_dynamic_shape():
"""
- N1_pattern = T.dynamic("N1")
- M_pattern = T.dynamic("M")
- N2_pattern = T.dynamic("N2")
- N1_replacement = T.dynamic("N1")
- N2_replacement = T.dynamic("N2")
- M_replacement = T.dynamic("M")
+ N1_pattern = T.dynamic("N1", "int64")
+ M_pattern = T.dynamic("M", "int64")
+ N2_pattern = T.dynamic("N2", "int64")
+ N1_replacement = T.dynamic("N1", "int64")
+ N2_replacement = T.dynamic("N2", "int64")
+ M_replacement = T.dynamic("M", "int64")
@R.rewriter
class Rewriter:
@@ -1271,9 +1271,9 @@ def test_match_dynamic_shape():
out = proj_A + proj_B
return out
- N1 = T.dynamic("N1")
- M = T.dynamic("M")
- N2 = T.dynamic("N2")
+ N1 = T.dynamic("N1", "int64")
+ M = T.dynamic("M", "int64")
+ N2 = T.dynamic("N2", "int64")
@R.function(private=True)
def expected(
@@ -1303,10 +1303,10 @@ def test_match_dynamic_shape():
def test_match_dynamic_pattern_against_dynamic_shape():
"""A dynamic pattern may match a static shape"""
- M_pattern = T.dynamic("M")
- N_pattern = T.dynamic("N")
- M_replacement = T.dynamic("M")
- N_replacement = T.dynamic("N")
+ M_pattern = T.dynamic("M", "int64")
+ N_pattern = T.dynamic("N", "int64")
+ M_replacement = T.dynamic("M", "int64")
+ N_replacement = T.dynamic("N", "int64")
@R.rewriter
class Rewriter:
@@ -1329,7 +1329,7 @@ def test_match_dynamic_pattern_against_dynamic_shape():
ty_args=R.Tensor([M_replacement, N_replacement], "float32"),
)
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def before(
@@ -1342,7 +1342,7 @@ def test_match_dynamic_pattern_against_dynamic_shape():
F: R.Tensor([N * 2, N], "float32") = R.matmul(E, C)
return F
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def expected(
diff --git a/tests/python/relax/test_e2e_op_dynamic.py b/tests/python/relax/test_e2e_op_dynamic.py
index 6c00e985b3..e249e67285 100644
--- a/tests/python/relax/test_e2e_op_dynamic.py
+++ b/tests/python/relax/test_e2e_op_dynamic.py
@@ -85,8 +85,8 @@ def test_dynamic_strided_slice(begin, end, strides):
)
def test_dynamic_strided_slice_symbolic(begin, end, strides):
# fmt: off
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class DynamicStridedSlice:
diff --git a/tests/python/relax/test_frontend_from_exported_program.py b/tests/python/relax/test_frontend_from_exported_program.py
index ad012a2995..9519476bfb 100644
--- a/tests/python/relax/test_frontend_from_exported_program.py
+++ b/tests/python/relax/test_frontend_from_exported_program.py
@@ -5506,8 +5506,8 @@ def test_slice_with_symbolic_end():
return x[:, :seq_len] + 0.0 # +0.0 to ensure output is a new tensor
# The identity slice is elided; only x + 0.0 remains.
- s0 = T.dynamic("s0")
- s1 = T.dynamic("s1")
+ s0 = T.dynamic("s0", "int64")
+ s1 = T.dynamic("s1", "int64")
@I.ir_module
class ExpectedIdentity:
@@ -6465,7 +6465,7 @@ def test_masked_select():
def forward(self, data: torch.Tensor, mask: torch.Tensor):
return torch.masked_select(data, mask)
- u0 = T.dynamic("u0")
+ u0 = T.dynamic("u0", "int64")
@tvm.script.ir_module
class Expected:
@@ -7790,7 +7790,7 @@ def test_dynamic_shape():
def forward(self, x1, x2):
return torch.ops.aten.add.Tensor(x1, x2)
- s0 = T.dynamic("s0")
+ s0 = T.dynamic("s0", "int64")
@I.ir_module
class Expected:
@@ -8392,7 +8392,7 @@ def test_dynamic_shape_with_range_constraints():
def forward(self, x1, x2):
return torch.ops.aten.add.Tensor(x1, x2)
- s0 = T.dynamic("s0")
+ s0 = T.dynamic("s0", "int64")
@I.ir_module
class Expected:
@@ -8426,7 +8426,7 @@ def test_dynamic_shape_with_addition_constraints():
def forward(self, x, y):
return torch.cat([x, y], dim=0)
- s0 = T.dynamic("s0")
+ s0 = T.dynamic("s0", "int64")
@I.ir_module
class Expected:
@@ -8460,7 +8460,7 @@ def test_dynamic_shape_with_multiplication_constraints():
def forward(self, x, y):
return torch.cat([x, y], dim=0)
- s0 = T.dynamic("s0")
+ s0 = T.dynamic("s0", "int64")
@I.ir_module
class Expected:
@@ -8494,7 +8494,7 @@ def test_dynamic_shape_with_unbounded_constraints():
def forward(self, x):
return torch.ops.aten.add.Tensor(x, x)
- s0 = T.dynamic("s0")
+ s0 = T.dynamic("s0", "int64")
@I.ir_module
class Expected:
@@ -8529,7 +8529,7 @@ def test_sym_size_int():
shape_dim = torch.ops.aten.sym_size.int(x, 0)
return x.reshape(shape_dim, -1)
- s0 = T.dynamic("s0")
+ s0 = T.dynamic("s0", "int64")
@I.ir_module
class Expected:
@@ -8940,9 +8940,9 @@ def test_cond_shape_predicate():
return torch.cond(x.shape[0] > 4, true_fn, false_fn, (x,))
- s77_cond_true_branch_0 = T.dynamic("s77")
- s77_cond_false_branch_1 = T.dynamic("s77")
- s77_main = T.dynamic("s77")
+ s77_cond_true_branch_0 = T.dynamic("s77", "int64")
+ s77_cond_false_branch_1 = T.dynamic("s77", "int64")
+ s77_main = T.dynamic("s77", "int64")
@tvm.script.ir_module
class expected:
diff --git a/tests/python/relax/test_frontend_nn_exporter.py b/tests/python/relax/test_frontend_nn_exporter.py
index 5571393c06..39634a1e87 100644
--- a/tests/python/relax/test_frontend_nn_exporter.py
+++ b/tests/python/relax/test_frontend_nn_exporter.py
@@ -125,7 +125,7 @@ def test_dynamic_shape():
debug=False,
)
- batch_size = T.dynamic("batch_size")
+ batch_size = T.dynamic("batch_size", "int64")
@I.ir_module
class Expected:
@@ -160,8 +160,8 @@ def test_dynamic_shape_in_multiple_functions():
debug=False,
)
- batch_size_forward_relu = T.dynamic("batch_size")
- batch_size_forward_silu = T.dynamic("batch_size")
+ batch_size_forward_relu = T.dynamic("batch_size", "int64")
+ batch_size_forward_silu = T.dynamic("batch_size", "int64")
@I.ir_module
class Expected:
@@ -232,7 +232,7 @@ def test_export_nested_module():
debug=False,
)
- batch_size = T.dynamic("batch_size")
+ batch_size = T.dynamic("batch_size", "int64")
@I.ir_module
class Expected:
@@ -357,7 +357,7 @@ def test_generate_parameters():
debug=False,
)
- batch_size = T.dynamic("batch_size")
+ batch_size = T.dynamic("batch_size", "int64")
@I.ir_module
class Expected:
@@ -396,7 +396,7 @@ def test_generate_parameters():
assert_structural_equal(exported_mod, Expected)
- batch_size = T.dynamic("batch_size")
+ batch_size = T.dynamic("batch_size", "int64")
@I.ir_module
class ExpectedAfterLift:
@@ -467,7 +467,7 @@ def test_linear_dynamic_shape():
Even if dynamic, the weight/bias must be the same value.
"""
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@R.function
def forward(
@@ -572,9 +572,9 @@ def test_duplicate_names(dynamic_type):
)
def get_expected_with_intermediate_size():
- batch_size = T.dynamic("batch_size")
- hidden_size = T.dynamic("hidden_size")
- intermediate_size = T.dynamic("intermediate_size")
+ batch_size = T.dynamic("batch_size", "int64")
+ hidden_size = T.dynamic("hidden_size", "int64")
+ intermediate_size = T.dynamic("intermediate_size", "int64")
@I.ir_module
class Expected:
@@ -604,8 +604,8 @@ def test_duplicate_names(dynamic_type):
return Expected
def get_expected_without_intermediate_size():
- batch_size = T.dynamic("batch_size")
- hidden_size = T.dynamic("hidden_size")
+ batch_size = T.dynamic("batch_size", "int64")
+ hidden_size = T.dynamic("hidden_size", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_frontend_nn_extern_module.py b/tests/python/relax/test_frontend_nn_extern_module.py
index 244375a1a7..76d76c8dd6 100644
--- a/tests/python/relax/test_frontend_nn_extern_module.py
+++ b/tests/python/relax/test_frontend_nn_extern_module.py
@@ -87,9 +87,9 @@ def _check_ir_equality(mod):
# pylint: enable=import-outside-toplevel
- x = T.dynamic("x")
- y = T.dynamic("y")
- z = T.dynamic("z")
+ x = T.dynamic("x", "int64")
+ y = T.dynamic("y", "int64")
+ z = T.dynamic("z", "int64")
@I.ir_module
class ExpectedModule:
diff --git a/tests/python/relax/test_frontend_nn_modules.py b/tests/python/relax/test_frontend_nn_modules.py
index ae29cb290f..13f1f868c2 100644
--- a/tests/python/relax/test_frontend_nn_modules.py
+++ b/tests/python/relax/test_frontend_nn_modules.py
@@ -282,11 +282,11 @@ def test_conv3d():
def test_conv2d_dynamic():
- n = T.dynamic("n")
- h = T.dynamic("h")
- w = T.dynamic("w")
- c = T.dynamic("c")
- in_channels = T.dynamic("in_channels")
+ n = T.dynamic("n", "int64")
+ h = T.dynamic("h", "int64")
+ w = T.dynamic("w", "int64")
+ c = T.dynamic("c", "int64")
+ in_channels = T.dynamic("in_channels", "int64")
@R.function
def forward(
diff --git a/tests/python/relax/test_frontend_nn_op.py b/tests/python/relax/test_frontend_nn_op.py
index 301f0bfe48..aa02affe3a 100644
--- a/tests/python/relax/test_frontend_nn_op.py
+++ b/tests/python/relax/test_frontend_nn_op.py
@@ -638,8 +638,8 @@ def test_tensor_ir_op():
fused_heads = num_q_heads + num_kv_heads * 2
dtype = "float16"
- batch_size = T.dynamic("batch_size")
- seq_len = T.dynamic("seq_len")
+ batch_size = T.dynamic("batch_size", "int64")
+ seq_len = T.dynamic("seq_len", "int64")
@Ts.function(private=True)
def fused_rope( # pylint: disable=too-many-locals
@@ -666,9 +666,9 @@ def test_tensor_ir_op():
return tensor_expr_op_out
# fmt: off
- batch_size = T.dynamic("batch_size")
- seq_len = T.dynamic("seq_len")
- offset_1 = T.dynamic("offset_1")
+ batch_size = T.dynamic("batch_size", "int64")
+ seq_len = T.dynamic("seq_len", "int64")
+ offset_1 = T.dynamic("offset_1", "int64")
@I.ir_module
class Expected:
@@ -714,9 +714,9 @@ def test_tensor_ir_inplace_op():
hidden_size = 4096
dtype = "float16"
- vocab_size = T.dynamic("vocab_size")
- seq_len = T.dynamic("seq_len")
- total_seq_len = T.dynamic("total_seq_len")
+ vocab_size = T.dynamic("vocab_size", "int64")
+ seq_len = T.dynamic("seq_len", "int64")
+ total_seq_len = T.dynamic("total_seq_len", "int64")
@Ts.function
def inplace_take(
@@ -747,13 +747,13 @@ def test_tensor_ir_inplace_op():
)
return tensor_expr_op_out
- vocab_size_inplace_take = T.dynamic("vocab_size")
- seq_len_inplace_take = T.dynamic("seq_len")
- total_seq_len_inplace_take = T.dynamic("total_seq_len")
- total_seq_len_test = T.dynamic("total_seq_len")
- offset_1 = T.dynamic("offset_1")
- vocab_size_test = T.dynamic("vocab_size")
- seq_len_test = T.dynamic("seq_len")
+ vocab_size_inplace_take = T.dynamic("vocab_size", "int64")
+ seq_len_inplace_take = T.dynamic("seq_len", "int64")
+ total_seq_len_inplace_take = T.dynamic("total_seq_len", "int64")
+ total_seq_len_test = T.dynamic("total_seq_len", "int64")
+ offset_1 = T.dynamic("offset_1", "int64")
+ vocab_size_test = T.dynamic("vocab_size", "int64")
+ seq_len_test = T.dynamic("seq_len", "int64")
@I.ir_module
class Expected:
@@ -1020,11 +1020,11 @@ def test_sample_top_p_top_k_from_sorted_prob():
return z0
# fmt: off
- batch_get_index_from_sorted = T.dynamic("batch")
- vocab_size_get_index_from_sorted = T.dynamic("vocab_size")
- out_batch = T.dynamic("out_batch")
- batch_get_renorm_prob = T.dynamic("batch")
- vocab_size_get_renorm_prob = T.dynamic("vocab_size")
+ batch_get_index_from_sorted = T.dynamic("batch", "int64")
+ vocab_size_get_index_from_sorted = T.dynamic("vocab_size", "int64")
+ out_batch = T.dynamic("out_batch", "int64")
+ batch_get_renorm_prob = T.dynamic("batch", "int64")
+ vocab_size_get_renorm_prob = T.dynamic("vocab_size", "int64")
@I.ir_module
class Expected:
@@ -1145,8 +1145,8 @@ def test_renormalize_top_p_top_k_prob():
return z0
# fmt: off
- batch = T.dynamic("batch")
- vocab_size = T.dynamic("vocab_size")
+ batch = T.dynamic("batch", "int64")
+ vocab_size = T.dynamic("vocab_size", "int64")
@I.ir_module
class Expected:
@@ -1256,7 +1256,7 @@ def test_sort_argsort_topk():
z2 = op.topk(x, k=2, axis=-1)
return z0, z1, z2
- seq_len = T.dynamic("seq_len")
+ seq_len = T.dynamic("seq_len", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_frontend_nn_subroutines.py b/tests/python/relax/test_frontend_nn_subroutines.py
index 9774140c05..8a7a4efded 100644
--- a/tests/python/relax/test_frontend_nn_subroutines.py
+++ b/tests/python/relax/test_frontend_nn_subroutines.py
@@ -42,9 +42,9 @@ def test_linear():
state = nn.op.matmul(input, self.weights)
return self.activation(state)
- batch_size_forward = I.dynamic("batch_size")
- batch_size_layer = I.dynamic("batch_size")
- batch_size_activation = I.dynamic("batch_size")
+ batch_size_forward = I.dynamic("batch_size", "int64")
+ batch_size_layer = I.dynamic("batch_size", "int64")
+ batch_size_activation = I.dynamic("batch_size", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_frontend_onnx.py b/tests/python/relax/test_frontend_onnx.py
index 4bbc24268b..e5e7a73201 100644
--- a/tests/python/relax/test_frontend_onnx.py
+++ b/tests/python/relax/test_frontend_onnx.py
@@ -1055,7 +1055,7 @@ def _make_expected_broadcast_ir_min(
Expected IR module for the Min operation.
"""
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class ExpectedMin:
@@ -1090,7 +1090,7 @@ def _make_expected_broadcast_ir_max(
Expected IR module for the Max operation.
"""
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class ExpectedMax:
@@ -2680,7 +2680,7 @@ def test_compress():
if axis is None:
flat_shape = (int(np.prod(tensor_shape)),)
- num_nonzero = T.dynamic("num_nonzero")
+ num_nonzero = T.dynamic("num_nonzero", "int64")
@I.ir_module
class ExpectedCompressFlat:
@@ -2704,7 +2704,7 @@ def test_compress():
return ExpectedCompressFlat
- num_nonzero = T.dynamic("num_nonzero")
+ num_nonzero = T.dynamic("num_nonzero", "int64")
@I.ir_module
class ExpectedCompressAxis:
@@ -3394,10 +3394,10 @@ def test_unsqueeze_dynamic_axes_ir():
model = helper.make_model(graph, producer_name="unsqueeze_dynamic_axes_ir_test")
tvm_model = from_onnx(model, opset=13, keep_params_in_input=True)
- unsqueeze_dim_0 = T.dynamic("unsqueeze_dim_0")
- unsqueeze_dim_1 = T.dynamic("unsqueeze_dim_1")
- unsqueeze_dim_2 = T.dynamic("unsqueeze_dim_2")
- unsqueeze_dim_3 = T.dynamic("unsqueeze_dim_3")
+ unsqueeze_dim_0 = T.dynamic("unsqueeze_dim_0", "int64")
+ unsqueeze_dim_1 = T.dynamic("unsqueeze_dim_1", "int64")
+ unsqueeze_dim_2 = T.dynamic("unsqueeze_dim_2", "int64")
+ unsqueeze_dim_3 = T.dynamic("unsqueeze_dim_3", "int64")
@I.ir_module
class Expected:
@@ -4245,7 +4245,7 @@ def test_shape_start_end_symbolic():
keep_params_in_input=True,
)
- B = T.dynamic("B")
+ B = T.dynamic("B", "int64")
@I.ir_module
class Expected:
@@ -4452,7 +4452,7 @@ def test_trilu_dynamic_k_ir(upper: bool):
expected = ExpectedTriu
else:
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@I.ir_module
class ExpectedTril:
@@ -5535,8 +5535,8 @@ def test_dynamic_squeeze():
tvm_model = from_onnx(model, opset=13, keep_params_in_input=True)
tvm_model["main"] = tvm_model["main"].without_attr("params")
- A = T.dynamic("A")
- B = T.dynamic("B")
+ A = T.dynamic("A", "int64")
+ B = T.dynamic("B", "int64")
@I.ir_module
class Expected:
@@ -5571,9 +5571,9 @@ def test_squeeze_dynamic_axes_ir():
model = helper.make_model(graph, producer_name="squeeze_dynamic_axes_ir_test")
tvm_model = from_onnx(model, opset=13, keep_params_in_input=True)
- squeeze_num_keep_dims = T.dynamic("squeeze_num_keep_dims")
- squeeze_dim_0 = T.dynamic("squeeze_dim_0")
- squeeze_dim_1 = T.dynamic("squeeze_dim_1")
+ squeeze_num_keep_dims = T.dynamic("squeeze_num_keep_dims", "int64")
+ squeeze_dim_0 = T.dynamic("squeeze_dim_0", "int64")
+ squeeze_dim_1 = T.dynamic("squeeze_dim_1", "int64")
@I.ir_module
class Expected:
@@ -7280,7 +7280,7 @@ def test_expand():
R.output(gv)
return gv
- batch = T.dynamic("batch")
+ batch = T.dynamic("batch", "int64")
@I.ir_module
class ExpectedDynamicShape:
@@ -7874,7 +7874,7 @@ def test_slice_dynamic_shape():
R.output(gv)
return gv
- A = T.dynamic("A")
+ A = T.dynamic("A", "int64")
@I.ir_module
class ExpectedShapeSlice1:
@@ -7891,8 +7891,8 @@ def test_slice_dynamic_shape():
R.output(gv)
return gv
- A = T.dynamic("A")
- B = T.dynamic("B")
+ A = T.dynamic("A", "int64")
+ B = T.dynamic("B", "int64")
@I.ir_module
class ExpectedShapeSlice2:
@@ -7909,7 +7909,7 @@ def test_slice_dynamic_shape():
R.output(gv)
return gv
- C = T.dynamic("C")
+ C = T.dynamic("C", "int64")
@I.ir_module
class ExpectedShapeSlice3:
@@ -7926,9 +7926,9 @@ def test_slice_dynamic_shape():
R.output(gv)
return gv
- A = T.dynamic("A")
- B = T.dynamic("B")
- C = T.dynamic("C")
+ A = T.dynamic("A", "int64")
+ B = T.dynamic("B", "int64")
+ C = T.dynamic("C", "int64")
@I.ir_module
class ExpectedShapeSlice4:
@@ -7960,7 +7960,7 @@ def test_slice_dynamic_shape():
R.output(gv)
return gv
- A = T.dynamic("A")
+ A = T.dynamic("A", "int64")
@I.ir_module
class ExpectedShapeSlice6:
@@ -7977,8 +7977,8 @@ def test_slice_dynamic_shape():
R.output(gv)
return gv
- A = T.dynamic("A")
- B = T.dynamic("B")
+ A = T.dynamic("A", "int64")
+ B = T.dynamic("B", "int64")
@I.ir_module
class ExpectedShapeSlice7:
@@ -7995,7 +7995,7 @@ def test_slice_dynamic_shape():
R.output(gv)
return gv
- C = T.dynamic("C")
+ C = T.dynamic("C", "int64")
@I.ir_module
class ExpectedShapeSlice8:
@@ -8012,9 +8012,9 @@ def test_slice_dynamic_shape():
R.output(gv)
return gv
- A = T.dynamic("A")
- B = T.dynamic("B")
- C = T.dynamic("C")
+ A = T.dynamic("A", "int64")
+ B = T.dynamic("B", "int64")
+ C = T.dynamic("C", "int64")
@I.ir_module
class ExpectedShapeSlice9:
@@ -8046,7 +8046,7 @@ def test_slice_dynamic_shape():
R.output(gv)
return gv
- A = T.dynamic("A")
+ A = T.dynamic("A", "int64")
@I.ir_module
class ExpectedShapeSlice11:
@@ -8063,8 +8063,8 @@ def test_slice_dynamic_shape():
R.output(gv)
return gv
- A = T.dynamic("A")
- B = T.dynamic("B")
+ A = T.dynamic("A", "int64")
+ B = T.dynamic("B", "int64")
@I.ir_module
class ExpectedShapeSlice12:
@@ -8081,7 +8081,7 @@ def test_slice_dynamic_shape():
R.output(gv)
return gv
- C = T.dynamic("C")
+ C = T.dynamic("C", "int64")
@I.ir_module
class ExpectedShapeSlice13:
@@ -8098,9 +8098,9 @@ def test_slice_dynamic_shape():
R.output(gv)
return gv
- A = T.dynamic("A")
- B = T.dynamic("B")
- C = T.dynamic("C")
+ A = T.dynamic("A", "int64")
+ B = T.dynamic("B", "int64")
+ C = T.dynamic("C", "int64")
@I.ir_module
class ExpectedShapeSlice14:
@@ -9033,10 +9033,10 @@ def test_tile():
expected.update_func(expected.get_global_var("tile"), tvm_model["tile"])
tvm.ir.assert_structural_equal(tvm_model, expected)
- tile_input_dim_0 = T.dynamic("tile_input_dim_0")
- tile_input_dim_1 = T.dynamic("tile_input_dim_1")
- tile_input_dim_2 = T.dynamic("tile_input_dim_2")
- tile_input_dim_3 = T.dynamic("tile_input_dim_3")
+ tile_input_dim_0 = T.dynamic("tile_input_dim_0", "int64")
+ tile_input_dim_1 = T.dynamic("tile_input_dim_1", "int64")
+ tile_input_dim_2 = T.dynamic("tile_input_dim_2", "int64")
+ tile_input_dim_3 = T.dynamic("tile_input_dim_3", "int64")
@I.ir_module
class ExpectedTileDynamicInput:
@@ -9177,8 +9177,8 @@ def test_tile_dynamic_repeats():
)
if rank == 2:
- tile_dim_0 = T.dynamic("tile_dim_0")
- tile_dim_1 = T.dynamic("tile_dim_1")
+ tile_dim_0 = T.dynamic("tile_dim_0", "int64")
+ tile_dim_1 = T.dynamic("tile_dim_1", "int64")
@I.ir_module
class ExpectedTileRank2:
@@ -9215,9 +9215,9 @@ def test_tile_dynamic_repeats():
return ExpectedTileRank2
if rank == 3:
- tile_dim_0 = T.dynamic("tile_dim_0")
- tile_dim_1 = T.dynamic("tile_dim_1")
- tile_dim_2 = T.dynamic("tile_dim_2")
+ tile_dim_0 = T.dynamic("tile_dim_0", "int64")
+ tile_dim_1 = T.dynamic("tile_dim_1", "int64")
+ tile_dim_2 = T.dynamic("tile_dim_2", "int64")
@I.ir_module
class ExpectedTileRank3:
@@ -9257,10 +9257,10 @@ def test_tile_dynamic_repeats():
return ExpectedTileRank3
if rank == 4:
- tile_dim_0 = T.dynamic("tile_dim_0")
- tile_dim_1 = T.dynamic("tile_dim_1")
- tile_dim_2 = T.dynamic("tile_dim_2")
- tile_dim_3 = T.dynamic("tile_dim_3")
+ tile_dim_0 = T.dynamic("tile_dim_0", "int64")
+ tile_dim_1 = T.dynamic("tile_dim_1", "int64")
+ tile_dim_2 = T.dynamic("tile_dim_2", "int64")
+ tile_dim_3 = T.dynamic("tile_dim_3", "int64")
@I.ir_module
class ExpectedTileRank4:
@@ -10724,8 +10724,8 @@ def test_flatten_dynamic():
tvm_model = from_onnx(model, keep_params_in_input=True)
tvm.ir.assert_structural_equal(tvm_model, expected)
- A = T.dynamic("A")
- B = T.dynamic("B")
+ A = T.dynamic("A", "int64")
+ B = T.dynamic("B", "int64")
@I.ir_module
class ExpectedDynamicAxis0:
@@ -10741,8 +10741,8 @@ def test_flatten_dynamic():
R.output(gv)
return gv
- A = T.dynamic("A")
- B = T.dynamic("B")
+ A = T.dynamic("A", "int64")
+ B = T.dynamic("B", "int64")
@I.ir_module
class ExpectedDynamicAxisNegative1:
@@ -10756,8 +10756,8 @@ def test_flatten_dynamic():
R.output(gv)
return gv
- A = T.dynamic("A")
- B = T.dynamic("B")
+ A = T.dynamic("A", "int64")
+ B = T.dynamic("B", "int64")
@I.ir_module
class ExpectedDynamicAxis2:
@@ -10870,7 +10870,7 @@ def test_nonzero():
tvm_model = from_onnx(model, keep_params_in_input=True)
tvm.ir.assert_structural_equal(tvm_model, expected)
- nonzero_numbers = T.dynamic("nonzero_numbers")
+ nonzero_numbers = T.dynamic("nonzero_numbers", "int64")
@I.ir_module
class ExpectedScalar:
@@ -10885,7 +10885,7 @@ def test_nonzero():
R.output(gv)
return gv
- nonzero_numbers = T.dynamic("nonzero_numbers")
+ nonzero_numbers = T.dynamic("nonzero_numbers", "int64")
@I.ir_module
class ExpectedRank1:
@@ -10900,7 +10900,7 @@ def test_nonzero():
R.output(gv)
return gv
- nonzero_numbers = T.dynamic("nonzero_numbers")
+ nonzero_numbers = T.dynamic("nonzero_numbers", "int64")
@I.ir_module
class ExpectedRank2:
@@ -10915,7 +10915,7 @@ def test_nonzero():
R.output(gv)
return gv
- nonzero_numbers = T.dynamic("nonzero_numbers")
+ nonzero_numbers = T.dynamic("nonzero_numbers", "int64")
@I.ir_module
class ExpectedRank3:
@@ -10930,7 +10930,7 @@ def test_nonzero():
R.output(gv)
return gv
- nonzero_numbers = T.dynamic("nonzero_numbers")
+ nonzero_numbers = T.dynamic("nonzero_numbers", "int64")
@I.ir_module
class ExpectedRank4:
@@ -11766,8 +11766,8 @@ def test_symbolic_shape_deduction():
tvm_model = from_onnx(model, keep_params_in_input=True)
tvm.ir.assert_structural_equal(tvm_model["main"].without_attr("params"), expected["main"])
- batch = T.dynamic("batch")
- seq = T.dynamic("seq")
+ batch = T.dynamic("batch", "int64")
+ seq = T.dynamic("seq", "int64")
@I.ir_module
class ExpectedWithReshapeFlatten:
@@ -11785,8 +11785,8 @@ def test_symbolic_shape_deduction():
R.output(gv)
return gv
- batch = T.dynamic("batch")
- seq = T.dynamic("seq")
+ batch = T.dynamic("batch", "int64")
+ seq = T.dynamic("seq", "int64")
@I.ir_module
class ExpectedWithoutReshapeFlatten:
@@ -11822,7 +11822,7 @@ def test_multi_inputs_with_same_symbolic_shape():
model = helper.make_model(graph, producer_name="test_multi_symbolic_shape_input")
tvm_model = from_onnx(model, keep_params_in_input=True)
- batch = T.dynamic("batch")
+ batch = T.dynamic("batch", "int64")
@I.ir_module
class Expected:
@@ -11966,8 +11966,8 @@ def test_shape_dim_string_expression_graph_add():
tvm_model = from_onnx(model, opset=14, keep_params_in_input=True)
# fmt: off
- A = T.dynamic("A")
- B = T.dynamic("B")
+ A = T.dynamic("A", "int64")
+ B = T.dynamic("B", "int64")
@I.ir_module
class Expected:
@@ -12001,8 +12001,8 @@ def test_shape_dim_string_expression_graph_subtract():
tvm_model = from_onnx(model, opset=14, keep_params_in_input=True)
# fmt: off
- A = T.dynamic("A")
- B = T.dynamic("B")
+ A = T.dynamic("A", "int64")
+ B = T.dynamic("B", "int64")
@I.ir_module
class Expected:
@@ -12036,8 +12036,8 @@ def test_shape_dim_string_expression_graph_mul():
tvm_model = from_onnx(model, opset=14, keep_params_in_input=True)
# fmt: off
- A = T.dynamic("A")
- B = T.dynamic("B")
+ A = T.dynamic("A", "int64")
+ B = T.dynamic("B", "int64")
@I.ir_module
class Expected:
@@ -12072,8 +12072,8 @@ def test_shape_dim_string_expression_graph_div_1():
tvm_model = from_onnx(model, opset=14, keep_params_in_input=True)
# fmt: off
- A = T.dynamic("A")
- B = T.dynamic("B")
+ A = T.dynamic("A", "int64")
+ B = T.dynamic("B", "int64")
@I.ir_module
class Expected:
@@ -12108,8 +12108,8 @@ def test_shape_dim_string_expression_graph_div_2():
tvm_model = from_onnx(model, opset=14, keep_params_in_input=True)
# fmt: off
- A = T.dynamic("A")
- B = T.dynamic("B")
+ A = T.dynamic("A", "int64")
+ B = T.dynamic("B", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_frontend_stablehlo.py b/tests/python/relax/test_frontend_stablehlo.py
index d6aa363b99..d50c800ff4 100644
--- a/tests/python/relax/test_frontend_stablehlo.py
+++ b/tests/python/relax/test_frontend_stablehlo.py
@@ -183,10 +183,10 @@ def test_add_dynamic():
mod = from_stablehlo(add_dyn)
- n_0 = T.dynamic("n_0")
- n_1 = T.dynamic("n_1")
- n_2 = T.dynamic("n_2")
- n_3 = T.dynamic("n_3")
+ n_0 = T.dynamic("n_0", "int64")
+ n_1 = T.dynamic("n_1", "int64")
+ n_2 = T.dynamic("n_2", "int64")
+ n_3 = T.dynamic("n_3", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_frontend_tflite.py b/tests/python/relax/test_frontend_tflite.py
index 8875057c01..7d2d01536c 100644
--- a/tests/python/relax/test_frontend_tflite.py
+++ b/tests/python/relax/test_frontend_tflite.py
@@ -1090,8 +1090,8 @@ def test_fill_dynamic_dims():
def func(self, dims, value):
return tf.fill(dims, value)
- fill_dim_0 = T.dynamic("fill_dim_0")
- fill_dim_1 = T.dynamic("fill_dim_1")
+ fill_dim_0 = T.dynamic("fill_dim_0", "int64")
+ fill_dim_1 = T.dynamic("fill_dim_1", "int64")
@I.ir_module
class Expected:
@@ -1126,8 +1126,8 @@ def test_random_uniform_dynamic_shape():
def func(self, shape):
return tf.raw_ops.RandomUniform(shape=shape, dtype=tf.float32, seed=7, seed2=11)
- random_uniform_dim_0 = T.dynamic("random_uniform_dim_0")
- random_uniform_dim_1 = T.dynamic("random_uniform_dim_1")
+ random_uniform_dim_0 = T.dynamic("random_uniform_dim_0", "int64")
+ random_uniform_dim_1 = T.dynamic("random_uniform_dim_1", "int64")
@I.ir_module
class Expected:
@@ -1173,8 +1173,8 @@ def test_random_standard_normal_dynamic_shape():
def func(self, shape):
return tf.raw_ops.RandomStandardNormal(shape=shape, dtype=tf.float32, seed=3, seed2=5)
- random_standard_normal_dim_0 = T.dynamic("random_standard_normal_dim_0")
- random_standard_normal_dim_1 = T.dynamic("random_standard_normal_dim_1")
+ random_standard_normal_dim_0 = T.dynamic("random_standard_normal_dim_0", "int64")
+ random_standard_normal_dim_1 = T.dynamic("random_standard_normal_dim_1", "int64")
@I.ir_module
class Expected:
@@ -1236,7 +1236,7 @@ def test_multinomial_dynamic_num_samples():
seed2=17,
)
- multinomial_num_samples = T.dynamic("multinomial_num_samples")
+ multinomial_num_samples = T.dynamic("multinomial_num_samples", "int64")
@I.ir_module
class Expected:
@@ -13316,8 +13316,8 @@ def test_dilate_dynamic_dilations():
mod = from_tflite(tflite_model)
mod["main"] = mod["main"].without_attr("params")
- dilate_stride_0 = T.dynamic("dilate_stride_0")
- dilate_stride_1 = T.dynamic("dilate_stride_1")
+ dilate_stride_0 = T.dynamic("dilate_stride_0", "int64")
+ dilate_stride_1 = T.dynamic("dilate_stride_1", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_inline_functions.py b/tests/python/relax/test_inline_functions.py
index 4dcd5ea059..5be10c973d 100644
--- a/tests/python/relax/test_inline_functions.py
+++ b/tests/python/relax/test_inline_functions.py
@@ -174,8 +174,8 @@ def test_subroutine_with_symbolic_vars():
caller's `tirx::Var` symbolic variables should remain.
"""
- n_main = T.dynamic("n")
- n_subroutine = T.dynamic("n")
+ n_main = T.dynamic("n", "int64")
+ n_subroutine = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -193,7 +193,7 @@ def test_subroutine_with_symbolic_vars():
C = R.concat([B, B], axis=1)
return C
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@R.function(private=True)
def expected(A: R.Tensor([n, 16], "int32")) -> R.Tensor([n, 32], "int32"):
@@ -214,7 +214,7 @@ def test_subroutine_with_symbolic_vars_and_static_argument():
should remain.
"""
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -282,8 +282,8 @@ def test_inline_multiple_instances_with_distinct_static_shapes():
different value for the symbolic variables it uses.
"""
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Before:
diff --git a/tests/python/relax/test_op_index.py b/tests/python/relax/test_op_index.py
index 06f018f912..1eff597088 100644
--- a/tests/python/relax/test_op_index.py
+++ b/tests/python/relax/test_op_index.py
@@ -901,7 +901,7 @@ def test_dynamic_strided_slice_infer_ty_arg_wrong_shape_info():
def test_legalize_dynamic_begin_end():
"""relax.op.strided_slice FLegalize must support dynamic begin/end"""
- index = T.dynamic("index")
+ index = T.dynamic("index", "int64")
@I.ir_module
class before:
@@ -909,7 +909,7 @@ def test_legalize_dynamic_begin_end():
def main(A: R.Tensor((16, 16), "float32"), B: R.Shape([index])) -> R.Tensor((1, 16)):
return R.strided_slice(A, [0], [index], [index + 1], assume_inbound=True)
- index = T.dynamic("index")
+ index = T.dynamic("index", "int64")
@I.ir_module
class expected:
@@ -940,7 +940,7 @@ def test_legalize_dynamic_begin_end():
def test_legalize_dynamic_begin_inf_end():
"""relax.op.strided_slice FLegalize must support dynamic begin/end"""
- index = T.dynamic("index")
+ index = T.dynamic("index", "int64")
@I.ir_module
class before:
@@ -951,7 +951,7 @@ def test_legalize_dynamic_begin_inf_end():
)
# fmt: off
- index = T.dynamic("index")
+ index = T.dynamic("index", "int64")
@I.ir_module
class expected:
diff --git a/tests/python/relax/test_op_size.py b/tests/python/relax/test_op_size.py
index aef849abe3..63bc7df9b5 100644
--- a/tests/python/relax/test_op_size.py
+++ b/tests/python/relax/test_op_size.py
@@ -43,8 +43,8 @@ def test_op_size():
def test_op_size_dynamic():
- m = I.dynamic("m")
- n = I.dynamic("n")
+ m = I.dynamic("m", "int64")
+ n = I.dynamic("n", "int64")
@tvm.script.ir_module
class Module:
diff --git a/tests/python/relax/test_op_take.py b/tests/python/relax/test_op_take.py
index 0fd7efd57b..a7c1ec43c9 100644
--- a/tests/python/relax/test_op_take.py
+++ b/tests/python/relax/test_op_take.py
@@ -148,7 +148,7 @@ def test_take_dynamic_prim_value_as_index(axis):
target = "llvm"
dev = tvm.cpu()
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Module:
diff --git a/tests/python/relax/test_op_view.py b/tests/python/relax/test_op_view.py
index 4e6d34d1e2..f718ddc73c 100644
--- a/tests/python/relax/test_op_view.py
+++ b/tests/python/relax/test_op_view.py
@@ -123,14 +123,14 @@ def test_error_if_static_2d_view_larger_than_source():
def test_infer_shape_of_1d_dynamic_view():
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def explicit_ty(A: R.Tensor([N])) -> R.Tensor([N // 2]):
B: R.Tensor([N // 2]) = R.memory.view(A, R.shape([N // 2]))
return B
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def inferred_ty(A: R.Tensor([N])):
@@ -141,14 +141,14 @@ def test_infer_shape_of_1d_dynamic_view():
def test_infer_shape_of_2d_dynamic_view_of_1d_source():
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def explicit_ty(A: R.Tensor([N])) -> R.Tensor([N // 8, 8]):
B: R.Tensor([N // 8, 8]) = R.memory.view(A, R.shape([N // 8, 8]))
return B
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def inferred_ty(A: R.Tensor([N])):
@@ -159,14 +159,14 @@ def test_infer_shape_of_2d_dynamic_view_of_1d_source():
def test_infer_shape_of_2d_dynamic_view():
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def explicit_ty(A: R.Tensor([N])) -> R.Tensor([N // 2]):
B: R.Tensor([N // 2]) = R.memory.view(A, R.shape([N // 2]))
return B
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def inferred_ty(A: R.Tensor([N])):
@@ -178,7 +178,7 @@ def test_infer_shape_of_2d_dynamic_view():
def test_error_if_1d_dynamic_view_larger_than_1d_source():
with pytest.raises(ValueError):
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@R.function
def func(A: R.Tensor([N])):
@@ -188,7 +188,7 @@ def test_error_if_1d_dynamic_view_larger_than_1d_source():
def test_error_if_1d_dynamic_view_provably_larger_than_1d_source():
with pytest.raises(ValueError):
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@R.function
def func(A: R.Tensor([N])):
@@ -198,7 +198,7 @@ def test_error_if_1d_dynamic_view_provably_larger_than_1d_source():
def test_error_if_2d_dynamic_view_provably_larger_than_1d_source():
with pytest.raises(ValueError):
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@R.function
def func(A: R.Tensor([N])):
@@ -221,7 +221,7 @@ def test_validity_of_dynamic_view_may_depend_on_runtime_value():
"""
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@R.function
def func(A: R.Tensor([N])):
diff --git a/tests/python/relax/test_optimize_layout_transform.py b/tests/python/relax/test_optimize_layout_transform.py
index c5bb7f0b71..7107ea8b0f 100644
--- a/tests/python/relax/test_optimize_layout_transform.py
+++ b/tests/python/relax/test_optimize_layout_transform.py
@@ -270,8 +270,8 @@ def test_optimize_transform_layout_pass_two_args():
def test_tranform_layout_tir_remove_pad_transform_layout():
- p0 = T.dynamic("p0")
- i0 = T.dynamic("i0")
+ p0 = T.dynamic("p0", "int64")
+ i0 = T.dynamic("i0", "int64")
@I.ir_module
class Before:
@@ -343,8 +343,8 @@ def test_tranform_layout_tir_remove_pad_transform_layout():
R.output(gv)
return gv
- p0 = T.dynamic("p0")
- i0 = T.dynamic("i0")
+ p0 = T.dynamic("p0", "int64")
+ i0 = T.dynamic("i0", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_pipeline.py b/tests/python/relax/test_pipeline.py
index 2bb8183ecb..d0ffaaa2a0 100644
--- a/tests/python/relax/test_pipeline.py
+++ b/tests/python/relax/test_pipeline.py
@@ -56,8 +56,8 @@ def test_pipeline_with_kv_cache():
target = tvm.target.Target("llvm", host="llvm")
pipeline = relax.pipeline.get_default_pipeline(target)
- m = T.dynamic("m")
- L = T.dynamic("L")
+ m = T.dynamic("m", "int64")
+ L = T.dynamic("L", "int64")
@tvm.script.ir_module
class Mod:
diff --git a/tests/python/relax/test_relax_operators.py b/tests/python/relax/test_relax_operators.py
index 4024fa4349..fe4505ea01 100644
--- a/tests/python/relax/test_relax_operators.py
+++ b/tests/python/relax/test_relax_operators.py
@@ -33,8 +33,8 @@ from tvm.script import ir as I
from tvm.script import relax as R
from tvm.script import tirx as T
-m = T.dynamic("m")
-n = T.dynamic("n")
+m = T.dynamic("m", "int64")
+n = T.dynamic("n", "int64")
@tvm.script.ir_module
@@ -190,7 +190,7 @@ def test_assert_on_argument_fails():
def test_assert_on_symbolic_var_passes():
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@R.function(pure=False)
def func(x: R.Tensor([N], "int32")):
@@ -202,7 +202,7 @@ def test_assert_on_symbolic_var_passes():
def test_assert_on_symbolic_var_fails():
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@R.function(pure=False)
def func(x: R.Tensor([N], "int32")):
@@ -267,8 +267,8 @@ def test_op_shape_of():
assert constrained_shape == tvm_ffi.Shape([1])
-m = T.dynamic("m")
-n = T.dynamic("n")
+m = T.dynamic("m", "int64")
+n = T.dynamic("n", "int64")
@tvm.script.ir_module
@@ -788,7 +788,7 @@ def test_prim_value_as_branch_condition():
def test_computed_prim_value_as_branch_condition():
"""The primitive scalar condition may be computed within the function"""
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@R.function
def func(x: R.Tensor([N], "int64")):
diff --git a/tests/python/relax/test_relax_to_pyfunc_converter.py b/tests/python/relax/test_relax_to_pyfunc_converter.py
index 341fccf42e..93daf3b51b 100644
--- a/tests/python/relax/test_relax_to_pyfunc_converter.py
+++ b/tests/python/relax/test_relax_to_pyfunc_converter.py
@@ -34,13 +34,13 @@ from tvm.script import relax as R
from tvm.script import s_tir as Ts
from tvm.script import tirx as T
-n_symbolic_add = T.dynamic("n")
-batch_symbolic_matmul = T.dynamic("batch")
-m = T.dynamic("m")
-k = T.dynamic("k")
-n_symbolic_matmul = T.dynamic("n")
-batch_symbolic_expand_dims = T.dynamic("batch")
-seq_len = T.dynamic("seq_len")
+n_symbolic_add = T.dynamic("n", "int64")
+batch_symbolic_matmul = T.dynamic("batch", "int64")
+m = T.dynamic("m", "int64")
+k = T.dynamic("k", "int64")
+n_symbolic_matmul = T.dynamic("n", "int64")
+batch_symbolic_expand_dims = T.dynamic("batch", "int64")
+seq_len = T.dynamic("seq_len", "int64")
@I.ir_module
diff --git a/tests/python/relax/test_testing_nn.py b/tests/python/relax/test_testing_nn.py
index 3784325c84..b3f34e109a 100644
--- a/tests/python/relax/test_testing_nn.py
+++ b/tests/python/relax/test_testing_nn.py
@@ -81,9 +81,9 @@ def test_define_subroutine():
state = relax.op.matmul(input, self.weights)
return self.activation(state)
- batch_size_main = T.dynamic("batch_size")
- batch_size_layer = T.dynamic("batch_size")
- batch_size_activation = T.dynamic("batch_size")
+ batch_size_main = T.dynamic("batch_size", "int64")
+ batch_size_layer = T.dynamic("batch_size", "int64")
+ batch_size_activation = T.dynamic("batch_size", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_tir_call_source_kernel.py b/tests/python/relax/test_tir_call_source_kernel.py
index 596cce88f9..2ec1c8b6f9 100644
--- a/tests/python/relax/test_tir_call_source_kernel.py
+++ b/tests/python/relax/test_tir_call_source_kernel.py
@@ -42,8 +42,8 @@ extern "C" __global__ void add_kernel(float* x, float* y, float* output, int n_e
def test_tir_call_source_kernel():
BLOCK_SIZE = 64
- m_add = T.dynamic("m")
- m_main = T.dynamic("m")
+ m_add = T.dynamic("m", "int64")
+ m_main = T.dynamic("m", "int64")
@I.ir_module
class Module:
@@ -77,7 +77,7 @@ def test_tir_call_source_kernel():
R.output(output)
return output
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Parsed:
diff --git a/tests/python/relax/test_transform.py b/tests/python/relax/test_transform.py
index 80d9dcf68d..816fa180d5 100644
--- a/tests/python/relax/test_transform.py
+++ b/tests/python/relax/test_transform.py
@@ -79,8 +79,8 @@ def test_dataflowblock_pass_rejects_rewriting_match_cast_role_of_binding_var():
def test_to_non_dataflow():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class TestToNonDataflow:
@@ -144,10 +144,10 @@ def test_to_non_dataflow():
def test_call_tir_rewrite():
- m_exp = T.dynamic("m")
- n_exp = T.dynamic("n")
- m_foo = T.dynamic("m")
- n_foo = T.dynamic("n")
+ m_exp = T.dynamic("m", "int64")
+ n_exp = T.dynamic("n", "int64")
+ m_foo = T.dynamic("m", "int64")
+ n_foo = T.dynamic("n", "int64")
@tvm.script.ir_module
class TestCallTIRRewrite:
@@ -336,8 +336,8 @@ def test_transform_remove_purity_checking():
def test_call_dps_packed_rewrite():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class TestCallDPSPackedRewrite:
diff --git a/tests/python/relax/test_transform_adjust_matmul_order.py b/tests/python/relax/test_transform_adjust_matmul_order.py
index 170702a676..2fce58f328 100644
--- a/tests/python/relax/test_transform_adjust_matmul_order.py
+++ b/tests/python/relax/test_transform_adjust_matmul_order.py
@@ -173,8 +173,8 @@ class TestPreserveCompileTimeMatmulOnRHS(Base):
Expected = Before
-lora_r_before = T.dynamic("lora_r")
-lora_r_expected = T.dynamic("lora_r")
+lora_r_before = T.dynamic("lora_r", "int64")
+lora_r_expected = T.dynamic("lora_r", "int64")
class TestLHSDynamic(Base):
@@ -216,8 +216,8 @@ class TestLHSDynamic(Base):
return x
-lora_r_before = T.dynamic("lora_r")
-lora_r_expected = T.dynamic("lora_r")
+lora_r_before = T.dynamic("lora_r", "int64")
+lora_r_expected = T.dynamic("lora_r", "int64")
class TestRHSDynamic(Base):
@@ -270,8 +270,8 @@ class TestIdempotentRHSDynamic(Base):
Expected = TestRHSDynamic.Expected
-batch_size_before = T.dynamic("batch_size")
-lora_r_before = T.dynamic("lora_r")
+batch_size_before = T.dynamic("batch_size", "int64")
+lora_r_before = T.dynamic("lora_r", "int64")
class TestDynamicWithBatchSymbolic1(Base):
@@ -377,8 +377,8 @@ class TestDynamicWithBatchConcrete1RHSFirst(Base):
return out
-batch_size_before = T.dynamic("batch_size")
-lora_r_before = T.dynamic("lora_r")
+batch_size_before = T.dynamic("batch_size", "int64")
+lora_r_before = T.dynamic("lora_r", "int64")
class TestDynamicWithBatchSymbolic2(Base):
@@ -484,10 +484,10 @@ class TestDynamicWithBatchConcrete2LHSFirst(Base):
return out
-M_before = T.dynamic("M")
-N_before = T.dynamic("N")
-P_before = T.dynamic("P")
-Q_before = T.dynamic("Q")
+M_before = T.dynamic("M", "int64")
+N_before = T.dynamic("N", "int64")
+P_before = T.dynamic("P", "int64")
+Q_before = T.dynamic("Q", "int64")
class TestNoOpForFullyDynamicOnLHS(Base):
@@ -522,10 +522,10 @@ class TestNoOpForFullyDynamicOnLHS(Base):
Expected = Before
-M_before = T.dynamic("M")
-N_before = T.dynamic("N")
-P_before = T.dynamic("P")
-Q_before = T.dynamic("Q")
+M_before = T.dynamic("M", "int64")
+N_before = T.dynamic("N", "int64")
+P_before = T.dynamic("P", "int64")
+Q_before = T.dynamic("Q", "int64")
class TestNoOpForFullyDynamicOnRHS(Base):
@@ -650,8 +650,8 @@ class TestLHSPermuteDimsNonMatrixAxes(Base):
Expected = Before
-lora_r_before = T.dynamic("lora_r")
-lora_r_expected = T.dynamic("lora_r")
+lora_r_before = T.dynamic("lora_r", "int64")
+lora_r_expected = T.dynamic("lora_r", "int64")
class TestRHSPermuteDimsDynamic(Base):
@@ -696,10 +696,10 @@ class TestRHSPermuteDimsDynamic(Base):
return x
-lora_r_before = T.dynamic("lora_r")
-batch_size_before = T.dynamic("batch_size")
-lora_r_expected = T.dynamic("lora_r")
-batch_size_expected = T.dynamic("batch_size")
+lora_r_before = T.dynamic("lora_r", "int64")
+batch_size_before = T.dynamic("batch_size", "int64")
+lora_r_expected = T.dynamic("lora_r", "int64")
+batch_size_expected = T.dynamic("batch_size", "int64")
class TestRHSPermuteDimsWithDynamicBatch(Base):
@@ -765,8 +765,8 @@ class TestRHSPermuteDimsWithDynamicBatch(Base):
return x
-lora_r_before = T.dynamic("lora_r")
-lora_r_expected = T.dynamic("lora_r")
+lora_r_before = T.dynamic("lora_r", "int64")
+lora_r_expected = T.dynamic("lora_r", "int64")
class TestRHSPermuteDimsDynamicWithSquareMatrix(Base):
diff --git a/tests/python/relax/test_transform_alter_op_impl.py b/tests/python/relax/test_transform_alter_op_impl.py
index 0af241faf5..b7640fa864 100644
--- a/tests/python/relax/test_transform_alter_op_impl.py
+++ b/tests/python/relax/test_transform_alter_op_impl.py
@@ -256,8 +256,8 @@ def test_supported_implicit_padding():
Ts.writes(output[v_ax0])
output[v_ax0] = T.max(arg0[v_ax0], T.float32(0))
- p0 = T.dynamic("p0")
- i0 = T.dynamic("i0")
+ p0 = T.dynamic("p0", "int64")
+ i0 = T.dynamic("i0", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_attach_global_symbol.py b/tests/python/relax/test_transform_attach_global_symbol.py
index 43b053408d..30aef40187 100644
--- a/tests/python/relax/test_transform_attach_global_symbol.py
+++ b/tests/python/relax/test_transform_attach_global_symbol.py
@@ -29,12 +29,12 @@ from tvm.script import tirx as T
def test_basic():
- m_tir_matmul = T.dynamic("m")
- n_tir_matmul = T.dynamic("n")
- k_tir_matmul = T.dynamic("k")
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- k_main = T.dynamic("k")
+ m_tir_matmul = T.dynamic("m", "int64")
+ n_tir_matmul = T.dynamic("n", "int64")
+ k_tir_matmul = T.dynamic("k", "int64")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ k_main = T.dynamic("k", "int64")
@tvm.script.ir_module
class Before:
@@ -60,12 +60,12 @@ def test_basic():
)
return gv0
- m_tir_matmul = T.dynamic("m")
- n_tir_matmul = T.dynamic("n")
- k_tir_matmul = T.dynamic("k")
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- k_main = T.dynamic("k")
+ m_tir_matmul = T.dynamic("m", "int64")
+ n_tir_matmul = T.dynamic("n", "int64")
+ k_tir_matmul = T.dynamic("k", "int64")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ k_main = T.dynamic("k", "int64")
@tvm.script.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_bind_params.py b/tests/python/relax/test_transform_bind_params.py
index 555ee3bc43..16bae4b063 100644
--- a/tests/python/relax/test_transform_bind_params.py
+++ b/tests/python/relax/test_transform_bind_params.py
@@ -80,10 +80,10 @@ def test_bind_params(use_np_array):
def test_bind_params_symbolic_vars():
- batch = T.dynamic("batch")
- k = T.dynamic("k")
- m = T.dynamic("m")
- n = T.dynamic("n")
+ batch = T.dynamic("batch", "int64")
+ k = T.dynamic("k", "int64")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Before:
diff --git a/tests/python/relax/test_transform_bind_symbolic_vars.py b/tests/python/relax/test_transform_bind_symbolic_vars.py
index 3438e020c5..bc25439c10 100644
--- a/tests/python/relax/test_transform_bind_symbolic_vars.py
+++ b/tests/python/relax/test_transform_bind_symbolic_vars.py
@@ -30,10 +30,10 @@ from tvm.script import tirx as T
def test_bind_tensors():
"""Symbolic variables may occur in Tensor shapes"""
- batch = T.dynamic("batch")
- n = T.dynamic("n")
- k = T.dynamic("k")
- m = T.dynamic("m")
+ batch = T.dynamic("batch", "int64")
+ n = T.dynamic("n", "int64")
+ k = T.dynamic("k", "int64")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class Before:
@@ -57,8 +57,8 @@ def test_bind_tensors():
target_func_name = "main"
After = relax.transform.BindSymbolicVars(symvar_map, target_func_name)(Before)
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Expected:
@@ -84,10 +84,10 @@ def test_bind_tensors():
def test_bind_shape():
"""Symbolic variables may occur in ShapeExpr"""
- batch = T.dynamic("batch")
- n = T.dynamic("n")
- k = T.dynamic("k")
- m = T.dynamic("m")
+ batch = T.dynamic("batch", "int64")
+ n = T.dynamic("n", "int64")
+ k = T.dynamic("k", "int64")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class Before:
@@ -111,8 +111,8 @@ def test_bind_shape():
target_func_name = "main"
After = relax.transform.BindSymbolicVars(symvar_map, target_func_name)(Before)
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Expected:
@@ -130,10 +130,10 @@ def test_bind_shape():
def test_arith():
"""Symbolic shapes may use TIR arithmetic expressions"""
- batch = T.dynamic("batch")
- m = T.dynamic("m")
- n = T.dynamic("n")
- k = T.dynamic("k")
+ batch = T.dynamic("batch", "int64")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
+ k = T.dynamic("k", "int64")
@tvm.script.ir_module
class Before:
@@ -161,7 +161,7 @@ def test_arith():
target_func_name = "main"
After = relax.transform.BindSymbolicVars(symvar_map, target_func_name)(Before)
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -187,10 +187,10 @@ def test_arith():
def test_bind_multiple_variables_by_name():
"""String names may be used to replace across multiple functions"""
- m_main_1 = T.dynamic("m")
- n_main_1 = T.dynamic("n")
- m_main_2 = T.dynamic("m")
- n_main_2 = T.dynamic("n")
+ m_main_1 = T.dynamic("m", "int64")
+ n_main_1 = T.dynamic("n", "int64")
+ m_main_2 = T.dynamic("m", "int64")
+ n_main_2 = T.dynamic("n", "int64")
@tvm.script.ir_module
class Before:
@@ -202,8 +202,8 @@ def test_bind_multiple_variables_by_name():
def main_2(x: R.Tensor((m_main_2, n_main_2), dtype="float32")):
return x
- m_main_1 = T.dynamic("m")
- m_main_2 = T.dynamic("m")
+ m_main_1 = T.dynamic("m", "int64")
+ m_main_2 = T.dynamic("m", "int64")
@tvm.script.ir_module
class Expected:
@@ -222,10 +222,10 @@ def test_bind_multiple_variables_by_name():
def test_bind_single_variable_by_identity():
"""TIR variables may be used to replace a specific var"""
- m_main_1 = T.dynamic("m")
- n_main_1 = T.dynamic("n")
- m_main_2 = T.dynamic("m")
- n_main_2 = T.dynamic("n")
+ m_main_1 = T.dynamic("m", "int64")
+ n_main_1 = T.dynamic("n", "int64")
+ m_main_2 = T.dynamic("m", "int64")
+ n_main_2 = T.dynamic("n", "int64")
@tvm.script.ir_module
class Before:
@@ -237,9 +237,9 @@ def test_bind_single_variable_by_identity():
def main_2(x: R.Tensor((m_main_2, n_main_2), dtype="float32")):
return x
- m_main_1 = T.dynamic("m")
- m_main_2 = T.dynamic("m")
- n = T.dynamic("n")
+ m_main_1 = T.dynamic("m", "int64")
+ m_main_2 = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -259,10 +259,10 @@ def test_bind_single_variable_by_identity():
def test_bind_single_variable_by_function_name():
"""Variable name and function name may be used to replace a specific var"""
- m_main_1 = T.dynamic("m")
- n_main_1 = T.dynamic("n")
- m_main_2 = T.dynamic("m")
- n_main_2 = T.dynamic("n")
+ m_main_1 = T.dynamic("m", "int64")
+ n_main_1 = T.dynamic("n", "int64")
+ m_main_2 = T.dynamic("m", "int64")
+ n_main_2 = T.dynamic("n", "int64")
@tvm.script.ir_module
class Before:
@@ -274,9 +274,9 @@ def test_bind_single_variable_by_function_name():
def main_2(x: R.Tensor((m_main_2, n_main_2), dtype="float32")):
return x
- m_main_1 = T.dynamic("m")
- m_main_2 = T.dynamic("m")
- n = T.dynamic("n")
+ m_main_1 = T.dynamic("m", "int64")
+ m_main_2 = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -295,8 +295,8 @@ def test_bind_single_variable_by_function_name():
def test_error_for_unused_replacement():
"""Each replacement must be used"""
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Before:
diff --git a/tests/python/relax/test_transform_canonicalize_bindings.py b/tests/python/relax/test_transform_canonicalize_bindings.py
index 27149bc25a..958a9de44a 100644
--- a/tests/python/relax/test_transform_canonicalize_bindings.py
+++ b/tests/python/relax/test_transform_canonicalize_bindings.py
@@ -153,8 +153,8 @@ def test_casting():
def test_match_cast():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class TestMatchCast:
@@ -165,8 +165,8 @@ def test_match_cast():
w = z
return w
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -180,8 +180,8 @@ def test_match_cast():
def test_same_shape():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class TestSameShape:
@@ -194,8 +194,8 @@ def test_same_shape():
q = R.add(w, y)
return R.add(q, w)
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -210,8 +210,8 @@ def test_same_shape():
def test_change_shape():
- o = T.dynamic("o")
- p = T.dynamic("p")
+ o = T.dynamic("o", "int64")
+ p = T.dynamic("p", "int64")
@I.ir_module
class TestChangeShape:
@@ -228,8 +228,8 @@ def test_change_shape():
q = R.add(w, y)
return R.add(q, w)
- o = T.dynamic("o")
- p = T.dynamic("p")
+ o = T.dynamic("o", "int64")
+ p = T.dynamic("p", "int64")
@I.ir_module
class Expected:
@@ -244,10 +244,10 @@ def test_change_shape():
def test_replace_symbolic_variable_and_remove_match_cast():
- o = T.dynamic("o")
- p = T.dynamic("p")
- m = T.dynamic("m")
- n = T.dynamic("n")
+ o = T.dynamic("o", "int64")
+ p = T.dynamic("p", "int64")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class TestChangeShape:
@@ -264,8 +264,8 @@ def test_replace_symbolic_variable_and_remove_match_cast():
q = R.add(w, y)
return R.add(q, w)
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -290,10 +290,10 @@ def test_replace_symbolic_variable_and_remove_match_cast_of_tuple():
"""
- o = T.dynamic("o")
- p = T.dynamic("p")
- m = T.dynamic("m")
- n = T.dynamic("n")
+ o = T.dynamic("o", "int64")
+ p = T.dynamic("p", "int64")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -305,8 +305,8 @@ def test_replace_symbolic_variable_and_remove_match_cast_of_tuple():
q = R.add(w[0], y[0])
return R.add(q, w[0])
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -395,9 +395,9 @@ def test_fold_variables_from_match_cast():
"""
- N1 = T.dynamic("N1")
- M = T.dynamic("M")
- N2 = T.dynamic("N2")
+ N1 = T.dynamic("N1", "int64")
+ M = T.dynamic("M", "int64")
+ N2 = T.dynamic("N2", "int64")
@I.ir_module
class Before:
@@ -434,9 +434,9 @@ def test_fold_variables_from_match_cast():
)
return (proj_A, proj_B)
- N1 = T.dynamic("N1")
- M = T.dynamic("M")
- N2 = T.dynamic("N2")
+ N1 = T.dynamic("N1", "int64")
+ M = T.dynamic("M", "int64")
+ N2 = T.dynamic("N2", "int64")
@I.ir_module
class Expected:
@@ -483,9 +483,9 @@ def test_inconsistent_match_cast_raises_error():
"""
- N1 = T.dynamic("N1")
- M = T.dynamic("M")
- N2 = T.dynamic("N2")
+ N1 = T.dynamic("N1", "int64")
+ M = T.dynamic("M", "int64")
+ N2 = T.dynamic("N2", "int64")
@I.ir_module
class Before:
@@ -531,8 +531,8 @@ def test_match_cast_may_have_distinct_values_in_branches():
"""
- N = T.dynamic("N")
- M = T.dynamic("M")
+ N = T.dynamic("N", "int64")
+ M = T.dynamic("M", "int64")
@I.ir_module
class Before:
@@ -562,8 +562,8 @@ def test_match_cast_may_have_distinct_values_in_branches():
return out
- N = T.dynamic("N")
- M = T.dynamic("M")
+ N = T.dynamic("N", "int64")
+ M = T.dynamic("M", "int64")
@I.ir_module
class Expected:
@@ -898,7 +898,7 @@ def test_canonicalize_with_updated_ty():
in order to provide better type.
"""
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -919,7 +919,7 @@ def test_canonicalize_with_updated_ty():
# version of `C` with `ndim=2`.
return C
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -1226,7 +1226,7 @@ def test_canonicalization_causes_ty_update():
class.
"""
- vocab_size = T.dynamic("vocab_size")
+ vocab_size = T.dynamic("vocab_size", "int64")
@I.ir_module
class Before:
@@ -1263,7 +1263,7 @@ def test_canonicalization_causes_ty_update():
# with `shape=[vocab_size,4096]`.
return E
- vocab_size = T.dynamic("vocab_size")
+ vocab_size = T.dynamic("vocab_size", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_codegen_pass.py b/tests/python/relax/test_transform_codegen_pass.py
index 26f604bdd8..6110cf85a1 100644
--- a/tests/python/relax/test_transform_codegen_pass.py
+++ b/tests/python/relax/test_transform_codegen_pass.py
@@ -298,9 +298,9 @@ def test_default_entry_func():
def test_dynamic_shape():
import tvm.relax.backend.cuda.cublas
- r1_main = T.dynamic("r1")
- r2 = T.dynamic("r2")
- r1_fused_relax_matmul_cublas = T.dynamic("r1")
+ r1_main = T.dynamic("r1", "int64")
+ r2 = T.dynamic("r2", "int64")
+ r1_fused_relax_matmul_cublas = T.dynamic("r1", "int64")
@I.ir_module
class Before:
@@ -343,8 +343,8 @@ def test_dynamic_shape():
gv1: R.Tensor((1, r1_fused_relax_matmul_cublas), dtype="float16") = gv(x, w1)
return gv1
- r1 = T.dynamic("r1")
- r2 = T.dynamic("r2")
+ r1 = T.dynamic("r1", "int64")
+ r2 = T.dynamic("r2", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_combine_parallel_matmul.py b/tests/python/relax/test_transform_combine_parallel_matmul.py
index 695321f1da..77d848341d 100644
--- a/tests/python/relax/test_transform_combine_parallel_matmul.py
+++ b/tests/python/relax/test_transform_combine_parallel_matmul.py
@@ -538,7 +538,7 @@ def test_combine_matmul_of_static_and_dynamic_shapes():
"""
- M = T.dynamic("M")
+ M = T.dynamic("M", "int64")
@R.function(private=True)
def before(
@@ -553,7 +553,7 @@ def test_combine_matmul_of_static_and_dynamic_shapes():
R.output(out)
return out
- M = T.dynamic("M")
+ M = T.dynamic("M", "int64")
@R.function(private=True)
def expected(
@@ -596,7 +596,7 @@ def test_combine_matmul_of_dynamic_and_static_shapes():
concatenated weights.
"""
- M = T.dynamic("M")
+ M = T.dynamic("M", "int64")
@R.function(private=True)
def before(
@@ -611,7 +611,7 @@ def test_combine_matmul_of_dynamic_and_static_shapes():
R.output(out)
return out
- M = T.dynamic("M")
+ M = T.dynamic("M", "int64")
@R.function(private=True)
def expected(
@@ -654,8 +654,8 @@ def test_limit_one_dynamic_shape_in_combined_matmul():
matmul.
"""
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def before(
@@ -672,8 +672,8 @@ def test_limit_one_dynamic_shape_in_combined_matmul():
R.output(out)
return out
- M = T.dynamic("M")
- N = T.dynamic("N")
+ M = T.dynamic("M", "int64")
+ N = T.dynamic("N", "int64")
@R.function(private=True)
def expected(
diff --git a/tests/python/relax/test_transform_compute_prim_value.py b/tests/python/relax/test_transform_compute_prim_value.py
index d56554a56c..809257e347 100644
--- a/tests/python/relax/test_transform_compute_prim_value.py
+++ b/tests/python/relax/test_transform_compute_prim_value.py
@@ -24,7 +24,7 @@ from tvm.script import tirx as T
def test_prim_value_in_assert_condition():
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@I.ir_module
class Before:
@@ -33,7 +33,7 @@ def test_prim_value_in_assert_condition():
_ = R.assert_op(N % 16 == 0)
return A
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@I.ir_module
class Expected:
@@ -57,7 +57,7 @@ def test_prim_value_in_assert_condition():
def test_prim_value_in_branch_condition():
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@I.ir_module
class Before:
@@ -69,7 +69,7 @@ def test_prim_value_in_branch_condition():
out = R.call_packed("slow_non_vectorized_impl", A, ty_args=[A.ty])
return out
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_convert_layout.py b/tests/python/relax/test_transform_convert_layout.py
index bf7ccd104e..076c81a61b 100644
--- a/tests/python/relax/test_transform_convert_layout.py
+++ b/tests/python/relax/test_transform_convert_layout.py
@@ -118,10 +118,10 @@ def test_conv2d_onlydim():
def test_conv2d_symbolic():
- N = T.dynamic("N")
- C = T.dynamic("C")
- H = T.dynamic("H")
- W = T.dynamic("W")
+ N = T.dynamic("N", "int64")
+ C = T.dynamic("C", "int64")
+ H = T.dynamic("H", "int64")
+ W = T.dynamic("W", "int64")
@I.ir_module
class Input:
@@ -135,10 +135,10 @@ def test_conv2d_symbolic():
R.output(gv)
return gv
- N = T.dynamic("N")
- C = T.dynamic("C")
- H = T.dynamic("H")
- W = T.dynamic("W")
+ N = T.dynamic("N", "int64")
+ C = T.dynamic("C", "int64")
+ H = T.dynamic("H", "int64")
+ W = T.dynamic("W", "int64")
@I.ir_module
class Expected:
@@ -172,10 +172,10 @@ def test_conv2d_symbolic():
def test_conv2d_matchcast_bias():
- N = T.dynamic("N")
- C = T.dynamic("C")
- H = T.dynamic("H")
- W = T.dynamic("W")
+ N = T.dynamic("N", "int64")
+ C = T.dynamic("C", "int64")
+ H = T.dynamic("H", "int64")
+ W = T.dynamic("W", "int64")
@I.ir_module
class Input:
@@ -190,10 +190,10 @@ def test_conv2d_matchcast_bias():
R.output(gv)
return gv
- N = T.dynamic("N")
- H = T.dynamic("H")
- W = T.dynamic("W")
- C = T.dynamic("C")
+ N = T.dynamic("N", "int64")
+ H = T.dynamic("H", "int64")
+ W = T.dynamic("W", "int64")
+ C = T.dynamic("C", "int64")
@I.ir_module
class Expected:
@@ -1919,11 +1919,11 @@ def test_conv2d_NHWC_sub_indexed():
def test_conv2d_symbolic_sub_indexed():
- N = T.dynamic("N")
- H = T.dynamic("H")
- W = T.dynamic("W")
- Hw = T.dynamic("Hw")
- Ww = T.dynamic("Ww")
+ N = T.dynamic("N", "int64")
+ H = T.dynamic("H", "int64")
+ W = T.dynamic("W", "int64")
+ Hw = T.dynamic("Hw", "int64")
+ Ww = T.dynamic("Ww", "int64")
@I.ir_module
class Input:
@@ -1940,11 +1940,11 @@ def test_conv2d_symbolic_sub_indexed():
R.output(gv)
return gv
- N = T.dynamic("N")
- H = T.dynamic("H")
- W = T.dynamic("W")
- Hw = T.dynamic("Hw")
- Ww = T.dynamic("Ww")
+ N = T.dynamic("N", "int64")
+ H = T.dynamic("H", "int64")
+ W = T.dynamic("W", "int64")
+ Hw = T.dynamic("Hw", "int64")
+ Ww = T.dynamic("Ww", "int64")
@I.ir_module
class Expected:
@@ -1999,15 +1999,15 @@ def test_conv2d_symbolic_sub_indexed():
def test_conv2d_matchcast_bias_sub_indexed():
- N = T.dynamic("N")
- H = T.dynamic("H")
- W = T.dynamic("W")
- Hw = T.dynamic("Hw")
- Ww = T.dynamic("Ww")
- Nb = T.dynamic("Nb")
- Cb = T.dynamic("Cb")
- Hb = T.dynamic("Hb")
- Wb = T.dynamic("Wb")
+ N = T.dynamic("N", "int64")
+ H = T.dynamic("H", "int64")
+ W = T.dynamic("W", "int64")
+ Hw = T.dynamic("Hw", "int64")
+ Ww = T.dynamic("Ww", "int64")
+ Nb = T.dynamic("Nb", "int64")
+ Cb = T.dynamic("Cb", "int64")
+ Hb = T.dynamic("Hb", "int64")
+ Wb = T.dynamic("Wb", "int64")
@I.ir_module
class Input:
@@ -2026,15 +2026,15 @@ def test_conv2d_matchcast_bias_sub_indexed():
R.output(gv)
return gv
- N = T.dynamic("N")
- H = T.dynamic("H")
- W = T.dynamic("W")
- Hw = T.dynamic("Hw")
- Ww = T.dynamic("Ww")
- Nb = T.dynamic("Nb")
- Cb = T.dynamic("Cb")
- Hb = T.dynamic("Hb")
- Wb = T.dynamic("Wb")
+ N = T.dynamic("N", "int64")
+ H = T.dynamic("H", "int64")
+ W = T.dynamic("W", "int64")
+ Hw = T.dynamic("Hw", "int64")
+ Ww = T.dynamic("Ww", "int64")
+ Nb = T.dynamic("Nb", "int64")
+ Cb = T.dynamic("Cb", "int64")
+ Hb = T.dynamic("Hb", "int64")
+ Wb = T.dynamic("Wb", "int64")
@I.ir_module
class Expected_NHWC4c:
@@ -2101,15 +2101,15 @@ def test_conv2d_matchcast_bias_sub_indexed():
R.output(gv)
return gv
- N = T.dynamic("N")
- H = T.dynamic("H")
- W = T.dynamic("W")
- Hw = T.dynamic("Hw")
- Ww = T.dynamic("Ww")
- Nb = T.dynamic("Nb")
- Cb = T.dynamic("Cb")
- Hb = T.dynamic("Hb")
- Wb = T.dynamic("Wb")
+ N = T.dynamic("N", "int64")
+ H = T.dynamic("H", "int64")
+ W = T.dynamic("W", "int64")
+ Hw = T.dynamic("Hw", "int64")
+ Ww = T.dynamic("Ww", "int64")
+ Nb = T.dynamic("Nb", "int64")
+ Cb = T.dynamic("Cb", "int64")
+ Hb = T.dynamic("Hb", "int64")
+ Wb = T.dynamic("Wb", "int64")
@I.ir_module
class Expected_NCHW4c:
@@ -2177,15 +2177,15 @@ def test_conv2d_matchcast_bias_sub_indexed():
def test_conv2d_layout_incompatible_fallback():
- N = T.dynamic("N")
- H = T.dynamic("H")
- W = T.dynamic("W")
- Hw = T.dynamic("Hw")
- Ww = T.dynamic("Ww")
- Nb = T.dynamic("Nb")
- Cb = T.dynamic("Cb")
- Hb = T.dynamic("Hb")
- Wb = T.dynamic("Wb")
+ N = T.dynamic("N", "int64")
+ H = T.dynamic("H", "int64")
+ W = T.dynamic("W", "int64")
+ Hw = T.dynamic("Hw", "int64")
+ Ww = T.dynamic("Ww", "int64")
+ Nb = T.dynamic("Nb", "int64")
+ Cb = T.dynamic("Cb", "int64")
+ Hb = T.dynamic("Hb", "int64")
+ Wb = T.dynamic("Wb", "int64")
@I.ir_module
class Input:
@@ -2204,15 +2204,15 @@ def test_conv2d_layout_incompatible_fallback():
R.output(gv)
return gv
- N = T.dynamic("N")
- H = T.dynamic("H")
- W = T.dynamic("W")
- Hw = T.dynamic("Hw")
- Ww = T.dynamic("Ww")
- Nb = T.dynamic("Nb")
- Cb = T.dynamic("Cb")
- Hb = T.dynamic("Hb")
- Wb = T.dynamic("Wb")
+ N = T.dynamic("N", "int64")
+ H = T.dynamic("H", "int64")
+ W = T.dynamic("W", "int64")
+ Hw = T.dynamic("Hw", "int64")
+ Ww = T.dynamic("Ww", "int64")
+ Nb = T.dynamic("Nb", "int64")
+ Cb = T.dynamic("Cb", "int64")
+ Hb = T.dynamic("Hb", "int64")
+ Wb = T.dynamic("Wb", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_cse.py b/tests/python/relax/test_transform_cse.py
index 3c6816b4bc..74b5759a16 100644
--- a/tests/python/relax/test_transform_cse.py
+++ b/tests/python/relax/test_transform_cse.py
@@ -493,10 +493,10 @@ def test_match_cast():
def test_match_cast_with_symbolic_vars():
- n = T.dynamic("n")
- m = T.dynamic("m")
- p = T.dynamic("p")
- q = T.dynamic("q")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
+ p = T.dynamic("p", "int64")
+ q = T.dynamic("q", "int64")
@I.ir_module
class Before:
@@ -514,10 +514,10 @@ def test_match_cast_with_symbolic_vars():
R.output(gv)
return gv
- n = T.dynamic("n")
- m = T.dynamic("m")
- p = T.dynamic("p")
- q = T.dynamic("q")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
+ p = T.dynamic("p", "int64")
+ q = T.dynamic("q", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_dead_code_elimination.py b/tests/python/relax/test_transform_dead_code_elimination.py
index 650f512bf3..8cda8edb65 100644
--- a/tests/python/relax/test_transform_dead_code_elimination.py
+++ b/tests/python/relax/test_transform_dead_code_elimination.py
@@ -287,15 +287,15 @@ def test_tracking_through_externally_exposed_func(provide_entry_func_name):
def test_unused_relax_func_symbolic_shape():
# Test with relax function w/ symbolic shape.
- m_tir_matmul = T.dynamic("m")
- n_tir_matmul = T.dynamic("n")
- k_tir_matmul = T.dynamic("k")
- m_unused_func = T.dynamic("m")
- n_unused_func = T.dynamic("n")
- k_unused_func = T.dynamic("k")
- m_main = T.dynamic("m")
- k_main = T.dynamic("k")
- n_main = T.dynamic("n")
+ m_tir_matmul = T.dynamic("m", "int64")
+ n_tir_matmul = T.dynamic("n", "int64")
+ k_tir_matmul = T.dynamic("k", "int64")
+ m_unused_func = T.dynamic("m", "int64")
+ n_unused_func = T.dynamic("n", "int64")
+ k_unused_func = T.dynamic("k", "int64")
+ m_main = T.dynamic("m", "int64")
+ k_main = T.dynamic("k", "int64")
+ n_main = T.dynamic("n", "int64")
@tvm.script.ir_module(check_well_formed=False)
class InputModule:
diff --git a/tests/python/relax/test_transform_decompose_ops.py b/tests/python/relax/test_transform_decompose_ops.py
index 2da0d09ff2..88ee7041f4 100644
--- a/tests/python/relax/test_transform_decompose_ops.py
+++ b/tests/python/relax/test_transform_decompose_ops.py
@@ -367,9 +367,9 @@ def test_op_tensor_to_shape():
gv: R.Shape(ndim=3) = R.tensor_to_shape(t)
return gv
- x = T.dynamic("x")
- x_1 = T.dynamic("x_1")
- x_2 = T.dynamic("x_2")
+ x = T.dynamic("x", "int64")
+ x_1 = T.dynamic("x_1", "int64")
+ x_2 = T.dynamic("x_2", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_fold_constant.py b/tests/python/relax/test_transform_fold_constant.py
index 5a268103a0..3151b3c774 100644
--- a/tests/python/relax/test_transform_fold_constant.py
+++ b/tests/python/relax/test_transform_fold_constant.py
@@ -185,10 +185,10 @@ def test_dataflow_fold():
def test_fold_mixed_case():
n_addone = T.dynamic("n", "int32")
m_addone = T.dynamic("m", "int32")
- n_before = T.dynamic("n")
- m_before = T.dynamic("m")
- n_expected = T.dynamic("n")
- m_expected = T.dynamic("m")
+ n_before = T.dynamic("n", "int64")
+ m_before = T.dynamic("m", "int64")
+ n_expected = T.dynamic("n", "int64")
+ m_expected = T.dynamic("m", "int64")
@tvm.script.ir_module
class Module:
@@ -601,7 +601,7 @@ def test_fold_large_op_with_tensor_input():
def test_call_tir_with_primitive_args_not_folded():
"""call_tir with symbolic primitive arguments cannot be const-evaluated."""
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class Module:
diff --git a/tests/python/relax/test_transform_fuse_ops.py b/tests/python/relax/test_transform_fuse_ops.py
index cd03bbf877..6908d7a6b4 100644
--- a/tests/python/relax/test_transform_fuse_ops.py
+++ b/tests/python/relax/test_transform_fuse_ops.py
@@ -1281,8 +1281,8 @@ def test_dead_group():
def test_symbolic_shape_aware_fuse():
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Before:
@@ -1295,10 +1295,10 @@ def test_symbolic_shape_aware_fuse():
R.output(gv)
return gv
- n_fused_add_exp_squeeze = T.dynamic("n")
- m_fused_add_exp_squeeze = T.dynamic("m")
- n_main = T.dynamic("n")
- m_main = T.dynamic("m")
+ n_fused_add_exp_squeeze = T.dynamic("n", "int64")
+ m_fused_add_exp_squeeze = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_main = T.dynamic("m", "int64")
@I.ir_module
class Expected:
@@ -1329,7 +1329,7 @@ def test_symbolic_shape_aware_fuse():
def test_symbolic_shape_aware_fuse_2():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -1342,8 +1342,8 @@ def test_symbolic_shape_aware_fuse_2():
R.output(gv)
return gv
- n_fused_full_trilu_broadcast_to = T.dynamic("n")
- n_main = T.dynamic("n")
+ n_fused_full_trilu_broadcast_to = T.dynamic("n", "int64")
+ n_main = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -1384,7 +1384,7 @@ def test_symbolic_shape_aware_fuse_2():
def test_symbolic_prim_arg_after_tensor_arg():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -1461,7 +1461,7 @@ def test_symbolic_prim_arg_after_tensor_arg():
def test_symbolic_prim_arg_before_tensor_arg():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -1538,7 +1538,7 @@ def test_symbolic_prim_arg_before_tensor_arg():
def test_symbolic_prim_arg_reused_from_derived_tensor_shape():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -1618,8 +1618,8 @@ def test_symbolic_prim_arg_reused_from_derived_tensor_shape():
def test_symbolic_prim_arg_not_bound_by_derived_tensor_shape():
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Before:
@@ -1826,7 +1826,7 @@ def test_primitive_call_arg_used_by_output_shape_not_inlined():
def test_symbolic_prim_arg_used_only_by_output_shape():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -1897,7 +1897,7 @@ def test_symbolic_prim_arg_used_only_by_output_shape():
def test_shape_expr_arg():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -1916,8 +1916,8 @@ def test_shape_expr_arg():
R.output(gv, lv2)
return gv, lv2
- n_fused_full_trilu_broadcast_to = T.dynamic("n")
- n_main = T.dynamic("n")
+ n_fused_full_trilu_broadcast_to = T.dynamic("n", "int64")
+ n_main = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -1964,8 +1964,8 @@ def test_shape_expr_arg():
def test_skipping_match_cast():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Module:
diff --git a/tests/python/relax/test_transform_fuse_ops_by_pattern.py b/tests/python/relax/test_transform_fuse_ops_by_pattern.py
index e6a14ddef8..c87774e4a8 100644
--- a/tests/python/relax/test_transform_fuse_ops_by_pattern.py
+++ b/tests/python/relax/test_transform_fuse_ops_by_pattern.py
@@ -1138,8 +1138,8 @@ def test_error_on_repeated_variable_definitions():
def test_matmul_symbolic_var():
- batch_size = T.dynamic("batch_size")
- M = T.dynamic("M")
+ batch_size = T.dynamic("batch_size", "int64")
+ M = T.dynamic("M", "int64")
@I.ir_module
class Before:
@@ -1156,11 +1156,11 @@ def test_matmul_symbolic_var():
R.output(out)
return out
- batch_size_main = T.dynamic("batch_size")
- M_main = T.dynamic("M")
- batch_size_fused_relax_matmul_cublas = T.dynamic("batch_size")
- batch_size_fused_relax_matmul1_cublas = T.dynamic("batch_size")
- M_fused_relax_matmul1_cublas = T.dynamic("M")
+ batch_size_main = T.dynamic("batch_size", "int64")
+ M_main = T.dynamic("M", "int64")
+ batch_size_fused_relax_matmul_cublas = T.dynamic("batch_size", "int64")
+ batch_size_fused_relax_matmul1_cublas = T.dynamic("batch_size", "int64")
+ M_fused_relax_matmul1_cublas = T.dynamic("M", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_fuse_tir.py b/tests/python/relax/test_transform_fuse_tir.py
index 7b36f6c39c..e1380fc800 100644
--- a/tests/python/relax/test_transform_fuse_tir.py
+++ b/tests/python/relax/test_transform_fuse_tir.py
@@ -709,10 +709,10 @@ def test_skip_call_dps_packed():
def test_symbolic_shape_aware_fuse():
- n_fused_add_exp_squeeze = T.dynamic("n")
- m_fused_add_exp_squeeze = T.dynamic("m")
- n_main = T.dynamic("n")
- m_main = T.dynamic("m")
+ n_fused_add_exp_squeeze = T.dynamic("n", "int64")
+ m_fused_add_exp_squeeze = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_main = T.dynamic("m", "int64")
@I.ir_module
class Before:
@@ -742,8 +742,8 @@ def test_symbolic_shape_aware_fuse():
def fused_add_exp_squeeze(x, p0):
return topi.squeeze(topi.exp(topi.add(x, p0)))
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Expected:
@@ -758,8 +758,8 @@ def test_symbolic_shape_aware_fuse():
def test_fuse_of_dynamic_kernel_with_var_params_and_static_args():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -824,8 +824,8 @@ def test_fuse_of_dynamic_kernel_with_expression_params_and_static_args():
Here, the kernel requires arguments (m*n), and is provided
"""
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -913,8 +913,8 @@ def test_symbolic_shape_aware_fuse_with_allocation():
def te_mean(x, axis):
return topi.divide(topi.sum(x, axis, keepdims=True), 4096)
- n_fused_mean_add_tir_sqrt_divide_multiply = T.dynamic("n")
- n_main = T.dynamic("n")
+ n_fused_mean_add_tir_sqrt_divide_multiply = T.dynamic("n", "int64")
+ n_main = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -953,7 +953,7 @@ def test_symbolic_shape_aware_fuse_with_allocation():
lv3 = topi.divide(y, lv2)
return topi.multiply(rms_norm_weight, lv3)
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -972,8 +972,8 @@ def test_symbolic_shape_aware_fuse_with_allocation():
def test_symbolic_var_in_call_tir_args():
- m_fused = T.dynamic("m")
- m_main = T.dynamic("m")
+ m_fused = T.dynamic("m", "int64")
+ m_main = T.dynamic("m", "int64")
@I.ir_module
class Before:
@@ -1019,7 +1019,7 @@ def test_symbolic_var_in_call_tir_args():
R.output(gv)
return gv
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Expected:
@@ -1183,8 +1183,8 @@ def test_same_buffer_multiple_read():
def test_tir_expression_in_shape():
- n_fused_transpose_matmul = T.dynamic("n")
- n_main = T.dynamic("n")
+ n_fused_transpose_matmul = T.dynamic("n", "int64")
+ n_main = T.dynamic("n", "int64")
@I.ir_module
class Module:
@@ -1213,7 +1213,7 @@ def test_tir_expression_in_shape():
R.output(lv)
return lv
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -1486,11 +1486,11 @@ def test_symbolic_var_in_buffer_shape():
typically determined from the DLTensor's known shape.)
"""
- sequence_length_foo = T.dynamic("sequence_length")
- sequence_length_fused = T.dynamic("sequence_length")
- m_fused = T.dynamic("m")
- sequence_length_main = T.dynamic("sequence_length")
- m_main = T.dynamic("m")
+ sequence_length_foo = T.dynamic("sequence_length", "int64")
+ sequence_length_fused = T.dynamic("sequence_length", "int64")
+ m_fused = T.dynamic("m", "int64")
+ sequence_length_main = T.dynamic("sequence_length", "int64")
+ m_main = T.dynamic("m", "int64")
@I.ir_module
class Before:
@@ -1540,9 +1540,9 @@ def test_symbolic_var_in_buffer_shape():
R.output(gv)
return gv
- sequence_length_fused = T.dynamic("sequence_length")
- sequence_length_main = T.dynamic("sequence_length")
- m = T.dynamic("m")
+ sequence_length_fused = T.dynamic("sequence_length", "int64")
+ sequence_length_main = T.dynamic("sequence_length", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Expected:
@@ -1597,7 +1597,7 @@ def test_symbolic_var_in_buffer_shape():
def test_symbolic_var_called_with_static_shape():
"""A dynamic Function may be called with a static shape"""
- num_elements = T.dynamic("num_elements")
+ num_elements = T.dynamic("num_elements", "int64")
@I.ir_module
class Before:
@@ -1670,7 +1670,7 @@ def test_symbolic_var_called_with_static_shape():
def test_symbolic_var_called_with_multiple_static_shapes():
"""A dynamic Function may be called with different shapes each time"""
- num_elements = T.dynamic("num_elements")
+ num_elements = T.dynamic("num_elements", "int64")
@I.ir_module
class Before:
diff --git a/tests/python/relax/test_transform_gradient.py b/tests/python/relax/test_transform_gradient.py
index e5451b9ba0..1c7006d402 100644
--- a/tests/python/relax/test_transform_gradient.py
+++ b/tests/python/relax/test_transform_gradient.py
@@ -1077,7 +1077,7 @@ def test_function_copy():
def test_tir_copy():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
diff --git a/tests/python/relax/test_transform_gradient_te_register.py b/tests/python/relax/test_transform_gradient_te_register.py
index d38ed45332..f1f2d2825c 100644
--- a/tests/python/relax/test_transform_gradient_te_register.py
+++ b/tests/python/relax/test_transform_gradient_te_register.py
@@ -287,10 +287,10 @@ def test_call_tir_kwargs(register_te_grads):
def get_expected_3():
# fmt: off
- n_f_mul = T.dynamic("n")
- n_f_mul_grad = T.dynamic("n")
- n_main_adjoint = T.dynamic("n")
- n_main = T.dynamic("n")
+ n_f_mul = T.dynamic("n", "int64")
+ n_f_mul_grad = T.dynamic("n", "int64")
+ n_main_adjoint = T.dynamic("n", "int64")
+ n_main = T.dynamic("n", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_ipc_allreduce_rewrite.py b/tests/python/relax/test_transform_ipc_allreduce_rewrite.py
index 155479e8db..57ab660287 100644
--- a/tests/python/relax/test_transform_ipc_allreduce_rewrite.py
+++ b/tests/python/relax/test_transform_ipc_allreduce_rewrite.py
@@ -24,8 +24,8 @@ from tvm.script import tirx as T
def test_ipc_allreduce_rewrite():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Module:
@@ -43,8 +43,8 @@ def test_ipc_allreduce_rewrite():
)
return alloc1
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -76,8 +76,8 @@ def test_ipc_allreduce_rewrite():
def test_ipc_allreduce_spread_along_reshape():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Module:
@@ -95,8 +95,8 @@ def test_ipc_allreduce_spread_along_reshape():
)
return alloc1
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -132,8 +132,8 @@ def test_ipc_allreduce_spread_along_reshape():
def test_ipc_allreduce_skip_reducer_other_than_sum():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Module:
diff --git a/tests/python/relax/test_transform_lambda_lift.py b/tests/python/relax/test_transform_lambda_lift.py
index dcaedde804..9f1fdff465 100644
--- a/tests/python/relax/test_transform_lambda_lift.py
+++ b/tests/python/relax/test_transform_lambda_lift.py
@@ -440,8 +440,8 @@ def test_lambda_function_with_same_name_as_global():
def test_symbolic_variable_defined_by_inner_func():
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Before:
@@ -457,8 +457,8 @@ def test_symbolic_variable_defined_by_inner_func():
sum_main = inner(x1, y1)
return sum_main
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Expected:
@@ -481,8 +481,8 @@ def test_symbolic_variable_defined_by_inner_func():
def test_runtime_symbolic_variable_defined_by_inner_func():
- n_from_param = T.dynamic("n")
- n_from_match_cast = T.dynamic("n")
+ n_from_param = T.dynamic("n", "int64")
+ n_from_match_cast = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -510,8 +510,8 @@ def test_runtime_symbolic_variable_defined_by_inner_func():
def test_symbolic_variable_defined_by_outer_func():
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Before:
@@ -527,10 +527,10 @@ def test_symbolic_variable_defined_by_outer_func():
sum_main = inner(x1, y1)
return sum_main
- n_main = T.dynamic("n")
- m_main = T.dynamic("m")
- n_main_inner = T.dynamic("n")
- m_main_inner = T.dynamic("m")
+ n_main = T.dynamic("n", "int64")
+ m_main = T.dynamic("m", "int64")
+ n_main_inner = T.dynamic("n", "int64")
+ m_main_inner = T.dynamic("m", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_lazy_transform_params.py b/tests/python/relax/test_transform_lazy_transform_params.py
index 14011a0f3a..0742bd7256 100644
--- a/tests/python/relax/test_transform_lazy_transform_params.py
+++ b/tests/python/relax/test_transform_lazy_transform_params.py
@@ -403,7 +403,7 @@ def test_extra_set_item_params_with_const_output():
def test_lazy_transform_params_with_symbolic_vars():
- slice_index = T.dynamic("slice_index")
+ slice_index = T.dynamic("slice_index", "int64")
@I.ir_module
class Before:
@@ -440,7 +440,7 @@ def test_lazy_transform_params_with_symbolic_vars():
vi = Ts.axis.remap("S", [i])
Output[vi] = Input[slice_index, vi]
- slice_index = T.dynamic("slice_index")
+ slice_index = T.dynamic("slice_index", "int64")
@I.ir_module
class Expected:
@@ -481,7 +481,7 @@ def test_lazy_transform_params_with_symbolic_vars():
def test_param_shape_symbolic():
ic_transform_layout_IOHW_to_OIHW = T.dynamic("ic", "int32")
- ic_main_transform_params = T.dynamic("ic")
+ ic_main_transform_params = T.dynamic("ic", "int64")
@I.ir_module
class Before:
@@ -524,7 +524,7 @@ def test_param_shape_symbolic():
return gv
ic_transform_layout_IOHW_to_OIHW = T.dynamic("ic", "int32")
- ic_main_transform_params = T.dynamic("ic")
+ ic_main_transform_params = T.dynamic("ic", "int64")
@I.ir_module
class Expected:
@@ -623,7 +623,7 @@ def test_output():
target = "llvm"
dev = tvm.cpu()
- ic = T.dynamic("ic")
+ ic = T.dynamic("ic", "int64")
@I.ir_module
class TransformModule:
@@ -797,8 +797,8 @@ def test_get_item_callback():
def test_get_item_callback_dynamic_shape():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -810,8 +810,8 @@ def test_get_item_callback_dynamic_shape():
D = R.add(C, B)
return (D, B)
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_legalize_ops_binary.py b/tests/python/relax/test_transform_legalize_ops_binary.py
index 13684205f2..9f3a3f8c77 100644
--- a/tests/python/relax/test_transform_legalize_ops_binary.py
+++ b/tests/python/relax/test_transform_legalize_ops_binary.py
@@ -122,10 +122,10 @@ def test_add_with_arg1_constant_scalar():
def test_add_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class Add:
@@ -134,14 +134,14 @@ def test_add_symbolic():
gv: R.Tensor((a, b, c, d), "float32") = R.add(x, y)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
- a_add = T.dynamic("a")
- b_add = T.dynamic("b")
- c_add = T.dynamic("c")
- d_add = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_add = T.dynamic("a", "int64")
+ b_add = T.dynamic("b", "int64")
+ c_add = T.dynamic("c", "int64")
+ d_add = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -299,10 +299,10 @@ def test_divide_with_arg1_constant_scalar():
def test_divide_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class Divide:
@@ -311,14 +311,14 @@ def test_divide_symbolic():
gv: R.Tensor((a, b, c, d), "float32") = R.divide(x, y)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
- a_divide = T.dynamic("a")
- b_divide = T.dynamic("b")
- c_divide = T.dynamic("c")
- d_divide = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_divide = T.dynamic("a", "int64")
+ b_divide = T.dynamic("b", "int64")
+ c_divide = T.dynamic("c", "int64")
+ d_divide = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -476,10 +476,10 @@ def test_floor_divide_with_arg1_constant_scalar():
def test_floor_divide_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class FloorDivide:
@@ -488,14 +488,14 @@ def test_floor_divide_symbolic():
gv: R.Tensor((a, b, c, d), "float32") = R.floor_divide(x, y)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
- a_floor_divide = T.dynamic("a")
- b_floor_divide = T.dynamic("b")
- c_floor_divide = T.dynamic("c")
- d_floor_divide = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_floor_divide = T.dynamic("a", "int64")
+ b_floor_divide = T.dynamic("b", "int64")
+ c_floor_divide = T.dynamic("c", "int64")
+ d_floor_divide = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -593,10 +593,10 @@ def test_multiply():
def test_multiply_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class Multiply:
@@ -605,14 +605,14 @@ def test_multiply_symbolic():
gv: R.Tensor((a, b, c, d), "float32") = R.multiply(x, y)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
- a_multiply = T.dynamic("a")
- b_multiply = T.dynamic("b")
- c_multiply = T.dynamic("c")
- d_multiply = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_multiply = T.dynamic("a", "int64")
+ b_multiply = T.dynamic("b", "int64")
+ c_multiply = T.dynamic("c", "int64")
+ d_multiply = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -710,10 +710,10 @@ def test_power():
def test_power_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class Power:
@@ -722,14 +722,14 @@ def test_power_symbolic():
gv: R.Tensor((a, b, c, d), "float32") = R.power(x, y)
return gv
- c_power = T.dynamic("c")
- d_power = T.dynamic("d")
- a_power = T.dynamic("a")
- b_power = T.dynamic("b")
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
+ c_power = T.dynamic("c", "int64")
+ d_power = T.dynamic("d", "int64")
+ a_power = T.dynamic("a", "int64")
+ b_power = T.dynamic("b", "int64")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -828,10 +828,10 @@ def test_atan2():
def test_atan2_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class Atan2:
@@ -840,14 +840,14 @@ def test_atan2_symbolic():
gv: R.Tensor((a, b, c, d), "float32") = R.atan2(x, y)
return gv
- c_atan2 = T.dynamic("c")
- d_atan2 = T.dynamic("d")
- a_atan2 = T.dynamic("a")
- b_atan2 = T.dynamic("b")
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
+ c_atan2 = T.dynamic("c", "int64")
+ d_atan2 = T.dynamic("d", "int64")
+ a_atan2 = T.dynamic("a", "int64")
+ b_atan2 = T.dynamic("b", "int64")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -943,10 +943,10 @@ def test_subtract():
def test_subtract_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class Subtract:
@@ -955,14 +955,14 @@ def test_subtract_symbolic():
gv: R.Tensor((a, b, c, d), "float32") = R.subtract(x, y)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
- a_subtract = T.dynamic("a")
- b_subtract = T.dynamic("b")
- c_subtract = T.dynamic("c")
- d_subtract = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_subtract = T.dynamic("a", "int64")
+ b_subtract = T.dynamic("b", "int64")
+ c_subtract = T.dynamic("c", "int64")
+ d_subtract = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -1123,10 +1123,10 @@ def test_equal_with_arg1_constant_scalar():
def test_equal_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class Equal:
@@ -1135,14 +1135,14 @@ def test_equal_symbolic():
gv: R.Tensor((a, b, c, d), "bool") = R.equal(x, y)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
- a_equal = T.dynamic("a")
- b_equal = T.dynamic("b")
- c_equal = T.dynamic("c")
- d_equal = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_equal = T.dynamic("a", "int64")
+ b_equal = T.dynamic("b", "int64")
+ c_equal = T.dynamic("c", "int64")
+ d_equal = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -1300,10 +1300,10 @@ def test_greater_with_arg1_constant_scalar():
def test_greater_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class Greater:
@@ -1312,14 +1312,14 @@ def test_greater_symbolic():
gv: R.Tensor((a, b, c, d), "bool") = R.greater(x, y)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
- a_greater = T.dynamic("a")
- b_greater = T.dynamic("b")
- c_greater = T.dynamic("c")
- d_greater = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_greater = T.dynamic("a", "int64")
+ b_greater = T.dynamic("b", "int64")
+ c_greater = T.dynamic("c", "int64")
+ d_greater = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -1415,10 +1415,10 @@ def test_greater_equal():
def test_greater_equal_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class GreaterEqual:
@@ -1427,14 +1427,14 @@ def test_greater_equal_symbolic():
gv: R.Tensor((a, b, c, d), "bool") = R.greater_equal(x, y)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
- a_greater_equal = T.dynamic("a")
- b_greater_equal = T.dynamic("b")
- c_greater_equal = T.dynamic("c")
- d_greater_equal = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_greater_equal = T.dynamic("a", "int64")
+ b_greater_equal = T.dynamic("b", "int64")
+ c_greater_equal = T.dynamic("c", "int64")
+ d_greater_equal = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -1532,10 +1532,10 @@ def test_less():
def test_less_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class Less:
@@ -1544,14 +1544,14 @@ def test_less_symbolic():
gv: R.Tensor((a, b, c, d), "bool") = R.less(x, y)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
- a_less = T.dynamic("a")
- b_less = T.dynamic("b")
- c_less = T.dynamic("c")
- d_less = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_less = T.dynamic("a", "int64")
+ b_less = T.dynamic("b", "int64")
+ c_less = T.dynamic("c", "int64")
+ d_less = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -1709,10 +1709,10 @@ def test_less_equal_with_arg1_constant_scalar():
def test_less_equal_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class LessEqual:
@@ -1721,14 +1721,14 @@ def test_less_equal_symbolic():
gv: R.Tensor((a, b, c, d), "bool") = R.less_equal(x, y)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
- a_less_equal = T.dynamic("a")
- b_less_equal = T.dynamic("b")
- c_less_equal = T.dynamic("c")
- d_less_equal = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_less_equal = T.dynamic("a", "int64")
+ b_less_equal = T.dynamic("b", "int64")
+ c_less_equal = T.dynamic("c", "int64")
+ d_less_equal = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -1824,10 +1824,10 @@ def test_not_equal():
def test_not_equal_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class NotEqual:
@@ -1836,14 +1836,14 @@ def test_not_equal_symbolic():
gv: R.Tensor((a, b, c, d), "bool") = R.not_equal(x, y)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
- a_not_equal = T.dynamic("a")
- b_not_equal = T.dynamic("b")
- c_not_equal = T.dynamic("c")
- d_not_equal = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_not_equal = T.dynamic("a", "int64")
+ b_not_equal = T.dynamic("b", "int64")
+ c_not_equal = T.dynamic("c", "int64")
+ d_not_equal = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -2001,10 +2001,10 @@ def test_maximum_with_arg1_constant_scalar():
def test_maximum_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class Maximum:
@@ -2013,14 +2013,14 @@ def test_maximum_symbolic():
gv: R.Tensor((a, b, c, d), "float32") = R.maximum(x, y)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
- a_maximum = T.dynamic("a")
- b_maximum = T.dynamic("b")
- c_maximum = T.dynamic("c")
- d_maximum = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_maximum = T.dynamic("a", "int64")
+ b_maximum = T.dynamic("b", "int64")
+ c_maximum = T.dynamic("c", "int64")
+ d_maximum = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -2178,10 +2178,10 @@ def test_minimum_with_arg1_constant_scalar():
def test_minimum_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class Minimum:
@@ -2190,14 +2190,14 @@ def test_minimum_symbolic():
gv: R.Tensor((a, b, c, d), "float32") = R.minimum(x, y)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
- a_minimum = T.dynamic("a")
- b_minimum = T.dynamic("b")
- c_minimum = T.dynamic("c")
- d_minimum = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_minimum = T.dynamic("a", "int64")
+ b_minimum = T.dynamic("b", "int64")
+ c_minimum = T.dynamic("c", "int64")
+ d_minimum = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_legalize_ops_create_datatype.py b/tests/python/relax/test_transform_legalize_ops_create_datatype.py
index aeb051c413..91aa869f49 100644
--- a/tests/python/relax/test_transform_legalize_ops_create_datatype.py
+++ b/tests/python/relax/test_transform_legalize_ops_create_datatype.py
@@ -121,8 +121,8 @@ def test_full_different_dtype():
def test_full_symbolic():
# fmt: off
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Full:
@@ -131,10 +131,10 @@ def test_full_symbolic():
gv: R.Tensor((m, n), "int32") = R.full((m, n), v, dtype="int32")
return gv
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_full = T.dynamic("m")
- n_full = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_full = T.dynamic("m", "int64")
+ n_full = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -254,8 +254,8 @@ def test_full_like_different_dtype():
def test_full_like_symbolic():
# fmt: off
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class FullLike:
@@ -264,10 +264,10 @@ def test_full_like_symbolic():
gv: R.Tensor((m, n), "int32") = R.full_like(x, v)
return gv
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_full = T.dynamic("m")
- n_full = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_full = T.dynamic("m", "int64")
+ n_full = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -325,8 +325,8 @@ def test_ones():
def test_ones_symbolic():
# fmt: off
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Ones:
@@ -335,10 +335,10 @@ def test_ones_symbolic():
gv: R.Tensor((m, n), "float32") = R.ones((m, n), "float32")
return gv
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_ones = T.dynamic("m")
- n_ones = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_ones = T.dynamic("m", "int64")
+ n_ones = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -396,8 +396,8 @@ def test_ones_like():
def test_ones_like_symbolic():
# fmt: off
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class OnesLike:
@@ -406,10 +406,10 @@ def test_ones_like_symbolic():
gv: R.Tensor((m, n), "float32") = R.ones_like(x)
return gv
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_ones = T.dynamic("m")
- n_ones = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_ones = T.dynamic("m", "int64")
+ n_ones = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -467,8 +467,8 @@ def test_zeros():
def test_zeros_symbolic():
# fmt: off
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Zeros:
@@ -477,10 +477,10 @@ def test_zeros_symbolic():
gv: R.Tensor((m, n), "float32") = R.zeros((m, n), "float32")
return gv
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_zeros = T.dynamic("m")
- n_zeros = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_zeros = T.dynamic("m", "int64")
+ n_zeros = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -538,8 +538,8 @@ def test_zeros_like():
def test_zeros_like_symbolic():
# fmt: off
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class ZerosLike:
@@ -548,10 +548,10 @@ def test_zeros_like_symbolic():
gv: R.Tensor((m, n), "float32") = R.zeros_like(x)
return gv
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_zeros = T.dynamic("m")
- n_zeros = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_zeros = T.dynamic("m", "int64")
+ n_zeros = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -599,7 +599,7 @@ def test_arange_const():
def test_arange_symbolic():
# fmt: off
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Arange:
@@ -608,7 +608,7 @@ def test_arange_symbolic():
gv = R.arange(1, R.prim_value(n), 2)
return gv
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -667,8 +667,8 @@ def test_shape_to_tensor():
def test_shape_to_tensor_symbolic():
# fmt: off
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class ShapeToTensor:
@@ -677,8 +677,8 @@ def test_shape_to_tensor_symbolic():
gv = R.shape_to_tensor(R.shape_of(x))
return gv
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -704,7 +704,7 @@ def test_shape_to_tensor_symbolic():
def test_shape_to_tensor_mixed():
# fmt: off
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class ShapeToTensor:
@@ -713,7 +713,7 @@ def test_shape_to_tensor_mixed():
gv = R.shape_to_tensor(R.shape_of(x))
return gv
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class Expected:
@@ -791,9 +791,9 @@ def test_tril():
def test_tril_symbolic():
# fmt: off
- m = T.dynamic("m")
- n = T.dynamic("n")
- k = T.dynamic("k")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
+ k = T.dynamic("k", "int64")
@tvm.script.ir_module
class Tril:
@@ -802,12 +802,12 @@ def test_tril_symbolic():
gv: R.Tensor((m, n, k), "int8") = R.tril(x, k=-2)
return gv
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- k_main = T.dynamic("k")
- k_tril = T.dynamic("k")
- m_tril = T.dynamic("m")
- n_tril = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ k_main = T.dynamic("k", "int64")
+ k_tril = T.dynamic("k", "int64")
+ m_tril = T.dynamic("m", "int64")
+ n_tril = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -865,9 +865,9 @@ def test_triu():
def test_triu_symbolic():
# fmt: off
- m = T.dynamic("m")
- n = T.dynamic("n")
- k = T.dynamic("k")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
+ k = T.dynamic("k", "int64")
@tvm.script.ir_module
class Triu:
@@ -876,12 +876,12 @@ def test_triu_symbolic():
gv: R.Tensor((m, n, k), "int8") = R.triu(x, k=-2)
return gv
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- k_main = T.dynamic("k")
- k_triu = T.dynamic("k")
- m_triu = T.dynamic("m")
- n_triu = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ k_main = T.dynamic("k", "int64")
+ k_triu = T.dynamic("k", "int64")
+ m_triu = T.dynamic("m", "int64")
+ n_triu = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -963,8 +963,8 @@ def test_astype_input_constant_scalar():
def test_astype_symbolic():
# fmt: off
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Astype:
@@ -973,10 +973,10 @@ def test_astype_symbolic():
gv: R.Tensor((m, n), "int32") = R.astype(x, "int32")
return gv
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_cast = T.dynamic("m")
- n_cast = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_cast = T.dynamic("m", "int64")
+ n_cast = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_legalize_ops_distributed.py b/tests/python/relax/test_transform_legalize_ops_distributed.py
index c47efea2a4..e717738ecc 100644
--- a/tests/python/relax/test_transform_legalize_ops_distributed.py
+++ b/tests/python/relax/test_transform_legalize_ops_distributed.py
@@ -35,7 +35,7 @@ def test_redistribute_replica_to_shard():
gv0 = R.dist.redistribute_replica_to_shard(x, num_workers=2, axis=1)
return gv0
- worker_id = T.dynamic("worker_id")
+ worker_id = T.dynamic("worker_id", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_legalize_ops_grad.py b/tests/python/relax/test_transform_legalize_ops_grad.py
index 3816b4ebc9..36da838931 100644
--- a/tests/python/relax/test_transform_legalize_ops_grad.py
+++ b/tests/python/relax/test_transform_legalize_ops_grad.py
@@ -334,9 +334,9 @@ def test_take_backward():
def test_take_backward_symbolic():
# fmt: off
- m = T.dynamic("m")
- i = T.dynamic("i")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ i = T.dynamic("i", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class TakeBackward:
@@ -345,12 +345,12 @@ def test_take_backward_symbolic():
gv = R.grad.take_backward(output_grad, x, indices, axis=1)
return gv
- m_take_backward = T.dynamic("m")
- i_take_backward = T.dynamic("i")
- n_take_backward = T.dynamic("n")
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- i_main = T.dynamic("i")
+ m_take_backward = T.dynamic("m", "int64")
+ i_take_backward = T.dynamic("i", "int64")
+ n_take_backward = T.dynamic("n", "int64")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ i_main = T.dynamic("i", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_legalize_ops_image.py b/tests/python/relax/test_transform_legalize_ops_image.py
index dde1a6a297..7c94c2d930 100644
--- a/tests/python/relax/test_transform_legalize_ops_image.py
+++ b/tests/python/relax/test_transform_legalize_ops_image.py
@@ -58,12 +58,12 @@ def test_image_resize2d():
def test_image_resize2d_symbolic():
# fmt: off
- n = T.dynamic("n")
- c = T.dynamic("c")
- oh = T.dynamic("oh")
- ow = T.dynamic("ow")
- h = T.dynamic("h")
- w = T.dynamic("w")
+ n = T.dynamic("n", "int64")
+ c = T.dynamic("c", "int64")
+ oh = T.dynamic("oh", "int64")
+ ow = T.dynamic("ow", "int64")
+ h = T.dynamic("h", "int64")
+ w = T.dynamic("w", "int64")
@tvm.script.ir_module
class Resize2D:
@@ -72,18 +72,18 @@ def test_image_resize2d_symbolic():
gv: R.Tensor((n, c, oh, ow, 16), "float32") = R.image.resize2d(x, size=(oh, ow), layout="NCHW16c", method="nearest_neighbor", coordinate_transformation_mode="asymmetric")
return gv
- n_main = T.dynamic("n")
- c_main = T.dynamic("c")
- oh_main = T.dynamic("oh")
- ow_main = T.dynamic("ow")
- h_main = T.dynamic("h")
- w_main = T.dynamic("w")
- c_resize2d = T.dynamic("c")
- h_resize2d = T.dynamic("h")
- n_resize2d = T.dynamic("n")
- oh_resize2d = T.dynamic("oh")
- ow_resize2d = T.dynamic("ow")
- w_resize2d = T.dynamic("w")
+ n_main = T.dynamic("n", "int64")
+ c_main = T.dynamic("c", "int64")
+ oh_main = T.dynamic("oh", "int64")
+ ow_main = T.dynamic("ow", "int64")
+ h_main = T.dynamic("h", "int64")
+ w_main = T.dynamic("w", "int64")
+ c_resize2d = T.dynamic("c", "int64")
+ h_resize2d = T.dynamic("h", "int64")
+ n_resize2d = T.dynamic("n", "int64")
+ oh_resize2d = T.dynamic("oh", "int64")
+ ow_resize2d = T.dynamic("ow", "int64")
+ w_resize2d = T.dynamic("w", "int64")
@tvm.script.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_legalize_ops_index_linear_algebra.py b/tests/python/relax/test_transform_legalize_ops_index_linear_algebra.py
index f7626b651f..ecb89e5d49 100644
--- a/tests/python/relax/test_transform_legalize_ops_index_linear_algebra.py
+++ b/tests/python/relax/test_transform_legalize_ops_index_linear_algebra.py
@@ -123,9 +123,9 @@ def test_take_const_prim_value():
def test_take_symbolic():
# fmt: off
- m = T.dynamic("m")
- i = T.dynamic("i")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ i = T.dynamic("i", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Take:
@@ -134,12 +134,12 @@ def test_take_symbolic():
gv: R.Tensor((m, i), "float32") = R.take(x, indices, axis=1)
return gv
- m_main = T.dynamic("m")
- i_main = T.dynamic("i")
- n_main = T.dynamic("n")
- i_take = T.dynamic("i")
- m_take = T.dynamic("m")
- n_take = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ i_main = T.dynamic("i", "int64")
+ n_main = T.dynamic("n", "int64")
+ i_take = T.dynamic("i", "int64")
+ m_take = T.dynamic("m", "int64")
+ n_take = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -166,7 +166,7 @@ def test_take_symbolic():
def test_take_symbolic_prim_value():
# fmt: off
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Take:
@@ -175,8 +175,8 @@ def test_take_symbolic_prim_value():
gv: R.Tensor((2, 4), "float32") = R.take(x, R.prim_value(n-1), axis=1)
return gv
- n_main = T.dynamic("n")
- n_take = T.dynamic("n")
+ n_main = T.dynamic("n", "int64")
+ n_take = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -297,8 +297,8 @@ def test_strided_slice_negative_axes():
def test_strided_slice_symbolic_sliced_axis():
# fmt: off
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class StridedSlice:
@@ -307,10 +307,10 @@ def test_strided_slice_symbolic_sliced_axis():
gv: R.Tensor((3, n), "float32") = R.strided_slice(x, axes=[0], begin=[1], end=[8], strides=[3], assume_inbound=True)
return gv
- m_strided_slice = T.dynamic("m")
- n_strided_slice = T.dynamic("n")
- n_main = T.dynamic("n")
- m_main = T.dynamic("m")
+ m_strided_slice = T.dynamic("m", "int64")
+ n_strided_slice = T.dynamic("n", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_main = T.dynamic("m", "int64")
@I.ir_module
class Expected:
@@ -339,7 +339,7 @@ def test_strided_slice_symbolic_sliced_axis():
def test_strided_slice_symbolic():
# fmt: off
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class StridedSlice:
@@ -348,8 +348,8 @@ def test_strided_slice_symbolic():
gv: R.Tensor((3, n), "float32") = R.strided_slice(x, axes=[0], begin=[1], end=[8], strides=[3])
return gv
- n_main = T.dynamic("n")
- n_strided_slice = T.dynamic("n")
+ n_main = T.dynamic("n", "int64")
+ n_strided_slice = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -376,7 +376,7 @@ def test_strided_slice_symbolic():
def test_strided_slice_symbolic_bound():
# fmt: off
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class StridedSlice:
@@ -385,8 +385,8 @@ def test_strided_slice_symbolic_bound():
gv: R.Tensor((3, n), "float32") = R.strided_slice(x, axes=[0, 1], begin=[1, 0], end=[8, n], strides=[3, 1])
return gv
- n_main = T.dynamic("n")
- n_strided_slice = T.dynamic("n")
+ n_main = T.dynamic("n", "int64")
+ n_strided_slice = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -409,7 +409,7 @@ def test_strided_slice_symbolic_bound():
def test_strided_slice_non_unit_stride():
# fmt: off
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class StridedSlice:
@@ -418,8 +418,8 @@ def test_strided_slice_non_unit_stride():
gv: R.Tensor((3, n), "float32") = R.strided_slice(x, axes=[0, 1], begin=[1, 0], end=[8, n], strides=[3, 1])
return gv
- n_main = T.dynamic("n")
- n_strided_slice = T.dynamic("n")
+ n_main = T.dynamic("n", "int64")
+ n_strided_slice = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -448,14 +448,14 @@ def test_dynamic_strided_slice():
def main(x: R.Tensor((8, 9, 10, 10), "float32"), begin: R.Tensor((4,),"int64"), end: R.Tensor((4,),"int64"), strides: R.Tensor((4,),"int64")) -> R.Tensor("float32", ndim=4):
gv: R.Tensor("float32", ndim=4) = R.dynamic_strided_slice(x, begin, end, strides)
return gv
- s_dynamic_strided_slice = T.dynamic("s")
- s_1_dynamic_strided_slice = T.dynamic("s_1")
- s_2_dynamic_strided_slice = T.dynamic("s_2")
- s_3_dynamic_strided_slice = T.dynamic("s_3")
- s_main = T.dynamic("s")
- s_1_main = T.dynamic("s_1")
- s_2_main = T.dynamic("s_2")
- s_3_main = T.dynamic("s_3")
+ s_dynamic_strided_slice = T.dynamic("s", "int64")
+ s_1_dynamic_strided_slice = T.dynamic("s_1", "int64")
+ s_2_dynamic_strided_slice = T.dynamic("s_2", "int64")
+ s_3_dynamic_strided_slice = T.dynamic("s_3", "int64")
+ s_main = T.dynamic("s", "int64")
+ s_1_main = T.dynamic("s_1", "int64")
+ s_2_main = T.dynamic("s_2", "int64")
+ s_3_main = T.dynamic("s_3", "int64")
@tvm.script.ir_module
class Expected:
@@ -785,7 +785,7 @@ def test_dynamic_strided_slice():
def test_dynamic_strided_slice_symbolic():
# fmt: off
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class DynamicStridedSlice:
@@ -793,13 +793,13 @@ def test_dynamic_strided_slice_symbolic():
def main(x: R.Tensor((10, n), "float32"), begin:R.Tensor((2,), "int64"), end:R.Tensor((2,), "int64"), strides:R.Tensor((2,), "int64")) -> R.Tensor("float32", ndim=2):
gv: R.Tensor("float32", ndim=2) = R.dynamic_strided_slice(x, begin, end, strides)
return gv
- n_dynamic_strided_slice = T.dynamic("n")
- s_dynamic_strided_slice = T.dynamic("s")
- s_1_dynamic_strided_slice = T.dynamic("s_1")
- n_shape_func = T.dynamic("n")
- n_main = T.dynamic("n")
- s_main = T.dynamic("s")
- s_1_main = T.dynamic("s_1")
+ n_dynamic_strided_slice = T.dynamic("n", "int64")
+ s_dynamic_strided_slice = T.dynamic("s", "int64")
+ s_1_dynamic_strided_slice = T.dynamic("s_1", "int64")
+ n_shape_func = T.dynamic("n", "int64")
+ n_main = T.dynamic("n", "int64")
+ s_main = T.dynamic("s", "int64")
+ s_1_main = T.dynamic("s_1", "int64")
@tvm.script.ir_module
class Expected:
@@ -1144,12 +1144,12 @@ def test_matmul_4_5():
def test_matmul_4_5_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- m = T.dynamic("m")
- n = T.dynamic("n")
- k = T.dynamic("k")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
+ k = T.dynamic("k", "int64")
@tvm.script.ir_module
class Matmul:
@@ -1158,18 +1158,18 @@ def test_matmul_4_5_symbolic():
gv: R.Tensor((a, b, c, m, n), "float32") = R.matmul(x, y)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- k_main = T.dynamic("k")
- a_matmul = T.dynamic("a")
- b_matmul = T.dynamic("b")
- c_matmul = T.dynamic("c")
- k_matmul = T.dynamic("k")
- m_matmul = T.dynamic("m")
- n_matmul = T.dynamic("n")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ k_main = T.dynamic("k", "int64")
+ a_matmul = T.dynamic("a", "int64")
+ b_matmul = T.dynamic("b", "int64")
+ c_matmul = T.dynamic("c", "int64")
+ k_matmul = T.dynamic("k", "int64")
+ m_matmul = T.dynamic("m", "int64")
+ n_matmul = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -1292,9 +1292,9 @@ def test_einsum():
def test_einsum_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
@I.ir_module
class Einsum:
@@ -1303,12 +1303,12 @@ def test_einsum_symbolic():
gv = R.einsum((x, y), subscripts="ij,jk->ik")
return gv
- a_main = T.dynamic("a")
- c_main = T.dynamic("c")
- b_main = T.dynamic("b")
- a_einsum = T.dynamic("a")
- b_einsum = T.dynamic("b")
- c_einsum = T.dynamic("c")
+ a_main = T.dynamic("a", "int64")
+ c_main = T.dynamic("c", "int64")
+ b_main = T.dynamic("b", "int64")
+ a_einsum = T.dynamic("a", "int64")
+ b_einsum = T.dynamic("b", "int64")
+ c_einsum = T.dynamic("c", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_legalize_ops_manipulate.py b/tests/python/relax/test_transform_legalize_ops_manipulate.py
index 8d9bd874b6..ce16a01c7f 100644
--- a/tests/python/relax/test_transform_legalize_ops_manipulate.py
+++ b/tests/python/relax/test_transform_legalize_ops_manipulate.py
@@ -63,10 +63,10 @@ def test_broadcast_to():
def test_broadcast_to_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class BroadcastTo:
@@ -75,14 +75,14 @@ def test_broadcast_to_symbolic():
gv: R.Tensor((a, b, c, d), "float32") = R.broadcast_to(x, (a, b, c, d))
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
- a_broadcast_to = T.dynamic("a")
- b_broadcast_to = T.dynamic("b")
- c_broadcast_to = T.dynamic("c")
- d_broadcast_to = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_broadcast_to = T.dynamic("a", "int64")
+ b_broadcast_to = T.dynamic("b", "int64")
+ c_broadcast_to = T.dynamic("c", "int64")
+ d_broadcast_to = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -173,10 +173,10 @@ def test_concat_input_tuple_var():
def test_concat_input_tuple_var_symbolic():
# fmt: off
- a = T.dynamic("a")
- b0 = T.dynamic("b0")
- b1 = T.dynamic("b1")
- b2 = T.dynamic("b2")
+ a = T.dynamic("a", "int64")
+ b0 = T.dynamic("b0", "int64")
+ b1 = T.dynamic("b1", "int64")
+ b2 = T.dynamic("b2", "int64")
@tvm.script.ir_module
class Concat:
@@ -185,14 +185,14 @@ def test_concat_input_tuple_var_symbolic():
gv: R.Tensor((a, b0 + b1 + b2), "float32") = R.concat(t, axis=1)
return gv
- a_main = T.dynamic("a")
- b0_main = T.dynamic("b0")
- b1_main = T.dynamic("b1")
- b2_main = T.dynamic("b2")
- a_concatenate = T.dynamic("a")
- b0_concatenate = T.dynamic("b0")
- b1_concatenate = T.dynamic("b1")
- b2_concatenate = T.dynamic("b2")
+ a_main = T.dynamic("a", "int64")
+ b0_main = T.dynamic("b0", "int64")
+ b1_main = T.dynamic("b1", "int64")
+ b2_main = T.dynamic("b2", "int64")
+ a_concatenate = T.dynamic("a", "int64")
+ b0_concatenate = T.dynamic("b0", "int64")
+ b1_concatenate = T.dynamic("b1", "int64")
+ b2_concatenate = T.dynamic("b2", "int64")
@tvm.script.ir_module
class Expected:
@@ -253,9 +253,9 @@ def test_expand_dims():
def test_expand_dims_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
@tvm.script.ir_module
class ExpandDims:
@@ -264,12 +264,12 @@ def test_expand_dims_symbolic():
gv: R.Tensor((a, 1, b, 1, c, 1), "float32") = R.expand_dims(x, axis=[1, 3, 5])
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- a_expand_dims = T.dynamic("a")
- b_expand_dims = T.dynamic("b")
- c_expand_dims = T.dynamic("c")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ a_expand_dims = T.dynamic("a", "int64")
+ b_expand_dims = T.dynamic("b", "int64")
+ c_expand_dims = T.dynamic("c", "int64")
@tvm.script.ir_module
class Expected:
@@ -358,9 +358,9 @@ def test_flatten_zero_rank():
def test_flatten_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
@tvm.script.ir_module
class Flatten:
@@ -369,12 +369,12 @@ def test_flatten_symbolic():
gv: R.Tensor((a * b * c,), "float32") = R.flatten(x)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- a_reshape = T.dynamic("a")
- b_reshape = T.dynamic("b")
- c_reshape = T.dynamic("c")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ a_reshape = T.dynamic("a", "int64")
+ b_reshape = T.dynamic("b", "int64")
+ c_reshape = T.dynamic("c", "int64")
@tvm.script.ir_module
class Expected:
@@ -432,10 +432,10 @@ def test_permute_dims():
def test_permute_dims_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class PermuteDims:
@@ -444,14 +444,14 @@ def test_permute_dims_symbolic():
gv: R.Tensor((b, d, c, a), "float32") = R.permute_dims(x, axes=[1, -1, 2, -4])
return gv
- b_main = T.dynamic("b")
- d_main = T.dynamic("d")
- c_main = T.dynamic("c")
- a_main = T.dynamic("a")
- a_transpose = T.dynamic("a")
- b_transpose = T.dynamic("b")
- c_transpose = T.dynamic("c")
- d_transpose = T.dynamic("d")
+ b_main = T.dynamic("b", "int64")
+ d_main = T.dynamic("d", "int64")
+ c_main = T.dynamic("c", "int64")
+ a_main = T.dynamic("a", "int64")
+ a_transpose = T.dynamic("a", "int64")
+ b_transpose = T.dynamic("b", "int64")
+ c_transpose = T.dynamic("c", "int64")
+ d_transpose = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -558,8 +558,8 @@ def test_reshape():
def test_reshape_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
@tvm.script.ir_module
class Reshape:
@@ -568,10 +568,10 @@ def test_reshape_symbolic():
gv: R.Tensor((a // 2, b * 2), "float32") = R.reshape(x, (a // 2, b * 2))
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- a_reshape = T.dynamic("a")
- b_reshape = T.dynamic("b")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ a_reshape = T.dynamic("a", "int64")
+ b_reshape = T.dynamic("b", "int64")
@tvm.script.ir_module
class Expected:
@@ -596,8 +596,8 @@ def test_reshape_symbolic():
tvm.ir.assert_structural_equal(mod, Expected)
# ShapeExpr might be produced by shape computation
- a = T.dynamic("a")
- b = T.dynamic("b")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
@tvm.script.ir_module
class Reshape2:
@@ -608,10 +608,10 @@ def test_reshape_symbolic():
return gv
# After lowering, redundant var might be removed by later dead code elimination
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- a_reshape = T.dynamic("a")
- b_reshape = T.dynamic("b")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ a_reshape = T.dynamic("a", "int64")
+ b_reshape = T.dynamic("b", "int64")
@tvm.script.ir_module
class Expected2:
@@ -653,8 +653,8 @@ def test_reshape_symbolic():
tvm.ir.assert_structural_equal(mod2, Expected2)
# ShapeExpr might be produced by shape computation
- a = T.dynamic("a")
- b = T.dynamic("b")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
@I.ir_module
class Reshape3:
@@ -665,8 +665,8 @@ def test_reshape_symbolic():
return gv
# After lowering, redundant var might be removed by later dead code elimination
- b_reshape = T.dynamic("b")
- b_main = T.dynamic("b")
+ b_reshape = T.dynamic("b", "int64")
+ b_main = T.dynamic("b", "int64")
@I.ir_module
class Expected3:
@@ -726,10 +726,10 @@ def test_data_dependent_reshape():
out_mod = relax.transform.LegalizeOps()(mod)
# fmt: off
- M_main = T.dynamic("M")
- N_main = T.dynamic("N")
- M_reshape = T.dynamic("M")
- N_reshape = T.dynamic("N")
+ M_main = T.dynamic("M", "int64")
+ N_main = T.dynamic("N", "int64")
+ M_reshape = T.dynamic("M", "int64")
+ N_reshape = T.dynamic("N", "int64")
@I.ir_module
class Expected:
@@ -888,8 +888,8 @@ def test_split_by_indices_n_section_divisible():
def test_split_by_indices_n_section_divisible_symbolic():
# fmt: off
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Split:
@@ -898,9 +898,9 @@ def test_split_by_indices_n_section_divisible_symbolic():
gv: R.Tuple([R.Tensor((m, n), "float32"), R.Tensor((m, n), "float32"), R.Tensor((m, n), "float32")]) = R.split(x, 3, axis=1)
return gv
- m_main = T.dynamic("m")
- n = T.dynamic("n")
- m_split = T.dynamic("m")
+ m_main = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
+ m_split = T.dynamic("m", "int64")
@tvm.script.ir_module
class Expected:
@@ -1003,8 +1003,8 @@ def test_squeeze_no_axis():
def test_squeeze_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
@tvm.script.ir_module
class Squeeze:
@@ -1013,10 +1013,10 @@ def test_squeeze_symbolic():
gv: R.Tensor((a, b, 1), "float32") = R.squeeze(x, [1])
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- a_squeeze = T.dynamic("a")
- b_squeeze = T.dynamic("b")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ a_squeeze = T.dynamic("a", "int64")
+ b_squeeze = T.dynamic("b", "int64")
@tvm.script.ir_module
class Expected:
@@ -1198,9 +1198,9 @@ def test_repeat_no_axis():
def test_repeat_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
@I.ir_module
class Repeat:
@@ -1209,12 +1209,12 @@ def test_repeat_symbolic():
gv = R.repeat(x, 2, 0)
return gv
- a_repeat = T.dynamic("a")
- b_repeat = T.dynamic("b")
- c_repeat = T.dynamic("c")
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
+ a_repeat = T.dynamic("a", "int64")
+ b_repeat = T.dynamic("b", "int64")
+ c_repeat = T.dynamic("c", "int64")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
@I.ir_module
class Expected:
@@ -1274,9 +1274,9 @@ def test_tile():
def test_tile_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
@I.ir_module
class Tile:
@@ -1285,12 +1285,12 @@ def test_tile_symbolic():
gv = R.tile(x, (2, 1, 2, 3))
return gv
- a_tile = T.dynamic("a")
- b_tile = T.dynamic("b")
- c_tile = T.dynamic("c")
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
+ a_tile = T.dynamic("a", "int64")
+ b_tile = T.dynamic("b", "int64")
+ c_tile = T.dynamic("c", "int64")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
@I.ir_module
class Expected:
@@ -1355,8 +1355,8 @@ def test_flip():
def test_flip_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
@I.ir_module
class Flip:
@@ -1365,10 +1365,10 @@ def test_flip_symbolic():
gv = R.flip(x, axis=1)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- a_flip = T.dynamic("a")
- b_flip = T.dynamic("b")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ a_flip = T.dynamic("a", "int64")
+ b_flip = T.dynamic("b", "int64")
@I.ir_module
class Expected:
@@ -1545,10 +1545,10 @@ def test_scatter_elements():
def test_scatter_elements_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- m = T.dynamic("m")
- n = T.dynamic("n")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class ScatterElements:
@@ -1556,14 +1556,14 @@ def test_scatter_elements_symbolic():
def main(x: R.Tensor((a, b), "float32"), indices:R.Tensor((m, n), "int64"), updates:R.Tensor((m,n), "float32")):
gv = R.scatter_elements(x, indices, updates, axis=1)
return gv
- a_scatter_elements = T.dynamic("a")
- b_scatter_elements = T.dynamic("b")
- m_scatter_elements = T.dynamic("m")
- n_scatter_elements = T.dynamic("n")
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
+ a_scatter_elements = T.dynamic("a", "int64")
+ b_scatter_elements = T.dynamic("b", "int64")
+ m_scatter_elements = T.dynamic("m", "int64")
+ n_scatter_elements = T.dynamic("n", "int64")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -1742,9 +1742,9 @@ def test_layout_transform_symbolic():
pad_value = 2
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
@I.ir_module
class LayoutTransform:
@@ -1755,12 +1755,12 @@ def test_layout_transform_symbolic():
)
return gv
- a_te_layout_transform_with_pad = T.dynamic("a")
- b_te_layout_transform_with_pad = T.dynamic("b")
- c_te_layout_transform_with_pad = T.dynamic("c")
- a_main = T.dynamic("a")
- c_main = T.dynamic("c")
- b_main = T.dynamic("b")
+ a_te_layout_transform_with_pad = T.dynamic("a", "int64")
+ b_te_layout_transform_with_pad = T.dynamic("b", "int64")
+ c_te_layout_transform_with_pad = T.dynamic("c", "int64")
+ a_main = T.dynamic("a", "int64")
+ c_main = T.dynamic("c", "int64")
+ b_main = T.dynamic("b", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_legalize_ops_nn.py b/tests/python/relax/test_transform_legalize_ops_nn.py
index 39b83a3bb3..8e38f8386b 100644
--- a/tests/python/relax/test_transform_legalize_ops_nn.py
+++ b/tests/python/relax/test_transform_legalize_ops_nn.py
@@ -154,11 +154,11 @@ def test_conv1d_nwc():
def test_conv1d_symbolic():
# fmt: off
- n = T.dynamic("n")
- w = T.dynamic("w")
- f = T.dynamic("f")
- kw = T.dynamic("kw")
- c = T.dynamic("c")
+ n = T.dynamic("n", "int64")
+ w = T.dynamic("w", "int64")
+ f = T.dynamic("f", "int64")
+ kw = T.dynamic("kw", "int64")
+ c = T.dynamic("c", "int64")
@tvm.script.ir_module
class Conv1d:
@@ -167,16 +167,16 @@ def test_conv1d_symbolic():
gv: R.Tensor((n, f, w - kw + 1), "float32") = R.nn.conv1d(x, kernel)
return gv
- n_main = T.dynamic("n")
- f_main = T.dynamic("f")
- w_main = T.dynamic("w")
- kw_main = T.dynamic("kw")
- c_main = T.dynamic("c")
- n_conv1d = T.dynamic("n")
- c_conv1d = T.dynamic("c")
- w_conv1d = T.dynamic("w")
- f_conv1d = T.dynamic("f")
- kw_conv1d = T.dynamic("kw")
+ n_main = T.dynamic("n", "int64")
+ f_main = T.dynamic("f", "int64")
+ w_main = T.dynamic("w", "int64")
+ kw_main = T.dynamic("kw", "int64")
+ c_main = T.dynamic("c", "int64")
+ n_conv1d = T.dynamic("n", "int64")
+ c_conv1d = T.dynamic("c", "int64")
+ w_conv1d = T.dynamic("w", "int64")
+ f_conv1d = T.dynamic("f", "int64")
+ kw_conv1d = T.dynamic("kw", "int64")
@tvm.script.ir_module
class Expected:
@@ -380,13 +380,13 @@ def test_conv2d_nhwc():
def test_conv2d_symbolic():
# fmt: off
- n = T.dynamic("n")
- h = T.dynamic("h")
- w = T.dynamic("w")
- f = T.dynamic("f")
- kh = T.dynamic("kh")
- kw = T.dynamic("kw")
- c = T.dynamic("c")
+ n = T.dynamic("n", "int64")
+ h = T.dynamic("h", "int64")
+ w = T.dynamic("w", "int64")
+ f = T.dynamic("f", "int64")
+ kh = T.dynamic("kh", "int64")
+ kw = T.dynamic("kw", "int64")
+ c = T.dynamic("c", "int64")
@tvm.script.ir_module
class Conv2d:
@@ -395,20 +395,20 @@ def test_conv2d_symbolic():
gv: R.Tensor((n, f, h - kh + 1, w - kw + 1), "float32") = R.nn.conv2d(x, kernel)
return gv
- n_main = T.dynamic("n")
- f_main = T.dynamic("f")
- h_main = T.dynamic("h")
- kh_main = T.dynamic("kh")
- w_main = T.dynamic("w")
- kw_main = T.dynamic("kw")
- c_main = T.dynamic("c")
- c_conv2d = T.dynamic("c")
- f_conv2d = T.dynamic("f")
- h_conv2d = T.dynamic("h")
- kh_conv2d = T.dynamic("kh")
- kw_conv2d = T.dynamic("kw")
- n_conv2d = T.dynamic("n")
- w_conv2d = T.dynamic("w")
+ n_main = T.dynamic("n", "int64")
+ f_main = T.dynamic("f", "int64")
+ h_main = T.dynamic("h", "int64")
+ kh_main = T.dynamic("kh", "int64")
+ w_main = T.dynamic("w", "int64")
+ kw_main = T.dynamic("kw", "int64")
+ c_main = T.dynamic("c", "int64")
+ c_conv2d = T.dynamic("c", "int64")
+ f_conv2d = T.dynamic("f", "int64")
+ h_conv2d = T.dynamic("h", "int64")
+ kh_conv2d = T.dynamic("kh", "int64")
+ kw_conv2d = T.dynamic("kw", "int64")
+ n_conv2d = T.dynamic("n", "int64")
+ w_conv2d = T.dynamic("w", "int64")
@tvm.script.ir_module
class Expected:
@@ -444,10 +444,10 @@ def test_conv2d_symbolic():
def test_conv2d_symbolic_group():
# fmt: off
- n = T.dynamic("n")
- f = T.dynamic("f")
- c = T.dynamic("c")
- c_div_8 = T.dynamic("c_div_8")
+ n = T.dynamic("n", "int64")
+ f = T.dynamic("f", "int64")
+ c = T.dynamic("c", "int64")
+ c_div_8 = T.dynamic("c_div_8", "int64")
@tvm.script.ir_module
class Conv2d:
@@ -456,14 +456,14 @@ def test_conv2d_symbolic_group():
gv: R.Tensor((n, f, 26, 26), "float32") = R.nn.conv2d(x, w, groups=8)
return gv
- n_main = T.dynamic("n")
- f_main = T.dynamic("f")
- c_main = T.dynamic("c")
- c_div_8_main = T.dynamic("c_div_8")
- n_conv2d = T.dynamic("n")
- c_conv2d = T.dynamic("c")
- f_conv2d = T.dynamic("f")
- c_div_8_conv2d = T.dynamic("c_div_8")
+ n_main = T.dynamic("n", "int64")
+ f_main = T.dynamic("f", "int64")
+ c_main = T.dynamic("c", "int64")
+ c_div_8_main = T.dynamic("c_div_8", "int64")
+ n_conv2d = T.dynamic("n", "int64")
+ c_conv2d = T.dynamic("c", "int64")
+ f_conv2d = T.dynamic("f", "int64")
+ c_div_8_conv2d = T.dynamic("c_div_8", "int64")
@tvm.script.ir_module
class Expected:
@@ -717,13 +717,13 @@ def test_conv2d_transpose_with_out_dtype():
def test_conv2d_transpose_symbolic():
# fmt: off
- n = T.dynamic("n")
- c = T.dynamic("c")
- h = T.dynamic("h")
- w = T.dynamic("w")
- f = T.dynamic("f")
- kh = T.dynamic("kh")
- kw = T.dynamic("kw")
+ n = T.dynamic("n", "int64")
+ c = T.dynamic("c", "int64")
+ h = T.dynamic("h", "int64")
+ w = T.dynamic("w", "int64")
+ f = T.dynamic("f", "int64")
+ kh = T.dynamic("kh", "int64")
+ kw = T.dynamic("kw", "int64")
@tvm.script.ir_module
class Conv2dTranspose:
@@ -732,20 +732,20 @@ def test_conv2d_transpose_symbolic():
gv = R.nn.conv2d_transpose(x, kernel, strides=(3, 3))
return gv
- n_main = T.dynamic("n")
- c_main = T.dynamic("c")
- h_main = T.dynamic("h")
- kh_main = T.dynamic("kh")
- w_main = T.dynamic("w")
- kw_main = T.dynamic("kw")
- f_main = T.dynamic("f")
- n_conv2d_transpose = T.dynamic("n")
- c_conv2d_transpose = T.dynamic("c")
- h_conv2d_transpose = T.dynamic("h")
- w_conv2d_transpose = T.dynamic("w")
- f_conv2d_transpose = T.dynamic("f")
- kh_conv2d_transpose = T.dynamic("kh")
- kw_conv2d_transpose = T.dynamic("kw")
+ n_main = T.dynamic("n", "int64")
+ c_main = T.dynamic("c", "int64")
+ h_main = T.dynamic("h", "int64")
+ kh_main = T.dynamic("kh", "int64")
+ w_main = T.dynamic("w", "int64")
+ kw_main = T.dynamic("kw", "int64")
+ f_main = T.dynamic("f", "int64")
+ n_conv2d_transpose = T.dynamic("n", "int64")
+ c_conv2d_transpose = T.dynamic("c", "int64")
+ h_conv2d_transpose = T.dynamic("h", "int64")
+ w_conv2d_transpose = T.dynamic("w", "int64")
+ f_conv2d_transpose = T.dynamic("f", "int64")
+ kh_conv2d_transpose = T.dynamic("kh", "int64")
+ kw_conv2d_transpose = T.dynamic("kw", "int64")
@I.ir_module
class Expected:
@@ -965,12 +965,12 @@ def test_max_pool2d_ceil_mode():
@pytest.mark.skip("TOPI pooling casts every shape value to i32.")
def test_max_pool2d_symbolic():
# fmt: off
- n = T.dynamic("n")
- c = T.dynamic("c")
- h = T.dynamic("h")
- w = T.dynamic("w")
- kh = T.dynamic("kh")
- kw = T.dynamic("kw")
+ n = T.dynamic("n", "int64")
+ c = T.dynamic("c", "int64")
+ h = T.dynamic("h", "int64")
+ w = T.dynamic("w", "int64")
+ kh = T.dynamic("kh", "int64")
+ kw = T.dynamic("kw", "int64")
@tvm.script.ir_module
class MaxPool2D:
@@ -1128,12 +1128,12 @@ def test_avg_pool2d_ceil_mode():
@pytest.mark.skip("TOPI pooling casts every shape value to i32.")
def test_avg_pool2d_symbolic():
# fmt: off
- n = T.dynamic("n")
- c = T.dynamic("c")
- h = T.dynamic("h")
- w = T.dynamic("w")
- kh = T.dynamic("kh")
- kw = T.dynamic("kw")
+ n = T.dynamic("n", "int64")
+ c = T.dynamic("c", "int64")
+ h = T.dynamic("h", "int64")
+ w = T.dynamic("w", "int64")
+ kh = T.dynamic("kh", "int64")
+ kw = T.dynamic("kw", "int64")
@tvm.script.ir_module
class AvgPool2D:
@@ -1233,12 +1233,12 @@ def test_adaptive_avg_pool2d_without_output_size():
@pytest.mark.skip("TOPI pooling casts every shape value to i32.")
def test_adaptive_avg_pool2d_symbolic():
# fmt: off
- n = T.dynamic("n")
- c = T.dynamic("c")
- oh = T.dynamic("oh")
- ow = T.dynamic("ow")
- h = T.dynamic("h")
- w = T.dynamic("w")
+ n = T.dynamic("n", "int64")
+ c = T.dynamic("c", "int64")
+ oh = T.dynamic("oh", "int64")
+ ow = T.dynamic("ow", "int64")
+ h = T.dynamic("h", "int64")
+ w = T.dynamic("w", "int64")
@tvm.script.ir_module
class AdaptiveAvgPool2D:
@@ -1285,8 +1285,8 @@ def test_relu():
def test_relu_symbolic():
# fmt: off
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Relu:
@@ -1295,10 +1295,10 @@ def test_relu_symbolic():
gv: R.Tensor((m, n), "float32") = R.nn.relu(x)
return gv
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_relu = T.dynamic("m")
- n_relu = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_relu = T.dynamic("m", "int64")
+ n_relu = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -1356,8 +1356,8 @@ def test_leakyrelu():
def test_leakyrelu_symbolic():
# fmt: off
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class LeakyRelu:
@@ -1366,10 +1366,10 @@ def test_leakyrelu_symbolic():
gv: R.Tensor((m, n), "float32") = R.nn.leakyrelu(x, 0.03)
return gv
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_leaky_relu = T.dynamic("m")
- n_leaky_relu = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_leaky_relu = T.dynamic("m", "int64")
+ n_leaky_relu = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -1435,7 +1435,7 @@ def test_prelu():
def test_prelu_symbolic():
# fmt: off
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class PRelu:
@@ -1444,8 +1444,8 @@ def test_prelu_symbolic():
gv: R.Tensor((m, 7), "float32") = R.nn.prelu(x, y)
return gv
- m_main = T.dynamic("m")
- m_prelu = T.dynamic("m")
+ m_main = T.dynamic("m", "int64")
+ m_prelu = T.dynamic("m", "int64")
@tvm.script.ir_module
class Expected:
@@ -1539,8 +1539,8 @@ def test_gelu():
def test_gelu_symbolic():
# fmt: off
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Gelu:
@@ -1549,10 +1549,10 @@ def test_gelu_symbolic():
gv: R.Tensor((m, n), "float32") = R.nn.gelu(x)
return gv
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_gelu = T.dynamic("m")
- n_gelu = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_gelu = T.dynamic("m", "int64")
+ n_gelu = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -1693,8 +1693,8 @@ def test_gelu_tanh():
def test_gelu_tanh_symbolic():
# fmt: off
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class GeluTanh:
@@ -1703,10 +1703,10 @@ def test_gelu_tanh_symbolic():
gv: R.Tensor((m, n), "float32") = R.nn.gelu_tanh(x)
return gv
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_gelu_tanh = T.dynamic("m")
- n_gelu_tanh = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_gelu_tanh = T.dynamic("m", "int64")
+ n_gelu_tanh = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -1827,8 +1827,8 @@ def test_silu():
def test_silu_symbolic():
# fmt: off
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Silu:
@@ -1837,10 +1837,10 @@ def test_silu_symbolic():
gv: R.Tensor((m, n), "float32") = R.nn.silu(x)
return gv
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_silu = T.dynamic("m")
- n_silu = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_silu = T.dynamic("m", "int64")
+ n_silu = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -1931,9 +1931,9 @@ def test_softmax():
def test_softmax_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
@tvm.script.ir_module
class Softmax:
@@ -1942,12 +1942,12 @@ def test_softmax_symbolic():
gv: R.Tensor((a, b, c), "float32") = R.nn.softmax(x)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- a_softmax = T.dynamic("a")
- b_softmax = T.dynamic("b")
- c_softmax = T.dynamic("c")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ a_softmax = T.dynamic("a", "int64")
+ b_softmax = T.dynamic("b", "int64")
+ c_softmax = T.dynamic("c", "int64")
@tvm.script.ir_module
class Expected:
@@ -2050,9 +2050,9 @@ def test_log_softmax():
def test_log_softmax_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
@tvm.script.ir_module
class LogSoftmax:
@@ -2061,12 +2061,12 @@ def test_log_softmax_symbolic():
gv: R.Tensor((a, b, c), "float32") = R.nn.log_softmax(x)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- a_log_softmax = T.dynamic("a")
- b_log_softmax = T.dynamic("b")
- c_log_softmax = T.dynamic("c")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ a_log_softmax = T.dynamic("a", "int64")
+ b_log_softmax = T.dynamic("b", "int64")
+ c_log_softmax = T.dynamic("c", "int64")
@tvm.script.ir_module
class Expected:
@@ -2211,8 +2211,8 @@ def test_cross_entropy_with_logits_batch():
def test_cross_entropy_with_logits_batch_symbolic():
# fmt: off
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class CrossEntropyWithLogits:
@@ -2221,10 +2221,10 @@ def test_cross_entropy_with_logits_batch_symbolic():
gv: R.Tensor((), "float32") = R.nn.cross_entropy_with_logits(x, y)
return gv
- n_main = T.dynamic("n")
- m_main = T.dynamic("m")
- m_cross_entropy_with_logits = T.dynamic("m")
- n_cross_entropy_with_logits = T.dynamic("n")
+ n_main = T.dynamic("n", "int64")
+ m_main = T.dynamic("m", "int64")
+ m_cross_entropy_with_logits = T.dynamic("m", "int64")
+ n_cross_entropy_with_logits = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -2554,10 +2554,10 @@ def test_batch_norm():
def test_batch_norm_symbolic():
# fmt: off
- n = T.dynamic("n")
- h = T.dynamic("h")
- w = T.dynamic("w")
- c = T.dynamic("c")
+ n = T.dynamic("n", "int64")
+ h = T.dynamic("h", "int64")
+ w = T.dynamic("w", "int64")
+ c = T.dynamic("c", "int64")
@tvm.script.ir_module
class BatchNorm:
@@ -2566,14 +2566,14 @@ def test_batch_norm_symbolic():
gv: R.Tuple(R.Tensor((n, h, w, c), "float32"), R.Tensor((c,), "float32"), R.Tensor((c,), "float32")) = R.nn.batch_norm(x, gamma, beta, moving_mean, moving_var, axis=1)
return gv
- n_batch_norm = T.dynamic("n")
- h_batch_norm = T.dynamic("h")
- w_batch_norm = T.dynamic("w")
- c_batch_norm = T.dynamic("c")
- n_main = T.dynamic("n")
- h_main = T.dynamic("h")
- w_main = T.dynamic("w")
- c_main = T.dynamic("c")
+ n_batch_norm = T.dynamic("n", "int64")
+ h_batch_norm = T.dynamic("h", "int64")
+ w_batch_norm = T.dynamic("w", "int64")
+ c_batch_norm = T.dynamic("c", "int64")
+ n_main = T.dynamic("n", "int64")
+ h_main = T.dynamic("h", "int64")
+ w_main = T.dynamic("w", "int64")
+ c_main = T.dynamic("c", "int64")
@tvm.script.ir_module
class Expected:
@@ -3030,9 +3030,9 @@ def test_layer_norm_fp16():
def test_layer_norm_symbolic():
# fmt: off
- n = T.dynamic("n")
- s = T.dynamic("s")
- f = T.dynamic("f")
+ n = T.dynamic("n", "int64")
+ s = T.dynamic("s", "int64")
+ f = T.dynamic("f", "int64")
@tvm.script.ir_module
class LayerNorm:
@@ -3041,12 +3041,12 @@ def test_layer_norm_symbolic():
gv: R.Tensor((n, s, f), "float32") = R.nn.layer_norm(x, gamma, beta, axes=[1, 2])
return gv
- n_main = T.dynamic("n")
- s_main = T.dynamic("s")
- f_main = T.dynamic("f")
- n_layer_norm = T.dynamic("n")
- s_layer_norm = T.dynamic("s")
- f_layer_norm = T.dynamic("f")
+ n_main = T.dynamic("n", "int64")
+ s_main = T.dynamic("s", "int64")
+ f_main = T.dynamic("f", "int64")
+ n_layer_norm = T.dynamic("n", "int64")
+ s_layer_norm = T.dynamic("s", "int64")
+ f_layer_norm = T.dynamic("f", "int64")
@tvm.script.ir_module
class Expected:
@@ -3251,10 +3251,10 @@ def test_group_norm_fp16():
def test_group_norm_symbolic():
# fmt: off
- n = T.dynamic("n")
- c = T.dynamic("c")
- h = T.dynamic("h")
- w = T.dynamic("w")
+ n = T.dynamic("n", "int64")
+ c = T.dynamic("c", "int64")
+ h = T.dynamic("h", "int64")
+ w = T.dynamic("w", "int64")
@tvm.script.ir_module
class GroupNorm:
@@ -3263,13 +3263,13 @@ def test_group_norm_symbolic():
gv: R.Tensor((n, 4 * c, h, w), "float32") = R.nn.group_norm(x, gamma, beta, num_groups=4, channel_axis=1, axes=[2, 3])
return gv
- n_group_norm = T.dynamic("n")
- h_group_norm = T.dynamic("h")
- w_group_norm = T.dynamic("w")
- n_main = T.dynamic("n")
- c = T.dynamic("c")
- h_main = T.dynamic("h")
- w_main = T.dynamic("w")
+ n_group_norm = T.dynamic("n", "int64")
+ h_group_norm = T.dynamic("h", "int64")
+ w_group_norm = T.dynamic("w", "int64")
+ n_main = T.dynamic("n", "int64")
+ c = T.dynamic("c", "int64")
+ h_main = T.dynamic("h", "int64")
+ w_main = T.dynamic("w", "int64")
@tvm.script.ir_module
class Expected:
@@ -3492,9 +3492,9 @@ def test_rms_norm_fp16():
def test_rms_norm_symbolic():
# fmt: off
- n = T.dynamic("n")
- s = T.dynamic("s")
- f = T.dynamic("f")
+ n = T.dynamic("n", "int64")
+ s = T.dynamic("s", "int64")
+ f = T.dynamic("f", "int64")
@tvm.script.ir_module
class RMSNorm:
@@ -3503,12 +3503,12 @@ def test_rms_norm_symbolic():
gv: R.Tensor((n, s, f), "float32") = R.nn.rms_norm(x, weight, axes=[1, 2])
return gv
- n_rms_norm = T.dynamic("n")
- s_rms_norm = T.dynamic("s")
- f_rms_norm = T.dynamic("f")
- n_main = T.dynamic("n")
- s_main = T.dynamic("s")
- f_main = T.dynamic("f")
+ n_rms_norm = T.dynamic("n", "int64")
+ s_rms_norm = T.dynamic("s", "int64")
+ f_rms_norm = T.dynamic("f", "int64")
+ n_main = T.dynamic("n", "int64")
+ s_main = T.dynamic("s", "int64")
+ f_main = T.dynamic("f", "int64")
@tvm.script.ir_module
class Expected:
@@ -3844,8 +3844,8 @@ def test_dynamic_attention():
legalization.
"""
- seq_len = T.dynamic("seq_len")
- seq_len_kv = T.dynamic("seq_len_kv")
+ seq_len = T.dynamic("seq_len", "int64")
+ seq_len_kv = T.dynamic("seq_len_kv", "int64")
@tvm.script.ir_module
class Attention:
@@ -3870,7 +3870,7 @@ def test_dynamic_batch_attention():
fix https://github.com/apache/tvm/issues/19696
"""
- batch_size = T.dynamic("batch_size")
+ batch_size = T.dynamic("batch_size", "int64")
@tvm.script.ir_module
class Attention:
@@ -3885,7 +3885,7 @@ def test_dynamic_batch_attention():
LegalizeOps()(Attention)
- batch_size = T.dynamic("batch_size")
+ batch_size = T.dynamic("batch_size", "int64")
@tvm.script.ir_module
class AttentionBias:
@@ -4056,7 +4056,7 @@ def test_nll_no_weight():
def test_nll_no_batch():
# fmt: off
- C = T.dynamic("C")
+ C = T.dynamic("C", "int64")
@tvm.script.ir_module
class NLLLoss:
@@ -4065,8 +4065,8 @@ def test_nll_no_batch():
gv = R.nn.nll_loss(predictions, targets, weights, reduction="mean", ignore_index=1)
return gv
- C_main = T.dynamic("C")
- C_nll_loss = T.dynamic("C")
+ C_main = T.dynamic("C", "int64")
+ C_nll_loss = T.dynamic("C", "int64")
@tvm.script.ir_module
class Expected:
@@ -4105,10 +4105,10 @@ def test_nll_no_batch():
def test_nll_loss_symbolic():
# fmt: off
- N = T.dynamic("N")
- C = T.dynamic("C")
- d1 = T.dynamic("d1")
- d2 = T.dynamic("d2")
+ N = T.dynamic("N", "int64")
+ C = T.dynamic("C", "int64")
+ d1 = T.dynamic("d1", "int64")
+ d2 = T.dynamic("d2", "int64")
@tvm.script.ir_module
class NLLLoss:
@@ -4117,14 +4117,14 @@ def test_nll_loss_symbolic():
gv: R.Tensor((), "float32") = R.nn.nll_loss(predictions, targets, weights, reduction="mean", ignore_index=-1)
return gv
- N_main = T.dynamic("N")
- C_main = T.dynamic("C")
- d1_main = T.dynamic("d1")
- d2_main = T.dynamic("d2")
- C_nll_loss = T.dynamic("C")
- N_nll_loss = T.dynamic("N")
- d1_nll_loss = T.dynamic("d1")
- d2_nll_loss = T.dynamic("d2")
+ N_main = T.dynamic("N", "int64")
+ C_main = T.dynamic("C", "int64")
+ d1_main = T.dynamic("d1", "int64")
+ d2_main = T.dynamic("d2", "int64")
+ C_nll_loss = T.dynamic("C", "int64")
+ N_nll_loss = T.dynamic("N", "int64")
+ d1_nll_loss = T.dynamic("d1", "int64")
+ d2_nll_loss = T.dynamic("d2", "int64")
@tvm.script.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_legalize_ops_qdq.py b/tests/python/relax/test_transform_legalize_ops_qdq.py
index 51e133ff6e..8cff36c708 100644
--- a/tests/python/relax/test_transform_legalize_ops_qdq.py
+++ b/tests/python/relax/test_transform_legalize_ops_qdq.py
@@ -132,7 +132,7 @@ def test_quantize_fp16_to_uint8():
def test_quantize_fp32_to_int8_symbolic():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Quantize:
@@ -145,8 +145,8 @@ def test_quantize_fp32_to_int8_symbolic():
out = R.quantize(data, scale, zp, axis=-1, out_dtype="int8")
return out
- n_quantize = T.dynamic("n")
- n_main = T.dynamic("n")
+ n_quantize = T.dynamic("n", "int64")
+ n_main = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -421,7 +421,7 @@ def test_dequantize_int8_to_fp32_scalar_param():
def test_dequantize_int8_to_fp32_symbolic():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Dequantize:
@@ -434,8 +434,8 @@ def test_dequantize_int8_to_fp32_symbolic():
out = R.dequantize(data, scale, zp, axis=-1, out_dtype="float32")
return out
- n_dequantize = T.dynamic("n")
- n_main = T.dynamic("n")
+ n_dequantize = T.dynamic("n", "int64")
+ n_main = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_legalize_ops_search_statistical.py b/tests/python/relax/test_transform_legalize_ops_search_statistical.py
index 9f5606509f..47b52a1980 100644
--- a/tests/python/relax/test_transform_legalize_ops_search_statistical.py
+++ b/tests/python/relax/test_transform_legalize_ops_search_statistical.py
@@ -61,9 +61,9 @@ def test_where():
def test_where_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
@tvm.script.ir_module
class Where:
@@ -72,12 +72,12 @@ def test_where_symbolic():
gv: R.Tensor((a, b, c), "float32") = R.where(condition, x, y)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- a_where = T.dynamic("a")
- b_where = T.dynamic("b")
- c_where = T.dynamic("c")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ a_where = T.dynamic("a", "int64")
+ b_where = T.dynamic("b", "int64")
+ c_where = T.dynamic("c", "int64")
@tvm.script.ir_module
class Expected:
@@ -149,10 +149,10 @@ def test_argmax():
def test_argmax_symbolic():
# fmt: off
- a = T.dynamic("a")
- c = T.dynamic("c")
- d = T.dynamic("d")
- b = T.dynamic("b")
+ a = T.dynamic("a", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
+ b = T.dynamic("b", "int64")
@tvm.script.ir_module
class Argmax:
@@ -161,14 +161,14 @@ def test_argmax_symbolic():
gv: R.Tensor((a, 1, c, d), "int64") = R.argmax(x, axis=1, keepdims=True)
return gv
- a_main = T.dynamic("a")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
- b_main = T.dynamic("b")
- a_argmax = T.dynamic("a")
- b_argmax = T.dynamic("b")
- c_argmax = T.dynamic("c")
- d_argmax = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
+ b_main = T.dynamic("b", "int64")
+ a_argmax = T.dynamic("a", "int64")
+ b_argmax = T.dynamic("b", "int64")
+ c_argmax = T.dynamic("c", "int64")
+ d_argmax = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -254,10 +254,10 @@ def test_argmin():
def test_argmin_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class Argmin:
@@ -266,14 +266,14 @@ def test_argmin_symbolic():
gv: R.Tensor((1, 1, 1, 1), "int64") = R.argmin(x, keepdims=True)
return gv
- a_argmin = T.dynamic("a")
- b_argmin = T.dynamic("b")
- c_argmin = T.dynamic("c")
- d_argmin = T.dynamic("d")
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
+ a_argmin = T.dynamic("a", "int64")
+ b_argmin = T.dynamic("b", "int64")
+ c_argmin = T.dynamic("c", "int64")
+ d_argmin = T.dynamic("d", "int64")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -350,10 +350,10 @@ def test_max():
def test_max_symbolic():
# fmt: off
- a = T.dynamic("a")
- d = T.dynamic("d")
- b = T.dynamic("b")
- c = T.dynamic("c")
+ a = T.dynamic("a", "int64")
+ d = T.dynamic("d", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
@tvm.script.ir_module
class Max:
@@ -362,14 +362,14 @@ def test_max_symbolic():
gv: R.Tensor((a, d), "float32") = R.max(x, axis=[1, 2])
return gv
- a_main = T.dynamic("a")
- d_main = T.dynamic("d")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- a_max = T.dynamic("a")
- b_max = T.dynamic("b")
- c_max = T.dynamic("c")
- d_max = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ d_main = T.dynamic("d", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ a_max = T.dynamic("a", "int64")
+ b_max = T.dynamic("b", "int64")
+ c_max = T.dynamic("c", "int64")
+ d_max = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -431,10 +431,10 @@ def test_min():
def test_min_symbolic():
# fmt: off
- a = T.dynamic("a")
- d = T.dynamic("d")
- b = T.dynamic("b")
- c = T.dynamic("c")
+ a = T.dynamic("a", "int64")
+ d = T.dynamic("d", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
@tvm.script.ir_module
class Min:
@@ -443,14 +443,14 @@ def test_min_symbolic():
gv: R.Tensor((a, 1, 1, d), "float32") = R.min(x, axis=[1, 2], keepdims=True)
return gv
- a_main = T.dynamic("a")
- d_main = T.dynamic("d")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- a_min = T.dynamic("a")
- b_min = T.dynamic("b")
- c_min = T.dynamic("c")
- d_min = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ d_main = T.dynamic("d", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ a_min = T.dynamic("a", "int64")
+ b_min = T.dynamic("b", "int64")
+ c_min = T.dynamic("c", "int64")
+ d_min = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -512,10 +512,10 @@ def test_sum():
def test_sum_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class Sum:
@@ -524,14 +524,14 @@ def test_sum_symbolic():
gv: R.Tensor((), "float32") = R.sum(x)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
- a_sum = T.dynamic("a")
- b_sum = T.dynamic("b")
- c_sum = T.dynamic("c")
- d_sum = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_sum = T.dynamic("a", "int64")
+ b_sum = T.dynamic("b", "int64")
+ c_sum = T.dynamic("c", "int64")
+ d_sum = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -626,10 +626,10 @@ def test_prod_bool():
def test_prod_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class Prod:
@@ -638,14 +638,14 @@ def test_prod_symbolic():
gv: R.Tensor((1, 1, 1, 1), "float32") = R.prod(x, keepdims=True)
return gv
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
- a_prod = T.dynamic("a")
- b_prod = T.dynamic("b")
- c_prod = T.dynamic("c")
- d_prod = T.dynamic("d")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_prod = T.dynamic("a", "int64")
+ b_prod = T.dynamic("b", "int64")
+ c_prod = T.dynamic("c", "int64")
+ d_prod = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -778,10 +778,10 @@ def test_mean():
def test_mean_symbolic():
# fmt: off
- b = T.dynamic("b")
- c = T.dynamic("c")
- a = T.dynamic("a")
- d = T.dynamic("d")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ a = T.dynamic("a", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class Mean:
@@ -790,14 +790,14 @@ def test_mean_symbolic():
gv: R.Tensor((b, c), "float32") = R.mean(x, [0, 3])
return gv
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- a_main = T.dynamic("a")
- d_main = T.dynamic("d")
- a_mean = T.dynamic("a")
- b_mean = T.dynamic("b")
- c_mean = T.dynamic("c")
- d_mean = T.dynamic("d")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ a_main = T.dynamic("a", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_mean = T.dynamic("a", "int64")
+ b_mean = T.dynamic("b", "int64")
+ c_mean = T.dynamic("c", "int64")
+ d_mean = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
@@ -988,10 +988,10 @@ def test_std():
def test_std_symbolic():
# fmt: off
- a = T.dynamic("a")
- b = T.dynamic("b")
- c = T.dynamic("c")
- d = T.dynamic("d")
+ a = T.dynamic("a", "int64")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class Std:
@@ -1000,14 +1000,14 @@ def test_std_symbolic():
gv: R.Tensor((), "float32") = R.std(x)
return gv
- a_std = T.dynamic("a")
- b_std = T.dynamic("b")
- c_std = T.dynamic("c")
- d_std = T.dynamic("d")
- a_main = T.dynamic("a")
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- d_main = T.dynamic("d")
+ a_std = T.dynamic("a", "int64")
+ b_std = T.dynamic("b", "int64")
+ c_std = T.dynamic("c", "int64")
+ d_std = T.dynamic("d", "int64")
+ a_main = T.dynamic("a", "int64")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ d_main = T.dynamic("d", "int64")
@I.ir_module
class Expected:
@@ -1150,10 +1150,10 @@ def test_variance():
def test_variance_symbolic():
# fmt: off
- b = T.dynamic("b")
- c = T.dynamic("c")
- a = T.dynamic("a")
- d = T.dynamic("d")
+ b = T.dynamic("b", "int64")
+ c = T.dynamic("c", "int64")
+ a = T.dynamic("a", "int64")
+ d = T.dynamic("d", "int64")
@tvm.script.ir_module
class Variance:
@@ -1162,14 +1162,14 @@ def test_variance_symbolic():
gv: R.Tensor((1, b, c, 1), "float32") = R.variance(x, [0, 3], keepdims=True)
return gv
- b_main = T.dynamic("b")
- c_main = T.dynamic("c")
- a_main = T.dynamic("a")
- d_main = T.dynamic("d")
- a_variance = T.dynamic("a")
- b_variance = T.dynamic("b")
- c_variance = T.dynamic("c")
- d_variance = T.dynamic("d")
+ b_main = T.dynamic("b", "int64")
+ c_main = T.dynamic("c", "int64")
+ a_main = T.dynamic("a", "int64")
+ d_main = T.dynamic("d", "int64")
+ a_variance = T.dynamic("a", "int64")
+ b_variance = T.dynamic("b", "int64")
+ c_variance = T.dynamic("c", "int64")
+ d_variance = T.dynamic("d", "int64")
@tvm.script.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_legalize_ops_unary.py b/tests/python/relax/test_transform_legalize_ops_unary.py
index fd5de13809..b0d04b18d5 100644
--- a/tests/python/relax/test_transform_legalize_ops_unary.py
+++ b/tests/python/relax/test_transform_legalize_ops_unary.py
@@ -52,8 +52,8 @@ def _test_static_shape(name: str, relax_op: Callable, te_func: Callable, dtype:
def _test_symbolic_shape(name: str, relax_op: Callable, te_func: Callable, dtype: str):
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Before:
@@ -63,8 +63,8 @@ def _test_symbolic_shape(name: str, relax_op: Callable, te_func: Callable, dtype
gv = relax_op(x)
return gv
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_lift_transform_params.py b/tests/python/relax/test_transform_lift_transform_params.py
index ae6d5f4a0d..2ddbf670ac 100644
--- a/tests/python/relax/test_transform_lift_transform_params.py
+++ b/tests/python/relax/test_transform_lift_transform_params.py
@@ -1402,7 +1402,7 @@ def test_stop_lifting():
def test_symbolic_var_1():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Before:
@@ -1413,7 +1413,7 @@ def test_symbolic_var_1():
zeros = R.zeros((n, n), "float32")
return shape
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -1438,8 +1438,8 @@ def test_symbolic_var_1():
def test_symbolic_var_2():
- n_zeros = T.dynamic("n")
- n_main = T.dynamic("n")
+ n_zeros = T.dynamic("n", "int64")
+ n_main = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -1465,8 +1465,8 @@ def test_symbolic_var_2():
R.output()
return shape
- n_zeros = T.dynamic("n")
- n_main = T.dynamic("n")
+ n_zeros = T.dynamic("n", "int64")
+ n_main = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -1504,7 +1504,7 @@ def test_symbolic_var_2():
def test_symbolic_var_from_shape():
- slice_index = T.dynamic("slice_index")
+ slice_index = T.dynamic("slice_index", "int64")
@I.ir_module
class Before:
@@ -1543,8 +1543,8 @@ def test_symbolic_var_from_shape():
vj = Ts.axis.remap("S", [j])
Output_Slice[vj] = Input_2d[slice_index, vj]
- slice_index_main = T.dynamic("slice_index")
- slice_index_main_transform_params = T.dynamic("slice_index")
+ slice_index_main = T.dynamic("slice_index", "int64")
+ slice_index_main_transform_params = T.dynamic("slice_index", "int64")
@I.ir_module
class Expected:
@@ -1604,8 +1604,8 @@ def test_symbolic_var_from_shape():
def test_symbolic_var_in_param_shape():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Before:
@@ -1626,9 +1626,9 @@ def test_symbolic_var_in_param_shape():
R.output(conv2)
return conv2
- m_main_transform_params = T.dynamic("m")
- n = T.dynamic("n")
- m_main = T.dynamic("m")
+ m_main_transform_params = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
+ m_main = T.dynamic("m", "int64")
@I.ir_module
class Expected:
@@ -1708,8 +1708,8 @@ def test_symbolic_var_defined_in_params_but_used_in_weights():
not variable definitions.
"""
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Before:
@@ -1726,9 +1726,9 @@ def test_symbolic_var_defined_in_params_but_used_in_weights():
R.output(output)
return output
- k = T.dynamic("k")
- m = T.dynamic("m")
- n = T.dynamic("n")
+ k = T.dynamic("k", "int64")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -1819,8 +1819,8 @@ def test_only_lift_when_variable_uses_constants():
def test_lift_transform_is_idempotent(shared_transform):
"""Multiple applicates of LiftTransformParams are allowed"""
- batch_size = T.dynamic("batch_size")
- lora_rank = T.dynamic("lora_rank")
+ batch_size = T.dynamic("batch_size", "int64")
+ lora_rank = T.dynamic("lora_rank", "int64")
@I.ir_module
class Module:
@@ -1851,9 +1851,9 @@ def test_lift_transform_when_one_already_exists():
"""If the module already contains `transform_params`, the
functions are composed together"""
- batch_size = T.dynamic("batch_size")
- lora_rank_main = T.dynamic("lora_rank")
- lora_rank_main_transform_params = T.dynamic("lora_rank")
+ batch_size = T.dynamic("batch_size", "int64")
+ lora_rank_main = T.dynamic("lora_rank", "int64")
+ lora_rank_main_transform_params = T.dynamic("lora_rank", "int64")
@I.ir_module
class Module:
diff --git a/tests/python/relax/test_transform_lower_gpu_ipc_alloc_storage.py b/tests/python/relax/test_transform_lower_gpu_ipc_alloc_storage.py
index 45c99848b6..afe5e762e2 100644
--- a/tests/python/relax/test_transform_lower_gpu_ipc_alloc_storage.py
+++ b/tests/python/relax/test_transform_lower_gpu_ipc_alloc_storage.py
@@ -24,8 +24,8 @@ from tvm.script import tirx as T
def test_alloc_storage():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Module:
@@ -39,8 +39,8 @@ def test_alloc_storage():
)
return alloc
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -62,8 +62,8 @@ def test_alloc_storage():
def test_builtin_alloc_tensor():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Module:
@@ -74,8 +74,8 @@ def test_builtin_alloc_tensor():
)
return tensor
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_normalize.py b/tests/python/relax/test_transform_normalize.py
index e6ce22597e..be9809fb1c 100644
--- a/tests/python/relax/test_transform_normalize.py
+++ b/tests/python/relax/test_transform_normalize.py
@@ -119,8 +119,8 @@ def test_normalize_no_op():
after_mod = relax.transform.Normalize()(before_mod)
assert_structural_equal(before_mod, after_mod, map_free_vars=True)
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class ANFMod2:
diff --git a/tests/python/relax/test_transform_remove_unused_parameters.py b/tests/python/relax/test_transform_remove_unused_parameters.py
index 3334354264..116fed4838 100644
--- a/tests/python/relax/test_transform_remove_unused_parameters.py
+++ b/tests/python/relax/test_transform_remove_unused_parameters.py
@@ -68,10 +68,10 @@ def test_replace_symbolic_variables():
parameter, which actually *defines* the variable.
"""
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_func = T.dynamic("m")
- n_func = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_func = T.dynamic("m", "int64")
+ n_func = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -83,10 +83,10 @@ def test_replace_symbolic_variables():
def func(A: R.Tensor([m_func, n_func], "float32")) -> R.Tensor([m_func, n_func], "float32"):
return R.zeros(R.shape([m_func, n_func]), dtype="float32")
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_func = T.dynamic("m")
- n_func = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_func = T.dynamic("m", "int64")
+ n_func = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -115,10 +115,10 @@ def test_no_extra_symbolic_variables():
distinct parameter.
"""
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_func = T.dynamic("m")
- n_func = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_func = T.dynamic("m", "int64")
+ n_func = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -145,10 +145,10 @@ def test_remove_extra_prim_parameters():
dtype-only scalar parameters are unused by the private function.
"""
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_func = T.dynamic("m")
- n_func = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_func = T.dynamic("m", "int64")
+ n_func = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -166,10 +166,10 @@ def test_remove_extra_prim_parameters():
out = R.add(A, zeros)
return out
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_func = T.dynamic("m")
- n_func = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_func = T.dynamic("m", "int64")
+ n_func = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -195,10 +195,10 @@ def test_remove_extra_shape_variables():
different parameter, then the `R.Shape` parameter can be removed.
"""
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_func = T.dynamic("m")
- n_func = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_func = T.dynamic("m", "int64")
+ n_func = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -215,10 +215,10 @@ def test_remove_extra_shape_variables():
out = R.add(A, zeros)
return out
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
- m_func = T.dynamic("m")
- n_func = T.dynamic("n")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
+ m_func = T.dynamic("m", "int64")
+ n_func = T.dynamic("n", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_reorder_take_after_matmul.py b/tests/python/relax/test_transform_reorder_take_after_matmul.py
index cc9c529dea..89cff13a68 100644
--- a/tests/python/relax/test_transform_reorder_take_after_matmul.py
+++ b/tests/python/relax/test_transform_reorder_take_after_matmul.py
@@ -38,8 +38,8 @@ class Base:
tvm.ir.assert_structural_equal(self.Expected, after)
-weight_table_size_before = T.dynamic("weight_table_size")
-weight_table_size_expected = T.dynamic("weight_table_size")
+weight_table_size_before = T.dynamic("weight_table_size", "int64")
+weight_table_size_expected = T.dynamic("weight_table_size", "int64")
class TestSimple(Base):
@@ -74,10 +74,10 @@ class TestSimple(Base):
return out
-batch_size_before = T.dynamic("batch_size")
-weight_table_size_before = T.dynamic("weight_table_size")
-batch_size_expected = T.dynamic("batch_size")
-weight_table_size_expected = T.dynamic("weight_table_size")
+batch_size_before = T.dynamic("batch_size", "int64")
+weight_table_size_before = T.dynamic("weight_table_size", "int64")
+batch_size_expected = T.dynamic("batch_size", "int64")
+weight_table_size_expected = T.dynamic("weight_table_size", "int64")
class TestBatchedActivations(Base):
@@ -114,10 +114,10 @@ class TestBatchedActivations(Base):
return out
-batch_size_before = T.dynamic("batch_size")
-routing_table_size_before = T.dynamic("routing_table_size")
-batch_size_expected = T.dynamic("batch_size")
-routing_table_size_expected = T.dynamic("routing_table_size")
+batch_size_before = T.dynamic("batch_size", "int64")
+routing_table_size_before = T.dynamic("routing_table_size", "int64")
+batch_size_expected = T.dynamic("batch_size", "int64")
+routing_table_size_expected = T.dynamic("routing_table_size", "int64")
class TestStaticBatchedActivationsAndWeights(Base):
@@ -156,10 +156,10 @@ class TestStaticBatchedActivationsAndWeights(Base):
return out
-batch_size_before = T.dynamic("batch_size")
-routing_table_size_before = T.dynamic("routing_table_size")
-batch_size_expected = T.dynamic("batch_size")
-routing_table_size_expected = T.dynamic("routing_table_size")
+batch_size_before = T.dynamic("batch_size", "int64")
+routing_table_size_before = T.dynamic("routing_table_size", "int64")
+batch_size_expected = T.dynamic("batch_size", "int64")
+routing_table_size_expected = T.dynamic("routing_table_size", "int64")
class TestDynamicBatchedActivationsAndWeights(Base):
diff --git a/tests/python/relax/test_transform_rewrite_cuda_graph.py b/tests/python/relax/test_transform_rewrite_cuda_graph.py
index 2ff3dd794f..27b4ae0d2b 100644
--- a/tests/python/relax/test_transform_rewrite_cuda_graph.py
+++ b/tests/python/relax/test_transform_rewrite_cuda_graph.py
@@ -759,8 +759,8 @@ def test_static_args():
def test_dynamic_capture():
- m_add_one = T.dynamic("m")
- m_main = T.dynamic("m")
+ m_add_one = T.dynamic("m", "int64")
+ m_main = T.dynamic("m", "int64")
@I.ir_module
class Before:
@@ -796,9 +796,9 @@ def test_dynamic_capture():
_ = R.call_tir_packed(Before.add_one, (alloc2, alloc3))
return alloc3
- m_add_one = T.dynamic("m")
- m_main_cuda_graph_capture = T.dynamic("m")
- m_main = T.dynamic("m")
+ m_add_one = T.dynamic("m", "int64")
+ m_main_cuda_graph_capture = T.dynamic("m", "int64")
+ m_main = T.dynamic("m", "int64")
@I.ir_module
class Expected:
@@ -1096,7 +1096,7 @@ def test_disable_capture_output():
def test_static_input_with_symbolic_shape():
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Before:
@@ -1115,8 +1115,8 @@ def test_static_input_with_symbolic_shape():
gv = (alloc3,)
return gv
- m_main_cuda_graph_capture = T.dynamic("m")
- m_main = T.dynamic("m")
+ m_main_cuda_graph_capture = T.dynamic("m", "int64")
+ m_main = T.dynamic("m", "int64")
@I.ir_module
class Expected:
@@ -1193,7 +1193,7 @@ if __name__ == "__main__":
def test_match_cast_of_captured_value():
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Before:
diff --git a/tests/python/relax/test_transform_rewrite_dataflow_reshape.py b/tests/python/relax/test_transform_rewrite_dataflow_reshape.py
index 42fa84af5e..57a5e690b2 100644
--- a/tests/python/relax/test_transform_rewrite_dataflow_reshape.py
+++ b/tests/python/relax/test_transform_rewrite_dataflow_reshape.py
@@ -656,7 +656,7 @@ def test_rewrite_static_reshape():
# def test_rewrite_dynamic_reshape():
-# N = T.dynamic("N")
+# N = T.dynamic("N", "int64")
#
# @I.ir_module
# class Before:
@@ -717,7 +717,7 @@ def test_rewrite_static_reshape():
def test_rewrite_dynamic_reshape():
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@I.ir_module
class Before:
@@ -729,7 +729,7 @@ def test_rewrite_dynamic_reshape():
R.output(z)
return z
- N = T.dynamic("N")
+ N = T.dynamic("N", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_transform_static_plan_block_memory.py b/tests/python/relax/test_transform_static_plan_block_memory.py
index 9c05c260df..0c51441dbd 100644
--- a/tests/python/relax/test_transform_static_plan_block_memory.py
+++ b/tests/python/relax/test_transform_static_plan_block_memory.py
@@ -681,10 +681,10 @@ def test_call_packed_external_func():
def test_symbolic_shape():
- m_exp = T.dynamic("m")
- n_exp = T.dynamic("n")
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
+ m_exp = T.dynamic("m", "int64")
+ n_exp = T.dynamic("n", "int64")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
@tvm.script.ir_module
class Module:
@@ -702,10 +702,10 @@ def test_symbolic_shape():
y: R.Tensor((m_main, n_main), dtype="float32") = alloc
return x
- m_exp = T.dynamic("m")
- n_exp = T.dynamic("n")
- m_main = T.dynamic("m")
- n_main = T.dynamic("n")
+ m_exp = T.dynamic("m", "int64")
+ n_exp = T.dynamic("n", "int64")
+ m_main = T.dynamic("m", "int64")
+ n_main = T.dynamic("n", "int64")
@tvm.script.ir_module
class Expected:
@@ -918,7 +918,7 @@ def test_multiple_functions():
def test_tir_var_upper_bound():
# fmt: off
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Module:
@@ -968,7 +968,7 @@ def test_tir_var_upper_bound():
gv: R.Tensor((2 * n + 2,), dtype="float32") = alloc4
return gv
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -1027,7 +1027,7 @@ def test_tir_var_upper_bound():
def test_lower_bound_only():
# fmt: off
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Module:
@@ -1077,7 +1077,7 @@ def test_lower_bound_only():
gv: R.Tensor((2 * n + 2,), dtype="float32") = alloc4
return gv
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -1137,7 +1137,7 @@ def test_lower_bound_only():
def test_upper_and_lower_bounds():
# fmt: off
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Module:
@@ -1187,7 +1187,7 @@ def test_upper_and_lower_bounds():
gv: R.Tensor((2 * n + 2,), dtype="float32") = alloc4
return gv
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -1245,7 +1245,7 @@ def test_upper_and_lower_bounds():
def test_invalid_tir_var_upper_bound():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Module:
@@ -1259,7 +1259,7 @@ def test_invalid_tir_var_upper_bound():
def test_invalid_tir_var_lower_bound():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Module:
@@ -1274,8 +1274,8 @@ def test_invalid_tir_var_lower_bound():
def test_tir_var_decreasing_monotone():
# fmt: off
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Module:
@@ -1298,8 +1298,8 @@ def test_tir_var_decreasing_monotone():
r: R.Tensor((n, m, T.max(n - m, 1)), dtype="float32") = alloc2
return r
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Expected:
@@ -1331,7 +1331,7 @@ def test_tir_var_decreasing_monotone():
def test_call_tir_dyn():
# fmt: off
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Module:
@@ -1358,7 +1358,7 @@ def test_call_tir_dyn():
lv3: R.Tensor((n,), dtype="float32") = alloc2
return lv3
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -1394,7 +1394,7 @@ def test_call_tir_dyn():
def test_call_tir_dyn_plan_dynamic_func_output():
# fmt: off
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Module:
@@ -1421,7 +1421,7 @@ def test_call_tir_dyn_plan_dynamic_func_output():
lv3: R.Tensor((n,), dtype="float32") = alloc2
return lv3
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -1458,8 +1458,8 @@ def test_call_tir_dyn_plan_dynamic_func_output():
def test_call_tir_dyn_plan_partially_dynamic():
# fmt: off
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Module:
@@ -1489,8 +1489,8 @@ def test_call_tir_dyn_plan_partially_dynamic():
lv4: R.Tensor((n, m), dtype="float32") = alloc3
return lv4
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Expected:
@@ -1598,8 +1598,8 @@ def test_function_independence():
def test_add():
- batch_size = T.dynamic("batch_size")
- vocab_size = T.dynamic("vocab_size")
+ batch_size = T.dynamic("batch_size", "int64")
+ vocab_size = T.dynamic("vocab_size", "int64")
@I.ir_module
class Module:
@@ -1645,8 +1645,8 @@ def test_add():
)
return lv1_1
- batch_size = T.dynamic("batch_size")
- vocab_size = T.dynamic("vocab_size")
+ batch_size = T.dynamic("batch_size", "int64")
+ vocab_size = T.dynamic("vocab_size", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/relax/test_utils.py b/tests/python/relax/test_utils.py
index 7f2a2d781b..cc98f1f5c4 100644
--- a/tests/python/relax/test_utils.py
+++ b/tests/python/relax/test_utils.py
@@ -42,7 +42,7 @@ def test_copy_with_new_vars():
def test_copy_with_new_vars_copied_symbolic_vars():
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@R.function
def before(x: R.Tensor((m,), "float32"), y: R.Tensor((m,), "float32")):
diff --git a/tests/python/relax/test_vm_build.py b/tests/python/relax/test_vm_build.py
index 0fd605de5d..043d598f3a 100644
--- a/tests/python/relax/test_vm_build.py
+++ b/tests/python/relax/test_vm_build.py
@@ -107,8 +107,8 @@ def test_vm_compile_unlowered_operator_error():
def test_match_check():
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class TestMatchCheck:
@@ -135,8 +135,8 @@ def test_match_check():
def test_vm_compile_stage2():
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class TestVMCompileStage2:
@@ -195,8 +195,8 @@ def test_vm_compile_stage3():
def test_vm_compile_e2e():
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class TestVMCompileE2E:
@@ -228,9 +228,9 @@ def test_vm_compile_e2e_func_param_with_shape():
m_tir_matmul = T.dynamic("m", "int32")
n_tir_matmul = T.dynamic("n", "int32")
k_tir_matmul = T.dynamic("k", "int32")
- m_func = T.dynamic("m")
- k_func = T.dynamic("k")
- n_func = T.dynamic("n")
+ m_func = T.dynamic("m", "int64")
+ k_func = T.dynamic("k", "int64")
+ n_func = T.dynamic("n", "int64")
@tvm.script.ir_module
class TestVMCompileE2E2:
@@ -590,8 +590,8 @@ def test_vm_relax_symbolic_shape():
def test_vm_relax_symbolic_shape_tuple():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class mod:
@@ -967,8 +967,8 @@ class TestVMSetInput:
def test_multi_systemlib():
pytest.importorskip("cloudpickle") # needed by popen_pool.PopenWorker
- N = T.dynamic("N")
- m = T.dynamic("m")
+ N = T.dynamic("N", "int64")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class ModA:
@@ -984,8 +984,8 @@ def test_multi_systemlib():
gv0 = R.call_tir(ModA.tir_init, (), ty_args=[R.Tensor((m + 1,), dtype="float32")])
return gv0
- N = T.dynamic("N")
- m = T.dynamic("m")
+ N = T.dynamic("N", "int64")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class ModB:
diff --git a/tests/python/relax/test_vm_builtin_lower.py b/tests/python/relax/test_vm_builtin_lower.py
index 02656578d2..8516fd2d61 100644
--- a/tests/python/relax/test_vm_builtin_lower.py
+++ b/tests/python/relax/test_vm_builtin_lower.py
@@ -26,8 +26,8 @@ from tvm.script import tirx as T
def test_vm_builtin_lower_mem_alloc_storage():
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -43,8 +43,8 @@ def test_vm_builtin_lower_mem_alloc_storage():
gv0 = alloc
return gv0
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -69,8 +69,8 @@ def test_vm_builtin_lower_mem_alloc_storage():
def test_vm_builtin_alloc_tensor_raises_error():
"""R.builtin.alloc_tensor should be handled earlier"""
- m = T.dynamic("m")
- n = T.dynamic("n")
+ m = T.dynamic("m", "int64")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
diff --git a/tests/python/relax/test_vm_codegen_only.py b/tests/python/relax/test_vm_codegen_only.py
index dee27728fd..30f58c966b 100644
--- a/tests/python/relax/test_vm_codegen_only.py
+++ b/tests/python/relax/test_vm_codegen_only.py
@@ -211,9 +211,9 @@ def test_shape_check_builtin():
# 0: n, 1: m
sindex = {"n": 0, "m": 1}
- n = T.dynamic("n")
- k = T.dynamic("k")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ k = T.dynamic("k", "int64")
+ m = T.dynamic("m", "int64")
@tvm.script.ir_module
class TestVMShapeCheck:
diff --git a/tests/python/s_tir/dlight/test_benchmark.py b/tests/python/s_tir/dlight/test_benchmark.py
index 599b60928f..0513302247 100644
--- a/tests/python/s_tir/dlight/test_benchmark.py
+++ b/tests/python/s_tir/dlight/test_benchmark.py
@@ -43,10 +43,10 @@ from tvm.script import tirx as T
# In principle, this should be attached to an argument.
# pylint: disable=no-self-argument,invalid-name,line-too-long,no-method-argument
# fmt: off
-full1_n = T.dynamic("n")
-full2_n = T.dynamic("n")
-matmul1_n = T.dynamic("n")
-_test_n = T.dynamic("n")
+full1_n = T.dynamic("n", "int64")
+full2_n = T.dynamic("n", "int64")
+matmul1_n = T.dynamic("n", "int64")
+_test_n = T.dynamic("n", "int64")
@I.ir_module(check_well_formed=False)
class Module:
@@ -102,7 +102,7 @@ class Module:
R.output(lv3)
return lv3
-m = T.dynamic("m")
+m = T.dynamic("m", "int64")
@Ts.function
def cuda_workload(inp0: T.Tensor((T.int64(1), m, T.int64(4096)), "float32"), inp1: T.Tensor((T.int64(4096), T.int64(4096)), "float32"), matmul: T.Tensor((T.int64(1), m, T.int64(4096)), "float32")):
diff --git a/tests/python/s_tir/dlight/test_cpu_gemv.py b/tests/python/s_tir/dlight/test_cpu_gemv.py
index 4378253f15..4dbd4d1c0a 100644
--- a/tests/python/s_tir/dlight/test_cpu_gemv.py
+++ b/tests/python/s_tir/dlight/test_cpu_gemv.py
@@ -433,7 +433,7 @@ def test_outer_reduction_adreno():
def test_outer_reduction_adreno_dynamic():
# fmt: off
- v = T.dynamic("v")
+ v = T.dynamic("v", "int64")
@Ts.function(private=True)
def before(lv612: T.Tensor((T.int64(512), v), 'uint32'), lv613: T.Tensor((T.int64(128), v), 'float16'), lv1607: T.Tensor((T.int64(1), T.int64(1), T.int64(4096)), "float16"), p_output0_intermediate: T.Tensor((T.int64(1), T.int64(1), v), "float32")):
@@ -463,7 +463,7 @@ def test_outer_reduction_adreno_dynamic():
Ts.writes(p_output0_intermediate[v_i0, v_i1, v_i2])
p_output0_intermediate[v_i0, v_i1, v_i2] = T.Cast("float32", var_matmul_intermediate[v_i0, v_i1, v_i2])
- v = T.dynamic("v")
+ v = T.dynamic("v", "int64")
@Ts.function(private=True)
def expected(lv612: T.Tensor((T.int64(512), v), 'uint32'), lv613: T.Tensor((T.int64(128), v), 'float16'), lv1607: T.Tensor((T.int64(1), T.int64(1), T.int64(4096)), "float16"), p_output0_intermediate: T.Tensor((T.int64(1), T.int64(1), v), "float32")):
diff --git a/tests/python/s_tir/dlight/test_gpu_gemv.py b/tests/python/s_tir/dlight/test_gpu_gemv.py
index d8a99ba17d..8d92793742 100644
--- a/tests/python/s_tir/dlight/test_gpu_gemv.py
+++ b/tests/python/s_tir/dlight/test_gpu_gemv.py
@@ -806,7 +806,7 @@ def test_outer_reduction_adreno():
def test_outer_reduction_adreno_dynamic():
# fmt: off
- v = T.dynamic("v")
+ v = T.dynamic("v", "int64")
@Ts.function(private=True)
def before(lv612: T.Tensor((T.int64(512), v), 'uint32'), lv613: T.Tensor((T.int64(128), v), 'float16'), lv1607: T.Tensor((T.int64(1), T.int64(1), T.int64(4096)), "float16"), p_output0_intermediate: T.Tensor((T.int64(1), T.int64(1), v), "float32")):
@@ -836,7 +836,7 @@ def test_outer_reduction_adreno_dynamic():
Ts.writes(p_output0_intermediate[v_i0, v_i1, v_i2])
p_output0_intermediate[v_i0, v_i1, v_i2] = T.Cast("float32", var_matmul_intermediate[v_i0, v_i1, v_i2])
- v = T.dynamic("v")
+ v = T.dynamic("v", "int64")
@Ts.function(private=True)
def expected(lv612: T.Tensor((T.int64(512), v), 'uint32'), lv613: T.Tensor((T.int64(128), v), 'float16'), lv1607: T.Tensor((T.int64(1), T.int64(1), T.int64(4096)), "float16"), p_output0_intermediate: T.Tensor((T.int64(1), T.int64(1), v), "float32")):
diff --git a/tests/python/s_tir/dlight/test_gpu_general_reduction.py b/tests/python/s_tir/dlight/test_gpu_general_reduction.py
index b5250441f2..8c3958e457 100644
--- a/tests/python/s_tir/dlight/test_gpu_general_reduction.py
+++ b/tests/python/s_tir/dlight/test_gpu_general_reduction.py
@@ -91,8 +91,8 @@ def test_scalar_argmin_reduction_value_scope():
def test_softmax_1():
# fmt: off
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class Before:
@@ -141,8 +141,8 @@ def test_softmax_1():
Ts.writes(var_compute_intermediate[v_i0, v_i1, v_i2, v_i3])
var_compute_intermediate[v_i0, v_i1, v_i2, v_i3] = T.Cast("float16", var_T_softmax_norm_intermediate[v_i0, v_i1, v_i2, v_i3])
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@I.ir_module
class After:
@@ -371,7 +371,7 @@ def test_softmax_3():
def test_layer_norm():
# fmt: off
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -408,7 +408,7 @@ def test_layer_norm():
Ts.writes(var_compute_intermediate[v_i0, v_i1, v_i2])
var_compute_intermediate[v_i0, v_i1, v_i2] = T.Cast("float16", var_T_layer_norm_intermediate[v_i0, v_i1, v_i2])
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class After:
@@ -449,7 +449,7 @@ def test_layer_norm():
def test_rms_norm():
# fmt: off
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Before:
@@ -474,7 +474,7 @@ def test_rms_norm():
Ts.writes(rms_norm_1[v_bsz, v_i, v_k])
rms_norm_1[v_bsz, v_i, v_k] = T.Cast("float16", T.Cast("float32", B[v_k]) * (T.Cast("float32", A[v_bsz, v_i, v_k]) / T.sqrt(Ared_temp[v_bsz, v_i] * T.float32(0.000244140625) + T.float32(9.9999999999999995e-07))))
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class After:
@@ -601,9 +601,9 @@ def test_group_norm():
def test_logsumexp():
- batch_size = T.dynamic("batch_size")
- vocab_size = T.dynamic("vocab_size")
- num_chunks = T.dynamic("num_chunks")
+ batch_size = T.dynamic("batch_size", "int64")
+ vocab_size = T.dynamic("vocab_size", "int64")
+ num_chunks = T.dynamic("num_chunks", "int64")
@I.ir_module
class Before:
@@ -650,9 +650,9 @@ def test_logsumexp():
v0, v1, v2 = Ts.axis.remap("SSS", [l0, l1, l2])
blocked_lse[v0, v1] = T.log(temp_sum[v0, v1]) + temp_max[v0, v1]
- batch_size = T.dynamic("batch_size")
- vocab_size = T.dynamic("vocab_size")
- num_chunks = T.dynamic("num_chunks")
+ batch_size = T.dynamic("batch_size", "int64")
+ vocab_size = T.dynamic("vocab_size", "int64")
+ num_chunks = T.dynamic("num_chunks", "int64")
@I.ir_module
class After:
diff --git a/tests/python/s_tir/dlight/test_gpu_low_batch_gemv.py b/tests/python/s_tir/dlight/test_gpu_low_batch_gemv.py
index 4b5e7e39d1..a3bf926be2 100644
--- a/tests/python/s_tir/dlight/test_gpu_low_batch_gemv.py
+++ b/tests/python/s_tir/dlight/test_gpu_low_batch_gemv.py
@@ -30,7 +30,7 @@ from tvm.target import Target
def test_batch_decode_gemv():
# fmt: off
- batch_size = T.dynamic("batch_size")
+ batch_size = T.dynamic("batch_size", "int64")
@Ts.function(private=True)
def before(lv429: T.Tensor((T.int64(4096), T.int64(3584)), "uint32"), lv430: T.Tensor((T.int64(4096), T.int64(896)), "float16"), lv807: T.Tensor((batch_size, T.int64(1), T.int64(28672)), 'float16'), NT_matmul_intermediate: T.Tensor((batch_size, T.int64(1), T.int64(4096)), 'float16')):
@@ -60,7 +60,7 @@ def test_batch_decode_gemv():
NT_matmul_intermediate[v_i0, v_i1, v_i2] = T.float16(0)
NT_matmul_intermediate[v_i0, v_i1, v_i2] = NT_matmul_intermediate[v_i0, v_i1, v_i2] + lv807[v_i0, v_i1, v_k] * dequantize_intermediate_intermediate[v_i2, v_k]
- batch_size = T.dynamic("batch_size")
+ batch_size = T.dynamic("batch_size", "int64")
@Ts.function(private=True)
def expected(lv429: T.Tensor((T.int64(4096), T.int64(3584)), "uint32"), lv430: T.Tensor((T.int64(4096), T.int64(896)), "float16"), lv807: T.Tensor((batch_size, T.int64(1), T.int64(28672)), 'float16'), NT_matmul_intermediate: T.Tensor((batch_size, T.int64(1), T.int64(4096)), 'float16')):
@@ -158,7 +158,7 @@ def test_batch_gemv():
K = 4096
# fmt: off
- batch_size = T.dynamic("batch_size")
+ batch_size = T.dynamic("batch_size", "int64")
@Ts.function(private=True)
def before(A: T.Tensor((batch_size, T.int64(1), T.int64(K)), 'float16'), B: T.Tensor((T.int64(N), T.int64(K)), "float16"), NT_matmul: T.Tensor((batch_size, T.int64(1), T.int64(N)), 'float16')):
@@ -174,7 +174,7 @@ def test_batch_gemv():
NT_matmul[v_i0, v_i1, v_i2] = T.float16(0)
NT_matmul[v_i0, v_i1, v_i2] = NT_matmul[v_i0, v_i1, v_i2] + A[v_i0, v_i1, v_k] * B[v_i2, v_k]
- batch_size = T.dynamic("batch_size")
+ batch_size = T.dynamic("batch_size", "int64")
@Ts.function(private=True)
def expected(A: T.Tensor((batch_size, T.int64(1), T.int64(4096)), 'float16'), B: T.Tensor((T.int64(4096), T.int64(4096)), "float16"), NT_matmul: T.Tensor((batch_size, T.int64(1), T.int64(4096)), 'float16')):
@@ -259,7 +259,7 @@ def test_batch_gemv():
def test_reduction_symbolic_var():
# fmt: off
- kv_seq_len = T.dynamic("kv_seq_len")
+ kv_seq_len = T.dynamic("kv_seq_len", "int64")
@Ts.function(private=True)
def before(A: T.Tensor((T.int64(1), T.int64(32), T.int64(1), kv_seq_len), "float32"), B: T.Tensor((T.int64(1), T.int64(32), kv_seq_len, T.int64(128)), "float32"), matmul: T.Tensor((T.int64(1), T.int64(32), T.int64(1), T.int64(128)), "float32")):
@@ -282,7 +282,7 @@ def test_reduction_symbolic_var():
def test_small_spatial_axis():
- batch_size = T.dynamic("batch_size")
+ batch_size = T.dynamic("batch_size", "int64")
@Ts.function(private=True)
def func(
@@ -302,7 +302,7 @@ def test_small_spatial_axis():
C[v_i0, v_i1] = C[v_i0, v_i1] + A[v_i0, v_k] * B[v_i1, v_k]
# fmt: off
- batch_size = T.dynamic("batch_size")
+ batch_size = T.dynamic("batch_size", "int64")
@Ts.function(private=True)
def expected(A: T.Tensor((batch_size, T.int64(4096)), 'float16'), B: T.Tensor((T.int64(8), T.int64(4096)), "float16"), C: T.Tensor((batch_size, T.int64(8)), 'float16')):
@@ -539,7 +539,7 @@ def test_outer_reduction():
def test_low_batch_gemv_cuda_target_without_max_shared_memory_per_block():
# fmt: off
- batch_size = T.dynamic("batch_size")
+ batch_size = T.dynamic("batch_size", "int64")
@Ts.function(private=True)
def before(A: T.Tensor((batch_size, T.int64(1), T.int64(128)), 'float16'), B: T.Tensor((T.int64(128), T.int64(128)), "float16"), C: T.Tensor((batch_size, T.int64(1), T.int64(128)), 'float16')):
@@ -565,7 +565,7 @@ def test_low_batch_gemv_cuda_target_without_max_shared_memory_per_block():
def test_low_batch_gemv_rejects_non_einsum_tensor_access():
- batch_size = T.dynamic("batch_size")
+ batch_size = T.dynamic("batch_size", "int64")
@Ts.function(private=True)
def before(
@@ -589,7 +589,7 @@ def test_low_batch_gemv_rejects_non_einsum_tensor_access():
def test_low_batch_gemv_broadcast_epilogue():
# fmt: off
- batch_size = T.dynamic("batch_size")
+ batch_size = T.dynamic("batch_size", "int64")
@Ts.function(private=True)
def before(
diff --git a/tests/python/s_tir/dlight/test_gpu_matmul.py b/tests/python/s_tir/dlight/test_gpu_matmul.py
index 4400caf908..c1f80d1f48 100644
--- a/tests/python/s_tir/dlight/test_gpu_matmul.py
+++ b/tests/python/s_tir/dlight/test_gpu_matmul.py
@@ -26,7 +26,7 @@ from tvm.target import Target
def test_matmul():
# fmt: off
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@Ts.function(private=True)
def before(inp0: T.Tensor((T.int64(1), m, T.int64(4096)), "float32"), inp1: T.Tensor((T.int64(4096), T.int64(4096)), "float32"), matmul: T.Tensor((T.int64(1), m, T.int64(4096)), "float32")):
@@ -38,7 +38,7 @@ def test_matmul():
matmul[v_i0, v_i1, v_i2] = T.float32(0)
matmul[v_i0, v_i1, v_i2] = matmul[v_i0, v_i1, v_i2] + inp0[v_i0, v_i1, v_k] * inp1[v_k, v_i2]
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@Ts.function(private=True)
def expected(inp0: T.Tensor((T.int64(1), m, T.int64(4096)), "float32"), inp1: T.Tensor((T.int64(4096), T.int64(4096)), "float32"), matmul: T.Tensor((T.int64(1), m, T.int64(4096)), "float32")):
@@ -350,7 +350,7 @@ def test_skip_gemv():
def test_output_fp32():
# fmt: off
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@Ts.function(private=True)
def before(lv13: T.Tensor((T.int64(4096), T.int64(512)), "uint32"), lv14: T.Tensor((T.int64(4096), T.int64(128)), "float16"), lv48: T.Tensor((T.int64(1), n, T.int64(4096)), 'float16'), lv13_1: T.Tensor((T.int64(4096),), "float16"), lv3: T.Tensor((T.int64(1), n, T.int64(4096)), 'float16'), p_output0_intermediate: T.Tensor((T.int64(1), n, T.int64(4096)), 'float16')):
@@ -401,7 +401,7 @@ def test_output_fp32():
Ts.writes(p_output0_intermediate[v_ax0, v_ax1, v_ax2])
p_output0_intermediate[v_ax0, v_ax1, v_ax2] = var_compute_intermediate_1[v_ax0, v_ax1, v_ax2] + lv3[v_ax0, v_ax1, v_ax2]
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@Ts.function(private=True)
def expected(lv13: T.Tensor((T.int64(4096), T.int64(512)), "uint32"), lv14: T.Tensor((T.int64(4096), T.int64(128)), "float16"), lv48: T.Tensor((T.int64(1), n, T.int64(4096)), 'float16'), lv13_1: T.Tensor((T.int64(4096),), "float16"), lv3: T.Tensor((T.int64(1), n, T.int64(4096)), 'float16'), p_output0_intermediate: T.Tensor((T.int64(1), n, T.int64(4096)), 'float16')):
@@ -482,7 +482,7 @@ def test_output_fp32():
def test_inline_consumer_chain():
# fmt: off
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@Ts.function(private=True)
def before(lv26: T.Tensor((n, T.int64(2048)), 'float16'), lv9: T.Tensor((T.int64(2048), T.int64(2048)), "float16"), lv52: T.Tensor((T.int64(1), n, T.int64(2048)), "float32"), var_T_multiply_intermediate: T.Tensor((n, T.int64(2048)), 'float16')):
@@ -533,7 +533,7 @@ def test_inline_consumer_chain():
Ts.writes(var_T_multiply_intermediate[v_ax0, v_ax1])
var_T_multiply_intermediate[v_ax0, v_ax1] = var_compute_intermediate[v_ax0, v_ax1] * var_T_multiply_intermediate_1[v_ax0, v_ax1]
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@Ts.function(private=True)
def expected(lv26: T.Tensor((n, T.int64(2048)), 'float16'), lv9: T.Tensor((T.int64(2048), T.int64(2048)), "float16"), lv52: T.Tensor((T.int64(1), n, T.int64(2048)), "float32"), var_T_multiply_intermediate: T.Tensor((n, T.int64(2048)), 'float16')):
@@ -614,7 +614,7 @@ def test_inline_consumer_chain():
def test_matmul_android():
# fmt: off
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@Ts.function(private=True)
def before(inp0: T.Tensor((T.int64(1), m, T.int64(4096)), "float32"), inp1: T.Tensor((T.int64(4096), T.int64(4096)), "float32"), matmul: T.Tensor((T.int64(1), m, T.int64(4096)), "float32")):
@@ -626,7 +626,7 @@ def test_matmul_android():
matmul[v_i0, v_i1, v_i2] = T.float32(0)
matmul[v_i0, v_i1, v_i2] = matmul[v_i0, v_i1, v_i2] + inp0[v_i0, v_i1, v_k] * inp1[v_k, v_i2]
- m = T.dynamic("m")
+ m = T.dynamic("m", "int64")
@Ts.function(private=True)
def expected(inp0: T.Tensor((T.int64(1), m, T.int64(4096)), "float32"), inp1: T.Tensor((T.int64(4096), T.int64(4096)), "float32"), matmul: T.Tensor((T.int64(1), m, T.int64(4096)), "float32")):
@@ -707,7 +707,7 @@ def test_matmul_android():
def test_fused_dequant_matmul_android():
# fmt: off
- seq_len = T.dynamic("seq_len")
+ seq_len = T.dynamic("seq_len", "int64")
@Ts.function(private=True)
def before(lv452: T.Tensor((T.int64(512), T.int64(12288)), "uint32"), lv453: T.Tensor((T.int64(128), T.int64(12288)), "float16"), rms_norm130: T.Tensor((T.int64(1), seq_len, T.int64(4096)), 'float16'), transformer_h_0_attn_c_attn_bias3: T.Tensor((T.int64(12288),), "float16"), T_add_intermediate_intermediate: T.Tensor((T.int64(1), seq_len, T.int64(12288)), 'float16')):
@@ -744,7 +744,7 @@ def test_fused_dequant_matmul_android():
Ts.writes(T_add_intermediate_intermediate[v_ax0, v_ax1, v_ax2])
T_add_intermediate_intermediate[v_ax0, v_ax1, v_ax2] = matmul_intermediate[v_ax0, v_ax1, v_ax2] + transformer_h_0_attn_c_attn_bias3[v_ax2]
- seq_len = T.dynamic("seq_len")
+ seq_len = T.dynamic("seq_len", "int64")
@Ts.function(private=True)
def expected(lv452: T.Tensor((T.int64(512), T.int64(12288)), "uint32"), lv453: T.Tensor((T.int64(128), T.int64(12288)), "float16"), rms_norm130: T.Tensor((T.int64(1), seq_len, T.int64(4096)), 'float16'), transformer_h_0_attn_c_attn_bias3: T.Tensor((T.int64(12288),), "float16"), T_add_intermediate_intermediate: T.Tensor((T.int64(1), seq_len, T.int64(12288)), 'float16')):
diff --git a/tests/python/s_tir/dlight/test_gpu_reduction.py b/tests/python/s_tir/dlight/test_gpu_reduction.py
index 4ccbeb6d0a..fef76690b0 100644
--- a/tests/python/s_tir/dlight/test_gpu_reduction.py
+++ b/tests/python/s_tir/dlight/test_gpu_reduction.py
@@ -845,7 +845,7 @@ def test_reduction_inner_no_broadcasting2():
def test_reduction_inner_spatial_choose_perfect_factor():
# fmt: off
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Module:
@@ -862,7 +862,7 @@ def test_reduction_inner_spatial_choose_perfect_factor():
with Ts.init():
matmul[v_i0, v_i1, v_i2, v_i3] = T.float16(0)
matmul[v_i0, v_i1, v_i2, v_i3] = matmul[v_i0, v_i1, v_i2, v_i3] + A[v_i0, v_i1, v_i2, v_k] * B[v_i0, v_i1, v_k, v_i3]
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@I.ir_module
class Expected:
@@ -1085,7 +1085,7 @@ def test_reduction_inner_spatial_uses_normalized_split_extent():
def test_repeat_transpose_gemv():
# fmt: off
- kv_seq_len = T.dynamic("kv_seq_len")
+ kv_seq_len = T.dynamic("kv_seq_len", "int64")
@I.ir_module
class Before:
@@ -1116,7 +1116,7 @@ def test_repeat_transpose_gemv():
with Ts.init():
var_matmul_intermediate[v_i0, v_i1, v_i2, v_i3] = T.float16(0)
var_matmul_intermediate[v_i0, v_i1, v_i2, v_i3] = var_matmul_intermediate[v_i0, v_i1, v_i2, v_i3] + astype66[v_i0, v_i1, v_i2, v_k] * var_T_transpose_intermediate[v_i0, v_i1, v_k, v_i3]
- kv_seq_len = T.dynamic("kv_seq_len")
+ kv_seq_len = T.dynamic("kv_seq_len", "int64")
@I.ir_module
class Expected:
@@ -1167,7 +1167,7 @@ def test_repeat_transpose_gemv():
def test_gemv_dyn_shape_epilogue():
- vocab_size = T.dynamic("vocab_size")
+ vocab_size = T.dynamic("vocab_size", "int64")
@I.ir_module
class Module:
@@ -1198,7 +1198,7 @@ def test_gemv_dyn_shape_epilogue():
C[v_i0, v_i1, v_i2] = T.Cast("float32", C_temp[v_i0, v_i1, v_i2])
# fmt: off
- vocab_size = T.dynamic("vocab_size")
+ vocab_size = T.dynamic("vocab_size", "int64")
@I.ir_module
class Expected:
diff --git a/tests/python/s_tir/schedule/test_tir_schedule_compute_inline.py b/tests/python/s_tir/schedule/test_tir_schedule_compute_inline.py
index 3aced82755..10bf87c803 100644
--- a/tests/python/s_tir/schedule/test_tir_schedule_compute_inline.py
+++ b/tests/python/s_tir/schedule/test_tir_schedule_compute_inline.py
@@ -1319,8 +1319,8 @@ def test_reverse_compute_inline_producer_is_reduction():
def test_compute_inline_softmax():
# fmt: off
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@Ts.function
def before(lv44: T.Tensor((T.int64(1), T.int64(32), n, m), "float32"), var_compute_intermediate: T.Tensor((T.int64(1), T.int64(32), n, m), 'float16')):
@@ -1366,8 +1366,8 @@ def test_compute_inline_softmax():
Ts.writes(var_compute_intermediate[v_i0, v_i1, v_i2, v_i3])
var_compute_intermediate[v_i0, v_i1, v_i2, v_i3] = T.Cast("float16", var_T_softmax_norm_intermediate[v_i0, v_i1, v_i2, v_i3])
- n = T.dynamic("n")
- m = T.dynamic("m")
+ n = T.dynamic("n", "int64")
+ m = T.dynamic("m", "int64")
@Ts.function
def after(lv44: T.Tensor((T.int64(1), T.int64(32), n, m), "float32"), var_compute_intermediate: T.Tensor((T.int64(1), T.int64(32), n, m), 'float16')):
@@ -1415,7 +1415,7 @@ def test_compute_inline_softmax():
def test_reverse_compute_inline_layer_norm():
# fmt: off
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@Ts.function
def before(lv6: T.Tensor((T.int64(1), n, T.int64(2560)), "float32"), weight1: T.Tensor((T.int64(2560),), "float32"), bias: T.Tensor((T.int64(2560),), "float32"), var_compute_intermediate: T.Tensor((T.int64(1), n, T.int64(2560)), 'float16')):
@@ -1456,7 +1456,7 @@ def test_reverse_compute_inline_layer_norm():
Ts.writes(var_compute_intermediate[v_i0, v_i1, v_i2])
var_compute_intermediate[v_i0, v_i1, v_i2] = T.Cast("float16", var_T_layer_norm_intermediate[v_i0, v_i1, v_i2])
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@Ts.function
def after(lv6: T.Tensor((T.int64(1), n, T.int64(2560)), "float32"), weight1: T.Tensor((T.int64(2560),), "float32"), bias: T.Tensor((T.int64(2560),), "float32"), var_compute_intermediate: T.Tensor((T.int64(1), n, T.int64(2560)), 'float16')):
diff --git a/tests/python/s_tir/schedule/test_tir_schedule_tensorize.py b/tests/python/s_tir/schedule/test_tir_schedule_tensorize.py
index 358405374d..4fa758f65d 100644
--- a/tests/python/s_tir/schedule/test_tir_schedule_tensorize.py
+++ b/tests/python/s_tir/schedule/test_tir_schedule_tensorize.py
@@ -717,9 +717,9 @@ def test_tensorize_matmul_mixed_dtype():
vk = Ts.axis.reduce(T.int64(128), k_0 * T.int64(16) + k_1)
C[vi, vj] = C[vi, vj] + A[vi, vk] * B[vj, vk]
- A_elem_offset = T.dynamic("A_elem_offset")
- B_elem_offset = T.dynamic("B_elem_offset")
- C_elem_offset = T.dynamic("C_elem_offset")
+ A_elem_offset = T.dynamic("A_elem_offset", "int64")
+ B_elem_offset = T.dynamic("B_elem_offset", "int64")
+ C_elem_offset = T.dynamic("C_elem_offset", "int64")
@Ts.function
def tensorized_matmul_int64_shape(
diff --git a/tests/python/s_tir/schedule/test_tir_schedule_transform_layout.py b/tests/python/s_tir/schedule/test_tir_schedule_transform_layout.py
index 7f25d3aff0..1672e174f4 100644
--- a/tests/python/s_tir/schedule/test_tir_schedule_transform_layout.py
+++ b/tests/python/s_tir/schedule/test_tir_schedule_transform_layout.py
@@ -1154,7 +1154,7 @@ def test_index_map_dtype_legalize_with_constant():
def test_transform_layout_with_symbolic_bound():
# fmt: off
# pylint: disable=invalid-name,line-too-long,too-many-locals
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@Ts.function
def before(A: T.Tensor((T.int64(1), T.int64(32), T.int64(1), T.int64(128)), 'float16'), B: T.Tensor((T.int64(1), T.int64(32), n, T.int64(128)), 'float16'), C: T.Tensor((T.int64(1), T.int64(32), T.int64(1), n), 'float16')):
@@ -1169,7 +1169,7 @@ def test_transform_layout_with_symbolic_bound():
C[v_i0, v_i1, v_i2, v_i3] = T.float16(0)
C[v_i0, v_i1, v_i2, v_i3] = C[v_i0, v_i1, v_i2, v_i3] + A[v_i0, v_i1, v_i2, v_k] * B[v_i0, v_i1, v_i3, v_k]
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@Ts.function
def after(A: T.Tensor((T.int64(1), T.int64(32), T.int64(1), T.int64(128)), 'float16'), B: T.Tensor((T.int64(1), T.int64(32), n, T.int64(128)), 'float16'), C: T.Tensor((n * T.int64(32),), 'float16')):
@@ -1202,7 +1202,7 @@ def test_transform_layout_with_symbolic_bound():
def test_transform_block_layout_with_symbolic_bound():
# fmt: off
# pylint: disable=invalid-name,line-too-long,too-many-locals
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@Ts.function
def before(A: T.Tensor((T.int64(1), T.int64(32), T.int64(1), T.int64(128)), 'float16'), B: T.Tensor((T.int64(1), T.int64(32), n, T.int64(128)), 'float16'), C: T.Tensor((n * T.int64(32),), 'float16')):
@@ -1217,7 +1217,7 @@ def test_transform_block_layout_with_symbolic_bound():
C[v_i1 * n + v_i3] = T.float16(0)
C[v_i1 * n + v_i3] = C[v_i1 * n + v_i3] + A[v_i0, v_i1, v_i2, v_k] * B[v_i0, v_i1, v_i3, v_k]
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@Ts.function
def after(A: T.Tensor((T.int64(1), T.int64(32), T.int64(1), T.int64(128)), 'float16'), B: T.Tensor((T.int64(1), T.int64(32), n, T.int64(128)), 'float16'), C: T.Tensor((n * T.int64(32),), 'float16')):
diff --git a/tests/python/s_tir/script/test_s_tir_script_printer.py b/tests/python/s_tir/script/test_s_tir_script_printer.py
index 3591943b3e..f1e605bb59 100644
--- a/tests/python/s_tir/script/test_s_tir_script_printer.py
+++ b/tests/python/s_tir/script/test_s_tir_script_printer.py
@@ -51,7 +51,7 @@ def test_function_symbolic_tensor_param_roundtrip():
source = func.script()
assert "T.Tensor((n + 1, n)" in source
- assert source.index("def main[n: T.int32](") < source.index("T.evaluate(n)")
+ assert source.index("def main[n](") < source.index("T.evaluate(n)")
tvm.ir.assert_structural_equal(
tvm.script.from_source(
source, extra_vars={"I": tvm.script.ir, "T": tvm.script.tirx, "Ts": tvm.script.s_tir}
@@ -72,7 +72,7 @@ def test_function_compound_tensor_shape_first_use_roundtrip():
source = func.script()
assert "T.Tensor((T.max(n, 1),)" in source
- assert source.index("def main[n: T.int32](") < source.index("T.evaluate(n)")
+ assert source.index("def main[n](") < source.index("T.evaluate(n)")
tvm.ir.assert_structural_equal(
tvm.script.from_source(
source, extra_vars={"I": tvm.script.ir, "T": tvm.script.tirx, "Ts": tvm.script.s_tir}
diff --git a/tests/python/s_tir/transform/test_s_tir_transform_default_gpu_schedule.py b/tests/python/s_tir/transform/test_s_tir_transform_default_gpu_schedule.py
index f1d8349c47..260b91282b 100644
--- a/tests/python/s_tir/transform/test_s_tir_transform_default_gpu_schedule.py
+++ b/tests/python/s_tir/transform/test_s_tir_transform_default_gpu_schedule.py
@@ -26,8 +26,8 @@ from tvm.script import tirx as T
def test_broadcast_to_symbolic():
# pylint: disable=no-self-argument,missing-class-docstring,line-too-long
# fmt: off
- x_0 = T.dynamic("x_0")
- x_1 = T.dynamic("x_1")
+ x_0 = T.dynamic("x_0", "int64")
+ x_1 = T.dynamic("x_1", "int64")
@tvm.script.ir_module
class Before:
@@ -46,8 +46,8 @@ def test_broadcast_to_symbolic():
Ts.writes(T_broadcast_to[v_ax0, v_ax1])
T_broadcast_to[v_ax0, v_ax1] = rxplaceholder[v_ax0, T.int64(0)]
- x_0 = T.dynamic("x_0")
- x_1 = T.dynamic("x_1")
+ x_0 = T.dynamic("x_0", "int64")
+ x_1 = T.dynamic("x_1", "int64")
@tvm.script.ir_module
class Expected:
diff --git a/tests/python/script/minilang.py b/tests/python/script/minilang.py
index a6c3c2a033..46de54635d 100644
--- a/tests/python/script/minilang.py
+++ b/tests/python/script/minilang.py
@@ -206,7 +206,7 @@ class Language:
def Tensor(shape=None, dtype="float32", device=None, placement="S[0]"):
return Value("tensor", (shape, dtype, device, placement))
- def dynamic(name, dtype="int64", *, loc=None):
+ def dynamic(name, dtype="int32", *, loc=None):
return self.at(loc, Value("symbol", (dtype,), name))
def cell(value=None):
@@ -217,6 +217,9 @@ class Language:
self.M.int32 = protocol_registry.register_scalar_annotation(
"M.int32", lambda: None, dtype="int32"
)
+ self.M.int64 = protocol_registry.register_scalar_annotation(
+ "M.int64", lambda: None, dtype="int64"
+ )
self.M.cell = protocol_registry.register_mutable_decl("M.cell")(cell)
@contextmanager
diff --git a/tests/python/script/test_dynamic_shape.py b/tests/python/script/test_dynamic_shape.py
index df0da9afc0..583325242b 100644
--- a/tests/python/script/test_dynamic_shape.py
+++ b/tests/python/script/test_dynamic_shape.py
@@ -153,15 +153,15 @@ def test_nested_scope_does_not_reassign_outer_symbol(language):
def test_mixed_generic_symbol_dtypes_and_identity(language):
source = """
@M.function
-def main[n, k: M.int32](x: M.Tensor((n, k))) -> M.Tensor((n, k)):
+def main[n, k: M.int64](x: M.Tensor((n, k))) -> M.Tensor((n, k)):
M.record(n)
M.record(k)
return x
"""
main = entry.parse(source, extra_vars={"M": language.M})
n, k = main.params[0].args[0].args[0]
- assert n.args == ("int64",)
- assert k.args == ("int32",)
+ assert n.args == ("int32",)
+ assert k.args == ("int64",)
assert main.ret_type.args[0][0] is n
assert main.ret_type.args[0][1] is k
assert main.body[0][1] is n
diff --git a/tests/python/te/test_te_create_function.py b/tests/python/te/test_te_create_function.py
index 83105def7a..1a9ab5769a 100644
--- a/tests/python/te/test_te_create_function.py
+++ b/tests/python/te/test_te_create_function.py
@@ -745,8 +745,8 @@ def te_resize2d_symbolic():
return [A, B]
-oh = T.dynamic("oh")
-ow = T.dynamic("ow")
+oh = T.dynamic("oh", "int64")
+ow = T.dynamic("ow", "int64")
@Ts.function
@@ -836,8 +836,8 @@ def te_slice_with_var_input():
return [tensor, idx, slice0]
-m = T.dynamic("m")
-n = T.dynamic("n")
+m = T.dynamic("m", "int64")
+n = T.dynamic("n", "int64")
@Ts.function
diff --git a/tests/python/tirx-transform/test_tir_transform_force_narrow_index_to_i32.py b/tests/python/tirx-transform/test_tir_transform_force_narrow_index_to_i32.py
index 492054d9ca..dbbd93b7fe 100644
--- a/tests/python/tirx-transform/test_tir_transform_force_narrow_index_to_i32.py
+++ b/tests/python/tirx-transform/test_tir_transform_force_narrow_index_to_i32.py
@@ -501,7 +501,7 @@ def test_left_shift_dynamic_and_vector_amounts_remain_valid():
def test_let_binding():
- n = T.dynamic("n")
+ n = T.dynamic("n", "int64")
@tvm.script.ir_module
class Before:
diff --git a/tests/python/tirx/script/test_tirx_script_dynamic_shape.py b/tests/python/tirx/script/test_tirx_script_dynamic_shape.py
index c421ccc1d5..5929a67d0e 100644
--- a/tests/python/tirx/script/test_tirx_script_dynamic_shape.py
+++ b/tests/python/tirx/script/test_tirx_script_dynamic_shape.py
@@ -136,8 +136,8 @@ def test_type_vars_roundtrip():
script = func.script()
assert script.startswith("from __future__ import annotations\n\n")
assert "def main[M](" in script
- assert "T.Tensor((M, M * T.int64(2)), T.float32)" in script
- assert "M = T.int64()" not in script
+ assert "T.Tensor((M, M * 2), T.float32)" in script
+ assert "M = T.int32()" not in script
typed = tvm.script.from_source(
"""
@T.function(private=True)
@@ -147,14 +147,14 @@ def func[M: int](A: T.Tensor((M, M * 2), T.float32)):
extra_vars={"I": tvm.script.ir, "T": tvm.script.tirx},
)
tvm.ir.assert_structural_equal(func, typed)
- assert 'M = T.dynamic("M", dtype="int64")' not in script
+ assert 'M = T.dynamic("M", dtype="int32")' not in script
repeated = func.script()
assert "from __future__ import annotations" in repeated
assert "def main[M](" in repeated
- assert "T.Tensor((M, M * T.int64(2)), T.float32)" in repeated
+ assert "T.Tensor((M, M * 2), T.float32)" in repeated
assert "UNUSED" not in script
- assert "M = T.int64()" not in repeated
+ assert "M = T.int32()" not in repeated
assert len(func.params) == 1
assert not hasattr(func, "type_params")
assert func.attrs.get("tirx.type_vars") is None
@@ -176,10 +176,10 @@ def test_dynamic_int32_roundtrip():
A[0] = T.float32(1)
source = func.script()
- assert "def main[n: T.int32](" in source
+ assert "def main[n](" in source
assert 'n = T.dynamic("n", dtype="int32")' not in source
repeated = func.script()
- assert "def main[n: T.int32](" in repeated
+ assert "def main[n](" in repeated
tvm.ir.assert_structural_equal(
func, tvm.script.from_source(source, extra_vars={"I": tvm.script.ir, "T": tvm.script.tirx})
)
@@ -235,9 +235,9 @@ def test_dynamic_symbols_are_fresh_and_scope_independent():
assert T.dynamic is I.dynamic
n = T.dynamic("n")
same_name = T.dynamic("n")
- k = T.dynamic("k", "int32")
- assert n.ty.dtype == "int64"
- assert k.ty.dtype == "int32"
+ k = T.dynamic("k", "int64")
+ assert n.ty.dtype == "int32"
+ assert k.ty.dtype == "int64"
assert not n.same_as(same_name)
@I.ir_module
diff --git a/tests/python/tirx/script/test_tirx_script_tensors.py b/tests/python/tirx/script/test_tirx_script_tensors.py
index 156585653a..1a16265c0a 100644
--- a/tests/python/tirx/script/test_tirx_script_tensors.py
+++ b/tests/python/tirx/script/test_tirx_script_tensors.py
@@ -351,7 +351,7 @@ def test_tensor_shape_repeated_var_prints_out_of_line():
func = tvm.tirx.Function([tensor], tvm.ir.Evaluate(0))
code = func.script()
- assert "def main[n: T.int32](" in code
+ assert "def main[n](" in code
assert_structural_equal(func, from_source(code))
diff --git a/web/tests/python/prepare_test_libs.py b/web/tests/python/prepare_test_libs.py
index 8a1767bdc8..bf98ff9543 100644
--- a/web/tests/python/prepare_test_libs.py
+++ b/web/tests/python/prepare_test_libs.py
@@ -27,7 +27,7 @@ from tvm.script import relax as R
def prepare_relax_lib(base_path):
pipeline = relax.get_pipeline()
- n = I.dynamic("n")
+ n = I.dynamic("n", "int64")
@tvm.script.ir_module
class Mod: