mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Change DG2 l1 cache policy to WB
With compiler LSC WAs this gives better performance. Related-To: NEO-7003 Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
6f77f1e468
commit
9a5e619c42
@ -1787,7 +1787,7 @@ HWTEST2_F(ProgramTests, givenDebugFlagSetToWbWhenGetInternalOptionsThenCorrectBu
|
||||
EXPECT_TRUE(CompilerOptions::contains(internalOptions, "-cl-store-cache-default=7 -cl-load-cache-default=4"));
|
||||
}
|
||||
|
||||
HWTEST2_F(ProgramTests, givenAtLeastDG2WhenGetInternalOptionsThenCorrectBuildOptionIsSet, IsAtLeastXeHpgCore) {
|
||||
HWTEST2_F(ProgramTests, givenAtLeastXeHpgWhenGetInternalOptionsThenCorrectBuildOptionIsSet, IsAtLeastXeHpgCore) {
|
||||
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
|
||||
auto internalOptions = program.getInternalOptions();
|
||||
EXPECT_TRUE(CompilerOptions::contains(internalOptions, "-cl-store-cache-default=2 -cl-load-cache-default=4"));
|
||||
|
13
opencl/test/unit_test/program/xe_hpg_core/CMakeLists.txt
Normal file
13
opencl/test/unit_test/program/xe_hpg_core/CMakeLists.txt
Normal file
@ -0,0 +1,13 @@
|
||||
#
|
||||
# Copyright (C) 2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(TESTS_XE_HPG_CORE)
|
||||
set(IGDRCL_SRCS_tests_program_xe_hpg_core
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
)
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_program_xe_hpg_core})
|
||||
add_subdirectories()
|
||||
endif()
|
16
opencl/test/unit_test/program/xe_hpg_core/dg2/CMakeLists.txt
Normal file
16
opencl/test/unit_test/program/xe_hpg_core/dg2/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
||||
#
|
||||
# Copyright (C) 2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(TESTS_DG2)
|
||||
set(IGDRCL_SRCS_tests_program_dg2
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/program_tests_dg2.cpp
|
||||
)
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_program_dg2})
|
||||
|
||||
endif()
|
||||
|
||||
add_subdirectories()
|
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/xe_hpg_core/hw_cmds_dg2.h"
|
||||
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_program.h"
|
||||
#include "opencl/test/unit_test/program/program_tests.h"
|
||||
using namespace NEO;
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(ProgramTests, givenAtLeastXeHpgWhenGetInternalOptionsThenCorrectBuildOptionIsSet_IsAtLeastXeHpgCore, IGFX_XE_HPG_CORE);
|
||||
DG2TEST_F(ProgramTests, givenDG2WhenGetInternalOptionsThenCorrectBuildOptionIsSet) {
|
||||
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
|
||||
auto internalOptions = program.getInternalOptions();
|
||||
EXPECT_TRUE(CompilerOptions::contains(internalOptions, "-cl-store-cache-default=7 -cl-load-cache-default=4"));
|
||||
}
|
@ -21,6 +21,7 @@
|
||||
using namespace NEO;
|
||||
using CmdsProgrammingTestsDg2 = UltCommandStreamReceiverTest;
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(CmdsProgrammingTestsXeHpgCore, givenL3ToL1DebugFlagWhenStatelessMocsIsProgrammedThenItHasL1CachingOn, IGFX_XE_HPG_CORE);
|
||||
DG2TEST_F(CmdsProgrammingTestsDg2, givenL3ToL1DebugFlagWhenStatelessMocsIsProgrammedThenItHasL1CachingOn) {
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
|
||||
@ -37,13 +38,14 @@ DG2TEST_F(CmdsProgrammingTestsDg2, givenL3ToL1DebugFlagWhenStatelessMocsIsProgra
|
||||
|
||||
auto stateBaseAddress = static_cast<STATE_BASE_ADDRESS *>(hwParserCsr.cmdStateBaseAddress);
|
||||
|
||||
auto actualL1CachePolocy = static_cast<uint8_t>(stateBaseAddress->getL1CachePolicyL1CacheControl());
|
||||
auto actualL1CachePolicy = static_cast<uint8_t>(stateBaseAddress->getL1CachePolicyL1CacheControl());
|
||||
|
||||
const uint8_t expectedL1CachePolicy = FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP;
|
||||
EXPECT_EQ(expectedL1CachePolicy, actualL1CachePolocy);
|
||||
const uint8_t expectedL1CachePolicy = FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB;
|
||||
EXPECT_EQ(expectedL1CachePolicy, actualL1CachePolicy);
|
||||
}
|
||||
|
||||
DG2TEST_F(CmdsProgrammingTestsDg2, givenSpecificProductFamilyWhenAppendingSbaThenProgramWtL1CachePolicy) {
|
||||
|
||||
auto memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
|
||||
AllocationProperties properties(pDevice->getRootDeviceIndex(), 1, AllocationType::BUFFER, pDevice->getDeviceBitfield());
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
||||
@ -56,11 +58,12 @@ DG2TEST_F(CmdsProgrammingTestsDg2, givenSpecificProductFamilyWhenAppendingSbaThe
|
||||
pDevice->getRootDeviceEnvironment().getGmmHelper(), false,
|
||||
MemoryCompressionState::NotApplicable, true, false, 1u);
|
||||
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(CmdsProgrammingTestsXeHpgCore, givenL1CachingOverrideWhenStateBaseAddressIsProgrammedThenItMatchesTheOverrideValue, IGFX_XE_HPG_CORE);
|
||||
DG2TEST_F(CmdsProgrammingTestsDg2, givenL1CachingOverrideWhenStateBaseAddressIsProgrammedThenItMatchesTheOverrideValue) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(0u);
|
||||
@ -89,7 +92,8 @@ DG2TEST_F(CmdsProgrammingTestsDg2, givenL1CachingOverrideWhenStateBaseAddressIsP
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
DG2TEST_F(CmdsProgrammingTestsDg2, whenAppendingRssThenProgramWBPL1CachePolicy) {
|
||||
HWTEST_EXCLUDE_PRODUCT(CmdsProgrammingTestsXeHpgCore, givenXeHpgCoreWhenAppendingRssThenProgramWBPL1CachePolicy, IGFX_XE_HPG_CORE);
|
||||
DG2TEST_F(CmdsProgrammingTestsDg2, givenDG2whenAppendingRssThenProgramWBL1CachePolicy) {
|
||||
auto memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
|
||||
size_t allocationSize = MemoryConstants::pageSize;
|
||||
AllocationProperties properties(pDevice->getRootDeviceIndex(), allocationSize, AllocationType::BUFFER, pDevice->getDeviceBitfield());
|
||||
@ -116,39 +120,10 @@ DG2TEST_F(CmdsProgrammingTestsDg2, whenAppendingRssThenProgramWBPL1CachePolicy)
|
||||
|
||||
EncodeSurfaceState<FamilyType>::encodeBuffer(args);
|
||||
|
||||
EXPECT_EQ(FamilyType::RENDER_SURFACE_STATE::L1_CACHE_POLICY_WBP, rssCmd.getL1CachePolicyL1CacheControl());
|
||||
}
|
||||
|
||||
DG2TEST_F(CmdsProgrammingTestsDg2, givenAlignedCacheableReadOnlyBufferThenChoseOclBufferConstPolicy) {
|
||||
MockContext context;
|
||||
const auto size = MemoryConstants::pageSize;
|
||||
const auto ptr = (void *)alignedMalloc(size * 2, MemoryConstants::pageSize);
|
||||
const auto flags = CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY;
|
||||
|
||||
auto retVal = CL_SUCCESS;
|
||||
auto buffer = std::unique_ptr<Buffer>(Buffer::create(
|
||||
&context,
|
||||
flags,
|
||||
size,
|
||||
ptr,
|
||||
retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
|
||||
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), false, false);
|
||||
|
||||
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
|
||||
const auto actualMocs = surfaceState.getMemoryObjectControlState();
|
||||
EXPECT_EQ(expectedMocs, actualMocs);
|
||||
|
||||
auto actualL1CachePolocy = static_cast<uint8_t>(surfaceState.getL1CachePolicyL1CacheControl());
|
||||
|
||||
const uint8_t expectedL1CachePolicy = FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP;
|
||||
EXPECT_EQ(expectedL1CachePolicy, actualL1CachePolocy);
|
||||
|
||||
alignedFree(ptr);
|
||||
EXPECT_EQ(FamilyType::RENDER_SURFACE_STATE::L1_CACHE_POLICY_WB, rssCmd.getL1CachePolicyL1CacheControl());
|
||||
}
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(CmdsProgrammingTestsXeHpgCore, givenAlignedCacheableReadOnlyBufferThenChoseOclBufferConstPolicy, IGFX_XE_HPG_CORE);
|
||||
DG2TEST_F(CmdsProgrammingTestsDg2, givenDG2WithBSteppingWhenFlushingTaskThenAdditionalStateBaseAddressCommandIsPresent) {
|
||||
auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
@ -168,3 +143,22 @@ DG2TEST_F(CmdsProgrammingTestsDg2, givenDG2WithBSteppingWhenFlushingTaskThenAddi
|
||||
stateBaseAddressItor = find<typename FamilyType::STATE_BASE_ADDRESS *>(stateBaseAddressItor, cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), stateBaseAddressItor);
|
||||
}
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(CmdsProgrammingTestsXeHpgCore, givenSpecificProductFamilyWhenAppendingSbaThenProgramWBPL1CachePolicy, IGFX_XE_HPG_CORE);
|
||||
DG2TEST_F(CmdsProgrammingTestsDg2, givenDG2WhenAppendingSbaThenProgramWBL1CachePolicy) {
|
||||
auto memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
|
||||
AllocationProperties properties(pDevice->getRootDeviceIndex(), 1, AllocationType::BUFFER, pDevice->getDeviceBitfield());
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
||||
|
||||
IndirectHeap indirectHeap(allocation, 1);
|
||||
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
auto sbaCmd = FamilyType::cmdInitStateBaseAddress;
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(&sbaCmd, &indirectHeap, true, 0,
|
||||
pDevice->getRootDeviceEnvironment().getGmmHelper(), false,
|
||||
MemoryCompressionState::NotApplicable, true, false, 1u);
|
||||
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
@ -37,10 +37,10 @@ XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenL3ToL1DebugFlagWhenStatele
|
||||
|
||||
auto stateBaseAddress = static_cast<STATE_BASE_ADDRESS *>(hwParserCsr.cmdStateBaseAddress);
|
||||
|
||||
auto actualL1CachePolocy = static_cast<uint8_t>(stateBaseAddress->getL1CachePolicyL1CacheControl());
|
||||
auto actualL1CachePolicy = static_cast<uint8_t>(stateBaseAddress->getL1CachePolicyL1CacheControl());
|
||||
|
||||
const uint8_t expectedL1CachePolicy = 0;
|
||||
EXPECT_EQ(expectedL1CachePolicy, actualL1CachePolocy);
|
||||
EXPECT_EQ(expectedL1CachePolicy, actualL1CachePolicy);
|
||||
}
|
||||
|
||||
XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenSpecificProductFamilyWhenAppendingSbaThenProgramWBPL1CachePolicy) {
|
||||
@ -89,7 +89,7 @@ XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenL1CachingOverrideWhenState
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, whenAppendingRssThenProgramWBPL1CachePolicy) {
|
||||
XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenXeHpgCoreWhenAppendingRssThenProgramWBPL1CachePolicy) {
|
||||
auto memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
|
||||
size_t allocationSize = MemoryConstants::pageSize;
|
||||
AllocationProperties properties(pDevice->getRootDeviceIndex(), allocationSize, AllocationType::BUFFER, pDevice->getDeviceBitfield());
|
||||
@ -141,10 +141,10 @@ XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenAlignedCacheableReadOnlyBu
|
||||
const auto actualMocs = surfaceState.getMemoryObjectControlState();
|
||||
EXPECT_EQ(expectedMocs, actualMocs);
|
||||
|
||||
auto actualL1CachePolocy = static_cast<uint8_t>(surfaceState.getL1CachePolicyL1CacheControl());
|
||||
auto actualL1CachePolicy = static_cast<uint8_t>(surfaceState.getL1CachePolicyL1CacheControl());
|
||||
|
||||
const uint8_t expectedL1CachePolicy = 0;
|
||||
EXPECT_EQ(expectedL1CachePolicy, actualL1CachePolocy);
|
||||
EXPECT_EQ(expectedL1CachePolicy, actualL1CachePolicy);
|
||||
|
||||
alignedFree(ptr);
|
||||
}
|
||||
|
Reference in New Issue
Block a user