NVIDIA NvNeural SDK
2021.2
GPU inference framework for NVIDIA Nsight Deep Learning Designer
|
Tool-supplied interface for C++ code generation. More...
#include <nvneural/CodeGenTypes.h>
Public Member Functions | |
Information Provided by the Host | |
virtual bool | deploymentMode () const noexcept=0 |
Returns true if the generator is in "deployment mode." When generating for deployment mode, the layer should precompile kernels where possible and optimize for speed rather than ease of development. | |
virtual const IStringList * | targetGpuArchitectures () const noexcept=0 |
Returns a pointer to an existing IStringList listing target GPU architectures. More... | |
virtual const char * | networkVariableName () const noexcept=0 |
Returns the C++ name of the INetwork variable being constructed. More... | |
virtual const char * | layerVariableName () const noexcept=0 |
Returns the C++ name of this ILayer object. More... | |
virtual const char * | resourceDictionaryVariableName () const noexcept=0 |
Returns the C++ name of the IResourceDictionary object. More... | |
virtual const char * | inputArgumentExpression () const noexcept=0 |
Returns the C++ expression corresponding to the command-line "input" parameter for this layer. More... | |
Information Provided by the Layer | |
virtual NeuralResult | setObjectClass (const char *pObjectClass) noexcept=0 |
Sets the object class that should be used to construct this layer. More... | |
virtual NeuralResult | addInclude (const char *pInclude) noexcept=0 |
Adds an include definition to the generated C++. More... | |
virtual NeuralResult | addSourceFragment (const char *pCppCode) noexcept=0 |
Adds a code fragment to the generated C++. | |
virtual NeuralResult | addHeaderFragment (const char *pCppCode) noexcept=0 |
Adds a code fragment to the generated header. | |
virtual NeuralResult | setInitializationFragment (const char *pCppCode) noexcept=0 |
Sets the initialization fragment, replacing ILayer::loadFromParameters. More... | |
virtual NeuralResult | addResource (IResourceDictionary::ResourceId *pResourceIdOut, const void *pBuffer, std::uint32_t bufferBytes) noexcept=0 |
Adds a binary resource to the generated C++. More... | |
virtual NeuralResult | setInputFragment (const char *pCppCode) noexcept=0 |
Marks a layer as a configurable input, setting its argument-parsing fragment. More... | |
![]() | |
virtual RefCount | addRef () const noexcept=0 |
Increments the object's reference count. More... | |
virtual const void * | queryInterface (TypeId interface) const noexcept=0 |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
virtual void * | queryInterface (TypeId interface) noexcept=0 |
Retrieves a new object interface pointer. More... | |
virtual RefCount | release () const noexcept=0 |
Decrements the object's reference count and destroy the object if the reference count reaches zero. More... | |
Static Public Attributes | |
static const IRefObject::TypeId | typeID = 0x1025680db910cfebul |
Interface TypeId for InterfaceOf purposes. | |
![]() | |
static const TypeId | typeID = 0x14ecc3f9de638e1dul |
Interface TypeId for InterfaceOf purposes. | |
Additional Inherited Members | |
![]() | |
using | RefCount = std::uint32_t |
Typedef used to track the number of active references to an object. | |
using | TypeId = std::uint64_t |
Every interface must define a unique TypeId. This should be randomized. | |
![]() | |
virtual | ~IRefObject ()=default |
A protected destructor prevents accidental stack-allocation of IRefObjects or use with other smart pointer classes like std::unique_ptr. | |
Tool-supplied interface for C++ code generation.
Host applications like ConverenceNG provide an instance of this interface to the ICppCodeGenerationLayer::generateLayerCpp method. Layers may call zero or more of the output methods to customize the standard code templates.
The SourceWriter class in CodeGenHelpers.h is provided for convenience when generating large swathes of C++ code. It exposes a non-ABI-stable interface based around iostreams with the added benefit of supporting automatic indentation.
Outputs:
|
pure virtualnoexcept |
Adds an include definition to the generated C++.
Remember to add <> or "" as appropriate.
|
pure virtualnoexcept |
Adds a binary resource to the generated C++.
pResourceIdOut | Returned resource ID |
pBuffer | Resource buffer to store |
bufferBytes | Size of the pBuffer resource in bytes |
|
pure virtualnoexcept |
Returns the C++ expression corresponding to the command-line "input" parameter for this layer.
Its type is std::string, and defaults to the empty string if the user did not specify a value.
|
pure virtualnoexcept |
Returns the C++ name of this ILayer object.
Its type is nvneural::RefPtr<nvneural::ILayer>.
|
pure virtualnoexcept |
Returns the C++ name of the INetwork variable being constructed.
Its type is nvneural::RefPtr<nvneural::INetwork>.
|
pure virtualnoexcept |
Returns the C++ name of the IResourceDictionary object.
Its type is nvneural::RefPtr<nvneural::IResourceDictionary>.
|
pure virtualnoexcept |
Sets the initialization fragment, replacing ILayer::loadFromParameters.
Multiple calls to this method replace previous fragments instead of concatenating.
|
pure virtualnoexcept |
Marks a layer as a configurable input, setting its argument-parsing fragment.
Multiple calls to this method replace previous fragments instead of concatenating.
Inside this fragment, the layer should retrieve the string named by the expression inputArgumentExpression and use it to load an input tensor.
The fragment should "return 1" (or some other nonzero exit code) and emit an error message to the default logger if something goes wrong at runtime.
|
pure virtualnoexcept |
Sets the object class that should be used to construct this layer.
Its type should be compatible with IPlugin::createObject. Multiple calls to this method replace previous object classes.
|
pure virtualnoexcept |
Returns a pointer to an existing IStringList listing target GPU architectures.
Architectures are in nvcc/nvrtc format (e.g., "sm_86") and can be passed directly to ICudaRuntimeCompiler::setTargetArchitecture.