@@ -15,10 +15,10 @@ CSplittedModelInfer::CSplittedModelInfer(const std::string& model_path,
1515 : m_dynamic_load_model_weights(dynamic_load_model_weights),
1616 m_is_gpu (device.find(" GPU" ) != std::string::npos || device.find(" gpu" ) != std::string::npos),
1717 m_properties(properties) {
18- #ifndef ENABLE_DYNAMIC_LOAD_MODEL_WEIGHTS
18+ #ifndef ENABLE_DYNAMIC_WEIGHT_MANAGEMENT
1919 OPENVINO_ASSERT (!m_dynamic_load_model_weights,
2020 " Dynamic loading of model weights is not enabled in this build. Please set "
21- " ENABLE_DYNAMIC_LOAD_MODEL_WEIGHTS to 1 and rebuild." );
21+ " ENABLE_DYNAMIC_WEIGHT_MANAGEMENT to 'ON' and rebuild." );
2222#endif
2323
2424 if (m_dynamic_load_model_weights) {
@@ -89,8 +89,7 @@ void CSplittedModelInfer::get_splitted_model_paths(const std::string& model_path
8989void CSplittedModelInfer::load_model (const std::string& model_path,
9090 const ov::AnyMap& properties,
9191 const std::string& device) {
92- #if USE_FULL_MODEL
93- #else
92+ #if !USE_FULL_MODEL
9493 {
9594 auto model = utils::singleton_core ().read_model (m_preprocess_model_path);
9695 m_preprocess_compiled_model = utils::singleton_core ().compile_model (model, device, properties);
@@ -119,7 +118,7 @@ void CSplittedModelInfer::load_model(const std::string& model_path,
119118 properties_splitted_model[ov::weights_path.name ()] =
120119 std::filesystem::path (path).replace_extension (" .bin" ).string ();
121120 auto cm = utils::singleton_core ().compile_model (model, m_context, properties_splitted_model);
122- # ifdef ENABLE_DYNAMIC_LOAD_MODEL_WEIGHTS
121+ # ifdef ENABLE_DYNAMIC_WEIGHT_MANAGEMENT
123122 // Release model weights after compilation to save GPU memory. Load weights again in infer() when
124123 // weights are needed.
125124 cm.release_model_weights ();
@@ -163,7 +162,7 @@ void CSplittedModelInfer::infer(const ov::AnyMap& inputs) {
163162 OPENVINO_ASSERT (num_splitted_models > 1 ,
164163 " Splitted models should be at least 2, but got " + std::to_string (num_splitted_models));
165164
166- # ifdef ENABLE_DYNAMIC_LOAD_MODEL_WEIGHTS
165+ # ifdef ENABLE_DYNAMIC_WEIGHT_MANAGEMENT
167166# if ENABLE_MULTIPLE_THREAD_LOAD_MODEL_WEIGHT
168167 std::future<bool > future_flag;
169168 if (m_dynamic_load_model_weights) {
@@ -175,7 +174,7 @@ void CSplittedModelInfer::infer(const ov::AnyMap& inputs) {
175174 m_compiled_models[0 ].load_model_weights ();
176175 }
177176# endif // ENABLE_MULTIPLE_THREAD_LOAD_MODEL_WEIGHT
178- # endif // ENABLE_DYNAMIC_LOAD_MODEL_WEIGHTS
177+ # endif // ENABLE_DYNAMIC_WEIGHT_MANAGEMENT
179178
180179 // Preprocess
181180 for (const auto & input : inputs) {
@@ -209,7 +208,7 @@ void CSplittedModelInfer::infer(const ov::AnyMap& inputs) {
209208 PROFILE (pm, " splitted_model_infer_" + std::to_string (i));
210209 ov::InferRequest curInferRequest;
211210 if (m_dynamic_load_model_weights) {
212- # ifdef ENABLE_DYNAMIC_LOAD_MODEL_WEIGHTS
211+ # ifdef ENABLE_DYNAMIC_WEIGHT_MANAGEMENT
213212 if (i + 1 < num_splitted_models) {
214213# if ENABLE_MULTIPLE_THREAD_LOAD_MODEL_WEIGHT
215214 next_future_flag = thread_utils::load_model_weights_async (m_compiled_models[i + 1 ]);
@@ -222,7 +221,7 @@ void CSplittedModelInfer::infer(const ov::AnyMap& inputs) {
222221 future_flag.wait ();
223222# endif // ENABLE_MULTIPLE_THREAD_LOAD_MODEL_WEIGHT
224223 curInferRequest = m_compiled_models[i].create_infer_request ();
225- # endif // ENABLE_DYNAMIC_LOAD_MODEL_WEIGHTS
224+ # endif // ENABLE_DYNAMIC_WEIGHT_MANAGEMENT
226225 } else {
227226 curInferRequest = m_infer_requests[i];
228227 }
@@ -238,7 +237,7 @@ void CSplittedModelInfer::infer(const ov::AnyMap& inputs) {
238237 curInferRequest.infer ();
239238 }
240239
241- # ifdef ENABLE_DYNAMIC_LOAD_MODEL_WEIGHTS
240+ # ifdef ENABLE_DYNAMIC_WEIGHT_MANAGEMENT
242241 if (m_dynamic_load_model_weights) {
243242# if ENABLE_MULTIPLE_THREAD_LOAD_MODEL_WEIGHT
244243 auto release_future =
@@ -256,7 +255,7 @@ void CSplittedModelInfer::infer(const ov::AnyMap& inputs) {
256255# if ENABLE_MULTIPLE_THREAD_LOAD_MODEL_WEIGHT
257256 future_flag = std::move (next_future_flag);
258257# endif
259- # endif // ENABLE_DYNAMIC_LOAD_MODEL_WEIGHTS
258+ # endif // ENABLE_DYNAMIC_WEIGHT_MANAGEMENT
260259 }
261260
262261 GENAI_DEBUG (
0 commit comments