Skip to content

[SYCL][GRAPH] Add empty method on graph#21554

Draft
lslusarczyk wants to merge 1 commit intointel:syclfrom
lslusarczyk:empty-method
Draft

[SYCL][GRAPH] Add empty method on graph#21554
lslusarczyk wants to merge 1 commit intointel:syclfrom
lslusarczyk:empty-method

Conversation

@lslusarczyk
Copy link
Contributor

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.
  • Specempty() documented in sycl_ext_oneapi_graph.asciidoc (aligned with get_nodes / get_root_nodes).
  • API docs — Doxygen on empty() in modifiable_graph.hpp.
  • TestsCommandGraphTest::GraphEmpty in Queries.cpp (public API, consistency with get_nodes(), vs graph_impl).

Testing

  • CommandGraphExtensionTests — includes new GraphEmpty coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant