Update clEnqueueVerifyMemory

- return success also for non aub CSRs

Change-Id: Iac7fdcd58e4b76a325ef67fd266f183d779ca956
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2019-01-14 12:52:44 +01:00
committed by sys_ocldev
parent 736c3ac3bd
commit ec03210687
7 changed files with 8 additions and 40 deletions

View File

@@ -4272,11 +4272,7 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueVerifyMemory(cl_command_queue commandQu
}
auto &csr = pCommandQueue->getCommandStreamReceiver();
if (csr.expectMemory(allocationPtr, expectedData, sizeOfComparison, comparisonMode)) {
retVal = CL_SUCCESS;
return retVal;
}
retVal = CL_INVALID_VALUE;
csr.expectMemory(allocationPtr, expectedData, sizeOfComparison, comparisonMode);
retVal = CL_SUCCESS;
return retVal;
}

View File

@@ -54,7 +54,7 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
void expectMemoryEqual(void *gfxAddress, const void *srcAddress, size_t length);
void expectMemoryNotEqual(void *gfxAddress, const void *srcAddress, size_t length);
bool expectMemory(const void *gfxAddress, const void *srcAddress, size_t length, uint32_t compareOperation) override;
void expectMemory(const void *gfxAddress, const void *srcAddress, size_t length, uint32_t compareOperation) override;
void activateAubSubCapture(const MultiDispatchInfo &dispatchInfo) override;

View File

@@ -690,11 +690,10 @@ void AUBCommandStreamReceiverHw<GfxFamily>::expectMemoryNotEqual(void *gfxAddres
}
template <typename GfxFamily>
bool AUBCommandStreamReceiverHw<GfxFamily>::expectMemory(const void *gfxAddress, const void *srcAddress,
void AUBCommandStreamReceiverHw<GfxFamily>::expectMemory(const void *gfxAddress, const void *srcAddress,
size_t length, uint32_t compareOperation) {
if (hardwareContext) {
hardwareContext->expectMemory(reinterpret_cast<uint64_t>(gfxAddress), srcAddress, length, compareOperation);
return true;
}
PageWalker walker = [&](uint64_t physAddress, size_t size, size_t offset, uint64_t entryBits) {
@@ -708,8 +707,6 @@ bool AUBCommandStreamReceiverHw<GfxFamily>::expectMemory(const void *gfxAddress,
};
this->ppgtt->pageWalk(reinterpret_cast<uintptr_t>(gfxAddress), length, 0, PageTableEntry::nonValidBits, walker, MemoryBanks::BankNotSpecified);
return true;
}
template <typename GfxFamily>

View File

@@ -392,9 +392,8 @@ TagAllocator<TimestampPacket> *CommandStreamReceiver::getTimestampPacketAllocato
return timestampPacketAllocator.get();
}
bool CommandStreamReceiver::expectMemory(const void *gfxAddress, const void *srcAddress,
void CommandStreamReceiver::expectMemory(const void *gfxAddress, const void *srcAddress,
size_t length, uint32_t compareOperation) {
return false;
}
} // namespace OCLRT

View File

@@ -168,7 +168,7 @@ class CommandStreamReceiver {
TagAllocator<HwPerfCounter> *getEventPerfCountAllocator();
TagAllocator<TimestampPacket> *getTimestampPacketAllocator();
virtual bool expectMemory(const void *gfxAddress, const void *srcAddress, size_t length, uint32_t compareOperation);
virtual void expectMemory(const void *gfxAddress, const void *srcAddress, size_t length, uint32_t compareOperation);
protected:
void cleanupResources();

View File

@@ -51,30 +51,7 @@ TEST_F(clEnqueueVerifyMemoryTests, givenInvalidCommandQueueWhenCallingVerifyMemo
EXPECT_EQ(CL_INVALID_COMMAND_QUEUE, retval);
}
TEST_F(clEnqueueVerifyMemoryTests, givenCommandQueueWithoutAubCsrWhenCallingVerifyMemoryThenErrorIsReturned) {
TEST_F(clEnqueueVerifyMemoryTests, givenCommandQueueWithoutAubCsrWhenCallingVerifyMemoryThenSuccessIsReturned) {
cl_int retval = clEnqueueVerifyMemory(pCommandQueue, gpuAddress, expected, expectedSize, comparisonMode);
EXPECT_EQ(CL_INVALID_VALUE, retval);
}
template <typename GfxFamily>
struct MockCsrWithExpectMemory : MockCsr<GfxFamily> {
MockCsrWithExpectMemory() = delete;
MockCsrWithExpectMemory(const HardwareInfo &hwInfoIn) = delete;
MockCsrWithExpectMemory(int32_t &execStamp, ExecutionEnvironment &executionEnvironment)
: MockCsr<GfxFamily>(execStamp, executionEnvironment) {
}
bool expectMemory(const void *gfxAddress, const void *srcAddress, size_t length, uint32_t compareOperation) override {
return true;
}
};
HWTEST_F(clEnqueueVerifyMemoryTests, givenCommandQueueWithMockAubCsrWhenCallingVerifyMemoryThenSuccessIsReturned) {
std::unique_ptr<MockDevice> mockDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
int32_t executionStamp = 0;
auto *mockCsr = new MockCsrWithExpectMemory<FamilyType>(executionStamp, *mockDevice.get()->executionEnvironment);
mockDevice.get()->resetCommandStreamReceiver(mockCsr);
CommandQueue cmdQ(nullptr, mockDevice.get(), 0);
cl_int retval = clEnqueueVerifyMemory(&cmdQ, gpuAddress, expected, expectedSize, comparisonMode);
EXPECT_EQ(CL_SUCCESS, retval);
}

View File

@@ -813,10 +813,9 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenAskedForMemoryExpectation
public:
using AUBCommandStreamReceiverHw<FamilyType>::AUBCommandStreamReceiverHw;
bool expectMemory(const void *gfxAddress, const void *srcAddress, size_t length, uint32_t compareOperation) override {
void expectMemory(const void *gfxAddress, const void *srcAddress, size_t length, uint32_t compareOperation) override {
inputCompareOperation = compareOperation;
AUBCommandStreamReceiverHw<FamilyType>::expectMemory(gfxAddress, srcAddress, length, compareOperation);
return true;
}
uint32_t inputCompareOperation = 0;
};