@@ -2087,14 +2087,14 @@ struct OrtEpApi {
20872087 *
20882088 * The returned handle owns only ORT's copy of callback function pointers and opaque state pointer values. It does not
20892089 * own the application-provided state. The application is responsible for keeping callback state valid and
2090- * synchronized while an EP may call ReadEpContextData or WriteEpContextData with this config.
2090+ * synchronized while an EP may call callbacks retrieved from this config.
20912091 *
20922092 * \param[in] session_options The OrtSessionOptions instance.
20932093 * \param[out] config The extracted OrtEpContextConfig.
20942094 *
20952095 * \snippet{doc} snippets.dox OrtStatus Return Value
20962096 *
2097- * \since Version 1.27 .
2097+ * \since Version 1.28 .
20982098 */
20992099 ORT_API2_STATUS (SessionOptions_GetEpContextConfig,
21002100 _In_ const OrtSessionOptions* session_options,
@@ -2104,66 +2104,49 @@ struct OrtEpApi {
21042104 *
21052105 * \param[in] input The OrtEpContextConfig instance to release. May be NULL.
21062106 *
2107- * \since Version 1.27 .
2107+ * \since Version 1.28 .
21082108 */
21092109 ORT_CLASS_RELEASE (EpContextConfig);
21102110
2111- /* * \brief Read EPContext binary data, using an application read callback or falling back to disk .
2111+ /* * \brief Get the application-provided EPContext data read callback.
21122112 *
2113- * If config contains a read callback, the callback is invoked with the provided allocator. Otherwise, ORT reads the
2114- * file from disk. The disk fallback derives the base directory from the graph's model path.
2113+ * Returns the OrtReadEpContextDataFunc and opaque state pointer registered via
2114+ * OrtApi::SessionOptions_SetEpContextDataReadFunc. If no callback was registered, *read_func and *state are set to
2115+ * NULL. The EP is responsible for calling the callback when present and for using its own normal read path when no
2116+ * callback is present.
21152117 *
2116- * This function is synchronous. If a callback is present, it is invoked on the calling thread and its OrtStatus is
2117- * returned to the caller. ORT does not serialize concurrent calls across EP instances or EP worker threads.
2118- *
2119- * \param[in] config The OrtEpContextConfig from SessionOptions_GetEpContextConfig. May be NULL for disk fallback.
2120- * \param[in] file_name EPContext file name as a null-terminated UTF-8 string.
2121- * \param[in] graph The OrtGraph from which ORT derives the model path for disk fallback. May be NULL.
2122- * \param[in] allocator Allocator for the output buffer.
2123- * \param[out] buffer Output buffer containing the EPContext binary data.
2124- * \param[out] buffer_size Size of the output buffer in bytes.
2118+ * \param[in] config The OrtEpContextConfig from SessionOptions_GetEpContextConfig.
2119+ * \param[out] read_func The registered read callback, or NULL if none was registered.
2120+ * \param[out] state Opaque state pointer passed to read_func, or NULL if none was registered.
21252121 *
21262122 * \snippet{doc} snippets.dox OrtStatus Return Value
21272123 *
2128- * \since Version 1.27 .
2124+ * \since Version 1.28 .
21292125 */
2130- ORT_API2_STATUS (ReadEpContextData,
2131- _In_opt_ const OrtEpContextConfig* config,
2132- _In_ const char * file_name,
2133- _In_opt_ const OrtGraph* graph,
2134- _Inout_ OrtAllocator* allocator,
2135- _Outptr_ void ** buffer,
2136- _Out_ size_t * buffer_size);
2126+ ORT_API2_STATUS (EpContextConfig_GetEpContextDataReadFunc,
2127+ _In_ const OrtEpContextConfig* config,
2128+ _Out_ OrtReadEpContextDataFunc* read_func,
2129+ _Out_ void ** state);
21372130
2138- /* * \brief Write EPContext binary data, using an application write callback or falling back to disk .
2131+ /* * \brief Get the application-provided EPContext data write callback.
21392132 *
2140- * If config contains a write callback, the data is forwarded to the application's callback. Otherwise, ORT writes the
2141- * data to disk. The disk fallback derives the base directory from the graph's model path.
2133+ * Returns the OrtWriteEpContextDataFunc and opaque state pointer registered via
2134+ * OrtCompileApi::ModelCompilationOptions_SetEpContextDataWriteFunc. If no callback was registered, *write_func and
2135+ * *state are set to NULL. The EP is responsible for calling the callback when present and for using its own normal
2136+ * write path when no callback is present.
21422137 *
2143- * This function is synchronous. If a callback is present, it is invoked on the calling thread and its OrtStatus is
2144- * returned to the caller. ORT does not retain buffer after the callback returns, reorder callback invocations, or
2145- * serialize concurrent calls across EP instances or EP worker threads.
2146- *
2147- * Each call is one complete write operation for file_name. The API does not provide an offset, sequence number, or
2148- * final-chunk marker. EPs should prefer one call per EPContext binary, or document EP-specific chunk ordering and
2149- * completion semantics if multiple calls are made for the same file_name.
2150- *
2151- * \param[in] config The OrtEpContextConfig from SessionOptions_GetEpContextConfig. May be NULL for disk fallback.
2152- * \param[in] file_name EPContext file name as a null-terminated UTF-8 string.
2153- * \param[in] graph The OrtGraph from which ORT derives the model path for disk fallback. May be NULL.
2154- * \param[in] buffer The buffer containing EPContext binary data to write.
2155- * \param[in] buffer_size Size of the buffer in bytes.
2138+ * \param[in] config The OrtEpContextConfig from SessionOptions_GetEpContextConfig.
2139+ * \param[out] write_func The registered write callback, or NULL if none was registered.
2140+ * \param[out] state Opaque state pointer passed to write_func, or NULL if none was registered.
21562141 *
21572142 * \snippet{doc} snippets.dox OrtStatus Return Value
21582143 *
2159- * \since Version 1.27 .
2144+ * \since Version 1.28 .
21602145 */
2161- ORT_API2_STATUS (WriteEpContextData,
2162- _In_opt_ const OrtEpContextConfig* config,
2163- _In_ const char * file_name,
2164- _In_opt_ const OrtGraph* graph,
2165- _In_ const void * buffer,
2166- _In_ size_t buffer_size);
2146+ ORT_API2_STATUS (EpContextConfig_GetEpContextDataWriteFunc,
2147+ _In_ const OrtEpContextConfig* config,
2148+ _Out_ OrtWriteEpContextDataFunc* write_func,
2149+ _Out_ void ** state);
21672150};
21682151
21692152/* *
0 commit comments