mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Use GPU address when patching pipe
Change-Id: I4e4ca7ab2597fa97aa8cd1229382187974b22dde Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
@ -109,7 +109,7 @@ cl_int Pipe::getPipeInfo(cl_image_info paramName,
|
||||
}
|
||||
|
||||
void Pipe::setPipeArg(void *memory, uint32_t patchSize) {
|
||||
patchWithRequiredSize(memory, patchSize, (uintptr_t)getCpuAddress());
|
||||
patchWithRequiredSize(memory, patchSize, static_cast<uintptr_t>(getGraphicsAllocation()->getGpuAddressToPatch()));
|
||||
}
|
||||
|
||||
Pipe::~Pipe() = default;
|
||||
|
@ -93,3 +93,23 @@ TEST_F(PipeTest, givenPipeWhenEnqueueWriteForUnmapIsCalledThenReturnError) {
|
||||
errCode = clEnqueueUnmapMemObject(&cmdQ, pipe.get(), nullptr, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_INVALID_MEM_OBJECT, errCode);
|
||||
}
|
||||
|
||||
TEST_F(PipeTest, givenPipeWithDifferentCpuAndGpuAddressesWhenSetArgPipeThenUseGpuAddress) {
|
||||
int errCode = CL_SUCCESS;
|
||||
|
||||
auto pipe = Pipe::create(&context, CL_MEM_READ_ONLY, 1, 20, nullptr, errCode);
|
||||
|
||||
ASSERT_NE(nullptr, pipe);
|
||||
EXPECT_EQ(CL_SUCCESS, errCode);
|
||||
|
||||
EXPECT_EQ(21u, *reinterpret_cast<unsigned int *>(pipe->getCpuAddress()));
|
||||
uint64_t gpuAddress = 0x12345;
|
||||
auto pipeAllocation = pipe->getGraphicsAllocation();
|
||||
pipeAllocation->setCpuPtrAndGpuAddress(pipeAllocation->getUnderlyingBuffer(), gpuAddress);
|
||||
EXPECT_NE(reinterpret_cast<uint64_t>(pipeAllocation->getUnderlyingBuffer()), pipeAllocation->getGpuAddress());
|
||||
uint64_t valueToPatch;
|
||||
pipe->setPipeArg(&valueToPatch, sizeof(valueToPatch));
|
||||
EXPECT_EQ(valueToPatch, pipeAllocation->getGpuAddressToPatch());
|
||||
|
||||
delete pipe;
|
||||
}
|
Reference in New Issue
Block a user