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/09/25 01:06:18 UTC

(tvm) branch main updated: [REFACTOR][Script] Give S-TIR its own construction namespace (#20437)

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 7188215f5c [REFACTOR][Script] Give S-TIR its own construction namespace (#20437)
7188215f5c is described below

commit 7188215f5c5d08685949f47c5a1290daa92d278a
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Thu Sep 24 21:06:12 2026 -0400

    [REFACTOR][Script] Give S-TIR its own construction namespace (#20437)
    
    Expose S-TIR through `tvm.s_tir.script` and `from tvm.script import
    s_tir as Ts`. Its Python and native builders own block construction,
    buffer normalization, function completion, and validation. Remove
    dialect mode switches from TIRx construction while sharing compatible
    operations through common frame hooks.
    
    Give TIRx an independent compilation pipeline and keep S-TIR pipeline
    selection with S-TIR. Update printed scripts and namespace call sites,
    and make codegen and TIRx cases construct TIRx directly.
---
 docs/arch/tvmscript.rst                            |  732 +----
 docs/deep_dive/relax/learning.rst                  |   19 +-
 docs/deep_dive/relax/tutorials/relax_creation.py   |   19 +-
 docs/deep_dive/tensor_ir/abstraction.rst           |   11 +-
 docs/deep_dive/tensor_ir/learning.rst              |   67 +-
 docs/deep_dive/tensor_ir/tutorials/tir_creation.py |   67 +-
 .../tensor_ir/tutorials/tir_transformation.py      |   21 +-
 .../tutorials/mix_python_and_tvm_with_pymodule.py  |   23 +-
 include/tvm/ir/function.h                          |    2 +-
 include/tvm/s_tir/script/builder/frame.h           |  178 ++
 include/tvm/s_tir/script/builder/ir.h              |  151 +
 include/tvm/tirx/script/builder/frame.h            |  142 +-
 include/tvm/tirx/script/builder/ir.h               |  113 +-
 include/tvm/tirx/transform.h                       |    9 +
 python/tvm/relax/backend/gpu_generic/cumsum.py     |   15 +-
 python/tvm/relax/backend/gpu_generic/sampling.py   |   43 +-
 python/tvm/relax/block_builder.py                  |   24 +-
 .../tvm/relax/frontend/nn/llm/_decode_kernels.py   |   99 +-
 python/tvm/relax/frontend/nn/llm/_kernel_common.py |   85 +-
 python/tvm/relax/frontend/nn/llm/_page_kernels.py  |   91 +-
 .../tvm/relax/frontend/nn/llm/_prefill_kernels.py  |  235 +-
 .../relax/frontend/nn/llm/position_embedding.py    |   39 +-
 python/tvm/relax/frontend/nn/llm/tree_attn.py      |  205 +-
 python/tvm/relax/frontend/nn/op.py                 |   21 +-
 .../tvm/relax/frontend/tflite/tflite_frontend.py   |   22 +-
 .../tvm/relax/transform/legalize_ops/inspect_op.py |    7 +-
 python/tvm/relax/transform/transform.py            |   28 +-
 python/tvm/s_tir/__init__.py                       |   27 +
 python/tvm/s_tir/backend/adreno/pipeline.py        |   25 +-
 python/tvm/s_tir/pipeline.py                       |   59 +-
 python/tvm/s_tir/schedule/schedule.py              |  841 ++---
 python/tvm/s_tir/script/__init__.py                |  100 +
 python/tvm/s_tir/script/ir_builder/__init__.py     |  103 +
 .../tvm/s_tir/script/ir_builder/_ffi_api.py        |   27 +-
 .../tvm/s_tir/script/ir_builder/frame.py           |   37 +-
 python/tvm/s_tir/script/ir_builder/ir.py           |  407 +++
 python/tvm/s_tir/tensor_intrin/arm_cpu.py          |  117 +-
 python/tvm/s_tir/tensor_intrin/cuda.py             |  257 +-
 .../tvm/s_tir/tensor_intrin/dot_product_common.py  |   21 +-
 python/tvm/s_tir/tensor_intrin/hexagon.py          |   81 +-
 python/tvm/s_tir/tensor_intrin/metal.py            |   81 +-
 python/tvm/s_tir/tensor_intrin/riscv_cpu.py        |   27 +-
 python/tvm/s_tir/tensor_intrin/rocm.py             |  113 +-
 python/tvm/s_tir/tensor_intrin/x86.py              |   29 +-
 python/tvm/script/ir_builder/parser_protocol.py    |    4 +-
 python/tvm/script/parser/entry.py                  |    8 +-
 python/tvm/te/operation.py                         |   14 +-
 python/tvm/tirx/build.py                           |   14 +-
 python/tvm/tirx/compilation_pipeline.py            |   98 +-
 python/tvm/tirx/function.py                        |    5 +
 python/tvm/tirx/script/ir_builder/frame.py         |   14 +-
 python/tvm/tirx/script/ir_builder/ir.py            |  420 +--
 .../tvm/tirx/script/ir_builder/parser_protocol.py  |   85 +-
 python/tvm/tirx/script/jit.py                      |    5 -
 python/tvm/tirx/transform/transform.py             |   22 +
 src/s_tir/script/builder/frame.cc                  |  161 +
 src/s_tir/script/builder/ir.cc                     |  309 ++
 .../script/builder}/script_complete.cc             |   27 +-
 .../script/builder}/script_complete.h              |   16 +-
 src/s_tir/script/builder/utils.h                   |   61 +
 src/s_tir/transform/lower_thread_allreduce.cc      |  982 +-----
 src/s_tir/transform/unify_thread_binding.cc        |  167 +-
 src/script/printer/script_printer.cc               |    8 +-
 src/script/printer/utils.h                         |   10 +
 src/te/operation/create_primfunc.cc                |   10 +-
 src/tirx/script/builder/frame.cc                   |  140 +-
 src/tirx/script/builder/ir.cc                      |  277 +-
 src/tirx/script/builder/utils.h                    |   21 -
 src/tirx/script/printer/block.cc                   |   16 +-
 src/tirx/script/printer/buffer.cc                  |    6 +-
 src/tirx/script/printer/function.cc                |    9 +-
 .../lower_thread_allreduce.cc}                     |   28 +-
 .../transform/lower_thread_allreduce.h}            |  123 +-
 src/tirx/transform/lower_tirx_opaque.cc            |    4 +-
 .../unify_thread_binding.cc}                       |   35 +-
 .../transform/unify_thread_binding.h}              |   60 +-
 tests/python/codegen/test_codegen_assert.py        |   16 +-
 .../python/codegen/test_codegen_error_handling.py  |   28 +-
 tests/python/codegen/test_gpu_codegen_allreduce.py |   47 +-
 tests/python/codegen/test_inject_ptx_ldg32.py      |   18 +-
 tests/python/codegen/test_target_codegen.py        |   15 +-
 .../python/codegen/test_target_codegen_aarch64.py  |  150 +-
 tests/python/codegen/test_target_codegen_arm.py    |   40 +-
 tests/python/codegen/test_target_codegen_blob.py   |    4 +-
 tests/python/codegen/test_target_codegen_bool.py   |   42 +-
 tests/python/codegen/test_target_codegen_c_host.py |   68 +-
 .../codegen/test_target_codegen_cross_llvm.py      |   10 +-
 tests/python/codegen/test_target_codegen_cuda.py   |  342 +--
 .../python/codegen/test_target_codegen_cuda_fp4.py |  133 +-
 .../python/codegen/test_target_codegen_cuda_fp8.py |  623 +---
 tests/python/codegen/test_target_codegen_device.py |   32 +-
 tests/python/codegen/test_target_codegen_extern.py |    6 +-
 .../codegen/test_target_codegen_gpu_common.py      |   10 +-
 .../python/codegen/test_target_codegen_hexagon.py  |   30 +-
 tests/python/codegen/test_target_codegen_llvm.py   |  390 +--
 .../python/codegen/test_target_codegen_llvm_vla.py |   10 +-
 tests/python/codegen/test_target_codegen_metal.py  |  118 +-
 tests/python/codegen/test_target_codegen_opencl.py |  110 +-
 tests/python/codegen/test_target_codegen_riscv.py  |   22 +-
 tests/python/codegen/test_target_codegen_rocm.py   |   55 +-
 .../codegen/test_target_codegen_static_init.py     |    2 +-
 tests/python/codegen/test_target_codegen_vulkan.py |  201 +-
 tests/python/codegen/test_target_codegen_webgpu.py |   28 +-
 tests/python/codegen/test_target_codegen_x86.py    |   10 +-
 .../contrib/test_android/test_meta_schedule.py     |    9 +-
 .../python/contrib/test_tir_triton_integration.py  |   21 +-
 tests/python/disco/test_callback.py                |   15 +-
 tests/python/disco/test_nvshmem.py                 |   23 +-
 tests/python/disco/test_session.py                 |   23 +-
 tests/python/driver/test_compile.py                |    3 +-
 tests/python/ir/test_datatype_nv_fp8.py            |    7 +-
 tests/python/ir/test_pass_instrument.py            |    9 +-
 tests/python/relax/backend/adreno/mod_utils.py     |   45 +-
 .../test_transform_fold_vdevice_scope_change.py    |   85 +-
 .../test_distributed_transform_lower_distir.py     |  189 +-
 ...ributed_transform_lower_global_to_local_view.py |  733 ++---
 ...est_distributed_transform_propagate_sharding.py |  519 ++--
 .../test_distributed_tvmscript_parser.py           |   25 +-
 .../test_distributed_tvmscript_printer.py          |   22 +-
 tests/python/relax/test_analysis.py                |  149 +-
 .../python/relax/test_analysis_detect_recursion.py |   13 +-
 .../relax/test_analysis_estimate_memory_usage.py   |   13 +-
 .../test_analysis_suggest_layout_transforms.py     |  429 +--
 tests/python/relax/test_analysis_well_formed.py    |  169 +-
 tests/python/relax/test_ast_printer.py             |    7 +-
 .../python/relax/test_backend_dispatch_sampling.py |   73 +-
 .../relax/test_backend_transform_shape_lower.py    |    9 +-
 tests/python/relax/test_base_py_module_printer.py  |   21 +-
 .../relax/test_base_py_module_symbolic_shape.py    |    5 +-
 tests/python/relax/test_blockbuilder_emit_te.py    |   19 +-
 tests/python/relax/test_codegen_cutlass.py         |  261 +-
 tests/python/relax/test_dataflow_inplace.py        |  121 +-
 tests/python/relax/test_dataflow_pattern.py        |   21 +-
 tests/python/relax/test_dataflow_rewriter.py       |   11 +-
 tests/python/relax/test_dlpack_integration.py      |    5 +-
 ...eliminate_pad_branch_using_buffer_assumption.py |  199 +-
 tests/python/relax/test_frontend_common.py         |   37 +-
 tests/python/relax/test_frontend_dynamo.py         |   51 +-
 tests/python/relax/test_frontend_nn_op.py          |  107 +-
 tests/python/relax/test_frontend_onnx.py           |   41 +-
 tests/python/relax/test_op_index.py                |   27 +-
 tests/python/relax/test_op_misc.py                 |    7 +-
 .../python/relax/test_optimize_layout_transform.py |  109 +-
 tests/python/relax/test_pytorch_integration.py     |   11 +-
 .../python/relax/test_relax_to_pyfunc_converter.py |   11 +-
 .../python/relax/test_runtime_builtin_rnn_state.py |   13 +-
 tests/python/relax/test_tir_call_source_kernel.py  |   21 +-
 tests/python/relax/test_transform.py               |   83 +-
 tests/python/relax/test_transform_alter_op_impl.py |  221 +-
 .../test_transform_annotate_tir_op_pattern.py      |  185 +-
 ...st_transform_attach_attr_layout_free_buffers.py |   71 +-
 .../relax/test_transform_attach_global_symbol.py   |   21 +-
 tests/python/relax/test_transform_bind_params.py   |   13 +-
 tests/python/relax/test_transform_codegen_pass.py  |    3 +-
 .../relax/test_transform_compute_prim_value.py     |    5 +-
 tests/python/relax/test_transform_cse.py           |   75 +-
 .../relax/test_transform_dead_code_elimination.py  |   55 +-
 tests/python/relax/test_transform_fold_constant.py |   67 +-
 tests/python/relax/test_transform_fuse_ops.py      |  483 +--
 .../relax/test_transform_fuse_ops_by_pattern.py    |   57 +-
 tests/python/relax/test_transform_fuse_tir.py      |  575 ++--
 .../relax/test_transform_fuse_transpose_matmul.py  |   37 +-
 tests/python/relax/test_transform_gradient.py      |  113 +-
 .../relax/test_transform_gradient_te_register.py   |  123 +-
 tests/python/relax/test_transform_lambda_lift.py   |   45 +-
 .../relax/test_transform_lazy_transform_params.py  |  215 +-
 tests/python/relax/test_transform_legalize_ops.py  |   97 +-
 .../relax/test_transform_legalize_ops_binary.py    |  617 ++--
 .../relax/test_transform_legalize_ops_ccl.py       |   33 +-
 .../test_transform_legalize_ops_create_datatype.py |  245 +-
 .../test_transform_legalize_ops_distributed.py     |   15 +-
 .../relax/test_transform_legalize_ops_grad.py      |  237 +-
 .../relax/test_transform_legalize_ops_image.py     |   37 +-
 ..._transform_legalize_ops_index_linear_algebra.py |  285 +-
 .../test_transform_legalize_ops_manipulate.py      |  581 ++--
 .../python/relax/test_transform_legalize_ops_nn.py | 3215 ++++++++++----------
 .../relax/test_transform_legalize_ops_qdq.py       |  133 +-
 ...st_transform_legalize_ops_search_statistical.py |  709 ++---
 .../relax/test_transform_lift_transform_params.py  |  113 +-
 .../test_transform_merge_composite_functions.py    |   21 +-
 .../test_transform_meta_schedule_apply_database.py |   25 +-
 .../relax/test_transform_meta_schedule_tuning.py   |   47 +-
 .../relax/test_transform_normalize_global_var.py   |    5 +-
 ...st_transform_operator_specific_normalization.py |   21 +-
 .../relax/test_transform_rewrite_cuda_graph.py     |  193 +-
 .../test_transform_rewrite_dataflow_reshape.py     |  231 +-
 ...nsform_specialize_primfunc_based_on_callsite.py |   55 +-
 .../test_transform_split_layout_rewrite_preproc.py |  115 +-
 .../test_transform_static_plan_block_memory.py     |  201 +-
 .../relax/test_transform_to_mixed_precision.py     |   67 +-
 tests/python/relax/test_tvmscript_parser.py        |  127 +-
 tests/python/relax/test_tvmscript_printer_relax.py |   19 +-
 tests/python/relax/test_tvmscript_pyfunc.py        |    9 +-
 .../relax/test_vm_alloc_storage_with_scope.py      |   15 +-
 tests/python/relax/test_vm_build.py                |   61 +-
 tests/python/relax/test_vm_codegen_only.py         |   25 +-
 tests/python/relax/test_vm_codegen_tir.py          |   15 +-
 tests/python/relax/test_vm_cuda_graph.py           |   13 +-
 tests/python/relax/texture/test_texture_nd.py      |    9 +-
 tests/python/runtime/test_executable.py            |    3 +-
 tests/python/runtime/test_runtime_extension.py     |    3 +-
 tests/python/runtime/test_runtime_rpc.py           |    5 +-
 ...st_s_tir_analysis_calculate_allocated_memory.py |   33 +-
 .../test_s_tir_analysis_estimate_tir_flops.py      |   15 +-
 .../test_s_tir_analysis_identify_memcpy.py         |   35 +-
 .../test_s_tir_analysis_is_pure_function.py        |   19 +-
 .../s_tir/analysis/test_s_tir_analysis_oob.py      |   11 +-
 .../test_s_tir_analysis_verify_block_scope.py      |  153 +
 .../s_tir/analysis/test_sblock_access_region.py    |  241 +-
 .../analysis/test_sblock_buffer_access_lca.py      |   55 +-
 .../python/s_tir/base/test_compilation_pipeline.py |   69 +
 .../base/test_pipeline_iket_isolation.py}          |   31 +-
 .../base/test_s_tir_texture_scope.py}              |   16 +-
 .../s_tir/base/test_sblock_dependence_info.py      |   37 +-
 .../s_tir/base/test_tir_te_extern_primfunc.py      |   41 +-
 tests/python/s_tir/dlight/test_benchmark.py        |  117 +-
 tests/python/s_tir/dlight/test_cpu_gemv.py         |  507 +--
 tests/python/s_tir/dlight/test_cpu_reduction.py    |    4 +-
 tests/python/s_tir/dlight/test_gpu_conv.py         |   73 +-
 tests/python/s_tir/dlight/test_gpu_fallback.py     |  161 +-
 tests/python/s_tir/dlight/test_gpu_gemv.py         | 1133 +++----
 .../s_tir/dlight/test_gpu_general_reduction.py     |  653 ++--
 .../python/s_tir/dlight/test_gpu_low_batch_gemv.py |  557 ++--
 tests/python/s_tir/dlight/test_gpu_matmul.py       |  853 +++---
 .../s_tir/dlight/test_gpu_matmul_tensorize.py      | 1013 +++---
 tests/python/s_tir/dlight/test_gpu_reduction.py    | 1233 ++++----
 tests/python/s_tir/dlight/test_gpu_rmsnorm.py      |  309 +-
 tests/python/s_tir/dlight/test_gpu_transpose.py    |  145 +-
 tests/python/s_tir/dlight/test_primitives.py       |   33 +-
 .../meta_schedule/test_meta_schedule_arg_info.py   |    9 +-
 .../meta_schedule/test_meta_schedule_builder.py    |   31 +-
 .../meta_schedule/test_meta_schedule_cost_model.py |   19 +-
 .../meta_schedule/test_meta_schedule_database.py   |   23 +-
 ...schedule_feature_extractor_per_store_feature.py |   67 +-
 .../test_meta_schedule_measure_callback.py         |    9 +-
 .../test_meta_schedule_mma_tensorize.py            |   17 +-
 ...eta_schedule_mutator_mutate_compute_location.py |   25 +-
 .../test_meta_schedule_mutator_mutate_parallel.py  |    9 +-
 ..._meta_schedule_mutator_mutate_thread_binding.py |    7 +-
 .../test_meta_schedule_mutator_mutate_tile_size.py |    9 +-
 .../test_meta_schedule_mutator_mutate_unroll.py    |    9 +-
 .../test_meta_schedule_post_order_apply.py         |   63 +-
 ...ule_postproc_disallow_async_strided_mem_copy.py |    9 +-
 ...meta_schedule_postproc_disallow_dynamic_loop.py |   17 +-
 ..._schedule_postproc_rewrite_cooperative_fetch.py |  111 +-
 .../test_meta_schedule_postproc_rewrite_layout.py  |  485 +--
 ...e_postproc_rewrite_parallel_vectorize_unroll.py |  221 +-
 ...ta_schedule_postproc_rewrite_reduction_block.py |  163 +-
 ...est_meta_schedule_postproc_rewrite_tensorize.py |  253 +-
 ...meta_schedule_postproc_rewrite_unbound_block.py |  145 +-
 .../test_meta_schedule_postproc_verify_gpu_code.py |  321 +-
 ...est_meta_schedule_postproc_verify_vtcm_limit.py |   99 +-
 .../meta_schedule/test_meta_schedule_runner.py     |   45 +-
 ...test_meta_schedule_schedule_rule_add_rfactor.py |  149 +-
 ...eta_schedule_schedule_rule_apply_custom_rule.py |   11 +-
 .../test_meta_schedule_schedule_rule_auto_bind.py  |   61 +-
 ...test_meta_schedule_schedule_rule_auto_inline.py |  449 +--
 ...chedule_schedule_rule_cross_thread_reduction.py |  551 ++--
 .../test_meta_schedule_schedule_rule_mlt.py        |  499 +--
 .../test_meta_schedule_schedule_rule_mlt_intrin.py |  281 +-
 .../test_meta_schedule_schedule_rule_mlt_tc.py     | 1481 ++++-----
 ...dule_schedule_rule_parallel_vectorize_unroll.py |  255 +-
 ...hedule_schedule_rule_random_compute_location.py |   55 +-
 .../test_meta_schedule_search_strategy.py          |   17 +-
 .../meta_schedule/test_meta_schedule_space_cpu.py  | 2613 ++++++++--------
 .../meta_schedule/test_meta_schedule_space_cuda.py | 1217 ++++----
 .../test_meta_schedule_space_cuda_async.py         |  321 +-
 .../test_meta_schedule_space_generator.py          |    9 +-
 .../test_meta_schedule_space_post_opt.py           |    9 +-
 .../test_meta_schedule_task_scheduler.py           |   31 +-
 .../test_meta_schedule_trace_apply.py              | 2123 ++++++-------
 .../test_meta_schedule_tune_context.py             |    9 +-
 .../meta_schedule/test_meta_schedule_tune_tir.py   |   21 +-
 .../s_tir/schedule/test_tir_schedule_analysis.py   |   79 +-
 .../test_tir_schedule_annotate_buffer_access.py    |  239 +-
 .../schedule/test_tir_schedule_block_scope.py      |   33 +-
 .../s_tir/schedule/test_tir_schedule_blockize.py   |  269 +-
 .../schedule/test_tir_schedule_cache_index.py      |   87 +-
 .../schedule/test_tir_schedule_cache_read_write.py | 1253 ++++----
 .../s_tir/schedule/test_tir_schedule_compute_at.py | 1417 ++++-----
 .../schedule/test_tir_schedule_compute_inline.py   | 1125 +++----
 .../test_tir_schedule_decompose_padding.py         |  271 +-
 .../s_tir/schedule/test_tir_schedule_error.py      |   19 +-
 .../s_tir/schedule/test_tir_schedule_for_kind.py   |  367 +--
 .../test_tir_schedule_fuse_reduction_epilogue.py   |  125 +-
 ...ir_schedule_fuse_reduction_epilogue_clipping.py |   99 +-
 ...st_tir_schedule_fuse_reduction_epilogue_relu.py |   85 +-
 .../s_tir/schedule/test_tir_schedule_merge.py      |  165 +-
 .../s_tir/schedule/test_tir_schedule_pad_einsum.py |  199 +-
 .../s_tir/schedule/test_tir_schedule_partition.py  |  397 +--
 .../schedule/test_tir_schedule_read_write_at.py    |  149 +-
 .../s_tir/schedule/test_tir_schedule_reduction.py  |  281 +-
 .../s_tir/schedule/test_tir_schedule_reindex.py    |  199 +-
 .../s_tir/schedule/test_tir_schedule_reorder.py    |  199 +-
 .../test_tir_schedule_reorder_block_iter_var.py    |   21 +-
 .../s_tir/schedule/test_tir_schedule_rfactor.py    | 1015 +++---
 .../schedule/test_tir_schedule_rolling_buffer.py   |  483 +--
 .../s_tir/schedule/test_tir_schedule_sampling.py   |   41 +-
 .../s_tir/schedule/test_tir_schedule_set_dtype.py  |   65 +-
 .../s_tir/schedule/test_tir_schedule_set_scope.py  |   49 +-
 .../s_tir/schedule/test_tir_schedule_split_fuse.py |  351 +--
 .../s_tir/schedule/test_tir_schedule_state.py      |   53 +-
 .../test_tir_schedule_state_cached_flags.py        |  383 +--
 .../schedule/test_tir_schedule_storage_align.py    |   83 +-
 .../s_tir/schedule/test_tir_schedule_tensorize.py  |  285 +-
 .../s_tir/schedule/test_tir_schedule_trace.py      |   33 +-
 .../s_tir/schedule/test_tir_schedule_transform.py  |   69 +-
 .../schedule/test_tir_schedule_transform_layout.py |  545 ++--
 .../s_tir/schedule/test_tir_schedule_utilities.py  |  111 +-
 .../test_tir_unsafe_hide_buffer_access.py          |   31 +-
 tests/python/s_tir/test_arith_domain_touched.py    |    5 +-
 tests/python/s_tir/test_s_tir_renew_defs.py        |   41 +-
 ...test_s_tir_transform_annotate_irregular_loop.py |   33 +-
 .../test_s_tir_transform_canonicalize_loop.py      |   13 +-
 .../test_s_tir_transform_compact_buffer_region.py  |  827 ++---
 ...est_s_tir_transform_convert_blocks_to_opaque.py |   55 +-
 .../test_s_tir_transform_default_gpu_schedule.py   |  319 +-
 ...st_s_tir_transform_force_narrow_index_to_i32.py |   67 +-
 .../test_s_tir_transform_hoist_expression.py       |   79 +-
 .../transform/test_s_tir_transform_hoist_if.py     |   35 +-
 .../test_s_tir_transform_inject_double_buffer.py   |    9 +-
 .../test_s_tir_transform_inject_permuted_layout.py |  289 +-
 .../test_s_tir_transform_inject_ptx_async_copy.py  |  173 +-
 .../test_s_tir_transform_inject_ptx_ldg32.py       |    5 +-
 ...est_s_tir_transform_inject_software_pipeline.py | 1755 +++++------
 .../test_s_tir_transform_inject_virtual_thread.py  |   15 +-
 .../test_s_tir_transform_lift_thread_binding.py    |  147 +-
 .../test_s_tir_transform_loop_partition.py         |   73 +-
 ...s_tir_transform_lower_cross_thread_reduction.py | 1403 ++++-----
 .../test_s_tir_transform_lower_init_block.py       |   37 +-
 .../test_s_tir_transform_lower_match_buffer.py     |  207 +-
 .../test_s_tir_transform_lower_opaque_block.py     |  179 +-
 ...test_s_tir_transform_lower_thread_all_reduce.py |   29 +-
 ...transform_manifest_shared_memory_local_stage.py |   85 +-
 ...st_s_tir_transform_memhammer_lower_auto_copy.py |  349 +--
 ...form_merge_dynamic_shared_memory_allocations.py |   17 +-
 ...sform_plan_update_buffer_allocation_location.py |  293 +-
 .../test_s_tir_transform_profiling_instr.py        |  123 +-
 .../transform/test_s_tir_transform_remove_undef.py |   19 +-
 ...transform_remove_weight_layout_rewrite_block.py |   55 +-
 ...st_s_tir_transform_renormalize_split_pattern.py |   11 +-
 .../test_s_tir_transform_rewrite_unsafe_select.py  |    9 +-
 .../transform/test_s_tir_transform_thread_sync.py  |   61 +-
 .../test_s_tir_transform_unify_thread_binding.py   |   79 +-
 .../test_tirx_force_narrow_reject_blocks.py}       |   33 +-
 tests/python/target/test_arm_target.py             |    9 +-
 tests/python/target/test_target_target.py          |    3 +-
 tests/python/te/test_te_create_primfunc.py         |  317 +-
 .../test_tir_analysis_verify_well_formed.py        |  199 +-
 tests/python/tirx-base/test_tir_base.py            |    6 +-
 tests/python/tirx-base/test_tir_host_func.py       |   22 +-
 tests/python/tirx-base/test_tir_imm_values.py      |   54 +-
 tests/python/tirx-base/test_tir_intrin.py          |  151 +-
 tests/python/tirx-base/test_tir_ptx_cp_async.py    |   29 +-
 .../tirx-base/test_tir_ptx_griddepcontrol.py       |   11 +-
 tests/python/tirx-base/test_tir_ptx_ldmatrix.py    |   44 +-
 tests/python/tirx-base/test_tir_ptx_mma.py         |  102 +-
 tests/python/tirx-base/test_tir_ptx_mma_sp.py      |   16 +-
 .../tirx-base/test_tir_ptx_scalar_f32_math.py      |   11 +-
 .../python/tirx-base/test_tir_scalable_datatype.py |    2 +-
 tests/python/tirx-base/test_tir_specialize.py      |  133 +-
 .../tirx-base/test_tir_stmt_functor_substitute.py  |   36 +-
 tests/python/tirx-base/test_tir_texture_scope.py   |   68 +-
 .../test_tir_inline_private_functions.py           |   63 +-
 .../test_tir_transform_bf16_legalize.py            |   32 +-
 .../test_tir_transform_common_subexpr_elim.py      |   70 +-
 .../test_tir_transform_convert_ssa.py              |   56 +-
 .../test_tir_transform_flatten_buffer.py           |  187 +-
 ...test_tir_transform_force_narrow_index_to_i32.py |  325 +-
 .../test_tir_transform_fp8_legalize.py             |    8 +-
 .../tirx-transform/test_tir_transform_helpers.py   |   44 +-
 .../test_tir_transform_lower_tvm_builtin.py        |   26 +-
 .../test_tir_transform_make_packed_api.py          |   34 +-
 .../test_tir_transform_narrow_datatype.py          |  101 +-
 ...est_tir_transform_pointer_value_type_rewrite.py |   28 +-
 .../test_tir_transform_remove_assume.py            |    8 +-
 .../test_tir_transform_remove_no_op.py             |   76 +-
 .../tirx-transform/test_tir_transform_simplify.py  |  198 +-
 .../test_tir_transform_split_host_device.py        |  100 +-
 .../test_tir_transform_storage_rewrite.py          |   40 +-
 .../test_tir_transform_unroll_loop.py              |   14 +-
 .../tirx-transform/test_tir_transform_vectorize.py |  106 +-
 tests/python/tirx/iket/test_iket_profiler.py       |   22 +-
 tests/python/tirx/test_buffer_print.py             |  121 +-
 tests/python/tirx/test_compilation_pipeline.py     |   68 +
 tests/python/tirx/test_parser_printer.py           |    8 +-
 tests/python/tvmscript/test_tvmscript_complete.py  |  151 +-
 .../tvmscript/test_tvmscript_error_report.py       |  181 +-
 .../tvmscript/test_tvmscript_ir_builder_tir.py     |   44 +-
 .../tvmscript/test_tvmscript_meta_programming.py   |   29 +-
 tests/python/tvmscript/test_tvmscript_ops.py       |   35 +-
 .../tvmscript/test_tvmscript_parser_source.py      |    7 +-
 .../python/tvmscript/test_tvmscript_parser_tir.py  |  207 +-
 .../tvmscript/test_tvmscript_pep563_closure.py     |   31 +-
 .../tvmscript/test_tvmscript_printer_annotation.py |   14 +-
 .../tvmscript/test_tvmscript_printer_highlight.py  |    9 +-
 .../python/tvmscript/test_tvmscript_printer_ir.py  |    6 +-
 .../tvmscript/test_tvmscript_printer_metadata.py   |    6 +-
 .../test_tvmscript_printer_structural_equal.py     |   25 +-
 .../python/tvmscript/test_tvmscript_printer_tir.py |  192 +-
 .../test_tvmscript_printer_underlining.py          |   32 +-
 .../python/tvmscript/test_tvmscript_regression.py  |   29 +-
 tests/python/tvmscript/test_tvmscript_roundtrip.py |  377 +--
 .../tvmscript/test_tvmscript_s_tir_namespace.py    |  228 ++
 .../tvmscript/test_tvmscript_syntax_sugar.py       |  185 +-
 tests/python/tvmscript/test_tvmscript_type.py      |   93 +-
 406 files changed, 32519 insertions(+), 34065 deletions(-)

diff --git a/docs/arch/tvmscript.rst b/docs/arch/tvmscript.rst
index cead1d0582..7ee7e4556e 100644
--- a/docs/arch/tvmscript.rst
+++ b/docs/arch/tvmscript.rst
@@ -20,692 +20,102 @@
 TVMScript
 =========
 
-TVMScript is a Python-based domain-specific language (DSL) for writing TVM IR. It lets users
-define ``IRModule``\ s — containing both Relax functions and TIR ``PrimFunc``\ s — using
-familiar Python syntax. Decorators acquire the source and its definition context. A syntax
-transpiler translates the Python AST into a Python builder program; executing that program
-constructs TVM IR. The scripted function body is therefore translated before execution.
-
-TVMScript serves two roles in the TVM stack:
-
-- **Authoring**: users write TIR kernels and Relax programs directly in TVMScript.
-- **Roundtrip**: ``mod.script()`` prints IR as TVMScript, which can be re-parsed with any
-  required external symbols to reconstruct equivalent IR. This supports inspection,
-  debugging, and serialization of printable IR.
-
-
-Overview
---------
-
-TVMScript separates source acquisition, syntax translation, IR construction, and printing:
+TVMScript expresses TVM IR with Python syntax. A shared frontend translates source
+into a Python builder program; executing that program constructs IR. A separate
+printer converts IR back into readable, parseable source.
 
 .. code-block:: text
 
-   Parsing (Python source → TVM IR):
-
-   Python source (TVMScript)
-        │
-        ▼  Frontend: source + definition context
-        │
-   Python AST
-        │
-        ▼  Syntax transpiler + construction protocol
-        │
-   Generated Python builder program
-        │
-        ▼  Frontend: recompose and execute callable
-        │
-        ▼  IR builders (frame stack + dialect policy)
-        │
-   TVM IR (IRModule, PrimFunc, relax.Function)
-
-
-   Printing (TVM IR → Python source):
-
+   Source + definition context
+       → Python AST → syntax transpiler → Python builder program → TVM IR
    TVM IR
-        │
-        ▼  IRDocsifier (C++, dispatch by token + type)
-        │
-   Doc tree (ExprDoc, StmtDoc, ...)
-        │
-        ▼  DocToPythonScript
-        │
-   TVMScript text
-
-- **Frontend** (Python): captures definition context, acquires source, and composes the
-  generated callable with its lexical environment. It owns decorators, helper entry points,
-  and execution of the builder program.
-- **Syntax transpiler** (Python): rewrites Python AST nodes into calls on the selected
-  construction namespace. It preserves source scopes, evaluation order, and locations.
-- **IR builders** (Python + C++): own typed values, symbol identity, dialect policy, and
-  construction frames. Exiting a frame finalizes its IR and attaches it to its parent.
-- **Printer** (C++): converts IR to a ``Doc`` tree and formats it as Python syntax. The
-  printer's Doc tree is separate from the Python AST used for parsing.
-
-All source entry points use the canonical ``tvm.script.parser`` implementation.
-
-
-Decorators
-----------
-
-TVMScript uses three import aliases by convention:
-
-.. code-block:: python
-
-   from tvm.script import ir as I       # module-level constructs
-   from tvm.script import tirx as T     # TIR constructs
-   from tvm.script import relax as R    # Relax constructs
-   from tvm.script.parser.entry import make_macro_decorator
-   from tvm.target import Target
-
-These are public authoring APIs. ``Target`` configures compilation targets; it remains in
-``tvm.target``. Public dialect namespaces expose decorators and source constructors, so
-scripted programs do not need direct imports from builder implementation packages.
-
-The primary decorators are:
+       → IRDocsifier → Doc tree → Python text
 
-- ``@I.ir_module``: marks a Python class as an ``IRModule``. Each method inside becomes a
-  function in the module.
-- ``@T.prim_func``: marks a function as a TIR ``PrimFunc``.
-- ``@R.function``: marks a function as a ``relax.Function``.
-
-These can be composed:
-
-.. code-block:: python
-
-   @I.ir_module
-   class MyModule:
-       @T.prim_func(s_tir=True)
-       def add_kernel(A: T.Buffer((128,), "float32"),
-                      B: T.Buffer((128,), "float32"),
-                      C: T.Buffer((128,), "float32")):
-           for i in range(128):
-               with T.sblock("compute"):
-                   vi = T.axis.spatial(128, i)
-                   C[vi] = A[vi] + B[vi]
-
-       @R.function
-       def main(x: R.Tensor((128,), "float32"),
-                y: R.Tensor((128,), "float32")) -> R.Tensor((128,), "float32"):
-           with R.dataflow():
-               out = R.call_tir(MyModule.add_kernel, (x, y),
-                                out_ty=R.Tensor((128,), "float32"))
-               R.output(out)
-           return out
-
-Python creates the class before invoking ``@I.ir_module``. Function decorators inside an
-IR-module class retain method definitions for module construction. The module frontend then
-acquires the source and constructs declarations and bodies in the module's builder context.
-Standalone ``@T.prim_func`` and ``@R.function`` definitions construct their IR immediately.
-
-A helper can construct expressions or statements in the caller's active builder frames:
-
-.. code-block:: python
-
-   @make_macro_decorator(T)
-   def add_one(value):
-       return value + 1
-
-Unlike a function decorator, ``make_macro_decorator`` does not create an IR function for
-each helper. Its default return behavior is ordinary Python return from the generated
-helper program.
-``T.inline`` and the dialect macro decorators are supplied through the same frontend helper
-mechanism.
-
-
-Parser Architecture
+Source and frontend
 -------------------
 
-The parser lives in ``python/tvm/script/parser/``. ``inspect_source.py`` owns source
-acquisition, the ``Source`` representation and its coordinate helpers, and definition-context
-capture. Documented functions in ``entry.py`` manage the parse sequence, callable composition
-and execution.
-The transpiler handles syntax; the builders interpret concrete values. TIRx JIT validation,
-defaults and specialization caching live in ``tvm.tirx.script.jit``; shared parser utilities
-remain independent of that policy.
-
-Syntax and construction protocol
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-A registered function decorator selects a construction namespace. The same Python syntax
-then lowers to operations supplied by that namespace: for example, unmarked ``if`` creates
-TIR control-flow frames in a primitive function and Relax control-flow frames in a Relax
-function. The transpiler emits these operations without implementing dialect IR semantics.
-
-``parser/protocol_registry.py`` owns callable syntax metadata and registration. Argument policies such
-as ``expr_str`` translate symbolic strings written directly in source expressions.
-Global-info selectors use the builder decorator
-:func:`tvm.script.ir_builder.resolve_global_info_args`, which resolves named string arguments
-through an explicit dialect callback after ordinary Python argument evaluation. Captured
-aliases and unpacked calls use the same decorator. Dtype and placement strings remain literal. Captured or computed symbolic shapes must already contain explicit IR variables;
-the parser does not interpret expression strings found inside captured values.
-Registration keeps syntax facts in simple dictionaries keyed by canonical namespace paths.
-Known namespace aliases normalize to the registered path; ordinary captured callables,
-local aliases, methods and closures execute as Python without marker inference. The
-dictionaries retain no source functions or parse captures. Dialects own their namespace
-exports, entry points and aliases and register them with the generic parser.
-The registry selects a call's argument policy before traversal and reuses positional
-parameter names computed once at registration;
-``parser/expr_str_handling.py`` decodes annotation/expression strings and maps their
-escaped, multiline and UTF-8 source ranges. The main visitor rewrites the decoded syntax.
-
-Assignments become binding operations, standalone expressions become emission operations,
-and loops and scopes become builder contexts. An ordinary assignment passes its evaluated
-RHS and a separate ``value_span`` to ``bind_``, without first stamping the returned value.
-The binding target has its own span. TIRx preserves returned Vars, including BufferVars,
-and ordinary metadata objects; other expressions follow the dialect's binding rules.
-Construction still runs in the source context, and nested expressions retain their locations.
-Concrete binding, type checking, comparison construction, and frame finalization belong to
-the builders. Ordinary host calls and
-operator overloads execute as part of the generated Python program.
-
-Loop frames create their named variables during construction. Entering a frame returns
-the variable directly for one dimension and the variable sequence for multiple dimensions,
-so ordinary Python uses ``with T.serial(0, n) as i``. Generated scalar loops use the same
-entry form. Generated tuple, list and starred targets unpack the entered frame's stable
-``vars`` sequence, preserving explicit one-dimensional unpacking and native variable identity.
-
-Parser syntax restrictions raise ``SyntaxError`` with the original filename and source
-range. Python helper and builder exceptions propagate unchanged, preserving their identity,
-type and source-mapped traceback. Temporary parser contexts are released on both successful
-and exceptional exits.
-
-Parse flow
-~~~~~~~~~~
-
-The public entry points include ``tvm.script.parse`` and ``tvm.script.from_source``:
-
-1. **Acquire source and context**: the frontend accepts a function, class, or source string,
-   obtains its Python AST, and retains source locations. Decorators capture the definition
-   context temporarily through ``definition_scope``; source-string callers can supply
-   external bindings through ``extra_vars``. Source inspection belongs to
-   ``parser.inspect_source``.
-2. **Prescan and translate syntax**: acquisition supplies a fresh owned AST. One
-   ``PrescanCollector`` produces read-only ``PrescanContext`` facts for reserved names,
-   scoped declarations and conditional outputs. ``IRBuilderTranspiler`` rewrites that owned
-   tree with the standard Python AST visitor, using fixed namespace metadata and registered
-   argument policies without copying or reparsing the tree. One shared name allocator
-   avoids collisions with user identifiers through rewriting and recomposition.
-3. **Compose the callable**: the private frontend helper ``_recompose_builder`` compiles
-   the generated program with the source's globals, closure bindings, and necessary
-   annotation context. Explicit temporary phase inputs connect generated helpers to
-   their source functions without rediscovering them through a generated-AST walk.
-4. **Execute construction**: the callable enters native builder frames and reconstructs
-   declarations and annotations in their required context. When forward declarations are
-   needed, it declares all signatures first. Inside each retained native function frame,
-   it defines and calls a lexical body helper without an explicit frame argument. Re-entry
-   uses the existing parameters instead of adding them again. Native frames own module
-   references, results and function-local symbols.
-5. **Validate and return IR**: generated code calls the dialect's
-   ``X.check_well_formed_`` for a completed function or the shared
-   ``I.check_well_formed_`` for a completed module. Public parsing validates by default.
-   Parsing owns execution and releases its temporary builder and captures afterward.
-
-Definition and symbol scopes
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Python lexical bindings and DSL symbolic declarations have different owners. The frontend
-captures the exact definition scope during decoration, including enclosing names used only
-in annotations that Python may omit from the function's closure. Ordinary body references
-retain their source globals and closure bindings. Unrelated callers' local variables do not
-become part of this environment.
-
-Annotations are reconstructed as builder operations within the module/function context.
-The generated program preserves their definition scope and original names, using a
-distinct compiler binding only when a source-local binding would shadow the annotation.
-One prescan-seeded name allocator serves rewriting and callable recomposition. Body
-globals and closures retain their original lookup, including a method closure whose name
-also appears as a class member. Callable recomposition and
-lexical environment setup belong to the frontend. The transpiler preserves source scopes
-through Python syntax; it does not classify each name by membership in a runtime environment
-or search caller stacks for values.
-
-DSL expression strings such as ``R.Tensor(("n", 4), "float32")`` use
-``X.resolve_type_var_("n")``, which delegates to the nearest native function frame's
-``type_var_map``. Repeated names refer to the same symbol across parameters, return
-annotations and the body. Quoted lookup does not introduce a Python name; an explicit
-symbol declaration does. A Python name in ``R.Tensor((n, 4), ...)`` follows its source
-lexical scope. Relax global-info selectors use ``R.resolve_global_info_`` against the
-nearest active native module frame's existing map. String selectors outside an active module
-raise, including when an unrelated builder is active. Concrete metadata objects retain identity.
-When defining Python functions before their module builder opens, quote the whole annotation
-or use ``from __future__ import annotations``; the parser reconstructs these annotations inside
-the module. Printed module function signatures containing selectors request postponed annotations.
-Eager printed class assignments, such as typed ``R.ExternFunc`` declarations, retrieve concrete
-virtual devices with ``R.lookup_vdevice`` because postponed annotations do not defer assignment
-values. This explicit lookup preserves the module metadata object before tensor construction.
-
-During rewriting, each needed source range becomes a fixed native span entry in an
-injected table. ``_S[i](value)`` attaches that location while preserving identity;
-``_S[i].ctx(lambda: helper(value))`` evaluates the callee and arguments once within
-the source context and restores it on success or failure. Entries live in
-``ir_builder.base`` and retain no AST or active caller context. Dynamic caller/definition
-provenance is composed when an entry is used. Ordinary names, Python literals, fixed
-namespace/callee lookup and structural indexing tuples need no entries. Arithmetic and
-buffer loads retain their own expression ranges.
-
-Generated hooks receive entries explicitly: ``X.for_(X.range_(3), names="i", span=_S[i])``
-and ``X.emit_(value, span=_S[j])`` own their result locations. A callable registered with
-``result_span`` promises that its complete IR effect is represented by its returned node
-or emission receipt, allowing result attachment without a construction context. Opaque
-helpers still require ``.ctx`` to locate internal effects. At an ordinary assignment boundary,
-``.ctx(..., attach_result=False)`` preserves construction context while leaving the returned
-value's attribution to ``bind_`` through its separate ``value_span``.
-The parser-owned :mod:`tvm.script.parser.protocol_registry` module defines registration APIs,
-metadata and persistent registration state. Dialects apply these policies beside concrete definitions,
-constructor creation or necessary exposure sites, without namespace scans or bulk
-registration inventories. Dialect ``parser_protocol`` modules implement construction hooks. The shared
-:mod:`tvm.script.ir_builder.parser_protocol` documents the detailed builder-hook contract and links
-to the registry for special syntax policies. Dialect hooks retain typed signatures and
-document only their specific behavior. For example, dialects import ``args_policy``
-from ``tvm.script.parser.protocol_registry`` to register literal argument policies.
-
-Ordinary assignments pass returned values to ``bind_``. TIRx Vars keep their exact identity,
-producer names and spans, including scope variables, block axes and explicit ``T.bind``
-results. This behavior belongs to the builder's value handling and requires no parser
-producer classification. Self-emitting builders return ``AlreadyEmitted[T]`` so
-source-location handling can annotate the emitted object without emitting it twice.
-Layout, meta_class and view results likewise follow dialect value handling for assignment
-and standalone statements. Unsupported host values still fail under the dialect's emission
-rules. Expression-facing thread APIs return native Vars; IterVar remains native metadata.
-
-Simple comparison chains such as ``0 < i < 10`` lower to
-``X.and_(X.lt_(0, i), X.lt_(i, 10))``. Only names and numeric literals, including signed
-literals, are supported in a chain. Complex chain operands fail with a source-located
-syntax error before they evaluate. Single comparisons retain general operands, and the
-explicit constexpr boundary retains Python comparison semantics.
-
-A bare loop target receives the native entry result: ``for iters in T.grid(m, n)`` binds
-the original variable sequence, while ``for i in T.serial(n)`` binds one Var. Explicit
-tuple, list and starred targets unpack the native frame's stable ``vars`` field.
-
-Function decorators pass their construction namespace and options explicitly to parsing.
-Generated ``X.function_(**options)`` creates the frame; the dialect hook owns option defaults.
-Declaration creates stable references before function bodies; generated code reads the
-native ``global_var`` or ``local_var`` field directly, without a separate reservation pass.
-There is no function-registration record or copied source-function metadata. The root
-retains ``pyfunc`` behavior and original Python callables for module assembly.
-
-Completed modules use generic root coordination over dialect-owned validation hooks.
-Each dialect checks its members and cross-function requirements against the whole module,
-including captured members. Shared GlobalInfo construction and lookup belong to ``tvm.ir``;
-existing Relax class exports and serialized type keys remain compatible.
-
-Each parse rewrites the fresh AST returned by source acquisition directly, without
-copying or reparsing it. Ordinary functions construct arguments directly and bind their
-known body parameters from ``frame.params``. Specialization setup and conditional
-parameter selection are generated only for an explicit specialization request; an empty
-mapping still requests that path, while ``None`` selects ordinary parsing.
-
-Explicit host control flow
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Mark compile-time Python selection with ``I.constexpr`` or the identical dialect alias:
-
-.. code-block:: python
-
-   if I.constexpr(enabled):
-       T.evaluate(1)
-   else:
-       T.evaluate(0)
-
-   value = T.ramp(0, 1, lanes) if T.constexpr(lanes > 1) else 0
-
-The marker applies to the controlling value. The generated program evaluates it once and
-executes only the selected Python branch in the existing builder scope. Branch bodies and
-result expressions still translate normally. Marked ``and`` and ``or`` decisions retain
-Python short-circuiting; unmarked conditionals and logical expressions call dialect IR
-constructors. A Python boolean alone does not request compile-time branch selection.
-
-JIT supplies validated specialization bindings and optional-argument absence to builder
-execution. Syntax translation does not inspect those values to select a branch.
-
-
-IR Builder Architecture
------------------------
-
-The IR builder (``python/tvm/script/ir_builder/``, backed by C++ in ``src/script/ir_builder/``)
-provides a frame-stack API for constructing IR incrementally.
-
-Frame stack
-~~~~~~~~~~~
-
-The core idea: each IR scope (module, function, block, loop) is a **frame**. Frames are pushed
-on ``__enter__`` and popped on ``__exit__``. When a frame exits, it finalizes the IR it
-represents and attaches it to the parent frame.
-
-.. code-block:: text
-
-   IRBuilder (current construction context)
-   └── frame stack:
-       ├── IRModuleFrame          ← @I.ir_module
-       │   ├── PrimFuncFrame      ← @T.prim_func
-       │   │   ├── ForFrame       ← T.grid(...) / T.serial(...)
-       │   │   │   └── SBlockFrame ← T.sblock(...)
-       │   │   └── ...
-       │   └── FunctionFrame      ← @R.function
-       │       └── BindingBlockFrame ← R.dataflow()
-       └── ...
-
-The generated program constructs IR by entering and exiting frames. Each frame owns its
-construction policy and finalization; the syntax transpiler does not maintain an IR tree.
-
-TIR builder
-~~~~~~~~~~~
-
-The TIR builder (``python/tvm/tirx/script/ir_builder/``) implements the construction operations
-behind public ``T`` syntax. Builder modules also support direct programmatic construction;
-public decorators and internal frame-opening operations have distinct roles. Key categories:
-
-**Function and block**:
-
-- ``@T.prim_func`` selects TIR construction; its builder ``function()`` opens ``PrimFuncFrame``
-- ``T.sblock(name)`` → ``SBlockFrame`` (spatial block)
-- ``T.init()`` → ``BlockInitFrame`` (reduction initialization)
-- ``T.reads(...)``, ``T.writes(...)`` → declare buffer access regions
+``tvm.script.parser`` accepts Python functions, classes and source strings through
+public decorators, ``tvm.script.parse`` and ``tvm.script.from_source``. The frontend
+acquires source and locations, captures the definition's globals and closure bindings,
+and composes the generated callable with that environment. String callers provide
+external bindings through ``extra_vars``.
 
-**Loops**:
+Standalone function decorators construct IR immediately. Within an IR-module class,
+function decorators retain definitions until module construction, which can declare
+signatures before building bodies. Captured Python values belong to the source
+context; symbolic IR values are created and resolved by builders.
 
-- ``T.grid(*extents)`` → ``ForFrame`` returning loop variables
-- ``T.serial(start, stop)``, ``T.parallel(...)``, ``T.vectorized(...)``,
-  ``T.unroll(...)``, ``T.thread_binding(...)`` → loop with specific iterator type
-
-**Block axes**:
-
-- ``T.axis.spatial(dom, binding)`` — spatial iteration axis
-- ``T.axis.reduce(dom, binding)`` — reduction axis
-- ``T.axis.remap(kinds, bindings)`` — shorthand for multiple axes
-
-**Buffers**:
-
-- ``T.match_buffer(param, shape, dtype)`` — match function parameter to buffer
-- ``T.alloc_buffer(shape, dtype)`` — allocate intermediate buffer
-- ``T.Buffer(shape, dtype)`` — buffer type annotation in function signatures
-
-Relax builder
-~~~~~~~~~~~~~
-
-The Relax builder (``python/tvm/relax/script/ir_builder/``) implements:
-
-**Function and dataflow**:
-
-- ``@R.function`` selects Relax construction; its builder ``function()`` opens ``FunctionFrame``
-- ``R.dataflow()`` → ``BindingBlockFrame``
-- ``R.output(*vars)`` → expose variables from a dataflow block
-
-**Emit**:
-
-- ``R.emit(value)`` → emit a binding, returns a ``Var``
-- ``R.emit_match_cast(value, ty)`` → emit with type assertion
-
-Generated standalone-statement emission uses the construction protocol's separate ``emit_``
-operation. Public ``R.emit`` retains its binding-returning imperative API.
-
-**Type annotations**:
-
-- ``R.Tensor(shape, dtype)`` — tensor type
-- ``R.Tuple(*fields)`` — tuple type
-- ``R.Shape(values)`` — shape type
-- ``R.Any()`` — any Relax value type
-
-**Calling conventions**:
-
-- ``R.call_tir(func, args, out_ty)`` — call a TIR function
-- ``R.call_packed(name, *args)`` — call a PackedFunc
-- ``R.call_dps_packed(func, *args)`` — call using destination-passing style
-
-**Operators**: the ``R`` module also re-exports all Relax operators
-(``R.add``, ``R.matmul``, ``R.nn.conv2d``, etc.) so they can be used directly in TVMScript.
-
-
-Printer Architecture
---------------------
-
-The printer converts TVM IR back to TVMScript text. It is implemented primarily in C++
-(``src/script/printer/``) for performance.
-
-Doc tree
-~~~~~~~~
-
-The printer does **not** generate text directly. Instead, it first builds a ``Doc`` tree — an
-intermediate representation that mirrors Python syntax:
-
-- **Expression docs**: ``IdDoc``, ``AttrAccessDoc``, ``CallDoc``, ``IndexDoc``,
-  ``OperationDoc``, ``LiteralDoc``, ``TupleDoc``, ``ListDoc``, etc.
-- **Statement docs**: ``AssignDoc``, ``ForDoc``, ``IfDoc``, ``ScopeDoc`` (``with`` blocks),
-  ``FunctionDoc``, ``ClassDoc``, ``ReturnDoc``, ``CommentDoc``, etc.
-
-For example, ``T.axis.spatial(128, i)`` is represented as:
-
-.. code-block:: text
+Syntax and construction protocol
+--------------------------------
 
-   CallDoc(
-     callee=AttrAccessDoc(AttrAccessDoc(IdDoc("T"), "axis"), "spatial"),
-     args=[LiteralDoc(128), IdDoc("i")]
-   )
+The syntax transpiler rewrites a fresh Python AST using scope and declaration facts
+from a prescan. A registered decorator selects the construction namespace. Assignments
+call binding hooks, expression statements call emission hooks, and control flow opens
+builder frames. The namespace owns the meaning of these operations and the supported
+IR constructs.
 
-IRDocsifier
-~~~~~~~~~~~
+``tvm.script.parser.protocol_registry`` records syntax policies under registered
+namespace paths. These policies identify declarations and arguments that need special
+handling, such as symbolic expression strings. Source aliases resolve to those paths;
+ordinary Python calls remain calls in the generated program. Explicit ``constexpr``
+markers select host control flow during construction.
 
-The ``IRDocsifier`` (``include/tvm/script/printer/ir_docsifier.h``) is the main dispatcher.
-It maintains:
+Generated operations retain source locations. Syntax restrictions raise source-located
+``SyntaxError`` exceptions; builder and Python helper errors retain their original
+exception types. Temporary parse state is released when construction finishes or fails.
 
-- A dispatch table mapping ``(token, type_index)`` pairs to converter functions.
-- A frame stack for tracking the current scope (similar to the builder's frame stack).
-- A variable-to-name mapping to produce readable names.
+Frame-based construction
+------------------------
 
-Each IR dialect registers its own converters:
+The IR builder maintains an active stack of frames, such as module, function and loop
+frames. Entering a frame establishes its scope; exiting finalizes its IR and attaches it
+to its parent. Frames own parameters, symbols and construction state. Builder hooks own
+value binding, type rules and validation of completed IR. The shared
+``resolve_global_info_args`` decorator resolves named metadata arguments after
+ordinary Python argument evaluation; dialect callbacks own selector syntax and
+lookup in the active module.
 
-- ``src/tirx/script/printer/`` — converts PrimFunc, Buffer, SBlock, loops, expressions.
-- ``src/relax/script/printer/`` — converts relax.Function, bindings, types, operators.
-- ``src/script/printer/ir/`` — converts IRModule, shared types.
+Public script namespaces expose decorators and construction operations. The same
+underlying builders can also be used directly from Python. The transpiler therefore
+needs no separate mutable IR representation: it generates calls to this construction
+protocol.
 
-The final step calls ``DocToPythonScript()`` (``src/script/printer/doc_printer/python_doc_printer.cc``)
-to format the Doc tree into properly indented Python text.
+Printing and round trips
+------------------------
 
-Roundtrip
-~~~~~~~~~
+``IRDocsifier`` dispatches on IR types and context to produce a ``Doc`` tree of
+expressions and statements. It tracks scopes and names; ``DocToPythonScript`` formats
+the tree as Python text. This document tree is separate from the parser's Python AST.
 
-For printable IR with the required source context available:
+For example, a small function can be authored, printed and parsed again:
 
 .. code-block:: python
 
-   text = mod.script()           # IR → TVMScript text
-   reparsed = tvm.script.from_source(text)  # text → IR
-   tvm.ir.assert_structural_equal(mod, reparsed)
-
-This roundtrip property is relied upon by testing infrastructure and serialization workflows.
-Printed text uses canonical forms and may differ from hand-written TVMScript. External
-objects or Python attachments require their corresponding context; text alone does not
-serialize arbitrary Python state.
-
-
-Supported Python Syntax
------------------------
-
-TVMScript supports a subset of Python syntax. The table below summarizes what is supported
-and how each construct is interpreted:
-
-.. list-table::
-   :header-rows: 1
-   :widths: 25 15 60
-
-   * - Python Syntax
-     - TIR
-     - Relax
-   * - ``for i in range(n)``
-     - Serial loop nest
-     - No Relax IR loop construction
-   * - ``with T.sblock(...)``
-     - Spatial block scope
-     - N/A
-   * - ``with R.dataflow()``
-     - N/A
-     - Dataflow block
-   * - ``if ... else``
-     - TIR ``IfThenElse``; explicit ``I.constexpr`` selects a Python branch
-     - Relax ``If``; explicit ``I.constexpr`` selects a Python branch
-   * - ``while``
-     - ``T.While`` loop
-     - Not supported
-   * - ``x = expr``
-     - Variable binding
-     - Emit binding (implicit ``R.emit``)
-   * - ``x: T.Buffer(...)``
-     - Buffer annotation
-     - N/A
-   * - ``x: R.Tensor(...)``
-     - N/A
-     - Type annotation
-   * - ``return``
-     - Primitive return expression
-     - Function return value
-   * - ``A[i, j]``
-     - Buffer load
-     - Not applicable (use operators)
-   * - ``A[i, j] = expr``
-     - Buffer store
-     - Not applicable
-   * - Arithmetic (``+``, ``-``, etc.)
-     - PrimExpr operations
-     - Calls to Relax operators
-   * - Function calls
-     - ``T.*`` intrinsics
-     - ``R.*`` operators or ``call_tir`` / ``call_packed``
-
-Inside scripted function bodies, unsupported statement forms include ``class``,
-``try/except``, ``import``, and ``global``. ``yield`` and ``async/await`` are also unsupported.
-Place imports and ordinary Python class definitions in the surrounding Python program.
-
-
-TIR Syntax Reference
----------------------
-
-Function definition
-~~~~~~~~~~~~~~~~~~~
-
-.. code-block:: python
+   import tvm
+   from tvm.script import tirx as T
 
    @T.prim_func
-   def func_name(a: T.handle, b: T.handle):
-       m = T.int32()
-       n = T.int32()
-       A = T.match_buffer(a, (m, n), "float32")
-       B = T.match_buffer(b, (m,), "float32")
-       # function body
+   def increment(A: T.Buffer((4,), "float32")):
+       for i in T.serial(4):
+           A[i] = A[i] + 1.0
 
-- ``T.handle`` — opaque handle parameter (matched to a buffer inside the function).
-- ``T.Buffer(shape, dtype)`` — can also be used directly in the signature:
-  ``def func(A: T.Buffer((128,), "float32"))``.
+   text = increment.script()
+   reparsed = tvm.script.from_source(text)
+   tvm.ir.assert_structural_equal(increment, reparsed)
 
-Block and axes
-~~~~~~~~~~~~~~
+Printed source uses canonical forms rather than preserving the original spelling.
+Round trips require printable IR and any external objects needed by the source;
+the text does not serialize arbitrary Python state.
 
-Use ``@T.prim_func(s_tir=True)`` for functions with scheduled-TIR blocks and block axes.
-
-.. code-block:: python
-
-   for i, j in T.grid(128, 128):
-       with T.sblock("block_name"):
-           vi = T.axis.spatial(128, i)
-           vj = T.axis.reduce(128, j)
-           T.reads(A[vi, vj])
-           T.writes(B[vi])
-           # compute
-
-- ``T.axis.spatial`` / ``T.axis.reduce`` / ``T.axis.scan`` — declare axis variables with
-  their iteration domain and binding to outer loop variables.
-- ``T.axis.remap("SR", [i, j])`` — shorthand: ``S`` = spatial, ``R`` = reduce.
-- ``T.reads(...)``, ``T.writes(...)`` — declare buffer regions accessed by this block.
-
-Loop types
-~~~~~~~~~~
-
-.. code-block:: python
-
-   for i in T.serial(0, 128):          # sequential
-   for i in T.parallel(0, 128):        # parallel
-   for i in T.vectorized(0, 128):      # vectorized
-   for i in T.unroll(0, 128):          # unrolled
-   for i in T.thread_binding(0, 128, thread="threadIdx.x"):  # GPU thread
-
-Buffer operations
-~~~~~~~~~~~~~~~~~
-
-.. code-block:: python
-
-   C = T.alloc_buffer((128, 128), "float32")  # intermediate buffer
-   val = A[i, j]                               # buffer load
-   B[i] = val + 1.0                            # buffer store
-
-Common intrinsics
-~~~~~~~~~~~~~~~~~
-
-.. code-block:: python
-
-   T.exp(x), T.log(x), T.sqrt(x), T.tanh(x), ...  # math functions
-   T.cast(x, "float16")                              # type cast
-   T.if_then_else(cond, true_val, false_val)          # conditional expression
-   T.min(a, b), T.max(a, b)                           # min/max
-   T.call_extern("int32", "func_name", *args)                  # external function call
-   T.call_packed("func_name", *args)                   # packed function call
-   T.tvm_storage_sync("shared")                        # GPU memory fence
-
-
-Relax Syntax Reference
------------------------
-
-Function definition
-~~~~~~~~~~~~~~~~~~~
-
-.. code-block:: python
-
-   @R.function
-   def main(x: R.Tensor((128, 128), "float32"),
-            y: R.Tensor((128,), "float32")) -> R.Tensor((128, 128), "float32"):
-       # function body
-       return result
-
-- ``R.Tensor(shape, dtype)`` — tensor type annotation.
-- ``R.Tuple(...)``, ``R.Shape(...)``, ``R.Any()`` — other Relax type annotations.
-- ``R.function(private=True)`` — marks the function as module-private.
-- ``R.function(pure=False)`` — marks the function as having side effects.
-
-Dataflow blocks
-~~~~~~~~~~~~~~~
-
-.. code-block:: python
-
-   with R.dataflow():
-       lv0 = R.add(x, y)
-       lv1 = R.nn.relu(lv0)
-       R.output(lv1)
-
-Variables inside a ``R.dataflow()`` block are local to that block. ``R.output(...)`` exposes
-variables to the outer scope.
-
-Calling TIR functions
-~~~~~~~~~~~~~~~~~~~~~
-
-.. code-block:: python
-
-   out = R.call_tir(MyModule.my_kernel, (x, y), out_ty=R.Tensor((128,), "float32"))
-
-- ``MyModule.my_kernel`` — references a TIR ``PrimFunc`` in the same module.
-- ``out_ty`` — the type (shape and dtype) of the output tensor.
-
-Control flow
-~~~~~~~~~~~~
-
-Relax ``if`` uses plain Python ``if`` syntax. The condition must be a Relax variable with
-boolean type. Both branches are required.
+Namespace extension
+-------------------
 
-.. code-block:: python
+A language variant supplies construction hooks and a public script namespace, then
+registers its aliases with ``register_namespace``. ``register_namespace_initializer``
+supports lazy setup. ``tvm.script.register_dialect`` exposes a package through the
+public script namespace. Syntax policies are registered beside the operations that
+need them, while IR printing is extended through docsifier registrations.
 
-   @R.function
-   def f(cond: R.Tensor((), "bool"), x: R.Tensor((128,), "float32")):
-       if cond:
-           result = R.add(x, x)
-       else:
-           result = R.multiply(x, x)
-       return result
+This division keeps source acquisition, syntax translation and formatting shared.
+Language-specific construction and validation remain with the namespace and its
+builders.
diff --git a/docs/deep_dive/relax/learning.rst b/docs/deep_dive/relax/learning.rst
index d9c169150e..df3f3222f5 100644
--- a/docs/deep_dive/relax/learning.rst
+++ b/docs/deep_dive/relax/learning.rst
@@ -126,11 +126,12 @@ for the end-to-end model execution. The code block below shows a TVMScript imple
 
     from tvm.script import ir as I
     from tvm.script import tirx as T
+    from tvm.script import s_tir as Ts
     from tvm.script import relax as R
 
     @I.ir_module
     class Module:
-        @T.prim_func(private=True)
+        @Ts.prim_func(private=True)
         def linear(x: T.handle, w: T.handle, b: T.handle, z: T.handle):
             M, N, K = T.int64(), T.int64(), T.int64()
             X = T.match_buffer(x, (M, K), "float32")
@@ -139,24 +140,24 @@ for the end-to-end model execution. The code block below shows a TVMScript imple
             Z = T.match_buffer(z, (M, N), "float32")
             Y = T.alloc_buffer((M, N), "float32")
             for i, j, k in T.grid(M, N, K):
-                with T.sblock("Y"):
-                    v_i, v_j, v_k = T.axis.remap("SSR", [i, j, k])
-                    with T.init():
+                with Ts.sblock("Y"):
+                    v_i, v_j, v_k = Ts.axis.remap("SSR", [i, j, k])
+                    with Ts.init():
                         Y[v_i, v_j] = T.float32(0.0)
                     Y[v_i, v_j] = Y[v_i, v_j] + X[v_i, v_k] * W[v_k, v_j]
             for i, j in T.grid(M, N):
-                with T.sblock("Z"):
-                    v_i, v_j = T.axis.remap("SS", [i, j])
+                with Ts.sblock("Z"):
+                    v_i, v_j = Ts.axis.remap("SS", [i, j])
                     Z[v_i, v_j] = Y[v_i, v_j] + B[v_j]
 
-        @T.prim_func(private=True)
+        @Ts.prim_func(private=True)
         def relu(x: T.handle, y: T.handle):
             M, N = T.int64(), T.int64()
             X = T.match_buffer(x, (M, N), "float32")
             Y = T.match_buffer(y, (M, N), "float32")
             for i, j in T.grid(M, N):
-                with T.sblock("Y"):
-                    v_i, v_j = T.axis.remap("SS", [i, j])
+                with Ts.sblock("Y"):
+                    v_i, v_j = Ts.axis.remap("SS", [i, j])
                     Y[v_i, v_j] = T.max(X[v_i, v_j], T.float32(0.0))
 
         @R.function
diff --git a/docs/deep_dive/relax/tutorials/relax_creation.py b/docs/deep_dive/relax/tutorials/relax_creation.py
index 8407e4210a..f1437b66e0 100644
--- a/docs/deep_dive/relax/tutorials/relax_creation.py
+++ b/docs/deep_dive/relax/tutorials/relax_creation.py
@@ -40,6 +40,7 @@ and relax NNModule API.
 from tvm import relax, topi
 from tvm.script import ir as I
 from tvm.script import relax as R
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 
 
@@ -71,15 +72,15 @@ RelaxModule.show()
 
 @I.ir_module
 class RelaxModuleWithTIR:
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def relu(x: T.handle, y: T.handle):
         n = T.int64()
         m = T.int64()
         X = T.match_buffer(x, (n, m), "float32")
         Y = T.match_buffer(y, (n, m), "float32")
         for i, j in T.grid(n, m):
-            with T.sblock("relu"):
-                vi, vj = T.axis.remap("SS", [i, j])
+            with Ts.sblock("relu"):
+                vi, vj = Ts.axis.remap("SS", [i, j])
                 Y[vi, vj] = T.max(X[vi, vj], T.float32(0))
 
     @R.function
@@ -164,7 +165,7 @@ mod.show()
 # Tensor Expression(TE), TensorIR functions or other TVM packed functions.
 
 
-@T.prim_func(s_tir=True)
+@Ts.prim_func
 def tir_linear(x: T.handle, w: T.handle, b: T.handle, z: T.handle):
     M = T.int64()
     N = T.int64()
@@ -174,14 +175,14 @@ def tir_linear(x: T.handle, w: T.handle, b: T.handle, z: T.handle):
     B = T.match_buffer(b, (N,), "float32")
     Z = T.match_buffer(z, (M, N), "float32")
     for i, j, k in T.grid(M, N, K):
-        with T.sblock("linear"):
-            vi, vj, vk = T.axis.remap("SSR", [i, j, k])
-            with T.init():
+        with Ts.sblock("linear"):
+            vi, vj, vk = Ts.axis.remap("SSR", [i, j, k])
+            with Ts.init():
                 Z[vi, vj] = 0
             Z[vi, vj] = Z[vi, vj] + X[vi, vk] * W[vj, vk]
     for i, j in T.grid(M, N):
-        with T.sblock("add"):
-            vi, vj = T.axis.remap("SS", [i, j])
+        with Ts.sblock("add"):
+            vi, vj = Ts.axis.remap("SS", [i, j])
             Z[vi, vj] = Z[vi, vj] + B[vj]
 
 
diff --git a/docs/deep_dive/tensor_ir/abstraction.rst b/docs/deep_dive/tensor_ir/abstraction.rst
index a36e15677e..bfd790150f 100644
--- a/docs/deep_dive/tensor_ir/abstraction.rst
+++ b/docs/deep_dive/tensor_ir/abstraction.rst
@@ -30,16 +30,17 @@ the compute statements themselves.
 .. code:: python
 
     from tvm.script import tirx as T
+    from tvm.script import s_tir as Ts
 
-    @T.prim_func
+    @Ts.prim_func
     def main(
         A: T.Buffer((128,), "float32"),
         B: T.Buffer((128,), "float32"),
         C: T.Buffer((128,), "float32"),
     ) -> None:
         for i in range(128):
-            with T.sblock("C"):
-                vi = T.axis.spatial(128, i)
+            with Ts.sblock("C"):
+                vi = Ts.axis.spatial(128, i)
                 C[vi] = A[vi] + B[vi]
 
 Key Elements of Tensor Programs
@@ -60,11 +61,11 @@ computations rely on the loop's sequence. Fortunately, the majority of primitive
 functions we focus on possess favorable properties, such as independence among loop iterations.
 For instance, the aforementioned program includes block and iteration annotations:
 
-- The **block annotation** ``with T.sblock("C")`` signifies that the block is the fundamental
+- The **block annotation** ``with Ts.sblock("C")`` signifies that the block is the fundamental
   computation unit designated for scheduling. A block may encompass a single computation
   statement, multiple computation statements with loops, or opaque intrinsics such as Tensor
   Core instructions.
-- The **iteration annotation** ``T.axis.spatial``, indicating that variable ``vi`` is mapped
+- The **iteration annotation** ``Ts.axis.spatial``, indicating that variable ``vi`` is mapped
   to ``i``, and all iterations are independent.
 
 While this information isn't crucial for *executing* the specific program, it proves useful when
diff --git a/docs/deep_dive/tensor_ir/learning.rst b/docs/deep_dive/tensor_ir/learning.rst
index e93870c32d..7d72d597c1 100644
--- a/docs/deep_dive/tensor_ir/learning.rst
+++ b/docs/deep_dive/tensor_ir/learning.rst
@@ -60,26 +60,27 @@ language called TVMScript, which is a domain-specific dialect embedded in python
 .. code:: python
 
     from tvm.script import tirx as T
+    from tvm.script import s_tir as Ts
 
     @tvm.script.ir_module
     class MyModule:
-        @T.prim_func
+        @Ts.prim_func
         def mm_relu(A: T.Buffer((128, 128), "float32"),
                     B: T.Buffer((128, 128), "float32"),
                     C: T.Buffer((128, 128), "float32")):
             Y = T.alloc_buffer((128, 128), dtype="float32")
             for i, j, k in T.grid(128, 128, 128):
-                with T.sblock("Y"):
-                    vi = T.axis.spatial(128, i)
-                    vj = T.axis.spatial(128, j)
-                    vk = T.axis.reduce(128, k)
-                    with T.init():
+                with Ts.sblock("Y"):
+                    vi = Ts.axis.spatial(128, i)
+                    vj = Ts.axis.spatial(128, j)
+                    vk = Ts.axis.reduce(128, k)
+                    with Ts.init():
                         Y[vi, vj] = T.float32(0)
                     Y[vi, vj] = Y[vi, vj] + A[vi, vk] * B[vk, vj]
             for i, j in T.grid(128, 128):
-                with T.sblock("C"):
-                    vi = T.axis.spatial(128, i)
-                    vj = T.axis.spatial(128, j)
+                with Ts.sblock("C"):
+                    vi = Ts.axis.spatial(128, i)
+                    vj = Ts.axis.spatial(128, j)
                     C[vi, vj] = T.max(Y[vi, vj], T.float32(0))
 
 
@@ -139,16 +140,16 @@ Loop Iterations
 Computational Block
 ~~~~~~~~~~~~~~~~~~~
 A significant distinction lies in computational statements:
-**TensorIR incorporates an additional construct termed** ``T.sblock``.
+**TensorIR incorporates an additional construct termed** ``Ts.sblock``.
 
 .. code:: python
 
     # TensorIR
-    with T.sblock("Y"):
-        vi = T.axis.spatial(128, i)
-        vj = T.axis.spatial(128, j)
-        vk = T.axis.reduce(128, k)
-        with T.init():
+    with Ts.sblock("Y"):
+        vi = Ts.axis.spatial(128, i)
+        vj = Ts.axis.spatial(128, j)
+        vk = Ts.axis.reduce(128, k)
+        with Ts.init():
             Y[vi, vj] = T.float32(0)
         Y[vi, vj] = Y[vi, vj] + A[vi, vk] * B[vk, vj]
     # NumPy
@@ -163,21 +164,21 @@ a block encompasses more information than standard NumPy code. It comprises a se
 
 .. code:: python
 
-    vi = T.axis.spatial(128, i)
-    vj = T.axis.spatial(128, j)
-    vk = T.axis.reduce(128, k)
+    vi = Ts.axis.spatial(128, i)
+    vj = Ts.axis.spatial(128, j)
+    vk = Ts.axis.reduce(128, k)
 
 The above three lines declare the **key properties** about block axes in the following syntax.
 
 .. code:: python
 
-    [block_axis] = T.axis.[axis_type]([axis_range], [mapped_value])
+    [block_axis] = Ts.axis.[axis_type]([axis_range], [mapped_value])
 
 These three lines convey the following details:
 
 - They specify the binding of ``vi``, ``vj``, ``vk`` (in this instance, to ``i``, ``j``, ``k``).
 - They declare the original range intended for ``vi``, ``vj``, ``vk``
-  (the 128 in ``T.axis.spatial(128, i)``).
+  (the 128 in ``Ts.axis.spatial(128, i)``).
 - They announce the properties of the iterators (spatial, reduce).
 
 Block Axis Properties
@@ -208,8 +209,8 @@ error because the loop expects an iterator of size 128, but we only bound it to
 
     # wrong program due to loop and block iteration mismatch
     for i in range(127):
-        with T.sblock("C"):
-            vi = T.axis.spatial(128, i)
+        with Ts.sblock("C"):
+            vi = Ts.axis.spatial(128, i)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
             error here due to iterator size mismatch
             ...
@@ -217,20 +218,20 @@ error because the loop expects an iterator of size 128, but we only bound it to
 Sugars for Block Axes Binding
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In situations where each of the block axes is directly mapped to an outer loop iterator,
-we can use ``T.axis.remap`` to declare the block axis in a single line.
+we can use ``Ts.axis.remap`` to declare the block axis in a single line.
 
 .. code:: python
 
     # SSR means the properties of each axes are "spatial", "spatial", "reduce"
-    vi, vj, vk = T.axis.remap("SSR", [i, j, k])
+    vi, vj, vk = Ts.axis.remap("SSR", [i, j, k])
 
 which is equivalent to
 
 .. code:: python
 
-    vi = T.axis.spatial(range_of_i, i)
-    vj = T.axis.spatial(range_of_j, j)
-    vk = T.axis.reduce (range_of_k, k)
+    vi = Ts.axis.spatial(range_of_i, i)
+    vj = Ts.axis.spatial(range_of_j, j)
+    vk = Ts.axis.reduce (range_of_k, k)
 
 So we can also write the programs as follows.
 
@@ -238,18 +239,18 @@ So we can also write the programs as follows.
 
     @tvm.script.ir_module
     class MyModuleWithAxisRemapSugar:
-        @T.prim_func
+        @Ts.prim_func
         def mm_relu(A: T.Buffer((128, 128), "float32"),
                     B: T.Buffer((128, 128), "float32"),
                     C: T.Buffer((128, 128), "float32")):
             Y = T.alloc_buffer((128, 128), dtype="float32")
             for i, j, k in T.grid(128, 128, 128):
-                with T.sblock("Y"):
-                    vi, vj, vk = T.axis.remap("SSR", [i, j, k])
-                    with T.init():
+                with Ts.sblock("Y"):
+                    vi, vj, vk = Ts.axis.remap("SSR", [i, j, k])
+                    with Ts.init():
                         Y[vi, vj] = T.float32(0)
                     Y[vi, vj] = Y[vi, vj] + A[vi, vk] * B[vk, vj]
             for i, j in T.grid(128, 128):
-                with T.sblock("C"):
-                    vi, vj = T.axis.remap("SS", [i, j])
+                with Ts.sblock("C"):
+                    vi, vj = Ts.axis.remap("SS", [i, j])
                     C[vi, vj] = T.max(Y[vi, vj], T.float32(0))
diff --git a/docs/deep_dive/tensor_ir/tutorials/tir_creation.py b/docs/deep_dive/tensor_ir/tutorials/tir_creation.py
index 2f02c62dde..219ded0bc6 100644
--- a/docs/deep_dive/tensor_ir/tutorials/tir_creation.py
+++ b/docs/deep_dive/tensor_ir/tutorials/tir_creation.py
@@ -57,12 +57,13 @@ import tvm_ffi
 
 import tvm
 from tvm.script import ir as I
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 
 
 @I.ir_module
 class MyModule:
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mm_relu(
         A: T.Buffer((128, 128), "float32"),
         B: T.Buffer((128, 128), "float32"),
@@ -72,22 +73,22 @@ class MyModule:
         for i in range(128):
             for j in range(128):
                 for k in range(128):
-                    with T.sblock("Y"):
-                        vi = T.axis.spatial(128, i)
-                        vj = T.axis.spatial(128, j)
-                        vk = T.axis.reduce(128, k)
-                        T.reads(A[vi, vk], B[vk, vj])
-                        T.writes(Y[vi, vj])
-                        with T.init():
+                    with Ts.sblock("Y"):
+                        vi = Ts.axis.spatial(128, i)
+                        vj = Ts.axis.spatial(128, j)
+                        vk = Ts.axis.reduce(128, k)
+                        Ts.reads(A[vi, vk], B[vk, vj])
+                        Ts.writes(Y[vi, vj])
+                        with Ts.init():
                             Y[vi, vj] = T.float32(0)
                         Y[vi, vj] = Y[vi, vj] + A[vi, vk] * B[vk, vj]
         for i in range(128):
             for j in range(128):
-                with T.sblock("C"):
-                    vi = T.axis.spatial(128, i)
-                    vj = T.axis.spatial(128, j)
-                    T.reads(Y[vi, vj])
-                    T.writes(C[vi, vj])
+                with Ts.sblock("C"):
+                    vi = Ts.axis.spatial(128, i)
+                    vj = Ts.axis.spatial(128, j)
+                    Ts.reads(Y[vi, vj])
+                    Ts.writes(C[vi, vj])
                     C[vi, vj] = T.max(Y[vi, vj], T.float32(0))
 
 
@@ -98,14 +99,14 @@ class MyModule:
 # streamline the code:
 #
 # - Utilize ``T.grid`` to condense nested loops;
-# - Employ ``T.axis.remap`` to abbreviate block iterator annotations;
-# - Exclude ``T.reads`` and ``T.writes`` for blocks whose content can
+# - Employ ``Ts.axis.remap`` to abbreviate block iterator annotations;
+# - Exclude ``Ts.reads`` and ``Ts.writes`` for blocks whose content can
 #   be inferred from the block body;
 
 
 @I.ir_module
 class ConciseModule:
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mm_relu(
         A: T.Buffer((128, 128), "float32"),
         B: T.Buffer((128, 128), "float32"),
@@ -113,14 +114,14 @@ class ConciseModule:
     ):
         Y = T.alloc_buffer((128, 128), dtype="float32")
         for i, j, k in T.grid(128, 128, 128):
-            with T.sblock("Y"):
-                vi, vj, vk = T.axis.remap("SSR", [i, j, k])
-                with T.init():
+            with Ts.sblock("Y"):
+                vi, vj, vk = Ts.axis.remap("SSR", [i, j, k])
+                with Ts.init():
                     Y[vi, vj] = T.float32(0)
                 Y[vi, vj] = Y[vi, vj] + A[vi, vk] * B[vk, vj]
         for i, j in T.grid(128, 128):
-            with T.sblock("C"):
-                vi, vj = T.axis.remap("SS", [i, j])
+            with Ts.sblock("C"):
+                vi, vj = Ts.axis.remap("SS", [i, j])
                 C[vi, vj] = T.max(Y[vi, vj], T.float32(0))
 
 
@@ -144,7 +145,7 @@ dtype = "float32"
 # IRModule in TVMScript
 @I.ir_module
 class ConciseModuleFromPython:
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mm_relu(
         A: T.Buffer((M, K), dtype),
         B: T.Buffer((K, N), dtype),
@@ -152,14 +153,14 @@ class ConciseModuleFromPython:
     ):
         Y = T.alloc_buffer((M, N), dtype)
         for i, j, k in T.grid(M, N, K):
-            with T.sblock("Y"):
-                vi, vj, vk = T.axis.remap("SSR", [i, j, k])
-                with T.init():
+            with Ts.sblock("Y"):
+                vi, vj, vk = Ts.axis.remap("SSR", [i, j, k])
+                with Ts.init():
                     Y[vi, vj] = T.cast(T.float32(0), dtype)
                 Y[vi, vj] = Y[vi, vj] + A[vi, vk] * B[vk, vj]
         for i, j in T.grid(M, N):
-            with T.sblock("C"):
-                vi, vj = T.axis.remap("SS", [i, j])
+            with Ts.sblock("C"):
+                vi, vj = Ts.axis.remap("SS", [i, j])
                 C[vi, vj] = T.max(Y[vi, vj], T.cast(T.float32(0), dtype))
 
 
@@ -179,7 +180,7 @@ print(tvm_ffi.structural_equal(ConciseModule, ConciseModuleFromPython))
 
 @I.ir_module
 class DynamicShapeModule:
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mm_relu(a: T.handle, b: T.handle, c: T.handle):
         # Dynamic shape definition
         M = T.int32()
@@ -192,14 +193,14 @@ class DynamicShapeModule:
         C = T.match_buffer(c, [M, N], dtype)
         Y = T.alloc_buffer((M, N), dtype)
         for i, j, k in T.grid(M, N, K):
-            with T.sblock("Y"):
-                vi, vj, vk = T.axis.remap("SSR", [i, j, k])
-                with T.init():
+            with Ts.sblock("Y"):
+                vi, vj, vk = Ts.axis.remap("SSR", [i, j, k])
+                with Ts.init():
                     Y[vi, vj] = T.cast(T.float32(0), dtype)
                 Y[vi, vj] = Y[vi, vj] + A[vi, vk] * B[vk, vj]
         for i, j in T.grid(M, N):
-            with T.sblock("C"):
-                vi, vj = T.axis.remap("SS", [i, j])
+            with Ts.sblock("C"):
+                vi, vj = Ts.axis.remap("SS", [i, j])
                 C[vi, vj] = T.max(Y[vi, vj], T.cast(T.float32(0), dtype))
 
 
diff --git a/docs/deep_dive/tensor_ir/tutorials/tir_transformation.py b/docs/deep_dive/tensor_ir/tutorials/tir_transformation.py
index 14ca5881e5..a4ff02669d 100644
--- a/docs/deep_dive/tensor_ir/tutorials/tir_transformation.py
+++ b/docs/deep_dive/tensor_ir/tutorials/tir_transformation.py
@@ -38,31 +38,32 @@ transformations of primitive tensor functions.
 
 import tvm
 from tvm.script import ir as I
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 
 
 @I.ir_module
 class MyModule:
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def main(
         A: T.Buffer((128, 128), "float32"),
         B: T.Buffer((128, 128), "float32"),
         C: T.Buffer((128, 128), "float32"),
     ):
         T.func_attr({"tirx.noalias": True})
-        with T.sblock("root"):
-            T.reads()
-            T.writes()
-            Y = T.sblock_alloc_buffer((128, 128))
+        with Ts.sblock("root"):
+            Ts.reads()
+            Ts.writes()
+            Y = Ts.sblock_alloc_buffer((128, 128))
             for i, j, k in T.grid(128, 128, 128):
-                with T.sblock("Y"):
-                    vi, vj, vk = T.axis.remap("SSR", [i, j, k])
-                    with T.init():
+                with Ts.sblock("Y"):
+                    vi, vj, vk = Ts.axis.remap("SSR", [i, j, k])
+                    with Ts.init():
                         Y[vi, vj] = T.float32(0)
                     Y[vi, vj] = Y[vi, vj] + A[vi, vk] * B[vk, vj]
             for i, j in T.grid(128, 128):
-                with T.sblock("C"):
-                    vi, vj = T.axis.remap("SS", [i, j])
+                with Ts.sblock("C"):
+                    vi, vj = Ts.axis.remap("SS", [i, j])
                     C[vi, vj] = T.max(Y[vi, vj], T.float32(0))
 
 
diff --git a/docs/how_to/tutorials/mix_python_and_tvm_with_pymodule.py b/docs/how_to/tutorials/mix_python_and_tvm_with_pymodule.py
index bf42154bfb..12b93664eb 100644
--- a/docs/how_to/tutorials/mix_python_and_tvm_with_pymodule.py
+++ b/docs/how_to/tutorials/mix_python_and_tvm_with_pymodule.py
@@ -61,6 +61,7 @@ from tvm import relax
 from tvm.relax.base_py_module import BasePyModule
 from tvm.script import ir as I
 from tvm.script import relax as R
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 
 IS_IN_CI = os.getenv("CI", "").lower() == "true"
@@ -85,7 +86,7 @@ if RUN_EXAMPLE:
 
     @R.py_module
     class MyFirstModule(BasePyModule):
-        @T.prim_func(s_tir=True)
+        @Ts.prim_func
         def add_tir(
             A: T.Buffer((4,), "float32"),
             B: T.Buffer((4,), "float32"),
@@ -131,16 +132,16 @@ if RUN_EXAMPLE:
 
     @R.py_module
     class DebugModule(BasePyModule):
-        @T.prim_func(s_tir=True)
+        @Ts.prim_func
         def matmul_tir(var_A: T.handle, var_B: T.handle, var_C: T.handle):
             n = T.int32()
             A = T.match_buffer(var_A, (n, 4), "float32")
             B = T.match_buffer(var_B, (4, 3), "float32")
             C = T.match_buffer(var_C, (n, 3), "float32")
             for i, j, k in T.grid(n, 3, 4):
-                with T.sblock("matmul"):
-                    vi, vj, vk = T.axis.remap("SSR", [i, j, k])
-                    with T.init():
+                with Ts.sblock("matmul"):
+                    vi, vj, vk = Ts.axis.remap("SSR", [i, j, k])
+                    with Ts.init():
                         C[vi, vj] = T.float32(0)
                     C[vi, vj] = C[vi, vj] + A[vi, vk] * B[vk, vj]
 
@@ -209,15 +210,15 @@ if RUN_EXAMPLE:
 
     @R.py_module
     class PipelineModule(BasePyModule):
-        @T.prim_func(s_tir=True)
+        @Ts.prim_func
         def matmul_tir(var_A: T.handle, var_B: T.handle, var_C: T.handle):
             A = T.match_buffer(var_A, (2, 4), "float32")
             B = T.match_buffer(var_B, (4, 3), "float32")
             C = T.match_buffer(var_C, (2, 3), "float32")
             for i, j, k in T.grid(2, 3, 4):
-                with T.sblock("matmul"):
-                    vi, vj, vk = T.axis.remap("SSR", [i, j, k])
-                    with T.init():
+                with Ts.sblock("matmul"):
+                    vi, vj, vk = Ts.axis.remap("SSR", [i, j, k])
+                    with Ts.init():
                         C[vi, vj] = T.float32(0)
                     C[vi, vj] = C[vi, vj] + A[vi, vk] * B[vk, vj]
 
@@ -273,7 +274,7 @@ if RUN_EXAMPLE:
     # A simple Relax module: matmul + bias + relu (a dense layer)
     @I.ir_module
     class DenseLayer:
-        @T.prim_func(s_tir=True)
+        @Ts.prim_func
         def bias_add_tir(var_x: T.handle, var_b: T.handle, var_out: T.handle):
             x = T.match_buffer(var_x, (2, 4), "float32")
             b = T.match_buffer(var_b, (4,), "float32")
@@ -401,7 +402,7 @@ if RUN_EXAMPLE:
 
     @R.py_module
     class DynamicModule(BasePyModule):
-        @T.prim_func(s_tir=True)
+        @Ts.prim_func
         def scale_tir(var_x: T.handle, var_out: T.handle):
             n = T.int64()
             x = T.match_buffer(var_x, (n,), "float32")
diff --git a/include/tvm/ir/function.h b/include/tvm/ir/function.h
index 2f56653bb8..027e061ba4 100644
--- a/include/tvm/ir/function.h
+++ b/include/tvm/ir/function.h
@@ -128,7 +128,7 @@ constexpr const char* kGlobalSymbol = "global_symbol";
 /*!
  * \brief The function uses s_tir (apache-derived TIR) semantics:
  *        parser fills layout=None, ScriptComplete wraps body in a root SBlock,
- *        and printer emits `s_tir=True` on the decorator.
+ *        and the printer emits the S-TIR `Ts.prim_func` entry point.
  *        Default (attr absent or False) is tirx semantics.
  *
  * Type: IntImm (bool dtype)
diff --git a/include/tvm/s_tir/script/builder/frame.h b/include/tvm/s_tir/script/builder/frame.h
new file mode 100644
index 0000000000..9f59569911
--- /dev/null
+++ b/include/tvm/s_tir/script/builder/frame.h
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+#ifndef TVM_S_TIR_SCRIPT_BUILDER_FRAME_H_
+#define TVM_S_TIR_SCRIPT_BUILDER_FRAME_H_
+
+#include <tvm/s_tir/stmt.h>
+#include <tvm/tirx/script/builder/frame.h>
+
+namespace tvm {
+namespace script {
+namespace ir_builder {
+namespace s_tir {
+
+using tirx::TIRFrame;
+using tirx::TIRFrameNode;
+
+/*! \brief Function frame owning schedulable TIR construction. */
+class PrimFuncFrameNode : public tirx::PrimFuncFrameNode {
+ public:
+  /*! \brief Buffers allocated in the implicit root block. */
+  ffi::Array<tvm::tirx::BufferVar> root_alloc_buffers;
+
+  static void RegisterReflection() {
+    namespace refl = tvm::ffi::reflection;
+    refl::ObjectDef<PrimFuncFrameNode>().def_ro("root_alloc_buffers",
+                                                &PrimFuncFrameNode::root_alloc_buffers);
+  }
+  TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.s_tir.PrimFuncFrame", PrimFuncFrameNode,
+                                    tirx::PrimFuncFrameNode);
+  tvm::tirx::PrimFunc FinalizeFunction(tvm::tirx::PrimFunc func) final;
+};
+
+class PrimFuncFrame : public tirx::PrimFuncFrame {
+ public:
+  explicit PrimFuncFrame(ffi::ObjectPtr<PrimFuncFrameNode> data)
+      : tirx::PrimFuncFrame(std::move(data)) {}
+  TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(PrimFuncFrame, tirx::PrimFuncFrame,
+                                                PrimFuncFrameNode);
+};
+
+/*!
+ * \brief A frame that represents the block.
+ *
+ * \sa SBlockFrame
+ */
+class SBlockFrameNode : public TIRFrameNode {
+ public:
+  /*! \brief The name of the block. */
+  ffi::String name;
+  /*! \brief The variables of the block. */
+  ffi::Array<tvm::tirx::IterVar> iter_vars;
+  /*! \brief The read buffer regions of the block. */
+  ffi::Optional<ffi::Array<tvm::TensorRegion>> reads;
+  /*! \brief The write buffer regions of the block. */
+  ffi::Optional<ffi::Array<tvm::TensorRegion>> writes;
+  /*! \brief The init statement of the bolck. */
+  ffi::Optional<tvm::tirx::Stmt> init;
+  /*! \brief The buffer allocated in the block. */
+  ffi::Array<tvm::tirx::BufferVar> alloc_buffers;
+  /*! \brief The match buffer regions. */
+  ffi::Array<tvm::s_tir::MatchBufferRegion> match_buffers;
+  /*! \brief The annotation of the block. */
+  ffi::Optional<ffi::Map<ffi::String, Any>> annotations;
+  /*! \brief The corresponding values of the iter vars. */
+  ffi::Array<PrimExpr> iter_values;
+  /*!
+   * \brief The predicate of the block realization, the block will only be executed when the
+   * predicate is true.
+   */
+  ffi::Optional<PrimExpr> predicate;
+  /*! \brief The flag whether to construct BlockRealize or Block. */
+  bool no_realize;
+
+  static void RegisterReflection() {
+    namespace refl = tvm::ffi::reflection;
+    refl::ObjectDef<SBlockFrameNode>()
+        .def_ro("name", &SBlockFrameNode::name)
+        .def_ro("iter_vars", &SBlockFrameNode::iter_vars)
+        .def_ro("reads", &SBlockFrameNode::reads)
+        .def_ro("writes", &SBlockFrameNode::writes)
+        .def_ro("init", &SBlockFrameNode::init)
+        .def_ro("alloc_buffers", &SBlockFrameNode::alloc_buffers)
+        .def_ro("match_buffers", &SBlockFrameNode::match_buffers)
+        .def_ro("annotations", &SBlockFrameNode::annotations)
+        .def_ro("iter_values", &SBlockFrameNode::iter_values)
+        .def_ro("predicate", &SBlockFrameNode::predicate)
+        .def_ro("no_realize", &SBlockFrameNode::no_realize);
+  }
+  TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.s_tir.SBlockFrame", SBlockFrameNode,
+                                    TIRFrameNode);
+
+ public:
+  /*!
+   * \brief The method called when exiting RAII scope.
+   * \sa tvm::support::With
+   */
+  void BindBufferRegion(tvm::tirx::BufferVar buffer, tvm::TensorRegion region) final;
+  void ExitWithScope() final;
+};
+
+/*!
+ * \brief Managed reference to SBlockFrameNode.
+ *
+ * \sa SBlockFrameNode
+ */
+
+class SBlockFrame : public TIRFrame {
+ public:
+  explicit SBlockFrame(ffi::ObjectPtr<SBlockFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
+    TVM_FFI_ICHECK(data != nullptr);
+    data_ = std::move(data);
+  }
+  TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(SBlockFrame, TIRFrame, SBlockFrameNode);
+};
+
+/*!
+ * \brief A frame that represents the block initialization statment.
+ *
+ * \sa BlockInitFrame
+ */
+class BlockInitFrameNode : public TIRFrameNode {
+ public:
+  static void RegisterReflection() {
+    namespace refl = tvm::ffi::reflection;
+    refl::ObjectDef<BlockInitFrameNode>();
+  }
+  TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.s_tir.BlockInitFrame", BlockInitFrameNode,
+                                    TIRFrameNode);
+
+ public:
+  /*!
+   * \brief The method called when entering RAII scope.
+   * \sa tvm::support::With
+   */
+  void EnterWithScope() final;
+  /*!
+   * \brief The method called when exiting RAII scope.
+   * \sa tvm::support::With
+   */
+  void ExitWithScope() final;
+};
+
+/*!
+ * \brief Managed reference to BlockInitFrameNode.
+ *
+ * \sa BlockInitFrameNode
+ */
+class BlockInitFrame : public TIRFrame {
+ public:
+  explicit BlockInitFrame(ffi::ObjectPtr<BlockInitFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
+    TVM_FFI_ICHECK(data != nullptr);
+    data_ = std::move(data);
+  }
+  TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(BlockInitFrame, TIRFrame, BlockInitFrameNode);
+};
+
+}  // namespace s_tir
+}  // namespace ir_builder
+}  // namespace script
+}  // namespace tvm
+
+#endif  // TVM_S_TIR_SCRIPT_BUILDER_FRAME_H_
diff --git a/include/tvm/s_tir/script/builder/ir.h b/include/tvm/s_tir/script/builder/ir.h
new file mode 100644
index 0000000000..a14d2ac489
--- /dev/null
+++ b/include/tvm/s_tir/script/builder/ir.h
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+#ifndef TVM_S_TIR_SCRIPT_BUILDER_IR_H_
+#define TVM_S_TIR_SCRIPT_BUILDER_IR_H_
+
+#include <tvm/s_tir/script/builder/frame.h>
+#include <tvm/tirx/script/builder/ir.h>
+
+namespace tvm {
+namespace script {
+namespace ir_builder {
+namespace s_tir {
+
+using tvm::tirx::BufferVar;
+using tvm::tirx::Layout;
+using tvm::tirx::Var;
+
+PrimFuncFrame PrimFunc(bool is_private = false, bool persistent = false);
+PrimFuncFrame DeclFunction(bool is_private = false, bool persistent = false);
+
+/*!
+ * \brief The block declaration statement.
+ * \param name The name of the block.
+ * \param no_realize The flag whether to construct s_tir::SBlockRealize or s_tir::SBlock.
+ * \return The SBlockFrame.
+ */
+SBlockFrame Block(ffi::String name, bool no_realize = false, ffi::String exec_scope = "");
+
+/*!
+ * \brief The block initialization statement.
+ * \return The BlockInitFrame.
+ */
+BlockInitFrame Init();
+
+/*!
+ * \brief The block predicate statement.
+ * \param predicate The predicate condition.
+ */
+void Where(PrimExpr predicate);
+
+/*!
+ * \brief The block buffer region reading statement.
+ * \param buffer_slices The array of buffer regions to read.
+ */
+void Reads(ffi::Array<ffi::ObjectRef> buffer_slices);
+
+/*!
+ * \brief The block buffer region writing statement.
+ * \param buffer_slices The array of buffer regions to write.
+ */
+void Writes(ffi::Array<ffi::ObjectRef> buffer_slices);
+
+/*!
+ * \brief The block annotation statement.
+ * \param attrs The annotation of the block.
+ */
+void BlockAttrs(ffi::Map<ffi::String, ffi::Any> attrs);
+
+/*!
+ * \brief The buffer allocation function.
+ * \param shape The type of the buffer prior to flattening.
+ * \param dtype The data type in the content of the buffer.
+ * \param data The pointer to the head of the data.
+ * \param strides The strides of each dimension.
+ * \param elem_offset The offset in terms of number of dtype elements (including lanes).
+ * \param storage_scope The optional storage scope of buffer data pointer.
+ * \param align The alignment requirement of data pointer in bytes.
+ * \param offset_factor The factor of elem_offset field.
+ * \param layout The layout of the buffer.
+ * \param allocated_addr The allocated address of the buffer. Might be multi-dimensional.
+ * \return The buffer attached to its enclosing block or function allocation list.
+ */
+BufferVar SBlockAllocBuffer(ffi::Array<PrimExpr> shape, PrimType dtype = PrimType::Float(32),
+                            ffi::Optional<Expr> data = std::nullopt,
+                            ffi::Array<PrimExpr> strides = {}, PrimExpr elem_offset = PrimExpr(),
+                            ffi::String storage_scope = "", int align = -1, int offset_factor = 0,
+                            ffi::Optional<Layout> layout = std::nullopt,
+                            ffi::Array<PrimExpr> allocated_addr = {});
+
+namespace axis {
+
+/*!
+ * \brief The spatial block axis defining function.
+ * \param dom The domain of the iteration variable.
+ * \param binding The binding value of the iteration variable.
+ * \param dtype The data type of the iteration variable.
+ * \return The iteration variable.
+ */
+Var Spatial(Range dom, PrimExpr binding, PrimType dtype = PrimType::Int(32));
+
+/*!
+ * \brief The reduced block axis defining function.
+ * \param dom The domain of the iteration variable.
+ * \param binding The binding value of the iteration variable.
+ * \param dtype The data type of the iteration variable.
+ * \return The iteration variable.
+ */
+Var Reduce(Range dom, PrimExpr binding, PrimType dtype = PrimType::Int(32));
+
+/*!
+ * \brief The scanning block axis defining function.
+ * \param dom The domain of the iteration variable.
+ * \param binding The binding value of the iteration variable.
+ * \param dtype The data type of the iteration variable.
+ * \return The iteration variable.
+ */
+Var Scan(Range dom, PrimExpr binding, PrimType dtype = PrimType::Int(32));
+
+/*!
+ * \brief The opaque block axis defining function.
+ * \param dom The domain of the iteration variable.
+ * \param binding The binding value of the iteration variable.
+ * \param dtype The data type of the iteration variable.
+ * \return The iteration variable.
+ */
+Var Opaque(Range dom, PrimExpr binding, PrimType dtype = PrimType::Int(32));
+
+/*!
+ * \brief The block axis remapping function.
+ * \param kinds The types of the iteration variables.
+ * \param bindings The binding values of the iteration variables.
+ * \param dtype The data types of the iteration variables.
+ * \return The iteration variables.
+ */
+ffi::Array<Var> Remap(ffi::String kinds, ffi::Array<PrimExpr> bindings,
+                      PrimType dtype = PrimType::Int(32));
+
+}  // namespace axis
+
+}  // namespace s_tir
+}  // namespace ir_builder
+}  // namespace script
+}  // namespace tvm
+
+#endif  // TVM_S_TIR_SCRIPT_BUILDER_IR_H_
diff --git a/include/tvm/tirx/script/builder/frame.h b/include/tvm/tirx/script/builder/frame.h
index c28613e97a..d045209907 100644
--- a/include/tvm/tirx/script/builder/frame.h
+++ b/include/tvm/tirx/script/builder/frame.h
@@ -19,12 +19,13 @@
 #ifndef TVM_SCRIPT_IR_BUILDER_TIR_FRAME_H_
 #define TVM_SCRIPT_IR_BUILDER_TIR_FRAME_H_
 
-#include <tvm/s_tir/stmt.h>
 #include <tvm/script/ir_builder/base.h>
 #include <tvm/script/ir_builder/ir/frame.h>
 #include <tvm/tirx/exec_scope.h>
+#include <tvm/tirx/function.h>
 #include <tvm/tirx/stmt.h>
 
+#include <functional>
 #include <utility>
 
 namespace tvm {
@@ -42,6 +43,9 @@ class TIRFrameNode : public IRBuilderFrameNode {
   /*! \brief The Stmt within in this frame. */
   ffi::Array<tvm::tirx::Stmt> stmts;
 
+  /*! \brief Bind a view in frames that support region aliases. */
+  virtual void BindBufferRegion(tvm::tirx::BufferVar buffer, tvm::TensorRegion region);
+
   static void RegisterReflection() {
     namespace refl = tvm::ffi::reflection;
     refl::ObjectDef<TIRFrameNode>().def_ro("stmts", &TIRFrameNode::stmts);
@@ -86,13 +90,6 @@ class PrimFuncFrameNode : public TIRFrameNode {
   ffi::Map<ffi::String, Any> attrs;
   /*! \brief The variable map bound to thread env. */
   ffi::Map<tvm::tirx::Var, tvm::tirx::IterVar> env_threads;
-  /*! \brief The buffer allocated in root block. */
-  ffi::Array<tvm::tirx::BufferVar> root_alloc_buffers;
-
-  // TIR utils
-  /*! \brief Whether this PrimFunc uses s_tir semantics (root s_tir::SBlock wrap,
-   *  parser layout default = None). Default (false) = tirx semantics. */
-  bool s_tir;
   /*! \brief Whether it is a persistent kernel. */
   bool persistent;
   /*! \brief Whether this frame declares a bodyless signature. */
@@ -112,15 +109,13 @@ class PrimFuncFrameNode : public TIRFrameNode {
         .def_ro("buffer_map", &PrimFuncFrameNode::buffer_map)
         .def_ro("attrs", &PrimFuncFrameNode::attrs)
         .def_ro("env_threads", &PrimFuncFrameNode::env_threads)
-        .def_ro("root_alloc_buffers", &PrimFuncFrameNode::root_alloc_buffers)
-        .def_ro("s_tir", &PrimFuncFrameNode::s_tir)
         .def_ro("persistent", &PrimFuncFrameNode::persistent)
         .def_ro("is_declaration", &PrimFuncFrameNode::is_declaration)
         .def_ro("function", &PrimFuncFrameNode::function)
         .def_ro("global_var", &PrimFuncFrameNode::global_var);
   }
-  TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.PrimFuncFrame", PrimFuncFrameNode,
-                                    TIRFrameNode);
+  TVM_FFI_DECLARE_OBJECT_INFO("script.ir_builder.tirx.PrimFuncFrame", PrimFuncFrameNode,
+                              TIRFrameNode);
 
  public:
   /*!
@@ -128,6 +123,14 @@ class PrimFuncFrameNode : public TIRFrameNode {
    * \sa tvm::support::With
    */
   void ExitWithScope() final;
+
+  /*! \brief Register validation for an extension-owned function attribute. */
+  using AttrValidator = std::function<void(const PrimFuncFrameNode*, const ffi::Any&)>;
+  static void RegisterAttrValidator(ffi::String key, AttrValidator validator);
+  void ValidateAttrs() const;
+
+  /*! \brief Complete dialect-specific function construction before publication. */
+  virtual tvm::tirx::PrimFunc FinalizeFunction(tvm::tirx::PrimFunc func);
 };
 
 /*!
@@ -144,121 +147,6 @@ class PrimFuncFrame : public TIRFrame {
   TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(PrimFuncFrame, TIRFrame, PrimFuncFrameNode);
 };
 
-/*!
- * \brief A frame that represents the block.
- *
- * \sa SBlockFrame
- */
-class SBlockFrameNode : public TIRFrameNode {
- public:
-  /*! \brief The name of the block. */
-  ffi::String name;
-  /*! \brief The variables of the block. */
-  ffi::Array<tvm::tirx::IterVar> iter_vars;
-  /*! \brief The read buffer regions of the block. */
-  ffi::Optional<ffi::Array<tvm::TensorRegion>> reads;
-  /*! \brief The write buffer regions of the block. */
-  ffi::Optional<ffi::Array<tvm::TensorRegion>> writes;
-  /*! \brief The init statement of the bolck. */
-  ffi::Optional<tvm::tirx::Stmt> init;
-  /*! \brief The buffer allocated in the block. */
-  ffi::Array<tvm::tirx::BufferVar> alloc_buffers;
-  /*! \brief The match buffer regions. */
-  ffi::Array<tvm::s_tir::MatchBufferRegion> match_buffers;
-  /*! \brief The annotation of the block. */
-  ffi::Optional<ffi::Map<ffi::String, Any>> annotations;
-  /*! \brief The corresponding values of the iter vars. */
-  ffi::Array<PrimExpr> iter_values;
-  /*!
-   * \brief The predicate of the block realization, the block will only be executed when the
-   * predicate is true.
-   */
-  ffi::Optional<PrimExpr> predicate;
-  /*! \brief The flag whether to construct BlockRealize or Block. */
-  bool no_realize;
-
-  static void RegisterReflection() {
-    namespace refl = tvm::ffi::reflection;
-    refl::ObjectDef<SBlockFrameNode>()
-        .def_ro("name", &SBlockFrameNode::name)
-        .def_ro("iter_vars", &SBlockFrameNode::iter_vars)
-        .def_ro("reads", &SBlockFrameNode::reads)
-        .def_ro("writes", &SBlockFrameNode::writes)
-        .def_ro("init", &SBlockFrameNode::init)
-        .def_ro("alloc_buffers", &SBlockFrameNode::alloc_buffers)
-        .def_ro("match_buffers", &SBlockFrameNode::match_buffers)
-        .def_ro("annotations", &SBlockFrameNode::annotations)
-        .def_ro("iter_values", &SBlockFrameNode::iter_values)
-        .def_ro("predicate", &SBlockFrameNode::predicate)
-        .def_ro("no_realize", &SBlockFrameNode::no_realize);
-  }
-  TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.SSBlockFrame", SBlockFrameNode,
-                                    TIRFrameNode);
-
- public:
-  /*!
-   * \brief The method called when exiting RAII scope.
-   * \sa tvm::support::With
-   */
-  void ExitWithScope() final;
-};
-
-/*!
- * \brief Managed reference to SBlockFrameNode.
- *
- * \sa SBlockFrameNode
- */
-
-class SBlockFrame : public TIRFrame {
- public:
-  explicit SBlockFrame(ffi::ObjectPtr<SBlockFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
-    TVM_FFI_ICHECK(data != nullptr);
-    data_ = std::move(data);
-  }
-  TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(SBlockFrame, TIRFrame, SBlockFrameNode);
-};
-
-/*!
- * \brief A frame that represents the block initialization statment.
- *
- * \sa BlockInitFrame
- */
-class BlockInitFrameNode : public TIRFrameNode {
- public:
-  static void RegisterReflection() {
-    namespace refl = tvm::ffi::reflection;
-    refl::ObjectDef<BlockInitFrameNode>();
-  }
-  TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.tirx.SBlockInitFrame", BlockInitFrameNode,
-                                    TIRFrameNode);
-
- public:
-  /*!
-   * \brief The method called when entering RAII scope.
-   * \sa tvm::support::With
-   */
-  void EnterWithScope() final;
-  /*!
-   * \brief The method called when exiting RAII scope.
-   * \sa tvm::support::With
-   */
-  void ExitWithScope() final;
-};
-
-/*!
- * \brief Managed reference to BlockInitFrameNode.
- *
- * \sa BlockInitFrameNode
- */
-class BlockInitFrame : public TIRFrame {
- public:
-  explicit BlockInitFrame(ffi::ObjectPtr<BlockInitFrameNode> data) : TIRFrame(ffi::UnsafeInit{}) {
-    TVM_FFI_ICHECK(data != nullptr);
-    data_ = std::move(data);
-  }
-  TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(BlockInitFrame, TIRFrame, BlockInitFrameNode);
-};
-
 /*!
  * \brief A frame that represents the for loop.
  *
diff --git a/include/tvm/tirx/script/builder/ir.h b/include/tvm/tirx/script/builder/ir.h
index 7e3e7283a9..246891abb1 100644
--- a/include/tvm/tirx/script/builder/ir.h
+++ b/include/tvm/tirx/script/builder/ir.h
@@ -66,10 +66,10 @@ BufferVar BufferDecl(ffi::Array<PrimExpr> shape, PrimType dtype, ffi::String buf
  * \brief The primitive function statement.
  * \return The PrimFuncFrame.
  */
-PrimFuncFrame PrimFunc(bool is_private, bool s_tir = false, bool persistent = false);
+PrimFuncFrame PrimFunc(bool is_private, bool persistent = false);
 
 /*! \brief Construct a bodyless function signature using the ordinary signature operations. */
-PrimFuncFrame DeclFunction(bool is_private = false, bool s_tir = false, bool persistent = false);
+PrimFuncFrame DeclFunction(bool is_private = false, bool persistent = false);
 
 /*!
  * \brief The PrimFunc variable arguments adding function.
@@ -128,14 +128,6 @@ BufferVar MatchBuffer(ffi::ObjectRef param, ffi::Array<PrimExpr> shape,
                       ffi::Optional<Layout> layout = std::nullopt,
                       ffi::Array<PrimExpr> allocated_addr = {});
 
-/*!
- * \brief The block declaration statement.
- * \param name The name of the block.
- * \param no_realize The flag whether to construct s_tir::SBlockRealize or s_tir::SBlock.
- * \return The SBlockFrame.
- */
-SBlockFrame Block(ffi::String name, bool no_realize = false, ffi::String exec_scope = "");
-
 void TilePrimitiveCall(tvm::tirx::TilePrimitiveCall op_call);
 
 /*!
@@ -170,107 +162,6 @@ ffi::Array<tvm::tirx::Var> WarpId(ffi::Optional<ffi::Array<PrimExpr>> extents, f
 ffi::Array<tvm::tirx::Var> ThreadId(ffi::Optional<ffi::Array<PrimExpr>> extents, ffi::String parent,
                                     PrimType dtype = PrimType::Int(32));
 
-/*!
- * \brief The block initialization statement.
- * \return The BlockInitFrame.
- */
-BlockInitFrame Init();
-
-/*!
- * \brief The block predicate statement.
- * \param predicate The predicate condition.
- */
-void Where(PrimExpr predicate);
-
-/*!
- * \brief The block buffer region reading statement.
- * \param buffer_slices The array of buffer regions to read.
- */
-void Reads(ffi::Array<ffi::ObjectRef> buffer_slices);
-
-/*!
- * \brief The block buffer region writing statement.
- * \param buffer_slices The array of buffer regions to write.
- */
-void Writes(ffi::Array<ffi::ObjectRef> buffer_slices);
-
-/*!
- * \brief The block annotation statement.
- * \param attrs The annotation of the block.
- */
-void BlockAttrs(ffi::Map<ffi::String, ffi::Any> attrs);
-
-/*!
- * \brief The buffer allocation function.
- * \param shape The type of the buffer prior to flattening.
- * \param dtype The data type in the content of the buffer.
- * \param data The pointer to the head of the data.
- * \param strides The strides of each dimension.
- * \param elem_offset The offset in terms of number of dtype elements (including lanes).
- * \param storage_scope The optional storage scope of buffer data pointer.
- * \param align The alignment requirement of data pointer in bytes.
- * \param offset_factor The factor of elem_offset field.
- * \param layout The layout of the buffer.
- * \param allocated_addr The allocated address of the buffer. Might be multi-dimensional.
- * \return The buffer attached to its enclosing block or function allocation list.
- */
-BufferVar SBlockAllocBuffer(ffi::Array<PrimExpr> shape, PrimType dtype = PrimType::Float(32),
-                            ffi::Optional<Expr> data = std::nullopt,
-                            ffi::Array<PrimExpr> strides = {}, PrimExpr elem_offset = PrimExpr(),
-                            ffi::String storage_scope = "", int align = -1, int offset_factor = 0,
-                            ffi::Optional<Layout> layout = std::nullopt,
-                            ffi::Array<PrimExpr> allocated_addr = {});
-
-namespace axis {
-
-/*!
- * \brief The spatial block axis defining function.
- * \param dom The domain of the iteration variable.
- * \param binding The binding value of the iteration variable.
- * \param dtype The data type of the iteration variable.
- * \return The iteration variable.
- */
-Var Spatial(Range dom, PrimExpr binding, PrimType dtype = PrimType::Int(32));
-
-/*!
- * \brief The reduced block axis defining function.
- * \param dom The domain of the iteration variable.
- * \param binding The binding value of the iteration variable.
- * \param dtype The data type of the iteration variable.
- * \return The iteration variable.
- */
-Var Reduce(Range dom, PrimExpr binding, PrimType dtype = PrimType::Int(32));
-
-/*!
- * \brief The scanning block axis defining function.
- * \param dom The domain of the iteration variable.
- * \param binding The binding value of the iteration variable.
- * \param dtype The data type of the iteration variable.
- * \return The iteration variable.
- */
-Var Scan(Range dom, PrimExpr binding, PrimType dtype = PrimType::Int(32));
-
-/*!
- * \brief The opaque block axis defining function.
- * \param dom The domain of the iteration variable.
- * \param binding The binding value of the iteration variable.
- * \param dtype The data type of the iteration variable.
- * \return The iteration variable.
- */
-Var Opaque(Range dom, PrimExpr binding, PrimType dtype = PrimType::Int(32));
-
-/*!
- * \brief The block axis remapping function.
- * \param kinds The types of the iteration variables.
- * \param bindings The binding values of the iteration variables.
- * \param dtype The data types of the iteration variables.
- * \return The iteration variables.
- */
-ffi::Array<Var> Remap(ffi::String kinds, ffi::Array<PrimExpr> bindings,
-                      PrimType dtype = PrimType::Int(32));
-
-}  // namespace axis
-
 /*!
  * \brief The serial For statement.
  * \param start The minimum value of iteration.
diff --git a/include/tvm/tirx/transform.h b/include/tvm/tirx/transform.h
index c37da8a235..d8bdc625ef 100644
--- a/include/tvm/tirx/transform.h
+++ b/include/tvm/tirx/transform.h
@@ -113,6 +113,15 @@ TVM_DLL Pass StmtSimplify();
  */
 TVM_DLL Pass ConvertSSA();
 
+/*!
+ * \brief Unify loop and attribute bindings of each thread axis within a kernel.
+ * \return The pass.
+ */
+TVM_DLL Pass UnifyThreadBinding();
+
+/*! \brief Lower cross-thread reductions to target-specific communication. */
+TVM_DLL Pass LowerThreadAllreduce();
+
 /*!
  * \brief Transform the high-level PrimFunc to a low-level version
  *        that can be used as an API function.
diff --git a/python/tvm/relax/backend/gpu_generic/cumsum.py b/python/tvm/relax/backend/gpu_generic/cumsum.py
index 9d79cf7079..ded3fb2392 100644
--- a/python/tvm/relax/backend/gpu_generic/cumsum.py
+++ b/python/tvm/relax/backend/gpu_generic/cumsum.py
@@ -19,6 +19,7 @@
 
 import math
 
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 from tvm.tirx import PrimFunc
 
@@ -108,9 +109,9 @@ def gpu_2d_continuous_cumsum(
     ):
         for by in T.thread_binding(batch, thread="blockIdx.y"):
             for bx in T.thread_binding(num_blocks, thread="blockIdx.x"):
-                with T.sblock():
-                    local_buf = T.sblock_alloc_buffer((thread_elem,), out_dtype, scope="local")
-                    shared_buf = T.sblock_alloc_buffer((block_elem,), out_dtype, scope="shared")
+                with Ts.sblock():
+                    local_buf = Ts.sblock_alloc_buffer((thread_elem,), out_dtype, scope="local")
+                    shared_buf = Ts.sblock_alloc_buffer((block_elem,), out_dtype, scope="shared")
                     for ty in T.thread_binding(TY, thread="threadIdx.y"):
                         for tx in T.thread_binding(TX, thread="threadIdx.x"):
                             tx_idx: T.let[T.int64] = (
@@ -173,7 +174,7 @@ def gpu_2d_continuous_cumsum(
                                     bx > 0, source[by, src_offset + bx - 1], 0
                                 )
 
-    @T.prim_func(private=True, s_tir=True)
+    @Ts.prim_func(private=True)
     def cumsum(var_a: T.handle, var_out: T.handle):
         T.func_attr({"tirx.is_scheduled": True})  # prevent further scheduling
         m, n = T.int64(), T.int64()
@@ -252,7 +253,7 @@ def gpu_3d_axis_1_cumsum(
     out_dtype = out_dtype or in_dtype
     TX = T.int64(tx_len)
 
-    @T.prim_func(private=True, s_tir=True)
+    @Ts.prim_func(private=True)
     def cumsum(var_a: T.handle, var_out: T.handle):
         T.func_attr({"tirx.is_scheduled": True})
         outer, scan, inner = T.int64(), T.int64(), T.int64()
@@ -262,8 +263,8 @@ def gpu_3d_axis_1_cumsum(
         for bx in T.thread_binding(T.ceildiv(outer * inner, TX), thread="blockIdx.x"):
             for tx in T.thread_binding(TX, thread="threadIdx.x"):
                 row: T.let[T.int64] = bx * TX + tx
-                with T.sblock():
-                    accumulator = T.sblock_alloc_buffer((), out_dtype, scope="local")
+                with Ts.sblock():
+                    accumulator = Ts.sblock_alloc_buffer((), out_dtype, scope="local")
                     if row < outer * inner:
                         outer_idx: T.let[T.int64] = row // inner
                         inner_idx: T.let[T.int64] = row % inner
diff --git a/python/tvm/relax/backend/gpu_generic/sampling.py b/python/tvm/relax/backend/gpu_generic/sampling.py
index 302b8b7e8c..84431f91b7 100644
--- a/python/tvm/relax/backend/gpu_generic/sampling.py
+++ b/python/tvm/relax/backend/gpu_generic/sampling.py
@@ -21,6 +21,7 @@ import math
 from collections.abc import Callable
 
 import tvm
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 from tvm.tirx import PrimFunc
 
@@ -138,8 +139,8 @@ def gpu_multinomial_from_uniform(
         source_local: T.Buffer,
         output_local: T.Buffer,
     ):
-        with T.sblock():
-            shared_buf = T.sblock_alloc_buffer((TX * TY,), "bool", scope="shared")
+        with Ts.sblock():
+            shared_buf = Ts.sblock_alloc_buffer((TX * TY,), "bool", scope="shared")
             tx_idx: T.let[T.int64] = ty * TX + tx
             shared_buf[tx_idx] = source_local[thread_elem - 1]
             output_local[0] = T.if_then_else(
@@ -167,9 +168,9 @@ def gpu_multinomial_from_uniform(
         reduce_op: Callable,  # T.macro
         mask_local: T.Buffer | None = None,
     ):
-        with T.sblock():
-            local_sum = T.sblock_alloc_buffer((), dtype, scope="local")
-            shared_buf = T.sblock_alloc_buffer((TX * TY,), dtype, scope="shared")
+        with Ts.sblock():
+            local_sum = Ts.sblock_alloc_buffer((), dtype, scope="local")
+            shared_buf = Ts.sblock_alloc_buffer((TX * TY,), dtype, scope="shared")
             idx: T.let[T.int64] = ty * TX + tx
 
             local_sum[()] = T.Cast(dtype, init_value)
@@ -199,14 +200,14 @@ def gpu_multinomial_from_uniform(
         uniform_sample,
         sample_id_local,
     ):
-        with T.sblock():
-            prob_gt_threshold = T.sblock_alloc_buffer((thread_elem,), prob_dtype, scope="local")
-            cumsum = T.sblock_alloc_buffer((block_elem,), prob_dtype, scope="shared")
-            greater_than_u = T.sblock_alloc_buffer((thread_elem,), "bool", scope="local")
-            mask = T.sblock_alloc_buffer((thread_elem,), "bool", scope="local")
-            valid = T.sblock_alloc_buffer((thread_elem,), "bool", scope="local")
-            indices = T.sblock_alloc_buffer((thread_elem), dtype, scope="local")
-            step_aggregate = T.sblock_alloc_buffer((), prob_dtype, scope="local")
+        with Ts.sblock():
+            prob_gt_threshold = Ts.sblock_alloc_buffer((thread_elem,), prob_dtype, scope="local")
+            cumsum = Ts.sblock_alloc_buffer((block_elem,), prob_dtype, scope="shared")
+            greater_than_u = Ts.sblock_alloc_buffer((thread_elem,), "bool", scope="local")
+            mask = Ts.sblock_alloc_buffer((thread_elem,), "bool", scope="local")
+            valid = Ts.sblock_alloc_buffer((thread_elem,), "bool", scope="local")
+            indices = Ts.sblock_alloc_buffer((thread_elem), dtype, scope="local")
+            step_aggregate = Ts.sblock_alloc_buffer((), prob_dtype, scope="local")
             # Load prob data from global memory to local memory
             for v in T.unroll(thread_elem):
                 idx: T.let[T.int64] = step_iter * block_elem + ty * warp_elem + tx * thread_elem + v
@@ -258,7 +259,7 @@ def gpu_multinomial_from_uniform(
 
             aggregate[()] += step_aggregate[()]
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def parallel_sampling_from_prob(
         var_prob: T.handle,
         var_uniform_samples: T.handle,
@@ -273,9 +274,9 @@ def gpu_multinomial_from_uniform(
         row_indices = T.match_buffer(var_row_indices, (batch_size, 1), sample_indices_dtype)
         token_ids = T.match_buffer(var_sampled_token_ids, (batch_size, 1), dtype)
         # local buffers
-        aggregate = T.sblock_alloc_buffer((), prob_dtype, scope="local")
-        sample_id_local = T.sblock_alloc_buffer((), dtype, scope="local")
-        step_iter = T.sblock_alloc_buffer((), "int32", scope="local")
+        aggregate = Ts.sblock_alloc_buffer((), prob_dtype, scope="local")
+        sample_id_local = Ts.sblock_alloc_buffer((), dtype, scope="local")
+        step_iter = Ts.sblock_alloc_buffer((), "int32", scope="local")
 
         for bx in T.thread_binding(batch_size, thread="blockIdx.x"):
             row_idx: T.let[T.int64] = T.Cast("int64", row_indices[bx, 0])
@@ -317,7 +318,7 @@ def generic_get_sample_index(
 ):
     """Generate a generic get_sample_index kernel."""
 
-    @T.prim_func(private=True, s_tir=True)
+    @Ts.prim_func(private=True)
     def _get_sample_index(A: T.handle, B: T.handle, C: T.handle, D: T.handle):
         batch, vocab_size = T.int64(), T.int64()
         prob = T.match_buffer(A, (batch, vocab_size), prob_dtype)
@@ -327,9 +328,9 @@ def generic_get_sample_index(
         output_index = T.match_buffer(D, (out_batch, 1), dtype)
 
         for ax0, ax1 in T.grid(out_batch, vocab_size):
-            with T.sblock("T_get_sample_index"):
-                v_ax0, v_ax1 = T.axis.remap("SS", [ax0, ax1])
-                T.writes(output_index[v_ax0, 0])
+            with Ts.sblock("T_get_sample_index"):
+                v_ax0, v_ax1 = Ts.axis.remap("SS", [ax0, ax1])
+                Ts.writes(output_index[v_ax0, 0])
                 if (
                     usample[v_ax0, T.int64(0)] < prob[sample_indices[v_ax0, T.int64(0)], v_ax1]
                     or v_ax1 + 1 == vocab_size
diff --git a/python/tvm/relax/block_builder.py b/python/tvm/relax/block_builder.py
index d67c70e0cb..13a50bfa13 100644
--- a/python/tvm/relax/block_builder.py
+++ b/python/tvm/relax/block_builder.py
@@ -472,7 +472,7 @@ class BlockBuilder(Object):
 
             @tvm.script.ir_module
             class Module:
-                @T.prim_func(s_tir=True)
+                @Ts.prim_func
                 def te_func(var_rxplaceholder: T.handle, var_rxplaceholder_1: T.handle,
                             var_compute: T.handle) -> None:
                     # function attr dict
@@ -483,12 +483,12 @@ class BlockBuilder(Object):
                     rxplaceholder_1 = T.match_buffer(var_rxplaceholder_1, [n, m], dtype="float32")
                     compute = T.match_buffer(var_compute, [128, 128], dtype="float32")
                     # body
-                    # with T.sblock("root")
+                    # with Ts.sblock("root")
                     for i0, i1 in T.grid(128, 128):
-                        with T.sblock("compute"):
-                            i, j = T.axis.remap("SS", [i0, i1])
-                            T.reads([rxplaceholder[i, j], rxplaceholder_1[i, j]])
-                            T.writes([compute[i, j]])
+                        with Ts.sblock("compute"):
+                            i, j = Ts.axis.remap("SS", [i0, i1])
+                            Ts.reads([rxplaceholder[i, j], rxplaceholder_1[i, j]])
+                            Ts.writes([compute[i, j]])
                             compute[i, j] = rxplaceholder[i, j] + rxplaceholder_1[i, j]
 
                 @R.function
@@ -521,18 +521,18 @@ class BlockBuilder(Object):
 
             @tvm.script.ir_module
             class Module:
-                @T.prim_func(s_tir=True)
+                @Ts.prim_func
                 def te_func(var_rxplaceholder: T.handle, var_compute: T.handle, n: T.int64) -> None:
                     rxplaceholder = T.match_buffer(var_rxplaceholder, [n + T.int64(1)],
                                                    dtype="float32")
                     compute = T.match_buffer(var_compute, [n + T.int64(1)], dtype="float32")
                     # body
-                    # with T.sblock("root")
+                    # with Ts.sblock("root")
                     for i0 in T.serial(0, n + T.int64(1)):
-                        with T.sblock("compute"):
-                            i = T.axis.spatial(n + T.int64(1), i0)
-                            T.reads([rxplaceholder[i]])
-                            T.writes([compute[i]])
+                        with Ts.sblock("compute"):
+                            i = Ts.axis.spatial(n + T.int64(1), i0)
+                            Ts.reads([rxplaceholder[i]])
+                            Ts.writes([compute[i]])
                             compute[i] = rxplaceholder[i]
 
                 @R.function
diff --git a/python/tvm/relax/frontend/nn/llm/_decode_kernels.py b/python/tvm/relax/frontend/nn/llm/_decode_kernels.py
index f03b9ff432..adbd414639 100644
--- a/python/tvm/relax/frontend/nn/llm/_decode_kernels.py
+++ b/python/tvm/relax/frontend/nn/llm/_decode_kernels.py
@@ -31,6 +31,7 @@ Contents:
 import math
 from typing import Any
 
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 from tvm.target import Target
 
@@ -56,7 +57,7 @@ def _attention_decode_cpu(num_kv_heads, num_qo_heads, head_dim, qkv_dtype, slidi
     if sliding_window:
         global_symbol += "_sliding_window"
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def batch_decode_paged_kv(
         Q_handle: T.handle,
         pages_handle: T.handle,
@@ -101,20 +102,20 @@ def _attention_decode_cpu(num_kv_heads, num_qo_heads, head_dim, qkv_dtype, slidi
         length_info = _declare_length_info(var_length_info, B, sliding_window, length_info_elem_offset)
 
         for b in T.serial(B):
-            with T.sblock("attn"):
-                O_local = T.sblock_alloc_buffer((D,), "float32")
-                Q_local = T.sblock_alloc_buffer((D,), "float32")
-                K_local = T.sblock_alloc_buffer((D,), "float32")
-                V_local = T.sblock_alloc_buffer((D,), "float32")
+            with Ts.sblock("attn"):
+                O_local = Ts.sblock_alloc_buffer((D,), "float32")
+                Q_local = Ts.sblock_alloc_buffer((D,), "float32")
+                K_local = Ts.sblock_alloc_buffer((D,), "float32")
+                V_local = Ts.sblock_alloc_buffer((D,), "float32")
 
-                kv_chunk_len = T.sblock_alloc_buffer((1,), "int32")
+                kv_chunk_len = Ts.sblock_alloc_buffer((1,), "int32")
 
-                m_val = T.sblock_alloc_buffer((1,), "float32")
-                new_m = T.sblock_alloc_buffer((1,), "float32")
-                d_val = T.sblock_alloc_buffer((1,), "float32")
-                S_val = T.sblock_alloc_buffer((1,), "float32")
-                scale_O = T.sblock_alloc_buffer((1,), "float32")
-                factor = T.sblock_alloc_buffer((1,), "float32")
+                m_val = Ts.sblock_alloc_buffer((1,), "float32")
+                new_m = Ts.sblock_alloc_buffer((1,), "float32")
+                d_val = Ts.sblock_alloc_buffer((1,), "float32")
+                S_val = Ts.sblock_alloc_buffer((1,), "float32")
+                scale_O = Ts.sblock_alloc_buffer((1,), "float32")
+                factor = Ts.sblock_alloc_buffer((1,), "float32")
 
                 cur_page_indptr_begin: T.let[T.int32] = page_table_indptr[b]
                 cur_page_indptr_end: T.let[T.int32] = page_table_indptr[b + 1]
@@ -211,7 +212,7 @@ def _attention_decode(num_kv_heads, num_qo_heads, head_dim, qkv_dtype, sliding_w
         global_symbol += "_sliding_window"
 
     # pylint: disable=too-many-branches
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def batch_decode_paged_kv(
         Q_handle: T.handle,
         pages_handle: T.handle,
@@ -253,29 +254,29 @@ def _attention_decode(num_kv_heads, num_qo_heads, head_dim, qkv_dtype, sliding_w
                 for ty in T.thread_binding(bdy, thread="threadIdx.y"):
                     for tx in T.thread_binding(bdx, thread="threadIdx.x"):
                         for tz in T.thread_binding(bdz, thread="threadIdx.z"):
-                            with T.sblock("attn"):
-                                Q_local = T.sblock_alloc_buffer((VEC_SIZE,), qkv_dtype, scope="local")
-                                kv_chunk_len = T.sblock_alloc_buffer((1,), "int32", scope="local")
-                                K_smem = T.sblock_alloc_buffer((bdz * bdy * tile_size_per_bdx, D), qkv_dtype, scope="shared")
-                                V_smem = T.sblock_alloc_buffer((bdz * bdy * tile_size_per_bdx, D), qkv_dtype, scope="shared")
-                                O_allreduce = T.sblock_alloc_buffer((bdz, bdy, D), "float32", scope="shared")
-                                md_allreduce = T.sblock_alloc_buffer((bdz, bdy, 2), "float32", scope="shared")
-                                S_reduce_local = T.sblock_alloc_buffer((1,), "float32", scope="local")
-                                t0 = T.sblock_alloc_buffer((1,), "float32", scope="local")
-
-                                S_local = T.sblock_alloc_buffer((bdy * tile_size_per_bdx), "float32", scope="local")
-                                QK_local = T.sblock_alloc_buffer((VEC_SIZE,), "float32", scope="local")
-                                V_local = T.sblock_alloc_buffer((VEC_SIZE,), qkv_dtype, scope="local")
-                                m_prev = T.sblock_alloc_buffer((1,), "float32", scope="local")
-                                d_prev = T.sblock_alloc_buffer((1,), "float32", scope="local")
-                                other_m = T.sblock_alloc_buffer((1,), "float32", scope="local")
-                                other_d = T.sblock_alloc_buffer((1,), "float32", scope="local")
-                                exp_mprev = T.sblock_alloc_buffer((1,), "float32", scope="local")
-                                exp_otherm = T.sblock_alloc_buffer((1,), "float32", scope="local")
-                                other_o = T.sblock_alloc_buffer((VEC_SIZE,), "float32", scope="local")
-                                st_m = T.sblock_alloc_buffer((1,), "float32", scope="local")
-                                st_d = T.sblock_alloc_buffer((1,), "float32", scope="local")
-                                O_local = T.sblock_alloc_buffer((VEC_SIZE,), "float32", scope="local")
+                            with Ts.sblock("attn"):
+                                Q_local = Ts.sblock_alloc_buffer((VEC_SIZE,), qkv_dtype, scope="local")
+                                kv_chunk_len = Ts.sblock_alloc_buffer((1,), "int32", scope="local")
+                                K_smem = Ts.sblock_alloc_buffer((bdz * bdy * tile_size_per_bdx, D), qkv_dtype, scope="shared")
+                                V_smem = Ts.sblock_alloc_buffer((bdz * bdy * tile_size_per_bdx, D), qkv_dtype, scope="shared")
+                                O_allreduce = Ts.sblock_alloc_buffer((bdz, bdy, D), "float32", scope="shared")
+                                md_allreduce = Ts.sblock_alloc_buffer((bdz, bdy, 2), "float32", scope="shared")
+                                S_reduce_local = Ts.sblock_alloc_buffer((1,), "float32", scope="local")
+                                t0 = Ts.sblock_alloc_buffer((1,), "float32", scope="local")
+
+                                S_local = Ts.sblock_alloc_buffer((bdy * tile_size_per_bdx), "float32", scope="local")
+                                QK_local = Ts.sblock_alloc_buffer((VEC_SIZE,), "float32", scope="local")
+                                V_local = Ts.sblock_alloc_buffer((VEC_SIZE,), qkv_dtype, scope="local")
+                                m_prev = Ts.sblock_alloc_buffer((1,), "float32", scope="local")
+                                d_prev = Ts.sblock_alloc_buffer((1,), "float32", scope="local")
+                                other_m = Ts.sblock_alloc_buffer((1,), "float32", scope="local")
+                                other_d = Ts.sblock_alloc_buffer((1,), "float32", scope="local")
+                                exp_mprev = Ts.sblock_alloc_buffer((1,), "float32", scope="local")
+                                exp_otherm = Ts.sblock_alloc_buffer((1,), "float32", scope="local")
+                                other_o = Ts.sblock_alloc_buffer((VEC_SIZE,), "float32", scope="local")
+                                st_m = Ts.sblock_alloc_buffer((1,), "float32", scope="local")
+                                st_d = Ts.sblock_alloc_buffer((1,), "float32", scope="local")
+                                O_local = Ts.sblock_alloc_buffer((VEC_SIZE,), "float32", scope="local")
 
                                 by: T.let[T.int32] = fused_by_bz % H_kv
                                 bz: T.let[T.int32] = fused_by_bz // H_kv
@@ -307,9 +308,9 @@ def _attention_decode(num_kv_heads, num_qo_heads, head_dim, qkv_dtype, sliding_w
                                     tile_start_g: T.let[T.int32()] = ((iterator * bdz + tz) * bdy + ty) * tile_size_per_bdx  # type: ignore
                                     # load KV from global memory to shared memory
                                     for j in T.serial(tile_size_per_bdx):
-                                        with T.sblock("KV_load"):
-                                            T.reads()
-                                            T.writes()
+                                        with Ts.sblock("KV_load"):
+                                            Ts.reads()
+                                            Ts.writes()
                                             row_g: T.let[T.int32()] = tile_start_g + j  # type: ignore
                                             if row_g < kv_chunk_len[0]:
                                                 seq_offset: T.let[T.int32()] = _get_seq_offset(row_g, batch_idx, length_info, sliding_window)  # type: ignore
@@ -337,9 +338,9 @@ def _attention_decode(num_kv_heads, num_qo_heads, head_dim, qkv_dtype, sliding_w
                                         for vec in T.unroll(VEC_SIZE):
                                             S_reduce_local[0] += QK_local[vec]
 
-                                        with T.sblock("block_cross_thread"):
-                                            T.reads(S_reduce_local[0])
-                                            T.writes(t0[0])
+                                        with Ts.sblock("block_cross_thread"):
+                                            Ts.reads(S_reduce_local[0])
+                                            Ts.writes(t0[0])
                                             T.attr(
                                                 T.comm_reducer(lambda x0, y0: x0 + y0, [T.float32(0)]),
                                                 "reduce_scope",
@@ -412,7 +413,7 @@ def _attention_decode(num_kv_heads, num_qo_heads, head_dim, qkv_dtype, sliding_w
 
 
 def _merge_state_inplace_cpu(v_dtype):
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def merge_state_inplace_cpu(
         v: T.handle,
         s: T.handle,
@@ -431,7 +432,7 @@ def _merge_state_inplace_cpu(v_dtype):
 
         for n in T.serial(N):
             for h in T.serial(H):
-                with T.sblock("merge"):
+                with Ts.sblock("merge"):
                     s_val = _var_cpu("float32")
                     s_other_val = _var_cpu("float32")
                     s_max = _var_cpu("float32")
@@ -463,7 +464,7 @@ def _merge_state_inplace(num_heads, head_dim, v_dtype, target: Target, global_sy
     gdy = num_heads // bdy
     check_thread_limits(target, bdx=bdx, bdy=bdy, bdz=1, gdz=1)
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def merge_state_inplace(
         v: T.handle,
         s: T.handle,
@@ -484,15 +485,15 @@ def _merge_state_inplace(num_heads, head_dim, v_dtype, target: Target, global_sy
             for by in T.thread_binding(gdy, thread="blockIdx.y"):
                 for ty in T.thread_binding(bdy, thread="threadIdx.y"):
                     for tx in T.thread_binding(bdx, thread="threadIdx.x"):
-                        with T.sblock("merge"):
+                        with Ts.sblock("merge"):
                             s_val = _var("float32")
                             s_other_val = _var("float32")
                             s_max = _var("float32")
                             scale = _var("float32")
                             other_scale = _var("float32")
 
-                            v_vec = T.sblock_alloc_buffer((VEC_SIZE,), v_dtype, scope="local")
-                            v_other_vec = T.sblock_alloc_buffer((VEC_SIZE,), v_dtype, scope="local")
+                            v_vec = Ts.sblock_alloc_buffer((VEC_SIZE,), v_dtype, scope="local")
+                            v_other_vec = Ts.sblock_alloc_buffer((VEC_SIZE,), v_dtype, scope="local")
 
                             s_val[0] = S[bx, ty + by * bdy]
                             s_other_val[0] = S_other[bx, ty + by * bdy]
diff --git a/python/tvm/relax/frontend/nn/llm/_kernel_common.py b/python/tvm/relax/frontend/nn/llm/_kernel_common.py
index 1ff2db07fd..f0d6f30dae 100644
--- a/python/tvm/relax/frontend/nn/llm/_kernel_common.py
+++ b/python/tvm/relax/frontend/nn/llm/_kernel_common.py
@@ -40,6 +40,7 @@ from typing import Any
 import tvm
 from tvm import s_tir, tirx
 from tvm.runtime import DataType
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 from tvm.target import Target
 
@@ -47,11 +48,11 @@ from .position_embedding import switch_rope_freq_func
 
 
 def _var(dtype):
-    return T.sblock_alloc_buffer((1,), dtype, scope="local")
+    return Ts.sblock_alloc_buffer((1,), dtype, scope="local")
 
 
 def _var_cpu(dtype):
-    return T.sblock_alloc_buffer((1,), dtype)
+    return Ts.sblock_alloc_buffer((1,), dtype)
 
 
 def get_max_num_threads_per_block(target: Target) -> int:
@@ -175,32 +176,32 @@ def _alloc_softmax_state_buffers(tile_x, tile_z, bdx, num_warps):
 
     Returns ``(S_smem, S_local, m_smem, m_prev_smem, d_smem, m_new, m_prev, d_new)``.
     """
-    S_smem = T.sblock_alloc_buffer((tile_x, tile_z), "float32", scope="shared")
-    S_local = T.sblock_alloc_buffer((tile_x, tile_z), "float32", scope="local")
-    m_smem = T.sblock_alloc_buffer((tile_x,), "float32", scope="shared")
-    m_prev_smem = T.sblock_alloc_buffer((tile_x,), "float32", scope="shared")
-    d_smem = T.sblock_alloc_buffer((tile_x,), "float32", scope="shared")
+    S_smem = Ts.sblock_alloc_buffer((tile_x, tile_z), "float32", scope="shared")
+    S_local = Ts.sblock_alloc_buffer((tile_x, tile_z), "float32", scope="local")
+    m_smem = Ts.sblock_alloc_buffer((tile_x,), "float32", scope="shared")
+    m_prev_smem = Ts.sblock_alloc_buffer((tile_x,), "float32", scope="shared")
+    d_smem = Ts.sblock_alloc_buffer((tile_x,), "float32", scope="shared")
     md_shape = (math.ceil(tile_x / (bdx * num_warps)),)
-    m_new = T.sblock_alloc_buffer(md_shape, "float32", scope="local")
-    m_prev = T.sblock_alloc_buffer(md_shape, "float32", scope="local")
-    d_new = T.sblock_alloc_buffer(md_shape, "float32", scope="local")
+    m_new = Ts.sblock_alloc_buffer(md_shape, "float32", scope="local")
+    m_prev = Ts.sblock_alloc_buffer(md_shape, "float32", scope="local")
+    d_new = Ts.sblock_alloc_buffer(md_shape, "float32", scope="local")
     return S_smem, S_local, m_smem, m_prev_smem, d_smem, m_new, m_prev, d_new
 
 
 def _alloc_mha_qkvo_buffers(tile_x, tile_z, d_qk, d_v, dtype):
     """Allocate Q/K/V shared + O local buffers for standard MHA/GQA prefill kernels."""
-    Q_smem = T.sblock_alloc_buffer((tile_x, d_qk), dtype, scope="shared")
-    K_smem = T.sblock_alloc_buffer((tile_z, d_qk), dtype, scope="shared")
-    V_smem = T.sblock_alloc_buffer((tile_z, d_v), dtype, scope="shared")
-    O_local = T.sblock_alloc_buffer((tile_x, d_v), "float32", scope="local")
+    Q_smem = Ts.sblock_alloc_buffer((tile_x, d_qk), dtype, scope="shared")
+    K_smem = Ts.sblock_alloc_buffer((tile_z, d_qk), dtype, scope="shared")
+    V_smem = Ts.sblock_alloc_buffer((tile_z, d_v), dtype, scope="shared")
+    O_local = Ts.sblock_alloc_buffer((tile_x, d_v), "float32", scope="local")
     return Q_smem, K_smem, V_smem, O_local
 
 
 def _alloc_mla_qkvo_buffers(tile_x, tile_z, d_qk, d_latent, dtype):
     """Allocate Q + combined KV shared + O local for MLA prefill (V reuses the KV buffer)."""
-    Q_smem = T.sblock_alloc_buffer((tile_x, d_qk), dtype, scope="shared")
-    KV_smem = T.sblock_alloc_buffer((tile_z, d_qk), dtype, scope="shared")
-    O_local = T.sblock_alloc_buffer((tile_x, d_latent), "float32", scope="local")
+    Q_smem = Ts.sblock_alloc_buffer((tile_x, d_qk), dtype, scope="shared")
+    KV_smem = Ts.sblock_alloc_buffer((tile_z, d_qk), dtype, scope="shared")
+    O_local = Ts.sblock_alloc_buffer((tile_x, d_latent), "float32", scope="local")
     return Q_smem, KV_smem, O_local
 
 
@@ -229,8 +230,8 @@ def _make_prefill_macros(tile_x, tile_y, tile_z, tile_o, bdx, num_warps, group_s
                 m_smem[row] = -5e4
                 d_smem[row] = 1.0
         for li, lj in T.grid(tile_x, tile_o):
-            with T.sblock("O_init"):
-                i, j = T.axis.remap("SS", [li, lj])
+            with Ts.sblock("O_init"):
+                i, j = Ts.axis.remap("SS", [li, lj])
                 O_local[i, j] = 0.0
         T.tvm_storage_sync("shared")
 
@@ -238,17 +239,17 @@ def _make_prefill_macros(tile_x, tile_y, tile_z, tile_o, bdx, num_warps, group_s
     def compute_s_gemm(
         Q_smem: T.Buffer, K_smem: T.Buffer, S_local: T.Buffer, S_smem: T.Buffer, sm_scale: T.float32,
     ):
-        with T.sblock():
+        with Ts.sblock():
             for li, lj, lk in T.grid(tile_x, tile_z, tile_y):
-                with T.sblock("S_gemm"):
-                    i, j, k = T.axis.remap("SSR", [li, lj, lk])
-                    with T.init():
+                with Ts.sblock("S_gemm"):
+                    i, j, k = Ts.axis.remap("SSR", [li, lj, lk])
+                    with Ts.init():
                         S_local[i, j] = 0.0
                     S_local[i, j] += T.cast(Q_smem[i, k], "float32") * T.cast(K_smem[j, k], "float32") * sm_scale * math.log2(math.exp(1))
         T.tvm_storage_sync("shared")
         for li, lj in T.grid(tile_x, tile_z):
-            with T.sblock("S_store"):
-                i, j = T.axis.remap("SS", [li, lj])
+            with Ts.sblock("S_store"):
+                i, j = Ts.axis.remap("SS", [li, lj])
                 S_smem[i, j] = S_local[i, j]
         T.tvm_storage_sync("shared")
 
@@ -263,7 +264,7 @@ def _make_prefill_macros(tile_x, tile_y, tile_z, tile_o, bdx, num_warps, group_s
         for i in T.serial(T.ceildiv(tile_x, bdx * num_warps)):
             row: T.let[T.int32] = i * bdx * num_warps + ty * bdx + tx
             if row < tile_x:
-                with T.sblock("update1"):
+                with Ts.sblock("update1"):
                     m_prev[i] = m_smem[row]
                     m_new[i] = m_smem[row]
                     row_: T.let[T.int32] = (LH_start + row) // group_size
@@ -274,7 +275,7 @@ def _make_prefill_macros(tile_x, tile_y, tile_z, tile_o, bdx, num_warps, group_s
         # Phase 2: exp-and-scale S_smem; masked-out entries use -inf
         for i in T.serial(T.ceildiv(tile_x, bdx * num_warps)):
             row: T.let[T.int32] = i * bdx * num_warps + ty * bdx + tx
-            with T.sblock("update"):
+            with Ts.sblock("update"):
                 for j in T.serial(tile_z):
                     # predicate sits inside loop so sync stays outside conditional branches
                     if row < tile_x:
@@ -287,7 +288,7 @@ def _make_prefill_macros(tile_x, tile_y, tile_z, tile_o, bdx, num_warps, group_s
         for i in T.serial(T.ceildiv(tile_x, bdx * num_warps)):
             row: T.let[T.int32] = i * bdx * num_warps + ty * bdx + tx
             if row < tile_x:
-                with T.sblock("update"):
+                with Ts.sblock("update"):
                     for j in T.serial(tile_z):
                         d_new[i] += S_smem[row, j]
                     m_smem[row] = m_new[i]
@@ -300,11 +301,11 @@ def _make_prefill_macros(tile_x, tile_y, tile_z, tile_o, bdx, num_warps, group_s
         S_smem: T.Buffer, V_smem: T.Buffer, O_local: T.Buffer,
         m_prev_smem: T.Buffer, m_smem: T.Buffer,
     ):
-        with T.sblock():
+        with Ts.sblock():
             for li, lj, lk in T.grid(tile_x, tile_o, tile_z):
-                with T.sblock("O_gemm"):
-                    i, j, k = T.axis.remap("SSR", [li, lj, lk])
-                    with T.init():
+                with Ts.sblock("O_gemm"):
+                    i, j, k = Ts.axis.remap("SSR", [li, lj, lk])
+                    with Ts.init():
                         O_local[i, j] *= T.exp2(m_prev_smem[i] - m_smem[i])
                     O_local[i, j] += S_smem[i, k] * T.cast(V_smem[k, j], "float32")
 
@@ -319,15 +320,15 @@ def _make_prefill_macros(tile_x, tile_y, tile_z, tile_o, bdx, num_warps, group_s
         the ``by * group_size`` term drops to zero at compile time.
         """
         for li, lj in T.grid(tile_x, tile_o):
-            with T.sblock("O_store"):
-                i, j = T.axis.remap("SS", [li, lj])
+            with Ts.sblock("O_store"):
+                i, j = Ts.axis.remap("SS", [li, lj])
                 cur_L: T.let[T.int32] = q_indptr[b_idx] + (LH_start + i) // group_size
                 cur_H_qo: T.let[T.int32] = by * group_size + (LH_start + i) % group_size
                 if cur_L < q_indptr[b_idx + 1]:
                     output[cur_L, cur_H_qo, j] = O_local[i, j] / d_smem[i]
         for li in T.grid(tile_x):
-            with T.sblock("lse_store"):
-                i = T.axis.remap("S", [li])
+            with Ts.sblock("lse_store"):
+                i = Ts.axis.remap("S", [li])
                 cur_L: T.let[T.int32] = q_indptr[b_idx] + (LH_start + i) // group_size
                 cur_H_qo: T.let[T.int32] = by * group_size + (LH_start + i) % group_size
                 if cur_L < q_indptr[b_idx + 1]:
@@ -363,7 +364,7 @@ def _make_prefill_macros(tile_x, tile_y, tile_z, tile_o, bdx, num_warps, group_s
         for i in T.serial(T.ceildiv(tile_x, bdx * num_warps)):
             row: T.let[T.int32] = i * bdx * num_warps + ty * bdx + tx
             if row < tile_x:
-                with T.sblock("update1"):
+                with Ts.sblock("update1"):
                     m_prev[i] = m_smem[row]
                     m_new[i] = m_smem[row]
                     row_: T.let[T.int32] = (LH_start + row) // group_size
@@ -373,7 +374,7 @@ def _make_prefill_macros(tile_x, tile_y, tile_z, tile_o, bdx, num_warps, group_s
                     d_new[i] = d_smem[row] * T.exp2(m_prev[i] - m_new[i])
         for i in T.serial(T.ceildiv(tile_x, bdx * num_warps)):
             row: T.let[T.int32] = i * bdx * num_warps + ty * bdx + tx
-            with T.sblock("update"):
+            with Ts.sblock("update"):
                 for j in T.serial(tile_z):
                     if row < tile_x:
                         row_: T.let[T.int32] = (LH_start + row) // group_size
@@ -384,7 +385,7 @@ def _make_prefill_macros(tile_x, tile_y, tile_z, tile_o, bdx, num_warps, group_s
         for i in T.serial(T.ceildiv(tile_x, bdx * num_warps)):
             row: T.let[T.int32] = i * bdx * num_warps + ty * bdx + tx
             if row < tile_x:
-                with T.sblock("update"):
+                with Ts.sblock("update"):
                     for j in T.serial(tile_z):
                         d_new[i] += S_smem[row, j]
                     m_smem[row] = m_new[i]
@@ -406,7 +407,7 @@ def _make_prefill_macros(tile_x, tile_y, tile_z, tile_o, bdx, num_warps, group_s
         for i in T.serial(T.ceildiv(tile_x, bdx * num_warps)):
             row: T.let[T.int32] = i * bdx * num_warps + ty * bdx + tx
             if row < tile_x:
-                with T.sblock("update1"):
+                with Ts.sblock("update1"):
                     m_prev[i] = m_smem[row]
                     m_new[i] = m_smem[row]
                     row_: T.let[T.int32] = (LH_start + row) // group_size
@@ -419,7 +420,7 @@ def _make_prefill_macros(tile_x, tile_y, tile_z, tile_o, bdx, num_warps, group_s
                     d_new[i] = d_smem[row] * T.exp2(m_prev[i] - m_new[i])
         for i in T.serial(T.ceildiv(tile_x, bdx * num_warps)):
             row: T.let[T.int32] = i * bdx * num_warps + ty * bdx + tx
-            with T.sblock("update"):
+            with Ts.sblock("update"):
                 for j in T.serial(tile_z):
                     if row < tile_x:
                         row_: T.let[T.int32] = (LH_start + row) // group_size
@@ -433,7 +434,7 @@ def _make_prefill_macros(tile_x, tile_y, tile_z, tile_o, bdx, num_warps, group_s
         for i in T.serial(T.ceildiv(tile_x, bdx * num_warps)):
             row: T.let[T.int32] = i * bdx * num_warps + ty * bdx + tx
             if row < tile_x:
-                with T.sblock("update"):
+                with Ts.sblock("update"):
                     for j in T.serial(tile_z):
                         d_new[i] += S_smem[row, j]
                     m_smem[row] = m_new[i]
diff --git a/python/tvm/relax/frontend/nn/llm/_page_kernels.py b/python/tvm/relax/frontend/nn/llm/_page_kernels.py
index 882de88e45..da43ddd79f 100644
--- a/python/tvm/relax/frontend/nn/llm/_page_kernels.py
+++ b/python/tvm/relax/frontend/nn/llm/_page_kernels.py
@@ -31,6 +31,7 @@ This module contains:
 """
 
 # pylint: disable=too-many-statements,too-many-arguments,invalid-name,line-too-long
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 from tvm.target import Target
 
@@ -40,7 +41,7 @@ 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."""
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def tir_kv_cache_transpose_append(
         var_pages: T.handle,
         var_k_data: T.handle,
@@ -58,16 +59,16 @@ def _kv_cache_transpose_append(num_key_value_heads, head_dim, dtype, page_size:
         position_map = T.match_buffer(var_position_map, (ntoken,), "int32", elem_offset=position_map_elem_offset)
         for global_pos, h, f in T.grid(ntoken, num_key_value_heads, head_dim):
             if position_map[global_pos] != T.int32(-1):
-                with T.sblock("k_transpose_append"):
-                    vgpos, vh, vf = T.axis.remap("SSS", [global_pos, h, f])
-                    T.reads(position_map[vgpos], k_data[vgpos, vh, vf])
-                    T.writes(pages[position_map[vgpos] // page_size, 0, vh, position_map[vgpos] % page_size, vf])
+                with Ts.sblock("k_transpose_append"):
+                    vgpos, vh, vf = Ts.axis.remap("SSS", [global_pos, h, f])
+                    Ts.reads(position_map[vgpos], k_data[vgpos, vh, vf])
+                    Ts.writes(pages[position_map[vgpos] // page_size, 0, vh, position_map[vgpos] % page_size, vf])
                     position: T.int32 = position_map[vgpos]  # type: ignore
                     pages[T.floordiv(position, page_size), 0, vh, T.floormod(position, page_size), vf] = k_data[vgpos, vh, vf]
-                with T.sblock("v_transpose_append"):
-                    vgpos, vh, vf = T.axis.remap("SSS", [global_pos, h, f])
-                    T.reads(position_map[vgpos], v_data[vgpos, vh, vf])
-                    T.writes(pages[position_map[vgpos] // page_size, 1, vh, position_map[vgpos] % page_size, vf])
+                with Ts.sblock("v_transpose_append"):
+                    vgpos, vh, vf = Ts.axis.remap("SSS", [global_pos, h, f])
+                    Ts.reads(position_map[vgpos], v_data[vgpos, vh, vf])
+                    Ts.writes(pages[position_map[vgpos] // page_size, 1, vh, position_map[vgpos] % page_size, vf])
                     position: T.int32 = position_map[vgpos] # type: ignore[name-defined,no-redef]
                     pages[T.floordiv(position, page_size), 1, vh, T.floormod(position, page_size), vf] = v_data[vgpos, vh, vf]
 
@@ -77,7 +78,7 @@ 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."""
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def tir_kv_cache_transpose_append_mla(
         var_pages: T.handle,
         var_kv_data: T.handle,
@@ -93,10 +94,10 @@ def _kv_cache_transpose_append_mla(d_qk: int, dtype, page_size: int = 16):
         position_map = T.match_buffer(var_position_map, (ntoken,), "int32", elem_offset=position_map_elem_offset)
         for global_pos, f in T.grid(ntoken, d_qk):
             if position_map[global_pos] != T.int32(-1):
-                with T.sblock("k_transpose_append"):
-                    vgpos, vf = T.axis.remap("SS", [global_pos, f])
-                    T.reads(position_map[vgpos], kv_data[vgpos, vf])
-                    T.writes(pages[position_map[vgpos] // page_size, position_map[vgpos] % page_size, vf])
+                with Ts.sblock("k_transpose_append"):
+                    vgpos, vf = Ts.axis.remap("SS", [global_pos, f])
+                    Ts.reads(position_map[vgpos], kv_data[vgpos, vf])
+                    Ts.writes(pages[position_map[vgpos] // page_size, position_map[vgpos] % page_size, vf])
                     position: T.int32 = position_map[vgpos]  # type: ignore
                     pages[T.floordiv(position, page_size), T.floormod(position, page_size), vf] = kv_data[vgpos, vf]
 
@@ -106,7 +107,7 @@ 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."""
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def tir_kv_cache_debug_get_kv(
         var_pages: T.handle,
         var_position_map: T.handle,
@@ -125,10 +126,10 @@ def _kv_cache_debug_get_kv(num_hidden_layers, num_key_value_heads, head_dim, dty
         k_data = T.match_buffer(var_k_data, (num_hidden_layers, seqlen, num_key_value_heads, head_dim), dtype)
         v_data = T.match_buffer(var_v_data, (num_hidden_layers, seqlen, num_key_value_heads, head_dim), dtype)
         for p, h, d in T.grid(seqlen, num_key_value_heads, head_dim):
-            with T.sblock("copy0"):
-                vp, vh, vd = T.axis.remap("SSS", [p, h, d])
-                T.reads(position_map[vp], pages[position_map[vp] // page_size, 0:2, vh, position_map[vp] % page_size, vd])
-                T.writes(k_data[layer_id, vp, vh, vd], v_data[layer_id, vp, vh, vd])
+            with Ts.sblock("copy0"):
+                vp, vh, vd = Ts.axis.remap("SSS", [p, h, d])
+                Ts.reads(position_map[vp], pages[position_map[vp] // page_size, 0:2, vh, position_map[vp] % page_size, vd])
+                Ts.writes(k_data[layer_id, vp, vh, vd], v_data[layer_id, vp, vh, vd])
                 position: T.int32 = position_map[vp] # type: ignore[name-defined]
                 k_data[layer_id, vp, vh, vd] = pages[T.floordiv(position, page_size), 0, vh, T.floormod(position, page_size), vd]
                 v_data[layer_id, vp, vh, vd] = pages[T.floordiv(position, page_size), 1, vh, T.floormod(position, page_size), vd]
@@ -139,7 +140,7 @@ 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."""
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def tir_kv_cache_debug_get_kv_mla(
         var_pages: T.handle,
         var_position_map: T.handle,
@@ -156,10 +157,10 @@ def _kv_cache_debug_get_kv_mla(num_hidden_layers, d_qk, dtype):
         position_map = T.match_buffer(var_position_map, (seqlen,), "int32", elem_offset=position_map_elem_offset)
         compressed_kv_with_k_pe_data = T.match_buffer(var_compressed_kv_with_k_pe_data, (num_hidden_layers, seqlen, d_qk), dtype)
         for p, d in T.grid(seqlen, d_qk):
-            with T.sblock("copy0"):
-                vp, vd = T.axis.remap("SS", [p, d])
-                T.reads(position_map[vp], pages[position_map[vp] // page_size, position_map[vp] % page_size, vd])
-                T.writes(compressed_kv_with_k_pe_data[layer_id, vp, vd])
+            with Ts.sblock("copy0"):
+                vp, vd = Ts.axis.remap("SS", [p, d])
+                Ts.reads(position_map[vp], pages[position_map[vp] // page_size, position_map[vp] % page_size, vd])
+                Ts.writes(compressed_kv_with_k_pe_data[layer_id, vp, vd])
                 position: T.int32 = position_map[vp] # type: ignore[name-defined]
                 compressed_kv_with_k_pe_data[layer_id, vp, vd] = pages[T.floordiv(position, page_size), T.floormod(position, page_size), vd]
 
@@ -169,7 +170,7 @@ def _kv_cache_debug_get_kv_mla(num_hidden_layers, d_qk, dtype):
 def _copy_single_page(num_heads, page_size, head_dim, dtype, target: Target):
     tx = get_max_num_threads_per_block(target)
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def copy_single_page(var_pages: T.handle, src_page_id: T.int64, tgt_page_id: T.int64, copy_length: T.int64):
         T.func_attr({"tirx.is_scheduled": True})
         num_pages = T.int32()
@@ -178,11 +179,11 @@ def _copy_single_page(num_heads, page_size, head_dim, dtype, target: Target):
 
         for b in T.thread_binding((copy_length * num_heads * head_dim + tx - 1) // tx, thread="blockIdx.x"):
             for t in T.thread_binding(tx, thread="threadIdx.x"):
-                with T.sblock("copy"):
-                    T.where(b * tx + t < copy_length * num_heads * head_dim)
-                    vh = T.axis.spatial(num_heads, T.Cast("int32", (b * tx + t) // (copy_length * head_dim)))
-                    vp = T.axis.spatial(copy_length, (b * tx + t) % (copy_length * head_dim) // head_dim)
-                    vd = T.axis.spatial(head_dim, T.Cast("int32", (b * tx + t) % head_dim))
+                with Ts.sblock("copy"):
+                    Ts.where(b * tx + t < copy_length * num_heads * head_dim)
+                    vh = Ts.axis.spatial(num_heads, T.Cast("int32", (b * tx + t) // (copy_length * head_dim)))
+                    vp = Ts.axis.spatial(copy_length, (b * tx + t) % (copy_length * head_dim) // head_dim)
+                    vd = Ts.axis.spatial(head_dim, T.Cast("int32", (b * tx + t) % head_dim))
                     pages[tgt_page_id, 0, vh, vp, vd] = pages[src_page_id, 0, vh, vp, vd]
                     pages[tgt_page_id, 1, vh, vp, vd] = pages[src_page_id, 1, vh, vp, vd]
 
@@ -192,7 +193,7 @@ def _copy_single_page(num_heads, page_size, head_dim, dtype, target: Target):
 def _copy_single_page_mla(page_size, head_dim, dtype, target: Target):
     tx = get_max_num_threads_per_block(target)
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def copy_single_page_mla(var_pages: T.handle, src_page_id: T.int64, tgt_page_id: T.int64, copy_length: T.int64):
         T.func_attr({"tirx.is_scheduled": True})
         num_pages = T.int32()
@@ -201,10 +202,10 @@ def _copy_single_page_mla(page_size, head_dim, dtype, target: Target):
 
         for b in T.thread_binding((copy_length * head_dim + tx - 1) // tx, thread="blockIdx.x"):
             for t in T.thread_binding(tx, thread="threadIdx.x"):
-                with T.sblock("copy"):
-                    T.where(b * tx + t < copy_length * head_dim)
-                    vp = T.axis.spatial(copy_length, (b * tx + t) // head_dim)
-                    vd = T.axis.spatial(head_dim, T.Cast("int32", (b * tx + t) % head_dim))
+                with Ts.sblock("copy"):
+                    Ts.where(b * tx + t < copy_length * head_dim)
+                    vp = Ts.axis.spatial(copy_length, (b * tx + t) // head_dim)
+                    vd = Ts.axis.spatial(head_dim, T.Cast("int32", (b * tx + t) % head_dim))
                     pages[tgt_page_id, vp, vd] = pages[src_page_id, vp, vd]
 
     return copy_single_page_mla
@@ -213,7 +214,7 @@ def _copy_single_page_mla(page_size, head_dim, dtype, target: Target):
 def _copy_single_page_cpu(num_heads, page_size, head_dim, dtype):
     tx = 1
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def copy_single_page_cpu(var_pages: T.handle, src_page_id: T.int64, tgt_page_id: T.int64, copy_length: T.int64):
         T.func_attr({"tirx.is_scheduled": True})
         num_pages = T.int32()
@@ -221,11 +222,11 @@ def _copy_single_page_cpu(num_heads, page_size, head_dim, dtype):
 
         for b in T.serial((copy_length * num_heads * head_dim + tx - 1) // tx):
             for t in T.serial(tx):
-                with T.sblock("copy"):
-                    T.where(b * tx + t < copy_length * num_heads * head_dim)
-                    vh = T.axis.spatial(num_heads, T.Cast("int32", (b * tx + t) // (copy_length * head_dim)))
-                    vp = T.axis.spatial(copy_length, (b * tx + t) % (copy_length * head_dim) // head_dim)
-                    vd = T.axis.spatial(head_dim, T.Cast("int32", (b * tx + t) % head_dim))
+                with Ts.sblock("copy"):
+                    Ts.where(b * tx + t < copy_length * num_heads * head_dim)
+                    vh = Ts.axis.spatial(num_heads, T.Cast("int32", (b * tx + t) // (copy_length * head_dim)))
+                    vp = Ts.axis.spatial(copy_length, (b * tx + t) % (copy_length * head_dim) // head_dim)
+                    vd = Ts.axis.spatial(head_dim, T.Cast("int32", (b * tx + t) % head_dim))
                     pages[tgt_page_id, 0, vh, vp, vd] = pages[src_page_id, 0, vh, vp, vd]
                     pages[tgt_page_id, 1, vh, vp, vd] = pages[src_page_id, 1, vh, vp, vd]
 
@@ -235,7 +236,7 @@ def _copy_single_page_cpu(num_heads, page_size, head_dim, dtype):
 def _compact_kv_copy(num_heads, head_dim, dtype, target: Target, page_size: int = 16):
     tx = get_max_num_threads_per_block(target)
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def compact_kv_copy(var_pages: T.handle, var_copy_length_indptr: T.handle, var_copy_src_dst_pos: T.handle, batch_size: T.int32):
         T.func_attr({"tirx.is_scheduled": True})
         num_pages = T.int32()
@@ -247,7 +248,7 @@ def _compact_kv_copy(num_heads, head_dim, dtype, target: Target, page_size: int
         copy_length_indptr = T.match_buffer(var_copy_length_indptr, (batch_size + 1,), "int32", elem_offset=copy_length_indptr_elem_offset)
         copy_src_dst_pos = T.match_buffer(var_copy_src_dst_pos, (2, total_copy_length), "int32", elem_offset=copy_src_dst_pos_elem_offset)
 
-        with T.sblock("root"):
+        with Ts.sblock("root"):
             for bhd_o in T.thread_binding((batch_size * num_heads * head_dim + tx - 1) // tx, thread="blockIdx.x"):
                 for bhd_i in T.thread_binding(tx, thread="threadIdx.x"):
                     b: T.int32 = (bhd_o * tx + bhd_i) // (num_heads * head_dim)
@@ -266,7 +267,7 @@ def _compact_kv_copy(num_heads, head_dim, dtype, target: Target, page_size: int
 def _compact_kv_copy_cpu(num_heads, head_dim, dtype, page_size: int = 16):
     tx = 8
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def compact_kv_copy_cpu(var_pages: T.handle, var_copy_length_indptr: T.handle, var_copy_src_dst_pos: T.handle, batch_size: T.int32):
         T.func_attr({"tirx.is_scheduled": True})
         num_pages = T.int32()
@@ -277,7 +278,7 @@ def _compact_kv_copy_cpu(num_heads, head_dim, dtype, page_size: int = 16):
         copy_length_indptr = T.match_buffer(var_copy_length_indptr, (batch_size + 1,), "int32", elem_offset=copy_length_indptr_elem_offset)
         copy_src_dst_pos = T.match_buffer(var_copy_src_dst_pos, (2, total_copy_length), "int32", elem_offset=copy_src_dst_pos_elem_offset)
 
-        with T.sblock("root"):
+        with Ts.sblock("root"):
             for bhd_o in T.serial((batch_size * num_heads * head_dim + tx - 1) // tx):
                 for bhd_i in T.serial(tx):
                     b: T.int32 = (bhd_o * tx + bhd_i) // (num_heads * head_dim)
diff --git a/python/tvm/relax/frontend/nn/llm/_prefill_kernels.py b/python/tvm/relax/frontend/nn/llm/_prefill_kernels.py
index c60f11642b..2cfee6b1f4 100644
--- a/python/tvm/relax/frontend/nn/llm/_prefill_kernels.py
+++ b/python/tvm/relax/frontend/nn/llm/_prefill_kernels.py
@@ -31,6 +31,7 @@ from typing import Any, Literal
 
 import tvm
 from tvm import tirx
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 from tvm.target import Target
 
@@ -68,7 +69,7 @@ def _attention_prefill_cpu(
     group_size = h_q // h_kv
 
     # pylint: disable=too-many-branches
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def batch_prefill_paged_kv_cpu(
         var_q: T.handle, # [total_len, h_q, d]
         var_q_indptr: T.handle, # [batch_size + 1]
@@ -120,20 +121,20 @@ def _attention_prefill_cpu(
 
         for h_qo in T.serial(h_q):
             for b_idx in T.serial(batch_size):
-                with T.sblock("attn"):
-                    O_local = T.sblock_alloc_buffer((d, ), "float32")
-                    Q_local = T.sblock_alloc_buffer((d, ), "float32")
-                    K_local = T.sblock_alloc_buffer((d, ), "float32")
-                    V_local = T.sblock_alloc_buffer((d, ), "float32")
-
-                    kv_chunk_len = T.sblock_alloc_buffer((1, ), "int32")
-
-                    m_val = T.sblock_alloc_buffer((1, ), "float32")
-                    new_m = T.sblock_alloc_buffer((1, ), "float32")
-                    d_val = T.sblock_alloc_buffer((1, ), "float32")
-                    S_val = T.sblock_alloc_buffer((1, ), "float32")
-                    scale_O = T.sblock_alloc_buffer((1, ), "float32")
-                    factor = T.sblock_alloc_buffer((1, ), "float32")
+                with Ts.sblock("attn"):
+                    O_local = Ts.sblock_alloc_buffer((d, ), "float32")
+                    Q_local = Ts.sblock_alloc_buffer((d, ), "float32")
+                    K_local = Ts.sblock_alloc_buffer((d, ), "float32")
+                    V_local = Ts.sblock_alloc_buffer((d, ), "float32")
+
+                    kv_chunk_len = Ts.sblock_alloc_buffer((1, ), "int32")
+
+                    m_val = Ts.sblock_alloc_buffer((1, ), "float32")
+                    new_m = Ts.sblock_alloc_buffer((1, ), "float32")
+                    d_val = Ts.sblock_alloc_buffer((1, ), "float32")
+                    S_val = Ts.sblock_alloc_buffer((1, ), "float32")
+                    scale_O = Ts.sblock_alloc_buffer((1, ), "float32")
+                    factor = Ts.sblock_alloc_buffer((1, ), "float32")
                     cur_page_indptr_begin: T.let[T.int32] = page_indptr[b_idx]
                     cur_page_indptr_end: T.let[T.int32] = page_indptr[b_idx + 1]
                     #max_kv_len: T.let[T.int32] = max_num_pages * page_size
@@ -234,7 +235,7 @@ def _attention_prefill(
     init_states, compute_s_gemm, softmax_update_causal, compute_o_gemm, _, advance_tile_batch, paged_store_output_lse, *_ = _make_prefill_macros(tile_x, tile_y, tile_z, tile_y, bdx, num_warps, group_size)
 
     # pylint: disable=too-many-branches
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def batch_prefill_paged_kv(
         var_q: T.handle, # [total_len, h_q, d]
         var_q_indptr: T.handle, # [batch_size + 1]
@@ -289,10 +290,10 @@ def _attention_prefill(
             for lby in T.thread_binding(h_kv, thread="blockIdx.y"):
                 for lty in T.thread_binding(num_warps, thread="threadIdx.y"):
                     for ltx in T.thread_binding(bdx, thread="threadIdx.x"):
-                        with T.sblock("attn"):
-                            bx, by, ty, tx = T.axis.remap("SSSS", [lbx, lby, lty, ltx])
-                            T.reads()
-                            T.writes()
+                        with Ts.sblock("attn"):
+                            bx, by, ty, tx = Ts.axis.remap("SSSS", [lbx, lby, lty, ltx])
+                            Ts.reads()
+                            Ts.writes()
                             tile_id, batch_idx, batch_tiles, batch_rows, iterator, kv_chunk_len = _alloc_tile_walk_state()
                             Q_smem, K_smem, V_smem, O_local = _alloc_mha_qkvo_buffers(tile_x, tile_z, d, d, dtype)
                             S_smem, S_local, m_smem, m_prev_smem, d_smem, m_new, m_prev, d_new = (
@@ -324,10 +325,10 @@ def _attention_prefill(
 
                                     # Load Q from gmem to smem
                                     for li, lj in T.grid(tile_x, tile_y):
-                                        with T.sblock("Q_load"):
-                                            i, j = T.axis.remap("SS", [li, lj])
-                                            T.reads()
-                                            T.writes()
+                                        with Ts.sblock("Q_load"):
+                                            i, j = Ts.axis.remap("SS", [li, lj])
+                                            Ts.reads()
+                                            Ts.writes()
                                             cur_L: T.let[T.int32] = q_indptr_val + (LH_start + i) // group_size
                                             cur_H_qo: T.let[T.int32] = by * group_size + (LH_start + i) % group_size
                                             if cur_L < q_indptr[b_idx + 1]:
@@ -343,10 +344,10 @@ def _attention_prefill(
                                     for iterator in T.serial(T.ceildiv(kv_chunk_len[0], tile_z)):
                                         L_kv_start: T.let[T.int32] = iterator * tile_z
                                         for lz, ly in T.grid(tile_z, tile_y):
-                                            with T.sblock("K_load"):
-                                                i, j = T.axis.remap("SS", [lz, ly])
-                                                T.reads()
-                                                T.writes()
+                                            with Ts.sblock("K_load"):
+                                                i, j = Ts.axis.remap("SS", [lz, ly])
+                                                Ts.reads()
+                                                Ts.writes()
                                                 cur_L: T.let[T.int32] = L_kv_start + i
                                                 if cur_L < kv_chunk_len[0]:
                                                     seq_offset: T.let[T.int32()] = _get_seq_offset(cur_L, b_idx, length_info, sliding_window)  # type: ignore
@@ -361,10 +362,10 @@ def _attention_prefill(
                                                     K_smem[i, j] = 0.0
                                         T.tvm_storage_sync("shared")
                                         for lz, ly in T.grid(tile_z, tile_y):
-                                            with T.sblock("V_load"):
-                                                i, j = T.axis.remap("SS", [lz, ly])
-                                                T.reads()
-                                                T.writes()
+                                            with Ts.sblock("V_load"):
+                                                i, j = Ts.axis.remap("SS", [lz, ly])
+                                                Ts.reads()
+                                                Ts.writes()
                                                 cur_L: T.let[T.int32] = L_kv_start + i
                                                 if cur_L < kv_chunk_len[0]:
                                                     seq_offset: T.let[T.int32()] = _get_seq_offset(cur_L, b_idx, length_info, sliding_window)  # type: ignore
@@ -396,7 +397,7 @@ def _attention_sequence_prefill(h_kv, h_q, d, dtype, target: Target, causal=0, s
     _, LOAD_VEC, group_size, bdx, num_warps, tile_x, tile_y, tile_z = _get_prefill_kernel_config(h_kv, h_q, d, dtype, target)
     init_states, compute_s_gemm, softmax_update_causal, compute_o_gemm, *_ = _make_prefill_macros(tile_x, tile_y, tile_z, tile_y, bdx, num_warps, group_size)
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def batch_sequence_prefill_kv(  # pylint: disable=too-many-branches
         var_q: T.handle, # [total_len, h_q, d]
         var_k: T.handle, # [total_len, h_kv, d]
@@ -420,10 +421,10 @@ def _attention_sequence_prefill(h_kv, h_q, d, dtype, target: Target, causal=0, s
             for lby in T.thread_binding(h_kv, thread="blockIdx.y"):
                 for lty in T.thread_binding(num_warps, thread="threadIdx.y"):
                     for ltx in T.thread_binding(bdx, thread="threadIdx.x"):
-                        with T.sblock("attn"):
-                            vbx, by, ty, tx = T.axis.remap("SSSS", [lbx, lby, lty, ltx])
-                            T.reads()
-                            T.writes()
+                        with Ts.sblock("attn"):
+                            vbx, by, ty, tx = Ts.axis.remap("SSSS", [lbx, lby, lty, ltx])
+                            Ts.reads()
+                            Ts.writes()
 
                             Q_smem, K_smem, V_smem, O_local = _alloc_mha_qkvo_buffers(tile_x, tile_z, d, d, dtype)
                             S_smem, S_local, m_smem, m_prev_smem, d_smem, m_new, m_prev, d_new = (
@@ -439,10 +440,10 @@ def _attention_sequence_prefill(h_kv, h_q, d, dtype, target: Target, causal=0, s
 
                             # Load Q from gmem to smem
                             for li, lj in T.grid(tile_x, tile_y):
-                                with T.sblock("Q_load"):
-                                    i, j = T.axis.remap("SS", [li, lj])
-                                    T.reads()
-                                    T.writes()
+                                with Ts.sblock("Q_load"):
+                                    i, j = Ts.axis.remap("SS", [li, lj])
+                                    Ts.reads()
+                                    Ts.writes()
                                     cur_L: T.let[T.int32] = (LH_start + i) // group_size
                                     cur_H_qo: T.let[T.int32] = by * group_size + (LH_start + i) % group_size
                                     if cur_L < qo_len:
@@ -455,10 +456,10 @@ def _attention_sequence_prefill(h_kv, h_q, d, dtype, target: Target, causal=0, s
                                 L_kv_start: T.let[T.int32] = iterator * tile_z
                                 L_kv_base: T.let[T.int32] = 0
                                 for lz, ly in T.grid(tile_z, tile_y):
-                                    with T.sblock("K_load"):
-                                        i, j = T.axis.remap("SS", [lz, ly])
-                                        T.reads()
-                                        T.writes()
+                                    with Ts.sblock("K_load"):
+                                        i, j = Ts.axis.remap("SS", [lz, ly])
+                                        Ts.reads()
+                                        Ts.writes()
                                         cur_L: T.let[T.int32] = L_kv_start + i
                                         if cur_L < kv_len:
                                             K_smem[i, j] = k[
@@ -468,10 +469,10 @@ def _attention_sequence_prefill(h_kv, h_q, d, dtype, target: Target, causal=0, s
                                             K_smem[i, j] = 0.0
                                 T.tvm_storage_sync("shared")
                                 for lz, ly in T.grid(tile_z, tile_y):
-                                    with T.sblock("V_load"):
-                                        i, j = T.axis.remap("SS", [lz, ly])
-                                        T.reads()
-                                        T.writes()
+                                    with Ts.sblock("V_load"):
+                                        i, j = Ts.axis.remap("SS", [lz, ly])
+                                        Ts.reads()
+                                        Ts.writes()
                                         cur_L: T.let[T.int32] = L_kv_start + i
                                         if cur_L < kv_len:
                                             V_smem[i, j] = v[b_idx, L_kv_base + cur_L, by, j]
@@ -485,8 +486,8 @@ def _attention_sequence_prefill(h_kv, h_q, d, dtype, target: Target, causal=0, s
 
                             # Store O from smem to gmem
                             for li, lj in T.grid(tile_x, tile_y):
-                                with T.sblock("O_store"):
-                                    i, j = T.axis.remap("SS", [li, lj])
+                                with Ts.sblock("O_store"):
+                                    i, j = Ts.axis.remap("SS", [li, lj])
                                     cur_L: T.let[T.int32] = 0 + (LH_start + i) // group_size
                                     cur_H_qo: T.let[T.int32] = by * group_size + (LH_start + i) % group_size
                                     if cur_L < qo_len:
@@ -494,8 +495,8 @@ def _attention_sequence_prefill(h_kv, h_q, d, dtype, target: Target, causal=0, s
 
                             # Store LSE to gmem
                             for li in T.grid(tile_x):
-                                with T.sblock("lse_store"):
-                                    i = T.axis.remap("S", [li])
+                                with Ts.sblock("lse_store"):
+                                    i = Ts.axis.remap("S", [li])
                                     cur_L: T.let[T.int32] = 0 + (LH_start + i) // group_size
                                     cur_H_qo: T.let[T.int32] = by * group_size + (LH_start + i) % group_size
                                     if cur_L < qo_len:
@@ -563,7 +564,7 @@ def _attention_sequence_prefill_with_mask(
         pad = kv_len - valid_len
         return tirx.And(col < kv_len, col >= pad)
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def batch_sequence_prefill_kv_masked(  # pylint: disable=too-many-branches
         var_q: T.handle, # [batch_size, qo_len, h_q, d]
         var_k: T.handle, # [batch_size, kv_len, h_kv, d]
@@ -588,10 +589,10 @@ def _attention_sequence_prefill_with_mask(
             for lby in T.thread_binding(h_kv, thread="blockIdx.y"):
                 for lty in T.thread_binding(num_warps, thread="threadIdx.y"):
                     for ltx in T.thread_binding(bdx, thread="threadIdx.x"):
-                        with T.sblock("attn"):
-                            vbx, by, ty, tx = T.axis.remap("SSSS", [lbx, lby, lty, ltx])
-                            T.reads()
-                            T.writes()
+                        with Ts.sblock("attn"):
+                            vbx, by, ty, tx = Ts.axis.remap("SSSS", [lbx, lby, lty, ltx])
+                            Ts.reads()
+                            Ts.writes()
 
                             Q_smem, K_smem, V_smem, O_local = _alloc_mha_qkvo_buffers(tile_x, tile_z, d, d, dtype)
                             S_smem, S_local, m_smem, m_prev_smem, d_smem, m_new, m_prev, d_new = (
@@ -608,10 +609,10 @@ def _attention_sequence_prefill_with_mask(
 
                             # Load Q; rows outside the valid range are zeroed so they contribute nothing downstream.
                             for li, lj in T.grid(tile_x, tile_y):
-                                with T.sblock("Q_load"):
-                                    i, j = T.axis.remap("SS", [li, lj])
-                                    T.reads()
-                                    T.writes()
+                                with Ts.sblock("Q_load"):
+                                    i, j = Ts.axis.remap("SS", [li, lj])
+                                    Ts.reads()
+                                    Ts.writes()
                                     cur_L: T.let[T.int32] = (LH_start + i) // group_size
                                     cur_H_qo: T.let[T.int32] = by * group_size + (LH_start + i) % group_size
                                     if _q_row_valid(cur_L, valid_len, qo_len):
@@ -624,10 +625,10 @@ def _attention_sequence_prefill_with_mask(
                                 L_kv_start: T.let[T.int32] = iterator * tile_z
                                 L_kv_base: T.let[T.int32] = 0
                                 for lz, ly in T.grid(tile_z, tile_y):
-                                    with T.sblock("K_load"):
-                                        i, j = T.axis.remap("SS", [lz, ly])
-                                        T.reads()
-                                        T.writes()
+                                    with Ts.sblock("K_load"):
+                                        i, j = Ts.axis.remap("SS", [lz, ly])
+                                        Ts.reads()
+                                        Ts.writes()
                                         cur_L: T.let[T.int32] = L_kv_start + i
                                         if _kv_col_valid(cur_L, valid_len, kv_len):
                                             K_smem[i, j] = k[b_idx, L_kv_base + cur_L, by, j]
@@ -635,10 +636,10 @@ def _attention_sequence_prefill_with_mask(
                                             K_smem[i, j] = 0.0
                                 T.tvm_storage_sync("shared")
                                 for lz, ly in T.grid(tile_z, tile_y):
-                                    with T.sblock("V_load"):
-                                        i, j = T.axis.remap("SS", [lz, ly])
-                                        T.reads()
-                                        T.writes()
+                                    with Ts.sblock("V_load"):
+                                        i, j = Ts.axis.remap("SS", [lz, ly])
+                                        Ts.reads()
+                                        Ts.writes()
                                         cur_L: T.let[T.int32] = L_kv_start + i
                                         if _kv_col_valid(cur_L, valid_len, kv_len):
                                             V_smem[i, j] = v[b_idx, L_kv_base + cur_L, by, j]
@@ -652,8 +653,8 @@ def _attention_sequence_prefill_with_mask(
 
                             # Store O
                             for li, lj in T.grid(tile_x, tile_y):
-                                with T.sblock("O_store"):
-                                    i, j = T.axis.remap("SS", [li, lj])
+                                with Ts.sblock("O_store"):
+                                    i, j = Ts.axis.remap("SS", [li, lj])
                                     cur_L: T.let[T.int32] = 0 + (LH_start + i) // group_size
                                     cur_H_qo: T.let[T.int32] = by * group_size + (LH_start + i) % group_size
                                     if cur_L < qo_len:
@@ -661,8 +662,8 @@ def _attention_sequence_prefill_with_mask(
 
                             # Store LSE
                             for li in T.grid(tile_x):
-                                with T.sblock("lse_store"):
-                                    i = T.axis.remap("S", [li])
+                                with Ts.sblock("lse_store"):
+                                    i = Ts.axis.remap("S", [li])
                                     cur_L: T.let[T.int32] = 0 + (LH_start + i) // group_size
                                     cur_H_qo: T.let[T.int32] = by * group_size + (LH_start + i) % group_size
                                     if cur_L < qo_len:
@@ -677,7 +678,7 @@ def _attention_sequence_prefill_with_mask(
 def _attention_prefill_ragged_cpu(h_kv, h_q, d_qk, d_v, dtype, rope_scaling: dict[str, Any]):
     group_size = h_q // h_kv
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def batch_prefill_ragged_kv(  # pylint: disable=too-many-branches
         var_q: T.handle,  # [total_len, h_q, d_qk]
         var_q_indptr: T.handle,  # [batch_size + 1]
@@ -713,20 +714,20 @@ def _attention_prefill_ragged_cpu(h_kv, h_q, d_qk, d_v, dtype, rope_scaling: dic
         lse = T.match_buffer(var_lse, (qo_len, h_q), "float32")  # pylint: disable=unused-variable
 
         for b in T.serial(batch_size):
-            with T.sblock("attn"):
-                softmax_sum = T.sblock_alloc_buffer([h_q], "float32")
-                m_prev = T.sblock_alloc_buffer([h_q], "float32")
-                m_new = T.sblock_alloc_buffer([h_q], "float32")
-                d_prev = T.sblock_alloc_buffer([h_q], "float32")
-                d_new = T.sblock_alloc_buffer([h_q], "float32")
-                p_sum = T.sblock_alloc_buffer([d_v], "float32")
-                max_score = T.sblock_alloc_buffer([h_q], "float32")
-                attention_scores = T.sblock_alloc_buffer([kv_len, h_q], "float32")
-                exp_scores = T.sblock_alloc_buffer([kv_len, h_q], "float32")
-                attention_score = T.sblock_alloc_buffer([1], "float32")
-                query_val = T.sblock_alloc_buffer([1], "float32")
-                key_val = T.sblock_alloc_buffer([1], "float32")
-                result = T.sblock_alloc_buffer([1], "float32")
+            with Ts.sblock("attn"):
+                softmax_sum = Ts.sblock_alloc_buffer([h_q], "float32")
+                m_prev = Ts.sblock_alloc_buffer([h_q], "float32")
+                m_new = Ts.sblock_alloc_buffer([h_q], "float32")
+                d_prev = Ts.sblock_alloc_buffer([h_q], "float32")
+                d_new = Ts.sblock_alloc_buffer([h_q], "float32")
+                p_sum = Ts.sblock_alloc_buffer([d_v], "float32")
+                max_score = Ts.sblock_alloc_buffer([h_q], "float32")
+                attention_scores = Ts.sblock_alloc_buffer([kv_len, h_q], "float32")
+                exp_scores = Ts.sblock_alloc_buffer([kv_len, h_q], "float32")
+                attention_score = Ts.sblock_alloc_buffer([1], "float32")
+                query_val = Ts.sblock_alloc_buffer([1], "float32")
+                key_val = Ts.sblock_alloc_buffer([1], "float32")
+                result = Ts.sblock_alloc_buffer([1], "float32")
 
                 for q_idx in T.serial(q_indptr[b + 1] - q_indptr[b]):
                     for i in T.serial(h_q):
@@ -796,7 +797,7 @@ def _attention_prefill_ragged(h_kv, h_q, d_qk, d_v, dtype, rope_scaling: dict[st
     NUM_BLKS, LOAD_VEC, group_size, bdx, num_warps, tile_x, tile_y, tile_z = _get_prefill_kernel_config(h_kv, h_q, d_qk, dtype, target, d_v=d_v)
     init_states, compute_s_gemm, softmax_update_causal, compute_o_gemm, _, advance_tile_batch, paged_store_output_lse, *_ = _make_prefill_macros(tile_x, tile_y, tile_z, d_v, bdx, num_warps, group_size)
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def batch_prefill_ragged_kv(  # pylint: disable=too-many-branches
         var_q: T.handle, # [total_len, h_q, d_qk]
         var_q_indptr: T.handle, # [batch_size + 1]
@@ -836,10 +837,10 @@ def _attention_prefill_ragged(h_kv, h_q, d_qk, d_v, dtype, rope_scaling: dict[st
             for lby in T.thread_binding(h_kv, thread="blockIdx.y"):
                 for lty in T.thread_binding(num_warps, thread="threadIdx.y"):
                     for ltx in T.thread_binding(bdx, thread="threadIdx.x"):
-                        with T.sblock("attn"):
-                            bx, by, ty, tx = T.axis.remap("SSSS", [lbx, lby, lty, ltx])
-                            T.reads()
-                            T.writes()
+                        with Ts.sblock("attn"):
+                            bx, by, ty, tx = Ts.axis.remap("SSSS", [lbx, lby, lty, ltx])
+                            Ts.reads()
+                            Ts.writes()
                             tile_id, batch_idx, batch_tiles, batch_rows, iterator, kv_chunk_len = _alloc_tile_walk_state()
                             Q_smem, K_smem, V_smem, O_local = _alloc_mha_qkvo_buffers(tile_x, tile_z, d_qk, d_v, dtype)
                             S_smem, S_local, m_smem, m_prev_smem, d_smem, m_new, m_prev, d_new = (
@@ -865,10 +866,10 @@ def _attention_prefill_ragged(h_kv, h_q, d_qk, d_v, dtype, rope_scaling: dict[st
 
                                     # Load Q from gmem to smem
                                     for li, lj in T.grid(tile_x, tile_y):
-                                        with T.sblock("Q_load"):
-                                            i, j = T.axis.remap("SS", [li, lj])
-                                            T.reads()
-                                            T.writes()
+                                        with Ts.sblock("Q_load"):
+                                            i, j = Ts.axis.remap("SS", [li, lj])
+                                            Ts.reads()
+                                            Ts.writes()
                                             cur_L: T.let[T.int32] = q_indptr_val + (LH_start + i) // group_size
                                             cur_H_qo: T.let[T.int32] = by * group_size + (LH_start + i) % group_size
                                             if cur_L < q_indptr[b_idx + 1]:
@@ -885,8 +886,8 @@ def _attention_prefill_ragged(h_kv, h_q, d_qk, d_v, dtype, rope_scaling: dict[st
                                         L_kv_start: T.let[T.int32] = iterator * tile_z
                                         L_kv_base: T.let[T.int32] = kv_indptr[b_idx]
                                         for lz, ly in T.grid(tile_z, tile_y):
-                                            with T.sblock("K_load"):
-                                                i, j = T.axis.remap("SS", [lz, ly])
+                                            with Ts.sblock("K_load"):
+                                                i, j = Ts.axis.remap("SS", [lz, ly])
                                                 cur_L: T.let[T.int32] = L_kv_start + i
                                                 if cur_L < kv_chunk_len[0]:
                                                     K_smem[i, j] = T.if_then_else(
@@ -898,10 +899,10 @@ def _attention_prefill_ragged(h_kv, h_q, d_qk, d_v, dtype, rope_scaling: dict[st
                                                     K_smem[i, j] = 0.0
                                         T.tvm_storage_sync("shared")
                                         for lz, ly in T.grid(tile_z, d_v):
-                                            with T.sblock("V_load"):
-                                                i, j = T.axis.remap("SS", [lz, ly])
-                                                T.reads()
-                                                T.writes()
+                                            with Ts.sblock("V_load"):
+                                                i, j = Ts.axis.remap("SS", [lz, ly])
+                                                Ts.reads()
+                                                Ts.writes()
                                                 cur_L: T.let[T.int32] = L_kv_start + i
                                                 if cur_L < kv_chunk_len[0]:
                                                     V_smem[i, j] = v[L_kv_base + cur_L, by, j]
@@ -934,7 +935,7 @@ def _attention_prefill_mla(h_q, d_latent, d_rope, dtype, sliding_window: bool, t
         global_symbol += "_sliding_window"
 
     # pylint: disable=too-many-branches
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def batch_prefill_paged_kv_mla(
         var_q: T.handle, # [total_len, h_q, d_qk]
         var_q_indptr: T.handle, # [batch_size + 1]
@@ -979,10 +980,10 @@ def _attention_prefill_mla(h_q, d_latent, d_rope, dtype, sliding_window: bool, t
         for lbx in T.thread_binding(NUM_BLKS, thread="blockIdx.x"):
             for lty in T.thread_binding(num_warps, thread="threadIdx.y"):
                 for ltx in T.thread_binding(bdx, thread="threadIdx.x"):
-                    with T.sblock("attn"):
-                        bx, ty, tx = T.axis.remap("SSS", [lbx, lty, ltx])
-                        T.reads()
-                        T.writes()
+                    with Ts.sblock("attn"):
+                        bx, ty, tx = Ts.axis.remap("SSS", [lbx, lty, ltx])
+                        Ts.reads()
+                        Ts.writes()
                         tile_id, batch_idx, batch_tiles, batch_rows, iterator, kv_chunk_len = _alloc_tile_walk_state()
                         Q_smem, KV_smem, O_local = _alloc_mla_qkvo_buffers(tile_x, tile_z, d_qk, d_latent, dtype)
                         S_smem, S_local, m_smem, m_prev_smem, d_smem, m_new, m_prev, d_new = (
@@ -1014,10 +1015,10 @@ def _attention_prefill_mla(h_q, d_latent, d_rope, dtype, sliding_window: bool, t
 
                                 # Load Q from gmem to smem
                                 for li, lj in T.grid(tile_x, tile_y):
-                                    with T.sblock("Q_load"):
-                                        i, j = T.axis.remap("SS", [li, lj])
-                                        T.reads()
-                                        T.writes()
+                                    with Ts.sblock("Q_load"):
+                                        i, j = Ts.axis.remap("SS", [li, lj])
+                                        Ts.reads()
+                                        Ts.writes()
                                         cur_L: T.let[T.int32] = q_indptr_val + (LH_start + i) // group_size
                                         cur_H_qo: T.let[T.int32] = (LH_start + i) % group_size
                                         if cur_L < q_indptr[b_idx + 1]:
@@ -1029,10 +1030,10 @@ def _attention_prefill_mla(h_q, d_latent, d_rope, dtype, sliding_window: bool, t
                                 for iterator in T.serial(T.ceildiv(kv_chunk_len[0], tile_z)):
                                     L_kv_start: T.let[T.int32] = iterator * tile_z
                                     for lz, ly in T.grid(tile_z, tile_y):
-                                        with T.sblock("KV_load"):
-                                            i, j = T.axis.remap("SS", [lz, ly])
-                                            T.reads()
-                                            T.writes()
+                                        with Ts.sblock("KV_load"):
+                                            i, j = Ts.axis.remap("SS", [lz, ly])
+                                            Ts.reads()
+                                            Ts.writes()
                                             cur_L: T.let[T.int32] = L_kv_start + i
                                             if cur_L < kv_chunk_len[0]:
                                                 seq_offset: T.let[T.int32()] = _get_seq_offset(cur_L, b_idx, length_info, sliding_window)  # type: ignore
diff --git a/python/tvm/relax/frontend/nn/llm/position_embedding.py b/python/tvm/relax/frontend/nn/llm/position_embedding.py
index 1ff7e9c66d..b057cde242 100644
--- a/python/tvm/relax/frontend/nn/llm/position_embedding.py
+++ b/python/tvm/relax/frontend/nn/llm/position_embedding.py
@@ -24,6 +24,7 @@ from typing import Any
 
 from tvm import tirx
 from tvm.relax.frontend.nn import Tensor, op
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 
 # pylint: disable=invalid-name
@@ -390,7 +391,7 @@ def llama_rope(  # pylint: disable=too-many-arguments
             expr = tirx.Let(var, value, expr)
         return expr
 
-    @T.prim_func(private=True, s_tir=True)
+    @Ts.prim_func(private=True)
     def fused_rope(  # pylint: disable=too-many-locals
         var_qkv: T.handle,
         var_q: T.handle,
@@ -411,8 +412,8 @@ def llama_rope(  # pylint: disable=too-many-arguments
         k = T.match_buffer(var_k, (batch_size, seq_len, num_kv_heads, head_dim), dtype)
         v = T.match_buffer(var_v, (batch_size, seq_len, num_kv_heads, head_dim), dtype)
         for iters in T.grid(batch_size, seq_len, fused_heads, head_dim):
-            with T.sblock("llama_fused_rope"):
-                b, s, h, d = T.axis.remap("SSSS", iters)
+            with Ts.sblock("llama_fused_rope"):
+                b, s, h, d = Ts.axis.remap("SSSS", iters)
                 if h < num_q_heads:
                     q[b, s, h, d] = T.if_then_else(
                         d < rotary_dim,
@@ -522,7 +523,7 @@ def llama_rope_with_position_map(  # pylint: disable=too-many-arguments
             expr = tirx.Let(var, value, expr)
         return expr
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def fused_rope(  # pylint: disable=too-many-locals
         var_qkv: T.handle,
         var_position_map: T.handle,
@@ -547,8 +548,8 @@ def llama_rope_with_position_map(  # pylint: disable=too-many-arguments
             var_position_map, (seq_len,), "int32", elem_offset=position_map_elem_offset
         )
         for iters in T.grid(seq_len, fused_heads, head_dim):
-            with T.sblock("llama_fused_rope"):
-                s, h, d = T.axis.remap("SSS", iters)
+            with Ts.sblock("llama_fused_rope"):
+                s, h, d = Ts.axis.remap("SSS", iters)
                 if h < num_q_heads:
                     q[s, h, d] = T.if_then_else(
                         apply_rope > 0 and d < rotary_dim,
@@ -564,7 +565,7 @@ 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]
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def fused_rope_longrope_scaling(  # pylint: disable=too-many-locals
         var_qkv: T.handle,
         var_position_map: T.handle,
@@ -599,8 +600,8 @@ def llama_rope_with_position_map(  # pylint: disable=too-many-arguments
 
         if seq_len > original_max_position_embeddings:
             for iters in T.grid(seq_len, fused_heads, head_dim):
-                with T.sblock("llama_fused_rope"):
-                    s, h, d = T.axis.remap("SSS", iters)
+                with Ts.sblock("llama_fused_rope"):
+                    s, h, d = Ts.axis.remap("SSS", iters)
                     if h < num_q_heads:
                         q[s, h, d] = T.if_then_else(
                             d < rotary_dim,
@@ -631,8 +632,8 @@ def llama_rope_with_position_map(  # pylint: disable=too-many-arguments
                         v[s, h - (num_q_heads + num_kv_heads), d] = qkv[s, h, d]
         else:
             for iters in T.grid(seq_len, fused_heads, head_dim):
-                with T.sblock("llama_fused_rope"):
-                    s, h, d = T.axis.remap("SSS", iters)
+                with Ts.sblock("llama_fused_rope"):
+                    s, h, d = Ts.axis.remap("SSS", iters)
                     if h < num_q_heads:
                         q[s, h, d] = T.if_then_else(
                             d < rotary_dim,
@@ -749,7 +750,7 @@ def llama4_rope_with_position_map(  # pylint: disable=too-many-arguments
             expr = tirx.Let(var, value, expr)
         return expr
 
-    @T.prim_func(private=True, s_tir=True)
+    @Ts.prim_func(private=True)
     def fused_rope(  # pylint: disable=too-many-locals
         var_qkv: T.handle,
         var_position_map: T.handle,
@@ -774,8 +775,8 @@ def llama4_rope_with_position_map(  # pylint: disable=too-many-arguments
             var_position_map, (seq_len,), "int32", elem_offset=position_map_elem_offset
         )
         for iters in T.grid(seq_len, fused_heads, head_dim):
-            with T.sblock("llama_fused_rope"):
-                s, h, d = T.axis.remap("SSS", iters)
+            with Ts.sblock("llama_fused_rope"):
+                s, h, d = Ts.axis.remap("SSS", iters)
                 if h < num_q_heads:
                     q[s, h, d] = T.if_then_else(
                         apply_rope > 0 and d < rotary_dim,
@@ -791,7 +792,7 @@ 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]
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def fused_rope_longrope_scaling(  # pylint: disable=too-many-locals
         var_qkv: T.handle,
         var_position_map: T.handle,
@@ -826,8 +827,8 @@ def llama4_rope_with_position_map(  # pylint: disable=too-many-arguments
 
         if seq_len > original_max_position_embeddings:
             for iters in T.grid(seq_len, fused_heads, head_dim):
-                with T.sblock("llama_fused_rope"):
-                    s, h, d = T.axis.remap("SSS", iters)
+                with Ts.sblock("llama_fused_rope"):
+                    s, h, d = Ts.axis.remap("SSS", iters)
                     if h < num_q_heads:
                         q[s, h, d] = T.if_then_else(
                             d < rotary_dim,
@@ -858,8 +859,8 @@ def llama4_rope_with_position_map(  # pylint: disable=too-many-arguments
                         v[s, h - (num_q_heads + num_kv_heads), d] = qkv[s, h, d]
         else:
             for iters in T.grid(seq_len, fused_heads, head_dim):
-                with T.sblock("llama_fused_rope"):
-                    s, h, d = T.axis.remap("SSS", iters)
+                with Ts.sblock("llama_fused_rope"):
+                    s, h, d = Ts.axis.remap("SSS", iters)
                     if h < num_q_heads:
                         q[s, h, d] = T.if_then_else(
                             d < rotary_dim,
diff --git a/python/tvm/relax/frontend/nn/llm/tree_attn.py b/python/tvm/relax/frontend/nn/llm/tree_attn.py
index 237cebc917..98ae8b110c 100644
--- a/python/tvm/relax/frontend/nn/llm/tree_attn.py
+++ b/python/tvm/relax/frontend/nn/llm/tree_attn.py
@@ -23,6 +23,7 @@ import math
 from typing import Any
 
 from tvm import s_tir, tirx
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 from tvm.target import Target
 
@@ -88,7 +89,7 @@ def tree_attn_cpu(h_kv, h_q, d, dtype, rope_scaling: dict[str, Any]):
     group_size = h_q // h_kv
 
     # fmt: off
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def batch_tree_attn(  # pylint: disable=too-many-branches,line-too-long
         var_q: T.handle,  # [total_len, h_q, d]
         var_q_indptr: T.handle,  # [batch_size + 1]
@@ -135,37 +136,37 @@ def tree_attn_cpu(h_kv, h_q, d, dtype, rope_scaling: dict[str, Any]):
         lse = T.match_buffer(var_lse, (qo_len, h_q), "float32")  # pylint: disable=unused-variable
 
         for b in T.serial(batch_size_plus_1 - 1):
-            with T.sblock("attn"):
-
-                softmax_sum = T.sblock_alloc_buffer([h_q], "float32")
-                m_prev = T.sblock_alloc_buffer([h_q], "float32")
-                m_new = T.sblock_alloc_buffer([h_q], "float32")
-                d_prev = T.sblock_alloc_buffer([h_q], "float32")
-                d_new = T.sblock_alloc_buffer([h_q], "float32")
-                p_sum = T.sblock_alloc_buffer([d], "float32")
-
-                max_score = T.sblock_alloc_buffer([h_q], "float32")
-                attention_scores = T.sblock_alloc_buffer([kv_len, h_q], "float32")
-                exp_scores = T.sblock_alloc_buffer([kv_len, h_q], "float32")
-                attention_score = T.sblock_alloc_buffer(
+            with Ts.sblock("attn"):
+
+                softmax_sum = Ts.sblock_alloc_buffer([h_q], "float32")
+                m_prev = Ts.sblock_alloc_buffer([h_q], "float32")
+                m_new = Ts.sblock_alloc_buffer([h_q], "float32")
+                d_prev = Ts.sblock_alloc_buffer([h_q], "float32")
+                d_new = Ts.sblock_alloc_buffer([h_q], "float32")
+                p_sum = Ts.sblock_alloc_buffer([d], "float32")
+
+                max_score = Ts.sblock_alloc_buffer([h_q], "float32")
+                attention_scores = Ts.sblock_alloc_buffer([kv_len, h_q], "float32")
+                exp_scores = Ts.sblock_alloc_buffer([kv_len, h_q], "float32")
+                attention_score = Ts.sblock_alloc_buffer(
                     [
                         1,
                     ],
                     "float32",
                 )
-                query_val = T.sblock_alloc_buffer(
+                query_val = Ts.sblock_alloc_buffer(
                     [
                         1,
                     ],
                     "float32",
                 )
-                key_val = T.sblock_alloc_buffer(
+                key_val = Ts.sblock_alloc_buffer(
                     [
                         1,
                     ],
                     "float32",
                 )
-                result = T.sblock_alloc_buffer(
+                result = Ts.sblock_alloc_buffer(
                     [
                         1,
                     ],
@@ -287,7 +288,7 @@ def tree_attn(h_kv, h_q, d, dtype, rope_scaling: dict[str, Any], target: Target)
     )
 
     # fmt: off
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def batch_tree_attn(  # pylint: disable=too-many-branches
         var_q: T.handle, # [total_len, h_q, d]
         var_q_indptr: T.handle, # [batch_size + 1]
@@ -330,10 +331,10 @@ def tree_attn(h_kv, h_q, d, dtype, rope_scaling: dict[str, Any], target: Target)
             for lby in T.thread_binding(h_kv, thread="blockIdx.y"):
                 for lty in T.thread_binding(num_warps, thread="threadIdx.y"):
                     for ltx in T.thread_binding(bdx, thread="threadIdx.x"):
-                        with T.sblock("attn"):
-                            bx, by, ty, tx = T.axis.remap("SSSS", [lbx, lby, lty, ltx])
-                            T.reads()
-                            T.writes()
+                        with Ts.sblock("attn"):
+                            bx, by, ty, tx = Ts.axis.remap("SSSS", [lbx, lby, lty, ltx])
+                            Ts.reads()
+                            Ts.writes()
                             tile_id, batch_idx, batch_tiles, batch_rows, iterator, kv_chunk_len = _alloc_tile_walk_state()
                             Q_smem, K_smem, V_smem, O_local = _alloc_mha_qkvo_buffers(tile_x, tile_z, d, d, dtype)
                             S_smem, S_local, m_smem, m_prev_smem, d_smem, m_new, m_prev, d_new = _alloc_softmax_state_buffers(tile_x, tile_z, bdx, num_warps)
@@ -368,17 +369,17 @@ def tree_attn(h_kv, h_q, d, dtype, rope_scaling: dict[str, Any], target: Target)
                                             d_smem[row] = 1.0
 
                                     for li, lj in T.grid(tile_x, tile_y):
-                                        with T.sblock("O_init"):
-                                            i, j = T.axis.remap("SS", [li, lj])
+                                        with Ts.sblock("O_init"):
+                                            i, j = Ts.axis.remap("SS", [li, lj])
                                             O_local[i, j] = 0.0
                                     T.tvm_storage_sync("shared")
 
                                     # Load Q from gmem to smem
                                     for li, lj in T.grid(tile_x, tile_y):
-                                        with T.sblock("Q_load"):
-                                            i, j = T.axis.remap("SS", [li, lj])
-                                            T.reads()
-                                            T.writes()
+                                        with Ts.sblock("Q_load"):
+                                            i, j = Ts.axis.remap("SS", [li, lj])
+                                            Ts.reads()
+                                            Ts.writes()
                                             cur_L: T.let[T.int32] = q_indptr_val + (LH_start + i) // group_size
                                             cur_H_qo: T.let[T.int32] = by * group_size + (LH_start + i) % group_size
                                             if cur_L < q_indptr[b_idx + 1]:
@@ -395,10 +396,10 @@ def tree_attn(h_kv, h_q, d, dtype, rope_scaling: dict[str, Any], target: Target)
                                         L_kv_start: T.let[T.int32] = iterator * tile_z
                                         L_kv_base: T.let[T.int32] = kv_indptr[b_idx]
                                         for lz, ly in T.grid(tile_z, tile_y):
-                                            with T.sblock("KV_load"):
-                                                i, j = T.axis.remap("SS", [lz, ly])
-                                                T.reads()
-                                                T.writes()
+                                            with Ts.sblock("KV_load"):
+                                                i, j = Ts.axis.remap("SS", [lz, ly])
+                                                Ts.reads()
+                                                Ts.writes()
                                                 cur_L: T.let[T.int32] = L_kv_base + L_kv_start + i
                                                 if L_kv_start + i < kv_chunk_len[0]:
                                                     K_smem[i, j] = T.if_then_else(
@@ -413,17 +414,17 @@ def tree_attn(h_kv, h_q, d, dtype, rope_scaling: dict[str, Any], target: Target)
                                         T.tvm_storage_sync("shared")
 
                                         # Compute S
-                                        with T.sblock():
+                                        with Ts.sblock():
                                             for li, lj, lk in T.grid(tile_x, tile_z, tile_y):
-                                                with T.sblock("S_gemm"):
-                                                    i, j, k_axis = T.axis.remap("SSR", [li, lj, lk])
-                                                    with T.init():
+                                                with Ts.sblock("S_gemm"):
+                                                    i, j, k_axis = Ts.axis.remap("SSR", [li, lj, lk])
+                                                    with Ts.init():
                                                         S_local[i, j] = 0.0
                                                     S_local[i, j] += T.cast(Q_smem[i, k_axis], "float32") * T.cast(K_smem[j, k_axis], "float32") * sm_scale * math.log2(math.exp(1))
                                         T.tvm_storage_sync("shared")
                                         for li, lj in T.grid(tile_x, tile_z):
-                                            with T.sblock("S_store"):
-                                                i, j = T.axis.remap("SS", [li, lj])
+                                            with Ts.sblock("S_store"):
+                                                i, j = Ts.axis.remap("SS", [li, lj])
                                                 S_smem[i, j] = S_local[i, j]
                                         T.tvm_storage_sync("shared")
 
@@ -431,7 +432,7 @@ def tree_attn(h_kv, h_q, d, dtype, rope_scaling: dict[str, Any], target: Target)
                                         for i in T.serial(T.ceildiv(tile_x, bdx * num_warps)):
                                             row: T.let[T.int32] = i * bdx * num_warps + ty * bdx + tx
                                             if row < tile_x:
-                                                with T.sblock("update1"):
+                                                with Ts.sblock("update1"):
                                                     m_prev[i] = m_smem[row]
                                                     m_new[i] = m_smem[row]
                                                     # mask out of kv_chunk_len S
@@ -450,7 +451,7 @@ def tree_attn(h_kv, h_q, d, dtype, rope_scaling: dict[str, Any], target: Target)
 
                                         for i in T.serial(T.ceildiv(tile_x, bdx * num_warps)):
                                             row: T.let[T.int32] = i * bdx * num_warps + ty * bdx + tx
-                                            with T.sblock("update"):
+                                            with Ts.sblock("update"):
                                                 for j in T.serial(tile_z):
                                                     # this is to avoid sync inside condition branch
                                                     if row < tile_x:
@@ -470,7 +471,7 @@ def tree_attn(h_kv, h_q, d, dtype, rope_scaling: dict[str, Any], target: Target)
                                         for i in T.serial(T.ceildiv(tile_x, bdx * num_warps)):
                                             row: T.let[T.int32] = i * bdx * num_warps + ty * bdx + tx
                                             if row < tile_x:
-                                                with T.sblock("update"):
+                                                with Ts.sblock("update"):
                                                     for j in T.serial(tile_z):
                                                         d_new[i] += S_smem[row, j]
                                                     m_smem[row] = m_new[i]
@@ -479,18 +480,18 @@ def tree_attn(h_kv, h_q, d, dtype, rope_scaling: dict[str, Any], target: Target)
                                         T.tvm_storage_sync("shared")
 
                                         # Update O
-                                        with T.sblock():
+                                        with Ts.sblock():
                                             for li, lj, lk in T.grid(tile_x, tile_y, tile_z):
-                                                with T.sblock("O_gemm"):
-                                                    i, j, k_axis = T.axis.remap("SSR", [li, lj, lk])
-                                                    with T.init():
+                                                with Ts.sblock("O_gemm"):
+                                                    i, j, k_axis = Ts.axis.remap("SSR", [li, lj, lk])
+                                                    with Ts.init():
                                                         O_local[i, j] *= T.exp2(m_prev_smem[i] - m_smem[i])
                                                     O_local[i, j] += S_smem[i, k_axis] * T.cast(V_smem[k_axis, j], "float32")
 
                                     # Store O from smem to gmem
                                     for li, lj in T.grid(tile_x, tile_y):
-                                        with T.sblock("O_store"):
-                                            i, j = T.axis.remap("SS", [li, lj])
+                                        with Ts.sblock("O_store"):
+                                            i, j = Ts.axis.remap("SS", [li, lj])
                                             cur_L: T.let[T.int32] = q_indptr[b_idx] + (LH_start + i) // group_size
                                             cur_H_qo: T.let[T.int32] = by * group_size + (LH_start + i) % group_size
                                             if cur_L < q_indptr[b_idx + 1]:
@@ -498,8 +499,8 @@ def tree_attn(h_kv, h_q, d, dtype, rope_scaling: dict[str, Any], target: Target)
 
                                     # Store LSE to gmem
                                     for li in T.grid(tile_x):
-                                        with T.sblock("lse_store"):
-                                            i = T.axis.remap("S", [li])
+                                        with Ts.sblock("lse_store"):
+                                            i = Ts.axis.remap("S", [li])
                                             cur_L: T.let[T.int32] = q_indptr[b_idx] + (LH_start + i) // group_size
                                             cur_H_qo: T.let[T.int32] = by * group_size + (LH_start + i) % group_size
                                             if cur_L < q_indptr[b_idx + 1]:
@@ -607,7 +608,7 @@ def tree_attn_with_paged_kv_cache_cpu(h_kv, h_q, d, dtype, rope_scaling: dict[st
 
     # pylint: disable=line-too-long,too-many-branches
     # fmt: off
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def tree_attn_paged_kv_cpu(
         var_q: T.handle, # [total_len, h_q, d]
         var_q_indptr: T.handle, # [batch_size + 1]
@@ -679,22 +680,22 @@ def tree_attn_with_paged_kv_cache_cpu(h_kv, h_q, d, dtype, rope_scaling: dict[st
 
         for h_qo in T.serial(h_q):
             for b_idx in T.serial(batch_size):
-                with T.sblock("attn"):
-                    T.reads()
-                    T.writes()
-                    O_local = T.sblock_alloc_buffer((d, ), "float32")
-                    Q_local = T.sblock_alloc_buffer((d, ), "float32")
-                    K_local = T.sblock_alloc_buffer((d, ), "float32")
-                    V_local = T.sblock_alloc_buffer((d, ), "float32")
-
-                    kv_chunk_len = T.sblock_alloc_buffer((1, ), "int32")
-
-                    m_val = T.sblock_alloc_buffer((1, ), "float32")
-                    new_m = T.sblock_alloc_buffer((1, ), "float32")
-                    d_val = T.sblock_alloc_buffer((1, ), "float32")
-                    S_val = T.sblock_alloc_buffer((1, ), "float32")
-                    scale_O = T.sblock_alloc_buffer((1, ), "float32")
-                    factor = T.sblock_alloc_buffer((1, ), "float32")
+                with Ts.sblock("attn"):
+                    Ts.reads()
+                    Ts.writes()
+                    O_local = Ts.sblock_alloc_buffer((d, ), "float32")
+                    Q_local = Ts.sblock_alloc_buffer((d, ), "float32")
+                    K_local = Ts.sblock_alloc_buffer((d, ), "float32")
+                    V_local = Ts.sblock_alloc_buffer((d, ), "float32")
+
+                    kv_chunk_len = Ts.sblock_alloc_buffer((1, ), "int32")
+
+                    m_val = Ts.sblock_alloc_buffer((1, ), "float32")
+                    new_m = Ts.sblock_alloc_buffer((1, ), "float32")
+                    d_val = Ts.sblock_alloc_buffer((1, ), "float32")
+                    S_val = Ts.sblock_alloc_buffer((1, ), "float32")
+                    scale_O = Ts.sblock_alloc_buffer((1, ), "float32")
+                    factor = Ts.sblock_alloc_buffer((1, ), "float32")
                     cur_page_indptr_begin: T.let[T.int32] = page_indptr[b_idx]
                     cur_page_indptr_end: T.let[T.int32] = page_indptr[b_idx + 1]
                     kv_chunk_len[0] = T.if_then_else(
@@ -804,7 +805,7 @@ def tree_attn_with_paged_kv_cache(
     sliding_window = False  # Sliding window is not supported in this kernel.
 
     # fmt: off
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def tree_attn_paged_kv(
         var_q: T.handle,  # [total_len, h_q, d]
         var_q_indptr: T.handle,  # [batch_size + 1]
@@ -893,10 +894,10 @@ def tree_attn_with_paged_kv_cache(
             for lby in T.thread_binding(h_kv, thread="blockIdx.y"):
                 for lty in T.thread_binding(num_warps, thread="threadIdx.y"):
                     for ltx in T.thread_binding(bdx, thread="threadIdx.x"):
-                        with T.sblock("attn"):
-                            bx, by, ty, tx = T.axis.remap("SSSS", [lbx, lby, lty, ltx])
-                            T.reads()
-                            T.writes()
+                        with Ts.sblock("attn"):
+                            bx, by, ty, tx = Ts.axis.remap("SSSS", [lbx, lby, lty, ltx])
+                            Ts.reads()
+                            Ts.writes()
                             tile_id, batch_idx, batch_tiles, batch_rows, iterator, kv_chunk_len = _alloc_tile_walk_state()
                             Q_smem, K_smem, V_smem, O_local = _alloc_mha_qkvo_buffers(tile_x, tile_z, d, d, dtype)
                             S_smem, S_local, m_smem, m_prev_smem, d_smem, m_new, m_prev, d_new = _alloc_softmax_state_buffers(tile_x, tile_z, bdx, num_warps)
@@ -945,17 +946,17 @@ def tree_attn_with_paged_kv_cache(
                                             d_smem[row] = 1.0
 
                                     for li, lj in T.grid(tile_x, tile_y):
-                                        with T.sblock("O_init"):
-                                            i, j = T.axis.remap("SS", [li, lj])
+                                        with Ts.sblock("O_init"):
+                                            i, j = Ts.axis.remap("SS", [li, lj])
                                             O_local[i, j] = 0.0
                                     T.tvm_storage_sync("shared")
 
                                     # Load Q from gmem to smem
                                     for li, lj in T.grid(tile_x, tile_y):
-                                        with T.sblock("Q_load"):
-                                            i, j = T.axis.remap("SS", [li, lj])
-                                            T.reads()
-                                            T.writes()
+                                        with Ts.sblock("Q_load"):
+                                            i, j = Ts.axis.remap("SS", [li, lj])
+                                            Ts.reads()
+                                            Ts.writes()
                                             cur_L: T.let[T.int32] = q_indptr_val + (LH_start + i) // group_size
                                             cur_H_qo: T.let[T.int32] = by * group_size + (LH_start + i) % group_size
                                             if cur_L < q_indptr[b_idx + 1]:
@@ -980,10 +981,10 @@ def tree_attn_with_paged_kv_cache(
                                     for iterator in T.serial(T.ceildiv(kv_chunk_len[0], tile_z)):
                                         L_kv_start: T.let[T.int32] = iterator * tile_z
                                         for lz, ly in T.grid(tile_z, tile_y):
-                                            with T.sblock("K_load"):
-                                                i, j = T.axis.remap("SS", [lz, ly])
-                                                T.reads()
-                                                T.writes()
+                                            with Ts.sblock("K_load"):
+                                                i, j = Ts.axis.remap("SS", [lz, ly])
+                                                Ts.reads()
+                                                Ts.writes()
                                                 cur_L: T.let[T.int32] = L_kv_start + i
                                                 if cur_L < kv_chunk_len[0]:
                                                     seq_offset: T.let[T.int32()] = _get_seq_offset(cur_L, b_idx, length_info, sliding_window)  # type: ignore
@@ -997,10 +998,10 @@ def tree_attn_with_paged_kv_cache(
 
                                         T.tvm_storage_sync("shared")
                                         for lz, ly in T.grid(tile_z, tile_y):
-                                            with T.sblock("V_load"):
-                                                i, j = T.axis.remap("SS", [lz, ly])
-                                                T.reads()
-                                                T.writes()
+                                            with Ts.sblock("V_load"):
+                                                i, j = Ts.axis.remap("SS", [lz, ly])
+                                                Ts.reads()
+                                                Ts.writes()
                                                 cur_L: T.let[T.int32] = L_kv_start + i
                                                 if cur_L < kv_chunk_len[0]:
                                                     seq_offset: T.let[T.int32()] = _get_seq_offset(cur_L, b_idx, length_info, sliding_window)  # type: ignore
@@ -1014,11 +1015,11 @@ def tree_attn_with_paged_kv_cache(
                                         T.tvm_storage_sync("shared")
 
                                         # Compute S
-                                        with T.sblock():
+                                        with Ts.sblock():
                                             for li, lj, lk in T.grid(tile_x, tile_z, tile_y):
-                                                with T.sblock("S_gemm"):
-                                                    i, j, k = T.axis.remap("SSR", [li, lj, lk])
-                                                    with T.init():
+                                                with Ts.sblock("S_gemm"):
+                                                    i, j, k = Ts.axis.remap("SSR", [li, lj, lk])
+                                                    with Ts.init():
                                                         S_local[i, j] = 0.0
                                                     S_local[i, j] += (
                                                         T.cast(Q_smem[i, k], "float32")
@@ -1028,8 +1029,8 @@ def tree_attn_with_paged_kv_cache(
                                                     )
                                         T.tvm_storage_sync("shared")
                                         for li, lj in T.grid(tile_x, tile_z):
-                                            with T.sblock("S_store"):
-                                                i, j = T.axis.remap("SS", [li, lj])
+                                            with Ts.sblock("S_store"):
+                                                i, j = Ts.axis.remap("SS", [li, lj])
                                                 S_smem[i, j] = S_local[i, j]
                                         T.tvm_storage_sync("shared")
 
@@ -1037,7 +1038,7 @@ def tree_attn_with_paged_kv_cache(
                                         for i in T.serial(T.ceildiv(tile_x, bdx * num_warps)):
                                             row: T.let[T.int32] = i * bdx * num_warps + ty * bdx + tx
                                             if row < tile_x:
-                                                with T.sblock("update1"):
+                                                with Ts.sblock("update1"):
                                                     m_prev[i] = m_smem[row]
                                                     m_new[i] = m_smem[row]
                                                     # mask out of kv_chunk_len S
@@ -1062,7 +1063,7 @@ def tree_attn_with_paged_kv_cache(
 
                                         for i in T.serial(T.ceildiv(tile_x, bdx * num_warps)):
                                             row: T.let[T.int32] = i * bdx * num_warps + ty * bdx + tx
-                                            with T.sblock("update"):
+                                            with Ts.sblock("update"):
                                                 for j in T.serial(tile_z):
                                                     # this is to avoid sync inside condition branch
                                                     if row < tile_x:
@@ -1088,7 +1089,7 @@ def tree_attn_with_paged_kv_cache(
                                         for i in T.serial(T.ceildiv(tile_x, bdx * num_warps)):
                                             row: T.let[T.int32] = i * bdx * num_warps + ty * bdx + tx
                                             if row < tile_x:
-                                                with T.sblock("update"):
+                                                with Ts.sblock("update"):
                                                     for j in T.serial(tile_z):
                                                         d_new[i] += S_smem[row, j]
                                                     m_smem[row] = m_new[i]
@@ -1097,11 +1098,11 @@ def tree_attn_with_paged_kv_cache(
                                         T.tvm_storage_sync("shared")
 
                                         # Update O
-                                        with T.sblock():
+                                        with Ts.sblock():
                                             for li, lj, lk in T.grid(tile_x, tile_y, tile_z):
-                                                with T.sblock("O_gemm"):
-                                                    i, j, k = T.axis.remap("SSR", [li, lj, lk])
-                                                    with T.init():
+                                                with Ts.sblock("O_gemm"):
+                                                    i, j, k = Ts.axis.remap("SSR", [li, lj, lk])
+                                                    with Ts.init():
                                                         O_local[i, j] *= T.exp2(
                                                             m_prev_smem[i] - m_smem[i]
                                                         )
@@ -1111,8 +1112,8 @@ def tree_attn_with_paged_kv_cache(
 
                                     # Store O from smem to gmem
                                     for li, lj in T.grid(tile_x, tile_y):
-                                        with T.sblock("O_store"):
-                                            i, j = T.axis.remap("SS", [li, lj])
+                                        with Ts.sblock("O_store"):
+                                            i, j = Ts.axis.remap("SS", [li, lj])
                                             cur_L: T.let[T.int32] = (
                                                 q_indptr[b_idx] + (LH_start + i) // group_size
                                             )
@@ -1126,8 +1127,8 @@ def tree_attn_with_paged_kv_cache(
 
                                     # Store LSE to gmem
                                     for li in T.grid(tile_x):
-                                        with T.sblock("lse_store"):
-                                            i = T.axis.remap("S", [li])
+                                        with Ts.sblock("lse_store"):
+                                            i = Ts.axis.remap("S", [li])
                                             cur_L: T.let[T.int32] = (
                                                 q_indptr[b_idx] + (LH_start + i) // group_size
                                             )
diff --git a/python/tvm/relax/frontend/nn/op.py b/python/tvm/relax/frontend/nn/op.py
index 7e16a1be0d..dd6376b355 100644
--- a/python/tvm/relax/frontend/nn/op.py
+++ b/python/tvm/relax/frontend/nn/op.py
@@ -28,6 +28,7 @@ import numpy as np
 import tvm
 from tvm import te
 from tvm import tirx as _tir
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 
 from ... import expr as rx
@@ -2796,7 +2797,7 @@ 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])
 
-    @T.prim_func(private=True, s_tir=True)
+    @Ts.prim_func(private=True)
     def _get_renorm_prob(A: T.handle, B: T.handle, C: T.handle, D: T.handle):
         batch, vocab_size = T.int64(), T.int64()
         cumsum_sorted = T.match_buffer(A, (batch, vocab_size), prob_dtype)
@@ -2804,8 +2805,8 @@ def sample_top_p_top_k_from_sorted_prob(
         top_k = T.match_buffer(C, (batch, 1), index_dtype)
         renorm_prob = T.match_buffer(D, (batch, 1), prob_dtype)
         for ax0, ax1 in T.grid(batch, vocab_size):
-            with T.sblock("T_get_renorm_prob"):
-                v_ax0, v_ax1 = T.axis.remap("SS", [ax0, ax1])
+            with Ts.sblock("T_get_renorm_prob"):
+                v_ax0, v_ax1 = Ts.axis.remap("SS", [ax0, ax1])
                 if not _cumsum_mask(cumsum_sorted, top_p, top_k, v_ax0, 0):
                     renorm_prob[v_ax0, 0] = cumsum_sorted[v_ax0, 0]
                 elif _cumsum_mask(cumsum_sorted, top_p, top_k, v_ax0, v_ax1):
@@ -2814,7 +2815,7 @@ 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]
 
-    @T.prim_func(private=True, s_tir=True)
+    @Ts.prim_func(private=True)
     def _get_index_from_sorted(
         A: T.handle, B: T.handle, C: T.handle, D: T.handle, E: T.handle, F: T.handle
     ):
@@ -2828,9 +2829,9 @@ def sample_top_p_top_k_from_sorted_prob(
         output_index = T.match_buffer(F, (out_batch, 1), index_dtype)
 
         for ax0, ax1 in T.grid(out_batch, vocab_size):
-            with T.sblock("T_get_index_from_sorted"):
-                v_ax0, v_ax1 = T.axis.remap("SS", [ax0, ax1])
-                T.writes(output_index[v_ax0, 0])
+            with Ts.sblock("T_get_index_from_sorted"):
+                v_ax0, v_ax1 = Ts.axis.remap("SS", [ax0, ax1])
+                Ts.writes(output_index[v_ax0, 0])
                 if (
                     usample[v_ax0, T.int64(0)]
                     < cumsum_sorted[sample_indices[v_ax0, T.int64(0)], v_ax1]
@@ -2902,7 +2903,7 @@ 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])
 
-    @T.prim_func(private=True, s_tir=True)
+    @Ts.prim_func(private=True)
     def _get_renorm_cutoff(A: T.handle, B: T.handle, C: T.handle, D: T.handle, E: T.handle):
         batch, vocab_size = T.int64(), T.int64()
         sorted_prob = T.match_buffer(A, (batch, vocab_size), prob_dtype)
@@ -2911,8 +2912,8 @@ def renormalize_top_p_top_k_prob(prob, sorted_prob, top_p, top_k):
         top_k = T.match_buffer(D, (batch, 1), top_k_dtype)
         cutoff = T.match_buffer(E, (batch, 1), prob_dtype)
         for ax0, ax1 in T.grid(batch, vocab_size):
-            with T.sblock("T_get_renorm_cutoff"):
-                v_ax0, v_ax1 = T.axis.remap("SS", [ax0, ax1])
+            with Ts.sblock("T_get_renorm_cutoff"):
+                v_ax0, v_ax1 = Ts.axis.remap("SS", [ax0, ax1])
                 if _cumsum_mask(cumsum_sorted, top_p, top_k, v_ax0, 0) == 0:
                     cutoff[v_ax0, 0] = sorted_prob[v_ax0, 0]
                 elif _cumsum_mask(cumsum_sorted, top_p, top_k, v_ax0, v_ax1) == 1:
diff --git a/python/tvm/relax/frontend/tflite/tflite_frontend.py b/python/tvm/relax/frontend/tflite/tflite_frontend.py
index 7129198aa4..4f0543df02 100644
--- a/python/tvm/relax/frontend/tflite/tflite_frontend.py
+++ b/python/tvm/relax/frontend/tflite/tflite_frontend.py
@@ -30,6 +30,7 @@ import numpy as np
 import tvm
 from tvm import relax, tirx
 from tvm.relax import op as _op
+from tvm.script import s_tir as Ts
 
 from .tflite_flexbuffer import FlexBufferDecoder
 
@@ -8329,7 +8330,7 @@ def _build_tflite_rfft2d_primfunc(input_shape, output_pair_shape):
     output_complex_total = batch * height * out_width
     neg_two_pi = np.float32(-2.0 * math.pi)
 
-    @T.prim_func(private=True, s_tir=True, check_well_formed=False)
+    @Ts.prim_func(private=True, check_well_formed=False)
     def kernel(
         data: T.Buffer(input_shape, "float32"), output: T.Buffer(output_pair_shape, "float32")
     ):
@@ -8341,8 +8342,8 @@ def _build_tflite_rfft2d_primfunc(input_shape, output_pair_shape):
         neg_two_pi_const = T.float32(neg_two_pi)
 
         for b_idx, out_y, out_x in T.grid(batch, height, out_width):
-            with T.sblock("rfft2d"):
-                v_b, v_oy, v_ox = T.axis.remap("SSS", [b_idx, out_y, out_x])
+            with Ts.sblock("rfft2d"):
+                v_b, v_oy, v_ox = Ts.axis.remap("SSS", [b_idx, out_y, out_x])
                 real_sum: T.float32 = T.float32(0)
                 imag_sum: T.float32 = T.float32(0)
                 input_base = v_b * height * width
@@ -8502,7 +8503,8 @@ def _build_tflite_rfft2d_fft_primfunc(input_shape, output_pair_shape):
     # this kernel.
     primfunc_source = (
         "from tvm.script.parser import tirx as T\n"
-        "@T.prim_func(private=True, s_tir=True, check_well_formed=False)\n"
+        "from tvm.script import s_tir as Ts\n"
+        "@Ts.prim_func(private=True, check_well_formed=False)\n"
         "def kernel(\n"
         f"    data: T.Buffer({tuple(int(x) for x in input_shape)}, 'float32'),\n"
         f"    output: T.Buffer({tuple(int(x) for x in output_pair_shape)}, 'float32'),\n"
@@ -8512,8 +8514,8 @@ def _build_tflite_rfft2d_fft_primfunc(input_shape, output_pair_shape):
         f"    scratch_real = T.decl_buffer(({input_total},), 'float32')\n"
         f"    scratch_imag = T.decl_buffer(({input_total},), 'float32')\n"
         f"    for b_idx in T.serial({batch}):\n"
-        f"        with T.sblock('rfft2d_fft'):\n"
-        f"            v_b = T.axis.remap('S', [b_idx])\n"
+        f"        with Ts.sblock('rfft2d_fft'):\n"
+        f"            v_b = Ts.axis.remap('S', [b_idx])\n"
         f"            # Initialize scratch from real input; imag = 0.\n"
         f"            for i in T.serial({height * width}):\n"
         f"                src = v_b * {height * width} + i\n"
@@ -8611,7 +8613,7 @@ def _build_stablehlo_rng_bit_generator_primfunc(algorithm, state_len, out_dtype,
 
     if algorithm == "threefry":
 
-        @T.prim_func(private=True, s_tir=True)
+        @Ts.prim_func(private=True)
         def kernel(
             initial_state: T.Buffer((state_len,), "uint64"),
             output_state: T.Buffer((state_len,), "uint64"),
@@ -8620,7 +8622,7 @@ def _build_stablehlo_rng_bit_generator_primfunc(algorithm, state_len, out_dtype,
             # A single opaque structured block keeps the imperative kernel as a
             # well-formed block-structured PrimFunc, as required by the Relax
             # pipeline (e.g. HasReshapePattern).
-            with T.sblock("rng_bit_generator"):
+            with Ts.sblock("rng_bit_generator"):
                 state_key = initial_state[0]
                 state_counter = initial_state[1]
                 key_0 = _u32(state_key & T.uint64(0xFFFFFFFF))
@@ -8661,13 +8663,13 @@ def _build_stablehlo_rng_bit_generator_primfunc(algorithm, state_len, out_dtype,
 
         return kernel
 
-    @T.prim_func(private=True, s_tir=True)
+    @Ts.prim_func(private=True)
     def kernel(
         initial_state: T.Buffer((state_len,), "uint64"),
         output_state: T.Buffer((state_len,), "uint64"),
         output: T.Buffer(out_shape, out_dtype),
     ):
-        with T.sblock("rng_bit_generator"):
+        with Ts.sblock("rng_bit_generator"):
             state_key = initial_state[0]
             state_counter = initial_state[1]
             key_0 = _u32(state_key & T.uint64(0xFFFFFFFF))
diff --git a/python/tvm/relax/transform/legalize_ops/inspect_op.py b/python/tvm/relax/transform/legalize_ops/inspect_op.py
index 3d0819c831..ce09203fe4 100644
--- a/python/tvm/relax/transform/legalize_ops/inspect_op.py
+++ b/python/tvm/relax/transform/legalize_ops/inspect_op.py
@@ -20,6 +20,7 @@
 import enum
 
 from tvm.ir import Call
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 
 from ... import op
@@ -54,7 +55,7 @@ class TVMStructFieldKind(enum.IntEnum):
 
 @register_legalize("relax.inspect.tensor_stride_i")
 def _tensor_stride_i(bb: BlockBuilder, call: Call) -> Expr:
-    @T.prim_func(private=True, s_tir=True)
+    @Ts.prim_func(private=True)
     def _get_tensor_stride_i(dlpack_handle: T.handle, axis: T.int64) -> T.int64:
         T.func_attr({"tirx.is_host_func": True, "tirx.is_scheduled": True})
         assert T.int64(0) <= axis, "Specified axis may not be negative"
@@ -96,7 +97,7 @@ def _tensor_stride_i(bb: BlockBuilder, call: Call) -> Expr:
 
 @register_legalize("relax.inspect.tensor_byte_offset")
 def _tensor_byte_offset(bb: BlockBuilder, call: Call) -> Expr:
-    @T.prim_func(private=True, s_tir=True)
+    @Ts.prim_func(private=True)
     def _get_tensor_byte_offset(dlpack_handle: T.handle) -> T.int64:
         T.func_attr({"tirx.is_host_func": True, "tirx.is_scheduled": True})
         byte_offset: T.let[T.uint64] = T.tvm_struct_get(
@@ -110,7 +111,7 @@ def _tensor_byte_offset(bb: BlockBuilder, call: Call) -> Expr:
 
 @register_legalize("relax.inspect.tensor_elem_offset")
 def _tensor_elem_offset(bb: BlockBuilder, call: Call) -> Expr:
-    @T.prim_func(private=True, s_tir=True)
+    @Ts.prim_func(private=True)
     def _get_tensor_elem_offset(dlpack_handle: T.handle) -> T.int64:
         T.func_attr({"tirx.is_host_func": True, "tirx.is_scheduled": True})
         byte_offset: T.let[T.uint64] = T.tvm_struct_get(
diff --git a/python/tvm/relax/transform/transform.py b/python/tvm/relax/transform/transform.py
index c954fa09b4..703f6d0fc3 100644
--- a/python/tvm/relax/transform/transform.py
+++ b/python/tvm/relax/transform/transform.py
@@ -112,7 +112,7 @@ def Gradient(
 
     .. code-block:: python
 
-        @I.ir_module(s_tir=True)
+        @I.ir_module
         class Module:
             @R.function
             def main(
@@ -131,7 +131,7 @@ def Gradient(
 
     .. code-block:: python
 
-        @I.ir_module(s_tir=True)
+        @I.ir_module
         class After:
             @R.function
             def main(
@@ -170,7 +170,7 @@ def Gradient(
 
     .. code-block:: python
 
-        @I.ir_module(s_tir=True)
+        @I.ir_module
         class Module:
             @R.function
             def main(
@@ -188,7 +188,7 @@ def Gradient(
 
     .. code-block:: python
 
-        @I.ir_module(s_tir=True)
+        @I.ir_module
         class Module:
             @R.function
             def main(
@@ -1147,7 +1147,7 @@ def LegalizeOps(
                 r = R.call_tir(multiply, (y, z), (2, 3), dtype="float32")
                 return r
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def add(
                 A: T.Buffer((2, 3), "float32"),
                 B: T.Buffer((2, 3), "float32"),
@@ -1155,13 +1155,13 @@ def LegalizeOps(
             ):
                 T.func_attr({"tirx.noalias": True})
                 for ax0, ax1 in T.grid(2, 3):
-                    with T.sblock("T_add"):
-                        v_ax0, v_ax1 = T.axis.remap("SS", [ax0, ax1])
-                        T.reads(A[v_ax0, v_ax1], B[v_ax0, v_ax1])
-                        T.writes(T_add[v_ax0, v_ax1])
+                    with Ts.sblock("T_add"):
+                        v_ax0, v_ax1 = Ts.axis.remap("SS", [ax0, ax1])
+                        Ts.reads(A[v_ax0, v_ax1], B[v_ax0, v_ax1])
+                        Ts.writes(T_add[v_ax0, v_ax1])
                         T_add[v_ax0, v_ax1] = A[v_ax0, v_ax1] + B[v_ax0, v_ax1]
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def multiply(
                 A: T.Buffer((2, 3), "float32"),
                 B: T.Buffer((2, 3), "float32"),
@@ -1169,10 +1169,10 @@ def LegalizeOps(
             ):
                 T.func_attr({"tirx.noalias": True})
                 for ax0, ax1 in T.grid(2, 3):
-                    with T.sblock("T_multiply"):
-                        v_ax0, v_ax1 = T.axis.remap("SS", [ax0, ax1])
-                        T.reads(A[v_ax0, v_ax1], B[v_ax0, v_ax1])
-                        T.writes(T_multiply[v_ax0, v_ax1])
+                    with Ts.sblock("T_multiply"):
+                        v_ax0, v_ax1 = Ts.axis.remap("SS", [ax0, ax1])
+                        Ts.reads(A[v_ax0, v_ax1], B[v_ax0, v_ax1])
+                        Ts.writes(T_multiply[v_ax0, v_ax1])
                         T_multiply[v_ax0, v_ax1] = A[v_ax0, v_ax1] * B[v_ax0, v_ax1]
     """
 
diff --git a/python/tvm/s_tir/__init__.py b/python/tvm/s_tir/__init__.py
index 7bb80b3419..fe84822e42 100644
--- a/python/tvm/s_tir/__init__.py
+++ b/python/tvm/s_tir/__init__.py
@@ -18,6 +18,10 @@
 # pylint: disable=invalid-name
 """S-TIR namespace for scheduable TensorIR"""
 
+import tvm.script
+
+tvm.script.register_dialect("s_tir", "tvm.s_tir.script", builder_path="tvm.s_tir.script.ir_builder")
+
 from ._tensor_intrin import TensorIntrin
 from .stmt import MatchBufferRegion, SBlock, SBlockRealize
 
@@ -56,3 +60,26 @@ def renew_defs(func):
         The new generated func.
     """
     return _ffi_api.RenewDefs(func)
+
+
+def _initialize_script_namespace():
+    from . import script
+
+    script._initialize()
+
+
+from tvm.script.parser import register_namespace_initializer as _register_namespace_initializer
+
+_register_namespace_initializer(_initialize_script_namespace, aliases=("Ts", "s_tir"))
+
+
+def _check_script_module(module):
+    from tvm.tirx import PrimFunc
+
+    if any(isinstance(fn, PrimFunc) and not fn.is_tirx for fn in module.functions.values()):
+        from tvm.s_tir.script.ir_builder import _check_module_well_formed
+
+        _check_module_well_formed(module)
+
+
+tvm.script.register_module_validator(_check_script_module)
diff --git a/python/tvm/s_tir/backend/adreno/pipeline.py b/python/tvm/s_tir/backend/adreno/pipeline.py
index 1845f2f16e..0eec795233 100644
--- a/python/tvm/s_tir/backend/adreno/pipeline.py
+++ b/python/tvm/s_tir/backend/adreno/pipeline.py
@@ -23,7 +23,7 @@ from tvm import s_tir, tirx
 from tvm.tirx import compilation_pipeline as tir_pipeline
 
 
-def default_tir_pipeline():
+def default_tir_pipeline(*, prepare_only=False):
     """The default tirx pipeline used in tvm.tirx.build"""
 
     @tvm.transform.module_pass(opt_level=0)
@@ -90,7 +90,6 @@ def default_tir_pipeline():
                 s_tir.transform.VerifyVTCMLimit(),
                 s_tir.transform.LowerVtcmAlloc(),
                 tirx.transform.VerifyMemory(),
-                tirx.transform.AnnotateEntryFunc(),
             ]
         )
         passes.extend(
@@ -106,19 +105,21 @@ def default_tir_pipeline():
             passes.append(s_tir.transform.InjectPTXAsyncCopy())
         if bool(config.get("tirx.s_tir.ldg32", False)):
             passes.append(s_tir.transform.InjectPTXLDG32())
-        passes.extend(
-            [
-                s_tir.transform.MergeSharedMemoryAllocations(),
-                tirx.transform.SplitHostDevice(),
-                tirx.transform.MakePackedAPI(),
-                tirx.transform.FP8StorageLegalize(),
-                tirx.transform.BF16StorageLegalize(),
-            ]
-        )
+        passes.append(s_tir.transform.MergeSharedMemoryAllocations())
+        if not prepare_only:
+            passes.extend(
+                [
+                    tirx.transform.AnnotateEntryFunc(),
+                    tirx.transform.SplitHostDevice(),
+                    tirx.transform.MakePackedAPI(),
+                    tirx.transform.FP8StorageLegalize(),
+                    tirx.transform.BF16StorageLegalize(),
+                ]
+            )
         mod = tvm.ir.transform.Sequential(passes)(mod)
         return mod
 
-    return _pipeline
+    return _pipeline, tir_pipeline.finalize_host_passes, tir_pipeline.finalize_device_passes
 
 
 tir_pipeline.PIPELINE_MAP["adreno"] = default_tir_pipeline
diff --git a/python/tvm/s_tir/pipeline.py b/python/tvm/s_tir/pipeline.py
index 283ec8fc92..fb9e0f02d1 100644
--- a/python/tvm/s_tir/pipeline.py
+++ b/python/tvm/s_tir/pipeline.py
@@ -25,7 +25,7 @@ from tvm.tirx import compilation_pipeline as tir_pipeline
 tir = tirx  # alias for backward compat
 
 
-def default_s_tir_pipeline():
+def default_s_tir_pipeline(*, prepare_only=False):
     """The default tirx pipeline used in tvm.tirx.build"""
 
     @tvm.transform.module_pass(opt_level=0)
@@ -90,7 +90,6 @@ def default_s_tir_pipeline():
                 s_tir.transform.VerifyVTCMLimit(),
                 s_tir.transform.LowerVtcmAlloc(),
                 tirx.transform.VerifyMemory(),
-                tirx.transform.AnnotateEntryFunc(),
             ]
         )
         passes.extend(
@@ -106,15 +105,17 @@ def default_s_tir_pipeline():
             passes.append(s_tir.transform.InjectPTXAsyncCopy())
         if bool(config.get("tirx.s_tir.ldg32", False)):
             passes.append(s_tir.transform.InjectPTXLDG32())
-        passes.extend(
-            [
-                s_tir.transform.MergeSharedMemoryAllocations(),
-                tirx.transform.SplitHostDevice(),
-                tirx.transform.MakePackedAPI(),
-                tirx.transform.FP8StorageLegalize(),
-                tirx.transform.BF16StorageLegalize(),
-            ]
-        )
+        passes.append(s_tir.transform.MergeSharedMemoryAllocations())
+        if not prepare_only:
+            passes.extend(
+                [
+                    tirx.transform.AnnotateEntryFunc(),
+                    tirx.transform.SplitHostDevice(),
+                    tirx.transform.MakePackedAPI(),
+                    tirx.transform.FP8StorageLegalize(),
+                    tirx.transform.BF16StorageLegalize(),
+                ]
+            )
         mod = tvm.ir.transform.Sequential(passes)(mod)
         return mod
 
@@ -141,3 +142,39 @@ def finalize_device_passes():  # pylint: disable=unused-argument
 
 
 tir_pipeline.PIPELINE_MAP["s_tir"] = default_s_tir_pipeline
+
+
+def _select_default_pipeline(mod, target):
+    """Select S-TIR lowering only for functions constructed in this dialect."""
+    scheduled = {
+        gv: func
+        for gv, func in mod.functions.items()
+        if isinstance(func, tirx.PrimFunc) and not func.is_tirx
+    }
+    if not scheduled:
+        return None
+    mixed = len(scheduled) != len(mod.functions)
+    name = "s_tir"
+    if target is not None and target.kind.name == "opencl" and "adreno" in target.keys:
+        name = "adreno"
+    s_pipeline = tir_pipeline.get_tir_pipeline(name, prepare_only=mixed)
+    if not mixed:
+        return s_pipeline
+
+    lower_s_tir, finalize_host, finalize_device = s_pipeline
+    lower_tirx, _, _ = tir_pipeline.get_tir_pipeline("tirx", prepare_only=True)
+
+    @tvm.transform.module_pass(opt_level=0)
+    def _lower_mixed(input_mod, _ctx):
+        s_funcs = {gv: func for gv, func in input_mod.functions.items() if gv in scheduled}
+        t_funcs = {gv: func for gv, func in input_mod.functions.items() if gv not in scheduled}
+        lowered = tvm.IRModule(attrs=input_mod.attrs, global_infos=input_mod.global_infos)
+        for funcs, lowering in ((s_funcs, lower_s_tir), (t_funcs, lower_tirx)):
+            group = tvm.IRModule(funcs, attrs=input_mod.attrs, global_infos=input_mod.global_infos)
+            lowered.update(lowering(group))
+        return tir_pipeline.finalize_tir_pipeline()(lowered)
+
+    return _lower_mixed, finalize_host, finalize_device
+
+
+tir_pipeline.register_default_tir_pipeline_selector(_select_default_pipeline)
diff --git a/python/tvm/s_tir/schedule/schedule.py b/python/tvm/s_tir/schedule/schedule.py
index 42ac24df3d..253aced082 100644
--- a/python/tvm/s_tir/schedule/schedule.py
+++ b/python/tvm/s_tir/schedule/schedule.py
@@ -622,18 +622,18 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_merge(a: T.handle, b: T.handle, c: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 C = T.match_buffer(c, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
                 for i, j in T.grid(128, 128):
-                    with T.sblock("C"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("C"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         C[vi, vj] = A[vi, vj] * 2.0
 
         Create the schedule and do fuse:
@@ -650,7 +650,7 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_fuse(a: T.handle, b: T.handle, c: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
@@ -658,16 +658,16 @@ class Schedule(Object):
                 # the 2 loops are merged into 1
                 for i_m in range(128):
                     for j in range(128):
-                        with T.sblock("B"):
-                            vi, vj = T.axis.remap("SS", [i_m, j])
-                            T.reads(A[vi, vj])
-                            T.writes(B[vi, vj])
+                        with Ts.sblock("B"):
+                            vi, vj = Ts.axis.remap("SS", [i_m, j])
+                            Ts.reads(A[vi, vj])
+                            Ts.writes(B[vi, vj])
                             B[vi, vj] = A[vi, vj] * T.float32(2)
                     for j in range(128):
-                        with T.sblock("C"):
-                            vi, vj = T.axis.remap("SS", [i_m, j])
-                            T.reads(A[vi, vj])
-                            T.writes(C[vi, vj])
+                        with Ts.sblock("C"):
+                            vi, vj = Ts.axis.remap("SS", [i_m, j])
+                            Ts.reads(A[vi, vj])
+                            Ts.writes(C[vi, vj])
                             C[vi, vj] = A[vi, vj] * T.float32(2)
         """
         return _ffi_api.ScheduleMerge(self, loops)  # type: ignore # pylint: disable=no-member
@@ -698,13 +698,13 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_fuse(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
 
         Create the schedule and do fuse:
@@ -720,15 +720,15 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_fuse(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 # the 2 loops are fused into 1
                 for i_j_fused in T.serial(0, 16384):
-                    with T.sblock("B"):
-                        vi = T.axis.S(128, T.floordiv(i_j_fused, 128))
-                        vj = T.axis.S(128, T.floormod(i_j_fused, 128))
+                    with Ts.sblock("B"):
+                        vi = Ts.axis.S(128, T.floordiv(i_j_fused, 128))
+                        vj = Ts.axis.S(128, T.floormod(i_j_fused, 128))
                         B[vi, vj] = A[vi, vj] * 2.0
 
         """
@@ -788,13 +788,13 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_split(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
 
         Create the schedule and do split:
@@ -810,15 +810,15 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_split(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 # the original loop is split into 2 loops
                 for i0, i1, j in T.grid(2, 64, 128):
-                    with T.sblock("B"):
-                        vi = T.axis.S(128, i0 * 64 + i1)
-                        vj = T.axis.S(128, j)
+                    with Ts.sblock("B"):
+                        vi = Ts.axis.S(128, i0 * 64 + i1)
+                        vj = Ts.axis.S(128, j)
                         B[vi, vj] = A[vi, vj] * 2.0
 
         """
@@ -875,13 +875,13 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_partition(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
 
         Create the schedule and do partition:
@@ -901,40 +901,40 @@ class Schedule(Object):
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 # the original loop is partition into 3 loops
-                with T.sblock("root"):
-                    T.reads()
-                    T.writes()
-                    with T.sblock("B_i_common"):
-                        T.reads()
-                        T.writes()
-                        with T.sblock("B_i0_partition"):
-                            T.reads()
-                            T.writes()
+                with Ts.sblock("root"):
+                    Ts.reads()
+                    Ts.writes()
+                    with Ts.sblock("B_i_common"):
+                        Ts.reads()
+                        Ts.writes()
+                        with Ts.sblock("B_i0_partition"):
+                            Ts.reads()
+                            Ts.writes()
                             for i0, j in T.grid(2, 128):
-                                with T.sblock("B_i0"):
-                                    vi, vj = T.axis.remap("SS", [i0, j])
-                                    T.reads(A[0:2, 0:128])
-                                    T.writes(B[0:2, 0:128])
+                                with Ts.sblock("B_i0"):
+                                    vi, vj = Ts.axis.remap("SS", [i0, j])
+                                    Ts.reads(A[0:2, 0:128])
+                                    Ts.writes(B[0:2, 0:128])
                                     B[vi, vj] = A[vi, vj] * T.float32(2)
-                        with T.sblock("B_i1_partition"):
-                            T.reads()
-                            T.writes()
+                        with Ts.sblock("B_i1_partition"):
+                            Ts.reads()
+                            Ts.writes()
                             for i1 in range(2, 66):
                                 for j in range(128):
-                                    with T.sblock("B_i1"):
-                                        vi, vj = T.axis.remap("SS", [i1, j])
-                                        T.reads(A[2:66, 0:128])
-                                        T.writes(B[2:66, 0:128])
+                                    with Ts.sblock("B_i1"):
+                                        vi, vj = Ts.axis.remap("SS", [i1, j])
+                                        Ts.reads(A[2:66, 0:128])
+                                        Ts.writes(B[2:66, 0:128])
                                         B[vi, vj] = A[vi, vj] * T.float32(2)
-                        with T.sblock("B_partition_2"):
-                            T.reads()
-                            T.writes()
+                        with Ts.sblock("B_partition_2"):
+                            Ts.reads()
+                            Ts.writes()
                             for i2 in range(66, 128):
                                 for j in range(128):
-                                    with T.sblock("B_i2"):
-                                        vi, vj = T.axis.remap("SS", [i2, j])
-                                        T.reads(A[66:128, 0:128])
-                                        T.writes(B[66:128, 0:128])
+                                    with Ts.sblock("B_i2"):
+                                        vi, vj = Ts.axis.remap("SS", [i2, j])
+                                        Ts.reads(A[66:128, 0:128])
+                                        Ts.writes(B[66:128, 0:128])
                                         B[vi, vj] = A[vi, vj] * T.float32(2)
         """
         return list(
@@ -969,13 +969,13 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_reorder(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
 
         Create the schedule and do reorder:
@@ -991,14 +991,14 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_reorder(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 # Here j and i are reordered
                 for j, i in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
 
         """
@@ -1022,16 +1022,16 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def matmul(
                 A: T.Buffer((128, 128), "float32"),
                 B: T.Buffer((128, 128), "float32"),
                 C: T.Buffer((128, 128), "float32"),
             ) -> None:
                 for i, j, k in T.grid(128, 128, 128):
-                    with T.sblock("C"):
-                        vi, vj, vk = T.axis.remap("SSR", [i, j, k])
-                        with T.init():
+                    with Ts.sblock("C"):
+                        vi, vj, vk = Ts.axis.remap("SSR", [i, j, k])
+                        with Ts.init():
                             C[vi, vj] = 0.0
                         C[vi, vj] = C[vi, vj] + A[vi, vk] * B[vj, vk]
 
@@ -1047,18 +1047,18 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def matmul_after_reorder_block_iter_var(
                 A: T.Buffer((128, 128), "float32"),
                 B: T.Buffer((128, 128), "float32"),
                 C: T.Buffer((128, 128), "float32"),
             ):
                 for i, j, k in T.grid(128, 128, 128):
-                    with T.sblock("C"):
-                        vk, vj, vi = T.axis.remap("RSS", [k, j, i])
-                        T.reads(A[vi, vk], B[vj, vk])
-                        T.writes(C[vi, vj])
-                        with T.init():
+                    with Ts.sblock("C"):
+                        vk, vj, vi = Ts.axis.remap("RSS", [k, j, i])
+                        Ts.reads(A[vi, vk], B[vj, vk])
+                        Ts.writes(C[vi, vj])
+                        with Ts.init():
                             C[vi, vj] = T.float32(0)
                         C[vi, vj] = C[vi, vj] + A[vi, vk] * B[vj, vk]
 
@@ -1090,14 +1090,14 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_add_unit_loop(
                 A: T.Buffer((), "int32"),
                 B: T.Buffer((), "int32"),
                 C: T.Buffer((), "int32"),
             ) -> None:
-                with T.sblock("C"):
-                    vi = T.axis.spatial(1, 0)
+                with Ts.sblock("C"):
+                    vi = Ts.axis.spatial(1, 0)
                     C[()] = A[()] + B[()]
 
         Create the schedule and do add-unit-loop:
@@ -1112,15 +1112,15 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_add_unit_loop(
                 A: T.Buffer((), "int32"),
                 B: T.Buffer((), "int32"),
                 C: T.Buffer((), "int32"),
             ) -> None:
                 for u in T.serial(1):
-                    with T.sblock("C"):
-                        vi = T.axis.spatial(1, 0)
+                    with Ts.sblock("C"):
+                        vi = Ts.axis.spatial(1, 0)
                         C[()] = A[()] + B[()]
         """
         # pylint: disable-next=no-member
@@ -1150,13 +1150,13 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_parallel(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
 
         Create the schedule and do parallel:
@@ -1171,14 +1171,14 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_parallel(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i in T.parallel(0, 128):
                     for j in T.serial(0, 128):
-                        with T.sblock("B"):
-                            vi, vj = T.axis.remap("SS", [i, j])
+                        with Ts.sblock("B"):
+                            vi, vj = Ts.axis.remap("SS", [i, j])
                             B[vi, vj] = A[vi, vj] * 2.0
 
         """
@@ -1206,13 +1206,13 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_vectorize(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
 
         Create the schedule and do vectorize:
@@ -1227,14 +1227,14 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_vectorize(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i in T.serial(0, 128):
                     for j in T.vectorized(0, 128):
-                        with T.sblock("B"):
-                            vi, vj = T.axis.remap("SS", [i, j])
+                        with Ts.sblock("B"):
+                            vi, vj = Ts.axis.remap("SS", [i, j])
                             B[vi, vj] = A[vi, vj] * 2.0
 
         """
@@ -1267,13 +1267,13 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_bind(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
 
         Create the schedule and do bind:
@@ -1289,14 +1289,14 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_bind(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i in T.thread_binding(0, 128, thread = "blockIdx.x"):
                     for j in T.thread_binding(0, 128, thread = "threadIdx.x"):
-                        with T.sblock("B"):
-                            vi, vj = T.axis.remap("SS", [i, j])
+                        with Ts.sblock("B"):
+                            vi, vj = Ts.axis.remap("SS", [i, j])
                             B[vi, vj] = A[vi, vj] * 2.0
 
         """
@@ -1318,13 +1318,13 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_unroll(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
 
         Create the schedule and do unroll:
@@ -1339,14 +1339,14 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_unroll(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i in T.unroll(0, 128):
                     for j in T.serial(0, 128):
-                        with T.sblock("B"):
-                            vi, vj = T.axis.remap("SS", [i, j])
+                        with Ts.sblock("B"):
+                            vi, vj = Ts.axis.remap("SS", [i, j])
                             B[vi, vj] = A[vi, vj] * 2.0
 
         """
@@ -1397,13 +1397,13 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_cache_read(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
 
         Create the schedule and cache_read:
@@ -1419,18 +1419,18 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_cache_read(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
-                A_local = T.sblock_alloc_buffer((128, 128), scope="local")
+                A_local = Ts.sblock_alloc_buffer((128, 128), scope="local")
                 for i, j in T.grid(128, 128):
-                    with T.sblock("A_local"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("A_local"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         A_local[vi, vj] = A[vi, vj]
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A_local[vi, vj] * 2.0
 
         """
@@ -1492,13 +1492,13 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_cache_write(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
 
         Create the schedule and cache_write:
@@ -1514,18 +1514,18 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_cache_write(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
-                B_local = T.sblock_alloc_buffer((128, 128), scope="local")
+                B_local = Ts.sblock_alloc_buffer((128, 128), scope="local")
                 for i, j in T.grid(128, 128):
-                    with T.sblock("A_local"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("A_local"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B_local[vi, vj] = A[vi, vj] * 2.0
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = B_local[vi, vj]
 
         """
@@ -1585,13 +1585,13 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_reindex_cache_read(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
 
         Create the schedule and reindex_cache_read:
@@ -1607,18 +1607,18 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_reindex_cache_read(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
-                A_local = T.sblock_alloc_buffer((128, 128), scope="local")
+                A_local = Ts.sblock_alloc_buffer((128, 128), scope="local")
                 for i, j in T.grid(128, 128):
-                    with T.sblock("A_local"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("A_local"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         A_local[vj, vi] = A[vi, vj]
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A_local[vj, vi] * 2.0
 
         See Also
@@ -1685,13 +1685,13 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_reindex_cache_write(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
 
         Create the schedule and reindex_cache_write:
@@ -1707,18 +1707,18 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_cache_write(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (64, 2, 128))
-                B_local = T.sblock_alloc_buffer((128, 128), scope="local")
+                B_local = Ts.sblock_alloc_buffer((128, 128), scope="local")
                 for i, j in T.grid(128, 128):
-                    with T.sblock("A_local"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("A_local"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B_local[vi % 2, vi // 2, vj] = A[vi, vj] * 2.0
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = B_local[vi % 2, vi // 2, vj]
 
         See Also
@@ -1777,12 +1777,12 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_cache_inplace(data_io: T.Buffer((64), "int32")):
                 for i0 in T.serial(1):
-                    with T.sblock("A"):
-                        T.reads(data_io[:64])
-                        T.writes(data_io[:64])
+                    with Ts.sblock("A"):
+                        Ts.reads(data_io[:64])
+                        Ts.writes(data_io[:64])
                         T.evaluate(T.call_extern("call_impl", data_io.data, dtype=""))
 
         Create the schedule and cache_inplace:
@@ -1798,25 +1798,25 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def cache_inplace(data_io: T.Buffer(64, "int32")) -> None:
-                data_io_local = T.sblock_alloc_buffer([64], dtype="int32", scope="local")
+                data_io_local = Ts.sblock_alloc_buffer([64], dtype="int32", scope="local")
                 for i0 in T.serial(1):
                     for ax0 in T.serial(64):
-                        with T.sblock("data_io_local"):
-                            v0 = T.axis.spatial(64, ax0)
-                            T.reads(data_io[v0])
-                            T.writes(data_io_local[v0])
+                        with Ts.sblock("data_io_local"):
+                            v0 = Ts.axis.spatial(64, ax0)
+                            Ts.reads(data_io[v0])
+                            Ts.writes(data_io_local[v0])
                             data_io_local[v0] = data_io[v0]
-                    with T.sblock("A"):
-                        T.reads(data_io_local[0 : 64])
-                        T.writes(data_io_local[0 : 64])
+                    with Ts.sblock("A"):
+                        Ts.reads(data_io_local[0 : 64])
+                        Ts.writes(data_io_local[0 : 64])
                         T.evaluate(T.call_extern("call_impl", data_io_local.data, dtype=""))
                     for ax0 in T.serial(64):
-                        with T.sblock("data_io_local"):
-                            v0 = T.axis.spatial(64, ax0)
-                            T.reads(data_io_local[v0])
-                            T.writes(data_io[v0])
+                        with Ts.sblock("data_io_local"):
+                            v0 = Ts.axis.spatial(64, ax0)
+                            Ts.reads(data_io_local[v0])
+                            Ts.writes(data_io[v0])
                             data_io[v0] = data_io_local[v0]
 
         """
@@ -1861,13 +1861,13 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def resize(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (1, 3, 40, 40))
                 B = T.match_buffer(b, (1, 3, 80, 80))
                 for i0, i1, i2, i3 in T.grid(1, 3, 80, 80):
-                    with T.sblock("A"):
-                        n, c, vi, vj = T.axis.remap("SSSS", [i0, i1, i2, i3])
+                    with Ts.sblock("A"):
+                        n, c, vi, vj = Ts.axis.remap("SSSS", [i0, i1, i2, i3])
                         B[n, c, vi, vj] = A[n, c, vi//4 + vj//4, vj//2]
 
         Create the schedule and cache_index:
@@ -1883,30 +1883,30 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def resize_cache_index(
                 A: T.Buffer((1, 3, 40, 40), "float32"), B: T.Buffer((1, 3, 80, 80), "float32")
             ) -> None:
-                index_var_0 = T.sblock_alloc_buffer([80, 80], dtype="int32", strides=[1])
-                index_var_1 = T.sblock_alloc_buffer([80], dtype="int32", strides=[1])
+                index_var_0 = Ts.sblock_alloc_buffer([80, 80], dtype="int32", strides=[1])
+                index_var_1 = Ts.sblock_alloc_buffer([80], dtype="int32", strides=[1])
                 for ax0, ax1 in T.grid(80, 80):
-                    with T.sblock("index_0"):
-                        v0 = T.axis.spatial(80, ax0)
-                        v1 = T.axis.spatial(80, ax1)
-                        T.reads()
-                        T.writes(index_var_0[v0, v1])
+                    with Ts.sblock("index_0"):
+                        v0 = Ts.axis.spatial(80, ax0)
+                        v1 = Ts.axis.spatial(80, ax1)
+                        Ts.reads()
+                        Ts.writes(index_var_0[v0, v1])
                         index_var_0[v0, v1] = v0 // 4 + v1 // 4
                 for ax0 in T.serial(80):
-                    with T.sblock("index_1"):
-                        v0 = T.axis.spatial(80, ax0)
-                        T.reads()
-                        T.writes(index_var_1[v0])
+                    with Ts.sblock("index_1"):
+                        v0 = Ts.axis.spatial(80, ax0)
+                        Ts.reads()
+                        Ts.writes(index_var_1[v0])
                         index_var_1[v0] = v0 // 2
                 for i0, i1, i2, i3 in T.grid(1, 3, 80, 80):
-                    with T.sblock("A"):
-                        n, c, vi, vj = T.axis.remap("SSSS", [i0, i1, i2, i3])
-                        T.reads(A[n, c, vi // 4 + vj // 4, vj // 2])
-                        T.writes(B[n, c, vi, vj])
+                    with Ts.sblock("A"):
+                        n, c, vi, vj = Ts.axis.remap("SSSS", [i0, i1, i2, i3])
+                        Ts.reads(A[n, c, vi // 4 + vj // 4, vj // 2])
+                        Ts.writes(B[n, c, vi, vj])
                         B[n, c, vi, vj] = A[n, c, index_var_0[vi, vj], index_var_1[vj]]
 
         """
@@ -1961,14 +1961,14 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_reindex(
                 A: T.Buffer((128, 128), "float32"),
                 B: T.Buffer((128, 128), "float32")
             ) -> None:
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vj, vi] * 2.0
 
         Create the schedule and do reindex:
@@ -1983,19 +1983,19 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_reindex(
                 A: T.Buffer((128, 128), "float32"),
                 B: T.Buffer((128, 128), "float32")
             ) -> None:
-                A_reindex = T.sblock_alloc_buffer((128, 128), "float32")
+                A_reindex = Ts.sblock_alloc_buffer((128, 128), "float32")
                 for i, j in T.grid(128, 128):
-                    with T.sblock("A_reindex"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("A_reindex"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         A_reindex[vi, vj] = A[vj, vi]
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A_reindex[vi, vj] * 2.0
 
         """
@@ -2075,18 +2075,18 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_compute_at(a: T.handle, c: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128), "float32")
-                B = T.sblock_alloc_buffer((128, 128), "float32")
+                B = Ts.sblock_alloc_buffer((128, 128), "float32")
                 C = T.match_buffer(c, (128, 128), "float32")
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
                 for i, j in T.grid(128, 128):
-                    with T.sblock("C"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("C"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         C[vi, vj] = B[vi, vj] + 1.0
 
         Create the schedule and do compute-at:
@@ -2103,19 +2103,19 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_compute_at(a: T.handle, c: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128), "float32")
-                B = T.sblock_alloc_buffer((128, 128), "float32")
+                B = Ts.sblock_alloc_buffer((128, 128), "float32")
                 C = T.match_buffer(c, (128, 128), "float32")
                 for i in T.serial(0, 128):
                     for j in T.serial(0, 128):
-                        with T.sblock("B"):
-                            vi, vj = T.axis.remap("SS", [i, j])
+                        with Ts.sblock("B"):
+                            vi, vj = Ts.axis.remap("SS", [i, j])
                             B[vi, vj] = A[vi, vj] * 2.0
                     for j in T.serial(0, 128):
-                        with T.sblock("C"):
-                            vi, vj = T.axis.remap("SS", [i, j])
+                        with Ts.sblock("C"):
+                            vi, vj = Ts.axis.remap("SS", [i, j])
                             C[vi, vj] = B[vi, vj] + 1.0
 
         """
@@ -2171,18 +2171,18 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_reverse_compute_at(a: T.handle, c: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128), "float32")
-                B = T.sblock_alloc_buffer((128, 128), "float32")
+                B = Ts.sblock_alloc_buffer((128, 128), "float32")
                 C = T.match_buffer(c, (128, 128), "float32")
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
                 for i, j in T.grid(128, 128):
-                    with T.sblock("C"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("C"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         C[vi, vj] = B[vi, vj] + 1.0
 
         Create the schedule and do reverse-compute-at:
@@ -2199,19 +2199,19 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_reverse_compute_at(a: T.handle, c: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128), "float32")
-                B = T.sblock_alloc_buffer((128, 128), "float32")
+                B = Ts.sblock_alloc_buffer((128, 128), "float32")
                 C = T.match_buffer(c, (128, 128), "float32")
                 for i in T.serial(0, 128):
                     for j in T.serial(0, 128):
-                        with T.sblock("B"):
-                            vi, vj = T.axis.remap("SS", [i, j])
+                        with Ts.sblock("B"):
+                            vi, vj = Ts.axis.remap("SS", [i, j])
                             B[vi, vj] = A[vi, vj] * 2.0
                     for j in T.serial(0, 128):
-                        with T.sblock("C"):
-                            vi, vj = T.axis.remap("SS", [i, j])
+                        with Ts.sblock("C"):
+                            vi, vj = Ts.axis.remap("SS", [i, j])
                             C[vi, vj] = B[vi, vj] + 1.0
 
         """
@@ -2247,18 +2247,18 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_inline(a: T.handle, c: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
-                B = T.sblock_alloc_buffer((128, 128))
+                B = Ts.sblock_alloc_buffer((128, 128))
                 C = T.match_buffer(c, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
                 for i, j in T.grid(128, 128):
-                    with T.sblock("C"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("C"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         C[vi, vj] = B[vi, vj] + 1.0
 
         Create the schedule and do compute-inline:
@@ -2273,13 +2273,13 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_inline(a: T.handle, c: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 C = T.match_buffer(c, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("C"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("C"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         C[vi, vj] = A[vi, vj] * 2.0 + 1.0
 
         """
@@ -2316,18 +2316,18 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_inline(a: T.handle, c: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
-                B = T.sblock_alloc_buffer((128, 128))
+                B = Ts.sblock_alloc_buffer((128, 128))
                 C = T.match_buffer(c, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
                 for i, j in T.grid(128, 128):
-                    with T.sblock("C"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("C"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         C[vi, vj] = B[vi, vj] + 1.0
 
         Create the schedule and do reverse-compute-inline:
@@ -2342,13 +2342,13 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_inline(a: T.handle, c: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 C = T.match_buffer(c, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("C"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("C"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         C[vi, vj] = A[vi, vj] * 2.0 + 1.0
 
         """
@@ -2449,14 +2449,15 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
-            def before_decompose(a: ty.handle, b: ty.handle, c: ty.handle) -> None:
-                A = tirx.match_buffer(a, [128, 128])
-                B = tirx.match_buffer(b, [128, 128])
-                C = tirx.match_buffer(c, [128, 128])
-                for i, j, k in tirx.grid(128, 128, 128):
-                    with tirx.block([128, 128, tirx.reduce_axis(0, 128)], "C") as [vi, vj, vk]:
-                        with tirx.init():
+            @Ts.prim_func
+            def before_decompose(a: T.handle, b: T.handle, c: T.handle) -> None:
+                A = T.match_buffer(a, [128, 128])
+                B = T.match_buffer(b, [128, 128])
+                C = T.match_buffer(c, [128, 128])
+                for i, j, k in T.grid(128, 128, 128):
+                    with Ts.sblock("C"):
+                        vi, vj, vk = Ts.axis.remap("SSR", [i, j, k])
+                        with Ts.init():
                             C[vi, vj] = 0.0
                         C[vi, vj] = C[vi, vj] + A[vi, vk] * B[vj, vk]
 
@@ -2474,7 +2475,7 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_decompose(a: ty.handle, b: ty.handle, c: ty.handle) -> None:
                 A = tirx.match_buffer(a, [128, 128])
                 B = tirx.match_buffer(b, [128, 128])
@@ -2573,14 +2574,14 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_rfactor(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128, 128))
                 B = T.match_buffer(b, (128,))
                 for ii, i, j in T.grid(128, 128, 128):
-                with T.sblock("B"):
-                    vii, vi, vj = T.axis.remap("SRR", [ii, i, j])
-                    with T.init():
+                with Ts.sblock("B"):
+                    vii, vi, vj = Ts.axis.remap("SRR", [ii, i, j])
+                    with Ts.init():
                         B[vii] = 0.0
                     B[vii] = B[vii] + A[vii, vi, vj]
 
@@ -2597,21 +2598,21 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_rfactor(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, [128, 128, 128])
                 B = T.match_buffer(b, [128])
-                B_rf = T.sblock_alloc_buffer([128, 128])
+                B_rf = Ts.sblock_alloc_buffer([128, 128])
                 for i2, ii, i in T.grid(128, 128, 128):
-                    with T.sblock("B_rf"):
-                        vi2, vii, vi = T.axis.remap("SSR", [i2, ii, i])
-                        with T.init():
+                    with Ts.sblock("B_rf"):
+                        vi2, vii, vi = Ts.axis.remap("SSR", [i2, ii, i])
+                        with Ts.init():
                             B_rf[vi2, vii] = 0.0
                         B_rf[vi2, vii] = (B_rf[vi2, vii] + A[vii, vi, vi2])
                 for ii, i2 in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vii, vi2 = T.axis.remap("SR", [ii, i2])
-                        with T.init():
+                    with Ts.sblock("B"):
+                        vii, vi2 = Ts.axis.remap("SR", [ii, i2])
+                        with Ts.init():
                             B[vii] = 0.0
                         B[vii] = B[vii] + B_rf[vi2, vii]
 
@@ -2673,18 +2674,18 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_storage_align(a: T.handle, c: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
-                B = T.sblock_alloc_buffer((128, 128))
+                B = Ts.sblock_alloc_buffer((128, 128))
                 C = T.match_buffer(c, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
                 for i, j in T.grid(128, 128):
-                    with T.sblock("C"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("C"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         C[vi, vj] = B[vi, vj] + 1.0
 
         Create the schedule and do storage_align:
@@ -2699,19 +2700,19 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_storage_align(a: T.handle, c: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
-                B = T.sblock_alloc_buffer((128, 128))
+                B = Ts.sblock_alloc_buffer((128, 128))
                 C = T.match_buffer(c, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        T.sblock_attr({"buffer_dim_align": [[[0, 128, 1]]]})
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        Ts.sblock_attr({"buffer_dim_align": [[[0, 128, 1]]]})
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
                 for i, j in T.grid(128, 128):
-                    with T.sblock("C"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("C"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         C[vi, vj] = B[vi, vj] + 1.0
 
         After lowering passes, buffer B will have strides as [129, 1].
@@ -2748,19 +2749,19 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_set_scope(
                 A: T.Buffer((128, 128), "float32"), C: T.Buffer((128, 128), "float32")
             ) -> None:
-                B = T.sblock_alloc_buffer((128, 128), dtype="float32")
+                B = Ts.sblock_alloc_buffer((128, 128), dtype="float32")
 
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
                 for i, j in T.grid(128, 128):
-                    with T.sblock("C"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("C"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         C[vi, vj] = B[vi, vj] + 1.0
 
         Create the schedule and do set_scope:
@@ -2775,19 +2776,19 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_set_scope(
                 A: T.Buffer((128, 128), "float32"), C: T.Buffer((128, 128), "float32")
             ) -> None:
-                B_shared = T.sblock_alloc_buffer([128, 128], dtype="float32", scope="shared")
+                B_shared = Ts.sblock_alloc_buffer([128, 128], dtype="float32", scope="shared")
 
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B_shared[vi, vj] = A[vi, vj] * T.float32(2)
                 for i, j in T.grid(128, 128):
-                    with T.sblock("C"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("C"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         C[vi, vj] = B_shared[vi, vj] + T.float32(1)
 
         Note
@@ -2827,19 +2828,19 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_set_dtype(
                 A: T.Buffer((128, 128), "float32"), C: T.Buffer((128, 128), "float32")
             ) -> None:
-                B = T.sblock_alloc_buffer((128, 128), dtype="float32")
+                B = Ts.sblock_alloc_buffer((128, 128), dtype="float32")
 
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
                 for i, j in T.grid(128, 128):
-                    with T.sblock("C"):
-                        vi, vj = T.axis.remap("SS", [i, j]
+                    with Ts.sblock("C"):
+                        vi, vj = Ts.axis.remap("SS", [i, j]
                         C[vi, vj] = B[vi, vj] + 1.0
 
         Create the schedule and do unsafe_set_dtype:
@@ -2854,19 +2855,19 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_set_dtype(
                 A: T.Buffer((128, 128), "float32"), C: T.Buffer((128, 128), "float32")
             ) -> None:
-                B = T.sblock_alloc_buffer((128, 128), dtype="float16")
+                B = Ts.sblock_alloc_buffer((128, 128), dtype="float16")
 
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = T.cast(A[vi, vj] * 2.0, "float16")
                 for i, j in T.grid(128, 128):
-                    with T.sblock("C"):
-                        vi, vj = T.axis.remap("SS", [i, j]
+                    with Ts.sblock("C"):
+                        vi, vj = Ts.axis.remap("SS", [i, j]
                         C[vi, vj] = T.cast(B[vi, vj], "float32") + 1.0
 
         Note
@@ -2906,17 +2907,17 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_blockize(
                 A: T.Buffer((128, 128), "float32"),
                 B: T.Buffer((128, 128), "float32")
             ) -> None:
                 for i_0, j_0, i_1, j_1 in T.grid(8, 8, 16, 16):
-                    with T.sblock("B"):
-                        vi = T.axis.spatial(128, i_0 * 16 + i_1)
-                        vj = T.axis.spatial(128, j_0 * 16 + j_1)
-                        T.reads(A[vi, vj])
-                        T.writes(B[vi, vj])
+                    with Ts.sblock("B"):
+                        vi = Ts.axis.spatial(128, i_0 * 16 + i_1)
+                        vj = Ts.axis.spatial(128, j_0 * 16 + j_1)
+                        Ts.reads(A[vi, vj])
+                        Ts.writes(B[vi, vj])
                         B[vi, vj] = A[vi, vj] * T.float32(2)
 
         Create the schedule and do set_scope:
@@ -2933,21 +2934,21 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_blockize(
                 A: T.Buffer((128, 128), "float32"),
                 B: T.Buffer((128, 128), "float32")
             )-> None:
                 for i_0, j_0 in T.grid(8, 8):
-                    with T.sblock("B_o"):
-                        vio, vjo = T.axis.remap("SS", [i_0, j_0])
-                        T.reads(A[vio * 16 : vio * 16 + 16, vjo * 16 : vjo * 16 + 16])
-                        T.writes(B[vio * 16 : vio * 16 + 16, vjo * 16 : vjo * 16 + 16])
+                    with Ts.sblock("B_o"):
+                        vio, vjo = Ts.axis.remap("SS", [i_0, j_0])
+                        Ts.reads(A[vio * 16 : vio * 16 + 16, vjo * 16 : vjo * 16 + 16])
+                        Ts.writes(B[vio * 16 : vio * 16 + 16, vjo * 16 : vjo * 16 + 16])
                         for i_1, j_1 in T.grid(16, 16):
-                            with T.sblock("B"):
-                                vi, vj = T.axis.remap("SS", [i_1, j_1])
-                                T.reads(A[vio * 16 + vi, vjo * 16 + vj])
-                                T.writes(B[vio * 16 + vi, vjo * 16 + vj])
+                            with Ts.sblock("B"):
+                                vi, vj = Ts.axis.remap("SS", [i_1, j_1])
+                                Ts.reads(A[vio * 16 + vi, vjo * 16 + vj])
+                                Ts.writes(B[vio * 16 + vi, vjo * 16 + vj])
                                 B[vio * 16 + vi, vjo * 16 + vj] = A[vio * 16 + vi, vjo * 16 + vj] \
                                                                   * T.float32(2)
 
@@ -2985,51 +2986,51 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_tensorize(
                 A: T.Buffer((128, 128), "float32"),
                 B: T.Buffer((128, 128), "float32"),
                 C: T.Buffer((128, 128), "float32"),
             ) -> None:
                 # body
-                # with T.sblock("root")
+                # with Ts.sblock("root")
                 for i_0, j_0, k_0, i_1, j_1, k_1 in T.grid(8, 8, 8, 16, 16, 16):
-                    with T.sblock("update"):
-                        vi = T.axis.spatial(128, i_0 * 16 + i_1)
-                        vj = T.axis.spatial(128, j_0 * 16 + j_1)
-                        vk = T.axis.reduce(128, k_0 * 16 + k_1)
-                        T.reads(C[vi, vj], A[vi, vk], B[vj, vk])
-                        T.writes(C[vi, vj])
+                    with Ts.sblock("update"):
+                        vi = Ts.axis.spatial(128, i_0 * 16 + i_1)
+                        vj = Ts.axis.spatial(128, j_0 * 16 + j_1)
+                        vk = Ts.axis.reduce(128, k_0 * 16 + k_1)
+                        Ts.reads(C[vi, vj], A[vi, vk], B[vj, vk])
+                        Ts.writes(C[vi, vj])
                         C[vi, vj] = C[vi, vj] + A[vi, vk] * B[vj, vk]
 
         Declare and register the tensor intrinsic:
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def mma_desc(a: T.handle, b: T.handle, c: T.handle) -> None:
                 A = T.match_buffer(a, (16, 16), align=128, offset_factor=1)
                 B = T.match_buffer(b, (16, 16), align=128, offset_factor=1)
                 C = T.match_buffer(c, (16, 16), align=128, offset_factor=1)
 
-                with T.sblock("root"):
-                    T.reads(C[0 : 16, 0 : 16], A[0 : 16, 0 : 16], B[0 : 16, 0 : 16])
-                    T.writes(C[0 : 16, 0 : 16])
+                with Ts.sblock("root"):
+                    Ts.reads(C[0 : 16, 0 : 16], A[0 : 16, 0 : 16], B[0 : 16, 0 : 16])
+                    Ts.writes(C[0 : 16, 0 : 16])
                     for i, j, k in T.grid(16, 16, 16):
-                        with T.sblock("update"):
-                            vi, vj, vk = T.axis.remap("SSR", [i, j, k])
+                        with Ts.sblock("update"):
+                            vi, vj, vk = Ts.axis.remap("SSR", [i, j, k])
                             C[vi, vj] = C[vi, vj] + A[vi, vk] * B[vj, vk]
 
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def mma_intrin(a: T.handle, b: T.handle, c: T.handle) -> None:
                 A = T.match_buffer(a, (16, 16), align=128, offset_factor=1)
                 B = T.match_buffer(b, (16, 16), align=128, offset_factor=1)
                 C = T.match_buffer(c, (16, 16), align=128, offset_factor=1)
 
-                with T.sblock("root"):
-                    T.reads(C[0 : 16, 0 : 16], A[0 : 16, 0 : 16], B[0 : 16, 0 : 16])
-                    T.writes(C[0 : 16, 0 : 16])
+                with Ts.sblock("root"):
+                    Ts.reads(C[0 : 16, 0 : 16], A[0 : 16, 0 : 16], B[0 : 16, 0 : 16])
+                    Ts.writes(C[0 : 16, 0 : 16])
                     T.evaluate(
                         T.tvm_mma_sync(
                             C.data,
@@ -3060,23 +3061,23 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_tensorize(
                 A: T.Buffer((128, 128), "float32"),
                 B: T.Buffer((128, 128), "float32"),
                 C: T.Buffer((128, 128), "float32"),
             ) -> None:
                 # body
-                # with T.sblock("root")
+                # with Ts.sblock("root")
                 for i_0, j_0, k_0 in T.grid(8, 8, 8):
-                    with T.sblock("update_o"):
-                        vio, vjo, vko = T.axis.remap("SSR", [i_0, j_0, k_0])
-                        T.reads(
+                    with Ts.sblock("update_o"):
+                        vio, vjo, vko = Ts.axis.remap("SSR", [i_0, j_0, k_0])
+                        Ts.reads(
                             C[vio * 16 : vio * 16 + 16, vjo * 16 : vjo * 16 + 16],
                             A[vio * 16 : vio * 16 + 16, vko * 16 : vko * 16 + 16],
                             B[vjo * 16 : vjo * 16 + 16, vko * 16 : vko * 16 + 16],
                         )
-                        T.writes(C[vio * 16 : vio * 16 + 16, vjo * 16 : vjo * 16 + 16])
+                        Ts.writes(C[vio * 16 : vio * 16 + 16, vjo * 16 : vjo * 16 + 16])
                         A_1 = T.match_buffer(
                             A[vio * 16 : vio * 16 + 16, vko * 16 : vko * 16 + 16],
                             [16, 16],
@@ -3144,13 +3145,13 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_annotate(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
 
         Create the schedule and do annotate:
@@ -3165,14 +3166,14 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_annotate(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
-                        T.sblock_attr({"ann_key", "ann_value"})
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
+                        Ts.sblock_attr({"ann_key", "ann_value"})
                         B[vi, vj] = A[vi, vj] * 2.0
 
         """
@@ -3198,14 +3199,14 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_unannotate(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
-                        T.sblock_attr({"ann_key", "ann_value"})
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
+                        Ts.sblock_attr({"ann_key", "ann_value"})
                         B[vi, vj] = A[vi, vj] * 2.0
 
         Create the schedule and do annotate:
@@ -3220,13 +3221,13 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_unannotate(a: T.handle, b: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128))
                 B = T.match_buffer(b, (128, 128))
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
 
         """
@@ -3393,18 +3394,18 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_transform_layout(a: T.handle, c: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128), "float32")
-                B = T.sblock_alloc_buffer((128, 128), "float32")
+                B = Ts.sblock_alloc_buffer((128, 128), "float32")
                 C = T.match_buffer(c, (128, 128), "float32")
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
                 for i, j in T.grid(128, 128):
-                    with T.sblock("C"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("C"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         C[vi, vj] = B[vi, vj] + 1.0
 
         Create the schedule and do transform_layout:
@@ -3420,18 +3421,18 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def two_elementwise_transformed_intermediate_buffer(a: T.handle, c: T.handle) -> None:
                 A = T.match_buffer(a, (128, 128), "float32")
-                B = T.sblock_alloc_buffer((8, 8, 16, 16), "float32")
+                B = Ts.sblock_alloc_buffer((8, 8, 16, 16), "float32")
                 C = T.match_buffer(c, (128, 128), "float32")
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi // 16, vj // 16, vi % 16, vj % 16] = A[vi, vj] * 2.0
                 for i, j in T.grid(128, 128):
-                    with T.sblock("C"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("C"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         C[vi, vj] = B[vi // 16, vj // 16, vi % 16, vj % 16] + 1.0
 
         """
@@ -3503,14 +3504,14 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_transform_block_layout(
                 A: T.Buffer((16, 16), "float32"),
                 B: T.Buffer((16, 16), "float32")
             ) -> None:
                 for i, j in T.grid(16, 16):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
 
         Create the schedule and do transform_block_layout:
@@ -3525,14 +3526,14 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_transform_block_layout(
                 A: T.Buffer((16, 16), "float32"),
                 B: T.Buffer((16, 16), "float32")
             ) -> None:
                 for i in range(256):
-                    with T.sblock("B"):
-                        vi, = T.axis.remap("S", [i])
+                    with Ts.sblock("B"):
+                        vi, = Ts.axis.remap("S", [i])
                         B[vi // 16, vi % 16] = A[vi // 16, vi % 16] * 2.0
         """
         block = self._normalize_block_arg(block)
@@ -3582,11 +3583,11 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_decompose(x: T.Buffer(128, "int32"), y: T.Buffer(140, "int32")):
                 for i in range(140):
-                    with T.sblock("block"):
-                        vi = T.axis.remap("S", [i])
+                    with Ts.sblock("block"):
+                        vi = Ts.axis.remap("S", [i])
                         y[vi] = T.if_then_else(vi >= 6 and vi < 134, x[vi - 6], 0, dtype="int32")
 
         Create the schedule and do decompose-padding with specified loop:
@@ -3602,15 +3603,15 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_decompose(x: T.Buffer(128, "int32"), y: T.Buffer(140, "int32")):
                 for i in T.serial(140):
-                    with T.sblock("block_pad_const"):
-                        vi = T.axis.spatial(140, i)
+                    with Ts.sblock("block_pad_const"):
+                        vi = Ts.axis.spatial(140, i)
                         y[vi] = 0
                 for i in T.serial(128):
-                    with T.sblock("block"):
-                        vi = T.axis.spatial(128, i)
+                    with Ts.sblock("block"):
+                        vi = Ts.axis.spatial(128, i)
                         y[vi + 6] = x[vi]
         """
         block = self._normalize_block_arg(block)
@@ -3651,16 +3652,16 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_pad_einsum(
                 A: T.Buffer((127, 127), "float32"),
                 B: T.Buffer((127, 127), "float32"),
                 C: T.Buffer((127, 127), "float32"),
             ) -> None:
                 for i0, i1, i2 in T.grid(127, 127, 127):
-                    with T.sblock("C_shared"):
-                        i, j, k = T.axis.remap("SSR", [i0, i1, i2])
-                        with T.init():
+                    with Ts.sblock("C_shared"):
+                        i, j, k = Ts.axis.remap("SSR", [i0, i1, i2])
+                        with Ts.init():
                             C[i, j] = T.float32(0)
                         C[i, j] = C[i, j] + A[i, k] * B[k, j]
 
@@ -3677,41 +3678,41 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def main(
                 A: T.Buffer((127, 127), "float32"),
                 B: T.Buffer((127, 127), "float32"),
                 C: T.Buffer((127, 127), "float32"),
             ):
-                # with T.sblock("root"):
-                A_pad = T.sblock_alloc_buffer((128, 128))
-                B_pad = T.sblock_alloc_buffer((128, 128))
-                C_pad = T.sblock_alloc_buffer((128, 128))
+                # with Ts.sblock("root"):
+                A_pad = Ts.sblock_alloc_buffer((128, 128))
+                B_pad = Ts.sblock_alloc_buffer((128, 128))
+                C_pad = Ts.sblock_alloc_buffer((128, 128))
                 for i0, i1 in T.grid(128, 128):
-                    with T.sblock("A_pad"):
-                        v0, v1 = T.axis.remap("SS", [i0, i1])
+                    with Ts.sblock("A_pad"):
+                        v0, v1 = Ts.axis.remap("SS", [i0, i1])
                         A_pad[v0, v1] = T.if_then_else(
                             v0 < 127 and v1 < 127,
                             A[v0, v1],
                             T.float32(0),
                         )
                 for i0, i1 in T.grid(128, 128):
-                    with T.sblock("B_pad"):
-                        v0, v1 = T.axis.remap("SS", [i0, i1])
+                    with Ts.sblock("B_pad"):
+                        v0, v1 = Ts.axis.remap("SS", [i0, i1])
                         B_pad[v0, v1] = T.if_then_else(
                             v0 < 127 and v1 < 127,
                             B[v0, v1],
                             T.float32(0),
                         )
                 for i0, i1, i2 in T.grid(128, 128, 128):
-                    with T.sblock("C_shared"):
-                        i, j, k = T.axis.remap("SSR", [i0, i1, i2])
-                        with T.init():
+                    with Ts.sblock("C_shared"):
+                        i, j, k = Ts.axis.remap("SSR", [i0, i1, i2])
+                        with Ts.init():
                             C_pad[i, j] = T.float32(0)
                         C_pad[i, j] = C_pad[i, j] + A_pad[i, k] * B_pad[k, j]
                 for i0, i1 in T.grid(127, 127):
-                    with T.sblock("C_pad"):
-                        v0, v1 = T.axis.remap("SS", [i0, i1])
+                    with Ts.sblock("C_pad"):
+                        v0, v1 = Ts.axis.remap("SS", [i0, i1])
                         C[v0, v1] = C_pad[v0, v1]
 
         """
@@ -3754,27 +3755,27 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_rolling_buffer(
                 A: T.Buffer((12, 12), "int8"), C: T.Buffer((8, 8), "int8")
             ) -> None:
                 # body
-                # with T.sblock("root")
-                B = T.sblock_alloc_buffer([10, 10], dtype="int8")
+                # with Ts.sblock("root")
+                B = Ts.sblock_alloc_buffer([10, 10], dtype="int8")
                 for i0, i1 in T.grid(2, 2):
                     for ax0, ax1, ax2, ax3 in T.grid(6, 6, 3, 3):
-                        with T.sblock("B"):
-                            ax0_1 = T.axis.spatial(10, i0 * 4 + ax0)
-                            ax1_1 = T.axis.spatial(10, i1 * 4 + ax1)
-                            rv0, rv1 = T.axis.remap("RR", [ax2, ax3])
+                        with Ts.sblock("B"):
+                            ax0_1 = Ts.axis.spatial(10, i0 * 4 + ax0)
+                            ax1_1 = Ts.axis.spatial(10, i1 * 4 + ax1)
+                            rv0, rv1 = Ts.axis.remap("RR", [ax2, ax3])
                             B[ax0_1, ax1_1] = T.max(
                                 B[ax0_1, ax1_1], A[ax0_1 + rv0, ax1_1 + rv1]
                             )
                     for ax0, ax1, ax2, ax3 in T.grid(4, 4, 3, 3):
-                        with T.sblock("C"):
-                            ax0_1 = T.axis.spatial(8, i0 * 4 + ax0)
-                            ax1_1 = T.axis.spatial(8, i1 * 4 + ax1)
-                            rv0, rv1 = T.axis.remap("RR", [ax2, ax3])
+                        with Ts.sblock("C"):
+                            ax0_1 = Ts.axis.spatial(8, i0 * 4 + ax0)
+                            ax1_1 = Ts.axis.spatial(8, i1 * 4 + ax1)
+                            rv0, rv1 = Ts.axis.remap("RR", [ax2, ax3])
                             C[ax0_1, ax1_1] = T.max(
                                 C[ax0_1, ax1_1], B[ax0_1 + rv0, ax1_1 + rv1]
                             )
@@ -3791,29 +3792,29 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_rolling_buffer(
                 A: T.Buffer((12, 12), "int8"),
                 C: T.Buffer((8, 8), "int8")
             ) -> None:
                 # body
-                # with T.sblock("root")
-                B = T.sblock_alloc_buffer([6, 10], dtype="int8")
+                # with Ts.sblock("root")
+                B = Ts.sblock_alloc_buffer([6, 10], dtype="int8")
                 for i0, i1 in T.grid(2, 2):
                     for ax0, ax1, ax2, ax3 in T.grid(6, 6, 3, 3):
-                        with T.sblock("B"):
-                            T.where((i0 < 1 or 2 <= ax0) and (i1 < 1 or 2 <= ax1))
-                            ax0_1 = T.axis.spatial(10, i0 * 4 + ax0)
-                            ax1_1 = T.axis.spatial(10, i1 * 4 + ax1)
-                            rv0, rv1 = T.axis.remap("RR", [ax2, ax3])
+                        with Ts.sblock("B"):
+                            Ts.where((i0 < 1 or 2 <= ax0) and (i1 < 1 or 2 <= ax1))
+                            ax0_1 = Ts.axis.spatial(10, i0 * 4 + ax0)
+                            ax1_1 = Ts.axis.spatial(10, i1 * 4 + ax1)
+                            rv0, rv1 = Ts.axis.remap("RR", [ax2, ax3])
                             B[ax0_1 % 6, ax1_1] = T.max(
                                 B[ax0_1 % 6, ax1_1], A[ax0_1 + rv0, ax1_1 + rv1]
                             )
                     for ax0, ax1, ax2, ax3 in T.grid(4, 4, 3, 3):
-                        with T.sblock("C"):
-                            ax0_1 = T.axis.spatial(8, i0 * 4 + ax0)
-                            ax1_1 = T.axis.spatial(8, i1 * 4 + ax1)
-                            rv0, rv1 = T.axis.remap("RR", [ax2, ax3])
+                        with Ts.sblock("C"):
+                            ax0_1 = Ts.axis.spatial(8, i0 * 4 + ax0)
+                            ax1_1 = Ts.axis.spatial(8, i1 * 4 + ax1)
+                            rv0, rv1 = Ts.axis.remap("RR", [ax2, ax3])
                             C[ax0_1, ax1_1] = T.max(
                                 C[ax0_1, ax1_1], B[ax0_1 % 6 + rv0, ax1_1 + rv1]
                             )
@@ -3893,19 +3894,19 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def before_annotate_buffer_access(
                 A: T.Buffer((128, 128), "float32"),
                 C: T.Buffer((128, 128), "float32")
             ) -> None:
-                B = T.sblock_alloc_buffer((128, 128), "float32")
+                B = Ts.sblock_alloc_buffer((128, 128), "float32")
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         B[vi, vj] = A[vi, vj] * 2.0
                 for i, j in T.grid(128, 128):
-                    with T.sblock("C"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("C"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         C[vi, vj] = B[vi, vj] + 1.0
 
         Create the schedule and do annotate_buffer_access:
@@ -3922,22 +3923,22 @@ class Schedule(Object):
 
         .. code-block:: python
 
-            @T.prim_func(s_tir=True)
+            @Ts.prim_func
             def after_annotate_buffer_access(
                 A: T.Buffer((128, 128), "float32"),
                 C: T.Buffer((128, 128), "float32")
             ) -> None:
-                B = T.sblock_alloc_buffer((128, 128), "float32")
+                B = Ts.sblock_alloc_buffer((128, 128), "float32")
                 for i, j in T.grid(128, 128):
-                    with T.sblock("B"):
-                        vi, vj = T.axis.remap("SS", [i, j])
-                        T.reads(A[vi - 1:vi + 1, vj - 1:vj + 1])
-                        T.writes(B[vi, vj])
-                        T.sblock_attr({"explicit_read_region": 0})
+                    with Ts.sblock("B"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
+                        Ts.reads(A[vi - 1:vi + 1, vj - 1:vj + 1])
+                        Ts.writes(B[vi, vj])
+                        Ts.sblock_attr({"explicit_read_region": 0})
                         B[vi, vj] = A[vi, vj] * 2.0
                 for i, j in T.grid(128, 128):
-                    with T.sblock("C"):
-                        vi, vj = T.axis.remap("SS", [i, j])
+                    with Ts.sblock("C"):
+                        vi, vj = Ts.axis.remap("SS", [i, j])
                         C[vi, vj] = B[vi, vj] + 1.0
 
         This annotates the read region for buffer A (index 0) in block "B" to be
diff --git a/python/tvm/s_tir/script/__init__.py b/python/tvm/s_tir/script/__init__.py
new file mode 100644
index 0000000000..b6536aab80
--- /dev/null
+++ b/python/tvm/s_tir/script/__init__.py
@@ -0,0 +1,100 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""S-TIR construction namespace, exposed as ``tvm.script.s_tir``."""
+
+import importlib as _importlib
+import sys as _sys
+
+_initialized = False
+_initializing = False
+
+
+def _initialize():
+    global _initialized, _initializing
+    if _initialized or _initializing:
+        return
+    _initializing = True
+    try:
+        from tvm.script.parser import entry, protocol_registry, register_namespace
+        from tvm.tirx import script as shared
+
+        from . import ir_builder as builder
+
+        shared._initialize()
+        globals().update(
+            (name, getattr(shared, name))
+            for name in shared.__all__
+            if name not in ("builder", "ir_builder", "jit")
+        )
+        for name in (
+            "function_",
+            "arg",
+            "bind_",
+            "check_well_formed_",
+            "sblock",
+            "init",
+            "where",
+            "reads",
+            "writes",
+            "sblock_attr",
+            "sblock_alloc_buffer",
+            "axis",
+            "block_name_suffix_context",
+        ):
+            globals()[name] = getattr(builder, name)
+        # The operations are shared, but syntax is keyed by the registered namespace.
+        for table in (
+            protocol_registry.ARGS_POLICIES,
+            protocol_registry.TYPE_VAR_DECL,
+            protocol_registry.MUTABLE_CELL_DECL,
+            protocol_registry.RESULT_SPAN,
+        ):
+            table.update(
+                {
+                    "Ts." + key[2:]: value
+                    for key, value in list(table.items())
+                    if key.startswith("T.")
+                }
+            )
+        globals().update(
+            prim_func=protocol_registry.declaration_kind("Ts.prim_func", "function")(
+                entry.make_decorator(builder)
+            ),
+            inline=protocol_registry.declaration_kind("Ts.inline", "helper")(
+                entry.make_macro_decorator(builder, preserve_return=True, late_binding=True)
+            ),
+            macro=protocol_registry.declaration_kind("Ts.macro", "helper")(
+                entry.make_macro_decorator(builder, preserve_return=False)
+            ),
+        )
+        for alias in ("Ts", "s_tir"):
+            register_namespace(alias, _sys.modules[__name__])
+        globals()["__all__"] = sorted(name for name in globals() if not name.startswith("_"))
+        _initialized = True
+    finally:
+        _initializing = False
+
+
+def __getattr__(name):
+    if name == "ir_builder":
+        return _importlib.import_module(__name__ + ".ir_builder")
+    if name.startswith("_") and name != "__all__":
+        raise AttributeError(name)
+    _initialize()
+    if name in globals():
+        return globals()[name]
+    raise AttributeError(name)
diff --git a/python/tvm/s_tir/script/ir_builder/__init__.py b/python/tvm/s_tir/script/ir_builder/__init__.py
new file mode 100644
index 0000000000..36bc68531b
--- /dev/null
+++ b/python/tvm/s_tir/script/ir_builder/__init__.py
@@ -0,0 +1,103 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""S-TIR construction reuses common TIRx operations with its own frames."""
+
+from tvm import ir as _ir
+from tvm import tirx as _tir
+from tvm.script.ir_builder import base as _base
+from tvm.tirx.script.ir_builder import *
+from tvm.tirx.script.ir_builder import _native
+from tvm.tirx.script.ir_builder import arg as _shared_arg
+from tvm.tirx.script.ir_builder import bind_ as _shared_bind
+
+from . import _ffi_api
+from .frame import PrimFuncFrame as _PrimFuncFrame
+from .frame import SBlockFrame as _SBlockFrame
+from .ir import (
+    axis,
+    block_name_suffix_context,
+    init,
+    reads,
+    sblock,
+    sblock_alloc_buffer,
+    sblock_attr,
+    where,
+    writes,
+)
+
+
+def prim_func(is_private=False, persistent=False, *, private=None):
+    """Create an S-TIR function frame."""
+    return _ffi_api.PrimFunc(is_private if private is None else private, persistent)
+
+
+def function_(*, private=False, persistent=False, decl=False, span=None):
+    """Enter an S-TIR declaration or definition frame."""
+    native = _ffi_api.DeclFunction(private, persistent) if decl else prim_func(private, persistent)
+    return _base.at_(span, native)
+
+
+def arg(name, annotation, *, span=None):
+    """Normalize eagerly constructed parameter buffers for S-TIR."""
+    if _tir.is_buffer_var(annotation) and annotation.ty.layout is not None:
+        ty = annotation.ty
+        annotation = _native.buffer(
+            ty.shape,
+            ty.dtype,
+            strides=ty.strides,
+            elem_offset=ty.elem_offset,
+            scope=ty.storage_scope,
+            align=ty.data_alignment,
+            offset_factor=ty.offset_factor,
+            layout=None,
+            allocated_addr=list(ty.allocated_addr),
+            buffer_name=name,
+        )
+    return _shared_arg(name, annotation, span=span)
+
+
+def bind_(value=_base.MISSING, **options):
+    """Block frames cannot introduce an as-target value."""
+    if options.get("frame_value") and isinstance(value, _SBlockFrame):
+        raise TypeError("A block does not introduce an as-target value")
+    return _shared_bind(value, **options)
+
+
+def check_well_formed_(function):
+    """Validate a completed S-TIR function."""
+    from tvm.s_tir import analysis
+
+    try:
+        analysis.verify_well_formed(_ir.IRModule.from_expr(function))
+    except Exception as error:
+        raise ValueError(
+            "Program is not well-formed. If this is deliberate, set "
+            f"check_well_formed=False in the top-level decorator.\n{error}"
+        ) from error
+
+
+def _check_module_well_formed(module):
+    """Validate S-TIR functions independently of other module dialects."""
+    from tvm.s_tir import analysis
+
+    functions = {
+        gv: fn
+        for gv, fn in module.functions.items()
+        if isinstance(fn, _tir.PrimFunc) and fn.attrs.get("s_tir", False)
+    }
+    if functions:
+        analysis.verify_well_formed(_ir.IRModule(functions))
diff --git a/tests/python/runtime/test_runtime_extension.py b/python/tvm/s_tir/script/ir_builder/_ffi_api.py
similarity index 55%
copy from tests/python/runtime/test_runtime_extension.py
copy to python/tvm/s_tir/script/ir_builder/_ffi_api.py
index 4a6c317164..4947e0ccad 100644
--- a/tests/python/runtime/test_runtime_extension.py
+++ b/python/tvm/s_tir/script/ir_builder/_ffi_api.py
@@ -14,29 +14,8 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-import numpy as np
+"""S-TIR native construction APIs."""
 
-import tvm
-from tvm.script import ir as I
-from tvm.script import tirx as T
+import tvm_ffi
 
-
-def test_dltensor_compatible():
-    @I.ir_module
-    class Module:
-        @T.prim_func(s_tir=True)
-        def arange(A: T.handle):
-            n = T.int32()
-            Ab = T.match_buffer(A, (n,), "int64")
-            for i in T.serial(n - 1):
-                Ab[i + 1] = Ab[i] + T.int64(1)
-
-    mod = Module
-    f = tvm.compile(mod, target="llvm")
-    a = tvm.runtime.tensor(np.zeros(10, dtype="int64"))
-    f(a)
-    np.testing.assert_equal(a.numpy(), np.arange(a.shape[0]))
-
-
-if __name__ == "__main__":
-    test_dltensor_compatible()
+tvm_ffi.init_ffi_api("script.ir_builder.s_tir", __name__)
diff --git a/tests/python/runtime/test_runtime_extension.py b/python/tvm/s_tir/script/ir_builder/frame.py
similarity index 54%
copy from tests/python/runtime/test_runtime_extension.py
copy to python/tvm/s_tir/script/ir_builder/frame.py
index 4a6c317164..fdd8cd7b11 100644
--- a/tests/python/runtime/test_runtime_extension.py
+++ b/python/tvm/s_tir/script/ir_builder/frame.py
@@ -14,29 +14,26 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-import numpy as np
+"""S-TIR frames extend the common primitive construction stack."""
 
-import tvm
-from tvm.script import ir as I
-from tvm.script import tirx as T
+from tvm_ffi import register_object
 
+from tvm.tirx.script.ir_builder.frame import PrimFuncFrame as TIRxPrimFuncFrame
+from tvm.tirx.script.ir_builder.frame import TIRFrame
 
-def test_dltensor_compatible():
-    @I.ir_module
-    class Module:
-        @T.prim_func(s_tir=True)
-        def arange(A: T.handle):
-            n = T.int32()
-            Ab = T.match_buffer(A, (n,), "int64")
-            for i in T.serial(n - 1):
-                Ab[i + 1] = Ab[i] + T.int64(1)
 
-    mod = Module
-    f = tvm.compile(mod, target="llvm")
-    a = tvm.runtime.tensor(np.zeros(10, dtype="int64"))
-    f(a)
-    np.testing.assert_equal(a.numpy(), np.arange(a.shape[0]))
+@register_object("script.ir_builder.s_tir.PrimFuncFrame")
+class PrimFuncFrame(TIRxPrimFuncFrame):
+    def default_buffer_layout(self, shape, scope):
+        """S-TIR buffers carry no implicit layout."""
+        return None
 
 
-if __name__ == "__main__":
-    test_dltensor_compatible()
+@register_object("script.ir_builder.s_tir.SBlockFrame")
+class SBlockFrame(TIRFrame):
+    pass
+
+
+@register_object("script.ir_builder.s_tir.BlockInitFrame")
+class BlockInitFrame(TIRFrame):
+    pass
diff --git a/python/tvm/s_tir/script/ir_builder/ir.py b/python/tvm/s_tir/script/ir_builder/ir.py
new file mode 100644
index 0000000000..fa3dcdc183
--- /dev/null
+++ b/python/tvm/s_tir/script/ir_builder/ir.py
@@ -0,0 +1,407 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""S-TIR block construction over shared primitive operations."""
+
+import contextlib
+import threading
+from numbers import Integral
+from typing import Any
+
+from tvm import ir
+from tvm import tirx as tir
+from tvm.ir import TensorLoad, TensorRegion, is_prim_expr
+from tvm.tirx import Buffer, Expr, IntImm, Var
+from tvm.tirx.layout import Layout
+from tvm.tirx.script.ir_builder.ir import _get_layout, _record_meta_resource
+
+from . import _ffi_api
+from .frame import BlockInitFrame, SBlockFrame
+
+_block_name_suffix = threading.local()
+
+
+def _get_sblock_name_suffix() -> str:
+    """Get the current block name suffix for macro expansion."""
+    return getattr(_block_name_suffix, "value", "")
+
+
+@contextlib.contextmanager
+def block_name_suffix_context(block_suffix: str):
+    """Context manager to set block name suffix during macro expansion.
+
+    Parameters
+    ----------
+    block_suffix : str
+        The suffix to append to block names (e.g., "_1", "_2").
+
+    Yields
+    ------
+    None
+    """
+    old_suffix = getattr(_block_name_suffix, "value", "")
+    _block_name_suffix.value = block_suffix
+    try:
+        yield
+    finally:
+        _block_name_suffix.value = old_suffix
+
+
+def sblock(name: str = "", no_realize: bool = False, exec_scope: str = "") -> SBlockFrame:
+    """The sblock declaration statement.
+
+    Parameters
+    ----------
+    name : str
+        The name of the sblock.
+
+    no_realize : bool
+        The flag whether to construct SBlockRealize or SBlock.
+
+    exec_scope : str
+        The execution scope of the block.
+
+    Returns
+    -------
+    res : SBlockFrame
+        The SBlockFrame.
+    """
+    block_suffix = _get_sblock_name_suffix()
+    if block_suffix and name:
+        name = name + block_suffix
+    return _ffi_api.Block(name, no_realize, exec_scope)  # type: ignore[attr-defined] # pylint: disable=no-member
+
+
+def init() -> BlockInitFrame:
+    """The block initialization statement.
+
+    Returns
+    -------
+    res : BlockInitFrame
+        The BlockInitFrame.
+    """
+    return _ffi_api.Init()  # type: ignore[attr-defined] # pylint: disable=no-member
+
+
+def where(predicate: Expr | int) -> None:
+    """The block predicate statement.
+
+    Parameters
+    ----------
+    predicate : Union[Expr, Literal[0, 1]]
+        The predicate condition.
+    """
+    if isinstance(predicate, bool):
+        predicate = IntImm("bool", predicate)
+    if isinstance(predicate, int):
+        if predicate in [0, 1]:
+            predicate = IntImm("bool", predicate)
+        else:
+            raise ValueError(f"Invalid value for predicate: {predicate}")
+    _ffi_api.Where(predicate)  # type: ignore[attr-defined] # pylint: disable=no-member
+
+
+def reads(*buffer_slices: list[TensorRegion | TensorLoad]) -> None:
+    """The block buffer region reading statement.
+
+    Parameters
+    ----------
+    buffer_slices : List[Union[TensorRegion, TensorLoad]]
+        The array of buffer regions to read.
+    """
+    if len(buffer_slices) == 1:
+        if isinstance(buffer_slices[0], tuple):
+            buffer_slices = list(buffer_slices[0])
+        elif isinstance(buffer_slices[0], list):
+            buffer_slices = buffer_slices[0]  # type: ignore[assignment]
+        else:
+            buffer_slices = [buffer_slices[0]]
+    else:
+        buffer_slices = list(buffer_slices)  # type: ignore[assignment]
+    _ffi_api.Reads(buffer_slices)  # type: ignore[attr-defined] # pylint: disable=no-member
+
+
+def writes(*buffer_slices: list[TensorRegion | TensorLoad]) -> None:
+    """The block buffer region writing statement.
+
+    Parameters
+    ----------
+    buffer_slices : List[Union[TensorRegion, TensorLoad]]
+        The array of buffer regions to write.
+    """
+    if len(buffer_slices) == 1:
+        if isinstance(buffer_slices[0], tuple):
+            buffer_slices = list(buffer_slices[0])
+        elif isinstance(buffer_slices[0], list):
+            buffer_slices = buffer_slices[0]  # type: ignore[assignment]
+        else:
+            buffer_slices = [buffer_slices[0]]
+    else:
+        buffer_slices = list(buffer_slices)  # type: ignore[assignment]
+    _ffi_api.Writes(buffer_slices)  # type: ignore[attr-defined] # pylint: disable=no-member
+
+
+def sblock_attr(attrs: dict[str, Any]) -> None:
+    """The block annotation statement (for non-tirx SBlock usage).
+
+    Parameters
+    ----------
+    attrs : Dict[str, Any]
+        The annotation of the block.
+    """
+    return _ffi_api.BlockAttrs(attrs)  # type: ignore[attr-defined] # pylint: disable=no-member
+
+
+def sblock_alloc_buffer(
+    shape: list[Expr] | tuple[Expr] | Expr | Integral,
+    dtype: str = "float32",
+    data: Var = None,
+    strides: list[Expr] | None = None,
+    elem_offset: Expr = None,
+    scope: str = "global",
+    align: int = -1,
+    offset_factor: int = 0,
+    layout: str | Layout | None = "default",
+    allocated_addr: int | tuple[int, ...] | None = None,
+) -> Buffer:
+    """SBlock-level buffer allocation function.
+
+    Parameters
+    ----------
+    shape : Union[List[Expr], Tuple[Expr], Expr, Integral]
+        The type of the buffer prior to flattening.
+    dtype : str
+        The data type in the content of the buffer.
+    data : Var
+        The pointer to the head of the data.
+    strides : List[Expr]
+        The strides of each dimension.
+    elem_offset : Expr
+        The offset in terms of number of dtype elements (including lanes).
+    scope : str
+        The optional storage scope of buffer data pointer.
+    align : int
+        The alignment requirement of data pointer in bytes.
+    offset_factor : int
+        The factor of elem_offset field.
+    layout: Optional[Union[str, Layout]]
+        The layout of the buffer.
+
+    allocated_addr: Optional[Union[int, Tuple[int]]]
+        The address of the allocated buffer. Might be multi-dimensional.
+        There can be pooled storage scopes on some devices. For example,
+        the Trainium device has a pooled storage scope for the SRAN buffers. ("trn.sbuf")
+        CUDA has a pooled storage scope for the shared memory ("shared.dyn")
+
+    Returns
+    -------
+    res : Buffer
+        The allocated buffer.
+    """
+    shape = (shape,) if is_prim_expr(shape) or isinstance(shape, Integral) else shape
+    if strides is not None:
+        strides = [Var(s, "int64") if isinstance(s, str) else s for s in strides]
+    else:
+        strides = []
+    if allocated_addr is None:
+        allocated_addr = []
+    if not isinstance(allocated_addr, list | tuple):
+        allocated_addr = [allocated_addr]
+    buf = _ffi_api.SBlockAllocBuffer(  # type: ignore[attr-defined] # pylint: disable=no-member
+        shape,
+        dtype,
+        data,
+        strides,
+        elem_offset,
+        scope,
+        align,
+        offset_factor,
+        _get_layout(layout, shape, scope),
+        allocated_addr,
+    )
+    _record_meta_resource(buf, skip_frames=2)
+    return buf
+
+
+def _as_range(dom: ir.Range | list[Expr]) -> ir.Range:
+    """The range constructor.
+
+    Parameters
+    ----------
+    dom : Union[Range, List[Expr]]
+        The domain.
+
+    Returns
+    -------
+    res : Range
+        The Range.
+    """
+    if isinstance(dom, ir.Range):
+        return dom
+    if isinstance(dom, list | tuple):
+        from tvm.sym import Analyzer  # pylint: disable=import-outside-toplevel
+
+        extent = Analyzer().simplify(dom[1] - dom[0])
+        if isinstance(extent, tir.IntImm):
+            return ir.Range.from_min_extent(dom[0], extent)
+        return ir.Range(dom[0], dom[1])
+    if is_prim_expr(dom):
+        return ir.Range(IntImm(dom.ty, 0), dom)
+    return ir.Range(0, dom)
+
+
+class axis:  # pylint: disable=invalid-name
+    """The axis class"""
+
+    @staticmethod
+    def spatial(
+        dom: ir.Range | list[Expr] | tuple[Expr],
+        binding: Expr,
+        dtype: str = "int32",
+    ) -> Var:
+        """The spatial block axis defining function.
+
+        Parameters
+        ----------
+        dom : Union[Range, List[Expr], Tuple[Expr]]
+            The domain of the iteration variable.
+
+        binding : Expr
+            The binding value of the iteration variable.
+
+        dtype : str
+            The data type of the iteration variable.
+
+        Returns
+        -------
+        res : Var
+            The iteration variable.
+        """
+        return _ffi_api.AxisSpatial(  # type: ignore[attr-defined] # pylint: disable=no-member
+            _as_range(dom), binding, dtype
+        )
+
+    @staticmethod
+    def reduce(
+        dom: ir.Range | list[Expr] | tuple[Expr],
+        binding: Expr,
+        dtype: str = "int32",
+    ) -> Var:
+        """The reduced block axis defining function.
+
+        Parameters
+        ----------
+        dom : Union[Range, List[Expr], Tuple[Expr]]
+            The domain of the iteration variable.
+
+        binding : Expr
+            The binding value of the iteration variable.
+
+        dtype : str
+            The data type of the iteration variable.
+
+        Returns
+        -------
+        res : Var
+            The iteration variable.
+        """
+        return _ffi_api.AxisReduce(  # type: ignore[attr-defined] # pylint: disable=no-member
+            _as_range(dom), binding, dtype
+        )
+
+    @staticmethod
+    def scan(
+        dom: ir.Range | list[Expr] | tuple[Expr],
+        binding: Expr,
+        dtype: str = "int32",
+    ) -> Var:
+        """The scanning block axis defining function.
+
+        Parameters
+        ----------
+        dom : Union[Range, List[Expr], Tuple[Expr]]
+            The domain of the iteration variable.
+
+        binding : Expr
+            The binding value of the iteration variable.
+
+        dtype : str
+            The data type of the iteration variable.
+
+        Returns
+        -------
+        res : Var
+            The iteration variable.
+        """
+        return _ffi_api.AxisScan(  # type: ignore[attr-defined] # pylint: disable=no-member
+            _as_range(dom), binding, dtype
+        )
+
+    @staticmethod
+    def opaque(
+        dom: ir.Range | list[Expr] | tuple[Expr],
+        binding: Expr,
+        dtype: str = "int32",
+    ) -> Var:
+        """The opaque block axis defining function.
+
+        Parameters
+        ----------
+        dom : Union[Range, List[Expr], Tuple[Expr]]
+            The domain of the iteration variable.
+
+        binding : Expr
+            The binding value of the iteration variable.
+
+        dtype : str
+            The data type of the iteration variable.
+
+        Returns
+        -------
+        res : Var
+            The iteration variable.
+        """
+        return _ffi_api.AxisOpaque(  # type: ignore[attr-defined] # pylint: disable=no-member
+            _as_range(dom), binding, dtype
+        )
+
+    @staticmethod
+    def remap(kinds: str, bindings: list[Expr], dtype: str = "int32") -> list[Var] | Var:
+        """The block axis remapping function.
+
+        Parameters
+        ----------
+        kinds : str
+            The types of the iteration variables.
+
+        bindings : List[Expr]
+            The binding values of the iteration variables.
+
+        dtype : str
+            The data types of the iteration variables.
+
+        Returns
+        -------
+        res : Var
+            The iteration variables.
+        """
+        iter_vars = _ffi_api.AxisRemap(  # type: ignore[attr-defined] # pylint: disable=no-member
+            kinds, bindings, dtype
+        )
+        return iter_vars[0] if len(iter_vars) == 1 else iter_vars
+
+    S = spatial  # pylint: disable=invalid-name
+    R = reduce  # pylint: disable=invalid-name
diff --git a/python/tvm/s_tir/tensor_intrin/arm_cpu.py b/python/tvm/s_tir/tensor_intrin/arm_cpu.py
index 34472417f5..4c8fd04919 100644
--- a/python/tvm/s_tir/tensor_intrin/arm_cpu.py
+++ b/python/tvm/s_tir/tensor_intrin/arm_cpu.py
@@ -19,10 +19,11 @@
 """Intrinsics for ARM tensorization."""
 
 from tvm import tirx
+from tvm.s_tir.script.ir_builder import prim_func as build_prim_func
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 from tvm.script.ir_builder import IRBuilder
 from tvm.target.codegen import llvm_version_major
-from tvm.tirx.script.ir_builder import prim_func as build_prim_func
 
 from .. import TensorIntrin
 from .dot_product_common import (
@@ -36,31 +37,31 @@ from .dot_product_common import (
 # shape and dtype, and share the common description with x86.
 
 
-@T.prim_func(s_tir=True)
+@Ts.prim_func
 def neon_4x4_i8i8i32_desc(
     A: T.Buffer((4,), "int8", offset_factor=1),
     B: T.Buffer((4, 4), "int8", offset_factor=1),
     C: T.Buffer((4,), "int32", offset_factor=1),
 ) -> None:
-    with T.sblock("root"):
-        T.reads(C[0:4], A[0:4], B[0:4, 0:4])
-        T.writes(C[0:4])
+    with Ts.sblock("root"):
+        Ts.reads(C[0:4], A[0:4], B[0:4, 0:4])
+        Ts.writes(C[0:4])
         for i in T.serial(0, 4):
             for k in T.serial(0, 4):
-                with T.sblock("update"):
-                    vi, vk = T.axis.remap("SR", [i, k])
+                with Ts.sblock("update"):
+                    vi, vk = Ts.axis.remap("SR", [i, k])
                     C[vi] = C[vi] + T.cast(A[vk], "int32") * T.cast(B[vi, vk], "int32")
 
 
-@T.prim_func(s_tir=True)
+@Ts.prim_func
 def neon_4x4_i8i8i32_impl(
     A: T.Buffer((4,), "int8", offset_factor=1),
     B: T.Buffer((4, 4), "int8", offset_factor=1),
     C: T.Buffer((4,), "int32", offset_factor=1),
 ) -> None:
-    with T.sblock("root"):
-        T.reads(C[0:4], A[0:4], B[0:4, 0:4])
-        T.writes(C[0:4])
+    with Ts.sblock("root"):
+        Ts.reads(C[0:4], A[0:4], B[0:4, 0:4])
+        Ts.writes(C[0:4])
 
         A_int8 = A.vload([0], "int8x4")
         re_int32 = T.reinterpret(A_int8, dtype="int32")
@@ -118,30 +119,30 @@ def get_dotprod_intrin(in_dtype, out_dtype):
     out_dtype_x4 = f"{out_dtype}x4"
     in_dtype_x16 = f"{in_dtype}x16"
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def dot_prod_desc(a: T.handle, b: T.handle, c: T.handle) -> None:
         A = T.match_buffer(a, (4,), dtype=in_dtype, offset_factor=1)
         B = T.match_buffer(b, (4, 4), dtype=in_dtype, offset_factor=1)
         C = T.match_buffer(c, (4,), dtype=out_dtype, offset_factor=1)
-        with T.sblock("root"):
-            T.reads(C[0:4], A[0:4], B[0:4, 0:4])
-            T.writes(C[0:4])
+        with Ts.sblock("root"):
+            Ts.reads(C[0:4], A[0:4], B[0:4, 0:4])
+            Ts.writes(C[0:4])
             for i in T.serial(0, 4):
                 for k in T.serial(0, 4):
-                    with T.sblock("update"):
-                        vi, vk = T.axis.remap("SR", [i, k])
+                    with Ts.sblock("update"):
+                        vi, vk = Ts.axis.remap("SR", [i, k])
                         C[vi] = C[vi] + T.cast(A[vk], dtype=out_dtype) * T.cast(
                             B[vi, vk], dtype=out_dtype
                         )
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def dot_prod_impl(a: T.handle, b: T.handle, c: T.handle) -> None:
         A = T.match_buffer(a, (4,), dtype=in_dtype, offset_factor=1)
         B = T.match_buffer(b, (4, 4), dtype=in_dtype, offset_factor=1)
         C = T.match_buffer(c, (4,), dtype=out_dtype, offset_factor=1)
-        with T.sblock("root"):
-            T.reads(C[0:4], A[0:4], B[0:4, 0:4])
-            T.writes(C[0:4])
+        with Ts.sblock("root"):
+            Ts.reads(C[0:4], A[0:4], B[0:4, 0:4])
+            Ts.writes(C[0:4])
 
             A_i8x4 = A.vload([0], in_dtype_x4)
             A_i32 = T.reinterpret(A_i8x4, dtype=out_dtype)
@@ -256,16 +257,16 @@ def get_sme_transpose_interleave_2svlx2svl_fp32_intrin(cols, rows):
     SVF = tirx.get_vscale_expr("float32")
     SVF2 = 2 * SVF
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def desc(a: T.handle, a_t: T.handle) -> None:
         A = T.match_buffer(a, (SVF2, SVF2), dtype="float32", offset_factor=1)
         A_t = T.match_buffer(a_t, (SVF2, SVF2), dtype="float32", offset_factor=1)
-        with T.sblock("root"):
-            T.reads(A[0:SVF2, 0:SVF2])
-            T.writes(A_t[0:SVF2, 0:SVF2])
+        with Ts.sblock("root"):
+            Ts.reads(A[0:SVF2, 0:SVF2])
+            Ts.writes(A_t[0:SVF2, 0:SVF2])
             for k, m in T.grid(SVF2, SVF2):
-                with T.sblock("transpose"):
-                    v_m, v_k = T.axis.remap("SS", [m, k])
+                with Ts.sblock("transpose"):
+                    v_m, v_k = Ts.axis.remap("SS", [m, k])
                     A_t[v_k, v_m] = A[v_m, v_k]
 
     def impl():
@@ -287,9 +288,9 @@ def get_sme_transpose_interleave_2svlx2svl_fp32_intrin(cols, rows):
                     strides=[T.int32(), 1],
                 )
 
-                with T.sblock("root"):
-                    T.reads(A[0:SVF2, 0:SVF2])
-                    T.writes(A_t[0:SVF2, 0:SVF2])
+                with Ts.sblock("root"):
+                    Ts.reads(A[0:SVF2, 0:SVF2])
+                    Ts.writes(A_t[0:SVF2, 0:SVF2])
 
                     # Load rows of the input matrix
                     with T.serial(0, SVF) as slice_idx:
@@ -391,16 +392,16 @@ def get_sme_transpose_interleave_block2_2svl_fp16_intrin():
     SVF = tirx.get_vscale_expr("float16")
     SVF2 = 2 * SVF
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def desc(a: T.handle, a_t: T.handle) -> None:
         A = T.match_buffer(a, (SVF2, SVF), dtype="float16", offset_factor=1)
         A_t = T.match_buffer(a_t, (SVF, SVF2), dtype="float16", offset_factor=1)
-        with T.sblock("root"):
-            T.reads(A[0:SVF2, 0:SVF])
-            T.writes(A_t[0:SVF, 0:SVF2])
+        with Ts.sblock("root"):
+            Ts.reads(A[0:SVF2, 0:SVF])
+            Ts.writes(A_t[0:SVF, 0:SVF2])
             for k, m in T.grid(SVF, SVF2):
-                with T.sblock("transpose"):
-                    v_m, v_k = T.axis.remap("SS", [m, k])
+                with Ts.sblock("transpose"):
+                    v_m, v_k = Ts.axis.remap("SS", [m, k])
                     A_t[v_k, v_m] = A[v_m, v_k]
 
     def impl():
@@ -419,9 +420,9 @@ def get_sme_transpose_interleave_block2_2svl_fp16_intrin():
                 ptrue_fp16 = _create_ptrue_mask("float16")
                 ptrue_fp32 = _create_ptrue_mask("float32")
 
-                with T.sblock("root"):
-                    T.reads(A[0:SVF2, 0:SVF])
-                    T.writes(A_t[0:SVF, 0:SVF2])
+                with Ts.sblock("root"):
+                    Ts.reads(A[0:SVF2, 0:SVF])
+                    Ts.writes(A_t[0:SVF, 0:SVF2])
 
                     # Load rows of the input matrix
                     with T.serial(SVF // 2) as slice_idx:
@@ -595,18 +596,18 @@ def get_sme_gemm_interleaved_mopa_2svlx2svl_intrin(M, K, in_dtype):
         "llvm.aarch64.sme.mopa" if in_dtype == "float32" else "llvm.aarch64.sme.mopa.wide"
     )
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def desc(a: T.handle, b: T.handle, c: T.handle):
         A = T.match_buffer(a, (K, SVF2), dtype=in_dtype, offset_factor=1)
         B = T.match_buffer(b, (K, SVF2), dtype=in_dtype, offset_factor=1)
         C = T.match_buffer(c, (SVF2, SVF2), dtype="float32", offset_factor=1)
 
-        with T.sblock("root"):
-            T.reads(C[0:SVF2, 0:SVF2], A[0:K, 0:SVF2], B[0:K, 0:SVF2])
-            T.writes(C[0:SVF2, 0:SVF2])
+        with Ts.sblock("root"):
+            Ts.reads(C[0:SVF2, 0:SVF2], A[0:K, 0:SVF2], B[0:K, 0:SVF2])
+            Ts.writes(C[0:SVF2, 0:SVF2])
             for m, n, k in T.grid(SVF2, SVF2, K):
-                with T.sblock("gemm"):
-                    v_m, v_n, v_k = T.axis.remap("SSR", [m, n, k])
+                with Ts.sblock("gemm"):
+                    v_m, v_n, v_k = Ts.axis.remap("SSR", [m, n, k])
                     C[v_m, v_n] += T.Cast("float32", A[v_k, v_m]) * T.Cast("float32", B[v_k, v_n])
 
     def impl():
@@ -626,9 +627,9 @@ def get_sme_gemm_interleaved_mopa_2svlx2svl_intrin(M, K, in_dtype):
 
                 ptrue = _create_ptrue_mask(in_dtype)
 
-                with T.sblock("root"):
-                    T.reads(C[0:SVF2, 0:SVF2], A[0:K, 0:SVF2], B[0:K, 0:SVF2])
-                    T.writes(C[0:SVF2, 0:SVF2])
+                with Ts.sblock("root"):
+                    Ts.reads(C[0:SVF2, 0:SVF2], A[0:K, 0:SVF2], B[0:K, 0:SVF2])
+                    Ts.writes(C[0:SVF2, 0:SVF2])
 
                     # Iterate over the reduction axis applying outer product and accumulate
                     rows_per_iter = 1 if in_dtype == "float32" else 2
@@ -725,23 +726,23 @@ def get_sme_init_intrin():
     """
     SVF2 = 2 * 4 * T.vscale()
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def desc(c: T.handle) -> None:
         C = T.match_buffer(c, (SVF2, SVF2), "float32", offset_factor=1)
-        with T.sblock("root"):
-            T.reads()
-            T.writes(C[0:SVF2, 0:SVF2])
+        with Ts.sblock("root"):
+            Ts.reads()
+            Ts.writes(C[0:SVF2, 0:SVF2])
             for m, n in T.grid(SVF2, SVF2):
-                with T.sblock("init"):
-                    v_m, v_n = T.axis.remap("SS", [m, n])
+                with Ts.sblock("init"):
+                    v_m, v_n = Ts.axis.remap("SS", [m, n])
                     C[v_m, v_n] = T.float32(0)
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def impl(c: T.handle) -> None:
         C = T.match_buffer(c, (SVF2, SVF2), "float32", offset_factor=1)
-        with T.sblock("root"):
-            T.reads()
-            T.writes(C[0:SVF2, 0:SVF2])
+        with Ts.sblock("root"):
+            Ts.reads()
+            Ts.writes(C[0:SVF2, 0:SVF2])
             clear_all_tiles = T.int32(255)
             T.evaluate(T.call_llvm_intrin("void", "llvm.aarch64.sme.zero", clear_all_tiles))
 
diff --git a/python/tvm/s_tir/tensor_intrin/cuda.py b/python/tvm/s_tir/tensor_intrin/cuda.py
index a755c4c9da..629916b53d 100644
--- a/python/tvm/s_tir/tensor_intrin/cuda.py
+++ b/python/tvm/s_tir/tensor_intrin/cuda.py
@@ -24,6 +24,7 @@ from tvm_ffi import register_global_func
 
 from tvm.runtime import convert
 from tvm.s_tir import TensorIntrin
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 from tvm.tirx import Cast, IntImm
 from tvm.tirx.function import PrimFunc
@@ -149,7 +150,7 @@ def get_ldmatrix_intrin(
 
     offset_factor = smem_tile_col
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def ldmatrix_desc(warp_handle: T.handle, shared_handle: T.handle) -> None:
         shared = T.match_buffer(
             shared_handle,
@@ -168,20 +169,20 @@ def get_ldmatrix_intrin(
             scope="warp",
         )
 
-        with T.sblock("root"):
-            T.reads(shared[0:smem_tile_row, 0:smem_tile_col])
-            T.writes(warp[0:WARP_SIZE, 0:local_size])
+        with Ts.sblock("root"):
+            Ts.reads(shared[0:smem_tile_row, 0:smem_tile_col])
+            Ts.writes(warp[0:WARP_SIZE, 0:local_size])
 
             for ax0, ax1 in T.grid(smem_tile_row, smem_tile_col):
-                with T.sblock("shared_warp"):
-                    v0, v1 = T.axis.remap("SS", [ax0, ax1])
-                    T.reads(shared[v0, v1])
+                with Ts.sblock("shared_warp"):
+                    v0, v1 = Ts.axis.remap("SS", [ax0, ax1])
+                    Ts.reads(shared[v0, v1])
 
                     warp_indices = index_map(v0, v1)
-                    T.writes(warp[warp_indices[0], warp_indices[1]])
+                    Ts.writes(warp[warp_indices[0], warp_indices[1]])
                     warp[warp_indices[0], warp_indices[1]] = shared[v0, v1]
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def ldmatrix_impl(warp_handle: T.handle, shared_handle: T.handle) -> None:
         s0 = T.int32()
         s1 = T.int32()
@@ -203,9 +204,9 @@ def get_ldmatrix_intrin(
             scope="warp",
         )
 
-        with T.sblock("root"):
-            T.reads(shared[0:smem_tile_row, 0:smem_tile_col])
-            T.writes(warp[0:WARP_SIZE, 0:local_size])
+        with Ts.sblock("root"):
+            Ts.reads(shared[0:smem_tile_row, 0:smem_tile_col])
+            Ts.writes(warp[0:WARP_SIZE, 0:local_size])
             for tx in T.thread_binding(0, WARP_SIZE, "threadIdx.x"):
                 T.evaluate(
                     T.ptx_legacy.ldmatrix(
@@ -338,7 +339,7 @@ def get_mma_intrin(
     B_offset_factor = k_dim if b_transposed else N_DIM
     out_offset_factor = N_DIM
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mma_sync_desc(a: T.handle, b: T.handle, c: T.handle) -> None:
         A = T.match_buffer(
             a,
@@ -365,17 +366,17 @@ def get_mma_intrin(
             scope="warp",
         )
 
-        with T.sblock("root"):
-            T.reads(
+        with Ts.sblock("root"):
+            Ts.reads(
                 C[0:WARP_SIZE, 0:local_size_out],
                 A[0:WARP_SIZE, 0:local_size],
                 B[0:WARP_SIZE, 0:local_size],
             )
-            T.writes(C[0:WARP_SIZE, 0:local_size_out])
+            Ts.writes(C[0:WARP_SIZE, 0:local_size_out])
 
             for i, j, k in T.grid(M_DIM, N_DIM, k_dim):
-                with T.sblock("C"):
-                    vi, vj, vk = T.axis.remap("SSR", [i, j, k])
+                with Ts.sblock("C"):
+                    vi, vj, vk = Ts.axis.remap("SSR", [i, j, k])
                     a_indices = swap_if_flag(vi, vk, a_transposed)
                     b_indices = swap_if_flag(vk, vj, b_transposed)
 
@@ -383,18 +384,18 @@ def get_mma_intrin(
                     a_warp_indices = index_map_A(a_indices[0], a_indices[1])
                     b_warp_indices = index_map_B(b_indices[0], b_indices[1])
 
-                    T.reads(
+                    Ts.reads(
                         C[c_warp_indices[0], c_warp_indices[1]],
                         A[a_warp_indices[0], a_warp_indices[1]],
                         B[b_warp_indices[0], b_warp_indices[1]],
                     )
-                    T.writes(C[c_warp_indices[0], c_warp_indices[1]])
+                    Ts.writes(C[c_warp_indices[0], c_warp_indices[1]])
 
                     C[c_warp_indices[0], c_warp_indices[1]] += cast_to_out_dtype(
                         A[a_warp_indices[0], a_warp_indices[1]]
                     ) * cast_to_out_dtype(B[b_warp_indices[0], b_warp_indices[1]])
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mma_sync_impl(a: T.handle, b: T.handle, c: T.handle) -> None:
         A = T.match_buffer(
             a,
@@ -421,13 +422,13 @@ def get_mma_intrin(
             scope="warp",
         )
 
-        with T.sblock("root"):
-            T.reads(
+        with Ts.sblock("root"):
+            Ts.reads(
                 C[0:WARP_SIZE, 0:local_size_out],
                 A[0:WARP_SIZE, 0:local_size],
                 B[0:WARP_SIZE, 0:local_size],
             )
-            T.writes(C[0:WARP_SIZE, 0:local_size_out])
+            Ts.writes(C[0:WARP_SIZE, 0:local_size_out])
 
             for tx in T.thread_binding(0, WARP_SIZE, "threadIdx.x"):
                 T.evaluate(
@@ -554,30 +555,30 @@ def get_mma_fill_intrin(dtype, local_size):
     # Assume M = N = 16
     index_map = shared_16x16_to_ldmatrix_32x8_layout
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mma_fill_desc(a: T.handle) -> None:
         C_warp = T.match_buffer(a, [WARP_SIZE, local_size], dtype=dtype, scope="warp")
 
-        with T.sblock("root"):
-            T.reads()
-            T.writes(C_warp[0:WARP_SIZE, 0:local_size])
+        with Ts.sblock("root"):
+            Ts.reads()
+            Ts.writes(C_warp[0:WARP_SIZE, 0:local_size])
             for i0, i1 in T.grid(M_DIM, N_DIM):
-                with T.sblock("C_warp"):
-                    i, j = T.axis.remap("SS", [i0, i1])
+                with Ts.sblock("C_warp"):
+                    i, j = Ts.axis.remap("SS", [i0, i1])
                     warp_indices = index_map(i, j)
-                    T.reads()
-                    T.writes(C_warp[warp_indices[0], warp_indices[1]])
+                    Ts.reads()
+                    Ts.writes(C_warp[warp_indices[0], warp_indices[1]])
                     C_warp[warp_indices[0], warp_indices[1]] = zero
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mma_fill_impl(a: T.handle) -> None:
         C_warp = T.match_buffer(
             a, [WARP_SIZE, local_size], dtype=dtype, scope="warp", offset_factor=1
         )
 
-        with T.sblock("root"):
-            T.reads()
-            T.writes(C_warp[0:WARP_SIZE, 0:local_size])
+        with Ts.sblock("root"):
+            Ts.reads()
+            Ts.writes(C_warp[0:WARP_SIZE, 0:local_size])
 
             for tx in T.thread_binding(0, WARP_SIZE, "threadIdx.x"):
                 T.evaluate(
@@ -602,25 +603,25 @@ def get_mma_store_intrin(dtype, local_size, scope="global", use_mma_store_intrin
     index_map = shared_16x16_to_ldmatrix_32x8_layout
     index_map_rev = ldmatrix_32x8_to_shared_16x16_layout
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mma_store_desc(a: T.handle, c: T.handle) -> None:
         C_warp = T.match_buffer(a, [WARP_SIZE, local_size], dtype=dtype, scope="warp")
         C = T.match_buffer(c, [M_DIM, N_DIM], dtype=dtype, scope=scope)
 
-        with T.sblock("root"):
-            T.reads(C_warp[0:WARP_SIZE, 0:local_size])
-            T.writes(C[0:M_DIM, 0:N_DIM])
+        with Ts.sblock("root"):
+            Ts.reads(C_warp[0:WARP_SIZE, 0:local_size])
+            Ts.writes(C[0:M_DIM, 0:N_DIM])
             for i0, i1 in T.grid(M_DIM, N_DIM):
-                with T.sblock("C_warp"):
-                    v0, v1 = T.axis.remap("SS", [i0, i1])
+                with Ts.sblock("C_warp"):
+                    v0, v1 = Ts.axis.remap("SS", [i0, i1])
                     warp_indices = index_map(v0, v1)
-                    T.reads(C_warp[warp_indices[0], warp_indices[1]])
-                    T.writes(C[v0, v1])
+                    Ts.reads(C_warp[warp_indices[0], warp_indices[1]])
+                    Ts.writes(C[v0, v1])
                     C[v0, v1] = C_warp[warp_indices[0], warp_indices[1]]
 
     if use_mma_store_intrinic:
 
-        @T.prim_func(s_tir=True)
+        @Ts.prim_func
         def mma_store_impl(a: T.handle, c: T.handle) -> None:
             s0 = T.int32()
             s1 = T.int32()
@@ -632,9 +633,9 @@ def get_mma_store_intrin(dtype, local_size, scope="global", use_mma_store_intrin
                 c, [M_DIM, N_DIM], dtype=dtype, scope=scope, offset_factor=1, strides=[s0, s1]
             )
 
-            with T.sblock("root"):
-                T.reads(C_warp[0:WARP_SIZE, 0:local_size])
-                T.writes(C[0:M_DIM, 0:N_DIM])
+            with Ts.sblock("root"):
+                Ts.reads(C_warp[0:WARP_SIZE, 0:local_size])
+                Ts.writes(C[0:M_DIM, 0:N_DIM])
 
                 for tx in T.thread_binding(0, WARP_SIZE, "threadIdx.x"):
                     T.evaluate(
@@ -651,7 +652,7 @@ def get_mma_store_intrin(dtype, local_size, scope="global", use_mma_store_intrin
 
     else:
 
-        @T.prim_func(s_tir=True)
+        @Ts.prim_func
         def mma_store_impl(a: T.handle, c: T.handle) -> None:
             s0 = T.int32()
             s1 = T.int32()
@@ -663,9 +664,9 @@ def get_mma_store_intrin(dtype, local_size, scope="global", use_mma_store_intrin
                 c, [M_DIM, N_DIM], dtype=dtype, scope=scope, offset_factor=1, strides=[s0, s1]
             )
 
-            with T.sblock("root"):
-                T.reads(C_warp[0:WARP_SIZE, 0:local_size])
-                T.writes(C[0:M_DIM, 0:N_DIM])
+            with Ts.sblock("root"):
+                Ts.reads(C_warp[0:WARP_SIZE, 0:local_size])
+                Ts.writes(C[0:M_DIM, 0:N_DIM])
 
                 for tx in T.thread_binding(0, WARP_SIZE, "threadIdx.x"):
                     for local_id in T.serial(local_size):
@@ -835,7 +836,7 @@ def get_wmma_load_intrin(
         frag_m, frag_n = frag_n, frag_m
     offset_factor = frag_n
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def wmma_load_desc(a: T.handle, c: T.handle) -> None:
         A = T.match_buffer(
             a, (frag_m, frag_n), dtype, align=64, offset_factor=offset_factor, scope=shared_scope
@@ -848,15 +849,15 @@ def get_wmma_load_intrin(
             offset_factor=offset_factor,
             scope=wmma_fragment_scope,
         )
-        with T.sblock("root"):
-            T.reads(A[0:frag_m, 0:frag_n])
-            T.writes(C[0:frag_m, 0:frag_n])
+        with Ts.sblock("root"):
+            Ts.reads(A[0:frag_m, 0:frag_n])
+            Ts.writes(C[0:frag_m, 0:frag_n])
             for i, j in T.grid(frag_m, frag_n):
-                with T.sblock("load"):
-                    vii, vjj = T.axis.remap("SS", [i, j])
+                with Ts.sblock("load"):
+                    vii, vjj = Ts.axis.remap("SS", [i, j])
                     C[vii, vjj] = A[vii, vjj]
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def wmma_load_impl(a: T.handle, c: T.handle) -> None:
         s1 = T.int32()
         s0 = T.int32()
@@ -880,9 +881,9 @@ def get_wmma_load_intrin(
             scope=wmma_fragment_scope,
             strides=[d1, d0],
         )
-        with T.sblock("root"):
-            T.reads(A[0:frag_m, 0:frag_n])
-            T.writes(C[0:frag_m, 0:frag_n])
+        with Ts.sblock("root"):
+            Ts.reads(A[0:frag_m, 0:frag_n])
+            Ts.writes(C[0:frag_m, 0:frag_n])
             T.evaluate(
                 T.tvm_load_matrix_sync(
                     C.data,
@@ -907,7 +908,7 @@ def get_wmma_fill_intrin(
     zero = IntImm("int32", 0).astype(dtype)
     offset_factor = n_dim
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def wmma_fill_desc(c: T.handle) -> None:
         C = T.match_buffer(
             c,
@@ -917,15 +918,15 @@ def get_wmma_fill_intrin(
             offset_factor=offset_factor,
             scope="wmma.accumulator",
         )
-        with T.sblock("root"):
-            T.reads()
-            T.writes(C[0:m_dim, 0:n_dim])
+        with Ts.sblock("root"):
+            Ts.reads()
+            Ts.writes(C[0:m_dim, 0:n_dim])
             for i, j in T.grid(m_dim, n_dim):
-                with T.sblock("init"):
-                    vii, vjj = T.axis.remap("SS", [i, j])
+                with Ts.sblock("init"):
+                    vii, vjj = Ts.axis.remap("SS", [i, j])
                     C[vii, vjj] = zero
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def wmma_fill_impl(c: T.handle) -> None:
         d1 = T.int32()
         d0 = T.int32()
@@ -938,9 +939,9 @@ def get_wmma_fill_intrin(
             scope="wmma.accumulator",
             strides=[d1, d0],
         )
-        with T.sblock("root"):
-            T.reads()
-            T.writes(C[0:m_dim, 0:n_dim])
+        with Ts.sblock("root"):
+            Ts.reads()
+            Ts.writes(C[0:m_dim, 0:n_dim])
             T.evaluate(
                 T.tvm_fill_fragment(
                     C.data,
@@ -962,7 +963,7 @@ def get_wmma_store_intrin(
     """Generator of wmma_store intrins"""
     offset_factor = n_dim
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def wmma_store_desc(a: T.handle, c: T.handle) -> None:
         A = T.match_buffer(
             a,
@@ -975,15 +976,15 @@ def get_wmma_store_intrin(
         C = T.match_buffer(
             c, (m_dim, n_dim), dtype, align=64, offset_factor=offset_factor, scope=scope
         )
-        with T.sblock("root"):
-            T.reads(A[0:m_dim, 0:n_dim])
-            T.writes(C[0:m_dim, 0:n_dim])
+        with Ts.sblock("root"):
+            Ts.reads(A[0:m_dim, 0:n_dim])
+            Ts.writes(C[0:m_dim, 0:n_dim])
             for i, j in T.grid(m_dim, n_dim):
-                with T.sblock("store"):
-                    vii, vjj = T.axis.remap("SS", [i, j])
+                with Ts.sblock("store"):
+                    vii, vjj = Ts.axis.remap("SS", [i, j])
                     C[vii, vjj] = A[vii, vjj]
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def wmma_store_impl(a: T.handle, c: T.handle) -> None:
         s1 = T.int32()
         s0 = T.int32()
@@ -1007,9 +1008,9 @@ def get_wmma_store_intrin(
             scope=scope,
             strides=[s1, s0],
         )
-        with T.sblock("root"):
-            T.reads(A[0:m_dim, 0:n_dim])
-            T.writes(C[0:m_dim, 0:n_dim])
+        with Ts.sblock("root"):
+            Ts.reads(A[0:m_dim, 0:n_dim])
+            Ts.writes(C[0:m_dim, 0:n_dim])
             T.evaluate(
                 T.tvm_store_matrix_sync(
                     A.data,
@@ -1048,7 +1049,7 @@ def get_wmma_sync_intrin(
     B_offset_factor = b_shape_1
     out_offset_factor = n_dim
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def wmma_sync_desc(a: T.handle, b: T.handle, c: T.handle) -> None:
         A = T.match_buffer(
             a,
@@ -1075,18 +1076,18 @@ def get_wmma_sync_intrin(
             scope="wmma.accumulator",
         )
 
-        with T.sblock("root"):
-            T.reads(C[0:m_dim, 0:n_dim], A[0:m_dim, 0:k_dim], B[0:b_shape_0, 0:b_shape_1])
-            T.writes(C[0:m_dim, 0:n_dim])
+        with Ts.sblock("root"):
+            Ts.reads(C[0:m_dim, 0:n_dim], A[0:m_dim, 0:k_dim], B[0:b_shape_0, 0:b_shape_1])
+            Ts.writes(C[0:m_dim, 0:n_dim])
             for i, j, k in T.grid(m_dim, n_dim, k_dim):
-                with T.sblock(""):
-                    vii, vjj, vkk = T.axis.remap("SSR", [i, j, k])
+                with Ts.sblock(""):
+                    vii, vjj, vkk = Ts.axis.remap("SSR", [i, j, k])
                     b_indices = maybe_swap(vkk, vjj)
                     C[vii, vjj] = C[vii, vjj] + maybe_cast(A[vii, vkk]) * maybe_cast(
                         B[b_indices[0], b_indices[1]]
                     )
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def wmma_sync_impl(a: T.handle, b: T.handle, c: T.handle) -> None:
         a1 = T.int32()
         a0 = T.int32()
@@ -1123,9 +1124,9 @@ def get_wmma_sync_intrin(
             strides=[c1, c0],
         )
 
-        with T.sblock("root"):
-            T.reads(C[0:m_dim, 0:n_dim], A[0:m_dim, 0:k_dim], B[0:b_shape_0, 0:b_shape_1])
-            T.writes(C[0:m_dim, 0:n_dim])
+        with Ts.sblock("root"):
+            Ts.reads(C[0:m_dim, 0:n_dim], A[0:m_dim, 0:k_dim], B[0:b_shape_0, 0:b_shape_1])
+            Ts.writes(C[0:m_dim, 0:n_dim])
             T.evaluate(
                 T.tvm_mma_sync(
                     C.data,
@@ -1484,28 +1485,28 @@ def get_mma_init_intrin(
     assert dtype in ["float16", "float32"]
     assert n_dim // 4 * int(dtype[-2:]) <= 128, "n_dim vectorize failed"
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mma_init_desc(c: T.handle) -> None:
         dst = T.match_buffer(
             c, (m_dim, n_dim), dtype, align=64, offset_factor=1, scope="m16n8k8.matrixC"
         )
-        with T.sblock("root"):
-            T.reads()
-            T.writes(dst[0:m_dim, 0:n_dim])
+        with Ts.sblock("root"):
+            Ts.reads()
+            Ts.writes(dst[0:m_dim, 0:n_dim])
             for i, j in T.grid(m_dim, n_dim):
-                with T.sblock("init"):
-                    vi, vj = T.axis.remap("SS", [i, j])
+                with Ts.sblock("init"):
+                    vi, vj = Ts.axis.remap("SS", [i, j])
                     dst[vi, vj] = zero
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mma_init_impl(c: T.handle) -> None:
         dst = T.match_buffer(
             c, (m_dim, n_dim), dtype, align=64, offset_factor=1, scope="m16n8k8.matrixC"
         )
 
-        with T.sblock("root"):
-            T.reads()
-            T.writes(dst[0:m_dim, 0:n_dim])
+        with Ts.sblock("root"):
+            Ts.reads()
+            Ts.writes(dst[0:m_dim, 0:n_dim])
 
             for tx in T.thread_binding(0, WARP_SIZE, "threadIdx.x"):
                 for b in range(m_dim // 8):
@@ -1535,7 +1536,7 @@ def get_mma_load_intrin(
         (lambda tx, s0: (tx % 8) * s0 + (tx // 8) * 8) if trans else (lambda tx, s0: tx * s0)
     )
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mma_load_desc(a: T.handle, c: T.handle) -> None:
         src = T.match_buffer(
             a, (frag_m, frag_n), dtype, align=64, offset_factor=1, scope=shared_scope
@@ -1544,15 +1545,15 @@ def get_mma_load_intrin(
             c, (frag_m, frag_n), dtype, align=64, offset_factor=1, scope=mma_fragment_scope
         )
 
-        with T.sblock("root"):
-            T.reads(src[0:frag_m, 0:frag_n])
-            T.writes(dst[0:frag_m, 0:frag_n])
+        with Ts.sblock("root"):
+            Ts.reads(src[0:frag_m, 0:frag_n])
+            Ts.writes(dst[0:frag_m, 0:frag_n])
             for i, j in T.grid(frag_m, frag_n):
-                with T.sblock("root"):
-                    vi, vj = T.axis.remap("SS", [i, j])
+                with Ts.sblock("root"):
+                    vi, vj = Ts.axis.remap("SS", [i, j])
                     dst[vi, vj] = src[vi, vj]
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mma_load_impl(a: T.handle, c: T.handle) -> None:
         s0 = T.int32()
         s1 = T.int32()
@@ -1577,9 +1578,9 @@ def get_mma_load_intrin(
             strides=[d0, d1],
         )
 
-        with T.sblock("root"):
-            T.reads(src[0:frag_m, 0:frag_n])
-            T.writes(dst[0:frag_m, 0:frag_n])
+        with Ts.sblock("root"):
+            Ts.reads(src[0:frag_m, 0:frag_n])
+            Ts.writes(dst[0:frag_m, 0:frag_n])
 
             for tx in T.thread_binding(0, WARP_SIZE, "threadIdx.x"):
                 T.evaluate(
@@ -1615,7 +1616,7 @@ def get_mma_sync_intrin(
 
     B_shape_0, B_shape_1 = maybe_swap(k_dim, n_dim)
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mma_sync_desc(a: T.handle, b: T.handle, c: T.handle) -> None:
         A = T.match_buffer(
             a, (m_dim, k_dim), in_dtype, align=64, offset_factor=1, scope="m16n8k8.matrixA"
@@ -1627,18 +1628,18 @@ def get_mma_sync_intrin(
             c, (m_dim, n_dim), out_dtype, align=64, offset_factor=1, scope="m16n8k8.matrixC"
         )
 
-        with T.sblock("root"):
-            T.reads(C[0:m_dim, 0:n_dim], A[0:m_dim, 0:k_dim], B[0:B_shape_0, 0:B_shape_1])
-            T.writes(C[0:m_dim, 0:n_dim])
+        with Ts.sblock("root"):
+            Ts.reads(C[0:m_dim, 0:n_dim], A[0:m_dim, 0:k_dim], B[0:B_shape_0, 0:B_shape_1])
+            Ts.writes(C[0:m_dim, 0:n_dim])
             for i, j, k in T.grid(m_dim, n_dim, k_dim):
-                with T.sblock("m16n8k8_sync"):
-                    vi, vj, vk = T.axis.remap("SSR", [i, j, k])
+                with Ts.sblock("m16n8k8_sync"):
+                    vi, vj, vk = Ts.axis.remap("SSR", [i, j, k])
                     b_indices = maybe_swap(vk, vj)
                     C[vi, vj] = C[vi, vj] + maybe_cast(A[vi, vk]) * maybe_cast(
                         B[b_indices[0], b_indices[1]]
                     )
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mma_sync_impl(a: T.handle, b: T.handle, c: T.handle) -> None:
         a0 = T.int32()
         a1 = T.int32()
@@ -1674,9 +1675,9 @@ def get_mma_sync_intrin(
             strides=[c0, c1],
         )
 
-        with T.sblock("root"):
-            T.reads(C[0:m_dim, 0:n_dim], A[0:m_dim, 0:k_dim], B[0:B_shape_0, 0:B_shape_1])
-            T.writes(C[0:m_dim, 0:n_dim])
+        with Ts.sblock("root"):
+            Ts.reads(C[0:m_dim, 0:n_dim], A[0:m_dim, 0:k_dim], B[0:B_shape_0, 0:B_shape_1])
+            Ts.writes(C[0:m_dim, 0:n_dim])
             T.evaluate(
                 T.ptx_legacy.mma(
                     f"m{m_dim}n{n_dim}k{k_dim}",
@@ -1705,7 +1706,7 @@ def get_mma_store_dummy_intrin(
     """Disable mma store intrin for now."""
     del k_dim  # unused
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mma_store_desc(a: T.handle, c: T.handle) -> None:
         src = T.match_buffer(
             a, (m_dim, n_dim), dtype, align=64, offset_factor=1, scope="m16n8k8.matrixC"
@@ -1714,12 +1715,12 @@ def get_mma_store_dummy_intrin(
             c, (m_dim, n_dim), dtype, align=64, offset_factor=1, scope="shared.dyn"
         )
 
-        with T.sblock("root"):
-            T.reads(src[0:m_dim, 0:n_dim])
-            T.writes(dst[0:m_dim, 0:n_dim])
+        with Ts.sblock("root"):
+            Ts.reads(src[0:m_dim, 0:n_dim])
+            Ts.writes(dst[0:m_dim, 0:n_dim])
             for i, j in T.grid(m_dim, n_dim):
-                with T.sblock("m16n8k8_store"):
-                    vi, vj = T.axis.remap("SS", [i, j])
+                with Ts.sblock("m16n8k8_store"):
+                    vi, vj = Ts.axis.remap("SS", [i, j])
                     dst[vi, vj] = src[vi, vj]
 
     return mma_store_desc, mma_store_desc
diff --git a/python/tvm/s_tir/tensor_intrin/dot_product_common.py b/python/tvm/s_tir/tensor_intrin/dot_product_common.py
index 74b1acebf0..14513f8b4c 100644
--- a/python/tvm/s_tir/tensor_intrin/dot_product_common.py
+++ b/python/tvm/s_tir/tensor_intrin/dot_product_common.py
@@ -17,6 +17,7 @@
 # pylint: disable=invalid-name,missing-function-docstring
 """Dot product related intrinsics."""
 
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 
 from .. import TensorIntrin
@@ -28,29 +29,29 @@ def get_dp4a_intrin(dtype_a, dtype_b, dtype_c):
     vec_type_a = "int8x4" if dtype_a == "int8" else "uint8x4"
     vec_type_b = "int8x4" if dtype_b == "int8" else "uint8x4"
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def dp4a_desc(
         A: T.Buffer((4,), dtype_a, offset_factor=1, align=4, scope="shared"),
         B: T.Buffer((4,), dtype_b, offset_factor=1, align=4, scope="shared"),
         C: T.Buffer((1,), dtype_c, offset_factor=1, align=4, scope="local"),
     ) -> None:
-        with T.sblock("root"):
-            T.reads(C[0], A[0:4], B[0:4])
-            T.writes(C[0])
+        with Ts.sblock("root"):
+            Ts.reads(C[0], A[0:4], B[0:4])
+            Ts.writes(C[0])
             for i in range(0, 4):
-                with T.sblock("update"):
-                    vi = T.axis.remap("R", [i])
+                with Ts.sblock("update"):
+                    vi = Ts.axis.remap("R", [i])
                     C[0] = C[0] + T.cast(A[vi], dtype_c) * T.cast(B[vi], dtype_c)
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def dp4a_impl(
         A: T.Buffer((4,), dtype_a, offset_factor=1, align=4, scope="shared"),
         B: T.Buffer((4,), dtype_b, offset_factor=1, align=4, scope="shared"),
         C: T.Buffer((1,), dtype_c, offset_factor=1, align=4, scope="local"),
     ) -> None:
-        with T.sblock("root"):
-            T.reads(C[0], A[0:4], B[0:4])
-            T.writes(C[0])
+        with Ts.sblock("root"):
+            Ts.reads(C[0], A[0:4], B[0:4])
+            Ts.writes(C[0])
 
             C[0] += T.call_pure_extern(
                 "__dp4a",
diff --git a/python/tvm/s_tir/tensor_intrin/hexagon.py b/python/tvm/s_tir/tensor_intrin/hexagon.py
index d0eff7aa71..295d649145 100644
--- a/python/tvm/s_tir/tensor_intrin/hexagon.py
+++ b/python/tvm/s_tir/tensor_intrin/hexagon.py
@@ -17,6 +17,7 @@
 # pylint: disable=invalid-name,missing-function-docstring
 """Intrinsics for Hexagon tensorization."""
 
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 
 from .. import TensorIntrin
@@ -28,25 +29,25 @@ def generate_dma_load_intrin(
 ):
     """Generator of dma_load intrins"""
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def sync_dma_load_desc(a: T.handle, c: T.handle) -> None:
         A = T.match_buffer(a, (size), dtype, offset_factor=1, scope="global")
         C = T.match_buffer(c, (size), dtype, offset_factor=1, scope="global.vtcm")
-        with T.sblock("root"):
-            T.reads(A[0:size])
-            T.writes(C[0:size])
+        with Ts.sblock("root"):
+            Ts.reads(A[0:size])
+            Ts.writes(C[0:size])
             for i in T.serial(size):
-                with T.sblock("load"):
-                    vii = T.axis.remap("S", [i])
+                with Ts.sblock("load"):
+                    vii = Ts.axis.remap("S", [i])
                     C[vii] = A[vii]
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def sync_dma_load_impl(a: T.handle, c: T.handle) -> None:
         A = T.match_buffer(a, (size), dtype, offset_factor=1, scope="global")
         C = T.match_buffer(c, (size), dtype, offset_factor=1, scope="global.vtcm")
-        with T.sblock("root"):
-            T.reads(A[0:size])
-            T.writes(C[0:size])
+        with Ts.sblock("root"):
+            Ts.reads(A[0:size])
+            Ts.writes(C[0:size])
             T.evaluate(
                 T.tvm_call_packed(
                     "device_api.hexagon.dma_copy_dltensor",
@@ -78,28 +79,28 @@ def generate_dma_load_intrin(
 
 
 def generate_dot_product_32x4_u8u8i32(mem_scope="global"):
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def dot_product_32x4_u8u8i32_desc(a: T.handle, b: T.handle, c: T.handle) -> None:
         A = T.match_buffer(a, (4,), "uint8", offset_factor=1, scope=mem_scope)
         B = T.match_buffer(b, (32, 4), "uint8", offset_factor=1, scope=mem_scope)
         C = T.match_buffer(c, (32,), "int32", offset_factor=1, scope=mem_scope)
-        with T.sblock("root"):
-            T.reads(C[0:32], A[0:4], B[0:32, 0:4])
-            T.writes(C[0:32])
+        with Ts.sblock("root"):
+            Ts.reads(C[0:32], A[0:4], B[0:32, 0:4])
+            Ts.writes(C[0:32])
             for i in T.serial(0, 32):
                 for k in T.serial(0, 4):
-                    with T.sblock("update"):
-                        vi, vk = T.axis.remap("SR", [i, k])
+                    with Ts.sblock("update"):
+                        vi, vk = Ts.axis.remap("SR", [i, k])
                         C[vi] = C[vi] + T.cast(A[vk], "int32") * T.cast(B[vi, vk], "int32")
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def dot_product_32x4_u8u8i32_vrmpy(a: T.handle, b: T.handle, c: T.handle) -> None:
         A = T.match_buffer(a, (4,), "uint8", offset_factor=1, scope=mem_scope)
         B = T.match_buffer(b, (32, 4), "uint8", offset_factor=1, scope=mem_scope)
         C = T.match_buffer(c, (32,), "int32", offset_factor=1, scope=mem_scope)
-        with T.sblock("root"):
-            T.reads(C[0:32], A[0:4], B[0:32, 0:4])
-            T.writes(C[0:32])
+        with Ts.sblock("root"):
+            Ts.reads(C[0:32], A[0:4], B[0:32, 0:4])
+            Ts.writes(C[0:32])
 
             A_u8x4 = A.vload([0], "uint8x4")
             A_i32 = T.reinterpret(A_u8x4, dtype="int32")
@@ -119,28 +120,28 @@ def generate_dot_product_32x4_u8u8i32(mem_scope="global"):
 
 
 def generate_dot_product_32x4_u8i8i32(mem_scope="global"):
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def dot_product_32x4_u8i8i32_desc(a: T.handle, b: T.handle, c: T.handle) -> None:
         A = T.match_buffer(a, (4,), "uint8", offset_factor=1, scope=mem_scope)
         B = T.match_buffer(b, (32, 4), "int8", offset_factor=1, scope=mem_scope)
         C = T.match_buffer(c, (32,), "int32", offset_factor=1, scope=mem_scope)
-        with T.sblock("root"):
-            T.reads(C[0:32], A[0:4], B[0:32, 0:4])
-            T.writes(C[0:32])
+        with Ts.sblock("root"):
+            Ts.reads(C[0:32], A[0:4], B[0:32, 0:4])
+            Ts.writes(C[0:32])
             for i in T.serial(0, 32):
                 for k in T.serial(0, 4):
-                    with T.sblock("update"):
-                        vi, vk = T.axis.remap("SR", [i, k])
+                    with Ts.sblock("update"):
+                        vi, vk = Ts.axis.remap("SR", [i, k])
                         C[vi] = C[vi] + T.cast(A[vk], "int32") * T.cast(B[vi, vk], "int32")
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def dot_product_32x4_u8i8i32_vrmpy(a: T.handle, b: T.handle, c: T.handle) -> None:
         A = T.match_buffer(a, (4,), "uint8", offset_factor=1, scope=mem_scope)
         B = T.match_buffer(b, (32, 4), "int8", offset_factor=1, scope=mem_scope)
         C = T.match_buffer(c, (32,), "int32", offset_factor=1, scope=mem_scope)
-        with T.sblock("root"):
-            T.reads(C[0:32], A[0:4], B[0:32, 0:4])
-            T.writes(C[0:32])
+        with Ts.sblock("root"):
+            Ts.reads(C[0:32], A[0:4], B[0:32, 0:4])
+            Ts.writes(C[0:32])
 
             A_u8x4 = A.vload([0], "uint8x4")
             A_i32 = T.reinterpret(A_u8x4, dtype="int32")
@@ -160,28 +161,28 @@ def generate_dot_product_32x4_u8i8i32(mem_scope="global"):
 
 
 def generate_dot_product_32x2_i16i16i32(mem_scope="global"):
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def dot_product_32x2_i16i16i32_desc(a: T.handle, b: T.handle, c: T.handle) -> None:
         A = T.match_buffer(a, (2,), "int16", offset_factor=1, scope=mem_scope)
         B = T.match_buffer(b, (32, 2), "int16", offset_factor=1, scope=mem_scope)
         C = T.match_buffer(c, (32,), "int32", offset_factor=1, scope=mem_scope)
-        with T.sblock("root"):
-            T.reads(C[0:32], A[0:2], B[0:32, 0:2])
-            T.writes(C[0:32])
+        with Ts.sblock("root"):
+            Ts.reads(C[0:32], A[0:2], B[0:32, 0:2])
+            Ts.writes(C[0:32])
             for i in T.serial(0, 32):
                 for k in T.serial(0, 2):
-                    with T.sblock("update"):
-                        vi, vk = T.axis.remap("SR", [i, k])
+                    with Ts.sblock("update"):
+                        vi, vk = Ts.axis.remap("SR", [i, k])
                         C[vi] = C[vi] + T.cast(A[vk], "int32") * T.cast(B[vi, vk], "int32")
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def dot_product_32x2_i16i16i32_vdmpy(a: T.handle, b: T.handle, c: T.handle) -> None:
         A = T.match_buffer(a, (2,), "int16", offset_factor=1, scope=mem_scope)
         B = T.match_buffer(b, (32, 2), "int16", offset_factor=1, scope=mem_scope)
         C = T.match_buffer(c, (32,), "int32", offset_factor=1, scope=mem_scope)
-        with T.sblock("root"):
-            T.reads(C[0:32], A[0:2], B[0:32, 0:2])
-            T.writes(C[0:32])
+        with Ts.sblock("root"):
+            Ts.reads(C[0:32], A[0:2], B[0:32, 0:2])
+            Ts.writes(C[0:32])
 
             A_i16x2 = A.vload([0], "int16x2")
             A_i32 = T.reinterpret(A_i16x2, dtype="int32")
diff --git a/python/tvm/s_tir/tensor_intrin/metal.py b/python/tvm/s_tir/tensor_intrin/metal.py
index 8c63e9b46f..5eb328fb19 100644
--- a/python/tvm/s_tir/tensor_intrin/metal.py
+++ b/python/tvm/s_tir/tensor_intrin/metal.py
@@ -20,6 +20,7 @@
 from typing import Literal
 
 from tvm.s_tir import TensorIntrin
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 from tvm.tirx import Buffer, Expr, PrimFunc
 
@@ -41,26 +42,26 @@ def get_simdgroup_index(buffer: Buffer, stride: Expr, col: int, row: int):
 def get_make_filled_simdgroup_matrix_intrin(
     dtype: str, col: int = 8, row: int = 8
 ) -> tuple[PrimFunc, PrimFunc]:
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def desc(a: T.handle) -> None:
         A = T.match_buffer(a, (col, row), dtype, scope="metal.simdgroup", offset_factor=1)
-        with T.sblock("root"):
-            T.reads()
-            T.writes(A[0:col, 0:row])
+        with Ts.sblock("root"):
+            Ts.reads()
+            Ts.writes(A[0:col, 0:row])
             for i, j in T.grid(col, row):
-                with T.sblock("init"):
-                    vi, vj = T.axis.remap("SS", [i, j])
+                with Ts.sblock("init"):
+                    vi, vj = Ts.axis.remap("SS", [i, j])
                     A[vi, vj] = T.float32(0)
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def impl(a: T.handle) -> None:
         d0, d1 = T.int32(), T.int32()
         A = T.match_buffer(
             a, (col, row), dtype, scope="metal.simdgroup", strides=[d1, d0], offset_factor=1
         )
-        with T.sblock("root"):
-            T.reads()
-            T.writes(A[0:col, 0:row])
+        with Ts.sblock("root"):
+            Ts.reads()
+            Ts.writes(A[0:col, 0:row])
             T.metal.make_filled_simdgroup_matrix(
                 A.data,
                 index=get_simdgroup_index(A, d1, col, row),
@@ -81,25 +82,25 @@ def get_simdgroup_load_intrin(
 ) -> tuple[PrimFunc, PrimFunc]:
     align = col * row
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def desc(a: T.handle, c: T.handle) -> None:
         A = T.match_buffer(a, (col, row), dtype, align=align, scope=scope, offset_factor=1)
         C = T.match_buffer(
             c, (col, row), dtype, align=align, scope="metal.simdgroup", offset_factor=1
         )
-        with T.sblock("root"):
-            T.reads(A[0:col, 0:row])
-            T.writes(C[0:col, 0:row])
+        with Ts.sblock("root"):
+            Ts.reads(A[0:col, 0:row])
+            Ts.writes(C[0:col, 0:row])
             for i, j in T.grid(col, row):
-                with T.sblock("load"):
-                    vii, vjj = T.axis.remap("SS", [i, j])
+                with Ts.sblock("load"):
+                    vii, vjj = Ts.axis.remap("SS", [i, j])
                     if T.constexpr(transpose_matrix):
                         # C[vii, vjj] = A[vjj, vii]
                         C[vjj, vii] = A[vii, vjj]
                     else:
                         C[vii, vjj] = A[vii, vjj]
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def impl(a: T.handle, c: T.handle) -> None:
         s0, s1, d0, d1 = T.int32(), T.int32(), T.int32(), T.int32()
         A = T.match_buffer(
@@ -120,9 +121,9 @@ def get_simdgroup_load_intrin(
             strides=[d1, d0],
             offset_factor=1,
         )
-        with T.sblock("root"):
-            T.reads(A[0:col, 0:row])
-            T.writes(C[0:col, 0:row])
+        with Ts.sblock("root"):
+            Ts.reads(A[0:col, 0:row])
+            Ts.writes(C[0:col, 0:row])
             T.metal.simdgroup_load(
                 C.data,
                 index=get_simdgroup_index(C, d1, col, row),
@@ -145,24 +146,24 @@ def get_simdgroup_store_intrin(
 ) -> tuple[PrimFunc, PrimFunc]:
     align = col * row
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def desc(a: T.handle, c: T.handle) -> None:
         A = T.match_buffer(
             a, (col, row), dtype, align=align, scope="metal.simdgroup", offset_factor=1
         )
         C = T.match_buffer(c, (col, row), dtype, align=align, scope=scope, offset_factor=1)
-        with T.sblock("root"):
-            T.reads(A[0:col, 0:row])
-            T.writes(C[0:col, 0:row])
+        with Ts.sblock("root"):
+            Ts.reads(A[0:col, 0:row])
+            Ts.writes(C[0:col, 0:row])
             for i, j in T.grid(col, row):
-                with T.sblock("store"):
-                    vii, vjj = T.axis.remap("SS", [i, j])
+                with Ts.sblock("store"):
+                    vii, vjj = Ts.axis.remap("SS", [i, j])
                     if T.constexpr(transpose_matrix):
                         C[vjj, vii] = A[vii, vjj]
                     else:
                         C[vii, vjj] = A[vii, vjj]
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def impl(a: T.handle, c: T.handle) -> None:
         s0, s1, d0, d1 = T.int32(), T.int32(), T.int32(), T.int32()
         A = T.match_buffer(
@@ -177,9 +178,9 @@ def get_simdgroup_store_intrin(
         C = T.match_buffer(
             c, (col, row), dtype, align=align, scope=scope, strides=[d1, d0], offset_factor=1
         )
-        with T.sblock("root"):
-            T.reads(A[0:col, 0:row])
-            T.writes(C[0:col, 0:row])
+        with Ts.sblock("root"):
+            Ts.reads(A[0:col, 0:row])
+            Ts.writes(C[0:col, 0:row])
             T.metal.simdgroup_store(
                 A.data,
                 index=get_simdgroup_index(A, s1, col, row),
@@ -196,20 +197,20 @@ def get_simdgroup_store_intrin(
 def get_simdgroup_multiply_accumulate_intrin(
     m_dim: int, n_dim: int, k_dim: int, dtype: str
 ) -> tuple[PrimFunc, PrimFunc]:
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def desc(a: T.handle, b: T.handle, c: T.handle) -> None:
         A = T.match_buffer(a, (m_dim, k_dim), dtype, scope="metal.simdgroup", offset_factor=1)
         B = T.match_buffer(b, (k_dim, n_dim), dtype, scope="metal.simdgroup", offset_factor=1)
         C = T.match_buffer(c, (m_dim, n_dim), dtype, scope="metal.simdgroup", offset_factor=1)
-        with T.sblock("root"):
-            T.reads(C[0:m_dim, 0:n_dim], A[0:m_dim, 0:k_dim], B[0:k_dim, 0:n_dim])
-            T.writes(C[0:m_dim, 0:n_dim])
+        with Ts.sblock("root"):
+            Ts.reads(C[0:m_dim, 0:n_dim], A[0:m_dim, 0:k_dim], B[0:k_dim, 0:n_dim])
+            Ts.writes(C[0:m_dim, 0:n_dim])
             for i, j, k in T.grid(m_dim, n_dim, k_dim):
-                with T.sblock(""):
-                    vii, vjj, vkk = T.axis.remap("SSR", [i, j, k])
+                with Ts.sblock(""):
+                    vii, vjj, vkk = Ts.axis.remap("SSR", [i, j, k])
                     C[vii, vjj] += A[vii, vkk] * B[vkk, vjj]
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def impl(a: T.handle, b: T.handle, c: T.handle) -> None:
         a0, a1, b0, b1, c0, c1 = T.int32(), T.int32(), T.int32(), T.int32(), T.int32(), T.int32()
         A = T.match_buffer(
@@ -221,9 +222,9 @@ def get_simdgroup_multiply_accumulate_intrin(
         C = T.match_buffer(
             c, (m_dim, n_dim), dtype, scope="metal.simdgroup", strides=[c1, c0], offset_factor=1
         )
-        with T.sblock("root"):
-            T.reads(C[0:m_dim, 0:n_dim], A[0:m_dim, 0:k_dim], B[0:k_dim, 0:n_dim])
-            T.writes(C[0:m_dim, 0:n_dim])
+        with Ts.sblock("root"):
+            Ts.reads(C[0:m_dim, 0:n_dim], A[0:m_dim, 0:k_dim], B[0:k_dim, 0:n_dim])
+            Ts.writes(C[0:m_dim, 0:n_dim])
             T.metal.simdgroup_multiply_accumulate(
                 C.data,
                 get_simdgroup_index(C, c1, m_dim, n_dim),
diff --git a/python/tvm/s_tir/tensor_intrin/riscv_cpu.py b/python/tvm/s_tir/tensor_intrin/riscv_cpu.py
index bcd437b41b..78e4e00f7e 100644
--- a/python/tvm/s_tir/tensor_intrin/riscv_cpu.py
+++ b/python/tvm/s_tir/tensor_intrin/riscv_cpu.py
@@ -23,6 +23,7 @@ import logging
 import tvm_ffi
 
 from tvm.runtime import DataType
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 from tvm.target.codegen import Target, llvm_get_vector_width, target_has_features
 
@@ -73,19 +74,19 @@ def rvv_vec_dot_product_kernels(
         }
     """
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def rvv_vec_dot_prod_desc(
         A: T.Buffer((n_elems,), data_dtype, offset_factor=1),
         B: T.Buffer((n_lanes, n_elems), weight_dtype, offset_factor=1),
         C: T.Buffer((n_lanes,), out_dtype, offset_factor=1),
     ) -> None:
-        with T.sblock("root"):
-            T.reads(C[0:n_lanes], A[0:n_elems], B[0:n_lanes, 0:n_elems])
-            T.writes(C[0:n_lanes])
+        with Ts.sblock("root"):
+            Ts.reads(C[0:n_lanes], A[0:n_elems], B[0:n_lanes, 0:n_elems])
+            Ts.writes(C[0:n_lanes])
             for j in T.serial(0, n_lanes):
                 for k in T.serial(0, n_elems):
-                    with T.sblock("update"):
-                        vj, vk = T.axis.remap("SR", [j, k])
+                    with Ts.sblock("update"):
+                        vj, vk = Ts.axis.remap("SR", [j, k])
                         C[vj] = C[vj] + T.cast(A[vk], out_dtype) * T.cast(B[vj, vk], out_dtype)
 
     # LLVM only supports ELEN=32 or ELEN=64
@@ -105,15 +106,15 @@ def rvv_vec_dot_product_kernels(
         wide_dtype += str(DataType(data_dtype).bits * 2)
 
     # fmt: off
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def rvv_vec_dot_prod_impl(
         A: T.Buffer((n_elems,), data_dtype, offset_factor=1),
         B: T.Buffer((n_lanes, n_elems), weight_dtype, offset_factor=1),
         C: T.Buffer((n_lanes,), out_dtype, offset_factor=1),
     ) -> None:
-        with T.sblock("root"):
-            T.reads(C[0:n_lanes], A[0:n_elems], B[0:n_lanes, 0:n_elems])
-            T.writes(C[0:n_lanes])
+        with Ts.sblock("root"):
+            Ts.reads(C[0:n_lanes], A[0:n_elems], B[0:n_lanes, 0:n_elems])
+            Ts.writes(C[0:n_lanes])
 
             vec_A = T.call_llvm_intrin(
                 f"{data_dtype}xvscalex{d_dtype_lanes}",
@@ -123,9 +124,9 @@ def rvv_vec_dot_product_kernels(
                 T.int64(n_elems))
 
             for i in range(n_lanes):
-                with T.sblock("update"):
-                    T.reads(B[i, 0:n_elems])
-                    T.writes(C[i])
+                with Ts.sblock("update"):
+                    Ts.reads(B[i, 0:n_elems])
+                    Ts.writes(C[i])
 
                     vec_B_row = T.call_llvm_intrin(
                         f"{weight_dtype}xvscalex{w_dtype_lanes}",
diff --git a/python/tvm/s_tir/tensor_intrin/rocm.py b/python/tvm/s_tir/tensor_intrin/rocm.py
index 2646c0f497..93e244b27d 100644
--- a/python/tvm/s_tir/tensor_intrin/rocm.py
+++ b/python/tvm/s_tir/tensor_intrin/rocm.py
@@ -18,6 +18,7 @@
 """Intrinsics for AMDGPU tensorization."""
 
 from tvm.runtime import convert
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 from tvm.tirx.expr import Cast, IntImm
 
@@ -27,15 +28,15 @@ from .dot_product_common import get_dp4a_intrin
 lift = convert
 
 
-@T.prim_func(s_tir=True)
+@Ts.prim_func
 def sdot4(
     A: T.Buffer((4,), "int8", offset_factor=1, align=4, scope="shared"),
     B: T.Buffer((4,), "int8", offset_factor=1, align=4, scope="shared"),
     C: T.Buffer((1,), "int32", offset_factor=1, align=4, scope="local"),
 ) -> None:
-    with T.sblock("root"):
-        T.reads(C[0], A[0:4], B[0:4])
-        T.writes(C[0])
+    with Ts.sblock("root"):
+        Ts.reads(C[0], A[0:4], B[0:4])
+        Ts.writes(C[0])
 
         C[0] += T.call_llvm_pure_intrin(
             T.llvm_lookup_intrinsic_id("llvm.amdgcn.sdot4"),
@@ -121,30 +122,30 @@ def get_mma_fill_intrin(dtype, local_size):
     # Assume M = N = 16
     index_map = shared_16x16_to_local_64x4_layout_C
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mma_fill_desc(a: T.handle) -> None:
         C_warp = T.match_buffer(a, [WARP_SIZE, local_size], dtype=dtype, scope="warp")
 
-        with T.sblock("root"):
-            T.reads()
-            T.writes(C_warp[0:WARP_SIZE, 0:local_size])
+        with Ts.sblock("root"):
+            Ts.reads()
+            Ts.writes(C_warp[0:WARP_SIZE, 0:local_size])
             for i0, i1 in T.grid(M_DIM, N_DIM):
-                with T.sblock("C_warp"):
-                    i, j = T.axis.remap("SS", [i0, i1])
+                with Ts.sblock("C_warp"):
+                    i, j = Ts.axis.remap("SS", [i0, i1])
                     warp_indices = index_map(i, j)
-                    T.reads()
-                    T.writes(C_warp[warp_indices[0], warp_indices[1]])
+                    Ts.reads()
+                    Ts.writes(C_warp[warp_indices[0], warp_indices[1]])
                     C_warp[warp_indices[0], warp_indices[1]] = zero
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mma_fill_impl(a: T.handle) -> None:
         C_warp = T.match_buffer(
             a, [WARP_SIZE, local_size], dtype=dtype, scope="warp", offset_factor=1
         )
 
-        with T.sblock("root"):
-            T.reads()
-            T.writes(C_warp[0:WARP_SIZE, 0:local_size])
+        with Ts.sblock("root"):
+            Ts.reads()
+            Ts.writes(C_warp[0:WARP_SIZE, 0:local_size])
             tx = T.env_thread("threadIdx.x")
             T.launch_thread(tx, WARP_SIZE)
             for local_id in T.serial(0, local_size):
@@ -199,7 +200,7 @@ def get_mfma_load_intrin(
     else:
         raise ValueError("k_dim must be 4 or 16 currently")
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mfma_load_desc(reg_handle: T.handle, memory_handle: T.handle) -> None:
         memory = T.match_buffer(
             memory_handle,
@@ -212,20 +213,20 @@ def get_mfma_load_intrin(
             reg_handle, (WARP_SIZE, local_size), dtype, offset_factor=1, scope="warp"
         )
 
-        with T.sblock("root"):
-            T.reads(memory[0:row_dim, 0:col_dim])
-            T.writes(reg[0:WARP_SIZE, 0:local_size])
+        with Ts.sblock("root"):
+            Ts.reads(memory[0:row_dim, 0:col_dim])
+            Ts.writes(reg[0:WARP_SIZE, 0:local_size])
 
             for ax0, ax1 in T.grid(row_dim, col_dim):
-                with T.sblock("memory_reg"):
-                    v0, v1 = T.axis.remap("SS", [ax0, ax1])
-                    T.reads(memory[v0, v1])
+                with Ts.sblock("memory_reg"):
+                    v0, v1 = Ts.axis.remap("SS", [ax0, ax1])
+                    Ts.reads(memory[v0, v1])
 
                     warp_indices = index_map(v0, v1)
-                    T.writes(reg[warp_indices[0], warp_indices[1]])
+                    Ts.writes(reg[warp_indices[0], warp_indices[1]])
                     reg[warp_indices[0], warp_indices[1]] = memory[v0, v1]
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mfma_load_impl(reg_handle: T.handle, memory_handle: T.handle) -> None:
         s0 = T.int32()
         s1 = T.int32()
@@ -243,9 +244,9 @@ def get_mfma_load_intrin(
             reg_handle, (WARP_SIZE, local_size), dtype, align=64, offset_factor=1, scope="warp"
         )
 
-        with T.sblock("root"):
-            T.reads(memory[0:row_dim, 0:col_dim])
-            T.writes(reg[0:WARP_SIZE, 0:local_size])
+        with Ts.sblock("root"):
+            Ts.reads(memory[0:row_dim, 0:col_dim])
+            Ts.writes(reg[0:WARP_SIZE, 0:local_size])
             tx = T.env_thread("threadIdx.x")
             for local_id in T.serial(0, local_size):
                 matrix_indices = reverse_index_map(tx, local_id)
@@ -285,53 +286,53 @@ def get_mfma_intrin(k_dim, in_dtype="float32", out_dtype="float32", b_transposed
             return j, i
         return i, j
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mfma_sync_desc(a: T.handle, b: T.handle, c: T.handle) -> None:
         A = T.match_buffer(a, (WARP_SIZE, local_size), in_dtype, offset_factor=1, scope="warp")
         B = T.match_buffer(b, (WARP_SIZE, local_size), in_dtype, offset_factor=1, scope="warp")
         C = T.match_buffer(c, (WARP_SIZE, local_size_out), out_dtype, offset_factor=1, scope="warp")
 
-        with T.sblock("root"):
-            T.reads(
+        with Ts.sblock("root"):
+            Ts.reads(
                 C[0:WARP_SIZE, 0:local_size_out],
                 A[0:WARP_SIZE, 0:local_size],
                 B[0:WARP_SIZE, 0:local_size],
             )
-            T.writes(C[0:WARP_SIZE, 0:local_size_out])
+            Ts.writes(C[0:WARP_SIZE, 0:local_size_out])
 
             for i, j, k in T.grid(M_DIM, N_DIM, k_dim):
-                with T.sblock("C"):
-                    vi, vj, vk = T.axis.remap("SSR", [i, j, k])
+                with Ts.sblock("C"):
+                    vi, vj, vk = Ts.axis.remap("SSR", [i, j, k])
                     b_indices = maybe_swap(vk, vj)
 
                     c_warp_indices = index_map_C(vi, vj)
                     a_warp_indices = index_map_A(vi, vk)
                     b_warp_indices = index_map_B(b_indices[0], b_indices[1])
 
-                    T.reads(
+                    Ts.reads(
                         C[c_warp_indices[0], c_warp_indices[1]],
                         A[a_warp_indices[0], a_warp_indices[1]],
                         B[b_warp_indices[0], b_warp_indices[1]],
                     )
-                    T.writes(C[c_warp_indices[0], c_warp_indices[1]])
+                    Ts.writes(C[c_warp_indices[0], c_warp_indices[1]])
 
                     C[c_warp_indices[0], c_warp_indices[1]] += maybe_cast(
                         A[a_warp_indices[0], a_warp_indices[1]]
                     ) * maybe_cast(B[b_warp_indices[0], b_warp_indices[1]])
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mfma_sync_impl_float(a: T.handle, b: T.handle, c: T.handle) -> None:
         A = T.match_buffer(a, (WARP_SIZE, local_size), in_dtype, offset_factor=1, scope="warp")
         B = T.match_buffer(b, (WARP_SIZE, local_size), in_dtype, offset_factor=1, scope="warp")
         C = T.match_buffer(c, (WARP_SIZE, local_size_out), out_dtype, offset_factor=1, scope="warp")
 
-        with T.sblock("root"):
-            T.reads(
+        with Ts.sblock("root"):
+            Ts.reads(
                 A[0:WARP_SIZE, 0:local_size],
                 B[0:WARP_SIZE, 0:local_size],
                 C[0:WARP_SIZE, 0:local_size_out],
             )
-            T.writes(C[0:WARP_SIZE, 0:local_size_out])
+            Ts.writes(C[0:WARP_SIZE, 0:local_size_out])
             tx = T.env_thread("threadIdx.x")
             T.launch_thread(tx, WARP_SIZE)
             C[tx, T.ramp(0, 1, local_size_out)] = T.call_llvm_pure_intrin(
@@ -345,19 +346,19 @@ def get_mfma_intrin(k_dim, in_dtype="float32", out_dtype="float32", b_transposed
                 dtype=f"{out_dtype}x4",
             )
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mfma_sync_impl_integer(a: T.handle, b: T.handle, c: T.handle) -> None:
         A = T.match_buffer(a, (WARP_SIZE, local_size), in_dtype, offset_factor=1, scope="warp")
         B = T.match_buffer(b, (WARP_SIZE, local_size), in_dtype, offset_factor=1, scope="warp")
         C = T.match_buffer(c, (WARP_SIZE, local_size_out), out_dtype, offset_factor=1, scope="warp")
 
-        with T.sblock("root"):
-            T.reads(
+        with Ts.sblock("root"):
+            Ts.reads(
                 A[0:WARP_SIZE, 0:local_size],
                 B[0:WARP_SIZE, 0:local_size],
                 C[0:WARP_SIZE, 0:local_size_out],
             )
-            T.writes(C[0:WARP_SIZE, 0:local_size_out])
+            Ts.writes(C[0:WARP_SIZE, 0:local_size_out])
             tx = T.env_thread("threadIdx.x")
             T.launch_thread(tx, WARP_SIZE)
 
@@ -390,23 +391,23 @@ def get_mfma_intrin(k_dim, in_dtype="float32", out_dtype="float32", b_transposed
 def get_mfma_store_intrin(local_size=4, dtype="float32", scope="global"):
     index_map = shared_16x16_to_local_64x4_layout_C
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mfma_store_desc(a: T.handle, c: T.handle) -> None:
         C_warp = T.match_buffer(a, [WARP_SIZE, local_size], dtype=dtype, scope="warp")
         C = T.match_buffer(c, [M_DIM, N_DIM], dtype=dtype, scope=scope)
 
-        with T.sblock("root"):
-            T.reads(C_warp[0:WARP_SIZE, 0:local_size])
-            T.writes(C[0:M_DIM, 0:N_DIM])
+        with Ts.sblock("root"):
+            Ts.reads(C_warp[0:WARP_SIZE, 0:local_size])
+            Ts.writes(C[0:M_DIM, 0:N_DIM])
             for i0, i1 in T.grid(M_DIM, N_DIM):
-                with T.sblock("C_warp"):
-                    v0, v1 = T.axis.remap("SS", [i0, i1])
+                with Ts.sblock("C_warp"):
+                    v0, v1 = Ts.axis.remap("SS", [i0, i1])
                     warp_indices = index_map(v0, v1)
-                    T.reads(C_warp[warp_indices[0], warp_indices[1]])
-                    T.writes(C[v0, v1])
+                    Ts.reads(C_warp[warp_indices[0], warp_indices[1]])
+                    Ts.writes(C[v0, v1])
                     C[v0, v1] = C_warp[warp_indices[0], warp_indices[1]]
 
-    @T.prim_func(s_tir=True)
+    @Ts.prim_func
     def mfma_store_impl(a: T.handle, c: T.handle) -> None:
         s0 = T.int32()
         s1 = T.int32()
@@ -418,9 +419,9 @@ def get_mfma_store_intrin(local_size=4, dtype="float32", scope="global"):
             c, [M_DIM, N_DIM], dtype=dtype, scope=scope, offset_factor=1, strides=[s0, s1]
         )
 
-        with T.sblock("root"):
-            T.reads(C_warp[0:WARP_SIZE, 0:local_size])
-            T.writes(C[0:M_DIM, 0:N_DIM])
+        with Ts.sblock("root"):
+            Ts.reads(C_warp[0:WARP_SIZE, 0:local_size])
+            Ts.writes(C[0:M_DIM, 0:N_DIM])
             tx = T.env_thread("threadIdx.x")
             T.launch_thread(tx, WARP_SIZE)
             for i in range(local_size):
diff --git a/python/tvm/s_tir/tensor_intrin/x86.py b/python/tvm/s_tir/tensor_intrin/x86.py
index 1db0cc51e3..1a9a7b51e6 100644
--- a/python/tvm/s_tir/tensor_intrin/x86.py
+++ b/python/tvm/s_tir/tensor_intrin/x86.py
@@ -17,6 +17,7 @@
 # pylint: disable=invalid-name,missing-function-docstring
 """Intrinsics for x86 tensorization."""
 
+from tvm.script import s_tir as Ts
 from tvm.script import tirx as T
 
 from .. import TensorIntrin
@@ -25,31 +26,31 @@ from .. import TensorIntrin
 # Equivalent to the ones in topi/x86/tensor_intrin.py
 
 
-@T.prim_func(s_tir=True)
+@Ts.prim_func
 def dot_product_16x4_u8i8i32_desc(
     A: T.Buffer((4,), "uint8", offset_factor=1),
     B: T.Buffer((16, 4), "int8", offset_factor=1),
     C: T.Buffer((16,), "int32", offset_factor=1),
 ) -> None:
-    with T.sblock("root"):
-        T.reads(C[0:16], A[0:4], B[0:16, 0:4])
-        T.writes(C[0:16])
+    with Ts.sblock("root"):
+        Ts.reads(C[0:16], A[0:4], B[0:16, 0:4])
+        Ts.writes(C[0:16])
         for i in T.serial(0, 16):
             for k in T.serial(0, 4):
-                with T.sblock("update"):
-                    vi, vk = T.axis.remap("SR", [i, k])
+                with Ts.sblock("update"):
+                    vi, vk = Ts.axis.remap("SR", [i, k])
                     C[vi] = C[vi] + T.cast(A[vk], "int32") * T.cast(B[vi, vk], "int32")
 
 
-@T.prim_func(s_tir=True)
+@Ts.prim_func
 def dot_product_16x4_u8i8i32_vnni(
     A: T.Buffer((4,), "uint8", offset_factor=1),
     B: T.Buffer((16, 4), "int8", offset_factor=1),
     C: T.Buffer((16,), "int32", offset_factor=1),
 ) -> None:
-    with T.sblock("root"):
-        T.reads(C[0:16], A[0:4], B[0:16, 0:4])
-        T.writes(C[0:16])
+    with Ts.sblock("root"):
+        Ts.reads(C[0:16], A[0:4], B[0:16, 0:4])
+        Ts.writes(C[0:16])
 
         A_u8x4: T.uint8x4 = A.vload([0], "uint8x4")
         A_i32: T.int32 = T.reinterpret(A_u8x4, dtype="int32")
@@ -67,15 +68,15 @@ def dot_product_16x4_u8i8i32_vnni(
         )
 
 
-@T.prim_func(s_tir=True)
+@Ts.prim_func
 def dot_product_16x4_u8i8i32_avx512(
     A: T.Buffer((4,), "uint8", offset_factor=1),
     B: T.Buffer((16, 4), "int8", offset_factor=1),
     C: T.Buffer((16,), "int32", offset_factor=1),
 ) -> None:
-    with T.sblock("root"):
-        T.reads(C[0:16], A[0:4], B[0:16, 0:4])
-        T.writes(C[0:16])
+    with Ts.sblock("root"):
+        Ts.reads(C[0:16], A[0:4], B[0:16, 0:4])
+        Ts.writes(C[0:16])
 
         A_u8x4 = A.vload([0], "uint8x4")
         A_i32 = T.reinterpret(A_u8x4, dtype="int32")
diff --git a/python/tvm/script/ir_builder/parser_protocol.py b/python/tvm/script/ir_builder/parser_protocol.py
index 120e97c18e..91f3106ae6 100644
--- a/python/tvm/script/ir_builder/parser_protocol.py
+++ b/python/tvm/script/ir_builder/parser_protocol.py
@@ -852,7 +852,7 @@ def module_member_(name: str, value: Any) -> Any:
         # Source
         class Module:
             helper = existing_function
-        # Generated builder, inside I.ir_module()
+        # Generated builder, inside I.ir_module
         helper = I.module_member_("helper", existing_function)
     """
     from tvm.ir import BaseFunc
@@ -898,7 +898,7 @@ def function_(*, decl: bool = False, span: _Span = None, **options: Any) -> IRBu
         unspecified; active source-call provenance is composed by the builder. Frames
         retain their location until finalization.
     options : Any
-        Language variant options: TIRx ``private``, ``s_tir`` and ``persistent``
+        Language variant options: primitive function ``private`` and ``persistent``
         default to False. Relax ``pure`` defaults to True and ``private``/``local``
         to False; ``local=True`` requires a declared reference when building its
         body. See :func:`tvm.tirx.script.ir_builder.function_` and
diff --git a/python/tvm/script/parser/entry.py b/python/tvm/script/parser/entry.py
index 4060000453..cd883cf8e3 100644
--- a/python/tvm/script/parser/entry.py
+++ b/python/tvm/script/parser/entry.py
@@ -247,11 +247,6 @@ def make_decorator(
         check_well_formed : bool, optional
             Whether to check that the constructed function is well formed.
             Defaults to True.
-        s_tir : bool, optional
-            For ``T.prim_func``, select scheduled-TIR construction semantics:
-            buffers have no default layout and the body is wrapped in a root
-            block. Defaults to False, selecting TIRx construction. See
-            :func:`tvm.tirx.script.ir_builder.prim_func`.
         persistent : bool, optional
             For ``T.prim_func``, mark the resulting function as a persistent
             kernel. Defaults to False. See
@@ -377,14 +372,13 @@ def make_macro_decorator(
 
             import tvm
             from tvm.script import tirx as T
-
             x_value = 128
 
             @T.inline
             def capture(A, B):
                 B[()] = A[x_value]  # x_value resolved from enclosing scope
 
-            @T.prim_func(s_tir=True)
+            @T.prim_func
             def use(A: T.Buffer((1024,), "int32"), B: T.Buffer((), "int32")) -> None:
                 capture(A, B)       # Produces B[()] = A[128]
         """
diff --git a/python/tvm/te/operation.py b/python/tvm/te/operation.py
index cd8f4d8859..9ea64e7e2a 100644
--- a/python/tvm/te/operation.py
+++ b/python/tvm/te/operation.py
@@ -377,13 +377,13 @@ def extern_primfunc(input_tensors: list[_tensor.Tensor], primfunc: tvm.tirx.Prim
         A = te.placeholder((128, 128), name="A")
         B = te.placeholder((128, 128), name="B")
 
-        @T.prim_func(s_tir=True)
+        @Ts.prim_func
         def before_split(a: T.handle, b: T.handle) -> None:
             A = T.match_buffer(a, (128, 128))
             B = T.match_buffer(b, (128, 128))
             for i, j in T.grid(128, 128):
-                with T.sblock("B"):
-                    vi, vj = T.axis.remap("SS", [i, j])
+                with Ts.sblock("B"):
+                    vi, vj = Ts.axis.remap("SS", [i, j])
                     B[vi, vj] = A[vi, vj] * 2.0
 
         C = te.extern_primfunc([A, B], func)
@@ -569,16 +569,16 @@ def create_prim_func(
 
     .. code-block:: python
 
-        @T.prim_func(s_tir=True)
+        @Ts.prim_func
         def tir_matmul(a: T.handle, b: T.handle, c: T.handle) -> None:
             A = T.match_buffer(a, (128, 128))
             B = T.match_buffer(b, (128, 128))
             C = T.match_buffer(c, (128, 128))
 
             for i, j, k in T.grid(128, 128, 128):
-                with T.sblock():
-                    vi, vj, vk = T.axis.remap("SSR", [i, j, k])
-                    with T.init():
+                with Ts.sblock():
+                    vi, vj, vk = Ts.axis.remap("SSR", [i, j, k])
+                    with Ts.init():
                         C[vi, vj] = 0.0
                     C[vi, vj] += A[vi, vk] * B[vj, vk]
 
diff --git a/python/tvm/tirx/build.py b/python/tvm/tirx/build.py
index 214da90ede..1ff3758456 100644
--- a/python/tvm/tirx/build.py
+++ b/python/tvm/tirx/build.py
@@ -58,18 +58,18 @@ def split_host_device_mods(mod: IRModule) -> tuple[IRModule, dict[Target, IRModu
 
         @I.ir_module
         class Module:
-            @T.prim_func(private=True, s_tir=True)
+            @T.prim_func(private=True)
             def add(a: T.int32, b: T.int32) -> T.int32:
                 T.func_attr({"target": T.target({"arch": "sm_90", "keys": ["cuda", "gpu"],
                                                 "kind": "cuda", "max_num_threads": 1024}))
                 return a + b
 
-            @T.prim_func(private=True, s_tir=True)
+            @T.prim_func(private=True)
             def add_host(a: T.int32, b: T.int32) -> T.int32:
                 T.func_attr({"target": T.target({"keys": ["cpu"], "kind": "c"}))
                 return a + b
 
-            @T.prim_func(s_tir=True)
+            @T.prim_func
             def main_kernel(A: T.handle, B: T.handle, C: T.handle, length: T.int32):
                 T.func_attr({"target": T.target({"arch": "sm_90", "keys": ["cuda", "gpu"],
                                                 "kind": "cuda"}),
@@ -77,7 +77,7 @@ def split_host_device_mods(mod: IRModule) -> tuple[IRModule, dict[Target, IRModu
                             "tirx.is_global_func": True})
                 # ... kernel implementation
 
-            @T.prim_func(s_tir=True)
+            @T.prim_func
             def main(self_handle: T.handle, args: T.handle, num_args: T.int32, result: T.handle):
                 T.func_attr({"target": T.target({"keys": ["cpu"], "kind": "c"}),
                             "calling_conv": 1,  # kCPackedFunc for entry functions
@@ -157,7 +157,7 @@ def tir_to_runtime(
 def build(
     mod: PrimFunc | IRModule,
     target: str | Target | None = None,
-    pipeline: None | str | tvm.transform.Pass = "default",
+    pipeline: str | tvm.transform.Pass | None = "default",
 ):
     """Build a function with a signature, generating code for devices
     coupled with target information.
@@ -215,14 +215,14 @@ def build(
     mod = tvm.tirx.transform.BindTarget(target_to_bind)(mod)
 
     # Step 4: Apply the tirx pipeline
-    if pipeline is not None:
+    if pipeline not in (None, "default"):
         # custom pipeline
         assert isinstance(pipeline, str)
         pipeline, finalize_host_passes, finalize_device_passes = tvm.tirx.get_tir_pipeline(pipeline)
     else:
         # default pipeline depends on the target
         pipeline, finalize_host_passes, finalize_device_passes = tvm.tirx.get_default_tir_pipeline(
-            target
+            target, mod
         )
     mod = pipeline(mod)
 
diff --git a/python/tvm/tirx/compilation_pipeline.py b/python/tvm/tirx/compilation_pipeline.py
index d18186218c..51c2f70e12 100644
--- a/python/tvm/tirx/compilation_pipeline.py
+++ b/python/tvm/tirx/compilation_pipeline.py
@@ -24,45 +24,11 @@ from tvm.backend.cuda import transforms as cuda_transforms
 
 
 def default_tir_pipeline():
-    """The default tirx pipeline used in tvm.tirx.build"""
-
-    @tvm.transform.module_pass(opt_level=0)
-    def _pipeline(mod: tvm.ir.IRModule, _ctx: tvm.transform.PassContext) -> tvm.ir.IRModule:
-        """The default lowering passes for TIR backend."""
-        pass_ctx = tvm.transform.PassContext.current()
-        config = pass_ctx.config
-        passes = [
-            tirx.transform.LowerInitBlock(),
-            tvm.s_tir.transform.UnifyThreadBinding(),
-            tirx.transform.StmtSimplify(),
-            tirx.transform.FlattenBuffer(),
-            tirx.transform.BF16ComputeLegalize(),
-            tirx.transform.NarrowDataType(32),
-            tirx.transform.VectorizeLoop(not bool(config.get("tir.disable_vectorize", False))),
-            tirx.transform.UnrollLoop(),
-            tirx.transform.StmtSimplify(),
-        ]
-        if not bool(config.get("tir.disable_cse_tir", False)):
-            passes.append(tirx.transform.CommonSubexprElim())
-        passes.extend(
-            [
-                tirx.transform.FP8ComputeLegalize(),
-                tirx.transform.VerifyMemory(),
-                tirx.transform.AnnotateEntryFunc(),
-                tirx.transform.SplitHostDevice(),
-                cuda_transforms.LowerIket(),
-                tirx.transform.MakePackedAPI(),
-                tirx.transform.FP8StorageLegalize(),
-                tirx.transform.BF16StorageLegalize(),
-            ]
-        )
-        mod = tvm.ir.transform.Sequential(passes)(mod)
-        return mod
-
-    return _pipeline, finalize_host_passes, finalize_device_passes
+    """The default pipeline for TIRx primitive functions."""
+    return tirx_pipeline()
 
 
-def tirx_pipeline():
+def tirx_pipeline(*, prepare_only=False):
     """The TIRX pipeline used in tvm.tirx.build"""
 
     @tvm.transform.module_pass(opt_level=0)
@@ -72,36 +38,45 @@ def tirx_pipeline():
         config = pass_ctx.config
         passes = [
             tirx.transform.LowerTIRx(),
-            tvm.s_tir.transform.UnifyThreadBinding(),
+            tirx.transform.UnifyThreadBinding(),
             tirx.transform.StmtSimplify(),
             tirx.transform.LowerTIRxOpaque(),
             tirx.transform.FlattenBuffer(),
             tirx.transform.BF16ComputeLegalize(),
             tirx.transform.NarrowDataType(32),
-            tirx.transform.VectorizeLoop(not bool(config.get("tir.disable_vectorize", False))),
+            tirx.transform.VectorizeLoop(not bool(config.get("tirx.disable_vectorize", False))),
             tirx.transform.UnrollLoop(),
             tirx.transform.StmtSimplify(),
         ]
-        if not bool(config.get("tir.disable_cse_tir", False)):
+        if not bool(config.get("tirx.disable_cse_tir", False)):
             passes.append(tirx.transform.CommonSubexprElim())
         passes.extend(
             [
                 tirx.transform.FP8ComputeLegalize(),
                 tirx.transform.VerifyMemory(),
-                tirx.transform.AnnotateEntryFunc(),
-                tirx.transform.SplitHostDevice(),
-                cuda_transforms.LowerIket(),
-                tirx.transform.MakePackedAPI(),
-                tirx.transform.FP8StorageLegalize(),
-                tirx.transform.BF16StorageLegalize(),
+                tirx.transform.LowerThreadAllreduce(),
             ]
         )
         mod = tvm.ir.transform.Sequential(passes)(mod)
-        return mod
+        return mod if prepare_only else finalize_tir_pipeline()(mod)
 
     return _pipeline, finalize_host_passes, finalize_device_passes
 
 
+def finalize_tir_pipeline():
+    """Lower module-wide calling conventions after all dialects are prepared."""
+    return tvm.ir.transform.Sequential(
+        [
+            tirx.transform.AnnotateEntryFunc(),
+            tirx.transform.SplitHostDevice(),
+            cuda_transforms.LowerIket(),
+            tirx.transform.MakePackedAPI(),
+            tirx.transform.FP8StorageLegalize(),
+            tirx.transform.BF16StorageLegalize(),
+        ]
+    )
+
+
 def finalize_host_passes():  # pylint: disable=unused-argument
     """The default finalization passes for TIR backend."""
     host_pass_list = [
@@ -145,9 +120,8 @@ def get_tir_pipeline(name: str | None = None, **kwargs) -> tvm.transform.Pass:
     name : Optional[str]
         Name of the pipeline
     """
-    if name == "default":
-        # for now, default to s_tir pipeline
-        name = "s_tir"
+    if name is None:
+        name = "default"
     if name not in PIPELINE_MAP:
         raise ValueError(
             f"Unknown pre-built pipeline {name},candidates are {list(PIPELINE_MAP.keys())}"
@@ -155,11 +129,23 @@ def get_tir_pipeline(name: str | None = None, **kwargs) -> tvm.transform.Pass:
     return PIPELINE_MAP[name](**kwargs)
 
 
+# Dialects register their own default selection without introducing imports here.
+_DEFAULT_PIPELINE_SELECTORS = []
+
+
+def register_default_tir_pipeline_selector(selector) -> None:
+    """Register a callback returning a pipeline tuple or None for (module, target)."""
+    _DEFAULT_PIPELINE_SELECTORS.append(selector)
+
+
 def get_default_tir_pipeline(
-    target: tvm.target.Target,  # pylint: disable=unused-argument
+    target: tvm.target.Target | None,
+    mod: tvm.ir.IRModule | None = None,
 ) -> tvm.transform.Pass:
-    """Get the default TIR pipeline for the given target."""
-    if target.kind.name == "opencl" and "adreno" in target.keys:
-        return get_tir_pipeline("adreno")
-    else:
-        return get_tir_pipeline("s_tir")
+    """Get the default pipeline for the input module and target."""
+    if mod is not None:
+        for selector in _DEFAULT_PIPELINE_SELECTORS:
+            pipeline = selector(mod, target)
+            if pipeline is not None:
+                return pipeline
+    return get_tir_pipeline("default")
diff --git a/python/tvm/tirx/function.py b/python/tvm/tirx/function.py
index ec1f1fc57d..02c067dd23 100644
--- a/python/tvm/tirx/function.py
+++ b/python/tvm/tirx/function.py
@@ -84,6 +84,11 @@ class PrimFunc(BaseFunc, Scriptable):
             span,
         )  # type: ignore
 
+    @property
+    def is_tirx(self):
+        """Whether this primitive function uses the TIRx dialect."""
+        return not bool(self.attrs.get("s_tir", False))
+
     def with_body(self, new_body, span=None):
         """Create a new PrimFunc with the same set signatures but a new body.
 
diff --git a/python/tvm/tirx/script/ir_builder/frame.py b/python/tvm/tirx/script/ir_builder/frame.py
index 4b08d56dc5..870dd25d16 100644
--- a/python/tvm/tirx/script/ir_builder/frame.py
+++ b/python/tvm/tirx/script/ir_builder/frame.py
@@ -35,6 +35,12 @@ class TIRFrame(IRBuilderFrame): ...
 class PrimFuncFrame(TIRFrame):
     """Native function frame retaining signature, symbols and finalized results."""
 
+    def default_buffer_layout(self, shape, scope):
+        """Select the default layout for buffers constructed in this function."""
+        from tvm.tirx.layout import S, TileLayout
+
+        return None if scope in ("trn.sbuf", "trn.psum") else TileLayout(S[tuple(shape)])
+
     @property
     def params(self):
         """The native declared parameters, shared with the resumed body."""
@@ -45,14 +51,6 @@ class PrimFuncFrame(TIRFrame):
         return _resolve_type_var(self, _ffi_api.ResolveTypeVar, name, dtype, value=value, span=span)
 
 
-@_register_object("script.ir_builder.tirx.SSBlockFrame")
-class SBlockFrame(TIRFrame): ...
-
-
-@_register_object("script.ir_builder.tirx.SBlockInitFrame")
-class BlockInitFrame(TIRFrame): ...
-
-
 @_register_object("script.ir_builder.tirx.ForFrame")
 class ForFrame(TIRFrame):
     def set_names(self, names: str | Sequence[str] | None) -> None:
diff --git a/python/tvm/tirx/script/ir_builder/ir.py b/python/tvm/tirx/script/ir_builder/ir.py
index 1d35f2dea8..5544ca3214 100644
--- a/python/tvm/tirx/script/ir_builder/ir.py
+++ b/python/tvm/tirx/script/ir_builder/ir.py
@@ -132,24 +132,6 @@ def cast(value, dtype, span=None):
     return _prim_ffi_api._cast(dtype, value, span)  # type: ignore[attr-defined]
 
 
-def _current_s_tir() -> bool:
-    """Return True if the innermost enclosing PrimFuncFrame has ``s_tir=True``.
-
-    Gates the builder's default layout fill: ``s_tir=True`` PrimFuncs leave
-    ``layout=None`` so s_tir-style passes that do not touch layout round-trip
-    cleanly. Ordinary TIRx storage scopes instead use ``TileLayout(S[shape])``.
-    """
-    from tvm.script.ir_builder.base import IRBuilder  # local import to avoid cycle
-
-    if not IRBuilder.is_in_scope():
-        return False
-    builder = IRBuilder.current()
-    for f in reversed(list(builder.frames)):
-        if isinstance(f, frame.PrimFuncFrame):
-            return bool(f.s_tir)
-    return False
-
-
 def _get_layout(layout: str | Layout | None, shape: list[Expr], scope: str) -> Layout | None:
     if layout is None:
         return None
@@ -157,8 +139,10 @@ def _get_layout(layout: str | Layout | None, shape: list[Expr], scope: str) -> L
         return layout
     assert isinstance(layout, str)
     if layout == "default":
-        if _current_s_tir():
-            return None
+        if IRBuilder.is_in_scope():
+            for function_frame in reversed(list(IRBuilder.current().frames)):
+                if isinstance(function_frame, frame.PrimFuncFrame):
+                    return function_frame.default_buffer_layout(shape, scope)
         if scope in ["trn.sbuf", "trn.psum"]:
             return None
         return TileLayout(S[tuple(shape)])
@@ -198,7 +182,6 @@ def _get_elem_offset(elem_offset, byte_offset, dtype: str):
     return byte_offset * 8 // (DataType(_normalize_prim_type(dtype).dtype).bits)
 
 
-_block_name_suffix = threading.local()
 _meta_construction_state = threading.local()
 _THIS_FILE = __file__
 
@@ -279,32 +262,6 @@ def _record_meta_resource(value: Any, skip_frames: int = 2) -> None:
         scope.record(value, frame_info)
 
 
-def _get_sblock_name_suffix() -> str:
-    """Get the current block name suffix for macro expansion."""
-    return getattr(_block_name_suffix, "value", "")
-
-
-@contextlib.contextmanager
-def block_name_suffix_context(block_suffix: str):
-    """Context manager to set block name suffix during macro expansion.
-
-    Parameters
-    ----------
-    block_suffix : str
-        The suffix to append to block names (e.g., "_1", "_2").
-
-    Yields
-    ------
-    None
-    """
-    old_suffix = getattr(_block_name_suffix, "value", "")
-    _block_name_suffix.value = block_suffix
-    try:
-        yield
-    finally:
-        _block_name_suffix.value = old_suffix
-
-
 def buffer(
     shape: list[Expr] | tuple[Expr] | Expr | Integral,
     dtype: str = "float32",
@@ -397,7 +354,6 @@ def buffer_decl(*args, **kwargs):
 
 def prim_func(
     is_private: bool = False,
-    s_tir: bool = False,
     persistent: bool = False,
     *,
     private: bool | None = None,
@@ -408,11 +364,6 @@ def prim_func(
     ----------
     is_private : bool
         Whether the PrimFunc is annotated as private.
-    s_tir : bool
-        Whether this PrimFunc uses s_tir (apache-derived TIR) semantics:
-        Buffers use layout=None, and completion wraps the body in a root
-        SBlock. Default (False) selects tirx semantics: buffers use
-        ``DefaultLayout(shape)`` and the body has no root-block wrapping.
     persistent : bool
         Whether this is a persistent kernel.
     private : bool
@@ -425,7 +376,7 @@ def prim_func(
     """
     if private is not None:
         is_private = private
-    return _ffi_api.PrimFunc(is_private, s_tir, persistent)  # type: ignore[attr-defined] # pylint: disable=no-member
+    return _ffi_api.PrimFunc(is_private, persistent)  # type: ignore[attr-defined] # pylint: disable=no-member
 
 
 def arg(name: str, obj: Var | Buffer) -> Var | Buffer:
@@ -608,34 +559,6 @@ def match_buffer(
     return result
 
 
-def sblock(name: str = "", no_realize: bool = False, exec_scope: str = "") -> frame.SBlockFrame:
-    """The sblock declaration statement.
-
-    Parameters
-    ----------
-    name : str
-        The name of the sblock.
-
-    no_realize : bool
-        The flag whether to construct SBlockRealize or SBlock.
-
-    exec_scope : str
-        The execution scope of the block.
-
-    Returns
-    -------
-    res : frame.SBlockFrame
-        The SBlockFrame.
-    """
-    if isinstance(name, list):
-        # tir+
-        return _ffi_api.ScopeSlice(name, no_realize)
-    block_suffix = _get_sblock_name_suffix()
-    if block_suffix and name:
-        name = name + block_suffix
-    return _ffi_api.Block(name, no_realize, exec_scope)  # type: ignore[attr-defined] # pylint: disable=no-member
-
-
 def device_entry() -> None:
     """Mark the device-region entry within the enclosing PrimFunc body.
 
@@ -817,86 +740,6 @@ def thread_id_in_wg(
     return tuple(ret)
 
 
-def init() -> frame.BlockInitFrame:
-    """The block initialization statement.
-
-    Returns
-    -------
-    res : frame.BlockInitFrame
-        The BlockInitFrame.
-    """
-    return _ffi_api.Init()  # type: ignore[attr-defined] # pylint: disable=no-member
-
-
-def where(predicate: Expr | int) -> None:
-    """The block predicate statement.
-
-    Parameters
-    ----------
-    predicate : Union[Expr, Literal[0, 1]]
-        The predicate condition.
-    """
-    if isinstance(predicate, bool):
-        predicate = IntImm("bool", predicate)
-    if isinstance(predicate, int):
-        if predicate in [0, 1]:
-            predicate = IntImm("bool", predicate)
-        else:
-            raise ValueError(f"Invalid value for predicate: {predicate}")
-    _ffi_api.Where(predicate)  # type: ignore[attr-defined] # pylint: disable=no-member
-
-
-def reads(*buffer_slices: list[TensorRegion | TensorLoad]) -> None:
-    """The block buffer region reading statement.
-
-    Parameters
-    ----------
-    buffer_slices : List[Union[TensorRegion, TensorLoad]]
-        The array of buffer regions to read.
-    """
-    if len(buffer_slices) == 1:
-        if isinstance(buffer_slices[0], tuple):
-            buffer_slices = list(buffer_slices[0])
-        elif isinstance(buffer_slices[0], list):
-            buffer_slices = buffer_slices[0]  # type: ignore[assignment]
-        else:
-            buffer_slices = [buffer_slices[0]]
-    else:
-        buffer_slices = list(buffer_slices)  # type: ignore[assignment]
-    _ffi_api.Reads(buffer_slices)  # type: ignore[attr-defined] # pylint: disable=no-member
-
-
-def writes(*buffer_slices: list[TensorRegion | TensorLoad]) -> None:
-    """The block buffer region writing statement.
-
-    Parameters
-    ----------
-    buffer_slices : List[Union[TensorRegion, TensorLoad]]
-        The array of buffer regions to write.
-    """
-    if len(buffer_slices) == 1:
-        if isinstance(buffer_slices[0], tuple):
-            buffer_slices = list(buffer_slices[0])
-        elif isinstance(buffer_slices[0], list):
-            buffer_slices = buffer_slices[0]  # type: ignore[assignment]
-        else:
-            buffer_slices = [buffer_slices[0]]
-    else:
-        buffer_slices = list(buffer_slices)  # type: ignore[assignment]
-    _ffi_api.Writes(buffer_slices)  # type: ignore[attr-defined] # pylint: disable=no-member
-
-
-def sblock_attr(attrs: dict[str, Any]) -> None:
-    """The block annotation statement (for non-tirx SBlock usage).
-
-    Parameters
-    ----------
-    attrs : Dict[str, Any]
-        The annotation of the block.
-    """
-    return _ffi_api.BlockAttrs(attrs)  # type: ignore[attr-defined] # pylint: disable=no-member
-
-
 @_mutable_cell_decl("T.alloc_buffer")
 def alloc_buffer(
     shape: list[Expr] | tuple[Expr] | Expr | Integral,
@@ -918,8 +761,6 @@ def alloc_buffer(
 
         buf = T.alloc_buffer((128, 128))
 
-    For SBlock-level buffer allocation (added to SBlock.alloc_buffers),
-    use T.sblock_alloc_buffer() instead.
 
     Parameters
     ----------
@@ -1011,248 +852,6 @@ def wg_reg_tile(elem_per_thread: int, dtype: str = "float32") -> Buffer:
     )
 
 
-def sblock_alloc_buffer(
-    shape: list[Expr] | tuple[Expr] | Expr | Integral,
-    dtype: str = "float32",
-    data: Var = None,
-    strides: list[Expr] | None = None,
-    elem_offset: Expr = None,
-    scope: str = "global",
-    align: int = -1,
-    offset_factor: int = 0,
-    layout: str | Layout | None = "default",
-    allocated_addr: int | tuple[int, ...] | None = None,
-) -> Buffer:
-    """SBlock-level buffer allocation function.
-
-    Parameters
-    ----------
-    shape : Union[List[Expr], Tuple[Expr], Expr, Integral]
-        The type of the buffer prior to flattening.
-    dtype : str
-        The data type in the content of the buffer.
-    data : Var
-        The pointer to the head of the data.
-    strides : List[Expr]
-        The strides of each dimension.
-    elem_offset : Expr
-        The offset in terms of number of dtype elements (including lanes).
-    scope : str
-        The optional storage scope of buffer data pointer.
-    align : int
-        The alignment requirement of data pointer in bytes.
-    offset_factor : int
-        The factor of elem_offset field.
-    layout: Optional[Union[str, Layout]]
-        The layout of the buffer.
-
-    allocated_addr: Optional[Union[int, Tuple[int]]]
-        The address of the allocated buffer. Might be multi-dimensional.
-        There can be pooled storage scopes on some devices. For example,
-        the Trainium device has a pooled storage scope for the SRAN buffers. ("trn.sbuf")
-        CUDA has a pooled storage scope for the shared memory ("shared.dyn")
-
-    Returns
-    -------
-    res : Buffer
-        The allocated buffer.
-    """
-    shape = (shape,) if is_prim_expr(shape) or isinstance(shape, Integral) else shape
-    if strides is not None:
-        strides = [Var(s, "int64") if isinstance(s, str) else s for s in strides]
-    else:
-        strides = []
-    if allocated_addr is None:
-        allocated_addr = []
-    if not isinstance(allocated_addr, list | tuple):
-        allocated_addr = [allocated_addr]
-    buf = _ffi_api.SBlockAllocBuffer(  # type: ignore[attr-defined] # pylint: disable=no-member
-        shape,
-        dtype,
-        data,
-        strides,
-        elem_offset,
-        scope,
-        align,
-        offset_factor,
-        _get_layout(layout, shape, scope),
-        allocated_addr,
-    )
-    _record_meta_resource(buf, skip_frames=2)
-    return buf
-
-
-def _as_range(dom: ir.Range | list[Expr]) -> ir.Range:
-    """The range constructor.
-
-    Parameters
-    ----------
-    dom : Union[Range, List[Expr]]
-        The domain.
-
-    Returns
-    -------
-    res : Range
-        The Range.
-    """
-    if isinstance(dom, ir.Range):
-        return dom
-    if isinstance(dom, list | tuple):
-        from tvm.sym import Analyzer  # pylint: disable=import-outside-toplevel
-
-        extent = Analyzer().simplify(dom[1] - dom[0])
-        if isinstance(extent, tir.IntImm):
-            return ir.Range.from_min_extent(dom[0], extent)
-        return ir.Range(dom[0], dom[1])
-    if is_prim_expr(dom):
-        return ir.Range(IntImm(dom.ty, 0), dom)
-    return ir.Range(0, dom)
-
-
-class axis:  # pylint: disable=invalid-name
-    """The axis class"""
-
-    @staticmethod
-    def spatial(
-        dom: ir.Range | list[Expr] | tuple[Expr],
-        binding: Expr,
-        dtype: str = "int32",
-    ) -> Var:
-        """The spatial block axis defining function.
-
-        Parameters
-        ----------
-        dom : Union[Range, List[Expr], Tuple[Expr]]
-            The domain of the iteration variable.
-
-        binding : Expr
-            The binding value of the iteration variable.
-
-        dtype : str
-            The data type of the iteration variable.
-
-        Returns
-        -------
-        res : Var
-            The iteration variable.
-        """
-        return _ffi_api.AxisSpatial(  # type: ignore[attr-defined] # pylint: disable=no-member
-            _as_range(dom), binding, dtype
-        )
-
-    @staticmethod
-    def reduce(
-        dom: ir.Range | list[Expr] | tuple[Expr],
-        binding: Expr,
-        dtype: str = "int32",
-    ) -> Var:
-        """The reduced block axis defining function.
-
-        Parameters
-        ----------
-        dom : Union[Range, List[Expr], Tuple[Expr]]
-            The domain of the iteration variable.
-
-        binding : Expr
-            The binding value of the iteration variable.
-
-        dtype : str
-            The data type of the iteration variable.
-
-        Returns
-        -------
-        res : Var
-            The iteration variable.
-        """
-        return _ffi_api.AxisReduce(  # type: ignore[attr-defined] # pylint: disable=no-member
-            _as_range(dom), binding, dtype
-        )
-
-    @staticmethod
-    def scan(
-        dom: ir.Range | list[Expr] | tuple[Expr],
-        binding: Expr,
-        dtype: str = "int32",
-    ) -> Var:
-        """The scanning block axis defining function.
-
-        Parameters
-        ----------
-        dom : Union[Range, List[Expr], Tuple[Expr]]
-            The domain of the iteration variable.
-
-        binding : Expr
-            The binding value of the iteration variable.
-
-        dtype : str
-            The data type of the iteration variable.
-
-        Returns
-        -------
-        res : Var
-            The iteration variable.
-        """
-        return _ffi_api.AxisScan(  # type: ignore[attr-defined] # pylint: disable=no-member
-            _as_range(dom), binding, dtype
-        )
-
-    @staticmethod
-    def opaque(
-        dom: ir.Range | list[Expr] | tuple[Expr],
-        binding: Expr,
-        dtype: str = "int32",
-    ) -> Var:
-        """The opaque block axis defining function.
-
-        Parameters
-        ----------
-        dom : Union[Range, List[Expr], Tuple[Expr]]
-            The domain of the iteration variable.
-
-        binding : Expr
-            The binding value of the iteration variable.
-
-        dtype : str
-            The data type of the iteration variable.
-
-        Returns
-        -------
-        res : Var
-            The iteration variable.
-        """
-        return _ffi_api.AxisOpaque(  # type: ignore[attr-defined] # pylint: disable=no-member
-            _as_range(dom), binding, dtype
-        )
-
-    @staticmethod
-    def remap(kinds: str, bindings: list[Expr], dtype: str = "int32") -> list[Var] | Var:
-        """The block axis remapping function.
-
-        Parameters
-        ----------
-        kinds : str
-            The types of the iteration variables.
-
-        bindings : List[Expr]
-            The binding values of the iteration variables.
-
-        dtype : str
-            The data types of the iteration variables.
-
-        Returns
-        -------
-        res : Var
-            The iteration variables.
-        """
-        iter_vars = _ffi_api.AxisRemap(  # type: ignore[attr-defined] # pylint: disable=no-member
-            kinds, bindings, dtype
-        )
-        return iter_vars[0] if len(iter_vars) == 1 else iter_vars
-
-    S = spatial  # pylint: disable=invalid-name
-    R = reduce  # pylint: disable=invalid-name
-
-
 def serial(
     start: Expr,
     stop: Expr = None,
@@ -3412,17 +3011,8 @@ __all__ = [
     "func_ret",
     "Tuple",
     "match_buffer",
-    "sblock",
-    "block_name_suffix_context",
-    "init",
-    "where",
-    "reads",
-    "writes",
-    "sblock_attr",
     "alloc_buffer",
-    "sblock_alloc_buffer",
     "wg_reg_tile",
-    "axis",
     "serial",
     "parallel",
     "vectorized",
diff --git a/python/tvm/tirx/script/ir_builder/parser_protocol.py b/python/tvm/tirx/script/ir_builder/parser_protocol.py
index 16ba16145b..0d170dbc54 100644
--- a/python/tvm/tirx/script/ir_builder/parser_protocol.py
+++ b/python/tvm/tirx/script/ir_builder/parser_protocol.py
@@ -236,23 +236,19 @@ def call_global_var_(function: _ir.GlobalVar, args: Sequence[Any]) -> _ir.Expr:
 def function_(
     *,
     private: bool = False,
-    s_tir: bool = False,
     persistent: bool = False,
-    is_stir: bool | None = None,
     decl: bool = False,
     span: _Span = None,
 ) -> _frame.PrimFuncFrame:
     """Implements :func:`tvm.script.ir_builder.parser_protocol.function_`.
 
-    Public private/s_tir/persistent options pass to the native function frame;
-    is_stir supplies the JIT spelling. The same frame supports declaration and body entry.
+    Private/persistent options pass to the native TIRx function frame.
+    The same frame supports declaration and body entry.
     """
-    if is_stir is not None:
-        s_tir = is_stir
     native = (
-        _ffi_api.DeclFunction(private, s_tir, persistent)
+        _ffi_api.DeclFunction(private, persistent)
         if decl
-        else _native.prim_func(private=private, s_tir=s_tir, persistent=persistent)
+        else _native.prim_func(private=private, persistent=persistent)
     )
     return _base.at_(span, native)
 
@@ -267,22 +263,6 @@ def arg(name: str, annotation: Any, *, span: _Span = None) -> _ir.Var:
         annotation = resolve_type_var_(name, annotation, span=span)
     elif isinstance(annotation, _ir.Type):
         annotation = _ir.Var(name, annotation)
-    if _tir.is_buffer_var(annotation) and annotation.ty.layout is not None:
-        frames = _IRBuilder.current().frames
-        if _python.any(isinstance(frame, _frame.PrimFuncFrame) and frame.s_tir for frame in frames):
-            ty = annotation.ty
-            annotation = _native.buffer(
-                ty.shape,
-                ty.dtype,
-                strides=ty.strides,
-                elem_offset=ty.elem_offset,
-                scope=ty.storage_scope,
-                align=ty.data_alignment,
-                offset_factor=ty.offset_factor,
-                layout=None,
-                allocated_addr=list(ty.allocated_addr),
-                buffer_name=name,
-            )
     return _native.arg(name, _base.at_(span, annotation))
 
 
@@ -302,55 +282,22 @@ def func_ret_type(annotation: Any, *, span: _Span = None) -> None:
 
 
 def check_well_formed_(function: _tir.PrimFunc) -> None:
-    """Validate a completed TIRx function.
-
-    Parameters
-    ----------
-    function : tvm.tirx.PrimFunc
-        Completed function to validate, without changing its IR.
-
-    Raises
-    ------
-    ValueError
-        If the function fails language variant validation.
-
-    Notes
-    -----
-    See :func:`tvm.script.ir_builder.parser_protocol.check_well_formed_`
-    for the shared whole-module validation coordinator.
-
-    The completed native function owns semantic loop and IR validation.
-    Module-wide S-TIR and TIRx checks are supplied separately to the root coordinator.
-    """
-    from tvm import s_tir
-
-    message = (
-        "Program is not well-formed. If this is deliberate, set "
-        "check_well_formed=False in the top-level decorator."
-    )
+    """Validate a completed TIRx function."""
     try:
-        s_tir.analysis.verify_well_formed(_ir.IRModule.from_expr(function))
-        if not function.attrs.get("s_tir", False):
-            _tir.analysis.verify_tirx_well_formed(function)
+        _tir.analysis.verify_well_formed(function)
+        _tir.analysis.verify_tirx_well_formed(function)
     except Exception as error:
-        raise ValueError(f"{message}\n{error}") from error
+        raise ValueError(
+            "Program is not well-formed. If this is deliberate, set "
+            f"check_well_formed=False in the top-level decorator.\n{error}"
+        ) from error
 
 
 def _check_module_well_formed(module: _ir.IRModule) -> None:
-    """Own completed-module S-TIR checks and primitive-function eligibility."""
-    from tvm import s_tir
-
-    message = (
-        "Program is not well-formed. If this is deliberate, set "
-        "check_well_formed=False in the top-level decorator."
-    )
-    try:
-        s_tir.analysis.verify_well_formed(module)
-        for function in module.functions.values():
-            if isinstance(function, _tir.PrimFunc) and not function.attrs.get("s_tir", False):
-                _tir.analysis.verify_tirx_well_formed(function)
-    except Exception as error:
-        raise ValueError(f"{message}\n{error}") from error
+    """Validate completed functions belonging to the TIRx dialect."""
+    for function in module.functions.values():
+        if isinstance(function, _tir.PrimFunc) and function.is_tirx:
+            check_well_formed_(function)
 
 
 # --------------------------------------
... 111562 lines suppressed ...