Skip to content

Commit

Permalink
Pass prop-list to executable_command_graph constructor + typos
Browse files Browse the repository at this point in the history
  • Loading branch information
mfrancepillois committed Mar 6, 2024
1 parent e4ee57e commit 0318696
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
5 changes: 3 additions & 2 deletions sycl/include/sycl/ext/oneapi/experimental/graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,11 @@ class __SYCL_EXPORT executable_command_graph {
/// Constructor used by internal runtime.
/// @param Graph Detail implementation class to construct with.
/// @param Ctx Context to use for graph.
/// @param EnableProfiling Enable graph profiling.
/// @param PropList Optional list of properties to pass.
executable_command_graph(const std::shared_ptr<detail::graph_impl> &Graph,
const sycl::context &Ctx,
const bool EnableProfiling = false);
const property_list &PropList = {});


template <class Obj>
friend decltype(Obj::impl)
Expand Down
13 changes: 4 additions & 9 deletions sycl/source/detail/graph_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ void exec_graph_impl::createCommandBuffers(
sycl::detail::pi::PiExtCommandBuffer OutCommandBuffer;
sycl::detail::pi::PiExtCommandBufferDesc Desc{
pi_ext_structure_type::PI_EXT_STRUCTURE_TYPE_COMMAND_BUFFER_DESC, nullptr,
pi_bool(Partition->MIsInOrderGraph & !MEnableProfiling),
pi_bool(Partition->MIsInOrderGraph && !MEnableProfiling),
pi_bool(MEnableProfiling)};
auto ContextImpl = sycl::detail::getSyclObjImpl(MContext);
const sycl::detail::PluginPtr &Plugin = ContextImpl->getPlugin();
Expand Down Expand Up @@ -1163,12 +1163,8 @@ modifiable_command_graph::finalize(const sycl::property_list &PropList) const {
// Graph is read and written in this scope so we lock
// this graph with full priviledges.
graph_impl::WriteLock Lock(impl->MMutex);
bool EnableProfiling = false;
if (PropList.has_property<property::graph::enable_profiling>()) {
EnableProfiling = true;
}
return command_graph<graph_state::executable>{
this->impl, this->impl->getContext(), EnableProfiling};
this->impl, this->impl->getContext(), PropList};
}

bool modifiable_command_graph::begin_recording(queue &RecordingQueue) {
Expand Down Expand Up @@ -1283,9 +1279,8 @@ std::vector<node> modifiable_command_graph::get_root_nodes() const {

executable_command_graph::executable_command_graph(
const std::shared_ptr<detail::graph_impl> &Graph, const sycl::context &Ctx,
const bool EnableProfiling)
: impl(std::make_shared<detail::exec_graph_impl>(Ctx, Graph,
EnableProfiling)) {
const property_list &PropList)
: impl(std::make_shared<detail::exec_graph_impl>(Ctx, Graph, PropList)) {
finalizeImpl(); // Create backend representation for executable graph
}

Expand Down
12 changes: 7 additions & 5 deletions sycl/source/detail/graph_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,8 @@ class partition {
MPiCommandBuffers;
/// List of predecessors to this partition.
std::vector<std::shared_ptr<partition>> MPredecessors;
/// True is the graph of this partition is a single path graph
/// and InOrder optmization can be applied on it.
/// True if the graph of this partition is a single path graph
/// and in-order optmization can be applied on it.
bool MIsInOrderGraph = false;

/// @return True if the partition contains a host task
Expand Down Expand Up @@ -1061,12 +1061,14 @@ class exec_graph_impl {
/// nodes).
/// @param Context Context to create graph with.
/// @param GraphImpl Modifiable graph implementation to create with.
/// @param EnableProfiling Enable graph profiling.
/// @param PropList List of properties for constructing this object.
exec_graph_impl(sycl::context Context,
const std::shared_ptr<graph_impl> &GraphImpl,
const bool EnableProfiling = false)
const property_list &PropList)
: MSchedule(), MGraphImpl(GraphImpl), MPiSyncPoints(), MContext(Context),
MRequirements(), MExecutionEvents(), MEnableProfiling(EnableProfiling) {
MRequirements(), MExecutionEvents(),
MEnableProfiling(
PropList.has_property<property::graph::enable_profiling>()) {
// Copy nodes from GraphImpl and merge any subgraph nodes into this graph.
duplicateNodes();
}
Expand Down
4 changes: 2 additions & 2 deletions sycl/test-e2e/Graph/event_profiling_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ int main() {

KernelGraph.end_recording(Queue);

// The profiling is not available with the in-order optimization.
// We therefore disable this optimization.
// The `enable_profiling` property must be passed to the finalize function
// in order to query profiling information.
auto CopyGraphExec =
CopyGraph.finalize(exp_ext::property::graph::enable_profiling{});
auto KernelGraphExec =
Expand Down

0 comments on commit 0318696

Please sign in to comment.