@@ -465,33 +465,38 @@ int main() {
465
465
466
466
queue q{default_selector_v};
467
467
468
- ext::oneapi::experimental::command_graph graph;
468
+ ext::oneapi::experimental::command_graph graph{q.get_context(),
469
+ q.get_device()};
469
470
{
470
471
buffer<int> bIn1{in1, range{dataSize}};
471
472
buffer<int> bIn2{in2, range{dataSize}};
472
473
buffer<int> bIn3{in3, range{dataSize}};
473
474
buffer<int> bTmp1{tmp1, range{dataSize}};
474
475
// Internalization specified on the buffer
475
- buffer<int> bTmp2{tmp2, range{dataSize},
476
- {sycl::ext::oneapi::experimental::property::promote_private{}}};
476
+ buffer<int> bTmp2{
477
+ tmp2,
478
+ range{dataSize},
479
+ {sycl::ext::oneapi::experimental::property::promote_private{}}};
477
480
// Internalization specified on the buffer
478
- buffer<int> bTmp3{tmp3, range{dataSize},
479
- {sycl::ext::oneapi::experimental::property::promote_private{}}};
481
+ buffer<int> bTmp3{
482
+ tmp3,
483
+ range{dataSize},
484
+ {sycl::ext::oneapi::experimental::property::promote_private{}}};
480
485
buffer<int> bOut{out, range{dataSize}};
481
486
482
487
graph.begin_recording(q);
483
488
484
489
q.submit([&](handler &cgh) {
485
490
auto accIn1 = bIn1.get_access(cgh);
486
491
auto accIn2 = bIn2.get_access(cgh);
487
- // Internalization specified on each accessor.
492
+ // Internalization specified on each accessor.
488
493
auto accTmp1 = bTmp1.get_access(
489
494
cgh, sycl::ext::oneapi::experimental::property::promote_private{});
490
495
cgh.parallel_for<AddKernel>(dataSize, AddKernel{accIn1, accIn2, accTmp1});
491
496
});
492
497
493
498
q.submit([&](handler &cgh) {
494
- // Internalization specified on each accessor.
499
+ // Internalization specified on each accessor.
495
500
auto accTmp1 = bTmp1.get_access(
496
501
cgh, sycl::ext::oneapi::experimental::property::promote_private{});
497
502
auto accIn3 = bIn3.get_access(cgh);
@@ -501,7 +506,7 @@ int main() {
501
506
});
502
507
503
508
q.submit([&](handler &cgh) {
504
- // Internalization specified on each accessor.
509
+ // Internalization specified on each accessor.
505
510
auto accTmp1 = bTmp1.get_access(
506
511
cgh, sycl::ext::oneapi::experimental::property::promote_private{});
507
512
auto accTmp3 = bTmp3.get_access(cgh);
@@ -520,12 +525,11 @@ int main() {
520
525
graph.end_recording();
521
526
522
527
// Trigger fusion during finalization.
523
- auto exec_graph = graph.finalize(q.get_context(),
524
- {sycl::ext::oneapi::experimental::property::command_graph::perform_fusion});
528
+ auto exec_graph =
529
+ graph.finalize({sycl::ext::oneapi::experimental::property::
530
+ command_graph::perform_fusion});
525
531
526
- q.submit([&](handler& cgh) {
527
- cgh.ext_oneapi_graph(exec_graph);
528
- });
532
+ q.ext_oneapi_graph(exec_graph);
529
533
}
530
534
return 0;
531
535
}
@@ -548,7 +552,7 @@ int main() {
548
552
549
553
queue q{default_selector_v};
550
554
551
- sycl_ext::command_graph graph;
555
+ sycl_ext::command_graph graph{q.get_context(), q.get_device()} ;
552
556
553
557
int *dIn1, dIn2, dIn3, dTmp, dOut;
554
558
@@ -558,7 +562,8 @@ int main() {
558
562
dOut = malloc_device<int>(q, dataSize);
559
563
560
564
// Specify internalization for an USM pointer
561
- dTmp = malloc_device<int>(q, dataSize,
565
+ dTmp = malloc_device<int>(
566
+ q, dataSize,
562
567
{sycl::ext::oneapi::experimental::property::promote_private});
563
568
564
569
// This explicit memory operation is compatible with fusion, as it can be
@@ -597,8 +602,7 @@ int main() {
597
602
{sycl_ext::property::node::depends_on(kernel2)});
598
603
599
604
// Trigger fusion during finalization.
600
- auto exec = graph.finalize(q.get_context(),
601
- {sycl::ext::oneapi::experimental::property::
605
+ auto exec = graph.finalize({sycl::ext::oneapi::experimental::property::
602
606
command_graph::perform_fusion});
603
607
604
608
// use queue shortcut for graph submission
@@ -630,4 +634,5 @@ Ewan Crawford, Codeplay +
630
634
|Rev|Date|Authors|Changes
631
635
|1|2023-02-16|Lukas Sommer|*Initial draft*
632
636
|2|2023-03-16|Lukas Sommer|*Remove reference to outdated `add_malloc_device` API*
637
+ |3|2023-04-11|Lukas Sommer|*Update usage examples for graph API changes*
633
638
|========================================
0 commit comments