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/01 12:16:26 UTC
(tvm) 02/03: [REFACTOR][Script] Use the value builder in buffer value fixtures
This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch tqchen/printer-doc-translation
in repository https://gitbox.apache.org/repos/asf/tvm.git
commit b2b513f9665da702e4f1dd89ad4c78148a2375ce
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Thu Oct 1 03:44:50 2026 +0000
[REFACTOR][Script] Use the value builder in buffer value fixtures
---
tests/python/s_tir/script/test_s_tir_script_ir_builder.py | 6 +++---
tests/python/s_tir/script/test_s_tir_script_printer.py | 8 ++++----
tests/python/s_tir/transform/test_s_tir_transform_thread_sync.py | 2 +-
tests/python/tirx/script/test_tirx_script_basic_usage.py | 4 ++--
tests/python/tirx/script/test_tirx_script_ir_builder.py | 4 ++--
tests/python/tirx/script/test_tirx_script_source_locations.py | 4 ++--
6 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/tests/python/s_tir/script/test_s_tir_script_ir_builder.py b/tests/python/s_tir/script/test_s_tir_script_ir_builder.py
index d57c4f9f7f..43195e6c98 100644
--- a/tests/python/s_tir/script/test_s_tir_script_ir_builder.py
+++ b/tests/python/s_tir/script/test_s_tir_script_ir_builder.py
@@ -138,10 +138,10 @@ def test_ir_builder_tir_block_base():
def test_ir_builder_tir_block_complete():
with IRBuilder() as ib:
a = T.int64()
- b = T.Buffer((128, 128), "float32")
- c = T.Buffer((128, 128), "float32")
+ b = T.buffer((128, 128), "float32")
+ c = T.buffer((128, 128), "float32")
d = T.int32()
- e = T.Buffer((128, 128), "float32")
+ e = T.buffer((128, 128), "float32")
f = T.int32()
with Ts.sblock("block"):
Ts.where(a > 1)
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 67827a68a1..7f10971818 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
@@ -1399,10 +1399,10 @@ def multiple_commreducer():
# normal_reduce_temp0 is treated as uninitialized value
@Ts.prim_func(check_well_formed=False)
def multiple_commreducer() -> None:
- normal_reduce_temp0 = T.Buffer([1], dtype="float32", strides=[1], scope="local")
- normal_reduce_temp1 = T.Buffer([1], dtype="float32", strides=[1], scope="local")
- reduce_temp0 = T.Buffer([1], dtype="float32", strides=[1], scope="local")
- reduce_temp1 = T.Buffer([1], dtype="float32", strides=[1], scope="local")
+ normal_reduce_temp0 = T.buffer([1], dtype="float32", strides=[1], scope="local")
+ normal_reduce_temp1 = T.buffer([1], dtype="float32", strides=[1], scope="local")
+ reduce_temp0 = T.buffer([1], dtype="float32", strides=[1], scope="local")
+ reduce_temp1 = T.buffer([1], dtype="float32", strides=[1], scope="local")
for ax0_1 in T.thread_binding(0, 32, thread="threadIdx.x"):
with Ts.sblock("T_softmax_maxelem_cross_thread_reduction"):
T.attr(
diff --git a/tests/python/s_tir/transform/test_s_tir_transform_thread_sync.py b/tests/python/s_tir/transform/test_s_tir_transform_thread_sync.py
index d1d5469437..93587b8022 100644
--- a/tests/python/s_tir/transform/test_s_tir_transform_thread_sync.py
+++ b/tests/python/s_tir/transform/test_s_tir_transform_thread_sync.py
@@ -45,7 +45,7 @@ def test_sync_read_thread_id_independent_location():
def func(p0_arg: T.Buffer((1, 2, 1, 1), "float32"), p1: T.Buffer(2, "float32")) -> None:
threadIdx_x = T.env_thread("threadIdx.x")
blockIdx_x = T.env_thread("blockIdx.x")
- p0 = T.Buffer([2], dtype="float32", data=p0_arg.data)
+ p0 = T.buffer([2], dtype="float32", data=p0_arg.data)
result_local = Ts.sblock_alloc_buffer([1], dtype="float32", scope="local")
temp_shared = Ts.sblock_alloc_buffer([1], dtype="float32", scope="shared")
T.launch_thread(blockIdx_x, 8)
diff --git a/tests/python/tirx/script/test_tirx_script_basic_usage.py b/tests/python/tirx/script/test_tirx_script_basic_usage.py
index 351799fd14..d9910eb366 100644
--- a/tests/python/tirx/script/test_tirx_script_basic_usage.py
+++ b/tests/python/tirx/script/test_tirx_script_basic_usage.py
@@ -58,14 +58,14 @@ def test_native_concise_scopes_unwind_with_their_parent():
def test_tir_buffer_annotation():
buffer_0 = T.Buffer((128, 128), "float32")
assert (
- tirx.is_buffer_var(buffer_0)
+ isinstance(buffer_0, tirx.BufferType)
and list(buffer_0.shape) == [128, 128]
and buffer_0.dtype == ir.PrimType("float32")
)
buffer_1 = T.Buffer((64, 64, 64), "int32")
assert (
- tirx.is_buffer_var(buffer_1)
+ isinstance(buffer_1, tirx.BufferType)
and list(buffer_1.shape) == [64, 64, 64]
and buffer_1.dtype == ir.PrimType("int32")
)
diff --git a/tests/python/tirx/script/test_tirx_script_ir_builder.py b/tests/python/tirx/script/test_tirx_script_ir_builder.py
index dfc75f4f73..fc6e80de6c 100644
--- a/tests/python/tirx/script/test_tirx_script_ir_builder.py
+++ b/tests/python/tirx/script/test_tirx_script_ir_builder.py
@@ -194,7 +194,7 @@ def test_ir_builder_tir_if_then_else():
def test_ir_builder_tir_buffer_store():
- buffer_a = T.Buffer((10, 10), "float32")
+ buffer_a = T.buffer((10, 10), "float32")
i = T.int32()
with IRBuilder() as ib:
T.buffer_store(buffer_a, 0.1, [0, i])
@@ -210,7 +210,7 @@ def test_ir_builder_tir_buffer_store():
def test_ir_builder_tir_buffer_store_scalable_vec():
- buffer_a = T.Buffer((30,), "float32")
+ buffer_a = T.buffer((30,), "float32")
value = T.broadcast(0.11, 4 * tvm.tirx.vscale())
index = T.ramp(0, 1, 4 * tvm.tirx.vscale())
diff --git a/tests/python/tirx/script/test_tirx_script_source_locations.py b/tests/python/tirx/script/test_tirx_script_source_locations.py
index 297a8c52c2..87cec0809c 100644
--- a/tests/python/tirx/script/test_tirx_script_source_locations.py
+++ b/tests/python/tirx/script/test_tirx_script_source_locations.py
@@ -246,7 +246,7 @@ def test_native_view_keeps_producer_identity_name_and_span(monkeypatch):
from tvm import ir, tirx
from tvm.script.ir_builder import base
- captured = T.Buffer((4, 4), "float32")
+ captured = T.buffer((4, 4), "float32")
original = type(captured).view
seen, produced, observed = [], [], []
span = ir.Span(ir.SourceName("producer.py"), 7, 7, 2, 19)
@@ -299,7 +299,7 @@ def test_native_binding_preserves_metadata_but_binds_buffer_expressions():
from tvm.script.ir_builder import base
producer_span = ir.Span(ir.SourceName("producer.py"), 7, 7, 2, 19)
- buffer = T.Buffer((4,), "float32")
+ buffer = T.buffer((4,), "float32")
base.at_(producer_span, buffer)
layout = T.TileLayout(T.S[4])