Don't use ClDevice in Buffer::setSurfaceState

Change-Id: Id948b11ee7c0decb7a2e4e4fea70e950ee14913f
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2020-02-20 23:54:48 +01:00
committed by sys_ocldev
parent b6f8948712
commit 49aac737a7
8 changed files with 22 additions and 21 deletions

View File

@@ -514,7 +514,7 @@ bool CommandQueue::setupDebugSurface(Kernel *kernel) {
kernel->getKernelInfo().patchInfo.pAllocateSystemThreadSurface->Offset);
void *addressToPatch = reinterpret_cast<void *>(debugSurface->getGpuAddress());
size_t sizeToPatch = debugSurface->getUnderlyingBufferSize();
Buffer::setSurfaceState(device, surfaceState, sizeToPatch, addressToPatch, 0, debugSurface, 0, 0);
Buffer::setSurfaceState(&device->getDevice(), surfaceState, sizeToPatch, addressToPatch, 0, debugSurface, 0, 0);
return true;
}

View File

@@ -179,7 +179,7 @@ void Kernel::patchWithImplicitSurface(void *ptrToPatchInCrossThreadData, Graphic
auto surfaceState = ptrOffset(ssh, sshOffset);
void *addressToPatch = reinterpret_cast<void *>(allocation.getGpuAddressToPatch());
size_t sizeToPatch = allocation.getUnderlyingBufferSize();
Buffer::setSurfaceState(&getDevice(), surfaceState, sizeToPatch, addressToPatch, 0, &allocation, 0, 0);
Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState, sizeToPatch, addressToPatch, 0, &allocation, 0, 0);
}
}
@@ -311,7 +311,7 @@ cl_int Kernel::initialize() {
if (requiresSshForBuffers()) {
auto surfaceState = ptrOffset(reinterpret_cast<uintptr_t *>(getSurfaceStateHeap()),
patchInfo.pAllocateStatelessEventPoolSurface->SurfaceStateHeapOffset);
Buffer::setSurfaceState(&getDevice(), surfaceState, 0, nullptr, 0, nullptr, 0, 0);
Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState, 0, nullptr, 0, nullptr, 0, 0);
}
}
@@ -320,7 +320,7 @@ cl_int Kernel::initialize() {
if (requiresSshForBuffers()) {
auto surfaceState = ptrOffset(reinterpret_cast<uintptr_t *>(getSurfaceStateHeap()),
patchInfo.pAllocateStatelessDefaultDeviceQueueSurface->SurfaceStateHeapOffset);
Buffer::setSurfaceState(&getDevice(), surfaceState, 0, nullptr, 0, nullptr, 0, 0);
Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState, 0, nullptr, 0, nullptr, 0, 0);
}
}
if (kernelInfo.patchInfo.executionEnvironment) {
@@ -895,7 +895,7 @@ cl_int Kernel::setArgSvm(uint32_t argIndex, size_t svmAllocSize, void *svmPtr, G
if (requiresSshForBuffers()) {
const auto &kernelArgInfo = kernelInfo.kernelArgInfo[argIndex];
auto surfaceState = ptrOffset(getSurfaceStateHeap(), kernelArgInfo.offsetHeap);
Buffer::setSurfaceState(&getDevice(), surfaceState, svmAllocSize + ptrDiff(svmPtr, ptrToPatch), ptrToPatch, 0, svmAlloc, svmFlags, 0);
Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState, svmAllocSize + ptrDiff(svmPtr, ptrToPatch), ptrToPatch, 0, svmAlloc, svmFlags, 0);
}
if (!kernelArguments[argIndex].isPatched) {
patchedArgumentsNum++;
@@ -932,7 +932,7 @@ cl_int Kernel::setArgSvmAlloc(uint32_t argIndex, void *svmPtr, GraphicsAllocatio
offset = ptrDiff(ptrToPatch, svmAlloc->getGpuAddressToPatch());
allocSize -= offset;
}
Buffer::setSurfaceState(&getDevice(), surfaceState, allocSize, ptrToPatch, offset, svmAlloc, 0, 0);
Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState, allocSize, ptrToPatch, offset, svmAlloc, 0, 0);
}
if (!kernelArguments[argIndex].isPatched) {
@@ -1335,7 +1335,7 @@ cl_int Kernel::setArgBuffer(uint32_t argIndex,
if (requiresSshForBuffers()) {
auto surfaceState = ptrOffset(getSurfaceStateHeap(), kernelArgInfo.offsetHeap);
Buffer::setSurfaceState(&getDevice(), surfaceState, 0, nullptr, 0, nullptr, 0, 0);
Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState, 0, nullptr, 0, nullptr, 0, 0);
}
return CL_SUCCESS;
@@ -1382,7 +1382,7 @@ cl_int Kernel::setArgPipe(uint32_t argIndex,
if (requiresSshForBuffers()) {
auto surfaceState = ptrOffset(getSurfaceStateHeap(), kernelArgInfo.offsetHeap);
Buffer::setSurfaceState(&getDevice(), surfaceState,
Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState,
pipe->getSize(), pipe->getCpuAddress(), 0,
pipe->getGraphicsAllocation(), 0, 0);
}
@@ -2233,7 +2233,7 @@ void Kernel::patchDefaultDeviceQueue(DeviceQueue *devQueue) {
if (requiresSshForBuffers()) {
auto surfaceState = ptrOffset(reinterpret_cast<uintptr_t *>(getSurfaceStateHeap()),
patchInfo.pAllocateStatelessDefaultDeviceQueueSurface->SurfaceStateHeapOffset);
Buffer::setSurfaceState(&getDevice(), surfaceState, devQueue->getQueueBuffer()->getUnderlyingBufferSize(),
Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState, devQueue->getQueueBuffer()->getUnderlyingBufferSize(),
(void *)devQueue->getQueueBuffer()->getGpuAddress(), 0, devQueue->getQueueBuffer(), 0, 0);
}
}
@@ -2254,7 +2254,7 @@ void Kernel::patchEventPool(DeviceQueue *devQueue) {
if (requiresSshForBuffers()) {
auto surfaceState = ptrOffset(reinterpret_cast<uintptr_t *>(getSurfaceStateHeap()),
patchInfo.pAllocateStatelessEventPoolSurface->SurfaceStateHeapOffset);
Buffer::setSurfaceState(&getDevice(), surfaceState, devQueue->getEventPoolBuffer()->getUnderlyingBufferSize(),
Buffer::setSurfaceState(&getDevice().getDevice(), surfaceState, devQueue->getEventPoolBuffer()->getUnderlyingBufferSize(),
(void *)devQueue->getEventPoolBuffer()->getGpuAddress(), 0, devQueue->getEventPoolBuffer(), 0, 0);
}
}
@@ -2288,7 +2288,7 @@ void Kernel::patchSyncBuffer(Device &device, GraphicsAllocation *gfxAllocation,
patchInfo.pAllocateSyncBuffer->SurfaceStateHeapOffset);
auto addressToPatch = gfxAllocation->getUnderlyingBuffer();
auto sizeToPatch = gfxAllocation->getUnderlyingBufferSize();
Buffer::setSurfaceState(device.getSpecializedDevice<ClDevice>(), surfaceState, sizeToPatch, addressToPatch, 0, gfxAllocation, 0, 0);
Buffer::setSurfaceState(&device, surfaceState, sizeToPatch, addressToPatch, 0, gfxAllocation, 0, 0);
}
}

View File

@@ -562,7 +562,7 @@ Buffer *Buffer::createBufferHw(Context *context,
return pBuffer;
}
Buffer *Buffer::createBufferHwFromDevice(const ClDevice *device,
Buffer *Buffer::createBufferHwFromDevice(const Device *device,
cl_mem_flags flags,
cl_mem_flags_intel flagsIntel,
size_t size,
@@ -621,7 +621,7 @@ bool Buffer::isCompressed() const {
return false;
}
void Buffer::setSurfaceState(const ClDevice *device,
void Buffer::setSurfaceState(const Device *device,
void *surfaceState,
size_t svmSize,
void *svmPtr,

View File

@@ -17,6 +17,7 @@
#include "memory_properties_flags.h"
namespace NEO {
class Device;
class Buffer;
class ClDevice;
class MemoryManager;
@@ -88,7 +89,7 @@ class Buffer : public MemObj {
bool isHostPtrSVM,
bool isImageRedescribed);
static Buffer *createBufferHwFromDevice(const ClDevice *device,
static Buffer *createBufferHwFromDevice(const Device *device,
cl_mem_flags flags,
cl_mem_flags_intel flagsIntel,
size_t size,
@@ -105,7 +106,7 @@ class Buffer : public MemObj {
const cl_buffer_region *region,
cl_int &errcodeRet);
static void setSurfaceState(const ClDevice *device,
static void setSurfaceState(const Device *device,
void *surfaceState,
size_t svmSize,
void *svmPtr,

View File

@@ -55,7 +55,7 @@ void PrintfHandler::prepareDispatch(const MultiDispatchInfo &multiDispatchInfo)
kernel->getKernelInfo().patchInfo.pAllocateStatelessPrintfSurface->SurfaceStateHeapOffset);
void *addressToPatch = printfSurface->getUnderlyingBuffer();
size_t sizeToPatch = printfSurface->getUnderlyingBufferSize();
Buffer::setSurfaceState(&device, surfaceState, sizeToPatch, addressToPatch, 0, printfSurface, 0, 0);
Buffer::setSurfaceState(&device.getDevice(), surfaceState, sizeToPatch, addressToPatch, 0, printfSurface, 0, 0);
}
}

View File

@@ -270,7 +270,7 @@ HWTEST_F(KernelArgSvmTest, PatchWithImplicitSurface) {
{
void *addressToPatch = svmAlloc.getUnderlyingBuffer();
size_t sizeToPatch = svmAlloc.getUnderlyingBufferSize();
Buffer::setSurfaceState(pClDevice, &expectedSurfaceState, sizeToPatch,
Buffer::setSurfaceState(pDevice, &expectedSurfaceState, sizeToPatch,
addressToPatch, 0, &svmAlloc, 0, 0);
}
@@ -377,7 +377,7 @@ HWTEST_TYPED_TEST(KernelArgSvmTestTyped, GivenBufferKernelArgWhenBufferOffsetIsN
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
constexpr size_t rendSurfSize = sizeof(RENDER_SURFACE_STATE);
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
uint32_t svmSize = MemoryConstants::pageSize;
char *svmPtr = reinterpret_cast<char *>(alignedMalloc(svmSize, MemoryConstants::pageSize));

View File

@@ -1857,11 +1857,11 @@ TEST(ResidencyTests, whenBuffersIsCreatedWithMakeResidentFlagThenItSuccessfulyCr
class BufferTests : public ::testing::Test {
protected:
void SetUp() override {
device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(*platformDevices));
}
void TearDown() override {
}
std::unique_ptr<MockClDevice> device;
std::unique_ptr<MockDevice> device;
};
typedef BufferTests BufferSetSurfaceTests;

View File

@@ -24,7 +24,7 @@ class MockBufferStorage {
}
char data[128];
MockGraphicsAllocation mockGfxAllocation;
std::unique_ptr<MockClDevice> device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
std::unique_ptr<MockDevice> device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
};
class MockBuffer : public MockBufferStorage, public Buffer {