clang-hipify -> hipify-clang. Also attempt to build it by default
Change-Id: I694e6c772f5347c820d9bd6c9aa61d6d9696911e
[ROCm/clr commit: 11fd56ed5d]
This commit is contained in:
@@ -123,12 +123,10 @@ if(NOT DEFINED HIP_LIB_TYPE)
|
|||||||
endif()
|
endif()
|
||||||
add_to_config(_buildInfo HIP_LIB_TYPE)
|
add_to_config(_buildInfo HIP_LIB_TYPE)
|
||||||
|
|
||||||
# Check if we need to build clang hipify
|
# Check if we need to build hipify-clang
|
||||||
if(NOT DEFINED BUILD_CLANG_HIPIFY)
|
if(NOT DEFINED HIPIFY_CLANG_LLVM_DIR)
|
||||||
if(NOT DEFINED ENV{BUILD_CLANG_HIPIFY})
|
if(DEFINED ENV{HIPIFY_CLANG_LLVM_DIR})
|
||||||
set(BUILD_CLANG_HIPIFY 0)
|
set(HIPIFY_CLANG_LLVM_DIR $ENV{HIPIFY_CLANG_LLVM_DIR})
|
||||||
else()
|
|
||||||
set(BUILD_CLANG_HIPIFY $ENV{BUILD_CLANG_HIPIFY})
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -149,9 +147,7 @@ add_to_config(_buildInfo COMPILE_HIP_ATP_MARKER)
|
|||||||
add_custom_target(update_build_and_version_info ALL COMMAND make rebuild_cache)
|
add_custom_target(update_build_and_version_info ALL COMMAND make rebuild_cache)
|
||||||
|
|
||||||
# Build clang hipify if enabled
|
# Build clang hipify if enabled
|
||||||
if(BUILD_CLANG_HIPIFY)
|
add_subdirectory(hipify-clang)
|
||||||
add_subdirectory(clang-hipify)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Build hip_hcc if platform is hcc
|
# Build hip_hcc if platform is hcc
|
||||||
if(HIP_PLATFORM STREQUAL "hcc")
|
if(HIP_PLATFORM STREQUAL "hcc")
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.8)
|
|
||||||
project(hipify-clang)
|
|
||||||
|
|
||||||
# Find LLVM package
|
|
||||||
find_package(LLVM 3.8 QUIET PATHS ${LLVM_DIR} NO_DEFAULT_PATH)
|
|
||||||
if (NOT ${LLVM_FOUND})
|
|
||||||
message(FATAL_ERROR "Don't know where to find LLVM (v3.8) package. Please specify absolute path using -DLLVM_DIR")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH ${LLVM_CMAKE_DIR})
|
|
||||||
include(AddLLVM)
|
|
||||||
|
|
||||||
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
|
|
||||||
|
|
||||||
include_directories(${LLVM_INCLUDE_DIRS})
|
|
||||||
link_directories(${LLVM_LIBRARY_DIRS})
|
|
||||||
add_definitions(${LLVM_DEFINITIONS})
|
|
||||||
add_llvm_executable(hipify-clang src/Cuda2Hip.cpp )
|
|
||||||
find_program(LIT_COMMAND lit)
|
|
||||||
|
|
||||||
# Link against LLVM and CLANG tools libraries
|
|
||||||
target_link_libraries(hipify-clang
|
|
||||||
clangASTMatchers
|
|
||||||
clangFrontend
|
|
||||||
clangTooling
|
|
||||||
clangParse
|
|
||||||
clangSerialization
|
|
||||||
clangSema
|
|
||||||
clangEdit
|
|
||||||
clangLex
|
|
||||||
clangAnalysis
|
|
||||||
clangDriver
|
|
||||||
clangAST
|
|
||||||
clangToolingCore
|
|
||||||
clangRewrite
|
|
||||||
clangBasic
|
|
||||||
LLVMProfileData
|
|
||||||
LLVMSupport
|
|
||||||
LLVMMCParser
|
|
||||||
LLVMMC
|
|
||||||
LLVMBitReader
|
|
||||||
LLVMOption
|
|
||||||
LLVMCore)
|
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread -fno-rtti -fvisibility-inlines-hidden")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHIPIFY_CLANG_RES=\\\"${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}\\\"")
|
|
||||||
|
|
||||||
install(TARGETS hipify-clang
|
|
||||||
DESTINATION bin)
|
|
||||||
|
|
||||||
# tests
|
|
||||||
set(Python_ADDITIONAL_VERSIONS 2.7)
|
|
||||||
include(FindPythonInterp)
|
|
||||||
if( NOT PYTHONINTERP_FOUND )
|
|
||||||
message(FATAL_ERROR
|
|
||||||
"Unable to find Python interpreter, required for builds and testing\n\n"
|
|
||||||
"Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} )
|
|
||||||
|
|
||||||
configure_file(
|
|
||||||
${CMAKE_SOURCE_DIR}/tests/clang-hipify/lit.site.cfg.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/tests/clang-hipify/lit.site.cfg
|
|
||||||
@ONLY)
|
|
||||||
|
|
||||||
add_lit_testsuite(test-hipify "Running HIPify regression tests"
|
|
||||||
${CMAKE_SOURCE_DIR}/tests/clang-hipify
|
|
||||||
PARAMS site_config=${CMAKE_CURRENT_BINARY_DIR}/tests/clang-hipify/lit.site.cfg
|
|
||||||
DEPENDS hipify-clang lit
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(test-clang-hipify)
|
|
||||||
add_dependencies(test-clang-hipify test-hipify)
|
|
||||||
set_target_properties(test-clang-hipify PROPERTIES FOLDER "Tests")
|
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
cmake_minimum_required(VERSION 2.8.8)
|
||||||
|
project(hipify-clang)
|
||||||
|
|
||||||
|
# Find LLVM package
|
||||||
|
find_package(LLVM 3.8 QUIET PATHS ${HIPIFY_CLANG_LLVM_DIR} NO_DEFAULT_PATH)
|
||||||
|
if (NOT ${LLVM_FOUND})
|
||||||
|
message(STATUS "hipify-clang will not be built. To build it please specify absolute path to LLVM (v3.8) package using -DHIPIFY_CLANG_LLVM_DIR")
|
||||||
|
else()
|
||||||
|
list(APPEND CMAKE_MODULE_PATH ${LLVM_CMAKE_DIR})
|
||||||
|
include(AddLLVM)
|
||||||
|
|
||||||
|
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
|
||||||
|
|
||||||
|
include_directories(${LLVM_INCLUDE_DIRS})
|
||||||
|
link_directories(${LLVM_LIBRARY_DIRS})
|
||||||
|
add_definitions(${LLVM_DEFINITIONS})
|
||||||
|
add_llvm_executable(hipify-clang src/Cuda2Hip.cpp)
|
||||||
|
find_program(LIT_COMMAND lit)
|
||||||
|
|
||||||
|
# Link against LLVM and CLANG tools libraries
|
||||||
|
target_link_libraries(hipify-clang
|
||||||
|
clangASTMatchers
|
||||||
|
clangFrontend
|
||||||
|
clangTooling
|
||||||
|
clangParse
|
||||||
|
clangSerialization
|
||||||
|
clangSema
|
||||||
|
clangEdit
|
||||||
|
clangLex
|
||||||
|
clangAnalysis
|
||||||
|
clangDriver
|
||||||
|
clangAST
|
||||||
|
clangToolingCore
|
||||||
|
clangRewrite
|
||||||
|
clangBasic
|
||||||
|
LLVMProfileData
|
||||||
|
LLVMSupport
|
||||||
|
LLVMMCParser
|
||||||
|
LLVMMC
|
||||||
|
LLVMBitReader
|
||||||
|
LLVMOption
|
||||||
|
LLVMCore)
|
||||||
|
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread -fno-rtti -fvisibility-inlines-hidden")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHIPIFY_CLANG_RES=\\\"${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}\\\"")
|
||||||
|
|
||||||
|
install(TARGETS hipify-clang DESTINATION bin)
|
||||||
|
|
||||||
|
# tests
|
||||||
|
set(Python_ADDITIONAL_VERSIONS 2.7)
|
||||||
|
include(FindPythonInterp)
|
||||||
|
if(NOT PYTHONINTERP_FOUND)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Unable to find Python interpreter, required for builds and testing\n\n"
|
||||||
|
"Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_SOURCE_DIR}/tests/hipify-clang/lit.site.cfg.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/tests/hipify-clang/lit.site.cfg
|
||||||
|
@ONLY)
|
||||||
|
|
||||||
|
add_lit_testsuite(test-hipify "Running HIPify regression tests"
|
||||||
|
${CMAKE_SOURCE_DIR}/tests/hipify-clang
|
||||||
|
PARAMS site_config=${CMAKE_CURRENT_BINARY_DIR}/tests/hipify-clang/lit.site.cfg
|
||||||
|
DEPENDS hipify-clang lit
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target(test-hipify-clang)
|
||||||
|
add_dependencies(test-hipify-clang test-hipify)
|
||||||
|
set_target_properties(test-hipify-clang PROPERTIES FOLDER "Tests")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# vim: ts=4:sw=4:expandtab:smartindent
|
||||||
+2
-2
@@ -25,12 +25,12 @@ tar xvfJ clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz
|
|||||||
|
|
||||||
- Enable build of hipify-clang and specify path to LLVM.
|
- Enable build of hipify-clang and specify path to LLVM.
|
||||||
|
|
||||||
Note LLVM_DIR must be a full absolute path to the location extracted above. Here's an example assuming we extract the clang 3.8 package into ~/HIP/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/
|
Note HIPIFY_CLANG_LLVM_DIR must be a full absolute path to the location extracted above. Here's an example assuming we extract the clang 3.8 package into ~/HIP/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/
|
||||||
```shell
|
```shell
|
||||||
cd HIP
|
cd HIP
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -DBUILD_CLANG_HIPIFY=1 -DLLVM_DIR=~/HIP/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/ -DCMAKE_BUILD_TYPE=Release ..
|
cmake -DHIPIFY_CLANG_LLVM_DIR=~/HIP/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/ -DCMAKE_BUILD_TYPE=Release ..
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
```
|
```
|
||||||
Reference in New Issue
Block a user