MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / LazilyDeserializedEngine

Class LazilyDeserializedEngine

samples/common/sampleEngines.h:51–182  ·  view source on GitHub ↗

\brief A helper class to hold a serialized engine (std or safe) and only deserialize it when being accessed.

Source from the content-addressed store, hash-verified

49//! \brief A helper class to hold a serialized engine (std or safe) and only deserialize it when being accessed.
50//!
51class LazilyDeserializedEngine
52{
53public:
54 //!
55 //! \brief Delete default constructor to make sure isSafe and DLACore are always set.
56 //!
57 LazilyDeserializedEngine() = delete;
58
59 //!
60 //! \brief Constructor of LazilyDeserializedEngine.
61 //!
62 LazilyDeserializedEngine(bool isSafe, bool versionCompatible, int32_t DLACore, std::string const& tempdir,
63 nvinfer1::TempfileControlFlags tempfileControls, std::string const& leanDLLPath)
64 : mIsSafe(isSafe)
65 , mVersionCompatible(versionCompatible)
66 , mDLACore(DLACore)
67 , mTempdir(tempdir)
68 , mTempfileControls(tempfileControls)
69 , mLeanDLLPath(leanDLLPath)
70 {
71 }
72
73 //!
74 //! \brief Move from another LazilyDeserializedEngine.
75 //!
76 LazilyDeserializedEngine(LazilyDeserializedEngine&& other)
77 {
78 mIsSafe = other.mIsSafe;
79 mVersionCompatible = other.mVersionCompatible;
80 mDLACore = other.mDLACore;
81 mEngineBlob = std::move(other.mEngineBlob);
82 mEngine = std::move(other.mEngine);
83 mSafeEngine = std::move(other.mSafeEngine);
84 mTempdir = std::move(other.mTempdir);
85 mTempfileControls = other.mTempfileControls;
86 mLeanDLLPath = std::move(other.mLeanDLLPath);
87 mDynamicPlugins = std::move(other.mDynamicPlugins);
88 }
89
90 //!
91 //! \brief Delete copy constructor.
92 //!
93 LazilyDeserializedEngine(LazilyDeserializedEngine const& other) = delete;
94
95 //!
96 //! \brief Get the pointer to the ICudaEngine. Triggers deserialization if not already done so.
97 //!
98 nvinfer1::ICudaEngine* get();
99
100 //!
101 //! \brief Get the pointer to the ICudaEngine and release the ownership.
102 //!
103 nvinfer1::ICudaEngine* release();
104
105 //!
106 //! \brief Get the pointer to the safe::ICudaEngine. Triggers deserialization if not already done so.
107 //!
108 nvinfer1::safe::ICudaEngine* getSafe();

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected