Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions sycl/cmake/modules/UnifiedRuntimeTag.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# commit f01741af022cfe82afcb026b9aa0be251eb6a497
# Merge: 004d2474 85bb5f62
# Author: Callum Fare <callum@codeplay.com>
# Date: Tue Nov 5 13:39:53 2024 +0000
# Merge pull request #2260 from nrspruit/refactor_l0_default_init
# [L0] Refactor to remove default constructor inits
set(UNIFIED_RUNTIME_TAG f01741af022cfe82afcb026b9aa0be251eb6a497)
# commit 3edf99755ce2af3b53102a7d8438e0fe969efac3
# Merge: 5955bad3 0b968661
# Author: Ross Brunton <ross@codeplay.com>
# Date: Wed Nov 6 11:07:29 2024 +0000
# Merge pull request #2082 from RossBrunton/ross/multiadapt
# [CI] Add "loader" support to conformance testing
set(UNIFIED_RUNTIME_TAG 3edf99755ce2af3b53102a7d8438e0fe969efac3)
10 changes: 10 additions & 0 deletions sycl/test-e2e/Graph/Explicit/local_accessor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
// RUN: %if level_zero %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %}
// Extra run to check for immediate-command-list in Level Zero
// RUN: %if level_zero %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %}

#define GRAPH_E2E_EXPLICIT

#include "../Inputs/local_accessor.cpp"
54 changes: 54 additions & 0 deletions sycl/test-e2e/Graph/Inputs/local_accessor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Tests basic adding of nodes with local accessors,
// and submission of the graph.

#include "../graph_common.hpp"

int main() {
queue Queue{};

using T = int;

const size_t LocalSize = 128;

std::vector<T> DataA(Size), DataB(Size), DataC(Size);

std::iota(DataA.begin(), DataA.end(), 10);

std::vector<T> ReferenceA(DataA);

exp_ext::command_graph Graph{Queue.get_context(), Queue.get_device()};

T *PtrA = malloc_device<T>(Size, Queue);

Queue.copy(DataA.data(), PtrA, Size);
Queue.wait_and_throw();

auto node = add_node(Graph, Queue, [&](handler &CGH) {
local_accessor<T, 1> LocalMem(LocalSize, CGH);

CGH.parallel_for(nd_range({Size}, {LocalSize}), [=](nd_item<1> Item) {
LocalMem[Item.get_local_linear_id()] = Item.get_global_linear_id() * 2;
PtrA[Item.get_global_linear_id()] += LocalMem[Item.get_local_linear_id()];
});
});

auto GraphExec = Graph.finalize();

for (unsigned n = 0; n < Iterations; n++) {
Queue.submit([&](handler &CGH) { CGH.ext_oneapi_graph(GraphExec); });
}

Queue.wait_and_throw();

Queue.copy(PtrA, DataA.data(), Size);
Queue.wait_and_throw();

free(PtrA, Queue);

for (size_t i = 0; i < Size; i++) {
T Ref = 10 + i + (i * 2);
check_value(i, Ref, ReferenceA[i], "PtrA");
}

return 0;
}
93 changes: 93 additions & 0 deletions sycl/test-e2e/Graph/Inputs/whole_update_local_acc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// Tests whole graph update of nodes with local accessors,
// and submission of the graph.

#include "../graph_common.hpp"

using T = int;

auto add_graph_node(
exp_ext::command_graph<exp_ext::graph_state::modifiable> &Graph,
queue &Queue, size_t Size, size_t LocalSize, T *Ptr) {
return add_node(Graph, Queue, [&](handler &CGH) {
local_accessor<T, 1> LocalMem(LocalSize, CGH);

CGH.parallel_for(nd_range({Size}, {LocalSize}), [=](nd_item<1> Item) {
LocalMem[Item.get_local_linear_id()] = Item.get_global_linear_id() * 2;
Ptr[Item.get_global_linear_id()] +=
LocalMem[Item.get_local_linear_id()] + Item.get_local_range(0);
});
});
}
int main() {
queue Queue{};

const size_t LocalSize = 128;

std::vector<T> DataA(Size), DataB(Size);

std::iota(DataA.begin(), DataA.end(), 10);
std::iota(DataB.begin(), DataB.end(), 10);

std::vector<T> ReferenceA(DataA), ReferenceB(DataB);

exp_ext::command_graph GraphA{Queue.get_context(), Queue.get_device()};

T *PtrA = malloc_device<T>(Size, Queue);
T *PtrB = malloc_device<T>(Size, Queue);

Queue.copy(DataA.data(), PtrA, Size);
Queue.copy(DataB.data(), PtrB, Size);
Queue.wait_and_throw();

auto NodeA = add_graph_node(GraphA, Queue, Size, LocalSize / 2, PtrA);

auto GraphExecA = GraphA.finalize(exp_ext::property::graph::updatable{});

// Create second graph for whole graph update with a different local size
exp_ext::command_graph GraphB{Queue.get_context(), Queue.get_device()};
auto NodeB = add_graph_node(GraphB, Queue, Size, LocalSize, PtrB);

// Execute graphs before updating and check outputs
for (unsigned n = 0; n < Iterations; n++) {
Queue.submit([&](handler &CGH) { CGH.ext_oneapi_graph(GraphExecA); });
}

Queue.wait_and_throw();

Queue.copy(PtrA, DataA.data(), Size);
Queue.copy(PtrB, DataB.data(), Size);
Queue.wait_and_throw();

for (size_t i = 0; i < Size; i++) {
T RefA = 10 + i + (i * 2) + LocalSize / 2;
T RefB = 10 + i;
check_value(i, RefA, ReferenceA[i], "PtrA");
check_value(i, RefB, ReferenceB[i], "PtrB");
}

// Update GraphExecA using whole graph update

GraphExecA.update(GraphB);

// Execute graphs again and check outputs
for (unsigned n = 0; n < Iterations; n++) {
Queue.submit([&](handler &CGH) { CGH.ext_oneapi_graph(GraphExecA); });
}

Queue.wait_and_throw();

Queue.copy(PtrA, DataA.data(), Size);
Queue.copy(PtrB, DataB.data(), Size);
Queue.wait_and_throw();

for (size_t i = 0; i < Size; i++) {
T RefA = 10 + i + (i * 2) + LocalSize / 2;
T RefB = 10 + i + (i * 2) + LocalSize;
check_value(i, RefA, ReferenceA[i], "PtrA");
check_value(i, RefB, ReferenceB[i], "PtrB");
}

free(PtrA, Queue);
free(PtrB, Queue);
return 0;
}
10 changes: 10 additions & 0 deletions sycl/test-e2e/Graph/RecordReplay/local_accessor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
// RUN: %if level_zero %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %}
// Extra run to check for immediate-command-list in Level Zero
// RUN: %if level_zero %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %}

#define GRAPH_E2E_RECORD_REPLAY

#include "../Inputs/local_accessor.cpp"
10 changes: 10 additions & 0 deletions sycl/test-e2e/Graph/Update/Explicit/whole_update_local_acc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
// RUN: %if level_zero %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %}
// Extra run to check for immediate-command-list in Level Zero
// RUN: %if level_zero %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %}

#define GRAPH_E2E_EXPLICIT

#include "../../Inputs/whole_update_local_acc.cpp"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
// RUN: %if level_zero %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %}
// Extra run to check for immediate-command-list in Level Zero
// RUN: %if level_zero %{env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %}

#define GRAPH_E2E_RECORD_REPLAY

#include "../../Inputs/whole_update_local_acc.cpp"
Loading