# Compile policy is owned here; each semantic family explicitly contributes sources.
add_library(shifter_native_ops SHARED)
shifter_native_internal_includes(shifter_native_ops)
shifter_cuda_library(shifter_native_ops)
target_link_libraries(shifter_native_ops PUBLIC shifter_native_core PRIVATE shifter_native_ops_non_rdc)

# Non-RDC kernels keep instruction and register-allocation choices within one translation unit.
# This private PIC archive joins the shared library through host launchers.
add_library(shifter_native_ops_non_rdc STATIC)
shifter_native_internal_includes(shifter_native_ops_non_rdc)
shifter_cuda_non_rdc_archive(shifter_native_ops_non_rdc)
target_link_libraries(shifter_native_ops_non_rdc PRIVATE shifter_native_core CUDA::cudart CUDA::cuda_driver)

target_sources(shifter_native_ops PRIVATE weight_input.cpp)
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/collective/sources.cmake")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/common/sources.cmake")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/elementwise/sources.cmake")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/indexing/sources.cmake")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/embedding/sources.cmake")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/reduction/sources.cmake")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/sampling/sources.cmake")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/sequence/sources.cmake")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/dynamic_grouped_conv/sources.cmake")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/gated_residual/sources.cmake")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/mhc/sources.cmake")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/kv_cache/sources.cmake")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/linear/sources.cmake")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/linear_attention/sources.cmake")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/ple/sources.cmake")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/normalization/sources.cmake")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/rope/sources.cmake")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/softmax_attention/sources.cmake")
target_sources(shifter_native_ops PRIVATE "${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/residual_mix/residual_mix.cu")
target_sources(shifter_native_ops PRIVATE "${SHIFTER_SOURCE_ROOT}/src/shifter/kernels/cuda/sigmoid_topk/sigmoid_topk.cu")
include("${SHIFTER_SOURCE_ROOT}/src/shifter/regions/shared/cuda/moe/sources.cmake")
