@@ -2027,23 +2027,6 @@ typedef enum OrtEpDataLayout {
20272027 OrtEpDataLayout_Default = OrtEpDataLayout_NCHW,
20282028} OrtEpDataLayout;
20292029
2030- /* *
2031- * \brief Node assignment policies for graph capture validation.
2032- *
2033- * When graph capture is enabled, ORT validates that nodes are assigned to EPs in a way that is
2034- * compatible with graph capture. An EP can specify which validation policy ORT should apply.
2035- *
2036- * \since Version 1.26.
2037- */
2038- typedef enum OrtGraphCaptureNodeAssignmentPolicy {
2039- /* * All nodes in the main graph must be assigned to this EP. No CPU fallback is allowed. */
2040- OrtGraphCaptureNodeAssignmentPolicy_ALL_NODES_ON_EP = 0 ,
2041-
2042- /* * Compute nodes must be on this EP. CPU nodes are allowed for shape computation as long as
2043- * no memory copy nodes exist. */
2044- OrtGraphCaptureNodeAssignmentPolicy_ALLOW_CPU_FOR_SHAPES = 1 ,
2045- } OrtGraphCaptureNodeAssignmentPolicy;
2046-
20472030/* *
20482031 * \brief The OrtEp struct provides functions to implement for an execution provider.
20492032 * \since Version 1.22.
@@ -2363,101 +2346,6 @@ struct OrtEp {
23632346 */
23642347 ORT_API2_STATUS (CreateProfiler, _In_ OrtEp* this_ptr,
23652348 _Outptr_result_maybenull_ OrtEpProfilerImpl** profiler);
2366-
2367- /* * \brief Indicate whether the graph capturing mode (e.g., CUDA graph) is enabled for the provider.
2368- *
2369- * Graph capture allows an EP to record a sequence of device (e.g., GPU) operations during an initial run and replay
2370- * them on subsequent runs, bypassing per-kernel CPU launch overhead.
2371- *
2372- * Applications enable graph capture via EP-specific provider options (e.g., `enable_cuda_graph=1`
2373- * for the CUDA EP). An EP should return true from this function if it has been configured to enable
2374- * graph capture/replay.
2375- *
2376- * **ORT graph capture/replay summary:**
2377- * During OrtSession initialization, ORT calls OrtEp::IsGraphCaptureEnabled() on each EP in the order specified during
2378- * provider registration with the session. If an EP returns true, ORT validates that the graph is suitable for
2379- * graph capture, and if so, caches the EP for graph capture during the next run. The graph validation ensures
2380- * that there are no control flow nodes and that node-to-EP assignments are compatible with the policy specified
2381- * by the EP via OrtEp::GetGraphCaptureNodeAssignmentPolicy().
2382- * Note that an OrtSession only supports graph capture for one EP (i.e., the first EP to claim support).
2383- *
2384- * During the first call to OrtApi::Run() for the OrtSession, ORT performs multiple internal runs of the model
2385- * until the EP indicates that the graph has been captured by returning `true` from `OrtEp::IsGraphCaptured()`.
2386- * If the EP is unable to capture the graph within 8 runs, the call to OrtApi::Run() returns an error OrtStatus.
2387- * Each internal run invokes `OrtEp::OnRunStart()`, normal execution, and `OrtEp::OnRunEnd()`. EPs should use
2388- * these run callbacks to track the number of necessary warm-up runs and begin/end graph capture when ready.
2389- *
2390- * After successful graph capture, subsequent calls to OrtApi::Run() skip normal execution and ORT instead calls
2391- * `OrtEp::ReplayGraph()` directly.
2392- *
2393- * Applications can capture and replay multiple graphs (e.g., one per distinct input shape) by setting the
2394- * `"gpu_graph_id"` run config entry via `OrtApi::AddRunConfigEntry()` to different integer values. ORT passes
2395- * the value as the `graph_annotation_id` parameter to `OrtEp::IsGraphCaptured()` and `OrtEp::ReplayGraph()`.
2396- *
2397- * \param[in] this_ptr The OrtEp instance.
2398- * \return true if graph capture mode is enabled, false otherwise.
2399- *
2400- * \note Implementation of this function is optional. If set to NULL, ORT assumes graph capture is not enabled.
2401- * \note If this function returns true, `OrtEp::IsGraphCaptured` and `OrtEp::ReplayGraph` must also be implemented.
2402- * If either is NULL, ORT will log a warning and ignore this EP for graph capture.
2403- *
2404- * \since Version 1.26.
2405- */
2406- ORT_API_T (bool , IsGraphCaptureEnabled, _In_ const OrtEp* this_ptr);
2407-
2408- /* * \brief Indicate whether a graph has been captured and instantiated.
2409- *
2410- * ORT calls this before each `Session::Run()`. If true, ORT calls `ReplayGraph()` instead of
2411- * normal execution. After a run where this returns false, ORT automatically retries until it
2412- * returns true (handling warm-up runs transparently).
2413- *
2414- * \param[in] this_ptr The OrtEp instance.
2415- * \param[in] graph_annotation_id Identifies which captured graph to query.
2416- * Applications can set this value via `OrtApi::AddRunConfigEntry()` with the key `"gpu_graph_id"`.
2417- * The default value is 0 when the run config entry is not set.
2418- * Setting different IDs allows the EP to capture and manage multiple graphs (e.g., one per
2419- * distinct input shape). A value of -1 means graph capture/replay should be skipped for this run.
2420- * \return true if the graph has been captured, false otherwise.
2421- *
2422- * \note This function must be implemented if `OrtEp::IsGraphCaptureEnabled` is implemented and may return true.
2423- *
2424- * \since Version 1.26.
2425- */
2426- ORT_API_T (bool , IsGraphCaptured, _In_ const OrtEp* this_ptr, _In_ int graph_annotation_id);
2427-
2428- /* * \brief Run the instantiated (captured) graph.
2429- *
2430- * Called by ORT instead of normal execution when `IsGraphCaptured()` returns true.
2431- *
2432- * \param[in] this_ptr The OrtEp instance.
2433- * \param[in] graph_annotation_id Identifies which captured graph to replay.
2434- * Applications can set this value via `OrtApi::AddRunConfigEntry()` with the key `"gpu_graph_id"`.
2435- * The default value is 0 when the run config entry is not set.
2436- * A value of -1 means graph replay should be skipped for this run.
2437- *
2438- * \snippet{doc} snippets.dox OrtStatus Return Value
2439- *
2440- * \note This function must be implemented if `OrtEp::IsGraphCaptureEnabled` is implemented and may return true.
2441- *
2442- * \since Version 1.26.
2443- */
2444- ORT_API2_STATUS (ReplayGraph, _In_ OrtEp* this_ptr, _In_ int graph_annotation_id);
2445-
2446- /* * \brief Get the node assignment validation policy for graph capture.
2447- *
2448- * When graph capture is enabled, ORT validates that nodes are assigned to EPs in a way that is
2449- * compatible with graph capture. This function tells ORT which validation policy to apply.
2450- *
2451- * \param[in] this_ptr The OrtEp instance.
2452- * \return The node assignment policy for graph capture.
2453- *
2454- * \note Implementation of this function is optional. If set to NULL, ORT uses
2455- * OrtGraphCaptureNodeAssignmentPolicy_ALL_NODES_ON_EP (strictest validation).
2456- *
2457- * \since Version 1.26.
2458- */
2459- ORT_API_T (OrtGraphCaptureNodeAssignmentPolicy, GetGraphCaptureNodeAssignmentPolicy,
2460- _In_ const OrtEp* this_ptr);
24612349};
24622350
24632351/* * \brief The function signature that ORT will call to create OrtEpFactory instances.
0 commit comments