Skip to content

Commit

Permalink
migrate to monorepo
Browse files Browse the repository at this point in the history
Change-Id: If8fbc2f4e563582d6178dcf338bd93ddfc50ee02
  • Loading branch information
David Salinas committed Oct 11, 2019
1 parent 326fb1e commit 930f0c3
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 60 deletions.
24 changes: 4 additions & 20 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
[submodule "llvm"]
path = compiler
url = https://github.com/RadeonOpenCompute/llvm.git
branch = amd-common
[submodule "lld"]
path = lld
url = https://github.com/RadeonOpenCompute/lld.git
branch = amd-common
[submodule "clang"]
path = clang
url = https://github.com/RadeonOpenCompute/hcc-clang-upgrade.git
branch = clang_tot_upgrade
[submodule "compiler-rt"]
path = compiler-rt
url = https://github.com/RadeonOpenCompute/compiler-rt
branch = amd-common
[submodule "rocdl"]
path = rocdl
url = http://github.com/RadeonOpenCompute/ROCm-Device-Libs.git
branch = master
[submodule "clang-tools-extra"]
path = clang-tools-extra
url = https://github.com/RadeonOpenCompute/clang-tools-extra.git
branch = amd-common
[submodule "llvm-project"]
path = llvm-project
url = https://github.com/RadeonOpenCompute/llvm-project
branch = amd-stg-open-hcc
34 changes: 17 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ endif()
include (MCWAMP)

# Regression test
set(LLVM_SRC "${PROJECT_SOURCE_DIR}/compiler")
set(LLVM_ROOT "${PROJECT_BINARY_DIR}/compiler")
set(LLVM_SRC "${PROJECT_SOURCE_DIR}/llvm-project/llvm")
set(LLVM_ROOT "${PROJECT_BINARY_DIR}/llvm-project/llvm")

# obtain specific information about llvm setup
SET(LOCAL_LLVM_INCLUDE compiler/include)
SET(LOCAL_LLVM_INCLUDE llvm-project/llvm/include)

# setup compilation environment
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin" )
set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib" )

SET(PROJ_SEARCH_PATH "${PROJECT_BINARY_DIR}/include" "${PROJECT_SOURCE_DIR}/include" "${PROJECT_SOURCE_DIR}/${LOCAL_LLVM_INCLUDE}") # "${PROJECT_SOURCE_DIR}/compiler/utils/unittest/googletest/include" "${PROJECT_BINARY_DIR}/${LOCAL_LLVM_INCLUDE}"
SET(PROJ_SEARCH_PATH "${PROJECT_BINARY_DIR}/include" "${PROJECT_SOURCE_DIR}/include" "${PROJECT_SOURCE_DIR}/${LOCAL_LLVM_INCLUDE}") # "${PROJECT_SOURCE_DIR}/llvm-project/llvm/utils/unittest/googletest/include" "${PROJECT_BINARY_DIR}/${LOCAL_LLVM_INCLUDE}"
include_directories( ${PROJ_SEARCH_PATH} )

LINK_DIRECTORIES( ${LLVM_LIB_DIR} )
Expand Down Expand Up @@ -291,18 +291,18 @@ set(KALMAR_BACKEND "HCC_BACKEND_AMDGPU")
#########################

# build Clang frontend + AMDGPU backend
set(CLANG_SRC_DIR "${PROJECT_SOURCE_DIR}/compiler")
set(CLANG_BIN_DIR "${PROJECT_BINARY_DIR}/compiler")
set(CLANG_SRC_DIR "${PROJECT_SOURCE_DIR}/llvm-project/llvm")
set(CLANG_BIN_DIR "${PROJECT_BINARY_DIR}/llvm-project/llvm")

if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(LLVM_ENABLE_ASSERTIONS "On" CACHE BOOL "Compile with assertion checks enabled")
else ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(LLVM_ENABLE_ASSERTIONS "Off" CACHE BOOL "Compile with assertion checks enabled")
endif ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")

set(LLVM_EXTERNAL_CLANG_SOURCE_DIR "${PROJECT_SOURCE_DIR}/clang")
set(LLVM_EXTERNAL_COMPILER_RT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/compiler-rt")
set(LLVM_EXTERNAL_LLD_SOURCE_DIR "${PROJECT_SOURCE_DIR}/lld")
set(LLVM_EXTERNAL_CLANG_SOURCE_DIR "${PROJECT_SOURCE_DIR}/llvm-project/clang")
set(LLVM_EXTERNAL_COMPILER_RT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/llvm-project/compiler-rt")
set(LLVM_EXTERNAL_LLD_SOURCE_DIR "${PROJECT_SOURCE_DIR}/llvm-project/lld")

# determine LLVM targets to be built
# AMDGPU is always on
Expand All @@ -319,12 +319,12 @@ endif()
set(LLVM_TARGETS_TO_BUILD "AMDGPU" ${LLVM_HOST_TARGET} CACHE STRING "" FORCE)
set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "" FORCE)

if(EXISTS ${PROJECT_SOURCE_DIR}/clang-tools-extra/CMakeLists.txt)
set(LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR "${PROJECT_SOURCE_DIR}/clang-tools-extra")
if(EXISTS ${PROJECT_SOURCE_DIR}/llvm-project/clang-tools-extra/CMakeLists.txt)
set(LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR "${PROJECT_SOURCE_DIR}/llvm-project/clang-tools-extra")
endif()

add_subdirectory(${CLANG_SRC_DIR})
get_directory_property(CLANG_VERSION DIRECTORY clang DEFINITION CLANG_VERSION)
get_directory_property(CLANG_VERSION DIRECTORY llvm-project/clang DEFINITION CLANG_VERSION)

install(PROGRAMS $<TARGET_FILE:llvm-as>
$<TARGET_FILE:llvm-dis>
Expand All @@ -335,7 +335,7 @@ install(PROGRAMS $<TARGET_FILE:llvm-as>
$<TARGET_FILE:opt>
$<TARGET_FILE:llc>
DESTINATION bin
COMPONENT compiler)
COMPONENT llvm-project/llvm )

add_custom_target(clang_links DEPENDS clang)
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ppc64le")
Expand All @@ -354,15 +354,15 @@ add_custom_command(TARGET clang_links POST_BUILD
install(PROGRAMS $<TARGET_FILE:LLVMSelectAcceleratorCode>
$<TARGET_FILE:LLVMPromotePointerKernArgsToGlobal>
DESTINATION lib
COMPONENT compiler
COMPONENT llvm-project/llvm
)

# force library install path to lib
set(CMAKE_INSTALL_LIBDIR "lib" CACHE INTERNAL "Installation directory for libraries" FORCE)

install(FILES ${CLANG_BIN_DIR}/lib/clang/${CLANG_VERSION}/lib/linux/libclang_rt.builtins-${RT_BUILTIN_SUFFIX}.a
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT compiler)
COMPONENT llvm-project/llvm)

install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/ImportedTargets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hcc )
Expand All @@ -386,7 +386,7 @@ if (HCC_INTEGRATE_ROCDL)
set(GENERIC_IS_ZERO ON CACHE BOOL ON FORCE)
set(BUILD_HC_LIB ON)
set(AMDGCN_TARGETS_LIB_LIST "AMDGCN_LIB_TARGETS")
find_package(LLVM REQUIRED CONFIG PATHS ${CMAKE_BINARY_DIR}/compiler NO_DEFAULT_PATH)
find_package(LLVM REQUIRED CONFIG PATHS ${CMAKE_BINARY_DIR}/llvm-project/llvm NO_DEFAULT_PATH)

list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
include(AddLLVM)
Expand Down Expand Up @@ -582,7 +582,7 @@ endif ()

set(CPACK_RPM_PACKAGE_REQUIRES "${HCC_GENERAL_RPM_DEP} ${HCC_ROCR_DEP} ${HCC_LIBCXX_RPM_DEP}" )

set(CPACK_COMPONENTS_ALL compiler)
set(CPACK_COMPONENTS_ALL llvm-project/llvm)

include (CPack)
MESSAGE("")
Expand Down
1 change: 0 additions & 1 deletion clang
Submodule clang deleted from a01e2c
1 change: 0 additions & 1 deletion clang-tools-extra
Submodule clang-tools-extra deleted from 6f382a
2 changes: 1 addition & 1 deletion cmake-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

if(NOT CMAKE_CXX_COMPILER MATCHES ".*hcc")
set(CMAKE_CXX_COMPILER "${PROJECT_BINARY_DIR}/compiler/bin/clang++")
set(CMAKE_CXX_COMPILER "${PROJECT_BINARY_DIR}/llvm-project/llvm/bin/clang++")
endif()

add_executable(cmake-test cmake-test.cpp)
Expand Down
1 change: 0 additions & 1 deletion compiler
Submodule compiler deleted from c38780
1 change: 0 additions & 1 deletion compiler-rt
Submodule compiler-rt deleted from ead68a
14 changes: 7 additions & 7 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ target_link_libraries(hccshared INTERFACE -fPIC)
####################
# C++AMP tools
####################
install(PROGRAMS ${PROJECT_BINARY_DIR}/compiler/bin/clamp-device
${PROJECT_BINARY_DIR}/compiler/bin/clamp-embed
${PROJECT_BINARY_DIR}/compiler/bin/clamp-assemble
${PROJECT_BINARY_DIR}/compiler/bin/clamp-link
${PROJECT_BINARY_DIR}/compiler/bin/error-check
${PROJECT_BINARY_DIR}/compiler/bin/hc-kernel-assemble
${PROJECT_BINARY_DIR}/compiler/bin/hc-host-assemble
install(PROGRAMS ${PROJECT_BINARY_DIR}/llvm-project/llvm/bin/clamp-device
${PROJECT_BINARY_DIR}/llvm-project/llvm/bin/clamp-embed
${PROJECT_BINARY_DIR}/llvm-project/llvm/bin/clamp-assemble
${PROJECT_BINARY_DIR}/llvm-project/llvm/bin/clamp-link
${PROJECT_BINARY_DIR}/llvm-project/llvm/bin/error-check
${PROJECT_BINARY_DIR}/llvm-project/llvm/bin/hc-kernel-assemble
${PROJECT_BINARY_DIR}/llvm-project/llvm/bin/hc-host-assemble
DESTINATION bin)

####################
Expand Down
2 changes: 1 addition & 1 deletion lib/clamp-device.in
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ LLD=$BINDIR/ld.lld


HCC_BIN_PATH=$(dirname -- "$(readlink -f -- "$BASH_SOURCE")")
ROCM_DEVICE_LIBS_SEARCH_PATHS="$HCC_BIN_PATH/../../rocdl/lib;$HCC_BIN_PATH/../rocdl/lib;@ROCM_DEVICE_LIB_PATHS@"
ROCM_DEVICE_LIBS_SEARCH_PATHS="$HCC_BIN_PATH/../../../rocdl/lib;$HCC_BIN_PATH/../rocdl/lib;@ROCM_DEVICE_LIB_PATHS@"
ROCM_LIB=""
for SEARCH_PATH in $(echo $ROCM_DEVICE_LIBS_SEARCH_PATHS | tr ";" "\n")
do
Expand Down
1 change: 0 additions & 1 deletion lld
Submodule lld deleted from e5162a
1 change: 1 addition & 0 deletions llvm-project
Submodule llvm-project added at 264ced
2 changes: 1 addition & 1 deletion scripts/cmake/MCWAMP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ include(ImportedTargets)
# with debug information while other parts are not.

macro(amp_target name )
set(CMAKE_CXX_COMPILER "${PROJECT_BINARY_DIR}/compiler/bin/clang++")
set(CMAKE_CXX_COMPILER "${PROJECT_BINARY_DIR}/llvm-project/llvm/bin/clang++")
add_compile_options(-std=c++11)
add_definitions(-DHCC_MAJOR_VERSION=${HCC_VERSION_MAJOR})
add_definitions(-DHCC_MINOR_VERSION=${HCC_VERSION_MINOR})
Expand Down
16 changes: 8 additions & 8 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ file(MAKE_DIRECTORY ${GTEST_LIB_DIR})

# MCWAMP
set(MCWAMP_LIB_DIR "${LIBRARY_OUTPUT_PATH}")
set(MCWAMP_TOOL_DIR "${PROJECT_BINARY_DIR}/compiler/bin")
set(MCWAMP_TOOL_DIR "${PROJECT_BINARY_DIR}/llvm-project/llvm/bin")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
Expand All @@ -25,31 +25,31 @@ configure_file(

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/../lib/clamp-device.in
${CMAKE_CURRENT_BINARY_DIR}/../compiler/bin/clamp-device @ONLY)
${CMAKE_CURRENT_BINARY_DIR}/../llvm-project/llvm/bin/clamp-device @ONLY)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/../lib/clamp-embed.in
${CMAKE_CURRENT_BINARY_DIR}/../compiler/bin/clamp-embed @ONLY)
${CMAKE_CURRENT_BINARY_DIR}/../llvm-project/llvm/bin/clamp-embed @ONLY)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/../lib/clamp-assemble.in
${CMAKE_CURRENT_BINARY_DIR}/../compiler/bin/clamp-assemble @ONLY)
${CMAKE_CURRENT_BINARY_DIR}/../llvm-project/llvm/bin/clamp-assemble @ONLY)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/../lib/error-check.in
${CMAKE_CURRENT_BINARY_DIR}/../compiler/bin/error-check @ONLY)
${CMAKE_CURRENT_BINARY_DIR}/../llvm-project/llvm/bin/error-check @ONLY)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/../lib/hc-kernel-assemble.in
${CMAKE_CURRENT_BINARY_DIR}/../compiler/bin/hc-kernel-assemble @ONLY)
${CMAKE_CURRENT_BINARY_DIR}/../llvm-project/llvm/bin/hc-kernel-assemble @ONLY)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/../lib/hc-host-assemble.in
${CMAKE_CURRENT_BINARY_DIR}/../compiler/bin/hc-host-assemble @ONLY)
${CMAKE_CURRENT_BINARY_DIR}/../llvm-project/llvm/bin/hc-host-assemble @ONLY)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/../lib/clamp-link.in
${CMAKE_CURRENT_BINARY_DIR}/../compiler/bin/clamp-link @ONLY)
${CMAKE_CURRENT_BINARY_DIR}/../llvm-project/llvm/bin/clamp-link @ONLY)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/../lib/extractkernel.in
Expand Down

0 comments on commit 930f0c3

Please sign in to comment.