Skip to content

Commit b3a31b6

Browse files
committed
Applying comments
Signed-off-by: Vlad Romanov <[email protected]>
1 parent 6b67aaf commit b3a31b6

File tree

4 files changed

+24
-20
lines changed

4 files changed

+24
-20
lines changed

sycl/include/CL/sycl/detail/sycl_mem_obj_i.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class SYCLMemObjI {
3939
// InitFromUserData indicates that the returned memory should be intialized
4040
// with the data provided by user(if any). Usually it should happen on the
4141
// first allocation of memory for the memory object.
42-
// Non null HostPtr requires allocation to be made USE_HOST_PTR property.
42+
// Non null HostPtr requires allocation to be made with USE_HOST_PTR property.
4343
// Method returns a pointer to host allocation if Context is host one and
4444
// cl_mem obect if not.
4545
virtual void *allocateMem(ContextImplPtr Context, bool InitFromUserData,

sycl/source/detail/scheduler/commands.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ cl_int AllocaCommand::enqueueImp() {
194194
if (!MIsLeaderAlloca) {
195195

196196
if (MQueue->is_host()) {
197-
// Do not need make allocation if we have linked device allocation
197+
// Do not need to make allocation if we have a linked device allocation
198198
Command::waitForEvents(MQueue, RawEvents, Event);
199199
return CL_SUCCESS;
200200
}
@@ -277,7 +277,7 @@ cl_int ReleaseCommand::enqueueImp() {
277277
bool NeedUnmap = false;
278278
if (MAllocaCmd->MLinkedAllocaCmd) {
279279

280-
// When releasing one of the "linked" allocation special rules take place:
280+
// When releasing one of the "linked" allocations special rules take place:
281281
// 1. Device allocation should always be released.
282282
// 2. Host allocation should be released if host allocation is "leader".
283283
// 3. Device alloca in the pair should be in active state in order to be
@@ -295,7 +295,7 @@ cl_int ReleaseCommand::enqueueImp() {
295295
const QueueImplPtr &Queue = CurAllocaIsHost
296296
? MAllocaCmd->MLinkedAllocaCmd->getQueue()
297297
: MAllocaCmd->getQueue();
298-
RT::PiEvent MapEvent = nullptr;
298+
RT::PiEvent UnmapEvent = nullptr;
299299

300300
void *Src = CurAllocaIsHost
301301
? MAllocaCmd->getMemAllocation()
@@ -307,10 +307,10 @@ cl_int ReleaseCommand::enqueueImp() {
307307

308308
MemoryManager::unmap(MAllocaCmd->getSYCLMemObj(), Dst, Queue, Src,
309309
std::move(RawEvents), /*MUseExclusiveQueue*/ false,
310-
MapEvent);
310+
UnmapEvent);
311311

312312
std::swap(MAllocaCmd->MIsActive, MAllocaCmd->MLinkedAllocaCmd->MIsActive);
313-
RawEvents.push_back(MapEvent);
313+
RawEvents.push_back(UnmapEvent);
314314
}
315315

316316
RT::PiEvent &Event = MEvent->getHandleRef();

sycl/source/detail/scheduler/graph_builder.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static bool doOverlap(const Requirement *LHS, const Requirement *RHS) {
3535
}
3636

3737
static bool sameCtx(const ContextImplPtr &LHS, const ContextImplPtr &RHS) {
38-
// Consider two different host context to be the same to avoid additional
38+
// Consider two different host contexts to be the same to avoid additional
3939
// allocation on the host
4040
return LHS == RHS || (LHS->is_host() && RHS->is_host());
4141
}
@@ -180,26 +180,30 @@ UpdateHostRequirementCommand *Scheduler::GraphBuilder::insertUpdateHostReqCmd(
180180

181181
// Takes linked alloca commands. Makes AllocaCmdDst command active using map
182182
// or unmap operation.
183-
Command *insertMapUnmapForLinkedCmds(AllocaCommandBase *AllocaCmdSrc,
184-
AllocaCommandBase *AllocaCmdDst) {
185-
assert(AllocaCmdSrc->MLinkedAllocaCmd == AllocaCmdDst);
183+
static Command *insertMapUnmapForLinkedCmds(AllocaCommandBase *AllocaCmdSrc,
184+
AllocaCommandBase *AllocaCmdDst) {
185+
assert(AllocaCmdSrc->MLinkedAllocaCmd == AllocaCmdDst &&
186+
"Expected linked alloca commands");
187+
assert(AllocaCmdSrc->MIsActive &&
188+
"Expected source alloca command to be active");
189+
186190
if (AllocaCmdSrc->getQueue()->is_host()) {
187-
std::unique_ptr<UnMapMemObject> UnMapCmdUPtr(new UnMapMemObject(
191+
UnMapMemObject *UnMapCmd = new UnMapMemObject(
188192
AllocaCmdDst, *AllocaCmdDst->getRequirement(),
189-
&AllocaCmdSrc->MMemAllocation, AllocaCmdDst->getQueue()));
193+
&AllocaCmdSrc->MMemAllocation, AllocaCmdDst->getQueue());
190194

191195
std::swap(AllocaCmdSrc->MIsActive, AllocaCmdDst->MIsActive);
192196

193-
return UnMapCmdUPtr.release();
197+
return UnMapCmd;
194198
}
195199

196-
std::unique_ptr<MapMemObject> MapCmdUPtr(new MapMemObject(
197-
AllocaCmdSrc, *AllocaCmdSrc->getRequirement(),
198-
&AllocaCmdDst->MMemAllocation, AllocaCmdSrc->getQueue()));
200+
MapMemObject *MapCmd =
201+
new MapMemObject(AllocaCmdSrc, *AllocaCmdSrc->getRequirement(),
202+
&AllocaCmdDst->MMemAllocation, AllocaCmdSrc->getQueue());
199203

200204
std::swap(AllocaCmdSrc->MIsActive, AllocaCmdDst->MIsActive);
201205

202-
return MapCmdUPtr.release();
206+
return MapCmd;
203207
}
204208

205209
Command *Scheduler::GraphBuilder::insertMemoryMove(MemObjRecord *Record,

sycl/test/scheduler/HostAcc.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ using namespace cl;
1515
int main() {
1616

1717
bool Fail = false;
18-
// Check that multiple host accessor which are created with read access mode
18+
// Check that multiple host accessors which are created with read access mode
1919
// can exist simultaneously.
2020
sycl::buffer<int, 1> Buf(sycl::range<1>{1});
2121
{
2222
auto Acc1 = Buf.get_access<sycl::access::mode::read>();
2323
auto Acc2 = Buf.get_access<sycl::access::mode::read>();
2424
}
2525

26-
// Check creation of write accessor after read blocks and generate exception
27-
// (special env var is set for throwing exception) caught
26+
// Check that exception is thrown in a dead lock scenario if special
27+
// environment variable is set.
2828
{
2929
bool ExcCaught = false;
3030
try {

0 commit comments

Comments
 (0)