Add refcount on MemObj in blocked scenarios.

- Prevents destruction of MemObj while it may still be in use.
- Add UNRECOVERABLE to check whether object is deleted while having
dependencies, fix all problems is tests due to that fact.
- Fix special queue setting, clean interfaces.

Change-Id: I2a467e80df00ea1650decdcfa6866acf10b441f8
This commit is contained in:
Mrozek, Michal
2018-01-05 11:33:30 +01:00
committed by sys_ocldev
parent c838a7dfc6
commit b00819cafe
24 changed files with 247 additions and 160 deletions

View File

@@ -45,6 +45,15 @@ KernelOperation::~KernelOperation() {
alignedFree(commandStream->getBase());
}
CommandMapUnmap::CommandMapUnmap(MapOperationType op, MemObj &memObj, CommandStreamReceiver &csr, CommandQueue &cmdQ)
: memObj(memObj), csr(csr), cmdQ(cmdQ), op(op) {
memObj.incRefInternal();
}
CommandMapUnmap::~CommandMapUnmap() {
memObj.decRefInternal();
}
CompletionStamp &CommandMapUnmap::submit(uint32_t taskLevel, bool terminated) {
if (terminated) {
return completionStamp;
@@ -77,12 +86,12 @@ CompletionStamp &CommandMapUnmap::submit(uint32_t taskLevel, bool terminated) {
cmdQ.waitUntilComplete(completionStamp.taskCount, completionStamp.flushStamp);
if (m.isMemObjZeroCopy() == false) {
if (memObj.isMemObjZeroCopy() == false) {
if (op == MAP) {
m.transferDataToHostPtr();
memObj.transferDataToHostPtr();
} else {
DEBUG_BREAK_IF(op != UNMAP);
m.transferDataFromHostPtrToMemoryStorage();
memObj.transferDataFromHostPtrToMemoryStorage();
}
}

View File

@@ -59,13 +59,12 @@ class Command : public IFNode<Command> {
class CommandMapUnmap : public Command {
public:
CommandMapUnmap(MapOperationType op, MemObj &m, CommandStreamReceiver &csr, CommandQueue &cmdQ)
: m(m), csr(csr), cmdQ(cmdQ), op(op) {
}
CommandMapUnmap(MapOperationType op, MemObj &memObj, CommandStreamReceiver &csr, CommandQueue &cmdQ);
~CommandMapUnmap() override;
CompletionStamp &submit(uint32_t taskLevel, bool terminated) override;
private:
MemObj &m;
MemObj &memObj;
CommandStreamReceiver &csr;
CommandQueue &cmdQ;
MapOperationType op;