| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#ifndef __VP_GRAPH_SET_H__ |
| 29 |
#define __VP_GRAPH_SET_H__ |
| 30 |
|
| 31 |
#include "vp_pipeline_common.h" |
| 32 |
#include "vp_allocator.h" |
| 33 |
#include "mos_hybrid_cmd_manager.h" |
| 34 |
#include "levelzero_npu_interface.h" |
| 35 |
|
| 36 |
namespace vp |
| 37 |
{ |
| 38 |
using VpGraphIDList = std::vector<VP_GRAPH_ID>; |
| 39 |
struct GRAPH_BIN |
| 40 |
{ |
| 41 |
uint8_t *blob = nullptr; |
| 42 |
uint32_t size = 0; |
| 43 |
}; |
| 44 |
using GRAPH_POOL = std::map<VP_GRAPH_ID, GRAPH_BIN>; |
| 45 |
|
| 46 |
class VpGraphSet |
| 47 |
{ |
| 48 |
public: |
| 49 |
VpGraphSet(PVP_MHWINTERFACE hwInterface, PVpAllocator allocator); |
| 50 |
virtual ~VpGraphSet() |
| 51 |
{ |
| 52 |
Clean(); |
| 53 |
}; |
| 54 |
|
| 55 |
virtual MOS_STATUS Clean(); |
| 56 |
|
| 57 |
virtual MOS_STATUS Destroy() |
| 58 |
{ |
| 59 |
return MOS_STATUS_SUCCESS; |
| 60 |
} |
| 61 |
|
| 62 |
virtual MOS_STATUS GetGraphObject( |
| 63 |
VP_GRAPH_ID graphId, |
| 64 |
GraphHandle *&graphHandle); |
| 65 |
|
| 66 |
protected: |
| 67 |
#if (_DEBUG || _RELEASE_INTERNAL) |
| 68 |
virtual MOS_STATUS LoadGraphForDebug() { return MOS_STATUS_SUCCESS; }; |
| 69 |
#endif |
| 70 |
|
| 71 |
protected: |
| 72 |
GRAPH_POOL *m_graphPool = nullptr; |
| 73 |
PVP_MHWINTERFACE m_hwInterface = nullptr; |
| 74 |
PMOS_INTERFACE m_osInterface = nullptr; |
| 75 |
PVpAllocator m_allocator = nullptr; |
| 76 |
std::map<VP_GRAPH_ID, GraphHandle> m_cachedGraphs = {}; |
| 77 |
|
| 78 |
MEDIA_CLASS_DEFINE_END(vp__VpGraphSet) |
| 79 |
}; |
| 80 |
|
| 81 |
class InitGraphCmdPackage : public CmdPackage |
| 82 |
{ |
| 83 |
public: |
| 84 |
InitGraphCmdPackage(GRAPH_BIN &graphBin, L0NpuInterface *npuInterface, GraphHandle *graphHandle) : m_graphHandle(graphHandle), m_npuInterface(npuInterface), m_graphBin(graphBin) {}; |
| 85 |
virtual MOS_STATUS Submit(); |
| 86 |
virtual MOS_STATUS Wait() { return MOS_STATUS_SUCCESS; }; |
| 87 |
virtual std::unique_ptr<CmdPackage> Clone() const; |
| 88 |
virtual bool Releaseable() override { return m_releaseable; }; |
| 89 |
|
| 90 |
private: |
| 91 |
GraphHandle *m_graphHandle = nullptr; |
| 92 |
L0NpuInterface *m_npuInterface = nullptr; |
| 93 |
GRAPH_BIN m_graphBin = {}; |
| 94 |
bool m_releaseable = false; |
| 95 |
}; |
| 96 |
|
| 97 |
} |
| 98 |
|
| 99 |
#endif |