mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-23 20:12:03 +08:00
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:
committed by
sys_ocldev
parent
736c3ac3bd
commit
ec03210687
@@ -4272,11 +4272,7 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueVerifyMemory(cl_command_queue commandQu
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto &csr = pCommandQueue->getCommandStreamReceiver();
|
auto &csr = pCommandQueue->getCommandStreamReceiver();
|
||||||
if (csr.expectMemory(allocationPtr, expectedData, sizeOfComparison, comparisonMode)) {
|
csr.expectMemory(allocationPtr, expectedData, sizeOfComparison, comparisonMode);
|
||||||
retVal = CL_SUCCESS;
|
retVal = CL_SUCCESS;
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
retVal = CL_INVALID_VALUE;
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
|
|||||||
|
|
||||||
void expectMemoryEqual(void *gfxAddress, const void *srcAddress, size_t length);
|
void expectMemoryEqual(void *gfxAddress, const void *srcAddress, size_t length);
|
||||||
void expectMemoryNotEqual(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;
|
void activateAubSubCapture(const MultiDispatchInfo &dispatchInfo) override;
|
||||||
|
|
||||||
|
|||||||
@@ -690,11 +690,10 @@ void AUBCommandStreamReceiverHw<GfxFamily>::expectMemoryNotEqual(void *gfxAddres
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename GfxFamily>
|
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) {
|
size_t length, uint32_t compareOperation) {
|
||||||
if (hardwareContext) {
|
if (hardwareContext) {
|
||||||
hardwareContext->expectMemory(reinterpret_cast<uint64_t>(gfxAddress), srcAddress, length, compareOperation);
|
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) {
|
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);
|
this->ppgtt->pageWalk(reinterpret_cast<uintptr_t>(gfxAddress), length, 0, PageTableEntry::nonValidBits, walker, MemoryBanks::BankNotSpecified);
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
|
|||||||
@@ -392,9 +392,8 @@ TagAllocator<TimestampPacket> *CommandStreamReceiver::getTimestampPacketAllocato
|
|||||||
return timestampPacketAllocator.get();
|
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) {
|
size_t length, uint32_t compareOperation) {
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ class CommandStreamReceiver {
|
|||||||
TagAllocator<HwPerfCounter> *getEventPerfCountAllocator();
|
TagAllocator<HwPerfCounter> *getEventPerfCountAllocator();
|
||||||
TagAllocator<TimestampPacket> *getTimestampPacketAllocator();
|
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:
|
protected:
|
||||||
void cleanupResources();
|
void cleanupResources();
|
||||||
|
|||||||
@@ -51,30 +51,7 @@ TEST_F(clEnqueueVerifyMemoryTests, givenInvalidCommandQueueWhenCallingVerifyMemo
|
|||||||
EXPECT_EQ(CL_INVALID_COMMAND_QUEUE, retval);
|
EXPECT_EQ(CL_INVALID_COMMAND_QUEUE, retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(clEnqueueVerifyMemoryTests, givenCommandQueueWithoutAubCsrWhenCallingVerifyMemoryThenErrorIsReturned) {
|
TEST_F(clEnqueueVerifyMemoryTests, givenCommandQueueWithoutAubCsrWhenCallingVerifyMemoryThenSuccessIsReturned) {
|
||||||
cl_int retval = clEnqueueVerifyMemory(pCommandQueue, gpuAddress, expected, expectedSize, comparisonMode);
|
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);
|
EXPECT_EQ(CL_SUCCESS, retval);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -813,10 +813,9 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenAskedForMemoryExpectation
|
|||||||
public:
|
public:
|
||||||
using AUBCommandStreamReceiverHw<FamilyType>::AUBCommandStreamReceiverHw;
|
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;
|
inputCompareOperation = compareOperation;
|
||||||
AUBCommandStreamReceiverHw<FamilyType>::expectMemory(gfxAddress, srcAddress, length, compareOperation);
|
AUBCommandStreamReceiverHw<FamilyType>::expectMemory(gfxAddress, srcAddress, length, compareOperation);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
uint32_t inputCompareOperation = 0;
|
uint32_t inputCompareOperation = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user