Skip to content

Commit

Permalink
GNA 3.0 implementation
Browse files Browse the repository at this point in the history
Merge pull request #5 from piotrkaczorintel/main
  • Loading branch information
krzysztofjozwiak authored Oct 12, 2022
2 parents 6e42dc7 + cebe067 commit 38598e5
Show file tree
Hide file tree
Showing 319 changed files with 16,567 additions and 29,839 deletions.
36 changes: 33 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# @copyright (C) 2020-2021 Intel Corporation
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: LGPL-2.1-or-later

# minimum version of CMake
cmake_minimum_required(VERSION 3.10)
# global variables
set(PROJECT_NAME gna-lib)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 11)
set(CXX_STANDARD_REQUIRED ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

# project name
project(${PROJECT_NAME})

# global list of test dependencies
set(GNA_ALL_TESTS_REGISTERED_TARGETS "" CACHE INTERNAL "")

# main binary path
set(GNA_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)

Expand All @@ -36,7 +39,7 @@ endif()
if(DEFINED ENV{GNA_LIBRARY_VERSION})
set(GNA_LIBRARY_VER -DGNA_LIBRARY_VERSION_STRING=\"$ENV{GNA_LIBRARY_VERSION}\")
elseif(NOT DEFINED GNA_LIBRARY_VER)
set(GNA_LIBRARY_VER -DGNA_LIBRARY_VERSION_STRING=\"2.X.0.0\")
set(GNA_LIBRARY_VER -DGNA_LIBRARY_VERSION_STRING=\"3.0.0.0\")
endif()

# source path variables
Expand Down Expand Up @@ -104,5 +107,32 @@ if(CSCOPE_PATH)
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif()

# HW C-package module
option(GNA_BUILD_WITH_HW_MODULE_ENABLED "" OFF)

set(HW_MODULE_PATH)
set(GNA_HW_LIB_INCLUDE_PATH)
set(GNA_HW_LIB_ENABLED )

if(${GNA_BUILD_WITH_HW_MODULE_ENABLED})
set(HW_MODULE_PATH ${BUILD_DIR}/hw_module)
set(HW_MODULE_NAME gnahw)

set(GNA_HW_LIB_ENABLED ${GNA_HW_LIB_ENABLED} "-DGNA_HW_LIB_ENABLED=1")
message("Enabling ${HW_MODULE_NAME} for GNA library")
if(NOT EXISTS "${HW_MODULE_PATH}/CMakeLists.txt")

message(FATAL_ERROR "HW submodule was not initialized properly.\n"
"File <${HW_MODULE_PATH}/CMakeLists.txt> not found.\n"
"Try using 'git submodule update --init --recursive' to load all submodules.")
endif()
add_subdirectory(${HW_MODULE_PATH})
set_gna_compile_definitions(${HW_MODULE_NAME})

set(GNA_ALL_TESTS_REGISTERED_TARGETS "${HW_MODULE_NAME};${GNA_ALL_TESTS_REGISTERED_TARGETS}" CACHE INTERNAL "")
else()
message("HW Module 3.0 for GNA library will NOT be used.")
endif()

add_subdirectory(src/gna-lib/kernels)
add_subdirectory(src/gna-lib)
4 changes: 2 additions & 2 deletions build/cmake/gna_cmake_tools.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#@copyright (C) 2020-2021 Intel Corporation
#SPDX-License-Identifier: LGPL-2.1-or-later
# Copyright (C) 2019-2022 Intel Corporation
# SPDX-License-Identifier: LGPL-2.1-or-later

function (strip_symbols TARG_NAME)
set(GNA_TARG_RELEASE_OUT_DIR ${GNA_TOOLS_RELEASE_OUT_DIR}/${TARG_NAME}/${CMAKE_ARCHITECTURE})
Expand Down
6 changes: 4 additions & 2 deletions build/cmake/gna_compile_flags.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#@copyright (C) 2020-2021 Intel Corporation
#SPDX-License-Identifier: LGPL-2.1-or-later
# Copyright (C) 2019-2022 Intel Corporation
# SPDX-License-Identifier: LGPL-2.1-or-later

set(GNA_COMPILE_FLAGS)
set(GNA_COMPILE_ERROR_FLAGS)
Expand Down Expand Up @@ -151,6 +151,8 @@ else()
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
set(GNA_COMPILE_FLAGS_RELEASE ${GNA_COMPILE_FLAGS_RELEASE} -ipo)
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
set(GNA_COMPILE_FLAGS_RELEASE ${GNA_COMPILE_FLAGS_RELEASE} -flto=thin)
else()
set(GNA_COMPILE_FLAGS_RELEASE ${GNA_COMPILE_FLAGS_RELEASE} -flto -fno-fat-lto-objects)
endif()
Expand Down
2 changes: 1 addition & 1 deletion build/cmake/pdb_public.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @copyright (C) 2020-2021 Intel Corporation
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: LGPL-2.1-or-later

if(EXISTS ${PDB_PUBLIC})
Expand Down
4 changes: 2 additions & 2 deletions build/cmake/set_build_type.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#@copyright (C) 2020-2021 Intel Corporation
#SPDX-License-Identifier: LGPL-2.1-or-later
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: LGPL-2.1-or-later

get_property(IsMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(NOT IsMultiConfig)
Expand Down
4 changes: 2 additions & 2 deletions build/cmake/set_x86_flags.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#@copyright (C) 2020-2021 Intel Corporation
#SPDX-License-Identifier: LGPL-2.1-or-later
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: LGPL-2.1-or-later

if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(GNA_COMPILE_FLAGS "${GNA_COMPILE_FLAGS} /Qm32")
Expand Down
54 changes: 10 additions & 44 deletions build/common/version.props
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
@copyright (C) 2017-2021 Intel Corporation
Copyright (C) 2012-2021 Intel Corporation
SPDX-License-Identifier: LGPL-2.1-or-later
*/
-->

<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PRODUCT_NAME>Intel&#174; GNA</PRODUCT_NAME>
<PRODUCT_NAME_LONG>Intel&#174; Gaussian &amp; Neural Accelerator</PRODUCT_NAME_LONG>
<PRODUCT_COPYRIGHT>Copyright&#169; 2015-2020, Intel Corporation</PRODUCT_COPYRIGHT>
<PRODUCT_COPYRIGHT>Copyright&#169; 2015-2021, Intel Corporation</PRODUCT_COPYRIGHT>
</PropertyGroup>
<PropertyGroup>
<IS_VER_SET Condition="'$(GMM_VER_RELEASE)'!='' and '$(GMM_VER_HW)'!='' and '$(GMM_VER_FIX)'!='' and '$(GMM_VER_BUILD)'!=''">true</IS_VER_SET>
Expand All @@ -18,48 +17,15 @@
<VERSION_QB_ID Condition="$(IS_VER_SET) == true">$(GMM_VER_HW),$(GMM_VER_RELEASE),$(GMM_VER_FIX),$(GMM_VER_BUILD)</VERSION_QB_ID>
<VERSION_QB_ID Condition="$(IS_VER_SET) != true">3,0,0,0</VERSION_QB_ID>
</PropertyGroup>
<PropertyGroup>
<TARGET_ICC_17_ID>17</TARGET_ICC_17_ID>
<TARGET_ICC_18_ID>18</TARGET_ICC_18_ID>
<TARGET_ICC_19_ID>19</TARGET_ICC_19_ID>
<TARGET_VS140_ID>140</TARGET_VS140_ID>
<TARGET_VS141_ID>141</TARGET_VS141_ID>
<TARGET_TOOLSET_ID>0</TARGET_TOOLSET_ID>
<TARGET_TOOLSET_ID Condition="('$(PlatformToolset)'== 'Intel C++ Compiler 17.0')">$(TARGET_ICC_17_ID)</TARGET_TOOLSET_ID>
<TARGET_TOOLSET_ID Condition="('$(PlatformToolset)'== 'Intel C++ Compiler 18.0')">$(TARGET_ICC_18_ID)</TARGET_TOOLSET_ID>
<TARGET_TOOLSET_ID Condition="('$(PlatformToolset)'== 'Intel C++ Compiler 19.0')">$(TARGET_ICC_19_ID)</TARGET_TOOLSET_ID>
<TARGET_TOOLSET_ID Condition="('$(PlatformToolset)'== 'v140')">$(TARGET_VS140_ID)</TARGET_TOOLSET_ID>
<TARGET_TOOLSET_ID Condition="('$(PlatformToolset)'== 'v141')">$(TARGET_VS141_ID)</TARGET_TOOLSET_ID>
</PropertyGroup>
<PropertyGroup>
<TARGET_DEBUG_ID>1</TARGET_DEBUG_ID><!-- Debug configuration numeric version id -->
<TARGET_RELEASE_ID>2</TARGET_RELEASE_ID><!-- Release configuration numeric version id -->
<CONFIG_TYPE>0</CONFIG_TYPE>
<CONFIG_TYPE Condition="('$(Configuration)' == 'WIN_DEBUG')">$(TARGET_DEBUG_ID)</CONFIG_TYPE>
<CONFIG_TYPE Condition="('$(Configuration)' == 'WIN_RELEASE')">$(TARGET_RELEASE_ID)</CONFIG_TYPE>
</PropertyGroup>
<PropertyGroup>
<TARGET_X64_ID>64</TARGET_X64_ID><!-- amd64/Win64 platform numeric version id -->
<TARGET_X86_ID>86</TARGET_X86_ID><!-- ia86/Win32 platform numeric version id -->
<PLATFORM_ID>$(TARGET_X64_ID)</PLATFORM_ID>
<PLATFORM_ID Condition="'$(Platform)' == 'Win32'">$(TARGET_X86_ID)</PLATFORM_ID>
</PropertyGroup>
<PropertyGroup>
<TARGET_WIN_VER>10</TARGET_WIN_VER>
<VERSION_FILE_STR>$(TARGET_WIN_VER).$(PLATFORM_ID).$(CONFIG_TYPE).$(TARGET_TOOLSET_ID)</VERSION_FILE_STR>
<VERSION_FILE_ID>$(TARGET_WIN_VER),$(PLATFORM_ID),$(CONFIG_TYPE),$(TARGET_TOOLSET_ID)</VERSION_FILE_ID>
</PropertyGroup>
<ItemDefinitionGroup>
<ResourceCompile>
<PreprocessorDefinitions>
PRODUCT_NAME=\"$(PRODUCT_NAME)\";
PRODUCT_NAME_LONG=\"$(PRODUCT_NAME_LONG)\";
PRODUCT_COPYRIGHT=\"$(PRODUCT_COPYRIGHT)\";
PRODUCT_VERSION_STR=\"$(VERSION_QB_STR)\";
PRODUCT_VERSION_ID=$(VERSION_QB_ID);
VERSION_FILE_STR=\"$(VERSION_FILE_STR)\";
VERSION_FILE_ID=$(VERSION_FILE_ID);
%(PreprocessorDefinitions)
PRODUCT_NAME=\"$(PRODUCT_NAME)\";
PRODUCT_NAME_LONG=\"$(PRODUCT_NAME_LONG)\";
PRODUCT_COPYRIGHT=\"$(PRODUCT_COPYRIGHT)\";
PRODUCT_VERSION_STR=\"$(VERSION_QB_STR)\";
PRODUCT_VERSION_ID=$(VERSION_QB_ID);
%(PreprocessorDefinitions)
</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
Expand Down
8 changes: 4 additions & 4 deletions doc/gna-api-doxygen/Doxyfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Doxyfile 1.8.17

# @copyright (C) 2020-2021 Intel Corporation
# Copyright (C) 2019-2022 Intel Corporation
# SPDX-License-Identifier: LGPL-2.1-or-later

# This file describes the settings to be used by the documentation system
Expand Down Expand Up @@ -35,13 +35,13 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.

PROJECT_NAME = "Gaussian and Neural Accelerator 2.0 Library"
PROJECT_NAME = "Gaussian and Neural Accelerator 3.0 Library"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.

PROJECT_BRIEF = "GNA 2.0 Library"
PROJECT_BRIEF = "GNA 3.0 Library"

# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
Expand Down Expand Up @@ -2576,4 +2576,4 @@ DOT_CLEANUP = YES
# control system is used.


PROJECT_NUMBER=2.0
PROJECT_NUMBER=3.0
4 changes: 2 additions & 2 deletions doc/gna-api-doxygen/build_publish.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@echo off

::@copyright (C) 2020-2021 Intel Corporation
::SPDX-License-Identifier: LGPL-2.1-or-later
:: Copyright (C) 2020-2022 Intel Corporation
:: SPDX-License-Identifier: LGPL-2.1-or-later

echo Building and publish GNA API Doxygen documentation

Expand Down
4 changes: 2 additions & 2 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# @copyright (C) 2018-2021 Intel Corporation
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: LGPL-2.1-or-later

cmake_minimum_required(VERSION 3.10)

set(PROJECT_NAME gna-samples)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 11)
set(CXX_STANDARD_REQUIRED ON)

Expand Down
4 changes: 2 additions & 2 deletions samples/readme.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
@copyright (C) 2018-2021 Intel Corporation
Copyright (C) 2017-2022 Intel Corporation
SPDX-License-Identifier: LGPL-2.1-or-later
*/
*/

Build instruction for samples.

Expand Down
2 changes: 1 addition & 1 deletion samples/src/sample01/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @copyright (C) 2018-2021 Intel Corporation
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: LGPL-2.1-or-later

cmake_minimum_required(VERSION 3.10)
Expand Down
4 changes: 2 additions & 2 deletions samples/src/sample01/sample01.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
@copyright (C) 2020-2021 Intel Corporation
@copyright Copyright (C) 2020-2022 Intel Corporation
SPDX-License-Identifier: LGPL-2.1-or-later
*/
*/

#define __STDC_WANT_LIB_EXT1__ 1

Expand Down
21 changes: 6 additions & 15 deletions src/common/Address.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/**
@copyright (C) 2017-2021 Intel Corporation
@copyright Copyright (C) 2017-2022 Intel Corporation
SPDX-License-Identifier: LGPL-2.1-or-later
*/
*/

#pragma once

#include "common.h"
#include <cstdint>

#include "functional"

namespace GNA
{
Expand All @@ -27,9 +29,6 @@ template<typename T> class Address<T*const>
Address(const T * value) :
buffer(const_cast<T*>(value))
{}
Address(const Address& address) :
buffer(address.buffer)
{}
template<class C> Address(const Address<C*>& address) :
buffer(const_cast<C*>(address.Get()))
{}
Expand All @@ -53,7 +52,7 @@ template<typename T> class Address<T*const>

bool operator ==(const std::nullptr_t &right) const
{
return right == buffer;
return buffer == right;
}

explicit operator bool() const
Expand Down Expand Up @@ -163,11 +162,6 @@ template<typename T> class Address<T *> : public Address<T*const>
this->buffer = this->Get() + right;
return *this;
}
const Address& operator =(const Address& right)
{
this->buffer = right.buffer;
return *this;
}
~Address() = default;
Address(const Address&) = default;
const Address& operator =(const T& right)
Expand All @@ -180,7 +174,4 @@ template<typename T> class Address<T *> : public Address<T*const>
// Address Aliases
using BaseAddress = Address<uint8_t * const>;

// Functor for getting buffer offset for HW
using GetHwOffset = std::function<uint32_t(const BaseAddress&)>;

}
Loading

0 comments on commit 38598e5

Please sign in to comment.