[compiler-rt][libc][GPU] Fix 7 builtin unit test build failure for spirv64 targets (#236324) When building compiler-rt builtin unit test for spirv64 target, we encountered a bunch of build failure due to missing symbols from libm and libc. This PR adds part of required symbols needed by those tests which can make 7 failed unit tests to build pass. Using following command to build llvm-project: cmake ../llvm -G Ninja -DLLVM_ENABLE_PROJECTS="clang" -DRUNTIMES_spirv64-unknown-unknown_LLVM_ENABLE_RUNTIMES="compiler-rt;libc" -DLLVM_RUNTIME_TARGETS="default;spirv64-unknown-unknown" -DRUNTIMES_spirv64-unknown-unknown_COMPILER_RT_INCLUDE_TESTS=ON -DRUNTIMES_spirv64-unknown-unknown_COMPILER_RT_EMULATOR=/bin/true ninja all ninja check-compiler-rt-spirv64-unknown-unknown Before the fix, the build result was: Total Discovered Tests: 275 Unsupported: 125 (45.45%) Passed : 123 (44.73%) Failed : 27 (9.82%) After the fix, the build result was: Total Discovered Tests: 275 Unsupported: 125 (45.45%) Passed : 128 (46.55%) Failed : 22 (8.00%) All libc and libm symbols added are simple functions without using RPC mechanism and verified for spirv64 targets with Level_Zero and Intel GPU devices on Linux platform. --------- Signed-off-by: jinge90 <ge.jin@intel.com> Co-authored-by: Joseph Huber <huberjn@outlook.com> GitOrigin-RevId: c7233566764726c242ffa2335b0aca9781c57235
diff --git a/config/gpu/spirv/entrypoints.txt b/config/gpu/spirv/entrypoints.txt index 36c9833..5b21d12 100644 --- a/config/gpu/spirv/entrypoints.txt +++ b/config/gpu/spirv/entrypoints.txt
@@ -85,9 +85,27 @@ libc.src.strings.strcasecmp libc.src.strings.strncasecmp + # stdlib.h entrypoints + libc.src.stdlib.abs + libc.src.stdlib.div + libc.src.stdlib.labs + libc.src.stdlib.ldiv + libc.src.stdlib.llabs + libc.src.stdlib.lldiv ) set(TARGET_LIBM_ENTRYPOINTS + # math.h entrypoints + libc.src.math.logbf + # complex.h entrypoints + libc.src.complex.cabs + libc.src.complex.cabsf + libc.src.complex.creal + libc.src.complex.crealf + libc.src.complex.cimag + libc.src.complex.cimagf + libc.src.complex.conj + libc.src.complex.conjf ) if(LIBC_TYPES_HAS_FLOAT16)