mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 00:24:58 +08:00
feat(zebin): Add support for ELF section type SHT_NOBITS
This commit adds support for parsing SHT_NOBITS zebin's ELF sections (containing global/constant zero-initialized data). Related-To: NEO-7196 Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
31154dc20b
commit
fa03aa9a40
@@ -19,7 +19,7 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
GraphicsAllocation *allocateGlobalsSurface(NEO::SVMAllocsManager *const svmAllocManager, NEO::Device &device, size_t size, bool constant,
|
||||
GraphicsAllocation *allocateGlobalsSurface(NEO::SVMAllocsManager *const svmAllocManager, NEO::Device &device, size_t totalSize, size_t zeroInitSize, bool constant,
|
||||
LinkerInput *const linkerInput, const void *initData) {
|
||||
bool globalsAreExported = false;
|
||||
GraphicsAllocation *gpuAllocation = nullptr;
|
||||
@@ -37,7 +37,7 @@ GraphicsAllocation *allocateGlobalsSurface(NEO::SVMAllocsManager *const svmAlloc
|
||||
subDeviceBitfields.insert({rootDeviceIndex, deviceBitfield});
|
||||
NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, subDeviceBitfields);
|
||||
unifiedMemoryProperties.device = &device;
|
||||
auto ptr = svmAllocManager->createUnifiedMemoryAllocation(size, unifiedMemoryProperties);
|
||||
auto ptr = svmAllocManager->createUnifiedMemoryAllocation(totalSize, unifiedMemoryProperties);
|
||||
DEBUG_BREAK_IF(ptr == nullptr);
|
||||
if (ptr == nullptr) {
|
||||
return nullptr;
|
||||
@@ -49,7 +49,7 @@ GraphicsAllocation *allocateGlobalsSurface(NEO::SVMAllocsManager *const svmAlloc
|
||||
auto allocationType = constant ? AllocationType::CONSTANT_SURFACE : AllocationType::GLOBAL_SURFACE;
|
||||
gpuAllocation = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex,
|
||||
true, // allocateMemory
|
||||
size, allocationType,
|
||||
totalSize, allocationType,
|
||||
false, // isMultiStorageAllocation
|
||||
deviceBitfield});
|
||||
}
|
||||
@@ -61,11 +61,13 @@ GraphicsAllocation *allocateGlobalsSurface(NEO::SVMAllocsManager *const svmAlloc
|
||||
auto &rootDeviceEnvironment = device.getRootDeviceEnvironment();
|
||||
auto &productHelper = device.getProductHelper();
|
||||
|
||||
auto success = MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *gpuAllocation),
|
||||
device, gpuAllocation, 0, initData, size);
|
||||
|
||||
UNRECOVERABLE_IF(!success);
|
||||
|
||||
bool isOnlyBssData = (totalSize == zeroInitSize);
|
||||
if (false == isOnlyBssData) {
|
||||
auto initSize = totalSize - zeroInitSize;
|
||||
auto success = MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *gpuAllocation),
|
||||
device, gpuAllocation, 0, initData, initSize);
|
||||
UNRECOVERABLE_IF(!success);
|
||||
}
|
||||
return gpuAllocation;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user