mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-14 02:02:46 +00:00
Add an option to build CK with clang directly (#387)
* replace hipcc compiler with clang++
* build client app with hipcc
* build client app with clang
* add an option to build with hipcc ro clang
* fix the environment for client app
* fix setting up compiler in cmake_build
* change the way the compiler is set
[ROCm/composable_kernel commit: 1e5b59df22]
This commit is contained in:
@@ -29,6 +29,11 @@ if(USE_BITINT_EXTENSION_INT4)
|
||||
message("CK compiled with USE_BITINT_EXTENSION_INT4 set to ${USE_BITINT_EXTENSION_INT4}")
|
||||
endif()
|
||||
|
||||
## Threads
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
link_libraries(Threads::Threads)
|
||||
|
||||
## C++
|
||||
enable_language(CXX)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
@@ -78,6 +83,8 @@ if( DEFINED CK_OVERRIDE_HIP_VERSION_PATCH )
|
||||
message(STATUS "CK_HIP_VERSION_PATCH overriden with ${CK_OVERRIDE_HIP_VERSION_PATCH}")
|
||||
endif()
|
||||
message(STATUS "Build with HIP ${HIP_VERSION}")
|
||||
link_libraries(hip::device)
|
||||
add_compile_definitions(__HIP_PLATFORM_HCC__=1)
|
||||
|
||||
## tidy
|
||||
include(EnableCompilerWarnings)
|
||||
@@ -227,6 +234,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
|
||||
include_directories(BEFORE
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${PROJECT_SOURCE_DIR}/library/include
|
||||
${HIP_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
|
||||
|
||||
27
Jenkinsfile
vendored
27
Jenkinsfile
vendored
@@ -23,6 +23,22 @@ def getDockerImageName(){
|
||||
return img
|
||||
}
|
||||
|
||||
def build_compiler(){
|
||||
def compiler
|
||||
if (params.BUILD_COMPILER == "hipcc"){
|
||||
compiler = '/opt/rocm/bin/hipcc'
|
||||
}
|
||||
else{
|
||||
if (params.COMPILER_VERSION == "release"){
|
||||
compiler = "/opt/rocm/llvm/bin/clang++"
|
||||
}
|
||||
else{
|
||||
compiler = "/llvm-project/build/bin/clang++"
|
||||
}
|
||||
}
|
||||
return compiler
|
||||
}
|
||||
|
||||
def getDockerImage(Map conf=[:]){
|
||||
env.DOCKER_BUILDKIT=1
|
||||
def prefixpath = conf.get("prefixpath", "/opt/rocm") // prefix:/opt/rocm
|
||||
@@ -103,7 +119,7 @@ def buildDocker(install_prefix){
|
||||
|
||||
def cmake_build(Map conf=[:]){
|
||||
|
||||
def compiler = conf.get("compiler","/opt/rocm/bin/hipcc")
|
||||
def compiler = build_compiler()
|
||||
def config_targets = conf.get("config_targets","check")
|
||||
def debug_flags = "-g -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=undefined " + conf.get("extradebugflags", "")
|
||||
def build_envs = "CTEST_PARALLEL_LEVEL=4 " + conf.get("build_env","")
|
||||
@@ -185,7 +201,6 @@ def buildHipClangJob(Map conf=[:]){
|
||||
if (conf.get("enforce_xnack_on", false)) {
|
||||
dockerOpts = dockerOpts + " --env HSA_XNACK=1 --env GPU_ARCH='${gpu_arch}' "
|
||||
}
|
||||
//def dockerArgs = "--build-arg PREFIX=${prefixpath} --build-arg GPU_ARCH='${gpu_arch}' --build-arg compiler_version='${params.COMPILER_VERSION}' "
|
||||
def dockerArgs = "--build-arg PREFIX=${prefixpath} --build-arg compiler_version='${params.COMPILER_VERSION}' "
|
||||
if (params.COMPILER_VERSION != "release"){
|
||||
dockerOpts = dockerOpts + " --env HIP_CLANG_PATH='/llvm-project/build/bin' "
|
||||
@@ -467,6 +482,10 @@ pipeline {
|
||||
name: 'COMPILER_VERSION',
|
||||
defaultValue: 'ck-9110',
|
||||
description: 'Specify which version of compiler to use: ck-9110 (default), release, or amd-stg-open.')
|
||||
string(
|
||||
name: 'BUILD_COMPILER',
|
||||
defaultValue: 'hipcc',
|
||||
description: 'Specify whether to build CK with hipcc (default) or with clang.')
|
||||
booleanParam(
|
||||
name: "RUN_FULL_QA",
|
||||
defaultValue: false,
|
||||
@@ -584,8 +603,8 @@ pipeline {
|
||||
{
|
||||
agent{ label rocmnode("gfx908")}
|
||||
environment{
|
||||
setup_args = """ -D -DBUILD_DEV=Off -DCMAKE_INSTALL_PREFIX=../install CMAKE_CXX_FLAGS="--offload-arch=gfx908 -O3 " """
|
||||
execute_args = """ cd ../client_example && rm -rf build && mkdir build && cd build && cmake -DCMAKE_PREFIX_PATH="${env.WORKSPACE}/install;/opt/rocm" -DCMAKE_CXX_COMPILER=/opt/rocm/bin/hipcc .. && make -j """
|
||||
setup_args = """ -DBUILD_DEV=Off -DCMAKE_INSTALL_PREFIX=../install -D CMAKE_CXX_FLAGS="--offload-arch=gfx908 -O3 " """
|
||||
execute_args = """ cd ../client_example && rm -rf build && mkdir build && cd build && cmake -D CMAKE_PREFIX_PATH="${env.WORKSPACE}/install;/opt/rocm" -D CMAKE_CXX_FLAGS=" --offload-arch=gfx908 -O3" -D CMAKE_CXX_COMPILER="${build_compiler()}" .. && make -j """
|
||||
}
|
||||
steps{
|
||||
buildHipClangJobAndReboot(setup_args: setup_args, config_targets: "install", no_reboot:true, build_type: 'Release', execute_cmd: execute_args, prefixpath: '/usr/local')
|
||||
|
||||
Reference in New Issue
Block a user