Skip to content

Commit 96d5a17

Browse files
committed
[libc] Clean up GPU math implementations
Summary: The math directory likes to do architecture specific implementations of these math functions. For the GPU case it was complicated by the fact that both NVPTX and AMDGPU had to go through the same code paths. Since reworking the GPU target this is no longer the case and we can simply use the same scheme. This patch moves all the old code into two separate directories. This likely results in a net increase in code, but it's easier to reason with.
1 parent 7789fb6 commit 96d5a17

File tree

223 files changed

+3690
-797
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+3690
-797
lines changed

libc/cmake/modules/LLVMLibCObjectRules.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ function(create_entrypoint_object fq_target_name)
307307
${fq_target_name}
308308
PROPERTIES
309309
ENTRYPOINT_NAME ${ADD_ENTRYPOINT_OBJ_NAME}
310-
TARGET_TYPE ${ENTRYPOINT_OBJ_TARGET_TYPE}
310+
TARGET_TYPE ${entrypoint_target_type}
311311
OBJECT_FILE "$<TARGET_OBJECTS:${fq_target_name}>"
312312
CXX_STANDARD ${ADD_ENTRYPOINT_OBJ_CXX_STANDARD}
313313
DEPS "${fq_deps_list}"

libc/src/math/CMakeLists.txt

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
add_subdirectory(generic)
22
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_ARCHITECTURE})
33
add_subdirectory(${LIBC_TARGET_ARCHITECTURE})
4-
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
5-
# TODO: We should split this into 'nvptx' and 'amdgpu' for the GPU build.
6-
add_subdirectory(${LIBC_TARGET_OS})
74
endif()
85

96
function(add_math_entrypoint_object name)
107
# We prefer machine specific implementation if available. Hence we check
118
# that first and return early if we are able to add an alias target for the
129
# machine specific implementation.
1310
get_fq_target_name("${LIBC_TARGET_ARCHITECTURE}.${name}" fq_machine_specific_target_name)
14-
get_fq_target_name("${LIBC_TARGET_OS}.${name}" fq_os_specific_target_name)
1511
if(TARGET ${fq_machine_specific_target_name})
1612
add_entrypoint_object(
1713
${name}
@@ -20,28 +16,6 @@ function(add_math_entrypoint_object name)
2016
.${LIBC_TARGET_ARCHITECTURE}.${name}
2117
)
2218
return()
23-
elseif(TARGET ${fq_os_specific_target_name})
24-
add_entrypoint_object(
25-
${name}
26-
ALIAS
27-
DEPENDS
28-
.${LIBC_TARGET_OS}.${name}
29-
)
30-
return()
31-
endif()
32-
33-
# The GPU optionally depends on vendor libraries. If we emitted one of these
34-
# entrypoints it means the user requested it and we should use it instead.
35-
get_fq_target_name("${LIBC_TARGET_OS}.vendor.${name}" fq_vendor_specific_target_name)
36-
if(TARGET ${fq_vendor_specific_target_name})
37-
add_entrypoint_object(
38-
${name}
39-
ALIAS
40-
DEPENDS
41-
.${LIBC_TARGET_OS}.vendor.${name}
42-
VENDOR
43-
)
44-
return()
4519
endif()
4620

4721
get_fq_target_name("generic.${name}" fq_generic_target_name)

0 commit comments

Comments
 (0)