提交 f438efc9 编写于 作者: M Megvii Engine Team

fix(src/atlas): add om model loading configuration

GitOrigin-RevId: e0376c962b31103f779f75550c6155f86bdffa20
上级 55afd35f
......@@ -76,7 +76,8 @@ typedef enum {
ACL_MDL_INPUTQ_NUM_SIZET,
ACL_MDL_INPUTQ_ADDR_PTR, /**< pointer to inputQ with shallow copy */
ACL_MDL_OUTPUTQ_NUM_SIZET,
ACL_MDL_OUTPUTQ_ADDR_PTR /**< pointer to outputQ with shallow copy */
ACL_MDL_OUTPUTQ_ADDR_PTR, /**< pointer to outputQ with shallow copy */
ACL_MDL_WORKSPACE_MEM_OPTIMIZE
} aclmdlConfigAttr;
typedef enum {
......
......@@ -178,8 +178,28 @@ AtlasRuntimeOpr::AtlasRuntimeOpr(
add_input({i});
}
if (m_model_id == INVALID_MODEL_ID && m_model_desc == nullptr) {
MGB_ATLAS_CHECK(
aclmdlLoadFromMem(m_buffer.data(), m_buffer.size(), &m_model_id));
aclmdlConfigHandle* config_handle = aclmdlCreateConfigHandle();
size_t mdl_load_type = ACL_MDL_LOAD_FROM_MEM;
const void* mdl_mem_addr_ptr = m_buffer.data();
size_t mdl_mem_size = m_buffer.size();
MGB_ATLAS_CHECK(aclmdlSetConfigOpt(
config_handle, ACL_MDL_LOAD_TYPE_SIZET, &mdl_load_type,
sizeof(size_t)));
MGB_ATLAS_CHECK(aclmdlSetConfigOpt(
config_handle, ACL_MDL_MEM_ADDR_PTR, &mdl_mem_addr_ptr,
sizeof(const void*)));
MGB_ATLAS_CHECK(aclmdlSetConfigOpt(
config_handle, ACL_MDL_MEM_SIZET, &mdl_mem_size, sizeof(size_t)));
size_t mem_optimize_mode = 1;
MGB_ATLAS_CHECK(aclmdlSetConfigOpt(
config_handle, ACL_MDL_WORKSPACE_MEM_OPTIMIZE, &mem_optimize_mode,
sizeof(size_t)));
MGB_ATLAS_CHECK(aclmdlLoadWithConfig(config_handle, &m_model_id));
MGB_ATLAS_CHECK(aclmdlDestroyConfigHandle(config_handle));
m_model_desc = aclmdlCreateDesc();
MGB_ATLAS_CHECK(aclmdlGetDesc(m_model_desc, m_model_id));
m_is_model_holder = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册