[REFACTOR][TARGET] Cleanup backend target registration#19759
Conversation
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.
There was a problem hiding this comment.
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.
| src/backend/trn/op/*.cc | ||
| src/backend/trn/transform/*.cc | ||
| src/backend/vulkan/codegen/register.cc | ||
| src/backend/vulkan/codegen/target_kind.cc |
There was a problem hiding this comment.
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
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.