Compile snippets as a static library (#9095)

This commit is contained in:
Ilya Lavrenov 2021-12-09 15:40:43 +03:00 committed by GitHub
parent 02e7706776
commit 12d322807f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 35 additions and 97 deletions

View File

@ -15,9 +15,9 @@ file(GLOB_RECURSE PUBLIC_HEADERS ${PUBLIC_HEADERS_DIR}/snippets/*.hpp)
source_group("src" FILES ${LIBRARY_SRC})
source_group("include" FILES ${PUBLIC_HEADERS})
# Create library
# Create static library
add_library(${TARGET_NAME} EXCLUDE_FROM_ALL
add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL
${LIBRARY_SRC}
${PUBLIC_HEADERS})
@ -25,12 +25,7 @@ ie_faster_build(${TARGET_NAME}
UNITY
)
ie_add_vs_version_file(NAME ${TARGET_NAME}
FILEDESCRIPTION "Inference Engine Snippets transformations library")
target_compile_definitions(${TARGET_NAME} PRIVATE inference_engine_transformations_EXPORTS)
target_link_libraries(${TARGET_NAME} PUBLIC ngraph inference_engine_transformations
target_link_libraries(${TARGET_NAME} PUBLIC ngraph
PRIVATE ngraph_reference)
target_include_directories(${TARGET_NAME} PUBLIC ${PUBLIC_HEADERS_DIR}
@ -38,8 +33,6 @@ target_include_directories(${TARGET_NAME} PUBLIC ${PUBLIC_HEADERS_DIR}
add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})
ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
ie_mark_target_as_cc(${TARGET_NAME})
# LTO
@ -49,15 +42,4 @@ set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_REL
# install
# TODO: uncomment once snippets are integrated into CPU plugin
# if(BUILD_SHARED_LIBS)
# install(TARGETS ${TARGET_NAME}
# RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core
# LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core)
# else()
# ov_install_static_lib(${TARGET_NAME} core)
# endif()
# TODO: remove once install commands above are commented out
install(TARGETS ${TARGET_NAME}
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT tests EXCLUDE_FROM_ALL
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT tests EXCLUDE_FROM_ALL)
# ov_install_static_lib(${TARGET_NAME} core)

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include <vector>
#include <cstdint>
@ -20,7 +18,7 @@ using RegInfo = std::pair<std::vector<size_t>, std::vector<size_t>>;
* @brief Base class for all target specific code emitters used by generator.
* @ingroup snippets
*/
class TRANSFORMATIONS_API Emitter {
class Emitter {
public:
/**
* @brief Default constructor

View File

@ -8,21 +8,20 @@
*/
#pragma once
#include <transformations_visibility.hpp>
#include "snippets_isa.hpp"
#include "emitter.hpp"
namespace ngraph {
namespace snippets {
TRANSFORMATIONS_API auto getRegisters(std::shared_ptr<ngraph::Node>& n) -> ngraph::snippets::RegInfo;
auto getRegisters(std::shared_ptr<ngraph::Node>& n) -> ngraph::snippets::RegInfo;
/**
* @interface TargetMachine
* @brief Base class Target machine representation. Target derives from this class to provide generator information about supported emittors
* @ingroup snippets
*/
class TRANSFORMATIONS_API TargetMachine {
class TargetMachine {
public:
/**
* @brief checks if target is natively supported
@ -71,7 +70,7 @@ protected:
* @brief Return scheduling information and pointer to generated kernel code
* @ingroup snippets
*/
class TRANSFORMATIONS_API Schedule {
class Schedule {
public:
/**
* @brief Default constructor
@ -101,7 +100,7 @@ public:
* @brief Target independent code generator interface
* @ingroup snippets
*/
class TRANSFORMATIONS_API Generator {
class Generator {
public:
/**
* @brief Default constructor

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include <ngraph/op/op.hpp>
#include "load.hpp"
@ -18,7 +16,7 @@ namespace op {
* @brief Generated by Canonicalization step for blocked data (NCHW<X>c) to be loaded
* @ingroup snippets
*/
class TRANSFORMATIONS_API BlockedLoad : public Load {
class BlockedLoad : public Load {
public:
OPENVINO_OP("BlockedLoad", "SnippetsOpset", ngraph::snippets::op::Load);

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include <ngraph/op/op.hpp>
#include <ngraph/op/parameter.hpp>
@ -18,7 +16,7 @@ namespace op {
* @brief Represents blocked input (NCHW<X>c) for a subgraph
* @ingroup snippets
*/
class TRANSFORMATIONS_API BlockedParameter : public ngraph::op::Parameter {
class BlockedParameter : public ngraph::op::Parameter {
public:
OPENVINO_OP("BlockedParameter", "SnippetsOpset", ngraph::op::Parameter);

View File

@ -4,7 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include <snippets/op/broadcastmove.hpp>
#include "ngraph/op/op.hpp"
@ -18,7 +17,7 @@ namespace op {
* @brief Is generated for broadcasting by least varying dimension for non-blocked cases and the second varying dimension for blocked
* @ingroup snippets
*/
class TRANSFORMATIONS_API BroadcastLoad : public BroadcastMove {
class BroadcastLoad : public BroadcastMove {
public:
OPENVINO_OP("BroadcastLoad", "SnippetsOpset", ngraph::snippets::op::BroadcastMove);

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include "ngraph/op/op.hpp"
namespace ngraph {
@ -17,7 +15,7 @@ namespace op {
* @brief Added to a subgraph if explicit broadcast instruction should be generated
* @ingroup snippets
*/
class TRANSFORMATIONS_API BroadcastMove : public ngraph::op::Op {
class BroadcastMove : public ngraph::op::Op {
public:
OPENVINO_OP("BroadcastMove", "SnippetsOpset");

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include "ngraph/op/op.hpp"
#include "snippets/emitter.hpp"
@ -18,7 +16,7 @@ namespace op {
* @brief Generated by Canonicalization and represents compute kernel legal for sheduling
* @ingroup snippets
*/
class TRANSFORMATIONS_API Kernel : public ngraph::op::Op {
class Kernel : public ngraph::op::Op {
public:
OPENVINO_OP("Kernel", "SnippetsOpset");

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include <ngraph/op/op.hpp>
namespace ngraph {
@ -21,7 +19,7 @@ namespace op {
* BlockedLoad == vector instruction - post increment
* @ingroup snippets
*/
class TRANSFORMATIONS_API Load : public ngraph::op::Op {
class Load : public ngraph::op::Op {
public:
OPENVINO_OP("Load", "SnippetsOpset");

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include "ngraph/op/op.hpp"
namespace ngraph {
@ -17,7 +15,7 @@ namespace op {
* @brief Generated by Canonicalization and represents not-an-operation
* @ingroup snippets
*/
class TRANSFORMATIONS_API Nop : public ngraph::op::Op {
class Nop : public ngraph::op::Op {
public:
OPENVINO_OP("Nop", "SnippetsOpset");

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include "ngraph/op/op.hpp"
#include "ngraph/op/constant.hpp"
@ -18,7 +16,7 @@ namespace op {
* @brief Generated by Canonicalization for a scalar constant Shape() == {1}
* @ingroup snippets
*/
class TRANSFORMATIONS_API Scalar : public ngraph::op::Constant {
class Scalar : public ngraph::op::Constant {
public:
OPENVINO_OP("Scalar", "SnippetsOpset", ngraph::op::Constant);

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include <ngraph/op/op.hpp>
#include "load.hpp"
@ -18,7 +16,7 @@ namespace op {
* @brief Generated by Canonicalization for a scalar value load to vector register
* @ingroup snippets
*/
class TRANSFORMATIONS_API ScalarLoad : public Load {
class ScalarLoad : public Load {
public:
OPENVINO_OP("ScalarLoad", "SnippetsOpset", ngraph::snippets::op::Load);

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include <ngraph/op/op.hpp>
#include "store.hpp"
@ -18,7 +16,7 @@ namespace op {
* @brief Generated by Canonicalization for a scalar value store from vector register
* @ingroup snippets
*/
class TRANSFORMATIONS_API ScalarStore : public Store {
class ScalarStore : public Store {
public:
OPENVINO_OP("ScalarStore", "SnippetsOpset", ngraph::snippets::op::Store);

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include <ngraph/op/op.hpp>
#include <ngraph/op/power.hpp>
#include <snippets/snippets_isa.hpp>
@ -19,7 +17,7 @@ namespace op {
* @brief Generated by Canonicalization for a spasical case of power innstruction which has constant power value
* @ingroup snippets
*/
class TRANSFORMATIONS_API PowerStatic : public ngraph::op::v1::Power {
class PowerStatic : public ngraph::op::v1::Power {
public:
OPENVINO_OP("PowerStatic", "SnippetsOpset", ngraph::op::v1::Power);

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include <ngraph/op/op.hpp>
namespace ngraph {
@ -17,7 +15,7 @@ namespace op {
* @brief Generated by Canonicalization step where explicit store instruction should be emmiteed
* @ingroup snippets
*/
class TRANSFORMATIONS_API Store : public ngraph::op::Op {
class Store : public ngraph::op::Op {
public:
OPENVINO_OP("Store", "SnippetsOpset");

View File

@ -6,7 +6,6 @@
#include <memory>
#include <transformations_visibility.hpp>
#include <ngraph/function.hpp>
#include <ngraph/op/op.hpp>
#include <ngraph/rt_info.hpp>
@ -23,7 +22,7 @@ namespace op {
* @brief An operation that is implemented by a function
* @ingroup snippets
*/
class TRANSFORMATIONS_API Subgraph : public ngraph::op::Op {
class Subgraph : public ngraph::op::Op {
public:
OPENVINO_OP("Subgraph", "SnippetsOpset");

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include "ngraph/op/op.hpp"
#include "snippets/emitter.hpp"
@ -18,7 +16,7 @@ namespace op {
* @brief Generated by Canonicalization and represents Loop in affine notation
* @ingroup snippets
*/
class TRANSFORMATIONS_API Tile : public ngraph::op::Op {
class Tile : public ngraph::op::Op {
public:
OPENVINO_OP("Tile", "SnippetsOpset");

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include <ngraph/op/op.hpp>
#include "load.hpp"
@ -18,7 +16,7 @@ namespace op {
* @brief Generated by Canonicalization for a vector value load to vector register
* @ingroup snippets
*/
class TRANSFORMATIONS_API VectorLoad : public Load {
class VectorLoad : public Load {
public:
OPENVINO_OP("VectorLoad", "SnippetsOpset", ngraph::snippets::op::Load);

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include <ngraph/op/op.hpp>
#include "store.hpp"
@ -18,7 +16,7 @@ namespace op {
* @brief Generated by Canonicalization for a vector value store from vector register
* @ingroup snippets
*/
class TRANSFORMATIONS_API VectorStore : public Store {
class VectorStore : public Store {
public:
OPENVINO_OP("VectorStore", "SnippetsOpset", ngraph::snippets::op::Store);

View File

@ -4,7 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include <ngraph/pass/pass.hpp>
namespace ngraph {
@ -17,7 +16,7 @@ namespace pass {
* Changing order of variables or datafrow lead to invalidation of register assignment.
* @ingroup snippets
*/
class TRANSFORMATIONS_API AssignRegisters : public ngraph::pass::FunctionPass {
class AssignRegisters : public ngraph::pass::FunctionPass {
public:
AssignRegisters() : FunctionPass() {
set_property(ngraph::pass::PassProperty::REQUIRE_STATIC_SHAPE, true);

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include <ngraph/ngraph.hpp>
#include <ngraph/pass/graph_rewrite.hpp>
#include <ngraph/pattern/matcher.hpp>
@ -20,7 +18,7 @@ namespace pass {
* @brief Matches multiple output loyout-oblivious operations to start a new subgraph
* @ingroup snippets
*/
class TRANSFORMATIONS_API StartSubgraph: public ngraph::pass::MatcherPass {
class StartSubgraph: public ngraph::pass::MatcherPass {
public:
NGRAPH_RTTI_DECLARATION;
explicit StartSubgraph(bool tokenize_by_node = false);
@ -31,7 +29,7 @@ public:
* @brief Matches loyout-oblivious operations with subgraph operation as an input to attech this node into it
* @ingroup snippets
*/
class TRANSFORMATIONS_API AttachToSubgraph: public ngraph::pass::MatcherPass {
class AttachToSubgraph: public ngraph::pass::MatcherPass {
public:
NGRAPH_RTTI_DECLARATION;
explicit AttachToSubgraph(bool tokenize_by_node = false);
@ -60,7 +58,7 @@ public:
* Scalar constants are placed as is into subgraph due to optimization purpose
* @ingroup snippets
*/
class TRANSFORMATIONS_API TokenizeSnippets: public ngraph::pass::GraphRewrite {
class TokenizeSnippets: public ngraph::pass::GraphRewrite {
public:
NGRAPH_RTTI_DECLARATION;
TokenizeSnippets(bool tokenize_by_node = false) {

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include <ngraph/pass/graph_rewrite.hpp>
#include <ngraph/pattern/matcher.hpp>
@ -19,7 +17,7 @@ namespace pass {
* The pass is used to convert function to a canonical form for code generation
* @ingroup snippets
*/
class TRANSFORMATIONS_API InsertLoad: public ngraph::pass::MatcherPass {
class InsertLoad: public ngraph::pass::MatcherPass {
public:
InsertLoad();
};
@ -30,7 +28,7 @@ public:
* The pass is used to convert function to a canonical form for code generation
* @ingroup snippets
*/
class TRANSFORMATIONS_API InsertStore: public ngraph::pass::MatcherPass {
class InsertStore: public ngraph::pass::MatcherPass {
public:
InsertStore();
};

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include <ngraph/pass/graph_rewrite.hpp>
#include <ngraph/pattern/matcher.hpp>
@ -19,7 +17,7 @@ namespace pass {
* The pass is used to convert function to a canonical form for code generation
* @ingroup snippets
*/
class TRANSFORMATIONS_API InsertMoveBroadcast: public ngraph::pass::MatcherPass {
class InsertMoveBroadcast: public ngraph::pass::MatcherPass {
public:
InsertMoveBroadcast();
};

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include <ngraph/pass/graph_rewrite.hpp>
#include <ngraph/pattern/matcher.hpp>
@ -19,7 +17,7 @@ namespace pass {
* The pass is used to convert function to a canonical form for code generation
* @ingroup snippets
*/
class TRANSFORMATIONS_API LoadMoveBroadcastToBroadcastLoad: public ngraph::pass::MatcherPass {
class LoadMoveBroadcastToBroadcastLoad: public ngraph::pass::MatcherPass {
public:
LoadMoveBroadcastToBroadcastLoad();
};

View File

@ -4,8 +4,6 @@
#pragma once
#include <transformations_visibility.hpp>
#include <ngraph/pass/graph_rewrite.hpp>
#include <ngraph/pattern/matcher.hpp>
@ -20,7 +18,7 @@ namespace pass {
* Used for tail generation
* @ingroup snippets
*/
class TRANSFORMATIONS_API ReplaceLoadsWithScalarLoads: public ngraph::pass::MatcherPass {
class ReplaceLoadsWithScalarLoads: public ngraph::pass::MatcherPass {
public:
ReplaceLoadsWithScalarLoads();
};
@ -32,7 +30,7 @@ public:
* Used for tail generation
* @ingroup snippets
*/
class TRANSFORMATIONS_API ReplaceStoresWithScalarStores: public ngraph::pass::MatcherPass {
class ReplaceStoresWithScalarStores: public ngraph::pass::MatcherPass {
public:
ReplaceStoresWithScalarStores();
};