aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsomov <somov@yandex-team.com>2024-10-20 18:41:57 +0300
committersomov <somov@yandex-team.com>2024-10-20 18:53:48 +0300
commitb0bc2c1c4133672df26abbb33009223d370704ab (patch)
treeccad0bb0cf8305c0bda613fee5d74a4ee40817bc
parente36aa48cf1a20abbfa2a921748f3f1a32b7000be (diff)
downloadydb-b0bc2c1c4133672df26abbb33009223d370704ab.tar.gz
Introduce CUDA_DEVICE_LINK_LIBRARY
commit_hash:7b188b7472202555da5b6607b32737377294e2a6
-rw-r--r--build/conf/linkers/ld.conf3
-rw-r--r--build/ymake.core.conf14
2 files changed, 15 insertions, 2 deletions
diff --git a/build/conf/linkers/ld.conf b/build/conf/linkers/ld.conf
index afaaa1cb42..df576648f3 100644
--- a/build/conf/linkers/ld.conf
+++ b/build/conf/linkers/ld.conf
@@ -340,7 +340,8 @@ SWIG_DLL_JAR_CMD=\
$REAL_SWIG_DLL_JAR_CMD && \
$DWARF_COMMAND
-_LD_TAIL_LINK_LIB=$AUTO_INPUT ${hide;kv:"p AR"} $TOOLCHAIN_ENV ${hide;kv:"pc light-red"} ${hide;kv:"show_out"}
+_LD_LINK_LIB_EXTRA_INPUT=
+_LD_TAIL_LINK_LIB=$AUTO_INPUT $_LD_LINK_LIB_EXTRA_INPUT ${hide;kv:"p AR"} $TOOLCHAIN_ENV ${hide;kv:"pc light-red"} ${hide;kv:"show_out"}
_LD_ARCHIVER=$YMAKE_PYTHON ${input:"build/scripts/link_lib.py"} ${quo:AR_TOOL} $AR_TYPE $_LD_LLVM_AR_FORMAT $ARCADIA_BUILD_ROOT $_LD_AR_PLUGIN
_LD_LIB_GENERATE_MF=$GENERATE_MF &&
when ($TIDY == "yes") {
diff --git a/build/ymake.core.conf b/build/ymake.core.conf
index 79ad503dea..1ef0d53978 100644
--- a/build/ymake.core.conf
+++ b/build/ymake.core.conf
@@ -4083,13 +4083,25 @@ macro CUDA_NVCC_FLAGS(Flags...) {
SET_APPEND(CUDA_NVCC_FLAGS $Flags)
}
+CUDA_DEVICE_LINK_LIBRARY_CMD=$NVCC_OLD $NVCC_FLAGS -o ${output;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:"devlink"} -dlink ${input:_NVCC_DEVICE_SRCS} -I$CUDA_TARGET_ROOT/include --compiler-options ${join= :C_FLAGS_PLATFORM} $NVCC_ENV ${hide;kv:"p DL"} ${hide;kv:"pc light-blue"} && $LINK_LIB
+
+### @usage: CUDA_DEVICE_LINK_LIBRARY()
+###
+### The LIBRARY() module with an additional step with CUDA device linking.
+### Use [NVCC_DEVICE_LINK](#macro_NVCC_DEVICE_LINK) macro to specify sources for device link.
+module CUDA_DEVICE_LINK_LIBRARY: LIBRARY {
+ SET(_LD_LINK_LIB_EXTRA_INPUT ${output;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:"devlink"})
+ .CMD=$CUDA_DEVICE_LINK_LIBRARY_CMD
+}
+
# tag:flags
### @usage: NVCC_DEVICE_LINK(file.cu...)
### Run nvcc --device-link on objects compiled from srcs with --device-c.
### This generates a stub object devlink.o that supplies missing pieces for the
### host linker to link relocatable device objects into the final executable.
+### This macro can be used only with [CUDA_DEVICE_LINK_LIBRARY](#module_CUDA_DEVICE_LINK_LIBRARY) module.
macro NVCC_DEVICE_LINK(Srcs...) {
- .CMD=$NVCC_OLD $NVCC_FLAGS -o ${output;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:"devlink"} -dlink ${input;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:Srcs} -I$CUDA_TARGET_ROOT/include --compiler-options ${quo:C_FLAGS_PLATFORM} $NVCC_ENV ${hide;kv:"p DL"} ${hide;kv:"pc light-blue"}
+ SET_APPEND(_NVCC_DEVICE_SRCS ${suf=${OBJ_SUF}${NVCC_OBJ_EXT}:Srcs})
.PEERDIR=build/platform/cuda
}