This is an automated email from the ASF dual-hosted git repository. tqchen pushed a commit to branch tvmscript-generic-parser-builder in repository https://gitbox.apache.org/repos/asf/tvm.git
commit 86585bff4ae393c6e9d894282bddc1a31c6147af Author: Tianqi Chen <[email protected]> AuthorDate: Mon Sep 21 00:54:39 2026 +0000 Preserve concrete device qualifiers and native loop defaults --- python/tvm/relax/script/builder_v2/__init__.py | 4 ++-- python/tvm/tirx/script/builder_v2/__init__.py | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/python/tvm/relax/script/builder_v2/__init__.py b/python/tvm/relax/script/builder_v2/__init__.py index 3b1f493cca..066de66265 100644 --- a/python/tvm/relax/script/builder_v2/__init__.py +++ b/python/tvm/relax/script/builder_v2/__init__.py @@ -47,8 +47,8 @@ def Tensor(shape=None, dtype=None, vdevice=None, ndim=-1, *, span=None): if isinstance(shape, _python.str) and dtype is None: dtype, shape = shape, None if isinstance(vdevice, _python.str): - target, _, index = vdevice.partition(":") - vdevice = _I.lookup_vdevice(target, int(index) if index else 0) + target, *qualifiers = vdevice.split(":", 2) + vdevice = _I.lookup_vdevice(target, int(qualifiers[0]) if qualifiers else 0) return _relax.TensorType(shape, dtype, vdevice, ndim, span) diff --git a/python/tvm/tirx/script/builder_v2/__init__.py b/python/tvm/tirx/script/builder_v2/__init__.py index de1fa0b758..c327ab543e 100644 --- a/python/tvm/tirx/script/builder_v2/__init__.py +++ b/python/tvm/tirx/script/builder_v2/__init__.py @@ -467,15 +467,11 @@ del _constructor def range_(*args): """Construct a serial loop from the source builtin range arguments.""" - if len(args) == 1: - start, stop, step = 0, args[0], 1 - elif len(args) == 2: - start, stop = args - step = 1 - elif len(args) == 3: - start, stop, step = args - else: + if len(args) in (1, 2): + return _T.serial(*args) + if len(args) != 3: raise TypeError("range expects one to three arguments") + start, stop, step = args if isinstance(step, _python.int) and step == 0: raise ValueError("range step cannot be zero") return _T.serial(start, stop, step=step)
