Use BCS to copy ISA if required
Change-Id: I181e09d0356718c25162efdddede39b13399ed3b Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
parent
d2b218d82d
commit
c381f371cd
|
@ -7,6 +7,8 @@
|
|||
|
||||
#include "shared/source/device_binary_format/patchtokens_decoder.h"
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/source/helpers/blit_commands_helper.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
|
@ -427,6 +429,15 @@ bool KernelInfo::createKernelAllocation(const Device &device) {
|
|||
if (!kernelAllocation) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto &hwInfo = device.getHardwareInfo();
|
||||
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
|
||||
if (kernelAllocation->isAllocatedInLocalMemoryPool() && hwHelper.isBlitCopyRequiredForLocalMemory(hwInfo)) {
|
||||
auto status = BlitHelperFunctions::blitMemoryToAllocation(device, kernelAllocation, 0, heapInfo.pKernelHeap, {kernelIsaSize, 1, 1});
|
||||
return (status == BlitOperationResult::Success);
|
||||
}
|
||||
|
||||
return device.getMemoryManager()->copyMemoryToAllocation(kernelAllocation, heapInfo.pKernelHeap, kernelIsaSize);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ struct BlitEnqueueTests : public ::testing::Test {
|
|||
bcsCsr->setupContext(*bcsOsContext);
|
||||
bcsCsr->initializeTagAllocation();
|
||||
|
||||
auto mockBlitMemoryToAllocation = [this](Device &device, GraphicsAllocation *memory, size_t offset, const void *hostPtr,
|
||||
auto mockBlitMemoryToAllocation = [this](const Device &device, GraphicsAllocation *memory, size_t offset, const void *hostPtr,
|
||||
Vec3<size_t> size) -> BlitOperationResult {
|
||||
auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer,
|
||||
*bcsCsr, memory, nullptr,
|
||||
|
@ -70,6 +70,7 @@ struct BlitEnqueueTests : public ::testing::Test {
|
|||
DebugManager.flags.ForceAuxTranslationMode.set(1);
|
||||
DebugManager.flags.ForceGpgpuSubmissionForBcsEnqueue.set(1);
|
||||
DebugManager.flags.CsrDispatchMode.set(static_cast<int32_t>(DispatchMode::ImmediateDispatch));
|
||||
DebugManager.flags.EnableLocalMemory.set(1);
|
||||
device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
auto &capabilityTable = device->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable;
|
||||
bool createBcsEngine = !capabilityTable.blitterOperationsSupported;
|
||||
|
@ -1461,4 +1462,46 @@ HWTEST_TEMPLATED_F(BlitEnqueueWithDisabledGpgpuSubmissionTests, givenSubmissionT
|
|||
}
|
||||
}
|
||||
|
||||
using BlitCopyTests = BlitEnqueueTests<1>;
|
||||
|
||||
HWTEST_TEMPLATED_F(BlitCopyTests, givenKernelAllocationInLocalMemoryWhenCreatingWithoutAllowedCpuAccessThenUseBcsForTransfer) {
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::CpuAccessDisallowed));
|
||||
DebugManager.flags.ForceNonSystemMemoryPlacement.set(1 << (static_cast<int64_t>(GraphicsAllocation::AllocationType::KERNEL_ISA) - 1));
|
||||
|
||||
uint32_t kernelHeap = 0;
|
||||
KernelInfo kernelInfo;
|
||||
kernelInfo.heapInfo.KernelHeapSize = 1;
|
||||
kernelInfo.heapInfo.pKernelHeap = &kernelHeap;
|
||||
|
||||
auto initialTaskCount = bcsMockContext->bcsCsr->peekTaskCount();
|
||||
|
||||
kernelInfo.createKernelAllocation(device->getDevice());
|
||||
|
||||
if (kernelInfo.kernelAllocation->isAllocatedInLocalMemoryPool()) {
|
||||
EXPECT_EQ(initialTaskCount + 1, bcsMockContext->bcsCsr->peekTaskCount());
|
||||
} else {
|
||||
EXPECT_EQ(initialTaskCount, bcsMockContext->bcsCsr->peekTaskCount());
|
||||
}
|
||||
|
||||
device->getMemoryManager()->freeGraphicsMemory(kernelInfo.kernelAllocation);
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(BlitCopyTests, givenKernelAllocationInLocalMemoryWhenCreatingWithAllowedCpuAccessThenDontUseBcsForTransfer) {
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::CpuAccessAllowed));
|
||||
DebugManager.flags.ForceNonSystemMemoryPlacement.set(1 << (static_cast<int64_t>(GraphicsAllocation::AllocationType::KERNEL_ISA) - 1));
|
||||
|
||||
uint32_t kernelHeap = 0;
|
||||
KernelInfo kernelInfo;
|
||||
kernelInfo.heapInfo.KernelHeapSize = 1;
|
||||
kernelInfo.heapInfo.pKernelHeap = &kernelHeap;
|
||||
|
||||
auto initialTaskCount = bcsMockContext->bcsCsr->peekTaskCount();
|
||||
|
||||
kernelInfo.createKernelAllocation(device->getDevice());
|
||||
|
||||
EXPECT_EQ(initialTaskCount, bcsMockContext->bcsCsr->peekTaskCount());
|
||||
|
||||
device->getMemoryManager()->freeGraphicsMemory(kernelInfo.kernelAllocation);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -36,7 +36,7 @@ struct BcsBufferTests : public ::testing::Test {
|
|||
bcsCsr->initializeTagAllocation();
|
||||
bcsCsr->createGlobalFenceAllocation();
|
||||
|
||||
auto mockBlitMemoryToAllocation = [this](Device &device, GraphicsAllocation *memory, size_t offset, const void *hostPtr,
|
||||
auto mockBlitMemoryToAllocation = [this](const Device &device, GraphicsAllocation *memory, size_t offset, const void *hostPtr,
|
||||
Vec3<size_t> size) -> BlitOperationResult {
|
||||
auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer,
|
||||
*bcsCsr, memory, nullptr,
|
||||
|
|
|
@ -86,7 +86,7 @@ enum class BlitOperationResult {
|
|||
};
|
||||
|
||||
namespace BlitHelperFunctions {
|
||||
using BlitMemoryToAllocationFunc = std::function<BlitOperationResult(Device &device,
|
||||
using BlitMemoryToAllocationFunc = std::function<BlitOperationResult(const Device &device,
|
||||
GraphicsAllocation *memory,
|
||||
size_t offset,
|
||||
const void *hostPtr,
|
||||
|
@ -96,9 +96,9 @@ extern BlitMemoryToAllocationFunc blitAllocationToMemory;
|
|||
} // namespace BlitHelperFunctions
|
||||
|
||||
struct BlitHelper {
|
||||
static BlitOperationResult blitMemoryToAllocation(Device &device, GraphicsAllocation *memory, size_t offset, const void *hostPtr,
|
||||
static BlitOperationResult blitMemoryToAllocation(const Device &device, GraphicsAllocation *memory, size_t offset, const void *hostPtr,
|
||||
Vec3<size_t> size);
|
||||
static BlitOperationResult blitAllocationToMemory(Device &device, GraphicsAllocation *memory, size_t offset, const void *hostPtr,
|
||||
static BlitOperationResult blitAllocationToMemory(const Device &device, GraphicsAllocation *memory, size_t offset, const void *hostPtr,
|
||||
Vec3<size_t> size);
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
namespace NEO {
|
||||
|
||||
BlitOperationResult BlitHelper::blitMemoryToAllocation(Device &device, GraphicsAllocation *memory, size_t offset, const void *hostPtr,
|
||||
BlitOperationResult BlitHelper::blitMemoryToAllocation(const Device &device, GraphicsAllocation *memory, size_t offset, const void *hostPtr,
|
||||
Vec3<size_t> size) {
|
||||
return BlitOperationResult::Unsupported;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue