-
Notifications
You must be signed in to change notification settings - Fork 791
[SYCL] Graph recording support for handler-less kernel submission path #20250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -420,6 +420,61 @@ queue_impl::submit_impl(const detail::type_erased_cgfo_ty &CGF, | |||||
| return EventImpl; | ||||||
| } | ||||||
|
|
||||||
| EventImplPtr queue_impl::submit_command_to_graph( | ||||||
| ext::oneapi::experimental::detail::graph_impl &GraphImpl, | ||||||
| std::unique_ptr<detail::CG> &CommandGroup, sycl::detail::CGType CGType, | ||||||
| sycl::ext::oneapi::experimental::node_type UserFacingNodeType) { | ||||||
| auto EventImpl = detail::event_impl::create_completed_host_event(); | ||||||
| EventImpl->setSubmittedQueue(weak_from_this()); | ||||||
| ext::oneapi::experimental::detail::node_impl *NodeImpl = nullptr; | ||||||
|
|
||||||
| // GraphImpl is read and written in this scope so we lock this graph | ||||||
| // with full priviledges. | ||||||
| ext::oneapi::experimental::detail::graph_impl::WriteLock Lock( | ||||||
| GraphImpl.MMutex); | ||||||
|
|
||||||
| ext::oneapi::experimental::node_type NodeType = | ||||||
| UserFacingNodeType != ext::oneapi::experimental::node_type::empty | ||||||
| ? UserFacingNodeType | ||||||
| : ext::oneapi::experimental::detail::getNodeTypeFromCG(CGType); | ||||||
|
|
||||||
| // Create a new node in the graph representing this command-group | ||||||
| if (isInOrder()) { | ||||||
| // In-order queues create implicit linear dependencies between nodes. | ||||||
| // Find the last node added to the graph from this queue, so our new | ||||||
| // node can set it as a predecessor. | ||||||
| std::vector<ext::oneapi::experimental::detail::node_impl *> Deps; | ||||||
| if (ext::oneapi::experimental::detail::node_impl *DependentNode = | ||||||
| GraphImpl.getLastInorderNode(this)) { | ||||||
| Deps.push_back(DependentNode); | ||||||
| } | ||||||
| NodeImpl = &GraphImpl.add(NodeType, std::move(CommandGroup), Deps); | ||||||
|
|
||||||
| // If we are recording an in-order queue remember the new node, so it | ||||||
| // can be used as a dependency for any more nodes recorded from this | ||||||
| // queue. | ||||||
| GraphImpl.setLastInorderNode(*this, *NodeImpl); | ||||||
| } else { | ||||||
| ext::oneapi::experimental::detail::node_impl *LastBarrierRecordedFromQueue = | ||||||
| GraphImpl.getBarrierDep(weak_from_this()); | ||||||
| std::vector<ext::oneapi::experimental::detail::node_impl *> Deps; | ||||||
|
|
||||||
| if (LastBarrierRecordedFromQueue) { | ||||||
| Deps.push_back(LastBarrierRecordedFromQueue); | ||||||
| } | ||||||
| NodeImpl = &GraphImpl.add(NodeType, std::move(CommandGroup), Deps); | ||||||
|
|
||||||
| if (NodeImpl->MCGType == sycl::detail::CGType::Barrier) { | ||||||
| GraphImpl.setBarrierDep(weak_from_this(), *NodeImpl); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| // Associate an event with this new node and return the event. | ||||||
| GraphImpl.addEventForNode(EventImpl, *NodeImpl); | ||||||
|
|
||||||
| return EventImpl; | ||||||
| } | ||||||
|
|
||||||
| detail::EventImplPtr queue_impl::submit_kernel_direct_impl( | ||||||
| const NDRDescT &NDRDesc, | ||||||
| std::shared_ptr<detail::HostKernelBase> &HostKernel, | ||||||
|
|
@@ -454,6 +509,11 @@ detail::EventImplPtr queue_impl::submit_kernel_direct_impl( | |||||
| CodeLoc)); | ||||||
| CommandGroup->MIsTopCodeLoc = IsTopCodeLoc; | ||||||
|
|
||||||
| if (auto GraphImpl = getCommandGraph(); GraphImpl) { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Just a non-blocking nitpick, might just be my personal preference though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I will address this in a future PR. |
||||||
| return submit_command_to_graph(*GraphImpl, CommandGroup, | ||||||
| detail::CGType::Kernel); | ||||||
| } | ||||||
|
|
||||||
| return detail::Scheduler::getInstance().addCG(std::move(CommandGroup), | ||||||
| *this, true); | ||||||
| }; | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.