P4 to Git Change 1414821 by lmoriche@lmoriche_palamida on 2017/05/26 13:04:04
SWDEV-102733 - [OCL-LC-ROCm] Cmake build Write CMakeLists.txt to enable building with and without the DK environment - Update from git. Affected files ... ... //depot/stg/opencl/drivers/opencl/.gitignore#1 add ... //depot/stg/opencl/drivers/opencl/CMakeLists.txt#10 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/CMakeLists.txt#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/CMakeLists.txt#5 edit ... //depot/stg/opencl/drivers/opencl/tools/clinfo/CMakeLists.txt#1 add
This commit is contained in:
@@ -0,0 +1 @@
|
||||
build/
|
||||
@@ -15,6 +15,7 @@ set(CMAKE_MODULE_PATH
|
||||
)
|
||||
|
||||
set(LLVM_INCLUDE_TESTS CACHE BOOL OFF)
|
||||
set(LLVM_BUILD_TOOLS CACHE BOOL OFF)
|
||||
set(LLVM_TARGETS_TO_BUILD "AMDGPU" CACHE STRING "")
|
||||
set(LLVM_ENABLE_PROJECTS CACHE STRING "clang")
|
||||
set(LLVM_BUILD_GLOBAL_ISEL CACHE BOOL OFF)
|
||||
@@ -39,9 +40,9 @@ include_directories(${CMAKE_BINARY_DIR}/compiler/llvm/lib/Target/AMDGPU)
|
||||
|
||||
add_subdirectory(compiler/driver)
|
||||
|
||||
set(AMDGPU_TARGET_TRIPLE "amdgcn-amd-amdhsa-opencl")
|
||||
set(BUILD_HC_LIB CACHE BOOL OFF)
|
||||
set(ROCM_DEVICELIB_INCLUDE_TESTS CACHE BOOL OFF)
|
||||
set(AMDGCN_TARGETS_LIB_LIST "AMDGCN_LIB_TARGETS")
|
||||
add_subdirectory(library/amdgcn)
|
||||
|
||||
add_subdirectory(compiler/lib/loaders/elf/utils/libelf)
|
||||
@@ -50,4 +51,12 @@ add_subdirectory(tools/bc2h)
|
||||
|
||||
find_package(ROCR REQUIRED)
|
||||
add_subdirectory(runtime)
|
||||
|
||||
#set(OPENCL_INCLUDE_DIRS
|
||||
# ${CMAKE_SOURCE_DIR}/api/opencl/khronos/headers
|
||||
# ${CMAKE_SOURCE_DIR}/api/opencl/khronos/headers/opencl2.0)
|
||||
|
||||
add_subdirectory(api/opencl/amdocl)
|
||||
#add_subdirectory(api/opencl/khronos/icd)
|
||||
|
||||
#add_subdirectory(tools/clinfo)
|
||||
|
||||
@@ -1,34 +1,12 @@
|
||||
set(headers
|
||||
irif.amdgcn.inc
|
||||
ockl.amdgcn.inc
|
||||
ocml.amdgcn.inc
|
||||
opencl.amdgcn.inc
|
||||
oclc_unsafe_math_on.amdgcn.inc
|
||||
oclc_unsafe_math_off.amdgcn.inc
|
||||
oclc_finite_only_on.amdgcn.inc
|
||||
oclc_finite_only_off.amdgcn.inc
|
||||
oclc_correctly_rounded_sqrt_on.amdgcn.inc
|
||||
oclc_correctly_rounded_sqrt_off.amdgcn.inc
|
||||
oclc_daz_opt_off.amdgcn.inc
|
||||
oclc_daz_opt_on.amdgcn.inc
|
||||
oclc_isa_version_700.amdgcn.inc
|
||||
oclc_isa_version_701.amdgcn.inc
|
||||
oclc_isa_version_800.amdgcn.inc
|
||||
oclc_isa_version_801.amdgcn.inc
|
||||
oclc_isa_version_802.amdgcn.inc
|
||||
oclc_isa_version_803.amdgcn.inc
|
||||
oclc_isa_version_804.amdgcn.inc
|
||||
oclc_isa_version_810.amdgcn.inc
|
||||
oclc_isa_version_900.amdgcn.inc
|
||||
oclc_isa_version_901.amdgcn.inc
|
||||
)
|
||||
|
||||
foreach(AMDGCN_LIB_TARGET ${AMDGCN_LIB_TARGETS})
|
||||
get_target_property(lib_file_name ${AMDGCN_LIB_TARGET} ARCHIVE_OUTPUT_NAME)
|
||||
list(APPEND headers "${lib_file_name}.amdgcn.inc")
|
||||
endforeach(AMDGCN_LIB_TARGET ${AMDGCN_LIB_TARGETS})
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/loaders/elf/utils/common)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/loaders/elf/utils/libelf)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
|
||||
add_library(oclrocm OBJECT
|
||||
rocprintf.cpp
|
||||
rocprogram.cpp
|
||||
@@ -48,30 +26,25 @@ add_library(oclrocm OBJECT
|
||||
)
|
||||
set_target_properties(oclrocm PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
foreach(header ${headers})
|
||||
string(REGEX REPLACE "([^._-]*)(.*).amdgcn.inc" "${CMAKE_BINARY_DIR}/library/amdgcn/\\1/\\1\\2.lib.bc" bclib ${header})
|
||||
string(REGEX REPLACE ".inc$" "" target ${header})
|
||||
string(REGEX REPLACE "[\\.-]" "_" symbol ${target})
|
||||
string(REGEX REPLACE ".amdgcn.inc$" "" lib_bc ${header})
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/libraries.amdgcn.inc "// Automatically generated file; DO NOT EDIT.\n")
|
||||
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}.inc
|
||||
COMMAND bc2h ${bclib} ${CMAKE_CURRENT_BINARY_DIR}/${target}.inc ${symbol}
|
||||
DEPENDS ${bclib} ${lib_bc}_lib
|
||||
COMMENT "Generating ${target}.inc"
|
||||
foreach(AMDGCN_LIB_TARGET ${AMDGCN_LIB_TARGETS})
|
||||
get_target_property(lib_file_name ${AMDGCN_LIB_TARGET} ARCHIVE_OUTPUT_NAME)
|
||||
get_target_property(lib_file_path ${AMDGCN_LIB_TARGET} ARCHIVE_OUTPUT_DIRECTORY)
|
||||
set(bclib "${lib_file_path}/${lib_file_name}.lib.bc")
|
||||
set(header "${lib_file_name}.amdgcn.inc")
|
||||
set(symbol "${lib_file_name}_amdgcn")
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${header}
|
||||
COMMAND bc2h ${bclib} ${CMAKE_CURRENT_BINARY_DIR}/${header} ${symbol}
|
||||
DEPENDS ${AMDGCN_LIB_TARGET}
|
||||
COMMENT "Generating ${header}"
|
||||
)
|
||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_CURRENT_BINARY_DIR}/${target}.inc)
|
||||
|
||||
add_custom_target(${target}.inc ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${target}.inc)
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${target}.inc PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
add_custom_target(${header} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${header})
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${header} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
|
||||
string(REGEX REPLACE ".amdgcn.inc$" "" lib_bc ${header})
|
||||
endforeach()
|
||||
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/libraries.amdgcn.inc "// Automatically generated file; DO NOT EDIT.\n")
|
||||
|
||||
foreach(file ${headers})
|
||||
string(REGEX REPLACE "(.*).inc$" "#include \"\\1.inc\"" line ${file})
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/libraries.amdgcn.inc "${line}\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/libraries.amdgcn.inc "#include \"${header}\"\n")
|
||||
endforeach()
|
||||
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/libraries.amdgcn.inc
|
||||
|
||||
Reference in New Issue
Block a user