Skip to content

Commit

Permalink
Cmake embedded flag (#327)
Browse files Browse the repository at this point in the history
* cmake flag to combine embedded options in one place.
* Fixed wrong flag option for BUILD_SHARED_LIB. Removed it from under MIOPEN_EMBED_BUILD
* Removed the shared libs option from top of file.
* Removed SCGEMM mentions.
  • Loading branch information
Daniel Lowell authored Jul 10, 2020
1 parent 25ba842 commit 46a7bcb
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ endif()

project ( MIOpen C CXX )

option( BUILD_SHARED_LIBS "Build as a shared library" ON )

enable_testing()

find_package(ROCM REQUIRED PATHS /opt/rocm)
Expand All @@ -68,7 +66,6 @@ endif()

option( BUILD_DEV "Build for development only" OFF)

set(MIOPEN_DISABLE_USERDB Off CACHE BOOL "Disable user database access")

# Strip symbols for release
if(NOT WIN32 AND NOT APPLE)
Expand All @@ -87,14 +84,17 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif()
endif()




############################################################
# require C++14
add_compile_options(-std=c++14)

############################################################
# OPTION - MIOpen Backend
# - OpenCL
# - HCC
# - HIP
check_cxx_compiler_flag("--cuda-host-only -x hip" HAS_HIP)
if(CMAKE_CXX_COMPILER MATCHES ".*hcc" OR CMAKE_CXX_COMPILER MATCHES ".*hipcc" OR HAS_HIP)
set(MIOPEN_DEFAULT_BACKEND "HIP")
Expand All @@ -113,15 +113,27 @@ list(APPEND CMAKE_PREFIX_PATH /opt/rocm /opt/rocm/llvm /opt/rocm/hip /opt/rocm/h
option(ENABLE_HIP_WORKAROUNDS Off)
set(MIOPEN_INSTALL_CXX_HEADERS Off CACHE BOOL "Install MIOpen's C++ header interface")

option(MIOPEN_USE_COMGR "When possible, use comgr to build kernels instead of offline tools" Off)
option(MIOPEN_USE_HIP_KERNELS "Use HIP kernels." On)

# Embedded Build Configuration
option(MIOPEN_EMBED_BUILD "Build with the set of embed flags." Off)
option(MIOPEN_USE_COMGR "Use comgr to build kernels instead of offline tools" ${MIOPEN_EMBED_BUILD})
option(MIOPEN_DISABLE_USERDB "Disable user database access" ${MIOPEN_EMBED_BUILD})

# MIOPEN_USE_HIP_KERNELS is a Workaround for COMgr issues
if(MIOPEN_EMBED_BUILD)
option(BUILD_SHARED_LIBS "Build as a shared library" Off)
option(MIOPEN_USE_HIP_KERNELS "Use HIP kernels." Off)
else()
option(BUILD_SHARED_LIBS "Build as a shared library" ON)
option(MIOPEN_USE_HIP_KERNELS "Use HIP kernels." On)
endif()


set( MIOPEN_BACKEND ${MIOPEN_DEFAULT_BACKEND} CACHE STRING
"Which of MIOpens's backends to use?" )
set_property( CACHE MIOPEN_BACKEND PROPERTY STRINGS
OpenCL HIP HIPOC )


# OpenCL 1.2
if( MIOPEN_BACKEND STREQUAL "OpenCL")
set(MIOPEN_BACKEND_OPENCL 1)
Expand Down Expand Up @@ -214,7 +226,7 @@ if( MIOPEN_BACKEND STREQUAL "HIP" OR MIOPEN_BACKEND STREQUAL "HIPOC")
endif()
endif()
message( STATUS "${MIOPEN_BACKEND} backend selected." )

# look for and register clang-offload-bundler
if(MIOPEN_HIP_COMPILER MATCHES ".*clang\\+\\+$")
find_program(MIOPEN_OFFLOADBUNDLER_BIN clang-offload-bundler
Expand Down

0 comments on commit 46a7bcb

Please sign in to comment.