mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 06:24:51 +08:00
fix: add AllocationType::printfSurface to is2MBPageAllocationType
printfSurface is always allocated with size 4 MB it doesn't need aligning. Adding it to is2MBPageAllocationType for clarity and certainty. Related-To: NEO-12287 Signed-off-by: Fabian Zwoliński <fabian.zwolinski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
7b13028ac4
commit
d7b6c7b69e
@@ -24,6 +24,10 @@ NEO::GraphicsAllocation *PrintfHandler::createPrintfBuffer(Device *device) {
|
|||||||
NEO::AllocationProperties properties(
|
NEO::AllocationProperties properties(
|
||||||
device->getRootDeviceIndex(), PrintfHandler::printfBufferSize, NEO::AllocationType::printfSurface, device->getNEODevice()->getDeviceBitfield());
|
device->getRootDeviceIndex(), PrintfHandler::printfBufferSize, NEO::AllocationType::printfSurface, device->getNEODevice()->getDeviceBitfield());
|
||||||
properties.alignment = MemoryConstants::pageSize64k;
|
properties.alignment = MemoryConstants::pageSize64k;
|
||||||
|
|
||||||
|
DEBUG_BREAK_IF(device->getNEODevice()->getProductHelper().is2MBLocalMemAlignmentEnabled() &&
|
||||||
|
!isAligned(properties.size, MemoryConstants::pageSize2M));
|
||||||
|
|
||||||
auto allocation = device->getNEODevice()->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
|
auto allocation = device->getNEODevice()->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
|
||||||
|
|
||||||
*reinterpret_cast<uint32_t *>(allocation->getUnderlyingBuffer()) =
|
*reinterpret_cast<uint32_t *>(allocation->getUnderlyingBuffer()) =
|
||||||
|
|||||||
@@ -44,13 +44,17 @@ void PrintfHandler::prepareDispatch(const MultiDispatchInfo &multiDispatchInfo)
|
|||||||
if (printfSurfaceSize == 0) {
|
if (printfSurfaceSize == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto rootDeviceIndex = device.getRootDeviceIndex();
|
|
||||||
kernel = multiDispatchInfo.peekMainKernel();
|
|
||||||
printfSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, printfSurfaceSize, AllocationType::printfSurface, device.getDeviceBitfield()});
|
|
||||||
|
|
||||||
auto &rootDeviceEnvironment = device.getRootDeviceEnvironment();
|
auto &rootDeviceEnvironment = device.getRootDeviceEnvironment();
|
||||||
const auto &productHelper = device.getProductHelper();
|
const auto &productHelper = device.getProductHelper();
|
||||||
|
|
||||||
|
DEBUG_BREAK_IF(productHelper.is2MBLocalMemAlignmentEnabled() &&
|
||||||
|
!isAligned(printfSurfaceSize, MemoryConstants::pageSize2M));
|
||||||
|
|
||||||
|
auto rootDeviceIndex = device.getRootDeviceIndex();
|
||||||
|
kernel = multiDispatchInfo.peekMainKernel();
|
||||||
|
printfSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, printfSurfaceSize, AllocationType::printfSurface, device.getDeviceBitfield()});
|
||||||
|
|
||||||
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *printfSurface),
|
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *printfSurface),
|
||||||
device, printfSurface, 0, printfSurfaceInitialDataSizePtr.get(),
|
device, printfSurface, 0, printfSurfaceInitialDataSizePtr.get(),
|
||||||
sizeof(*printfSurfaceInitialDataSizePtr.get()));
|
sizeof(*printfSurfaceInitialDataSizePtr.get()));
|
||||||
|
|||||||
@@ -261,7 +261,8 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation>, NEO::NonCopyableAn
|
|||||||
static bool is2MBPageAllocationType(AllocationType type) {
|
static bool is2MBPageAllocationType(AllocationType type) {
|
||||||
return type == AllocationType::timestampPacketTagBuffer ||
|
return type == AllocationType::timestampPacketTagBuffer ||
|
||||||
type == AllocationType::gpuTimestampDeviceBuffer ||
|
type == AllocationType::gpuTimestampDeviceBuffer ||
|
||||||
type == AllocationType::profilingTagBuffer;
|
type == AllocationType::profilingTagBuffer ||
|
||||||
|
type == AllocationType::printfSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isAccessedFromCommandStreamer(AllocationType allocationType) {
|
static bool isAccessedFromCommandStreamer(AllocationType allocationType) {
|
||||||
|
|||||||
@@ -215,6 +215,24 @@ TEST(GraphicsAllocationTest, whenAllocationTypeIsImageThenAllocationIsNotLockabl
|
|||||||
EXPECT_FALSE(GraphicsAllocation::isLockable(AllocationType::image));
|
EXPECT_FALSE(GraphicsAllocation::isLockable(AllocationType::image));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(GraphicsAllocationTest, givenAllocationTypeWhenCheckingIs2MBPageAllocationTypeThenReturnTrue) {
|
||||||
|
for (uint32_t i = 0; i < static_cast<uint32_t>(AllocationType::count); i++) {
|
||||||
|
auto allocType = static_cast<AllocationType>(i);
|
||||||
|
|
||||||
|
switch (allocType) {
|
||||||
|
case AllocationType::timestampPacketTagBuffer:
|
||||||
|
case AllocationType::gpuTimestampDeviceBuffer:
|
||||||
|
case AllocationType::profilingTagBuffer:
|
||||||
|
case AllocationType::printfSurface:
|
||||||
|
EXPECT_TRUE(GraphicsAllocation::is2MBPageAllocationType(allocType));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
EXPECT_FALSE(GraphicsAllocation::is2MBPageAllocationType(allocType));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEST(GraphicsAllocationTest, givenNumMemoryBanksWhenGettingNumHandlesForKmdSharedAllocationThenReturnCorrectValue) {
|
TEST(GraphicsAllocationTest, givenNumMemoryBanksWhenGettingNumHandlesForKmdSharedAllocationThenReturnCorrectValue) {
|
||||||
DebugManagerStateRestore restore;
|
DebugManagerStateRestore restore;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user