Skip to content

Commit

Permalink
Merge branch 'master' into tokenizer-fix-decode
Browse files Browse the repository at this point in the history
  • Loading branch information
apaniukov authored Oct 12, 2023
2 parents 2ee3707 + b21bc7c commit 4b57fcc
Show file tree
Hide file tree
Showing 19 changed files with 512 additions and 436 deletions.
31 changes: 19 additions & 12 deletions modules/nvidia_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

cmake_minimum_required(VERSION 3.13)
project(InferenceEngineNVIDIAGpuPlugin CXX CUDA)
project(OpenVINONVIDIAGpuPlugin CXX CUDA)

# Initialize CMAKE_CUDA_ARCHITECTURES when CMAKE_CUDA_COMPILER_ID is NVIDIA.
# Raise an error if CUDA_ARCHITECTURES is empty.
Expand All @@ -26,16 +26,14 @@ if (ENABLE_CUDNN_BACKEND_API)
add_definitions(-DENABLE_CUDNN_BACKEND_API)
endif()

set(IE_MAIN_CUDA_PLUGIN_SOURCE_DIR ${InferenceEngineNVIDIAGpuPlugin_SOURCE_DIR})

find_package(OpenVINODeveloperPackage REQUIRED
PATHS "${InferenceEngineDeveloperPackage_DIR}")

include(cmake/features.cmake)

set(HAS_REQUIRED REQUIRED)

if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
if(CMAKE_VERSION VERSION_LESS 3.17.0)
set(HAS_REQUIRED)
find_package(CUDA REQUIRED)
set(CUDAToolkit_VERSION_MAJOR ${CUDA_VERSION_MAJOR})
Expand Down Expand Up @@ -92,14 +90,23 @@ endif()
find_library(CUDNN_PATH
NAMES cudnn
${HAS_REQUIRED}
HINTS "$ENV{CUDNN_PATH}" "${CUDA_TOOLKIT_ROOT_DIR}" "${CUDA_PATH}" "$ENV{CUDA_PATH}"
HINTS "$ENV{CUDNN_PATH}" "${CUDA_TOOLKIT_ROOT_DIR}" "${CUDA_PATH}" "$ENV{CUDA_PATH}"
PATH_SUFFIXES nvidia/current lib64 lib/x64 lib)

if(CUDAToolkit_VERSION_MAJOR LESS_EQUAL 10)
set(CUTENSOR_LIB_DIRS lib/10.2 libcutensor/10.2)
elseif(CUDAToolkit_VERSION_MAJOR GREATER_EQUAL 11 AND CUDAToolkit_VERSION_MINOR LESS_EQUAL 0)
set(CUTENSOR_LIB_DIRS lib/11.0 libcutensor/11.0)
elseif(CUDAToolkit_VERSION_MAJOR GREATER_EQUAL 11 AND CUDAToolkit_VERSION_MINOR GREATER_EQUAL 1)
set(CUTENSOR_LIB_DIRS lib/11 libcutensor/11)
else()
set(CUTENSOR_LIB_DIRS lib/${CUDAToolkit_VERSION_MAJOR} libcutensor/${CUDAToolkit_VERSION_MAJOR})
endif()
find_library(CUTENSOR_PATH
NAMES cutensor
${HAS_REQUIRED}
HINTS "$ENV{CUTENSOR_PATH}" "${CUDA_TOOLKIT_ROOT_DIR}" "${CUDA_PATH}" "$ENV{CUDA_PATH}"
PATH_SUFFIXES nvidia/current lib64 lib/x64 lib lib/11)
PATH_SUFFIXES nvidia/current lib64 lib/x64 lib ${CUTENSOR_LIB_DIRS})
get_filename_component(CUTENSOR_INCLUDE_DIR "${CUTENSOR_PATH}" DIRECTORY)
get_filename_component(CUTENSOR_INCLUDE_DIR "${CUTENSOR_INCLUDE_DIR}/../../include" REALPATH)

Expand All @@ -121,11 +128,11 @@ set_target_properties(CUDA::cutensor PROPERTIES IMPORTED_LOCATION "${CUTENSOR_PA
set_target_properties(CUDA::cutensor PROPERTIES IMPORTED_IMPLIB "${CUTENSOR_PATH}")

if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
if(${CUDAToolkit_VERSION_MAJOR} LESS_EQUAL 10)
if(CUDAToolkit_VERSION_MAJOR LESS_EQUAL 10)
set(CMAKE_CUDA_ARCHITECTURES "30;35;50;60;72")
elseif(${CUDAToolkit_VERSION_MAJOR} EQUAL 11 AND ${CUDAToolkit_VERSION_MINOR} LESS_EQUAL 7)
elseif(CUDAToolkit_VERSION_MAJOR EQUAL 11 AND CUDAToolkit_VERSION_MINOR LESS_EQUAL 7)
set(CMAKE_CUDA_ARCHITECTURES "35;50;60-virtual;61;70-virtual;75;86")
elseif(${CUDAToolkit_VERSION_MAJOR} EQUAL 11 AND ${CUDAToolkit_VERSION_MINOR} EQUAL 8)
elseif(CUDAToolkit_VERSION_MAJOR EQUAL 11 AND CUDAToolkit_VERSION_MINOR EQUAL 8)
set(CMAKE_CUDA_ARCHITECTURES "35;50;60-virtual;61;70-virtual;75;86;89-virtual;90-virtual")
else()
set(CMAKE_CUDA_ARCHITECTURES "50;60-virtual;61;70-virtual;75;86;89-virtual;90-virtual")
Expand All @@ -140,7 +147,7 @@ include(FetchContent)
FetchContent_Declare(GSL
GIT_REPOSITORY "https://github.com/microsoft/GSL"
GIT_TAG "v3.1.0")
if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
if(CMAKE_VERSION VERSION_LESS 3.14.0)
FetchContent_GetProperties(GSL)
if(NOT GSL_POPULATED)
FetchContent_Populate(GSL)
Expand All @@ -156,7 +163,7 @@ set_property(TARGET GSL PROPERTY INTERFACE_COMPILE_FEATURES)
FetchContent_Declare(fmt-header-only
GIT_REPOSITORY "https://github.com/fmtlib/fmt"
GIT_TAG "7.1.3")
if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
if(CMAKE_VERSION VERSION_LESS 3.14.0)
FetchContent_GetProperties(fmt-header-only)
if(NOT fmt-header-only_POPULATED)
FetchContent_Populate(fmt-header-only)
Expand Down Expand Up @@ -185,4 +192,4 @@ endif()
# install

# ATTENTION: uncomment to install component
# ie_cpack(template)
# ov_cpack(template)
4 changes: 2 additions & 2 deletions modules/nvidia_plugin/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ov_mark_target_as_cc(${TARGET_NAME})

set_property(TARGET ${OBJ_NAME} PROPERTY CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES})

ieTargetLinkWholeArchive(${TARGET_NAME} ${OBJ_NAME})
ov_target_link_whole_archive(${TARGET_NAME} ${OBJ_NAME})

target_include_directories(${OBJ_NAME}
SYSTEM PUBLIC
Expand All @@ -53,7 +53,7 @@ target_include_directories(${OBJ_NAME}
PUBLIC
"${CUTENSOR_INCLUDE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}"
"${IE_MAIN_CUDA_PLUGIN_SOURCE_DIR}/include"
"${OpenVINONVIDIAGpuPlugin_SOURCE_DIR}/include"
PRIVATE $<TARGET_PROPERTY:openvino::conditional_compilation,INTERFACE_INCLUDE_DIRECTORIES>
)

Expand Down
4 changes: 2 additions & 2 deletions modules/nvidia_plugin/src/cuda/float16.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define CUDA_HAS_BF16_MATH
#endif // defined (CUDA_HAS_BF16_TYPE) && (__CUDA_ARCH__ >= 800 || !defined(__CUDA_ARCH__))

#ifdef __CUDACC__
#if defined(__CUDACC__) && CUDA_VERSION < 12000
#if !defined(CUDA_HAS_HALF_MATH)
/* Some basic arithmetic operations expected of a builtin */
__device__ __forceinline__ __half operator+(const __half &lh, const __half &rh) {
Expand Down Expand Up @@ -192,4 +192,4 @@ __device__ __forceinline__ bool operator<=(const __nv_bfloat16 &lh, const __nv_b
return static_cast<float>(lh) <= static_cast<float>(rh);
}
#endif /* defined(CUDA_HAS_BF16_TYPE) && !defined(CUDA_HAS_BF16_MATH) */
#endif // __CUDACC__
#endif // defined(__CUDACC__) && CUDA_VERSION < 12000
9 changes: 3 additions & 6 deletions modules/nvidia_plugin/tests/functional/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
# SPDX-License-Identifier: Apache-2.0
#

# [cmake:functional_tests]
set(TARGET_NAME ov_nvidia_func_tests)

if (ENABLE_INTEL_CPU)
# TODO: remove dependency on CPU plugin after migration to tests for API 2.0
if(CMAKE_SOURCE_DIR STREQUAL OpenVINO_SOURCE_DIR AND ENABLE_INTEL_CPU)
set(OPENVINO_ADDITIONAL_DEPENDENCIES openvino_intel_cpu_plugin)
else(ENABLE_INTEL_CPU)
set(OPENVINO_ADDITIONAL_DEPENDENCIES)
endif (ENABLE_INTEL_CPU)
endif()

ov_add_test_target(
NAME
Expand All @@ -34,4 +32,3 @@ ov_add_test_target(
if(ENABLE_PROXY)
target_compile_definitions(${TARGET_NAME} PUBLIC PROXY_PLUGIN_ENABLED)
endif()
# [cmake:functional_tests]
Loading

0 comments on commit 4b57fcc

Please sign in to comment.