ROCM.cmake 1.91 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

18
# ROCM Module
19 20 21 22 23 24 25 26 27
find_rocm(${USE_ROCM})

if(ROCM_FOUND)
  # always set the includedir
  # avoid global retrigger of cmake
  include_directories(${ROCM_INCLUDE_DIRS})
  add_definitions(-D__HIP_PLATFORM_HCC__=1)
endif(ROCM_FOUND)

28 29

if(USE_ROCM)
30 31 32
  if(NOT ROCM_FOUND)
    message(FATAL_ERROR "Cannot find ROCM, USE_ROCM=" ${USE_ROCM})
  endif()
33 34 35
  message(STATUS "Build with ROCM support")
  file(GLOB RUNTIME_ROCM_SRCS src/runtime/rocm/*.cc)
  list(APPEND RUNTIME_SRCS ${RUNTIME_ROCM_SRCS})
36
  list(APPEND TVM_RUNTIME_LINKER_LIBS ${ROCM_HIPHCC_LIBRARY})
37 38 39 40 41

  if(USE_MIOPEN)
    message(STATUS "Build with MIOpen support")
    file(GLOB MIOPEN_CONTRIB_SRCS src/contrib/miopen/*.cc)
    list(APPEND RUNTIME_SRCS ${MIOPEN_CONTRIB_SRCS})
42
    list(APPEND TVM_RUNTIME_LINKER_LIBS ${ROCM_MIOPEN_LIBRARY})
43 44 45 46 47 48
  endif(USE_MIOPEN)

  if(USE_ROCBLAS)
    message(STATUS "Build with RocBLAS support")
    file(GLOB ROCBLAS_CONTRIB_SRCS src/contrib/rocblas/*.cc)
    list(APPEND RUNTIME_SRCS ${ROCBLAS_CONTRIB_SRCS})
49
    list(APPEND TVM_RUNTIME_LINKER_LIBS ${ROCM_ROCBLAS_LIBRARY})
50 51
  endif(USE_ROCBLAS)
else(USE_ROCM)
52
  list(APPEND COMPILER_SRCS src/codegen/opt/build_rocm_off.cc)
53
endif(USE_ROCM)