Force stateless addressing mode for PVC

PVC will support buffers greater than 4GB, hence we have to
use stateless accessing mode as default.

Signed-off-by: Kopryk, Kamil <kamil.kopryk@intel.com>
This commit is contained in:
Kopryk, Kamil
2021-12-28 22:17:46 +00:00
committed by Compute-Runtime-Automation
parent 67fff7fc51
commit 446a78a134
18 changed files with 99 additions and 19 deletions

View File

@@ -9,6 +9,7 @@
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/gmm_helper/gmm.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/source/helpers/file_io.h"
#include "shared/source/helpers/hash.h"
#include "shared/source/helpers/string.h"
@@ -613,7 +614,8 @@ HWCMDTEST_P(IGFX_GEN8_CORE, AuxBuiltInTests, givenAuxTranslationKernelWhenSettin
}
HWTEST2_P(AuxBuiltInTests, givenAuxToNonAuxTranslationWhenSettingSurfaceStateThenSetValidAuxMode, AuxBuiltinsMatcher) {
if (this->pDevice->areSharedSystemAllocationsAllowed()) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if (compilerHwInfoConfig.isForceToStatelessRequired()) {
GTEST_SKIP();
}
@@ -669,7 +671,8 @@ HWTEST2_P(AuxBuiltInTests, givenAuxToNonAuxTranslationWhenSettingSurfaceStateThe
}
HWTEST2_P(AuxBuiltInTests, givenNonAuxToAuxTranslationWhenSettingSurfaceStateThenSetValidAuxMode, AuxBuiltinsMatcher) {
if (this->pDevice->areSharedSystemAllocationsAllowed()) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if (compilerHwInfoConfig.isForceToStatelessRequired()) {
GTEST_SKIP();
}

View File

@@ -6,6 +6,7 @@
*/
#pragma once
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "opencl/source/command_queue/command_queue_hw.h"
@@ -115,14 +116,17 @@ struct CommandQueueStateful : public CommandQueueHw<FamilyType> {
void enqueueHandlerHook(const unsigned int commandType, const MultiDispatchInfo &dispatchInfo) override {
auto kernel = dispatchInfo.begin()->getKernel();
auto &device = dispatchInfo.begin()->getClDevice();
if (!device.areSharedSystemAllocationsAllowed()) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(device.getHardwareInfo().platform.eProductFamily);
if (compilerHwInfoConfig.isForceToStatelessRequired()) {
EXPECT_TRUE(kernel->getKernelInfo().kernelDescriptor.kernelAttributes.supportsBuffersBiggerThan4Gb());
EXPECT_FALSE(kernel->getKernelInfo().getArgDescriptorAt(0).as<ArgDescPointer>().isPureStateful());
} else {
EXPECT_FALSE(kernel->getKernelInfo().kernelDescriptor.kernelAttributes.supportsBuffersBiggerThan4Gb());
if (HwHelperHw<FamilyType>::get().isStatelesToStatefullWithOffsetSupported()) {
EXPECT_TRUE(kernel->allBufferArgsStateful);
}
} else {
EXPECT_TRUE(kernel->getKernelInfo().kernelDescriptor.kernelAttributes.supportsBuffersBiggerThan4Gb());
EXPECT_FALSE(kernel->getKernelInfo().getArgDescriptorAt(0).as<ArgDescPointer>().isPureStateful());
}
}
};

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/built_ins/built_ins.h"
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/test_macros/test.h"
#include "shared/test/unit_test/utilities/base_object_utils.h"
@@ -549,7 +550,8 @@ HWTEST_F(EnqueueReadBufferRectTest, givenInOrderQueueAndDstPtrEqualSrcPtrAndNonZ
HWTEST_F(EnqueueReadWriteBufferRectDispatch, givenOffsetResultingInMisalignedPtrWhenEnqueueReadBufferRectForNon3DCaseIsCalledThenAddressInStateBaseAddressIsAlignedAndMatchesKernelDispatchInfoParams) {
hwInfo->capabilityTable.blitterOperationsSupported = false;
initializeFixture<FamilyType>();
if (device->areSharedSystemAllocationsAllowed()) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if (compilerHwInfoConfig.isForceToStatelessRequired()) {
GTEST_SKIP();
}

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/built_ins/built_ins.h"
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/test_macros/test.h"
#include "shared/test/unit_test/utilities/base_object_utils.h"
@@ -549,10 +550,10 @@ HWTEST_F(EnqueueReadWriteBufferRectDispatch, givenOffsetResultingInMisalignedPtr
hwInfo->capabilityTable.blitterOperationsSupported = false;
initializeFixture<FamilyType>();
if (device->areSharedSystemAllocationsAllowed()) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if (compilerHwInfoConfig.isForceToStatelessRequired()) {
GTEST_SKIP();
}
auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get(), device.get(), &properties);
buffer->forceDisallowCPUCopy = true;

View File

@@ -64,7 +64,7 @@ bool disabled = false;
using namespace NEO;
PRODUCT_FAMILY productFamily = DEFAULT_TEST_PLATFORM::hwInfo.platform.eProductFamily;
extern PRODUCT_FAMILY productFamily;
extern GFXCORE_FAMILY renderCoreFamily;
extern std::string lastTest;

View File

@@ -7,6 +7,7 @@
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/array_count.h"
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/memory_manager/memory_operations_handler.h"
#include "shared/source/memory_manager/unified_memory_manager.h"
@@ -1821,7 +1822,8 @@ class BufferL3CacheTests : public ::testing::TestWithParam<uint64_t> {
};
HWTEST_P(BufferL3CacheTests, givenMisalignedAndAlignedBufferWhenClEnqueueWriteImageThenL3CacheIsOn) {
if (ctx.getDevice(0)->areSharedSystemAllocationsAllowed() || !ctx.getDevice(0)->getHardwareInfo().capabilityTable.supportsImages) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if (compilerHwInfoConfig.isForceToStatelessRequired() || !ctx.getDevice(0)->getHardwareInfo().capabilityTable.supportsImages) {
GTEST_SKIP();
}
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
@@ -1857,7 +1859,8 @@ HWTEST_P(BufferL3CacheTests, givenMisalignedAndAlignedBufferWhenClEnqueueWriteIm
}
HWTEST_P(BufferL3CacheTests, givenMisalignedAndAlignedBufferWhenClEnqueueWriteBufferRectThenL3CacheIsOn) {
if (ctx.getDevice(0)->areSharedSystemAllocationsAllowed()) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if (compilerHwInfoConfig.isForceToStatelessRequired()) {
GTEST_SKIP();
}
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;

View File

@@ -20,6 +20,7 @@ const char *fSeparator = "/";
#endif
Environment *gEnvironment;
extern PRODUCT_FAMILY productFamily;
extern GFXCORE_FAMILY renderCoreFamily;
std::string getRunPath() {
@@ -94,6 +95,7 @@ int main(int argc, char **argv) {
if (NEO::hardwarePrefix[productId] && (0 == strcmp(devicePrefix.c_str(), NEO::hardwarePrefix[productId]))) {
if (NEO::hardwareInfoTable[productId]) {
renderCoreFamily = NEO::hardwareInfoTable[productId]->platform.eRenderCoreFamily;
productFamily = NEO::hardwareInfoTable[productId]->platform.eProductFamily;
break;
}
}

View File

@@ -13,8 +13,6 @@
#include "gtest/gtest.h"
PRODUCT_FAMILY productFamily;
TEST(OclocValidate, WhenFileArgIsMissingThenFail) {
std::map<std::string, std::string> files;
MockOclocArgHelper argHelper{files};

View File

@@ -12,10 +12,13 @@
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/device_binary_format/elf/elf_decoder.h"
#include "shared/source/device_binary_format/elf/ocl_elf.h"
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/source/helpers/file_io.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/variable_backup.h"
#include "shared/test/common/mocks/mock_compilers.h"
#include "shared/test/common/test_macros/test.h"
#include "shared/test/unit_test/device_binary_format/zebin_tests.h"
#include "compiler_options.h"
@@ -1561,6 +1564,54 @@ TEST(OfflineCompilerTest, givenInputOptionsAndOclockOptionsFileWithForceStosOptW
EXPECT_EQ(std::string::npos, found);
}
struct OfflineCompilerStatelessToStatefulTests : public ::testing::Test {
void SetUp() override {
mockOfflineCompiler = std::make_unique<MockOfflineCompiler>();
mockOfflineCompiler->deviceName = gEnvironment->devicePrefix;
mockOfflineCompiler->initHardwareInfo(mockOfflineCompiler->deviceName);
}
void runTest() const {
std::pair<bool, bool> testParams[] = {{true, false}, {false, true}};
for (const auto &[forceStatelessToStatefulOptimization, containsGreaterThan4gbBuffersRequired] : testParams) {
auto internalOptions = mockOfflineCompiler->internalOptions;
mockOfflineCompiler->forceStatelessToStatefulOptimization = forceStatelessToStatefulOptimization;
mockOfflineCompiler->appendExtraInternalOptions(mockOfflineCompiler->hwInfo, internalOptions);
auto found = internalOptions.find(NEO::CompilerOptions::greaterThan4gbBuffersRequired.data());
if (containsGreaterThan4gbBuffersRequired) {
EXPECT_NE(std::string::npos, found);
} else {
EXPECT_EQ(std::string::npos, found);
}
}
}
std::unique_ptr<MockOfflineCompiler> mockOfflineCompiler;
};
TEST_F(OfflineCompilerStatelessToStatefulTests, whenAppendExtraInternalOptionsThenInternalOptionsAreCorrect) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(mockOfflineCompiler->hwInfo.platform.eProductFamily);
if (!compilerHwInfoConfig.isForceToStatelessRequired()) {
GTEST_SKIP();
}
runTest();
}
template <PRODUCT_FAMILY productFamily>
class MockCompilerHwInfoConfigHw : public CompilerHwInfoConfigHw<productFamily> {
public:
bool isForceToStatelessRequired() const override {
return true;
}
};
HWTEST2_F(OfflineCompilerStatelessToStatefulTests, givenMockWhenAppendExtraInternalOptionsThenInternalOptionsAreCorrect, MatchAny) {
MockCompilerHwInfoConfigHw<productFamily> mockCompilerHwInfoConfig;
VariableBackup<CompilerHwInfoConfig *> backupMockHwInfoConfig(&CompilerHwInfoConfigFactory[productFamily], &mockCompilerHwInfoConfig);
runTest();
}
TEST(OfflineCompilerTest, givenNonExistingFilenameWhenUsedToReadOptionsThenReadOptionsFromFileReturnsFalse) {
std::string options;
std::string file("non_existing_file");

View File

@@ -5,6 +5,7 @@
*
*/
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/source/memory_manager/internal_allocation_storage.h"
#include "shared/source/os_interface/os_interface.h"
#include "shared/source/os_interface/windows/wddm_device_command_stream.h"
@@ -81,7 +82,8 @@ HWTEST_F(EnqueueBufferWindowsTest, givenMisalignedHostPtrWhenEnqueueReadBufferCa
GTEST_SKIP();
}
initializeFixture<FamilyType>();
if (device->areSharedSystemAllocationsAllowed()) {
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
if (compilerHwInfoConfig.isForceToStatelessRequired()) {
GTEST_SKIP();
}
auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get(), device.get(), &properties);

View File

@@ -72,6 +72,11 @@ PVCTEST_F(PvcHwInfoConfig, givenHwInfoConfigAndProgramPipeControlPriorToNonPipel
EXPECT_FALSE(hwInfoConfig.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs));
}
using CompilerHwInfoConfigHelperTestsPvc = ::testing::Test;
PVCTEST_F(CompilerHwInfoConfigHelperTestsPvc, givenPvcWhenIsForceToStatelessRequiredIsCalledThenReturnsTrue) {
EXPECT_TRUE(CompilerHwInfoConfig::get(productFamily)->isForceToStatelessRequired());
}
using PvcHwInfo = ::testing::Test;
PVCTEST_F(PvcHwInfo, givenPvcWhenConfiguringThenDisableCccs) {