Skip to content

[REFACTOR][TARGET] Cleanup backend target registration#19759

Merged
spectrometerHBH merged 1 commit into
apache:mainfrom
tqchen:tvm-backend-target-registration-cleanup
Jun 14, 2026
Merged

[REFACTOR][TARGET] Cleanup backend target registration#19759
spectrometerHBH merged 1 commit into
apache:mainfrom
tqchen:tvm-backend-target-registration-cleanup

Conversation

@tqchen

@tqchen tqchen commented Jun 14, 2026

Copy link
Copy Markdown
Member

The backend reorg leaves target-kind and op registration behind generic register.cc shims, which makes the new layout harder to navigate and keeps a few obsolete target paths alive. This change keeps backend registration beside the backend definitions while preserving the existing static initialization behavior.

Backend target-kind registration units now use semantic target_kind.cc names, target builtin registration is colocated with the CUDA, Metal, and Trainium builtin definitions, the NVPTX intrinsic rules live with CUDA LLVM codegen, and the unused target/opt placeholder is removed.

The backend reorg leaves target-kind and op registration behind generic register.cc shims, which makes the new layout harder to navigate and keeps a few obsolete target paths alive. This change keeps backend registration beside the backend definitions while preserving the existing static initialization behavior.

Backend target-kind registration units now use semantic target_kind.cc names, target builtin registration is colocated with the CUDA, Metal, and Trainium builtin definitions, the NVPTX intrinsic rules live with CUDA LLVM codegen, and the unused target/opt placeholder is removed.

@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 refactors backend static registration across multiple targets (CUDA, Hexagon, Metal, OpenCL, ROCm, Trainium, Vulkan, and WebGPU) by renaming registration files to target_kind.cc and moving target builtin registration blocks directly into their respective target_builtin.cc files. Feedback points out a critical build issue where the relocated intrin_rule_nvptx.cc file is excluded from compilation due to non-recursive globbing in CMakeLists.txt, and suggests adding the new path to the source list.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread CMakeLists.txt
src/backend/trn/op/*.cc
src/backend/trn/transform/*.cc
src/backend/vulkan/codegen/register.cc
src/backend/vulkan/codegen/target_kind.cc

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.

high

The file src/target/llvm/intrin_rule_nvptx.cc has been renamed to src/backend/cuda/codegen/llvm/intrin_rule_nvptx.cc. However, because CMakeLists.txt only globs src/backend/cuda/codegen/*.cc (non-recursively), and cmake/modules/LLVM.cmake likely only globs src/target/llvm/*.cc, this file is now excluded from the build. To ensure the NVPTX intrinsic rules are compiled, we should add src/backend/cuda/codegen/llvm/*.cc to the CODEGEN_SRCS list.

  src/backend/cuda/codegen/llvm/*.cc
  src/backend/vulkan/codegen/target_kind.cc

@spectrometerHBH spectrometerHBH merged commit 8b79dfd into apache:main Jun 14, 2026
9 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