-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Fix working with subbuffers with non-nil offset #957
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
[SYCL] Fix working with subbuffers with non-nil offset #957
Conversation
@@ -320,11 +320,13 @@ Command *Scheduler::GraphBuilder::addHostAccessor(Requirement *Req) { | |||
|
|||
AllocaCommandBase *SrcAllocaCmd = nullptr; | |||
|
|||
if (Record->MAllocaCommands.empty()) | |||
if (Record->MAllocaCommands.empty() || IsSuitableSubReq(Req)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getOrCreateAllocaForReq() method contains a proper procedure to create/find alloca cmd for subbuffer. That is why there is this kind of hack: regardless of whether alloca commands collection is non-empty go on and getOrCreate it. The method will lookup for it in first place, though. It'll not find the correct alloca command 'cause there is no equality of MOffsetInBytes. After that the method will create a proper alloca cmd for subbuffer.
@@ -320,11 +320,13 @@ Command *Scheduler::GraphBuilder::addHostAccessor(Requirement *Req) { | |||
|
|||
AllocaCommandBase *SrcAllocaCmd = nullptr; | |||
|
|||
if (Record->MAllocaCommands.empty()) | |||
if (Record->MAllocaCommands.empty() || IsSuitableSubReq(Req)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another approach here might be to check if SrcAllocaCmd is null and create it the same way getOrCreateAllocaForReq does if IsSuitableSubReq(Req) returns true. Thing is, this approach would violate code reuse. Although after refactoring there will be more places to edit in case of logic change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second commit implements this second approach. And fixes faults on GPU which were added with first commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest doing something like this instead:
diff --git a/sycl/source/detail/scheduler/graph_builder.cpp b/sycl/source/detail/scheduler/graph_builder.cpp
index b150f66..6c5b682 100644
--- a/sycl/source/detail/scheduler/graph_builder.cpp
+++ b/sycl/source/detail/scheduler/graph_builder.cpp
@@ -320,14 +320,21 @@ Command *Scheduler::GraphBuilder::addHostAccessor(Requirement *Req) {
·
AllocaCommandBase *SrcAllocaCmd = nullptr;
·
- if (Record->MAllocaCommands.empty())
- SrcAllocaCmd = getOrCreateAllocaForReq(Record, Req, HostQueue);
- else
- SrcAllocaCmd = findAllocaForReq(Record, Req, Record->MCurContext);
+ AllocaCommandBase *HostAllocaCmd =
+ getOrCreateAllocaForReq(Record, Req, HostQueue);
·
- if (!SrcAllocaCmd->getQueue()->is_host())
+ if (!sameCtx(HostAllocaCmd->getQueue()->get_context_impl(),
+ Record->MCurContext))
insertMemoryMove(Record, Req, HostQueue);
·
+ //if (Record->MAllocaCommands.empty())
+ //SrcAllocaCmd = getOrCreateAllocaForReq(Record, Req, HostQueue);
+ //else
+ //SrcAllocaCmd = findAllocaForReq(Record, Req, Record->MCurContext);
+
+ //if (!SrcAllocaCmd->getQueue()->is_host())
+ //insertMemoryMove(Record, Req, HostQueue);
+
Command *UpdateHostAccCmd = insertUpdateHostReqCmd(Record, Req, HostQueue);
·
// Need empty command to be blocked until host accessor is destructed
da2df9c
to
c4247a8
Compare
Done |
b1d0924
to
809318e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Sergey Kanaev <[email protected]>
Signed-off-by: Sergey Kanaev <[email protected]>
Signed-off-by: Sergey Kanaev <[email protected]>
Signed-off-by: Sergey Kanaev <[email protected]>
809318e
to
ed0b812
Compare
No description provided.