Fixes for aub tests

- remove unnecessary createAllocationAndHandleResidency calls
for hostptr memory used for buffers
- expect data under correct GPU VA from GraphicsAllocation in
AUBReadBuffer test

Change-Id: Ida8f3bbf4f2f5d27535f56952079528472992f0b
This commit is contained in:
Hoppe, Mateusz
2018-10-02 17:15:44 -07:00
committed by sys_ocldev
parent 599f6e28ef
commit 9c3d89dc36
2 changed files with 13 additions and 9 deletions

View File

@@ -50,9 +50,6 @@ struct AUBHelloWorld
void SetUp() override {
HelloWorldFixture<AUBHelloWorldFixtureFactory>::SetUp();
HardwareParse::SetUp();
auto &commandStreamReceiver = pDevice->getCommandStreamReceiver();
commandStreamReceiver.createAllocationAndHandleResidency(pDestMemory, sizeUserMemory);
commandStreamReceiver.createAllocationAndHandleResidency(pSrcMemory, sizeUserMemory);
}
void TearDown() override {

View File

@@ -14,6 +14,8 @@
#include "unit_tests/aub_tests/aub_tests_configuration.h"
#include "test.h"
#include <memory>
using namespace OCLRT;
struct ReadBufferHw
@@ -38,18 +40,18 @@ HWTEST_P(AUBReadBuffer, simple) {
cl_float srcMemory[] = {1.0f, 2.0f, 3.0f, 4.0f};
cl_float destMemory[] = {0.0f, 0.0f, 0.0f, 0.0f};
auto retVal = CL_INVALID_VALUE;
auto srcBuffer = Buffer::create(
auto srcBuffer = std::unique_ptr<Buffer>(Buffer::create(
&context,
CL_MEM_USE_HOST_PTR,
sizeof(srcMemory),
srcMemory,
retVal);
ASSERT_NE(nullptr, srcBuffer);
retVal));
ASSERT_NE(nullptr, srcBuffer.get());
auto pSrcMemory = &srcMemory[0];
auto pDestMemory = &destMemory[0];
cl_bool blockingRead = CL_TRUE;
cl_bool blockingRead = CL_FALSE;
size_t offset = GetParam();
size_t sizeWritten = sizeof(cl_float);
cl_uint numEventsInWaitList = 0;
@@ -60,7 +62,7 @@ HWTEST_P(AUBReadBuffer, simple) {
srcBuffer->forceDisallowCPUCopy = true;
retVal = pCmdQ->enqueueReadBuffer(
srcBuffer,
srcBuffer.get(),
blockingRead,
offset,
sizeWritten,
@@ -69,8 +71,13 @@ HWTEST_P(AUBReadBuffer, simple) {
eventWaitList,
event);
delete srcBuffer;
EXPECT_EQ(CL_SUCCESS, retVal);
allocation = pCommandStreamReceiver->getMemoryManager()->graphicsAllocations.peekHead();
while (allocation && allocation->getUnderlyingBuffer() != pDestMemory) {
allocation = allocation->next;
}
retVal = pCmdQ->flush();
EXPECT_EQ(CL_SUCCESS, retVal);
pSrcMemory = ptrOffset(pSrcMemory, offset);