[libc-commits] [libc] 79afb94 - [libc] Make NVPTX benchmarks use LTO for linking
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Sat Jul 27 04:53:24 PDT 2024
Author: Joseph Huber
Date: 2024-07-27T06:53:12-05:00
New Revision: 79afb94da1c508e90945df2f05d9cf80d2942ba1
URL: https://github.com/llvm/llvm-project/commit/79afb94da1c508e90945df2f05d9cf80d2942ba1
DIFF: https://github.com/llvm/llvm-project/commit/79afb94da1c508e90945df2f05d9cf80d2942ba1.diff
LOG: [libc] Make NVPTX benchmarks use LTO for linking
Summary:
Now that we can do LTO, we can make the benchmarks more accurate by
allowing optimization + inlining of the implementation.
Added:
Modified:
libc/benchmarks/gpu/CMakeLists.txt
libc/cmake/modules/LLVMLibCTestRules.cmake
Removed:
################################################################################
diff --git a/libc/benchmarks/gpu/CMakeLists.txt b/libc/benchmarks/gpu/CMakeLists.txt
index 69518acff3a5d..f1aa06a52584b 100644
--- a/libc/benchmarks/gpu/CMakeLists.txt
+++ b/libc/benchmarks/gpu/CMakeLists.txt
@@ -24,6 +24,8 @@ function(add_benchmark benchmark_name)
libc.src.stdio.printf
${BENCHMARK_DEPENDS}
${BENCHMARK_UNPARSED_ARGUMENTS}
+ COMPILE_OPTIONS
+ -flto
)
get_fq_target_name(${benchmark_name} fq_target_name)
set(fq_build_target_name ${fq_target_name}.__build__)
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 96eb065c4a672..a8b0c61d2236a 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -474,6 +474,8 @@ function(add_integration_test test_name)
target_link_options(${fq_build_target_name} PRIVATE
${LIBC_COMPILE_OPTIONS_DEFAULT} -Wno-multi-gpu
"-Wl,--suppress-stack-size-warning"
+ "-Wl,-mllvm,-nvptx-lower-global-ctor-dtor=1"
+ "-Wl,-mllvm,-nvptx-emit-init-fini-kernel"
-march=${LIBC_GPU_TARGET_ARCHITECTURE} -nostdlib -static
"--cuda-path=${LIBC_CUDA_ROOT}")
elseif(LIBC_CC_SUPPORTS_NOSTDLIBPP)
@@ -657,6 +659,8 @@ function(add_libc_hermetic test_name)
target_link_options(${fq_build_target_name} PRIVATE
${LIBC_COMPILE_OPTIONS_DEFAULT} -Wno-multi-gpu
"-Wl,--suppress-stack-size-warning"
+ "-Wl,-mllvm,-nvptx-lower-global-ctor-dtor=1"
+ "-Wl,-mllvm,-nvptx-emit-init-fini-kernel"
-march=${LIBC_GPU_TARGET_ARCHITECTURE} -nostdlib -static
"--cuda-path=${LIBC_CUDA_ROOT}")
elseif(LIBC_CC_SUPPORTS_NOSTDLIBPP)
More information about the libc-commits
mailing list