mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Change DG2 l1 cache policy to WB
With compiler LSC WAs this gives better performance. If debugger is active, policy will not be changed ie. will be WBP. Related-To: NEO-7003 Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
6118e41741
commit
8cc0177f1c
@@ -159,6 +159,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
|
||||
args.gmmHelper = neoDevice->getGmmHelper();
|
||||
args.useGlobalAtomics = kernelImp->getKernelDescriptor().kernelAttributes.flags.useGlobalAtomics;
|
||||
args.areMultipleSubDevicesInContext = false;
|
||||
args.isDebuggerActive = true;
|
||||
NEO::EncodeSurfaceState<GfxFamily>::encodeBuffer(args);
|
||||
*reinterpret_cast<typename GfxFamily::RENDER_SURFACE_STATE *>(surfaceStateSpace) = surfaceState;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
|
||||
|
||||
auto indirectObjectHeapBaseAddress = neoDevice->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex(), useLocalMemoryForIndirectHeap);
|
||||
auto instructionHeapBaseAddress = neoDevice->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex(), neoDevice->getMemoryManager()->isLocalMemoryUsedForIsa(neoDevice->getRootDeviceIndex()));
|
||||
auto isDebuggerActive = neoDevice->isDebuggerActive() || neoDevice->getDebugger() != nullptr;
|
||||
|
||||
NEO::StateBaseAddressHelperArgs<GfxFamily> stateBaseAddressHelperArgs = {
|
||||
gsba, // generalStateBase
|
||||
@@ -72,7 +73,8 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
|
||||
false, // isMultiOsContextCapable
|
||||
false, // useGlobalAtomics
|
||||
false, // areMultipleSubDevicesInContext
|
||||
false // overrideSurfaceStateBaseAddress
|
||||
false, // overrideSurfaceStateBaseAddress
|
||||
isDebuggerActive // isDebuggerActive
|
||||
};
|
||||
|
||||
NEO::StateBaseAddressHelper<GfxFamily>::programStateBaseAddress(stateBaseAddressHelperArgs);
|
||||
|
||||
@@ -41,6 +41,7 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
|
||||
|
||||
NEO::EncodeWA<GfxFamily>::addPipeControlBeforeStateBaseAddress(commandStream, hwInfo, isRcs);
|
||||
auto sbaCmdBuf = NEO::StateBaseAddressHelper<GfxFamily>::getSpaceForSbaCmd(commandStream);
|
||||
auto isDebuggerActive = neoDevice->isDebuggerActive() || neoDevice->getDebugger() != nullptr;
|
||||
|
||||
STATE_BASE_ADDRESS sbaCmd;
|
||||
NEO::StateBaseAddressHelperArgs<GfxFamily> stateBaseAddressHelperArgs = {
|
||||
@@ -62,7 +63,8 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
|
||||
multiOsContextCapable, // isMultiOsContextCapable
|
||||
false, // useGlobalAtomics
|
||||
false, // areMultipleSubDevicesInContext
|
||||
false // overrideSurfaceStateBaseAddress
|
||||
false, // overrideSurfaceStateBaseAddress
|
||||
isDebuggerActive // isDebuggerActive
|
||||
};
|
||||
|
||||
NEO::StateBaseAddressHelper<GfxFamily>::programStateBaseAddress(stateBaseAddressHelperArgs);
|
||||
|
||||
@@ -75,7 +75,7 @@ struct KernelHw : public KernelImp {
|
||||
if (l3Enabled == false) {
|
||||
this->kernelRequiresQueueUncachedMocsCount++;
|
||||
}
|
||||
|
||||
auto isDebuggerActive = neoDevice->isDebuggerActive() || neoDevice->getDebugger() != nullptr;
|
||||
NEO::EncodeSurfaceStateArgs args;
|
||||
args.outMemory = &surfaceState;
|
||||
args.graphicsAddress = bufferAddressForSsh;
|
||||
@@ -87,6 +87,7 @@ struct KernelHw : public KernelImp {
|
||||
args.useGlobalAtomics = kernelImmData->getDescriptor().kernelAttributes.flags.useGlobalAtomics;
|
||||
args.areMultipleSubDevicesInContext = args.numAvailableDevices > 1;
|
||||
args.implicitScaling = device->isImplicitScalingCapable();
|
||||
args.isDebuggerActive = isDebuggerActive;
|
||||
|
||||
NEO::EncodeSurfaceState<GfxFamily>::encodeBuffer(args);
|
||||
*reinterpret_cast<typename GfxFamily::RENDER_SURFACE_STATE *>(surfaceStateAddress) = surfaceState;
|
||||
|
||||
@@ -72,7 +72,7 @@ inline void patchWithImplicitSurface(ArrayRef<uint8_t> crossThreadData, ArrayRef
|
||||
|
||||
auto &hwInfo = device.getHardwareInfo();
|
||||
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
|
||||
auto isDebuggerActive = device.isDebuggerActive() || device.getDebugger() != nullptr;
|
||||
NEO::EncodeSurfaceStateArgs args;
|
||||
args.outMemory = surfaceState;
|
||||
args.size = sizeToPatch;
|
||||
@@ -84,6 +84,7 @@ inline void patchWithImplicitSurface(ArrayRef<uint8_t> crossThreadData, ArrayRef
|
||||
args.areMultipleSubDevicesInContext = args.numAvailableDevices > 1;
|
||||
args.mocs = hwHelper.getMocsIndex(*args.gmmHelper, true, false) << 1;
|
||||
args.implicitScaling = implicitScaling;
|
||||
args.isDebuggerActive = isDebuggerActive;
|
||||
|
||||
hwHelper.encodeBufferSurfaceState(args);
|
||||
}
|
||||
|
||||
@@ -121,8 +121,8 @@ std::string ModuleTranslationUnit::generateCompilerOptions(const char *buildOpti
|
||||
}
|
||||
std::string internalOptions = NEO::CompilerOptions::concatenate(internalBuildOptions, BuildOptions::hasBufferOffsetArg);
|
||||
auto &neoDevice = *device->getNEODevice();
|
||||
|
||||
if (neoDevice.getDeviceInfo().debuggerActive) {
|
||||
auto isDebuggerActive = neoDevice.getDeviceInfo().debuggerActive;
|
||||
if (isDebuggerActive) {
|
||||
if (NEO::SourceLevelDebugger::shouldAppendOptDisable(*device->getSourceLevelDebugger())) {
|
||||
NEO::CompilerOptions::concatenateAppend(options, BuildOptions::optDisable);
|
||||
}
|
||||
@@ -139,7 +139,7 @@ std::string ModuleTranslationUnit::generateCompilerOptions(const char *buildOpti
|
||||
internalOptions = NEO::CompilerOptions::concatenate(internalOptions, NEO::CompilerOptions::greaterThan4gbBuffersRequired);
|
||||
}
|
||||
|
||||
NEO::CompilerOptions::concatenateAppend(internalOptions, compilerHwInfoConfig.getCachingPolicyOptions());
|
||||
NEO::CompilerOptions::concatenateAppend(internalOptions, compilerHwInfoConfig.getCachingPolicyOptions(isDebuggerActive));
|
||||
return internalOptions;
|
||||
}
|
||||
|
||||
|
||||
@@ -2259,7 +2259,7 @@ HWTEST_F(ModuleTranslationUnitTest, givenInternalOptionsThenLSCCachePolicyIsSet)
|
||||
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr);
|
||||
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
EXPECT_TRUE(ret);
|
||||
auto expectedPolicy = compilerHwInfoConfig.getCachingPolicyOptions();
|
||||
auto expectedPolicy = compilerHwInfoConfig.getCachingPolicyOptions(false);
|
||||
if (expectedPolicy != nullptr) {
|
||||
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find(expectedPolicy), std::string::npos);
|
||||
} else {
|
||||
|
||||
@@ -7,9 +7,13 @@
|
||||
if(TESTS_DG2)
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_sampler_dg2.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_cache_flush_dg2.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_cmdlist_dg2.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_cmdqueue_dg2.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_excludes_dg2.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_kernel_dg2.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_module_dg2.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_sampler_dg2.cpp
|
||||
)
|
||||
add_subdirectories()
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/cache_flush_xehp_and_later.inl"
|
||||
#include "shared/source/helpers/l3_range.h"
|
||||
#include "shared/source/xe_hpg_core/hw_cmds.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "level_zero/core/source/xe_hpg_core/cmdlist_xe_hpg_core.h"
|
||||
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
using CacheFlushDG2Tests = Test<DeviceFixture>;
|
||||
|
||||
HWTEST2_F(CacheFlushDG2Tests, givenCommandStreamWithSingleL3RangeAndNonZeroPostSyncAddressWhenFlushGpuCacheIsCalledThenPostSyncOperationIsSetForL3ControlAndUnTypedDataPortCacheFlushIsSet, IsDG2) {
|
||||
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
|
||||
using L3_CONTROL = typename GfxFamily::L3_CONTROL;
|
||||
auto &hardwareInfo = this->neoDevice->getHardwareInfo();
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::Copy, 0u);
|
||||
LinearStream *cmdStream = commandList->commandContainer.getCommandStream();
|
||||
uint64_t gpuAddress = 0x1200;
|
||||
void *buffer = reinterpret_cast<void *>(gpuAddress);
|
||||
size_t size = 0x1000;
|
||||
uint64_t postSyncAddress = 0x1200;
|
||||
|
||||
NEO::MockGraphicsAllocation mockAllocation(buffer, gpuAddress, size);
|
||||
NEO::SvmAllocationData allocData(0);
|
||||
allocData.size = size;
|
||||
allocData.gpuAllocations.addAllocation(&mockAllocation);
|
||||
device->getDriverHandle()->getSvmAllocsManager()->insertSVMAlloc(allocData);
|
||||
|
||||
L3RangesVec ranges;
|
||||
ranges.push_back(L3Range::fromAddressSizeWithPolicy(
|
||||
gpuAddress, size,
|
||||
GfxFamily::L3_FLUSH_ADDRESS_RANGE::
|
||||
L3_FLUSH_EVICTION_POLICY_FLUSH_L3_WITH_EVICTION));
|
||||
NEO::flushGpuCache<GfxFamily>(cmdStream, ranges, postSyncAddress,
|
||||
hardwareInfo);
|
||||
|
||||
GenCmdList cmdList;
|
||||
EXPECT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(cmdStream->getCpuBase(), 0), cmdStream->getUsed()));
|
||||
auto itor = find<L3_CONTROL *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(cmdList.end(), itor);
|
||||
auto l3Control = genCmdCast<L3_CONTROL *>(*itor);
|
||||
EXPECT_TRUE(l3Control->getUnTypedDataPortCacheFlush());
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
@@ -5,7 +5,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_l0_debugger.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
|
||||
@@ -30,5 +32,79 @@ HWTEST2_F(CommandQueueTestDG2, givenBindlessEnabledWhenEstimateStateBaseAddressC
|
||||
EXPECT_EQ(size, expectedSize);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandQueueTestDG2, givenBindlessEnabledWhenProgramStateBaseAddressCalledOnDG2ThenProgramCorrectL1CachePolicy, IsDG2) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
|
||||
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(),
|
||||
neoDevice->getNumGenericSubDevices() > 1,
|
||||
neoDevice->getRootDeviceIndex(),
|
||||
neoDevice->getDeviceBitfield());
|
||||
|
||||
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
|
||||
using STATE_BASE_ADDRESS = typename GfxFamily::STATE_BASE_ADDRESS;
|
||||
ze_command_queue_desc_t desc = {};
|
||||
auto &csr = neoDevice->getGpgpuCommandStreamReceiver();
|
||||
auto commandQueue = std::make_unique<MockCommandQueueHw<gfxCoreFamily>>(device, &csr, &desc);
|
||||
void *linearStreamBuffer = alignedMalloc(4096, 0x1000);
|
||||
{
|
||||
NEO::LinearStream cmdStream(linearStreamBuffer, 4096);
|
||||
auto usedSpaceBefore = cmdStream.getUsed();
|
||||
commandQueue->programStateBaseAddress(0, false, cmdStream, false);
|
||||
auto usedSpaceAfter = cmdStream.getUsed();
|
||||
ASSERT_GT(usedSpaceAfter, usedSpaceBefore);
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(cmdStream.getCpuBase(), 0), usedSpaceAfter));
|
||||
|
||||
auto sbaItor = find<STATE_BASE_ADDRESS *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(cmdList.end(), sbaItor);
|
||||
auto cmdSba = genCmdCast<STATE_BASE_ADDRESS *>(*sbaItor);
|
||||
|
||||
EXPECT_EQ(STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB, cmdSba->getL1CachePolicyL1CacheControl());
|
||||
}
|
||||
{
|
||||
const_cast<NEO::DeviceInfo &>(device->getDeviceInfo()).debuggerActive = true;
|
||||
NEO::LinearStream cmdStream(linearStreamBuffer, 4096);
|
||||
auto usedSpaceBefore = cmdStream.getUsed();
|
||||
commandQueue->programStateBaseAddress(0, false, cmdStream, false);
|
||||
auto usedSpaceAfter = cmdStream.getUsed();
|
||||
ASSERT_GT(usedSpaceAfter, usedSpaceBefore);
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(cmdStream.getCpuBase(), 0), usedSpaceAfter));
|
||||
|
||||
auto sbaItor = find<STATE_BASE_ADDRESS *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(cmdList.end(), sbaItor);
|
||||
auto cmdSba = genCmdCast<STATE_BASE_ADDRESS *>(*sbaItor);
|
||||
|
||||
EXPECT_EQ(STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, cmdSba->getL1CachePolicyL1CacheControl());
|
||||
}
|
||||
{
|
||||
auto debugger = MockDebuggerL0Hw<FamilyType>::allocate(neoDevice);
|
||||
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(debugger);
|
||||
const_cast<NEO::DeviceInfo &>(device->getDeviceInfo()).debuggerActive = false;
|
||||
NEO::LinearStream cmdStream(linearStreamBuffer, 4096);
|
||||
auto usedSpaceBefore = cmdStream.getUsed();
|
||||
commandQueue->programStateBaseAddress(0, false, cmdStream, false);
|
||||
auto usedSpaceAfter = cmdStream.getUsed();
|
||||
ASSERT_GT(usedSpaceAfter, usedSpaceBefore);
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(cmdStream.getCpuBase(), 0), usedSpaceAfter));
|
||||
|
||||
auto sbaItor = find<STATE_BASE_ADDRESS *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(cmdList.end(), sbaItor);
|
||||
auto cmdSba = genCmdCast<STATE_BASE_ADDRESS *>(*sbaItor);
|
||||
|
||||
EXPECT_EQ(STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, cmdSba->getL1CachePolicyL1CacheControl());
|
||||
}
|
||||
|
||||
alignedFree(linearStreamBuffer);
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/test_macros/hw_test_base.h"
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(ModuleTranslationUnitTest, givenAtLeastXeHpgCoreWhenGetInternalOptionsThenCorrectBuildOptionIsSet_IsAtLeastXeHpgCore, IGFX_DG2);
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_l0_debugger.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "level_zero/core/test/unit_tests/fixtures/module_fixture.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
using KernelTestDG2 = Test<ModuleFixture>;
|
||||
|
||||
HWTEST2_F(KernelTestDG2, givenKernelImpWhenSetBufferSurfaceStateCalledThenProgramCorrectL1CachePolicy, IsDG2) {
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
ze_kernel_handle_t kernelHandle;
|
||||
|
||||
ze_kernel_desc_t kernelDesc = {};
|
||||
kernelDesc.pKernelName = kernelName.c_str();
|
||||
|
||||
ze_result_t res = module->createKernel(&kernelDesc, &kernelHandle);
|
||||
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
auto kernelImp = reinterpret_cast<L0::KernelImp *>(L0::Kernel::fromHandle(kernelHandle));
|
||||
|
||||
void *devicePtr = nullptr;
|
||||
ze_device_mem_alloc_desc_t deviceDesc = {};
|
||||
res = context->allocDeviceMem(device->toHandle(),
|
||||
&deviceDesc,
|
||||
16384u,
|
||||
0u,
|
||||
&devicePtr);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
auto gpuAlloc = device->getDriverHandle()->getSvmAllocsManager()->getSVMAllocs()->get(devicePtr)->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex());
|
||||
ASSERT_NE(nullptr, gpuAlloc);
|
||||
|
||||
uint32_t argIndex = 0u;
|
||||
kernelImp->setBufferSurfaceState(argIndex, devicePtr, gpuAlloc);
|
||||
|
||||
auto argInfo = kernelImp->getImmutableData()->getDescriptor().payloadMappings.explicitArgs[argIndex].as<NEO::ArgDescPointer>();
|
||||
auto surfaceStateAddressRaw = ptrOffset(kernelImp->getSurfaceStateHeapData(), argInfo.bindful);
|
||||
auto surfaceStateAddress = reinterpret_cast<RENDER_SURFACE_STATE *>(const_cast<unsigned char *>(surfaceStateAddressRaw));
|
||||
EXPECT_EQ(RENDER_SURFACE_STATE::L1_CACHE_POLICY_WB, surfaceStateAddress->getL1CachePolicyL1CacheControl());
|
||||
|
||||
const_cast<NEO::DeviceInfo &>(device->getDeviceInfo()).debuggerActive = true;
|
||||
kernelImp->setBufferSurfaceState(argIndex, devicePtr, gpuAlloc);
|
||||
surfaceStateAddressRaw = ptrOffset(kernelImp->getSurfaceStateHeapData(), argInfo.bindful);
|
||||
surfaceStateAddress = reinterpret_cast<RENDER_SURFACE_STATE *>(const_cast<unsigned char *>(surfaceStateAddressRaw));
|
||||
EXPECT_EQ(RENDER_SURFACE_STATE::L1_CACHE_POLICY_WBP, surfaceStateAddress->getL1CachePolicyL1CacheControl());
|
||||
|
||||
auto debugger = MockDebuggerL0Hw<FamilyType>::allocate(neoDevice);
|
||||
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(debugger);
|
||||
const_cast<NEO::DeviceInfo &>(device->getDeviceInfo()).debuggerActive = false;
|
||||
kernelImp->setBufferSurfaceState(argIndex, devicePtr, gpuAlloc);
|
||||
surfaceStateAddressRaw = ptrOffset(kernelImp->getSurfaceStateHeapData(), argInfo.bindful);
|
||||
surfaceStateAddress = reinterpret_cast<RENDER_SURFACE_STATE *>(const_cast<unsigned char *>(surfaceStateAddressRaw));
|
||||
EXPECT_EQ(RENDER_SURFACE_STATE::L1_CACHE_POLICY_WBP, surfaceStateAddress->getL1CachePolicyL1CacheControl());
|
||||
|
||||
Kernel::fromHandle(kernelHandle)->destroy();
|
||||
|
||||
context->freeMem(devicePtr);
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/mocks/mock_compilers.h"
|
||||
#include "shared/test/common/mocks/mock_l0_debugger.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "level_zero/core/test/unit_tests/fixtures/module_fixture.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_module.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
using KernelDebugSurfaceDG2Test = Test<ModuleFixture>;
|
||||
|
||||
HWTEST2_F(KernelDebugSurfaceDG2Test, givenDebuggerAndBindfulKernelWhenAppendingKernelToCommandListThenCachePolicyIsWBP, IsDG2) {
|
||||
NEO::MockCompilerEnableGuard mock(true);
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
|
||||
const_cast<DeviceInfo &>(neoDevice->getDeviceInfo()).debuggerActive = true;
|
||||
auto debugger = MockDebuggerL0Hw<FamilyType>::allocate(neoDevice);
|
||||
|
||||
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(debugger);
|
||||
auto &hwInfo = *NEO::defaultHwInfo.get();
|
||||
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
auto maxDbgSurfaceSize = hwHelper.getSipKernelMaxDbgSurfaceSize(hwInfo);
|
||||
auto debugSurface = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(
|
||||
{device->getRootDeviceIndex(), true,
|
||||
maxDbgSurfaceSize,
|
||||
NEO::AllocationType::DEBUG_CONTEXT_SAVE_AREA,
|
||||
false,
|
||||
false,
|
||||
device->getNEODevice()->getDeviceBitfield()});
|
||||
static_cast<L0::DeviceImp *>(device)->setDebugSurface(debugSurface);
|
||||
|
||||
uint8_t binary[10];
|
||||
ze_module_desc_t moduleDesc = {};
|
||||
moduleDesc.format = ZE_MODULE_FORMAT_NATIVE;
|
||||
moduleDesc.pInputModule = binary;
|
||||
moduleDesc.inputSize = 10;
|
||||
ModuleBuildLog *moduleBuildLog = nullptr;
|
||||
|
||||
std::unique_ptr<MockModule> module = std::make_unique<MockModule>(device,
|
||||
moduleBuildLog,
|
||||
ModuleType::User);
|
||||
|
||||
module->debugEnabled = true;
|
||||
|
||||
uint32_t kernelHeap = 0;
|
||||
KernelInfo kernelInfo;
|
||||
kernelInfo.heapInfo.KernelHeapSize = 1;
|
||||
kernelInfo.heapInfo.pKernelHeap = &kernelHeap;
|
||||
|
||||
Mock<::L0::Kernel> kernel;
|
||||
kernel.module = module.get();
|
||||
kernel.immutableData.kernelInfo = &kernelInfo;
|
||||
|
||||
ze_kernel_desc_t desc = {};
|
||||
|
||||
kernel.immutableData.kernelDescriptor->payloadMappings.implicitArgs.systemThreadSurfaceAddress.bindful = sizeof(RENDER_SURFACE_STATE);
|
||||
kernel.immutableData.surfaceStateHeapSize = 2 * sizeof(RENDER_SURFACE_STATE);
|
||||
kernel.immutableData.surfaceStateHeapTemplate.reset(new uint8_t[2 * sizeof(RENDER_SURFACE_STATE)]);
|
||||
module->kernelImmData = &kernel.immutableData;
|
||||
|
||||
kernel.initialize(&desc);
|
||||
|
||||
auto debugSurfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(kernel.surfaceStateHeapData.get());
|
||||
debugSurfaceState = ptrOffset(debugSurfaceState, sizeof(RENDER_SURFACE_STATE));
|
||||
|
||||
EXPECT_EQ(RENDER_SURFACE_STATE::L1_CACHE_POLICY_WBP, debugSurfaceState->getL1CachePolicyL1CacheControl());
|
||||
}
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
@@ -46,14 +46,14 @@ HWTEST2_F(KernelPropertyTest, givenKernelExtendedPropertiesStructureWhenKernelPr
|
||||
EXPECT_FALSE(kernelExtendedProperties.fp64Flags & FP_ATOMIC_EXT_FLAG_LOCAL_MIN_MAX);
|
||||
}
|
||||
|
||||
HWTEST2_F(KernelPropertyTest, givenDG2WhenGetInternalOptionsThenWriteByPassBuildOptionIsSet, IsDG2) {
|
||||
HWTEST2_F(KernelPropertyTest, givenDG2WhenGetInternalOptionsThenWriteBackBuildOptionIsSet, IsDG2) {
|
||||
auto pMockCompilerInterface = new MockCompilerInterface;
|
||||
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
|
||||
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
|
||||
MockModuleTranslationUnit moduleTu(this->device);
|
||||
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr);
|
||||
EXPECT_TRUE(ret);
|
||||
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=2 -cl-load-cache-default=4"), std::string::npos);
|
||||
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=7 -cl-load-cache-default=4"), std::string::npos);
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
|
||||
Reference in New Issue
Block a user