Minor clean-up.
Change-Id: Id1523930fc8aedf85506e254c67f6b1ca8dd020d Signed-off-by: Piotr Fusik <piotr.fusik@intel.com>
This commit is contained in:
parent
edc6366374
commit
2548bea71d
|
@ -73,8 +73,6 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
||||||
void blitBuffer(const BlitProperties &blitProperites) override;
|
void blitBuffer(const BlitProperties &blitProperites) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
using CommandStreamReceiver::osContext;
|
|
||||||
|
|
||||||
void programPreemption(LinearStream &csr, Device &device, DispatchFlags &dispatchFlags);
|
void programPreemption(LinearStream &csr, Device &device, DispatchFlags &dispatchFlags);
|
||||||
void programL3(LinearStream &csr, DispatchFlags &dispatchFlags, uint32_t &newL3Config);
|
void programL3(LinearStream &csr, DispatchFlags &dispatchFlags, uint32_t &newL3Config);
|
||||||
void programPreamble(LinearStream &csr, Device &device, DispatchFlags &dispatchFlags, uint32_t &newL3Config);
|
void programPreamble(LinearStream &csr, Device &device, DispatchFlags &dispatchFlags, uint32_t &newL3Config);
|
||||||
|
|
|
@ -28,7 +28,7 @@ bool GTPinHwHelperHw<GfxFamily>::addSurfaceState(Kernel *pKernel) {
|
||||||
size_t sizeToEnlarge = ssSize + btsSize;
|
size_t sizeToEnlarge = ssSize + btsSize;
|
||||||
size_t currBTOffset = pKernel->getBindingTableOffset();
|
size_t currBTOffset = pKernel->getBindingTableOffset();
|
||||||
size_t currSurfaceStateSize = currBTOffset;
|
size_t currSurfaceStateSize = currBTOffset;
|
||||||
char *pSsh = reinterpret_cast<char *>(pKernel->getSurfaceStateHeap());
|
char *pSsh = static_cast<char *>(pKernel->getSurfaceStateHeap());
|
||||||
char *pNewSsh = new char[sshSize + sizeToEnlarge];
|
char *pNewSsh = new char[sshSize + sizeToEnlarge];
|
||||||
memcpy_s(pNewSsh, sshSize + sizeToEnlarge, pSsh, currSurfaceStateSize);
|
memcpy_s(pNewSsh, sshSize + sizeToEnlarge, pSsh, currSurfaceStateSize);
|
||||||
RENDER_SURFACE_STATE *pSS = reinterpret_cast<RENDER_SURFACE_STATE *>(pNewSsh + currSurfaceStateSize);
|
RENDER_SURFACE_STATE *pSS = reinterpret_cast<RENDER_SURFACE_STATE *>(pNewSsh + currSurfaceStateSize);
|
||||||
|
|
|
@ -114,7 +114,7 @@ GraphicsAllocation *FlatBatchBufferHelperHw<GfxFamily>::flattenBatchBuffer(Batch
|
||||||
flatBatchBuffer = getMemoryManager()->allocateGraphicsMemoryWithProperties(flatBatchBufferProperties);
|
flatBatchBuffer = getMemoryManager()->allocateGraphicsMemoryWithProperties(flatBatchBufferProperties);
|
||||||
UNRECOVERABLE_IF(flatBatchBuffer == nullptr);
|
UNRECOVERABLE_IF(flatBatchBuffer == nullptr);
|
||||||
|
|
||||||
char *ptr = reinterpret_cast<char *>(flatBatchBuffer->getUnderlyingBuffer());
|
char *ptr = static_cast<char *>(flatBatchBuffer->getUnderlyingBuffer());
|
||||||
memcpy_s(ptr, indirectPatchCommandsSize, indirectPatchCommands.get(), indirectPatchCommandsSize);
|
memcpy_s(ptr, indirectPatchCommandsSize, indirectPatchCommands.get(), indirectPatchCommandsSize);
|
||||||
ptr += indirectPatchCommandsSize;
|
ptr += indirectPatchCommandsSize;
|
||||||
for (auto &chunk : orderedChunks) {
|
for (auto &chunk : orderedChunks) {
|
||||||
|
|
|
@ -755,13 +755,11 @@ void Kernel::setStartOffset(uint32_t offset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const void *Kernel::getSurfaceStateHeap() const {
|
const void *Kernel::getSurfaceStateHeap() const {
|
||||||
return kernelInfo.usesSsh
|
return kernelInfo.usesSsh ? pSshLocal.get() : nullptr;
|
||||||
? pSshLocal.get()
|
|
||||||
: nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *Kernel::getSurfaceStateHeap() {
|
void *Kernel::getSurfaceStateHeap() {
|
||||||
return const_cast<void *>(const_cast<const Kernel *>(this)->getSurfaceStateHeap());
|
return kernelInfo.usesSsh ? pSshLocal.get() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Kernel::getDynamicStateHeapSize() const {
|
size_t Kernel::getDynamicStateHeapSize() const {
|
||||||
|
@ -783,7 +781,7 @@ size_t Kernel::getNumberOfBindingTableStates() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Kernel::resizeSurfaceStateHeap(void *pNewSsh, size_t newSshSize, size_t newBindingTableCount, size_t newBindingTableOffset) {
|
void Kernel::resizeSurfaceStateHeap(void *pNewSsh, size_t newSshSize, size_t newBindingTableCount, size_t newBindingTableOffset) {
|
||||||
pSshLocal.reset(reinterpret_cast<char *>(pNewSsh));
|
pSshLocal.reset(static_cast<char *>(pNewSsh));
|
||||||
sshLocalSize = static_cast<uint32_t>(newSshSize);
|
sshLocalSize = static_cast<uint32_t>(newSshSize);
|
||||||
numberOfBindingTableStates = newBindingTableCount;
|
numberOfBindingTableStates = newBindingTableCount;
|
||||||
localBindingTableOffset = newBindingTableOffset;
|
localBindingTableOffset = newBindingTableOffset;
|
||||||
|
|
|
@ -61,7 +61,7 @@ struct FragmentStorage {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AllocationStorageData {
|
struct AllocationStorageData {
|
||||||
OsHandle *osHandleStorage;
|
OsHandle *osHandleStorage = nullptr;
|
||||||
size_t fragmentSize = 0;
|
size_t fragmentSize = 0;
|
||||||
const void *cpuPtr = nullptr;
|
const void *cpuPtr = nullptr;
|
||||||
bool freeTheFragment = false;
|
bool freeTheFragment = false;
|
||||||
|
@ -71,12 +71,6 @@ struct AllocationStorageData {
|
||||||
struct OsHandleStorage {
|
struct OsHandleStorage {
|
||||||
AllocationStorageData fragmentStorageData[maxFragmentsCount];
|
AllocationStorageData fragmentStorageData[maxFragmentsCount];
|
||||||
uint32_t fragmentCount = 0;
|
uint32_t fragmentCount = 0;
|
||||||
OsHandleStorage() {
|
|
||||||
for (int i = 0; i < maxFragmentsCount; i++) {
|
|
||||||
fragmentStorageData[i].osHandleStorage = nullptr;
|
|
||||||
fragmentStorageData[i].cpuPtr = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|
|
@ -59,7 +59,7 @@ class BufferObject {
|
||||||
uint64_t peekUnmapSize() const { return unmapSize; }
|
uint64_t peekUnmapSize() const { return unmapSize; }
|
||||||
StorageAllocatorType peekAllocationType() const { return storageAllocatorType; }
|
StorageAllocatorType peekAllocationType() const { return storageAllocatorType; }
|
||||||
void setAllocationType(StorageAllocatorType allocatorType) { this->storageAllocatorType = allocatorType; }
|
void setAllocationType(StorageAllocatorType allocatorType) { this->storageAllocatorType = allocatorType; }
|
||||||
bool peekIsReusableAllocation() { return this->isReused; }
|
bool peekIsReusableAllocation() const { return this->isReused; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BufferObject(Drm *drm, int handle, bool isAllocated);
|
BufferObject(Drm *drm, int handle, bool isAllocated);
|
||||||
|
|
|
@ -42,7 +42,7 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
|
||||||
void makeNonResident(GraphicsAllocation &gfxAllocation) override;
|
void makeNonResident(GraphicsAllocation &gfxAllocation) override;
|
||||||
bool waitForFlushStamp(FlushStamp &flushStampToWait) override;
|
bool waitForFlushStamp(FlushStamp &flushStampToWait) override;
|
||||||
|
|
||||||
DrmMemoryManager *getMemoryManager();
|
DrmMemoryManager *getMemoryManager() const;
|
||||||
|
|
||||||
gemCloseWorkerMode peekGemCloseWorkerOperationMode() {
|
gemCloseWorkerMode peekGemCloseWorkerOperationMode() {
|
||||||
return this->gemCloseWorkerOperationMode;
|
return this->gemCloseWorkerOperationMode;
|
||||||
|
|
|
@ -104,7 +104,7 @@ void DrmCommandStreamReceiver<GfxFamily>::makeResident(BufferObject *bo) {
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
void DrmCommandStreamReceiver<GfxFamily>::processResidency(ResidencyContainer &inputAllocationsForResidency) {
|
void DrmCommandStreamReceiver<GfxFamily>::processResidency(ResidencyContainer &inputAllocationsForResidency) {
|
||||||
for (auto &alloc : inputAllocationsForResidency) {
|
for (auto &alloc : inputAllocationsForResidency) {
|
||||||
auto drmAlloc = static_cast<DrmAllocation *>(alloc);
|
auto drmAlloc = static_cast<const DrmAllocation *>(alloc);
|
||||||
if (drmAlloc->fragmentsStorage.fragmentCount) {
|
if (drmAlloc->fragmentsStorage.fragmentCount) {
|
||||||
for (unsigned int f = 0; f < drmAlloc->fragmentsStorage.fragmentCount; f++) {
|
for (unsigned int f = 0; f < drmAlloc->fragmentsStorage.fragmentCount; f++) {
|
||||||
const auto osContextId = osContext->getContextId();
|
const auto osContextId = osContext->getContextId();
|
||||||
|
@ -129,18 +129,16 @@ void DrmCommandStreamReceiver<GfxFamily>::makeNonResident(GraphicsAllocation &gf
|
||||||
if (this->residency.size() != 0) {
|
if (this->residency.size() != 0) {
|
||||||
this->residency.clear();
|
this->residency.clear();
|
||||||
}
|
}
|
||||||
if (gfxAllocation.fragmentsStorage.fragmentCount) {
|
|
||||||
for (auto fragmentId = 0u; fragmentId < gfxAllocation.fragmentsStorage.fragmentCount; fragmentId++) {
|
for (auto fragmentId = 0u; fragmentId < gfxAllocation.fragmentsStorage.fragmentCount; fragmentId++) {
|
||||||
gfxAllocation.fragmentsStorage.fragmentStorageData[fragmentId].residency->resident[osContext->getContextId()] = false;
|
gfxAllocation.fragmentsStorage.fragmentStorageData[fragmentId].residency->resident[osContext->getContextId()] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
gfxAllocation.releaseResidencyInOsContext(this->osContext->getContextId());
|
gfxAllocation.releaseResidencyInOsContext(this->osContext->getContextId());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
DrmMemoryManager *DrmCommandStreamReceiver<GfxFamily>::getMemoryManager() {
|
DrmMemoryManager *DrmCommandStreamReceiver<GfxFamily>::getMemoryManager() const {
|
||||||
return (DrmMemoryManager *)CommandStreamReceiver::getMemoryManager();
|
return static_cast<DrmMemoryManager *>(CommandStreamReceiver::getMemoryManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
|
|
|
@ -412,7 +412,7 @@ DrmAllocation *DrmMemoryManager::allocate32BitGraphicsMemoryImpl(const Allocatio
|
||||||
BufferObject *DrmMemoryManager::findAndReferenceSharedBufferObject(int boHandle) {
|
BufferObject *DrmMemoryManager::findAndReferenceSharedBufferObject(int boHandle) {
|
||||||
BufferObject *bo = nullptr;
|
BufferObject *bo = nullptr;
|
||||||
for (const auto &i : sharingBufferObjects) {
|
for (const auto &i : sharingBufferObjects) {
|
||||||
if (i->handle == static_cast<int>(boHandle)) {
|
if (i->handle == boHandle) {
|
||||||
bo = i;
|
bo = i;
|
||||||
bo->reference();
|
bo->reference();
|
||||||
break;
|
break;
|
||||||
|
@ -547,8 +547,7 @@ void DrmMemoryManager::removeAllocationFromHostPtrManager(GraphicsAllocation *gf
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrmMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation) {
|
void DrmMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation) {
|
||||||
DrmAllocation *input;
|
auto input = static_cast<DrmAllocation *>(gfxAllocation);
|
||||||
input = static_cast<DrmAllocation *>(gfxAllocation);
|
|
||||||
for (auto handleId = 0u; handleId < maxHandleCount; handleId++) {
|
for (auto handleId = 0u; handleId < maxHandleCount; handleId++) {
|
||||||
if (gfxAllocation->getGmm(handleId)) {
|
if (gfxAllocation->getGmm(handleId)) {
|
||||||
delete gfxAllocation->getGmm(handleId);
|
delete gfxAllocation->getGmm(handleId);
|
||||||
|
|
|
@ -30,8 +30,8 @@ class WddmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily>
|
||||||
void processEviction() override;
|
void processEviction() override;
|
||||||
bool waitForFlushStamp(FlushStamp &flushStampToWait) override;
|
bool waitForFlushStamp(FlushStamp &flushStampToWait) override;
|
||||||
|
|
||||||
WddmMemoryManager *getMemoryManager();
|
WddmMemoryManager *getMemoryManager() const;
|
||||||
Wddm *peekWddm() {
|
Wddm *peekWddm() const {
|
||||||
return wddm;
|
return wddm;
|
||||||
}
|
}
|
||||||
GmmPageTableMngr *createPageTableManager() override;
|
GmmPageTableMngr *createPageTableManager() override;
|
||||||
|
|
|
@ -103,13 +103,13 @@ FlushStamp WddmCommandStreamReceiver<GfxFamily>::flush(BatchBuffer &batchBuffer,
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
void WddmCommandStreamReceiver<GfxFamily>::makeResident(GraphicsAllocation &gfxAllocation) {
|
void WddmCommandStreamReceiver<GfxFamily>::makeResident(GraphicsAllocation &gfxAllocation) {
|
||||||
DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "allocation =", static_cast<WddmAllocation *>(&gfxAllocation));
|
DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "allocation =", &gfxAllocation);
|
||||||
|
|
||||||
if (gfxAllocation.fragmentsStorage.fragmentCount == 0) {
|
if (gfxAllocation.fragmentsStorage.fragmentCount == 0) {
|
||||||
DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "allocation default handle =", static_cast<WddmAllocation *>(&gfxAllocation)->getDefaultHandle());
|
DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "allocation default handle =", static_cast<WddmAllocation &>(gfxAllocation).getDefaultHandle());
|
||||||
} else {
|
} else {
|
||||||
for (uint32_t allocationId = 0; allocationId < static_cast<WddmAllocation *>(&gfxAllocation)->fragmentsStorage.fragmentCount; allocationId++) {
|
for (uint32_t allocationId = 0; allocationId < gfxAllocation.fragmentsStorage.fragmentCount; allocationId++) {
|
||||||
DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "fragment handle =", static_cast<WddmAllocation *>(&gfxAllocation)->fragmentsStorage.fragmentStorageData[allocationId].osHandleStorage->handle);
|
DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "fragment handle =", gfxAllocation.fragmentsStorage.fragmentStorageData[allocationId].osHandleStorage->handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ void WddmCommandStreamReceiver<GfxFamily>::processEviction() {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
WddmMemoryManager *WddmCommandStreamReceiver<GfxFamily>::getMemoryManager() {
|
WddmMemoryManager *WddmCommandStreamReceiver<GfxFamily>::getMemoryManager() const {
|
||||||
return static_cast<WddmMemoryManager *>(CommandStreamReceiver::getMemoryManager());
|
return static_cast<WddmMemoryManager *>(CommandStreamReceiver::getMemoryManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ bool TbxSocketsImp::sendWriteData(const void *buffer, size_t sizeInBytes) {
|
||||||
|
|
||||||
bool TbxSocketsImp::getResponseData(void *buffer, size_t sizeInBytes) {
|
bool TbxSocketsImp::getResponseData(void *buffer, size_t sizeInBytes) {
|
||||||
size_t totalRecv = 0;
|
size_t totalRecv = 0;
|
||||||
auto dataBuffer = reinterpret_cast<char *>(buffer);
|
auto dataBuffer = static_cast<char *>(buffer);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
auto bytesRecv = ::recv(m_socket, &dataBuffer[totalRecv], static_cast<int>(sizeInBytes - totalRecv), 0);
|
auto bytesRecv = ::recv(m_socket, &dataBuffer[totalRecv], static_cast<int>(sizeInBytes - totalRecv), 0);
|
||||||
|
|
|
@ -13,6 +13,6 @@ namespace NEO {
|
||||||
|
|
||||||
class Directory {
|
class Directory {
|
||||||
public:
|
public:
|
||||||
static std::vector<std::string> getFiles(std::string &path);
|
static std::vector<std::string> getFiles(const std::string &path);
|
||||||
};
|
};
|
||||||
}; // namespace NEO
|
}; // namespace NEO
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
std::vector<std::string> Directory::getFiles(std::string &path) {
|
std::vector<std::string> Directory::getFiles(const std::string &path) {
|
||||||
std::vector<std::string> files;
|
std::vector<std::string> files;
|
||||||
|
|
||||||
DIR *dir = opendir(path.c_str());
|
DIR *dir = opendir(path.c_str());
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
std::vector<std::string> Directory::getFiles(std::string &path) {
|
std::vector<std::string> Directory::getFiles(const std::string &path) {
|
||||||
std::vector<std::string> files;
|
std::vector<std::string> files;
|
||||||
std::string newPath;
|
std::string newPath;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ void KernelDataTest::buildAndDecode() {
|
||||||
kernelDataSize += sizeof(SPatchDataParameterStream);
|
kernelDataSize += sizeof(SPatchDataParameterStream);
|
||||||
program->setDevice(pDevice);
|
program->setDevice(pDevice);
|
||||||
|
|
||||||
pKernelData = reinterpret_cast<char *>(alignedMalloc(kernelDataSize, MemoryConstants::cacheLineSize));
|
pKernelData = static_cast<char *>(alignedMalloc(kernelDataSize, MemoryConstants::cacheLineSize));
|
||||||
ASSERT_NE(nullptr, pKernelData);
|
ASSERT_NE(nullptr, pKernelData);
|
||||||
|
|
||||||
// kernel blob
|
// kernel blob
|
||||||
|
|
|
@ -227,11 +227,11 @@ TEST(PerThreadDataTest, generateLocalIDs) {
|
||||||
auto sizePerThreadDataTotal = PerThreadDataHelper::getPerThreadDataSizeTotal(simd, numChannels, localWorkSize);
|
auto sizePerThreadDataTotal = PerThreadDataHelper::getPerThreadDataSizeTotal(simd, numChannels, localWorkSize);
|
||||||
|
|
||||||
auto sizeOverSizedBuffer = sizePerThreadDataTotal * 4;
|
auto sizeOverSizedBuffer = sizePerThreadDataTotal * 4;
|
||||||
auto buffer = reinterpret_cast<char *>(alignedMalloc(sizeOverSizedBuffer, 16));
|
auto buffer = static_cast<char *>(alignedMalloc(sizeOverSizedBuffer, 16));
|
||||||
memset(buffer, 0, sizeOverSizedBuffer);
|
memset(buffer, 0, sizeOverSizedBuffer);
|
||||||
|
|
||||||
// Setup reference filled with zeros
|
// Setup reference filled with zeros
|
||||||
auto reference = reinterpret_cast<char *>(alignedMalloc(sizePerThreadDataTotal, 16));
|
auto reference = static_cast<char *>(alignedMalloc(sizePerThreadDataTotal, 16));
|
||||||
memset(reference, 0, sizePerThreadDataTotal);
|
memset(reference, 0, sizePerThreadDataTotal);
|
||||||
|
|
||||||
LinearStream stream(buffer, sizeOverSizedBuffer / 2);
|
LinearStream stream(buffer, sizeOverSizedBuffer / 2);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
std::vector<char> MockSipKernel::dummyBinaryForSip;
|
std::vector<char> MockSipKernel::dummyBinaryForSip;
|
||||||
std::vector<char> MockSipKernel::getDummyGenBinary() {
|
std::vector<char> MockSipKernel::getDummyGenBinary() {
|
||||||
if (dummyBinaryForSip.size() == 0) {
|
if (dummyBinaryForSip.empty()) {
|
||||||
dummyBinaryForSip = getBinary();
|
dummyBinaryForSip = getBinary();
|
||||||
}
|
}
|
||||||
return dummyBinaryForSip;
|
return dummyBinaryForSip;
|
||||||
|
@ -37,7 +37,7 @@ std::vector<char> MockSipKernel::getBinary() {
|
||||||
|
|
||||||
UNRECOVERABLE_IF(binary == nullptr);
|
UNRECOVERABLE_IF(binary == nullptr);
|
||||||
|
|
||||||
std::vector<char> ret{reinterpret_cast<char *>(binary), reinterpret_cast<char *>(binary) + binarySize};
|
std::vector<char> ret{static_cast<char *>(binary), static_cast<char *>(binary) + binarySize};
|
||||||
|
|
||||||
deleteDataReadFromFile(binary);
|
deleteDataReadFromFile(binary);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -610,7 +610,7 @@ TEST(OfflineCompilerTest, getStringWithinDelimiters) {
|
||||||
EXPECT_EQ(std::string::npos, dst.find("R\"===("));
|
EXPECT_EQ(std::string::npos, dst.find("R\"===("));
|
||||||
EXPECT_EQ(std::string::npos, dst.find(")===\""));
|
EXPECT_EQ(std::string::npos, dst.find(")===\""));
|
||||||
|
|
||||||
delete[] reinterpret_cast<char *>(ptrSrc);
|
delete[] static_cast<char *>(ptrSrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(OfflineCompilerTest, convertToPascalCase) {
|
TEST(OfflineCompilerTest, convertToPascalCase) {
|
||||||
|
|
|
@ -175,7 +175,7 @@ TEST_F(ProgramDataTest, AllocateConstantMemorySurfaceProgramBinaryInfo) {
|
||||||
buildAndDecodeProgramPatchList();
|
buildAndDecodeProgramPatchList();
|
||||||
|
|
||||||
EXPECT_NE(nullptr, pProgram->getConstantSurface());
|
EXPECT_NE(nullptr, pProgram->getConstantSurface());
|
||||||
EXPECT_EQ(0, memcmp(constValue, reinterpret_cast<char *>(pProgram->getConstantSurface()->getUnderlyingBuffer()), constSize));
|
EXPECT_EQ(0, memcmp(constValue, pProgram->getConstantSurface()->getUnderlyingBuffer(), constSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MockProgramDataTest, whenGlobalConstantsAreExportedThenAllocateSurfacesAsSvm) {
|
TEST_F(MockProgramDataTest, whenGlobalConstantsAreExportedThenAllocateSurfacesAsSvm) {
|
||||||
|
@ -327,7 +327,7 @@ TEST_F(ProgramDataTest, GivenDeviceForcing32BitMessagesWhenConstAllocationIsPres
|
||||||
buildAndDecodeProgramPatchList();
|
buildAndDecodeProgramPatchList();
|
||||||
|
|
||||||
EXPECT_NE(nullptr, pProgram->getConstantSurface());
|
EXPECT_NE(nullptr, pProgram->getConstantSurface());
|
||||||
EXPECT_EQ(0, memcmp(constValue, reinterpret_cast<char *>(pProgram->getConstantSurface()->getUnderlyingBuffer()), constSize));
|
EXPECT_EQ(0, memcmp(constValue, pProgram->getConstantSurface()->getUnderlyingBuffer(), constSize));
|
||||||
|
|
||||||
if (is64bit) {
|
if (is64bit) {
|
||||||
EXPECT_TRUE(pProgram->getConstantSurface()->is32BitAllocation());
|
EXPECT_TRUE(pProgram->getConstantSurface()->is32BitAllocation());
|
||||||
|
@ -338,7 +338,7 @@ TEST_F(ProgramDataTest, AllocateGlobalMemorySurfaceProgramBinaryInfo) {
|
||||||
auto globalSize = setupGlobalAllocation();
|
auto globalSize = setupGlobalAllocation();
|
||||||
buildAndDecodeProgramPatchList();
|
buildAndDecodeProgramPatchList();
|
||||||
EXPECT_NE(nullptr, pProgram->getGlobalSurface());
|
EXPECT_NE(nullptr, pProgram->getGlobalSurface());
|
||||||
EXPECT_EQ(0, memcmp(globalValue, reinterpret_cast<char *>(pProgram->getGlobalSurface()->getUnderlyingBuffer()), globalSize));
|
EXPECT_EQ(0, memcmp(globalValue, pProgram->getGlobalSurface()->getUnderlyingBuffer(), globalSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProgramDataTest, GlobalPointerProgramBinaryInfo) {
|
TEST_F(ProgramDataTest, GlobalPointerProgramBinaryInfo) {
|
||||||
|
@ -390,7 +390,7 @@ TEST_F(ProgramDataTest, GlobalPointerProgramBinaryInfo) {
|
||||||
sizeof(SPatchAllocateGlobalMemorySurfaceProgramBinaryInfo));
|
sizeof(SPatchAllocateGlobalMemorySurfaceProgramBinaryInfo));
|
||||||
memcpy_s((cl_char *)pAllocateGlobalMemorySurface + sizeof(allocateGlobalMemorySurface), globalPointerSize, &pGlobalPointerValue, globalPointerSize);
|
memcpy_s((cl_char *)pAllocateGlobalMemorySurface + sizeof(allocateGlobalMemorySurface), globalPointerSize, &pGlobalPointerValue, globalPointerSize);
|
||||||
|
|
||||||
pProgramPatchList = (void *)pAllocateGlobalMemorySurface;
|
pProgramPatchList = pAllocateGlobalMemorySurface;
|
||||||
programPatchListSize = allocateGlobalMemorySurface.Size;
|
programPatchListSize = allocateGlobalMemorySurface.Size;
|
||||||
buildAndDecodeProgramPatchList();
|
buildAndDecodeProgramPatchList();
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ TEST_F(ProgramDataTest, GlobalPointerProgramBinaryInfo) {
|
||||||
|
|
||||||
globalSurface->setCpuPtrAndGpuAddress(globalSurface->getUnderlyingBuffer(), globalSurface->getGpuAddress() + 1);
|
globalSurface->setCpuPtrAndGpuAddress(globalSurface->getUnderlyingBuffer(), globalSurface->getGpuAddress() + 1);
|
||||||
EXPECT_NE(reinterpret_cast<uint64_t>(globalSurface->getUnderlyingBuffer()), globalSurface->getGpuAddress());
|
EXPECT_NE(reinterpret_cast<uint64_t>(globalSurface->getUnderlyingBuffer()), globalSurface->getGpuAddress());
|
||||||
EXPECT_EQ(0, memcmp(&pGlobalPointerValue, reinterpret_cast<char *>(globalSurface->getUnderlyingBuffer()), globalPointerSize));
|
EXPECT_EQ(0, memcmp(&pGlobalPointerValue, globalSurface->getUnderlyingBuffer(), globalPointerSize));
|
||||||
|
|
||||||
delete[] pAllocateGlobalMemorySurface;
|
delete[] pAllocateGlobalMemorySurface;
|
||||||
|
|
||||||
|
@ -423,7 +423,7 @@ TEST_F(ProgramDataTest, GlobalPointerProgramBinaryInfo) {
|
||||||
|
|
||||||
buildAndDecodeProgramPatchList();
|
buildAndDecodeProgramPatchList();
|
||||||
|
|
||||||
EXPECT_EQ(0, memcmp(&pGlobalPointerValue, reinterpret_cast<char *>(globalSurface->getUnderlyingBuffer()), globalPointerSize));
|
EXPECT_EQ(0, memcmp(&pGlobalPointerValue, globalSurface->getUnderlyingBuffer(), globalPointerSize));
|
||||||
|
|
||||||
delete[] pGlobalPointer;
|
delete[] pGlobalPointer;
|
||||||
|
|
||||||
|
@ -446,7 +446,7 @@ TEST_F(ProgramDataTest, GlobalPointerProgramBinaryInfo) {
|
||||||
|
|
||||||
buildAndDecodeProgramPatchList();
|
buildAndDecodeProgramPatchList();
|
||||||
|
|
||||||
EXPECT_EQ(0, memcmp(&pGlobalPointerValue, reinterpret_cast<char *>(globalSurface->getUnderlyingBuffer()), globalPointerSize));
|
EXPECT_EQ(0, memcmp(&pGlobalPointerValue, globalSurface->getUnderlyingBuffer(), globalPointerSize));
|
||||||
|
|
||||||
delete[] pGlobalPointer;
|
delete[] pGlobalPointer;
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ TEST_F(ProgramDataTest, GlobalPointerProgramBinaryInfo) {
|
||||||
|
|
||||||
buildAndDecodeProgramPatchList();
|
buildAndDecodeProgramPatchList();
|
||||||
|
|
||||||
EXPECT_EQ(0, memcmp(&pGlobalPointerValue, reinterpret_cast<char *>(globalSurface->getUnderlyingBuffer()), globalPointerSize));
|
EXPECT_EQ(0, memcmp(&pGlobalPointerValue, globalSurface->getUnderlyingBuffer(), globalPointerSize));
|
||||||
|
|
||||||
delete[] pGlobalPointer;
|
delete[] pGlobalPointer;
|
||||||
|
|
||||||
|
@ -493,9 +493,9 @@ TEST_F(ProgramDataTest, GlobalPointerProgramBinaryInfo) {
|
||||||
buildAndDecodeProgramPatchList();
|
buildAndDecodeProgramPatchList();
|
||||||
|
|
||||||
if (!globalSurface->is32BitAllocation()) {
|
if (!globalSurface->is32BitAllocation()) {
|
||||||
EXPECT_NE(0, memcmp(&pGlobalPointerValue, reinterpret_cast<char *>(globalSurface->getUnderlyingBuffer()), globalPointerSize));
|
EXPECT_NE(0, memcmp(&pGlobalPointerValue, globalSurface->getUnderlyingBuffer(), globalPointerSize));
|
||||||
ptr = pGlobalPointerValue + (globalSurface->getGpuAddressToPatch());
|
ptr = pGlobalPointerValue + (globalSurface->getGpuAddressToPatch());
|
||||||
EXPECT_EQ(0, memcmp(&ptr, reinterpret_cast<char *>(globalSurface->getUnderlyingBuffer()), globalPointerSize));
|
EXPECT_EQ(0, memcmp(&ptr, globalSurface->getUnderlyingBuffer(), globalPointerSize));
|
||||||
}
|
}
|
||||||
delete[] pGlobalPointer;
|
delete[] pGlobalPointer;
|
||||||
}
|
}
|
||||||
|
@ -528,7 +528,7 @@ TEST_F(ProgramDataTest, Given32BitDeviceWhenGlobalMemorySurfaceIsPresentThenItHa
|
||||||
buildAndDecodeProgramPatchList();
|
buildAndDecodeProgramPatchList();
|
||||||
|
|
||||||
EXPECT_NE(nullptr, pProgram->getGlobalSurface());
|
EXPECT_NE(nullptr, pProgram->getGlobalSurface());
|
||||||
EXPECT_EQ(0, memcmp(globalValue, reinterpret_cast<char *>(pProgram->getGlobalSurface()->getUnderlyingBuffer()), globalSize));
|
EXPECT_EQ(0, memcmp(globalValue, pProgram->getGlobalSurface()->getUnderlyingBuffer(), globalSize));
|
||||||
if (is64bit) {
|
if (is64bit) {
|
||||||
EXPECT_TRUE(pProgram->getGlobalSurface()->is32BitAllocation());
|
EXPECT_TRUE(pProgram->getGlobalSurface()->is32BitAllocation());
|
||||||
}
|
}
|
||||||
|
@ -602,9 +602,9 @@ TEST_F(ProgramDataTest, ConstantPointerProgramBinaryInfo) {
|
||||||
constantSurface->setCpuPtrAndGpuAddress(constantSurface->getUnderlyingBuffer(), constantSurface->getGpuAddress() + 1);
|
constantSurface->setCpuPtrAndGpuAddress(constantSurface->getUnderlyingBuffer(), constantSurface->getGpuAddress() + 1);
|
||||||
EXPECT_NE(reinterpret_cast<uint64_t>(constantSurface->getUnderlyingBuffer()), constantSurface->getGpuAddress());
|
EXPECT_NE(reinterpret_cast<uint64_t>(constantSurface->getUnderlyingBuffer()), constantSurface->getGpuAddress());
|
||||||
|
|
||||||
EXPECT_EQ(0, memcmp(pConstantData, reinterpret_cast<char *>(constantSurface->getUnderlyingBuffer()), constantDataLen));
|
EXPECT_EQ(0, memcmp(pConstantData, constantSurface->getUnderlyingBuffer(), constantDataLen));
|
||||||
// there was no PATCH_TOKEN_CONSTANT_POINTER_PROGRAM_BINARY_INFO, so constant buffer offset should be still 0
|
// there was no PATCH_TOKEN_CONSTANT_POINTER_PROGRAM_BINARY_INFO, so constant buffer offset should be still 0
|
||||||
EXPECT_EQ(0U, *(uint64_t *)(reinterpret_cast<char *>(constantSurface->getUnderlyingBuffer()) + constantBufferOffsetPatchOffset));
|
EXPECT_EQ(0U, *reinterpret_cast<uint64_t *>(static_cast<char *>(constantSurface->getUnderlyingBuffer()) + constantBufferOffsetPatchOffset));
|
||||||
// once finally constant buffer offset gets patched - the patch value depends on the bitness of the compute kernel
|
// once finally constant buffer offset gets patched - the patch value depends on the bitness of the compute kernel
|
||||||
auto patchOffsetValueStorage = std::unique_ptr<uint64_t>(new uint64_t); // 4bytes for 32-bit compute kernel, full 8byte for 64-bit compute kernel
|
auto patchOffsetValueStorage = std::unique_ptr<uint64_t>(new uint64_t); // 4bytes for 32-bit compute kernel, full 8byte for 64-bit compute kernel
|
||||||
uint64_t *patchOffsetValue = patchOffsetValueStorage.get();
|
uint64_t *patchOffsetValue = patchOffsetValueStorage.get();
|
||||||
|
@ -633,11 +633,11 @@ TEST_F(ProgramDataTest, ConstantPointerProgramBinaryInfo) {
|
||||||
programPatchListSize = constantPointer.Size;
|
programPatchListSize = constantPointer.Size;
|
||||||
|
|
||||||
buildAndDecodeProgramPatchList();
|
buildAndDecodeProgramPatchList();
|
||||||
EXPECT_EQ(0, memcmp(pConstantData, reinterpret_cast<char *>(constantSurface->getUnderlyingBuffer()), constantDataLen));
|
EXPECT_EQ(0, memcmp(pConstantData, constantSurface->getUnderlyingBuffer(), constantDataLen));
|
||||||
// check that constant pointer offset was not patched
|
// check that constant pointer offset was not patched
|
||||||
EXPECT_EQ(0U, *(uint64_t *)(reinterpret_cast<char *>(constantSurface->getUnderlyingBuffer()) + constantBufferOffsetPatchOffset));
|
EXPECT_EQ(0U, *reinterpret_cast<uint64_t *>(static_cast<char *>(constantSurface->getUnderlyingBuffer()) + constantBufferOffsetPatchOffset));
|
||||||
// reset the constant pointer offset
|
// reset the constant pointer offset
|
||||||
*(uint64_t *)((char *)constantSurface->getUnderlyingBuffer() + constantBufferOffsetPatchOffset) = 0U;
|
*reinterpret_cast<uint64_t *>(static_cast<char *>(constantSurface->getUnderlyingBuffer()) + constantBufferOffsetPatchOffset) = 0U;
|
||||||
|
|
||||||
delete[] pConstantPointer;
|
delete[] pConstantPointer;
|
||||||
|
|
||||||
|
@ -658,9 +658,9 @@ TEST_F(ProgramDataTest, ConstantPointerProgramBinaryInfo) {
|
||||||
programPatchListSize = constantPointer.Size;
|
programPatchListSize = constantPointer.Size;
|
||||||
|
|
||||||
buildAndDecodeProgramPatchList();
|
buildAndDecodeProgramPatchList();
|
||||||
EXPECT_EQ(0, memcmp(pConstantData, reinterpret_cast<char *>(constantSurface->getUnderlyingBuffer()), constantDataLen));
|
EXPECT_EQ(0, memcmp(pConstantData, constantSurface->getUnderlyingBuffer(), constantDataLen));
|
||||||
// check that constant pointer offset was not patched
|
// check that constant pointer offset was not patched
|
||||||
EXPECT_EQ(0U, *(uint64_t *)(reinterpret_cast<char *>(constantSurface->getUnderlyingBuffer()) + constantBufferOffsetPatchOffset));
|
EXPECT_EQ(0U, *reinterpret_cast<uint64_t *>(static_cast<char *>(constantSurface->getUnderlyingBuffer()) + constantBufferOffsetPatchOffset));
|
||||||
// reset the constant pointer offset
|
// reset the constant pointer offset
|
||||||
*(uint64_t *)((char *)constantSurface->getUnderlyingBuffer() + constantBufferOffsetPatchOffset) = 0U;
|
*(uint64_t *)((char *)constantSurface->getUnderlyingBuffer() + constantBufferOffsetPatchOffset) = 0U;
|
||||||
|
|
||||||
|
@ -683,11 +683,11 @@ TEST_F(ProgramDataTest, ConstantPointerProgramBinaryInfo) {
|
||||||
programPatchListSize = constantPointer.Size;
|
programPatchListSize = constantPointer.Size;
|
||||||
|
|
||||||
buildAndDecodeProgramPatchList();
|
buildAndDecodeProgramPatchList();
|
||||||
EXPECT_EQ(0, memcmp(pConstantData, reinterpret_cast<char *>(constantSurface->getUnderlyingBuffer()), constantDataLen));
|
EXPECT_EQ(0, memcmp(pConstantData, constantSurface->getUnderlyingBuffer(), constantDataLen));
|
||||||
// check that constant pointer offset was not patched
|
// check that constant pointer offset was not patched
|
||||||
EXPECT_EQ(0U, *(uint64_t *)(reinterpret_cast<char *>(constantSurface->getUnderlyingBuffer()) + constantBufferOffsetPatchOffset));
|
EXPECT_EQ(0U, *reinterpret_cast<uint64_t *>(static_cast<char *>(constantSurface->getUnderlyingBuffer()) + constantBufferOffsetPatchOffset));
|
||||||
// reset the constant pointer offset
|
// reset the constant pointer offset
|
||||||
*(uint64_t *)((char *)constantSurface->getUnderlyingBuffer() + constantBufferOffsetPatchOffset) = 0U;
|
*reinterpret_cast<uint64_t *>(static_cast<char *>(constantSurface->getUnderlyingBuffer()) + constantBufferOffsetPatchOffset) = 0U;
|
||||||
|
|
||||||
delete[] pConstantPointer;
|
delete[] pConstantPointer;
|
||||||
|
|
||||||
|
@ -709,9 +709,9 @@ TEST_F(ProgramDataTest, ConstantPointerProgramBinaryInfo) {
|
||||||
|
|
||||||
buildAndDecodeProgramPatchList();
|
buildAndDecodeProgramPatchList();
|
||||||
|
|
||||||
EXPECT_EQ(0, memcmp(pConstantData, reinterpret_cast<char *>(constantSurface->getUnderlyingBuffer()), constantDataLen));
|
EXPECT_EQ(0, memcmp(pConstantData, constantSurface->getUnderlyingBuffer(), constantDataLen));
|
||||||
// check that constant pointer offset was patched
|
// check that constant pointer offset was patched
|
||||||
EXPECT_EQ(*reinterpret_cast<uint64_t *>(patchOffsetValue), *(uint64_t *)(reinterpret_cast<char *>(constantSurface->getUnderlyingBuffer()) + constantBufferOffsetPatchOffset));
|
EXPECT_EQ(*reinterpret_cast<uint64_t *>(patchOffsetValue), *reinterpret_cast<uint64_t *>(static_cast<char *>(constantSurface->getUnderlyingBuffer()) + constantBufferOffsetPatchOffset));
|
||||||
|
|
||||||
delete[] pConstantPointer;
|
delete[] pConstantPointer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue