llvm
53c9b59b - [SYCL][GRAPH] Add empty method on graph (#21554)

Commit
38 days ago
[SYCL][GRAPH] Add empty method on graph (#21554) ## Summary Adds `empty()` on modifiable command graphs so callers can test graph emptiness without relying on `get_nodes()`. ## Motivation We need to support **both native Level Zero graphs and SYCL graphs** behind a common usage pattern. Native L0 graph APIs expose something like **`empty()`** but **not** **`get_nodes()`**. **PyTorch** (and similar stacks) today often checks emptiness via **`get_nodes()`**. That breaks when switching to **native L0 graphs**, where `get_nodes()` is not available. Exposing **`empty()`** on the SYCL modifiable graph matches what native graphs can offer and gives PyTorch a single, portable way to ask “is this graph empty?” for both paths. ## Changes - **`modifiable_command_graph::empty()`** — `true` when the graph has no nodes. - **Spec** — `empty()` documented in `sycl_ext_oneapi_graph.asciidoc` (aligned with `get_nodes` / `get_root_nodes`). - **API docs** — Doxygen on `empty()` in `modifiable_graph.hpp`. - **Tests** — `CommandGraphTest::GraphEmpty` in `Queries.cpp` (public API, consistency with `get_nodes()`, vs `graph_impl`). ## Testing - `CommandGraphExtensionTests` — includes new `GraphEmpty` coverage.
Author
Parents
Loading