[libc-commits] [PATCH] D145912: [libc] Set the stub filename to the target name instead of the source

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Mar 13 12:53:29 PDT 2023


sivachandra accepted this revision.
sivachandra added inline comments.
This revision is now accepted and ready to land.


================
Comment at: libc/cmake/modules/LLVMLibCObjectRules.cmake:87
 
-  # The packaged version will be built for every target GPU architecture. We do
-  # this so we can support multiple accelerators on the same machine.
-  foreach(gpu_arch ${LIBC_GPU_ARCHITECTURES})
-    set(gpu_target_name ${fq_target_name}.${gpu_arch})
-    set(compile_options ${ADD_GPU_OBJ_COMPILE_OPTIONS})
-    # Derive the triple from the specified architecture.
-    if("${gpu_arch}" IN_LIST all_amdgpu_architectures)
-      set(gpu_target_triple "amdgcn-amd-amdhsa")
-      list(APPEND compile_options "-mcpu=${gpu_arch}")
-    elseif("${gpu_arch}" IN_LIST all_nvptx_architectures)
-      set(gpu_target_triple "nvptx64-nvidia-cuda")
-      list(APPEND compile_options "-march=${gpu_arch}")
-    else()
-      message(FATAL_ERROR "Unknown GPU architecture '${gpu_arch}'")
-    endif()
-    list(APPEND compile_options "--target=${gpu_target_triple}")
-    list(APPEND compile_options "-emit-llvm")
-
-    # Build the library for this target architecture. We always emit LLVM-IR for
-    # packaged GPU binaries.
-    add_library(${gpu_target_name}
-      EXCLUDE_FROM_ALL
-      OBJECT
-      ${ADD_GPU_OBJ_SRCS}
-      ${ADD_GPU_OBJ_HDRS}
-    )
-
-    target_compile_options(${gpu_target_name} PRIVATE ${compile_options})
-    target_include_directories(${gpu_target_name} PRIVATE ${include_dirs})
-    target_compile_definitions(${gpu_target_name} PRIVATE LIBC_COPT_PUBLIC_PACKAGING)
-    if(ADD_GPU_OBJ_DEPENDS)
-      add_dependencies(${gpu_target_name} ${ADD_GPU_OBJ_DEPENDS})
-    endif()
+  foreach(ADD_GPU_OBJ_SRC ${ADD_GPU_OBJ_SRCS})
+    # The packaged version will be built for every target GPU architecture. We do
----------------
Nit: Local vars are given names in the lower case `snake_case` style. So, here, it could just be `gpu_obj_src`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145912/new/

https://reviews.llvm.org/D145912



More information about the libc-commits mailing list