Skip to content

Commit

Permalink
Merge remote-tracking branch 'intel/sycl' into steffen/event_with_enq…
Browse files Browse the repository at this point in the history
…ueue
  • Loading branch information
steffenlarsen committed Mar 5, 2024
2 parents 85f47a3 + 6e8cdb1 commit 19926ab
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ inline constexpr grf_size_key::value_t<Size> grf_size;
inline constexpr grf_size_automatic_key::value_t grf_size_automatic;

} // namespace ext::intel::experimental
namespace ext::oneapi::experimental {
namespace ext::oneapi::experimental::detail {
template <unsigned int Size>
struct PropertyMetaInfo<
sycl::ext::intel::experimental::grf_size_key::value_t<Size>> {
Expand Down Expand Up @@ -79,7 +79,6 @@ struct ConflictingProperties<sycl::detail::register_alloc_mode_key, Properties>
sycl::ext::intel::experimental::grf_size_automatic_key,
Properties>::value> {};

} // namespace detail
} // namespace ext::oneapi::experimental
} // namespace ext::oneapi::experimental::detail
} // namespace _V1
} // namespace sycl
4 changes: 4 additions & 0 deletions sycl/source/detail/event_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ class event_impl {
return MEventFromSubmittedExecCommandBuffer;
}

const std::vector<EventImplPtr> &getPostCompleteEvents() const {
return MPostCompleteEvents;
}

void markAsProfilingTagEvent() { MProfilingTagEvent = true; }

bool isProfilingTagEvent() const noexcept { return MProfilingTagEvent; }
Expand Down
16 changes: 12 additions & 4 deletions sycl/source/detail/graph_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,9 @@ exec_graph_impl::enqueue(const std::shared_ptr<sycl::detail::queue_impl> &Queue,
sycl::detail::CG::StorageInitHelper CGData) {
WriteLock Lock(MMutex);

std::vector<sycl::detail::EventImplPtr> PartitionEvents;
// Map of the partitions to their execution events
std::unordered_map<std::shared_ptr<partition>, sycl::detail::EventImplPtr>
PartitionsExecutionEvents;

auto CreateNewEvent([&]() {
auto NewEvent = std::make_shared<sycl::detail::event_impl>(Queue);
Expand All @@ -787,7 +789,7 @@ exec_graph_impl::enqueue(const std::shared_ptr<sycl::detail::queue_impl> &Queue,
}

for (auto const &DepPartition : CurrentPartition->MPredecessors) {
CGData.MEvents.push_back(MPartitionsExecutionEvents[DepPartition]);
CGData.MEvents.push_back(PartitionsExecutionEvents[DepPartition]);
}

auto CommandBuffer =
Expand Down Expand Up @@ -819,7 +821,13 @@ exec_graph_impl::enqueue(const std::shared_ptr<sycl::detail::queue_impl> &Queue,
sycl::backend::ext_oneapi_level_zero) {
Event->wait(Event);
} else {
auto &AttachedEventsList = Event->getPostCompleteEvents();
CGData.MEvents.reserve(AttachedEventsList.size() + 1);
CGData.MEvents.push_back(Event);
// Add events of the previous execution of all graph partitions.
for (auto &AttachedEvent : AttachedEventsList) {
CGData.MEvents.push_back(AttachedEvent);
}
}
++It;
} else {
Expand Down Expand Up @@ -929,15 +937,15 @@ exec_graph_impl::enqueue(const std::shared_ptr<sycl::detail::queue_impl> &Queue,
NewEvent->setStateIncomplete();
NewEvent->getPreparedDepsEvents() = ScheduledEvents;
}
MPartitionsExecutionEvents[CurrentPartition] = NewEvent;
PartitionsExecutionEvents[CurrentPartition] = NewEvent;
}

// Keep track of this execution event so we can make sure it's completed in
// the destructor.
MExecutionEvents.push_back(NewEvent);
// Attach events of previous partitions to ensure that when the returned event
// is complete all execution associated with the graph have been completed.
for (auto const &Elem : MPartitionsExecutionEvents) {
for (auto const &Elem : PartitionsExecutionEvents) {
if (Elem.second != NewEvent) {
NewEvent->attachEventToComplete(Elem.second);
}
Expand Down
3 changes: 0 additions & 3 deletions sycl/source/detail/graph_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1192,9 +1192,6 @@ class exec_graph_impl {
std::vector<sycl::detail::EventImplPtr> MExecutionEvents;
/// List of the partitions that compose the exec graph.
std::vector<std::shared_ptr<partition>> MPartitions;
/// Map of the partitions to their execution events
std::unordered_map<std::shared_ptr<partition>, sycl::detail::EventImplPtr>
MPartitionsExecutionEvents;
/// Storage for copies of nodes from the original modifiable graph.
std::vector<std::shared_ptr<node_impl>> MNodeStorage;
};
Expand Down

0 comments on commit 19926ab

Please sign in to comment.