OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[c-api]Add non-variadic property setting functions for compiled models and core (#37556)
Pawel Raasz688569c2eeaa
diff --git a/src/bindings/c/include/openvino/c/ov_compiled_model.h b/src/bindings/c/include/openvino/c/ov_compiled_model.hindex 7db38d8ae9b..b442417b557 100644--- a/src/bindings/c/include/openvino/c/ov_compiled_model.h+++ b/src/bindings/c/include/openvino/c/ov_compiled_model.h@@ -148,6 +148,20 @@ ov_compiled_model_create_infer_request(const ov_compiled_model_t* compiled_modelOPENVINO_C_API(ov_status_e)ov_compiled_model_set_property(const ov_compiled_model_t* compiled_model, ...);+/**+ * @brief Sets properties for a compiled model using an array of ov_property_t key/value pairs.+ * Non-variadic alternative to ov_compiled_model_set_property(), compatible with all FFI callers.+ * @ingroup ov_compiled_model_c_api+ * @param compiled_model A pointer to the ov_compiled_model_t.+ * @param properties Array of ov_property_t key/value pairs.+ * @param num_properties Number of entries in the properties array.+ * @return Status code of the operation: OK(0) for success.+ */+OPENVINO_C_API(ov_status_e)+ov_compiled_model_set_properties(const ov_compiled_model_t* compiled_model,+ const size_t num_properties,+ const ov_property_t* properties);+/*** @brief Gets properties for current compiled model.* @ingroup ov_compiled_model_c_apidiff --git a/src/bindings/c/include/openvino/c/ov_core.h b/src/bindings/c/include/openvino/c/ov_core.hindex c207d372efa..2af24522260 100644--- a/src/bindings/c/include/openvino/c/ov_core.h+++ b/src/bindings/c/include/openvino/c/ov_core.h@@ -284,6 +284,84 @@ ov_core_compile_model_from_file_unicode(const ov_core_t* core,OPENVINO_C_API(ov_status_e)ov_core_set_property(const ov_core_t* core, const char* device_name, ...);+/**+ * @brief Sets properties for a device using an array of ov_property_t key/value pairs.+ * Non-variadic alternative to ov_core_set_property(), compatible with all FFI callers (e.g. Go cgo, Rust).+ * @ingroup ov_core_c_api+ * @param core A pointer to the ov_core_t instance.+ * @param device_name Name of a device (may be NULL to set global properties).+ * @param num_properties Number of entries in the properties array.+ * @param properties Array of ov_property_t key/value pairs.+ * @return Status code of the operation: OK(0) for success.+ */+OPENVINO_C_API(ov_status_e)+ov_core_set_properties(const ov_core_t* core,+ const char* device_name,+ const size_t num_properties,+ const ov_property_t* properties);++/**+ * @brief Creates a compiled model from a source model using an array of ov_property_t pairs.+ * Non-variadic alternative to ov_core_compile_model(), compatible with all FFI callers.+ * @ingroup ov_core_c_api+ * @param core A pointer to the ov_core_t instance.+ * @param model Model object acquired from ov_core_read_model.+ * @param device_name Name of a device to load a model to (may be NULL).+ * @param num_properties Number of entries in the properties array.+ * @param properties Array of ov_property_t key/value pairs (may be NULL when num_properties is 0).+ * @param compiled_model A pointer to the newly created compiled_model.+ * @return Status code of the operation: OK(0) for success.+ */+OPENVINO_C_API(ov_status_e)+ov_core_compile_model_props(const ov_core_t* core,+ const ov_model_t* model,+ const char* device_name,+ const size_t num_properties,+ const ov_property_t* properties,+ ov_compiled_model_t** compiled_model);++/**+ * @brief Reads and compiles a model from a file using an array of ov_property_t pairs.+ * Non-variadic alternative to ov_core_compile_model_from_file(), compatible with all FFI callers.+ * @ingroup ov_core_c_api+ * @param core A pointer to the ov_core_t instance.+ * @param model_path Path to a model file.+ * @param device_name Name of a device to load a model to (may be NULL).+ * @param num_properties Number of entries in the properties array.+ * @param properties Array of ov_property_t key/value pairs (may be NULL when num_properties is 0).+ * @param compiled_model A pointer to the newly created compiled_model.+ * @return Status code of the operation: OK(0) for success.+ */+OPENVINO_C_API(ov_status_e)+ov_core_compile_model_from_file_props(const ov_core_t* core,+ const char* model_path,+ const char* device_name,+ const size_t num_properties,+ const ov_property_t* properties,+ ov_compiled_model_t** compiled_model);++#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT+/**+ * @brief Reads and compiles a model from a Unicode file path using an array of ov_property_t pairs.+ * Non-variadic alternative to ov_core_compile_model_from_file_unicode(), compatible with all FFI callers.+ * @ingroup ov_core_c_api+ * @param core A pointer to the ov_core_t instance.+ * @param model_path Path to a model file (wide-character Unicode path).+ * @param device_name Name of a device to load a model to (may be NULL).+ * @param num_properties Number of entries in the properties array.+ * @param properties Array of ov_property_t key/value pairs (may be NULL when num_properties is 0).+ * @param compiled_model A pointer to the newly created compiled_model.+ * @return Status code of the operation: OK(0) for success.+ */+OPENVINO_C_API(ov_status_e)+ov_core_compile_model_from_file_unicode_props(const ov_core_t* core,+ const wchar_t* model_path,+ const char* device_name,+ const size_t num_properties,+ const ov_property_t* properties,+ ov_compiled_model_t** compiled_model);+#endif+/*** @brief Gets properties related to device behaviour.* The method extracts information that can be set via the set_property method.@@ -373,6 +451,24 @@ ov_core_create_context(const ov_core_t* core,ov_remote_context_t** context,...);+/**+ * @brief Creates a new remote shared context using an array of ov_property_t key/value pairs.+ * Non-variadic alternative to ov_core_create_context(), compatible with all FFI callers.+ * @ingroup ov_core_c_api+ * @param core A pointer to the ov_core_t instance.+ * @param device_name Device name to identify a plugin.+ * @param num_properties Number of entries in the properties array.+ * @param properties Array of ov_property_t key/value pairs (may be NULL when num_properties is 0).+ * @param context A pointer to the newly created remote context.+ * @return Status code of the operation: OK(0) for success.+ */+OPENVINO_C_API(ov_status_e)+ov_core_create_context_props(const ov_core_t* core,+ const char* device_name,+ const size_t num_properties,+ const ov_property_t* properties,+ ov_remote_context_t** context);+/*** @brief Creates a compiled model from a source model within a specified remote context.* @ingroup ov_core_c_api@@ -392,6 +488,27 @@ ov_core_compile_model_with_context(const ov_core_t* core,ov_compiled_model_t** compiled_model,...);+/**+ * @brief Creates a compiled model from a source model within a specified remote context using an array of+ * ov_property_t pairs.+ * Non-variadic alternative to ov_core_compile_model_with_context(), compatible with all FFI callers.+ * @ingroup ov_core_c_api+ * @param core A pointer to the ov_core_t instance.+ * @param model Model object acquired from ov_core_read_model.+ * @param context A pointer to the remote context.+ * @param num_properties Number of entries in the properties array.+ * @param properties Array of ov_property_t key/value pairs (may be NULL when num_properties is 0).+ * @param compiled_model A pointer to the newly created compiled_model.+ * @return Status code of the operation: OK(0) for success.+ */+OPENVINO_C_API(ov_status_e)+ov_core_compile_model_with_context_props(const ov_core_t* core,+ const ov_model_t* model,+ const ov_remote_context_t* context,+ const size_t num_properties,+ const ov_property_t* properties,+ ov_compiled_model_t** compiled_model);+/*** @brief Gets a pointer to default (plugin-supplied) shared context object for the specified accelerator device.* @ingroup ov_core_c_apidiff --git a/src/bindings/c/include/openvino/c/ov_prepostprocess.h b/src/bindings/c/include/openvino/c/ov_prepostprocess.hindex 85bf87f52bb..6f664670d76 100644--- a/src/bindings/c/include/openvino/c/ov_prepostprocess.h+++ b/src/bindings/c/include/openvino/c/ov_prepostprocess.h@@ -341,6 +341,25 @@ ov_preprocess_input_tensor_info_set_color_format_with_subname(const size_t sub_names_size,...);+/**+ * @brief Set ov_preprocess_input_tensor_info_t color format with sub-plane names using an array.+ * Non-variadic alternative to ov_preprocess_input_tensor_info_set_color_format_with_subname(),+ * compatible with all FFI callers.+ * @ingroup ov_prepostprocess_c_api+ * @param preprocess_input_tensor_info A pointer to the ov_preprocess_input_tensor_info_t.+ * @param colorFormat The color format enumeration value.+ * @param sub_names_size Number of entries in the sub_names array.+ * @param sub_names Array of null-terminated sub-plane name strings (e.g. "Y", "UV").+ * May be NULL when sub_names_size is 0.+ * @return Status code of the operation: OK(0) for success.+ */+OPENVINO_C_API(ov_status_e)+ov_preprocess_input_tensor_info_set_color_format_with_subnames(+ ov_preprocess_input_tensor_info_t* preprocess_input_tensor_info,+ const ov_color_format_e colorFormat,+ const size_t sub_names_size,+ const char** sub_names);+/*** @brief Set ov_preprocess_input_tensor_info_t spatial_static_shape.* @ingroup ov_prepostprocess_c_apidiff --git a/src/bindings/c/include/openvino/c/ov_property.h b/src/bindings/c/include/openvino/c/ov_property.hindex faf207a494e..ba2f70a58bc 100644--- a/src/bindings/c/include/openvino/c/ov_property.h+++ b/src/bindings/c/include/openvino/c/ov_property.h@@ -246,3 +246,38 @@ ov_property_key_auto_batch_timeout;*/OPENVINO_C_VAR(const char*)ov_property_key_intel_gpu_config_file;++/**+ * @struct ov_property_t+ * @ingroup ov_property_c_api+ * @brief A key/value property pair for use with the non-variadic @c _props API.+ *+ * The @c value field is a @c const void* that holds any property value. The library+ * interprets the value based on the @c key — string-valued properties pass a @c const char*,+ * GPU/OCL handle properties pass the raw handle pointer, and cache-encryption callbacks pass+ * a pointer to an @c ov_encryption_callbacks struct. This mirrors the existing variadic API where+ * the key determines the expected argument type. The struct size is exactly two pointers (16 bytes+ * on 64-bit) and will never change, making it fully ABI-stable across library versions.+ *+ * In C all pointer types implicitly convert to @c const void*, so no casts are needed:+ * @code+ * ov_encryption_callbacks cb = {my_encrypt, my_decrypt};+ * ov_property_t props[] = {+ * {ov_property_key_hint_performance_mode, "LATENCY"}, // const char* → const void*+ * {ov_property_key_num_streams, "4"},+ * {ov_property_key_cache_encryption_callbacks, &cb}, // struct pointer → const void*+ * };+ * ov_core_compile_model_from_file_props(core, "model.xml", "CPU", 3, props, &cm);+ *+ * // GPU context with a raw OCL handle (any pointer → const void*):+ * ov_property_t ctx_props[] = {+ * {ov_property_key_intel_gpu_context_type, "OCL"},+ * {ov_property_key_intel_gpu_ocl_context, ocl_context_ptr},+ * };+ * ov_core_create_context_props(core, "GPU", 2, ctx_props, &ctx);+ * @endcode+ */+typedef struct {+ const char* key; /*!< Property key string (see @c ov_property_key_xxx constants). */+ const void* value; /*!< Property value: @c const char* string, GPU/OCL handle, or @c ov_encryption_callbacks*. */+} ov_property_t;diff --git a/src/bindings/c/include/openvino/c/ov_remote_context.h b/src/bindings/c/include/openvino/c/ov_remote_context.hindex 507ffc5870b..d198d127bc0 100644--- a/src/bindings/c/include/openvino/c/ov_remote_context.h+++ b/src/bindings/c/include/openvino/c/ov_remote_context.h@@ -10,6 +10,7 @@#pragma once#include "openvino/c/gpu/gpu_plugin_properties.h"#include "openvino/c/ov_common.h"+#include "openvino/c/ov_property.h"#include "openvino/c/ov_shape.h"#include "openvino/c/ov_tensor.h"@@ -36,6 +37,26 @@ ov_remote_context_create_tensor(const ov_remote_context_t* context,ov_tensor_t** remote_tensor,...);+/**+ * @brief Allocates a remote tensor using an array of ov_property_t key/value pairs.+ * Non-variadic alternative to ov_remote_context_create_tensor(), compatible with all FFI callers.+ * @ingroup ov_remote_context_c_api+ * @param context A pointer to the ov_remote_context_t instance.+ * @param type Defines the element type of the tensor.+ * @param shape Defines the shape of the tensor.+ * @param num_properties Number of entries in the properties array.+ * @param properties Array of ov_property_t key/value pairs (may be NULL when num_properties is 0).+ * @param remote_tensor Pointer to returned ov_tensor_t that contains the remote tensor instance.+ * @return Status code of the operation: OK(0) for success.+ */+OPENVINO_C_API(ov_status_e)+ov_remote_context_create_tensor_props(const ov_remote_context_t* context,+ const ov_element_type_e type,+ const ov_shape_t shape,+ const size_t num_properties,+ const ov_property_t* properties,+ ov_tensor_t** remote_tensor);+/*** @brief Returns name of a device on which underlying object is allocated.* @ingroup ov_remote_context_c_apidiff --git a/src/bindings/c/src/common.h b/src/bindings/c/src/common.hindex fe22a7de37f..e7f810da466 100644--- a/src/bindings/c/src/common.h+++ b/src/bindings/c/src/common.h@@ -10,6 +10,8 @@#include <string>#include "openvino/c/ov_common.h"+#include "openvino/c/ov_property.h"+#include "openvino/c/ov_remote_context.h"#include "openvino/core/except.hpp"#include "openvino/openvino.hpp"#include "openvino/runtime/exception.hpp"@@ -72,6 +74,94 @@property[property_key] = value; \}+/**+ * @brief Converts an ov_encryption_callbacks C struct into an ov::EncryptionCallbacks C++ object.+ */+inline ov::EncryptionCallbacks make_ov_encryption_callbacks(const ov_encryption_callbacks* cb) {+ if (!cb || !cb->encrypt_func || !cb->decrypt_func) {+ OPENVINO_THROW("ov_property_key_cache_encryption_callbacks: value must be a valid ov_encryption_callbacks* "+ "with non-null encrypt_func and decrypt_func");+ }+ auto encrypt_func = cb->encrypt_func;+ auto decrypt_func = cb->decrypt_func;+ std::function<std::string(const std::string&)> encrypt_fn = [encrypt_func](const std::string& in) {+ size_t out_size = 0;+ std::string out_str;+ encrypt_func(in.c_str(), in.length(), nullptr, &out_size);+ if (out_size > 0) {+ std::unique_ptr<char[]> output_ptr(new char[out_size]);+ if (output_ptr) {+ char* output = output_ptr.get();+ encrypt_func(in.c_str(), in.length(), output, &out_size);+ out_str.assign(output, out_size);+ }+ }+ return out_str;+ };+ std::function<std::string(const std::string&)> decrypt_fn = [decrypt_func](const std::string& in) {+ size_t out_size = 0;+ std::string out_str;+ decrypt_func(in.c_str(), in.length(), nullptr, &out_size);+ if (out_size > 0) {+ std::unique_ptr<char[]> output_ptr(new char[out_size]);+ if (output_ptr) {+ char* output = output_ptr.get();+ decrypt_func(in.c_str(), in.length(), output, &out_size);+ out_str.assign(output, out_size);+ }+ }+ return out_str;+ };+ return ov::EncryptionCallbacks{std::move(encrypt_fn), std::move(decrypt_fn)};+}++/**+ * @brief Returns true for GPU property keys whose value is a raw pointer (OCL/VA handle),+ * not a null-terminated string. Mirrors the logic in GET_INTEL_GPU_PROPERTY_FROM_ARGS_LIST.+ */+inline bool ov_property_value_is_gpu_ptr(const std::string& key) {+#ifdef _WIN32+ return key == ov_property_key_intel_gpu_ocl_context || key == ov_property_key_intel_gpu_ocl_queue ||+ key == ov_property_key_intel_gpu_va_device || key == ov_property_key_intel_gpu_mem_handle ||+ key == ov_property_key_intel_gpu_dev_object_handle;+#else+ return key == ov_property_key_intel_gpu_ocl_context || key == ov_property_key_intel_gpu_ocl_queue ||+ key == ov_property_key_intel_gpu_va_device || key == ov_property_key_intel_gpu_mem_handle;+#endif+}++/**+ * @brief Builds an ov::AnyMap from a flat array of ov_property_t.+ *+ * The value field is a const void*. The correct C++ type is determined from the key,+ * mirroring the existing GET_PROPERTY_FROM_ARGS_LIST / GET_INTEL_GPU_PROPERTY_FROM_ARGS_LIST+ * variadic macros:+ * - ov_property_key_cache_encryption_callbacks → cast to ov_encryption_callbacks*+ * - known GPU handle keys → store as void* (ov::Any)+ * - everything else → cast to const char* and copy as std::string+ */+inline ov::AnyMap ov_build_property_map(const ov_property_t* properties, size_t num_properties) {+ ov::AnyMap result;+ for (size_t i = 0; i < num_properties; ++i) {+ if (!properties[i].key) {+ OPENVINO_THROW("ov_property_t: key must not be null");+ }+ const std::string key = properties[i].key;+ const void* val = properties[i].value;+ if (!val) {+ OPENVINO_THROW("ov_property_t: value for key '", key, "' must not be null");+ }+ if (key == ov::cache_encryption_callbacks.name()) {+ result[key] = make_ov_encryption_callbacks(static_cast<const ov_encryption_callbacks*>(val));+ } else if (ov_property_value_is_gpu_ptr(key)) {+ result[key] = ov::Any(const_cast<void*>(val));+ } else {+ result[key] = std::string(static_cast<const char*>(val));+ }+ }+ return result;+}+/*** @struct ov_core* @brief This struct represents OpenVINO Core entity.diff --git a/src/bindings/c/src/ov_compiled_model.cpp b/src/bindings/c/src/ov_compiled_model.cppindex 5e2ce2a7da6..fc6781f1cb1 100644--- a/src/bindings/c/src/ov_compiled_model.cpp+++ b/src/bindings/c/src/ov_compiled_model.cpp@@ -195,6 +195,20 @@ ov_status_e ov_compiled_model_set_property(const ov_compiled_model_t* compiled_mreturn ov_status_e::OK;}+ov_status_e ov_compiled_model_set_properties(const ov_compiled_model_t* compiled_model,+ const size_t num_properties,+ const ov_property_t* properties) {+ if (!compiled_model || !properties || num_properties == 0) {+ return ov_status_e::INVALID_C_PARAM;+ }+ try {+ ov::AnyMap property = ov_build_property_map(properties, num_properties);+ compiled_model->object->set_property(property);+ }+ CATCH_OV_EXCEPTIONS+ return ov_status_e::OK;+}+ov_status_e ov_compiled_model_get_property(const ov_compiled_model_t* compiled_model,const char* key,char** property_value) {diff --git a/src/bindings/c/src/ov_core.cpp b/src/bindings/c/src/ov_core.cppindex 5b1ed05f7cd..e19db8569f8 100644--- a/src/bindings/c/src/ov_core.cpp+++ b/src/bindings/c/src/ov_core.cpp@@ -241,6 +241,85 @@ ov_status_e ov_core_set_property(const ov_core_t* core, const char* device_name,return ov_status_e::OK;}+ov_status_e ov_core_set_properties(const ov_core_t* core,+ const char* device_name,+ const size_t num_properties,+ const ov_property_t* properties) {+ if (!core || !properties || num_properties == 0) {+ return ov_status_e::INVALID_C_PARAM;+ }+ try {+ ov::AnyMap property = ov_build_property_map(properties, num_properties);+ if (device_name) {+ core->object->set_property(device_name, property);+ } else {+ core->object->set_property(property);+ }+ }+ CATCH_OV_EXCEPTIONS+ return ov_status_e::OK;+}++ov_status_e ov_core_compile_model_props(const ov_core_t* core,+ const ov_model_t* model,+ const char* device_name,+ const size_t num_properties,+ const ov_property_t* properties,+ ov_compiled_model_t** compiled_model) {+ if (!core || !model || !compiled_model) {+ return ov_status_e::INVALID_C_PARAM;+ }+ if (num_properties > 0 && !properties) {+ return ov_status_e::INVALID_C_PARAM;+ }+ try {+ ov::AnyMap property = ov_build_property_map(properties, num_properties);+ std::string dev_name = "";+ ov::CompiledModel object;+ if (device_name) {+ dev_name = device_name;+ object = core->object->compile_model(model->object, dev_name, property);+ } else {+ object = core->object->compile_model(model->object, property);+ }+ auto _compiled_model = std::make_unique<ov_compiled_model_t>();+ _compiled_model->object = std::make_shared<ov::CompiledModel>(std::move(object));+ *compiled_model = _compiled_model.release();+ }+ CATCH_OV_EXCEPTIONS+ return ov_status_e::OK;+}++ov_status_e ov_core_compile_model_from_file_props(const ov_core_t* core,+ const char* model_path,+ const char* device_name,+ const size_t num_properties,+ const ov_property_t* properties,+ ov_compiled_model_t** compiled_model) {+ if (!core || !model_path || !compiled_model) {+ return ov_status_e::INVALID_C_PARAM;+ }+ if (num_properties > 0 && !properties) {+ return ov_status_e::INVALID_C_PARAM;+ }+ try {+ ov::AnyMap property = ov_build_property_map(properties, num_properties);+ ov::CompiledModel object;+ std::string dev_name = "";+ if (device_name) {+ dev_name = device_name;+ object = core->object->compile_model(model_path, dev_name, property);+ } else {+ object = core->object->compile_model(model_path, property);+ }+ auto _compiled_model = std::make_unique<ov_compiled_model_t>();+ _compiled_model->object = std::make_shared<ov::CompiledModel>(std::move(object));+ *compiled_model = _compiled_model.release();+ }+ CATCH_OV_EXCEPTIONS+ return ov_status_e::OK;+}+ov_status_e ov_core_get_property(const ov_core_t* core,const char* device_name,const char* property_key,@@ -426,6 +505,36 @@ ov_status_e ov_core_compile_model_from_file_unicode(const ov_core_t* core,CATCH_OV_EXCEPTIONSreturn ov_status_e::OK;}++ov_status_e ov_core_compile_model_from_file_unicode_props(const ov_core_t* core,+ const wchar_t* model_path_ws,+ const char* device_name,+ const size_t num_properties,+ const ov_property_t* properties,+ ov_compiled_model_t** compiled_model) {+ if (!core || !model_path_ws || !compiled_model) {+ return ov_status_e::INVALID_C_PARAM;+ }+ if (num_properties > 0 && !properties) {+ return ov_status_e::INVALID_C_PARAM;+ }+ try {+ ov::AnyMap property = ov_build_property_map(properties, num_properties);+ ov::CompiledModel object;+ std::string dev_name = "";+ if (device_name) {+ dev_name = device_name;+ object = core->object->compile_model(model_path_ws, dev_name, property);+ } else {+ object = core->object->compile_model(model_path_ws, property);+ }+ auto _compiled_model = std::make_unique<ov_compiled_model_t>();+ _compiled_model->object = std::make_shared<ov::CompiledModel>(std::move(object));+ *compiled_model = _compiled_model.release();+ }+ CATCH_OV_EXCEPTIONS+ return ov_status_e::OK;+}#endifov_status_e ov_core_compile_model_with_context(const ov_core_t* core,@@ -457,6 +566,29 @@ ov_status_e ov_core_compile_model_with_context(const ov_core_t* core,return ov_status_e::OK;}+ov_status_e ov_core_compile_model_with_context_props(const ov_core_t* core,+ const ov_model_t* model,+ const ov_remote_context_t* context,+ const size_t num_properties,+ const ov_property_t* properties,+ ov_compiled_model_t** compiled_model) {+ if (!core || !model || !context || !compiled_model) {+ return ov_status_e::INVALID_C_PARAM;+ }+ if (num_properties > 0 && !properties) {+ return ov_status_e::INVALID_C_PARAM;+ }+ try {+ ov::AnyMap property = ov_build_property_map(properties, num_properties);+ ov::CompiledModel object = core->object->compile_model(model->object, *context->object, property);+ auto _compiled_model = std::make_unique<ov_compiled_model_t>();+ _compiled_model->object = std::make_shared<ov::CompiledModel>(std::move(object));+ *compiled_model = _compiled_model.release();+ }+ CATCH_OV_EXCEPTIONS+ return ov_status_e::OK;+}+ov_status_e ov_core_get_default_context(const ov_core_t* core, const char* device_name, ov_remote_context_t** context) {if (!core || !device_name || !context) {return ov_status_e::INVALID_C_PARAM;diff --git a/src/bindings/c/src/ov_prepostprocess.cpp b/src/bindings/c/src/ov_prepostprocess.cppindex bd2771061bb..465940a0a70 100644--- a/src/bindings/c/src/ov_prepostprocess.cpp+++ b/src/bindings/c/src/ov_prepostprocess.cpp@@ -336,6 +336,31 @@ ov_status_e ov_preprocess_input_tensor_info_set_color_format(return ov_preprocess_input_tensor_info_set_color_format_with_subname(preprocess_input_tensor_info, colorFormat, 0);}+ov_status_e ov_preprocess_input_tensor_info_set_color_format_with_subnames(+ ov_preprocess_input_tensor_info_t* preprocess_input_tensor_info,+ const ov_color_format_e colorFormat,+ const size_t sub_names_size,+ const char** sub_names) {+ if (!preprocess_input_tensor_info) {+ return ov_status_e::INVALID_C_PARAM;+ }+ if (sub_names_size > 0 && !sub_names) {+ return ov_status_e::INVALID_C_PARAM;+ }+ try {+ std::vector<std::string> names = {};+ for (size_t i = 0; i < sub_names_size; i++) {+ if (!sub_names[i]) {+ return ov_status_e::INVALID_C_PARAM;+ }+ names.emplace_back(sub_names[i]);+ }+ preprocess_input_tensor_info->object->set_color_format(GET_OV_COLOR_FARMAT(colorFormat), names);+ }+ CATCH_OV_EXCEPTIONS+ return ov_status_e::OK;+}+ov_status_e ov_preprocess_input_tensor_info_set_spatial_static_shape(ov_preprocess_input_tensor_info_t* preprocess_input_tensor_info,const size_t input_height,diff --git a/src/bindings/c/src/ov_remote_context.cpp b/src/bindings/c/src/ov_remote_context.cppindex f13ecbc9d46..b215033f079 100644--- a/src/bindings/c/src/ov_remote_context.cpp+++ b/src/bindings/c/src/ov_remote_context.cpp@@ -19,32 +19,21 @@ const char* ov_property_key_intel_gpu_mem_handle = "MEM_HANDLE";const char* ov_property_key_intel_gpu_dev_object_handle = "DEV_OBJECT_HANDLE";const char* ov_property_key_intel_gpu_va_plane = "VA_PLANE";-inline bool check_intel_gpu_property_value_is_ptr(std::string& key) {-#ifdef _WIN32- return (key == ov_property_key_intel_gpu_ocl_context) || (key == ov_property_key_intel_gpu_ocl_queue) ||- (key == ov_property_key_intel_gpu_va_device) || (key == ov_property_key_intel_gpu_mem_handle) ||- (key == ov_property_key_intel_gpu_dev_object_handle);-#else- return (key == ov_property_key_intel_gpu_ocl_context) || (key == ov_property_key_intel_gpu_ocl_queue) ||- (key == ov_property_key_intel_gpu_va_device) || (key == ov_property_key_intel_gpu_mem_handle);-#endif-}-//!< Properties of intel gpu cannot be compeletly handled by (char*) type, because it contains non-char pointer which//!< points to memory block, so we have to use (void *) type to parse it from va_arg list.//!< (char *) type data will be copied before pass to ov::AnyMap, to prevent it from being freed out of ov api calling.//!< (void *) type data is memory block or gpu object handle, it cannot be copied into a new place.-#define GET_INTEL_GPU_PROPERTY_FROM_ARGS_LIST(property_size) \- for (size_t i = 0; i < property_size; i++) { \- std::string property_key = va_arg(args_ptr, char*); \- if (check_intel_gpu_property_value_is_ptr(property_key)) { \- ov::Any value = va_arg(args_ptr, void*); \- property[property_key] = std::move(value); \- } else { \- std::string _value = va_arg(args_ptr, char*); \- ov::Any value = _value; \- property[property_key] = std::move(value); \- } \+#define GET_INTEL_GPU_PROPERTY_FROM_ARGS_LIST(property_size) \+ for (size_t i = 0; i < property_size; i++) { \+ std::string property_key = va_arg(args_ptr, char*); \+ if (ov_property_value_is_gpu_ptr(property_key)) { \+ ov::Any value = va_arg(args_ptr, void*); \+ property[property_key] = std::move(value); \+ } else { \+ std::string _value = va_arg(args_ptr, char*); \+ ov::Any value = _value; \+ property[property_key] = std::move(value); \+ } \}ov_status_e ov_core_create_context(const ov_core_t* core,@@ -75,6 +64,29 @@ ov_status_e ov_core_create_context(const ov_core_t* core,return ov_status_e::OK;}+ov_status_e ov_core_create_context_props(const ov_core_t* core,+ const char* device_name,+ const size_t num_properties,+ const ov_property_t* properties,+ ov_remote_context_t** context) {+ if (!core || !device_name || !context) {+ return ov_status_e::INVALID_C_PARAM;+ }+ if (num_properties > 0 && !properties) {+ return ov_status_e::INVALID_C_PARAM;+ }+ try {+ ov::AnyMap property = ov_build_property_map(properties, num_properties);+ std::string dev_name = device_name;+ ov::RemoteContext object = core->object->create_context(dev_name, property);+ auto _context = std::make_unique<ov_remote_context>();+ _context->object = std::make_shared<ov::RemoteContext>(std::move(object));+ *context = _context.release();+ }+ CATCH_OV_EXCEPTIONS+ return ov_status_e::OK;+}+ov_status_e ov_remote_context_create_tensor(const ov_remote_context_t* context,const ov_element_type_e type,const ov_shape_t shape,@@ -106,6 +118,32 @@ ov_status_e ov_remote_context_create_tensor(const ov_remote_context_t* context,return ov_status_e::OK;}+ov_status_e ov_remote_context_create_tensor_props(const ov_remote_context_t* context,+ const ov_element_type_e type,+ const ov_shape_t shape,+ const size_t num_properties,+ const ov_property_t* properties,+ ov_tensor_t** remote_tensor) {+ if (!context || !shape.dims || !remote_tensor) {+ return ov_status_e::INVALID_C_PARAM;+ }+ if (num_properties > 0 && !properties) {+ return ov_status_e::INVALID_C_PARAM;+ }+ try {+ ov::AnyMap property = ov_build_property_map(properties, num_properties);+ ov::Shape tmp_shape;+ std::copy_n(shape.dims, shape.rank, std::back_inserter(tmp_shape));+ auto tmp_type = get_element_type(type);+ ov::RemoteTensor object = context->object->create_tensor(tmp_type, tmp_shape, property);+ auto _remote_tensor = std::make_unique<ov_tensor>();+ _remote_tensor->object = std::make_shared<ov::RemoteTensor>(std::move(object));+ *remote_tensor = _remote_tensor.release();+ }+ CATCH_OV_EXCEPTIONS+ return ov_status_e::OK;+}+ov_status_e ov_remote_context_get_device_name(const ov_remote_context_t* context, char** device_name) {if (!context || !device_name) {return ov_status_e::INVALID_C_PARAM;@@ -203,4 +241,4 @@ ov_status_e ov_remote_tensor_get_device_name(ov_tensor_t* remote_tensor, char**}CATCH_OV_EXCEPTIONSreturn ov_status_e::OK;-}\ No newline at end of file+}diff --git a/src/bindings/c/tests/ov_compiled_model_test.cpp b/src/bindings/c/tests/ov_compiled_model_test.cppindex 5ef431bca09..262cee717af 100644--- a/src/bindings/c/tests/ov_compiled_model_test.cpp+++ b/src/bindings/c/tests/ov_compiled_model_test.cpp@@ -399,4 +399,106 @@ TEST_P(ov_compiled_model_test, create_infer_request_error_handling) {ov_core_free(core);}+TEST_P(ov_compiled_model_test, set_properties) {+ auto device = GetParam();+ std::string device_name = "BATCH:" + device + "(4)";+ ov_core_t* core = nullptr;+ OV_EXPECT_OK(ov_core_create(&core));+ EXPECT_NE(nullptr, core);++ ov_model_t* model = nullptr;+ OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));+ EXPECT_NE(nullptr, model);++ ov_compiled_model_t* compiled_model = nullptr;+ OV_EXPECT_OK(ov_core_compile_model(core, model, device_name.c_str(), 0, &compiled_model));+ EXPECT_NE(nullptr, compiled_model);++ const char* key = ov_property_key_auto_batch_timeout;+ char* result = nullptr;+ OV_EXPECT_OK(ov_compiled_model_get_property(compiled_model, key, &result));+ EXPECT_STREQ("1000", result); // default value++ const ov_property_t props[] = {{key, "3000"}};+ OV_EXPECT_OK(ov_compiled_model_set_properties(compiled_model, 1, props));+ ov_free(result);++ result = nullptr;+ OV_EXPECT_OK(ov_compiled_model_get_property(compiled_model, key, &result));+ EXPECT_STREQ("3000", result);+ ov_free(result);++ ov_compiled_model_free(compiled_model);+ ov_model_free(model);+ ov_core_free(core);+}++TEST_P(ov_compiled_model_test, set_properties_same_as_variadic) {+ auto device = GetParam();+ std::string device_name = "BATCH:" + device + "(4)";+ ov_core_t* core = nullptr;+ OV_EXPECT_OK(ov_core_create(&core));+ EXPECT_NE(nullptr, core);++ ov_model_t* model = nullptr;+ OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));+ EXPECT_NE(nullptr, model);++ // variadic path+ ov_compiled_model_t* cm_variadic = nullptr;+ OV_EXPECT_OK(ov_core_compile_model(core, model, device_name.c_str(), 0, &cm_variadic));+ OV_EXPECT_OK(ov_compiled_model_set_property(cm_variadic, ov_property_key_auto_batch_timeout, "2000"));+ char* res_variadic = nullptr;+ OV_EXPECT_OK(ov_compiled_model_get_property(cm_variadic, ov_property_key_auto_batch_timeout, &res_variadic));++ // struct-array path+ ov_compiled_model_t* cm_array = nullptr;+ OV_EXPECT_OK(ov_core_compile_model(core, model, device_name.c_str(), 0, &cm_array));+ const ov_property_t props[] = {{ov_property_key_auto_batch_timeout, "2000"}};+ OV_EXPECT_OK(ov_compiled_model_set_properties(cm_array, 1, props));+ char* res_array = nullptr;+ OV_EXPECT_OK(ov_compiled_model_get_property(cm_array, ov_property_key_auto_batch_timeout, &res_array));++ EXPECT_STREQ(res_variadic, res_array);++ ov_free(res_variadic);+ ov_free(res_array);+ ov_compiled_model_free(cm_variadic);+ ov_compiled_model_free(cm_array);+ ov_model_free(model);+ ov_core_free(core);+}++TEST_P(ov_compiled_model_test, set_properties_multi) {+ auto device = GetParam();+ std::string device_name = "BATCH:" + device + "(4)";+ ov_core_t* core = nullptr;+ OV_EXPECT_OK(ov_core_create(&core));+ EXPECT_NE(nullptr, core);++ ov_model_t* model = nullptr;+ OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));+ EXPECT_NE(nullptr, model);++ ov_compiled_model_t* compiled_model = nullptr;+ OV_EXPECT_OK(ov_core_compile_model(core, model, device_name.c_str(), 0, &compiled_model));+ EXPECT_NE(nullptr, compiled_model);++ // Set two BATCH-mutable properties in a single call and verify both are applied.+ const ov_property_t props[] = {+ {ov_property_key_auto_batch_timeout, "3000"},+ {ov_property_key_auto_batch_timeout, "5000"}, // last write wins+ };+ OV_EXPECT_OK(ov_compiled_model_set_properties(compiled_model, 2, props));++ char* result = nullptr;+ OV_EXPECT_OK(ov_compiled_model_get_property(compiled_model, ov_property_key_auto_batch_timeout, &result));+ EXPECT_STREQ("5000", result);+ ov_free(result);++ ov_compiled_model_free(compiled_model);+ ov_model_free(model);+ ov_core_free(core);+}+} // namespacediff --git a/src/bindings/c/tests/ov_core_test.cpp b/src/bindings/c/tests/ov_core_test.cppindex 434462e3156..ea8d4779db6 100644--- a/src/bindings/c/tests/ov_core_test.cpp+++ b/src/bindings/c/tests/ov_core_test.cpp@@ -668,6 +668,84 @@ TEST_P(ov_core_test, ov_core_import_model_with_encryption) {ov_core_free(core);}+// Demonstrates passing ov_encryption_callbacks via ov_property_t — the library dispatches+// by key, so the same _props function handles strings, callbacks, and GPU handles.+TEST_P(ov_core_test, ov_core_compile_model_from_file_props_with_encryption) {+ auto device_name = GetParam();+ ov_core_t* core = nullptr;++ OV_EXPECT_OK(ov_core_create(&core));+ EXPECT_NE(nullptr, core);++ char* optimization_capabilites = NULL;+ ov_core_get_property(core, device_name.c_str(), "OPTIMIZATION_CAPABILITIES", &optimization_capabilites);+ bool supports_export_import = std::string(optimization_capabilites).find("EXPORT_IMPORT") != std::string::npos;+ ov_free(optimization_capabilites);+ if (!supports_export_import) {+ GTEST_SKIP() << "Skip this test, cause no EXPORT_IMPORT supported";+ }++ ov_encryption_callbacks encryption_callbacks{codec_xor, codec_xor};+ ov_property_t props[] = {+ {ov_property_key_cache_encryption_callbacks, &encryption_callbacks},+ };+ ov_compiled_model_t* compiled_model = nullptr;+ OV_EXPECT_OK(ov_core_compile_model_from_file_props(core,+ xml_file_name.c_str(),+ device_name.c_str(),+ 1,+ props,+ &compiled_model));+ EXPECT_NE(nullptr, compiled_model);++ std::string export_path = TestDataHelpers::get_exported_blob_file_name();+ OV_EXPECT_OK(ov_compiled_model_export_model(compiled_model, export_path.c_str()));+ ov_compiled_model_free(compiled_model);++ std::vector<uint8_t> buffer(content_from_file(export_path.c_str(), true));+ ov_compiled_model_t* compiled_model_imported = nullptr;+ OV_EXPECT_OK(ov_core_import_model(core,+ reinterpret_cast<const char*>(buffer.data()),+ buffer.size(),+ device_name.c_str(),+ &compiled_model_imported));+ EXPECT_NE(nullptr, compiled_model_imported);+ ov_compiled_model_free(compiled_model_imported);+ ov_core_free(core);+}++// Demonstrates mixing string property and encryption callback in one ov_property_t array.+TEST_P(ov_core_test, ov_core_compile_model_props_with_encryption) {+ auto device_name = GetParam();+ ov_core_t* core = nullptr;+ ov_model_t* model = nullptr;++ OV_EXPECT_OK(ov_core_create(&core));+ EXPECT_NE(nullptr, core);++ char* optimization_capabilites = NULL;+ ov_core_get_property(core, device_name.c_str(), "OPTIMIZATION_CAPABILITIES", &optimization_capabilites);+ bool supports_export_import = std::string(optimization_capabilites).find("EXPORT_IMPORT") != std::string::npos;+ ov_free(optimization_capabilites);+ if (!supports_export_import) {+ GTEST_SKIP() << "Skip this test, cause no EXPORT_IMPORT supported";+ }++ OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), nullptr, &model));+ EXPECT_NE(nullptr, model);++ ov_encryption_callbacks encryption_callbacks{codec_xor, codec_xor};+ ov_property_t props[] = {+ {ov_property_key_cache_encryption_callbacks, &encryption_callbacks},+ };+ ov_compiled_model_t* compiled_model = nullptr;+ OV_EXPECT_OK(ov_core_compile_model_props(core, model, device_name.c_str(), 1, props, &compiled_model));+ EXPECT_NE(nullptr, compiled_model);+ ov_compiled_model_free(compiled_model);+ ov_model_free(model);+ ov_core_free(core);+}+TEST_P(ov_core_test, ov_core_get_versions_by_device_name) {auto device_name = GetParam();ov_core_t* core = nullptr;@@ -811,4 +889,137 @@ TEST_P(ov_util_test, ov_get_last_err_msg_check_empty_msg) {ov_core_free(core);}+TEST_P(ov_core_test, ov_core_set_properties) {+ auto device_name = GetParam();+ ov_core_t* core = nullptr;+ OV_EXPECT_OK(ov_core_create(&core));+ EXPECT_NE(nullptr, core);++ const ov_property_t props[] = {{ov_property_key_log_level, "WARNING"}};+ OV_EXPECT_OK(ov_core_set_properties(core, device_name.c_str(), 1, props));+ ov_core_free(core);+}++TEST_P(ov_core_test, ov_core_set_properties_same_as_variadic) {+ auto device_name = GetParam();+ ov_core_t* core = nullptr;+ OV_EXPECT_OK(ov_core_create(&core));+ EXPECT_NE(nullptr, core);++ const char* key = ov_property_key_hint_performance_mode;+ const char* val = "LATENCY";++ const ov_property_t props[] = {{key, val}};+ OV_EXPECT_OK(ov_core_set_properties(core, device_name.c_str(), 1, props));++ char* result = nullptr;+ OV_EXPECT_OK(ov_core_get_property(core, device_name.c_str(), key, &result));+ EXPECT_STREQ(val, result);+ ov_free(result);+ ov_core_free(core);+}++TEST_P(ov_core_test, ov_core_set_properties_null_args) {+ ov_core_t* core = nullptr;+ OV_EXPECT_OK(ov_core_create(&core));+ EXPECT_NE(nullptr, core);++ OV_EXPECT_NOT_OK(ov_core_set_properties(nullptr, "CPU", 0, nullptr));+ OV_EXPECT_NOT_OK(ov_core_set_properties(core, "CPU", 1, nullptr));+ OV_EXPECT_NOT_OK(ov_core_set_properties(core, "CPU", 0, nullptr));+ ov_core_free(core);+}++TEST_P(ov_core_test, ov_core_compile_model_props) {+ auto device_name = GetParam();+ ov_core_t* core = nullptr;+ OV_EXPECT_OK(ov_core_create(&core));+ EXPECT_NE(nullptr, core);++ ov_model_t* model = nullptr;+ OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));+ EXPECT_NE(nullptr, model);++ const char* key = ov_property_key_hint_performance_mode;+ const char* val = "LATENCY";+ const ov_property_t props[] = {{key, val}};++ ov_compiled_model_t* compiled_model = nullptr;+ OV_EXPECT_OK(ov_core_compile_model_props(core, model, device_name.c_str(), 1, props, &compiled_model));+ EXPECT_NE(nullptr, compiled_model);++ char* result = nullptr;+ OV_EXPECT_OK(ov_compiled_model_get_property(compiled_model, key, &result));+ EXPECT_STREQ(val, result);+ ov_free(result);++ ov_compiled_model_free(compiled_model);+ ov_model_free(model);+ ov_core_free(core);+}++TEST_P(ov_core_test, ov_core_compile_model_props_same_as_variadic) {+ auto device_name = GetParam();+ ov_core_t* core = nullptr;+ OV_EXPECT_OK(ov_core_create(&core));+ EXPECT_NE(nullptr, core);++ ov_model_t* model = nullptr;+ OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));+ EXPECT_NE(nullptr, model);++ const char* key = ov_property_key_hint_performance_mode;+ const char* val = "LATENCY";++ // variadic path+ ov_compiled_model_t* cm_variadic = nullptr;+ OV_EXPECT_OK(ov_core_compile_model(core, model, device_name.c_str(), 2, &cm_variadic, key, val));+ char* res_variadic = nullptr;+ OV_EXPECT_OK(ov_compiled_model_get_property(cm_variadic, key, &res_variadic));++ // struct-array path+ const ov_property_t props[] = {{key, val}};+ ov_compiled_model_t* cm_array = nullptr;+ OV_EXPECT_OK(ov_core_compile_model_props(core, model, device_name.c_str(), 1, props, &cm_array));+ char* res_array = nullptr;+ OV_EXPECT_OK(ov_compiled_model_get_property(cm_array, key, &res_array));++ EXPECT_STREQ(res_variadic, res_array);++ ov_free(res_variadic);+ ov_free(res_array);+ ov_compiled_model_free(cm_variadic);+ ov_compiled_model_free(cm_array);+ ov_model_free(model);+ ov_core_free(core);+}++TEST_P(ov_core_test, ov_core_compile_model_from_file_props) {+ auto device_name = GetParam();+ ov_core_t* core = nullptr;+ OV_EXPECT_OK(ov_core_create(&core));+ EXPECT_NE(nullptr, core);++ const char* key = ov_property_key_hint_performance_mode;+ const char* val = "THROUGHPUT";+ const ov_property_t props[] = {{key, val}};++ ov_compiled_model_t* compiled_model = nullptr;+ OV_EXPECT_OK(ov_core_compile_model_from_file_props(core,+ xml_file_name.c_str(),+ device_name.c_str(),+ 1,+ props,+ &compiled_model));+ EXPECT_NE(nullptr, compiled_model);++ char* result = nullptr;+ OV_EXPECT_OK(ov_compiled_model_get_property(compiled_model, key, &result));+ EXPECT_STREQ(val, result);+ ov_free(result);++ ov_compiled_model_free(compiled_model);+ ov_core_free(core);+}+} // namespacediff --git a/src/bindings/c/tests/ov_preprocess_test.cpp b/src/bindings/c/tests/ov_preprocess_test.cppindex 2f6d330a320..09adc65db25 100644--- a/src/bindings/c/tests/ov_preprocess_test.cpp+++ b/src/bindings/c/tests/ov_preprocess_test.cpp@@ -666,3 +666,36 @@ TEST_F(ov_preprocess_test, ov_preprocess_preprocess_steps_pad_edge) {OV_EXPECT_OK(ov_preprocess_prepostprocessor_build(preprocess, &ppp_model));EXPECT_NE(nullptr, ppp_model);}++TEST_F(ov_preprocess_test, ov_preprocess_input_tensor_info_set_color_format_with_subnames) {+ OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));+ EXPECT_NE(nullptr, preprocess);++ OV_EXPECT_OK(ov_preprocess_prepostprocessor_get_input_info_by_index(preprocess, 0, &input_info));+ EXPECT_NE(nullptr, input_info);++ OV_EXPECT_OK(ov_preprocess_input_info_get_preprocess_steps(input_info, &input_process));+ EXPECT_NE(nullptr, input_process);++ OV_EXPECT_OK(ov_preprocess_input_info_get_tensor_info(input_info, &input_tensor_info));+ EXPECT_NE(nullptr, input_tensor_info);++ const char* sub_names[] = {"y", "uv"};+ OV_EXPECT_OK(ov_preprocess_input_tensor_info_set_color_format_with_subnames(input_tensor_info,+ ov_color_format_e::NV12_TWO_PLANES,+ 2,+ sub_names));+ OV_EXPECT_OK(ov_preprocess_input_tensor_info_set_spatial_static_shape(input_tensor_info, 320, 320));+ OV_EXPECT_OK(ov_preprocess_preprocess_steps_convert_color(input_process, ov_color_format_e::BGR));+ OV_EXPECT_OK(ov_preprocess_preprocess_steps_resize(input_process, RESIZE_LINEAR));++ ov_layout_t* layout = nullptr;+ const char* layout_desc = "NCHW";+ OV_EXPECT_OK(ov_layout_create(layout_desc, &layout));+ OV_EXPECT_OK(ov_preprocess_input_info_get_model_info(input_info, &input_model));+ OV_EXPECT_OK(ov_preprocess_input_model_info_set_layout(input_model, layout));+ ov_layout_free(layout);++ OV_EXPECT_OK(ov_preprocess_prepostprocessor_build(preprocess, &ppp_model));+ EXPECT_NE(nullptr, ppp_model);+}diff --git a/src/bindings/c/tests/ov_remote_context_test.cpp b/src/bindings/c/tests/ov_remote_context_test.cppindex fc577a1adc6..1572aa5bbd2 100644--- a/src/bindings/c/tests/ov_remote_context_test.cpp+++ b/src/bindings/c/tests/ov_remote_context_test.cpp@@ -636,3 +636,61 @@ TEST_P(ov_remote_context_ocl, remote_tensor_nv12_inference) {ov_shape_free(&shape_y);ov_shape_free(&shape_uv);}++TEST_P(ov_remote_context_ocl, compile_model_with_context_props) {+ const char* context_type = "OCL";+ OV_EXPECT_OK(ov_core_create_context(core,+ "GPU",+ 6,+ &context,+ ov_property_key_intel_gpu_context_type,+ context_type,+ ov_property_key_intel_gpu_ocl_context,+ cl_context.get(),+ ov_property_key_intel_gpu_ocl_queue,+ cl_queue.get()));+ EXPECT_NE(nullptr, context);++ const ov_property_t props[] = {{ov_property_key_hint_performance_mode, "THROUGHPUT"}};+ OV_EXPECT_OK(ov_core_compile_model_with_context_props(core, model, context, 1, props, &compiled_model));+ EXPECT_NE(nullptr, compiled_model);++ char* result = nullptr;+ OV_EXPECT_OK(ov_compiled_model_get_property(compiled_model, ov_property_key_hint_performance_mode, &result));+ EXPECT_STREQ("THROUGHPUT", result);+ ov_free(result);+}++TEST_P(ov_remote_context_ocl, compile_model_with_context_props_same_as_variadic) {+ const char* context_type = "OCL";+ OV_EXPECT_OK(ov_core_create_context(core,+ "GPU",+ 6,+ &context,+ ov_property_key_intel_gpu_context_type,+ context_type,+ ov_property_key_intel_gpu_ocl_context,+ cl_context.get(),+ ov_property_key_intel_gpu_ocl_queue,+ cl_queue.get()));+ EXPECT_NE(nullptr, context);++ // variadic path (0 properties)+ ov_compiled_model_t* cm_variadic = nullptr;+ OV_EXPECT_OK(ov_core_compile_model_with_context(core, model, context, 0, &cm_variadic));+ EXPECT_NE(nullptr, cm_variadic);++ // struct-array path (0 properties — must be equivalent)+ OV_EXPECT_OK(ov_core_compile_model_with_context_props(core, model, context, 0, nullptr, &compiled_model));+ EXPECT_NE(nullptr, compiled_model);++ ov_compiled_model_free(cm_variadic);+}++TEST_P(ov_remote_context_ocl, compile_model_with_context_props_null_args) {+ OV_EXPECT_NOT_OK(ov_core_compile_model_with_context_props(nullptr, model, context, 0, nullptr, &compiled_model));+ OV_EXPECT_NOT_OK(ov_core_compile_model_with_context_props(core, nullptr, context, 0, nullptr, &compiled_model));+ OV_EXPECT_NOT_OK(ov_core_compile_model_with_context_props(core, model, nullptr, 0, nullptr, &compiled_model));+ OV_EXPECT_NOT_OK(ov_core_compile_model_with_context_props(core, model, context, 0, nullptr, nullptr));+ OV_EXPECT_NOT_OK(ov_core_compile_model_with_context_props(core, model, context, 1, nullptr, &compiled_model));+}