Skip to content

[chore][TIR] reorganize src/tir/transforms to src/tir/transform#18738

Merged
tqchen merged 3 commits into
apache:mainfrom
tqchen:transform
Feb 9, 2026
Merged

[chore][TIR] reorganize src/tir/transforms to src/tir/transform#18738
tqchen merged 3 commits into
apache:mainfrom
tqchen:transform

Conversation

@tqchen

@tqchen tqchen commented Feb 9, 2026

Copy link
Copy Markdown
Member

This PR reorganizes src/tir/transforms to src/tir/transform to be consistent with the python namespace.

This PR reorganizes src/tir/transforms to src/tir/transform to be consistent
with the python namespace.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @tqchen, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a significant refactoring effort to standardize the directory naming within the TIR (Tensor IR) component. By renaming the src/tir/transforms directory to src/tir/transform, the codebase achieves better consistency with its Python counterparts. This change primarily impacts file paths in include statements, header guards, and internal documentation, ensuring a more coherent and maintainable project structure.

Highlights

  • Directory Renaming: The primary change involves renaming the src/tir/transforms directory to src/tir/transform to align with the Python namespace conventions.
  • Include Path Updates: Numerous C++ source and header files across the codebase have been updated to reflect the new directory structure, specifically changing #include directives from .../tir/transforms/... to .../tir/transform/....
  • Header Guard Adjustments: For renamed header files, the corresponding include guards (e.g., #ifndef TVM_TIR_TRANSFORMS_...) have been updated to match the new src/tir/transform path.
  • Documentation and Comment Fixes: Documentation files and internal file path comments within some C++ files have been corrected to reference the new directory name.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • docs/arch/pass_infra.rst
    • Updated reference link for unroll_loop.cc to reflect the new src/tir/transform path.
  • src/arith/detect_common_subexpr.cc
    • Updated include path for common_subexpr_elim_tools.h.
  • src/arith/int_constraints.cc
    • Updated include path for ir_utils.h.
  • src/arith/scalable_expression.cc
    • Updated include path for replace_selected_expr.h.
  • src/s_tir/schedule/primitive/block_annotate.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/schedule/primitive/blockize_tensorize.cc
    • Updated include path for simplify.h.
  • src/s_tir/schedule/primitive/cache_index.cc
    • Updated include paths for common_subexpr_elim_tools.h and replace_selected_expr.h.
  • src/s_tir/schedule/primitive/cache_read_write.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/schedule/primitive/decompose_padding.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/schedule/primitive/hide_buffer_access.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/schedule/transform.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/transform/canonicalize_loop.cc
    • Renamed file from src/s_tir/transform/canonicalize_loop.cc to src/s_tir/transform/canonicalize_loop.cc (no change in path, but part of the rename batch).
    • Updated internal file path comment.
  • src/s_tir/transform/compact_buffer_region.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/transform/convert_blocks_to_opaque.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/transform/inject_double_buffer.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/transform/inject_permuted_layout.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/transform/inject_software_pipeline.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/transform/inject_virtual_thread.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/transform/lift_thread_binding.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/transform/loop_partition.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/transform/lower_cross_thread_reduction.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/transform/lower_init_block.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/transform/lower_match_buffer.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/transform/lower_opaque_block.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/transform/memhammer_lower_auto_copy.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/transform/plan_update_buffer_allocation_location.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/transform/transform_mma_buffer_layout.cc
    • Updated include path for ir_utils.h.
  • src/s_tir/transform/unify_thread_binding.cc
    • Updated include path for ir_utils.h.
  • src/script/printer/tir/stmt.cc
    • Updated include path for ir_utils.h.
  • src/target/llvm/codegen_llvm.h
    • Updated include path for ir_utils.h.
  • src/target/source/codegen_c.h
    • Updated include path for ir_utils.h.
  • src/target/source/codegen_cuda.cc
    • Updated include path for ir_utils.h.
  • src/target/spirv/codegen_spirv.cc
    • Updated include path for ir_utils.h.
  • src/te/operation/create_primfunc.cc
    • Updated include path for ir_utils.h.
  • src/tir/analysis/block_access_region_detector.cc
    • Updated include path for ir_utils.h.
  • src/tir/analysis/verify_gpu_code.cc
    • Updated include path for ir_utils.h.
  • src/tir/backend/adreno/inject_texture_alloc.cc
    • Updated include path for ir_utils.h.
  • src/tir/ir/specialize.cc
    • Updated include path for ir_utils.h.
  • src/tir/transform/annotate_device_regions.cc
    • File renamed from src/tir/transforms/annotate_device_regions.cc.
  • src/tir/transform/arg_binder.cc
    • File renamed from src/tir/transforms/arg_binder.cc.
  • src/tir/transform/arg_binder.h
    • File renamed from src/tir/transforms/arg_binder.h.
    • Updated include guards from TVM_TIR_TRANSFORMS_ARG_BINDER_H_ to TVM_TIR_TRANSFORM_ARG_BINDER_H_.
  • src/tir/transform/bind_params.cc
    • File renamed from src/tir/transforms/bind_params.cc.
  • src/tir/transform/bind_target.cc
    • File renamed from src/tir/transforms/bind_target.cc.
  • src/tir/transform/bound_checker.cc
    • File renamed from src/tir/transforms/bound_checker.cc.
  • src/tir/transform/combine_context_call.cc
    • File renamed from src/tir/transforms/combine_context_call.cc.
  • src/tir/transform/common_subexpr_elim.cc
    • File renamed from src/tir/transforms/common_subexpr_elim.cc.
  • src/tir/transform/common_subexpr_elim.h
    • File renamed from src/tir/transforms/common_subexpr_elim.h.
    • Updated include guards from TVM_TIR_TRANSFORMS_COMMON_SUBEXPR_ELIM_H_ to TVM_TIR_TRANSFORM_COMMON_SUBEXPR_ELIM_H_.
  • src/tir/transform/common_subexpr_elim_tools.cc
    • File renamed from src/tir/transforms/common_subexpr_elim_tools.cc.
  • src/tir/transform/common_subexpr_elim_tools.h
    • File renamed from src/tir/transforms/common_subexpr_elim_tools.h.
    • Updated include guards from TVM_TIR_TRANSFORMS_COMMON_SUBEXPR_ELIM_TOOLS_H_ to TVM_TIR_TRANSFORM_COMMON_SUBEXPR_ELIM_TOOLS_H_.
  • src/tir/transform/convert_for_loops_serial.cc
    • File renamed from src/tir/transforms/convert_for_loops_serial.cc.
    • Updated internal file path comment.
  • src/tir/transform/decorate_device_scope.cc
    • File renamed from src/tir/transforms/decorate_device_scope.cc.
  • src/tir/transform/default_gpu_schedule.cc
    • File renamed from src/tir/transforms/default_gpu_schedule.cc.
  • src/tir/transform/dtype_conversion.cc
    • File renamed from src/tir/transforms/dtype_conversion.cc.
  • src/tir/transform/dtype_conversion.h
    • File renamed from src/tir/transforms/dtype_conversion.h.
    • Updated include guards from TVM_TIR_TRANSFORMS_DTYPE_CONVERSION_H_ to TVM_TIR_TRANSFORM_DTYPE_CONVERSION_H_.
  • src/tir/transform/extract_constants.cc
    • File renamed from src/tir/transforms/extract_constants.cc.
  • src/tir/transform/flatten_buffer.cc
    • File renamed from src/tir/transforms/flatten_buffer.cc.
  • src/tir/transform/force_narrow_index_to_i32.cc
    • File renamed from src/tir/transforms/force_narrow_index_to_i32.cc.
  • src/tir/transform/hoist_expression.cc
    • File renamed from src/tir/transforms/hoist_expression.cc.
  • src/tir/transform/inject_ptx_async_copy.cc
    • File renamed from src/tir/transforms/inject_ptx_async_copy.cc.
  • src/tir/transform/inject_ptx_ldg32.cc
    • File renamed from src/tir/transforms/inject_ptx_ldg32.cc.
  • src/tir/transform/inject_rolling_buffer.cc
    • File renamed from src/tir/transforms/inject_rolling_buffer.cc.
  • src/tir/transform/inline_private_functions.cc
    • File renamed from src/tir/transforms/inline_private_functions.cc.
  • src/tir/transform/ir_utils.cc
    • File renamed from src/tir/transforms/ir_utils.cc.
  • src/tir/transform/ir_utils.h
    • File renamed from src/tir/transforms/ir_utils.h.
    • Updated include guards from TVM_TIR_TRANSFORMS_IR_UTILS_H_ to TVM_TIR_TRANSFORM_IR_UTILS_H_.
  • src/tir/transform/lower_async_dma.cc
    • File renamed from src/tir/transforms/lower_async_dma.cc.
  • src/tir/transform/lower_custom_datatypes.cc
    • File renamed from src/tir/transforms/lower_custom_datatypes.cc.
  • src/tir/transform/lower_device_kernel_launch.cc
    • File renamed from src/tir/transforms/lower_device_kernel_launch.cc.
  • src/tir/transform/lower_device_storage_access_info.cc
    • File renamed from src/tir/transforms/lower_device_storage_access_info.cc.
  • src/tir/transform/lower_intrin.cc
    • File renamed from src/tir/transforms/lower_intrin.cc.
  • src/tir/transform/lower_thread_allreduce.cc
    • File renamed from src/tir/transforms/lower_thread_allreduce.cc.
  • src/tir/transform/lower_tvm_builtin.cc
    • File renamed from src/tir/transforms/lower_tvm_builtin.cc.
    • Updated internal file path comment.
  • src/tir/transform/lower_vtcm_alloc.cc
    • File renamed from src/tir/transforms/lower_vtcm_alloc.cc.
  • src/tir/transform/lower_warp_memory.cc
    • File renamed from src/tir/transforms/lower_warp_memory.cc.
  • src/tir/transform/make_packed_api.cc
    • File renamed from src/tir/transforms/make_packed_api.cc.
  • src/tir/transform/make_unpacked_api.cc
    • File renamed from src/tir/transforms/make_unpacked_api.cc.
  • src/tir/transform/merge_shared_memory_allocations.cc
    • File renamed from src/tir/transforms/merge_shared_memory_allocations.cc.
  • src/tir/transform/narrow_datatype.cc
    • File renamed from src/tir/transforms/narrow_datatype.cc.
  • src/tir/transform/primfunc_utils.cc
    • File renamed from src/tir/transforms/primfunc_utils.cc.
  • src/tir/transform/profile_instrumentation.cc
    • File renamed from src/tir/transforms/profile_instrumentation.cc.
  • src/tir/transform/reduce_branching_through_overcompute.cc
    • File renamed from src/tir/transforms/reduce_branching_through_overcompute.cc.
  • src/tir/transform/remap_thread_axis.cc
    • File renamed from src/tir/transforms/remap_thread_axis.cc.
  • src/tir/transform/remove_assume.cc
    • File renamed from src/tir/transforms/remove_assume.cc.
  • src/tir/transform/remove_no_op.cc
    • File renamed from src/tir/transforms/remove_no_op.cc.
  • src/tir/transform/remove_no_op.h
    • File renamed from src/tir/transforms/remove_no_op.h.
    • Updated include guards from TVM_TIR_TRANSFORMS_REMOVE_NO_OP_H_ to TVM_TIR_TRANSFORM_REMOVE_NO_OP_H_.
  • src/tir/transform/remove_store_undef.cc
    • File renamed from src/tir/transforms/remove_store_undef.cc.
  • src/tir/transform/remove_weight_layout_rewrite_block.cc
    • File renamed from src/tir/transforms/remove_weight_layout_rewrite_block.cc.
  • src/tir/transform/renew_defs.cc
    • File renamed from src/tir/transforms/renew_defs.cc.
  • src/tir/transform/renormalize_split_pattern.cc
    • File renamed from src/tir/transforms/renormalize_split_pattern.cc.
  • src/tir/transform/replace_global_vars.cc
    • File renamed from src/tir/transforms/replace_global_vars.cc.
    • Updated internal file path comment.
  • src/tir/transform/replace_selected_expr.cc
    • File renamed from src/tir/transforms/replace_selected_expr.cc.
  • src/tir/transform/replace_selected_expr.h
    • File renamed from src/tir/transforms/replace_selected_expr.h.
    • Updated include guards from TVM_TIR_TRANSFORMS_REPLACE_SELECTED_EXPR_H_ to TVM_TIR_TRANSFORM_REPLACE_SELECTED_EXPR_H_.
  • src/tir/transform/rewrite_unsafe_select.cc
    • File renamed from src/tir/transforms/rewrite_unsafe_select.cc.
  • src/tir/transform/simplify.cc
    • File renamed from src/tir/transforms/simplify.cc.
    • Updated include path for simplify.h.
  • src/tir/transform/simplify.h
    • File renamed from src/tir/transforms/simplify.h.
    • Updated include guards from TVM_TIR_TRANSFORMS_SIMPLIFY_H_ to TVM_TIR_TRANSFORM_SIMPLIFY_H_.
  • src/tir/transform/skip_assert.cc
    • File renamed from src/tir/transforms/skip_assert.cc.
  • src/tir/transform/split_host_device.cc
    • File renamed from src/tir/transforms/split_host_device.cc.
  • src/tir/transform/storage_access.cc
    • File renamed from src/tir/transforms/storage_access.cc.
  • src/tir/transform/storage_access.h
    • File renamed from src/tir/transforms/storage_access.h.
    • Updated include guards from TVM_TIR_TRANSFORMS_STORAGE_ACCESS_H_ to TVM_TIR_TRANSFORM_STORAGE_ACCESS_H_.
  • src/tir/transform/storage_rewrite.cc
    • File renamed from src/tir/transforms/storage_rewrite.cc.
  • src/tir/transform/tensorcore_infer_fragment.cc
    • File renamed from src/tir/transforms/tensorcore_infer_fragment.cc.
  • src/tir/transform/thread_storage_sync.cc
    • File renamed from src/tir/transforms/thread_storage_sync.cc.
  • src/tir/transform/unroll_loop.cc
    • File renamed from src/tir/transforms/unroll_loop.cc.
  • src/tir/transform/unsupported_dtype_legalize.cc
    • File renamed from src/tir/transforms/unsupported_dtype_legalize.cc.
  • src/tir/transform/update_pointer_storage_scope.cc
    • File renamed from src/tir/transforms/update_pointer_storage_scope.cc.
  • src/tir/transform/update_pointer_storage_scope.h
    • File renamed from src/tir/transforms/update_pointer_storage_scope.h.
    • Updated include guards from TVM_TIR_TRANSFORMS_UPDATE_POINTER_STORAGE_SCOPE_H_ to TVM_TIR_TRANSFORM_UPDATE_POINTER_STORAGE_SCOPE_H_.
  • src/tir/transform/using_assume_to_reduce_branches.cc
    • File renamed from src/tir/transforms/using_assume_to_reduce_branches.cc.
  • src/tir/transform/vectorize_loop.cc
    • File renamed from src/tir/transforms/vectorize_loop.cc.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request reorganizes src/tir/transforms to src/tir/transform to align with the Python namespace. The changes are extensive, involving file renames and path updates across many files. The refactoring appears to be thorough and correct. I've found a couple of minor issues in file comments that you might want to address for consistency.

Comment thread src/s_tir/transform/canonicalize_loop.cc Outdated
Comment thread src/tir/transform/lower_tvm_builtin.cc Outdated
tqchen and others added 2 commits February 9, 2026 09:18
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@tqchen tqchen merged commit c414e4c into apache:main Feb 9, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants