Skip to content

Commit 7d5fa42

Browse files
committed
[SYCL][Graph] Add implementation and modify tests
1 parent df50bdc commit 7d5fa42

File tree

5 files changed

+24
-4
lines changed

5 files changed

+24
-4
lines changed

sycl/include/sycl/ext/oneapi/experimental/enqueue_functions.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <sycl/detail/common.hpp>
1414
#include <sycl/event.hpp>
15+
#include <sycl/ext/oneapi/experimental/graph.hpp>
1516
#include <sycl/ext/oneapi/properties/properties.hpp>
1617
#include <sycl/handler.hpp>
1718
#include <sycl/nd_range.hpp>
@@ -103,13 +104,22 @@ void submit(queue Q, CommandGroupFunc &&CGF,
103104
Q, std::forward<CommandGroupFunc>(CGF), CodeLoc);
104105
}
105106

107+
__SYCL_EXPORT void submit(queue Q, command_graph<graph_state::executable> G,
108+
const sycl::detail::code_location &CodeLoc =
109+
sycl::detail::code_location::current());
110+
106111
template <typename CommandGroupFunc>
107112
event submit_with_event(queue Q, CommandGroupFunc &&CGF,
108113
const sycl::detail::code_location &CodeLoc =
109114
sycl::detail::code_location::current()) {
110115
return Q.submit(std::forward<CommandGroupFunc>(CGF), CodeLoc);
111116
}
112117

118+
__SYCL_EXPORT event
119+
submit_with_event(queue Q, command_graph<graph_state::executable> G,
120+
const sycl::detail::code_location &CodeLoc =
121+
sycl::detail::code_location::current());
122+
113123
template <typename KernelName = sycl::detail::auto_name, typename KernelType>
114124
void single_task(handler &CGH, const KernelType &KernelObj) {
115125
CGH.single_task<KernelName>(KernelObj);

sycl/source/enqueue_functions.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ __SYCL_EXPORT void mem_advise(queue Q, void *Ptr, size_t NumBytes, int Advice,
3838
/*CallerNeedsEvent=*/false);
3939
}
4040

41+
__SYCL_EXPORT event
42+
submit_with_event(queue Q, command_graph<graph_state::executable> G,
43+
const sycl::detail::code_location &CodeLoc) {
44+
return Q.ext_oneapi_graph(G, CodeLoc);
45+
}
46+
47+
__SYCL_EXPORT void submit(queue Q, command_graph<graph_state::executable> G,
48+
const sycl::detail::code_location &CodeLoc) {
49+
Q.ext_oneapi_graph(G, CodeLoc);
50+
}
51+
4152
} // namespace ext::oneapi::experimental
4253
} // namespace _V1
4354
} // namespace sycl

sycl/test-e2e/Graph/RecordReplay/ext_oneapi_enqueue_functions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ int main() {
4343

4444
auto GraphExec = Graph.finalize();
4545

46-
InOrderQueue.submit([&](handler &CGH) { CGH.ext_oneapi_graph(GraphExec); });
46+
exp_ext::submit(InOrderQueue, GraphExec);
4747
InOrderQueue.wait_and_throw();
4848

4949
free(PtrA, InOrderQueue);

sycl/test-e2e/Graph/RecordReplay/ext_oneapi_enqueue_functions_submit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ int main() {
6060

6161
auto GraphExec = Graph.finalize();
6262

63-
Queue.submit([&](handler &CGH) { CGH.ext_oneapi_graph(GraphExec); });
63+
exp_ext::submit(Queue, GraphExec);
6464
Queue.wait_and_throw();
6565
}
6666

sycl/test-e2e/Graph/RecordReplay/ext_oneapi_enqueue_functions_submit_with_event.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ int main() {
5252

5353
auto GraphExec = Graph.finalize();
5454

55-
Queue.submit([&](handler &CGH) { CGH.ext_oneapi_graph(GraphExec); });
56-
Queue.wait_and_throw();
55+
exp_ext::submit_with_event(Queue, GraphExec).wait();
5756

5857
free(PtrA, Queue);
5958
free(PtrB, Queue);

0 commit comments

Comments
 (0)