mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-22 10:17:01 +08:00
Add FP64 emulation support for ATS-M
This patch adds FP64 emulation support for ATS-M. Introducing new environment variable - NEO_FP64_EMULATION - which provides an option to allow the opt-in emulation of FP64. When emulation is enabled, we pass -cl-fp64-gen-emu (ocl) / -ze-fp64-gen-emu (L0) as an internal option to IGC. Related-To: NEO-7611 Signed-off-by: Fabian Zwolinski <fabian.zwolinski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
8a55d9b517
commit
6c59953072
@@ -688,6 +688,11 @@ ze_result_t DeviceImp::getKernelProperties(ze_device_module_properties_t *pKerne
|
||||
pKernelProperties->fp64flags |= ZE_DEVICE_FP_FLAG_ROUNDED_DIVIDE_SQRT;
|
||||
pKernelProperties->fp32flags |= ZE_DEVICE_FP_FLAG_ROUNDED_DIVIDE_SQRT;
|
||||
}
|
||||
} else if (hardwareInfo.capabilityTable.ftrSupportsFP64Emulation) {
|
||||
if (neoDevice->getExecutionEnvironment()->isFP64EmulationEnabled()) {
|
||||
pKernelProperties->flags |= ZE_DEVICE_MODULE_FLAG_FP64;
|
||||
pKernelProperties->fp64flags = defaultFpFlags | ZE_DEVICE_FP_FLAG_SOFT_FLOAT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ void DriverImp::initialize(ze_result_t *result) {
|
||||
envReader.getSetting("ZES_ENABLE_SYSMAN", false);
|
||||
envVariables.pciIdDeviceOrder =
|
||||
envReader.getSetting("ZE_ENABLE_PCI_ID_DEVICE_ORDER", false);
|
||||
envVariables.fp64Emulation =
|
||||
envReader.getSetting("NEO_FP64_EMULATION", false);
|
||||
|
||||
auto executionEnvironment = new NEO::ExecutionEnvironment();
|
||||
UNRECOVERABLE_IF(nullptr == executionEnvironment);
|
||||
@@ -53,6 +55,10 @@ void DriverImp::initialize(ze_result_t *result) {
|
||||
}
|
||||
}
|
||||
|
||||
if (envVariables.fp64Emulation) {
|
||||
executionEnvironment->setFP64EmulationEnabled();
|
||||
}
|
||||
|
||||
executionEnvironment->setMetricsEnabled(envVariables.metrics);
|
||||
|
||||
executionEnvironment->incRefInternal();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -32,6 +32,7 @@ struct L0EnvVariables {
|
||||
bool pin;
|
||||
bool sysman;
|
||||
bool pciIdDeviceOrder;
|
||||
bool fp64Emulation;
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
@@ -63,6 +63,7 @@ NEO::ConstStringRef optLargeRegisterFile = "-ze-opt-large-register-file";
|
||||
NEO::ConstStringRef optAutoGrf = "-ze-intel-enable-auto-large-GRF-mode";
|
||||
NEO::ConstStringRef enableLibraryCompile = "-library-compilation";
|
||||
NEO::ConstStringRef enableGlobalVariableSymbols = "-ze-take-global-address";
|
||||
NEO::ConstStringRef enableFP64GenEmu = "-ze-fp64-gen-emu";
|
||||
} // namespace BuildOptions
|
||||
|
||||
ModuleTranslationUnit::ModuleTranslationUnit(L0::Device *device)
|
||||
@@ -143,6 +144,10 @@ std::string ModuleTranslationUnit::generateCompilerOptions(const char *buildOpti
|
||||
internalOptions = NEO::CompilerOptions::concatenate(internalOptions, BuildOptions::debugKernelEnable);
|
||||
}
|
||||
|
||||
if (neoDevice.getExecutionEnvironment()->isFP64EmulationEnabled()) {
|
||||
internalOptions = NEO::CompilerOptions::concatenate(internalOptions, BuildOptions::enableFP64GenEmu);
|
||||
}
|
||||
|
||||
const auto &compilerProductHelper = neoDevice.getRootDeviceEnvironment().getHelper<NEO::CompilerProductHelper>();
|
||||
auto forceToStatelessRequired = compilerProductHelper.isForceToStatelessRequired();
|
||||
auto statelessToStatefulOptimizationDisabled = NEO::DebugManager.flags.DisableStatelessToStatefulOptimization.get();
|
||||
|
||||
@@ -40,6 +40,7 @@ extern NEO::ConstStringRef optLargeRegisterFile;
|
||||
extern NEO::ConstStringRef optAutoGrf;
|
||||
extern NEO::ConstStringRef enableLibraryCompile;
|
||||
extern NEO::ConstStringRef enableGlobalVariableSymbols;
|
||||
extern NEO::ConstStringRef enableFP64GenEmu;
|
||||
|
||||
} // namespace BuildOptions
|
||||
|
||||
|
||||
@@ -1861,6 +1861,56 @@ TEST_F(DeviceHasNoDoubleFp64Test, givenDeviceThatDoesntHaveFp64WhenDbgFlagEnable
|
||||
EXPECT_TRUE(kernelProperties.fp64flags & ZE_DEVICE_FP_FLAG_FMA);
|
||||
}
|
||||
|
||||
struct DeviceHasNoFp64HasFp64EmulationTest : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
HardwareInfo fp64EmulationDevice = *defaultHwInfo;
|
||||
fp64EmulationDevice.capabilityTable.ftrSupportsFP64 = false;
|
||||
fp64EmulationDevice.capabilityTable.ftrSupportsFP64Emulation = true;
|
||||
neoDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&fp64EmulationDevice, rootDeviceIndex);
|
||||
NEO::DeviceVector devices;
|
||||
devices.push_back(std::unique_ptr<NEO::Device>(neoDevice));
|
||||
driverHandle = std::make_unique<Mock<L0::DriverHandleImp>>();
|
||||
driverHandle->initialize(std::move(devices));
|
||||
device = driverHandle->devices[0];
|
||||
}
|
||||
|
||||
std::unique_ptr<Mock<L0::DriverHandleImp>> driverHandle;
|
||||
NEO::Device *neoDevice = nullptr;
|
||||
L0::Device *device = nullptr;
|
||||
const uint32_t rootDeviceIndex = 1u;
|
||||
const uint32_t numRootDevices = 1u;
|
||||
};
|
||||
|
||||
TEST_F(DeviceHasNoFp64HasFp64EmulationTest, givenDefaultFp64EmulationSettingsAndDeviceSupportingFp64EmulationAndWithoutNativeFp64ThenReportCorrectFp64Flags) {
|
||||
ze_device_module_properties_t kernelProperties = {};
|
||||
memset(&kernelProperties, std::numeric_limits<int>::max(), sizeof(ze_device_module_properties_t));
|
||||
kernelProperties.pNext = nullptr;
|
||||
|
||||
device->getKernelProperties(&kernelProperties);
|
||||
EXPECT_FALSE(kernelProperties.flags & ZE_DEVICE_MODULE_FLAG_FP64);
|
||||
EXPECT_FALSE(kernelProperties.fp64flags & ZE_DEVICE_FP_FLAG_SOFT_FLOAT);
|
||||
EXPECT_EQ(0u, kernelProperties.fp64flags);
|
||||
}
|
||||
|
||||
TEST_F(DeviceHasNoFp64HasFp64EmulationTest, givenFp64EmulationEnabledAndDeviceSupportingFp64EmulationAndWithoutNativeFp64ThenReportCorrectFp64Flags) {
|
||||
neoDevice->getExecutionEnvironment()->setFP64EmulationEnabled();
|
||||
ze_device_module_properties_t kernelProperties = {};
|
||||
memset(&kernelProperties, std::numeric_limits<int>::max(), sizeof(ze_device_module_properties_t));
|
||||
kernelProperties.pNext = nullptr;
|
||||
|
||||
device->getKernelProperties(&kernelProperties);
|
||||
EXPECT_TRUE(kernelProperties.flags & ZE_DEVICE_MODULE_FLAG_FP64);
|
||||
EXPECT_TRUE(kernelProperties.fp64flags & ZE_DEVICE_FP_FLAG_SOFT_FLOAT);
|
||||
|
||||
ze_device_fp_flags_t defaultFpFlags = static_cast<ze_device_fp_flags_t>(ZE_DEVICE_FP_FLAG_ROUND_TO_NEAREST |
|
||||
ZE_DEVICE_FP_FLAG_ROUND_TO_ZERO |
|
||||
ZE_DEVICE_FP_FLAG_ROUND_TO_INF |
|
||||
ZE_DEVICE_FP_FLAG_INF_NAN |
|
||||
ZE_DEVICE_FP_FLAG_DENORM |
|
||||
ZE_DEVICE_FP_FLAG_FMA);
|
||||
EXPECT_EQ(defaultFpFlags, kernelProperties.fp64flags & defaultFpFlags);
|
||||
}
|
||||
|
||||
struct DeviceHasFp64Test : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
|
||||
|
||||
@@ -413,6 +413,28 @@ TEST(DriverImpTest, givenEnabledProgramDebuggingWhenCreatingExecutionEnvironment
|
||||
L0::GlobalDriver = nullptr;
|
||||
}
|
||||
|
||||
TEST(DriverImpTest, givenEnabledFP64EmulationWhenCreatingExecutionEnvironmentThenFP64EmulationIsEnabled) {
|
||||
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
hwInfo.capabilityTable.levelZeroSupported = true;
|
||||
|
||||
VariableBackup<uint32_t> mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0);
|
||||
std::unordered_map<std::string, std::string> mockableEnvs = {{"NEO_FP64_EMULATION", "1"}};
|
||||
VariableBackup<std::unordered_map<std::string, std::string> *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs);
|
||||
|
||||
ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
DriverImp driverImp;
|
||||
driverImp.initialize(&result);
|
||||
|
||||
ASSERT_NE(nullptr, L0::GlobalDriver);
|
||||
ASSERT_NE(0u, L0::GlobalDriver->numDevices);
|
||||
EXPECT_TRUE(L0::GlobalDriver->devices[0]->getNEODevice()->getExecutionEnvironment()->isFP64EmulationEnabled());
|
||||
|
||||
delete L0::GlobalDriver;
|
||||
L0::GlobalDriverHandle = nullptr;
|
||||
L0::GlobalDriver = nullptr;
|
||||
}
|
||||
|
||||
TEST(DriverImpTest, givenEnabledProgramDebuggingAndEnabledExperimentalOpenCLWhenCreatingExecutionEnvironmentThenDebuggingEnabledIsFalse) {
|
||||
DebugManagerStateRestore restorer;
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
|
||||
@@ -375,5 +375,45 @@ TEST_F(ModuleTests, givenDefaultGrfFlagSetWhenCreatingModuleThenOverrideInternal
|
||||
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-intel-128-GRF-per-thread"), std::string::npos);
|
||||
}
|
||||
|
||||
TEST_F(ModuleTests, givenFP64EmulationDisabledWhenCreatingModuleThenEnableFP64GenEmuOptionIsNotPresent) {
|
||||
auto cip = new NEO::MockCompilerInterfaceCaptureBuildOptions();
|
||||
device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->compilerInterface.reset(cip);
|
||||
ASSERT_FALSE(device->getNEODevice()->getExecutionEnvironment()->isFP64EmulationEnabled());
|
||||
|
||||
uint8_t binary[10];
|
||||
ze_module_desc_t moduleDesc = {};
|
||||
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
|
||||
moduleDesc.pInputModule = binary;
|
||||
moduleDesc.inputSize = 10;
|
||||
|
||||
ModuleBuildLog *moduleBuildLog = nullptr;
|
||||
|
||||
auto module = std::unique_ptr<L0::ModuleImp>(new L0::ModuleImp(device, moduleBuildLog, ModuleType::Builtin));
|
||||
ASSERT_NE(nullptr, module.get());
|
||||
module->initialize(&moduleDesc, device->getNEODevice());
|
||||
|
||||
EXPECT_FALSE(CompilerOptions::contains(cip->buildInternalOptions, BuildOptions::enableFP64GenEmu));
|
||||
};
|
||||
|
||||
TEST_F(ModuleTests, givenFP64EmulationEnabledWhenCreatingModuleThenEnableFP64GenEmuOptionIsPresent) {
|
||||
auto cip = new NEO::MockCompilerInterfaceCaptureBuildOptions();
|
||||
device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->compilerInterface.reset(cip);
|
||||
device->getNEODevice()->getExecutionEnvironment()->setFP64EmulationEnabled();
|
||||
|
||||
uint8_t binary[10];
|
||||
ze_module_desc_t moduleDesc = {};
|
||||
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
|
||||
moduleDesc.pInputModule = binary;
|
||||
moduleDesc.inputSize = 10;
|
||||
|
||||
ModuleBuildLog *moduleBuildLog = nullptr;
|
||||
|
||||
auto module = std::unique_ptr<L0::ModuleImp>(new L0::ModuleImp(device, moduleBuildLog, ModuleType::Builtin));
|
||||
ASSERT_NE(nullptr, module.get());
|
||||
module->initialize(&moduleDesc, device->getNEODevice());
|
||||
|
||||
EXPECT_TRUE(CompilerOptions::contains(cip->buildInternalOptions, BuildOptions::enableFP64GenEmu));
|
||||
};
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
|
||||
@@ -87,13 +87,16 @@ cl_int CL_API_CALL clGetPlatformIDs(cl_uint numEntries,
|
||||
auto executionEnvironment = new ClExecutionEnvironment();
|
||||
executionEnvironment->incRefInternal();
|
||||
|
||||
if (NEO::DebugManager.flags.ExperimentalEnableL0DebuggerForOpenCL.get()) {
|
||||
NEO::EnvironmentVariableReader envReader;
|
||||
if (NEO::DebugManager.flags.ExperimentalEnableL0DebuggerForOpenCL.get()) {
|
||||
auto programDebugging = envReader.getSetting("ZET_ENABLE_PROGRAM_DEBUGGING", false);
|
||||
if (programDebugging) {
|
||||
executionEnvironment->setDebuggingEnabled();
|
||||
}
|
||||
}
|
||||
if (envReader.getSetting("NEO_FP64_EMULATION", false)) {
|
||||
executionEnvironment->setFP64EmulationEnabled();
|
||||
}
|
||||
auto allDevices = DeviceFactory::createDevices(*executionEnvironment);
|
||||
executionEnvironment->decRefInternal();
|
||||
if (allDevices.empty()) {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
@@ -58,11 +59,19 @@ void ClDevice::setupFp64Flags() {
|
||||
deviceInfo.doubleFpConfig = defaultFpFlags;
|
||||
deviceInfo.nativeVectorWidthDouble = 1;
|
||||
deviceInfo.preferredVectorWidthDouble = 1;
|
||||
} else {
|
||||
if (hwInfo.capabilityTable.ftrSupportsFP64Emulation) {
|
||||
if (getDevice().getExecutionEnvironment()->isFP64EmulationEnabled()) {
|
||||
deviceInfo.doubleFpConfig = defaultFpFlags | CL_FP_SOFT_FLOAT;
|
||||
deviceInfo.nativeVectorWidthDouble = 1;
|
||||
deviceInfo.preferredVectorWidthDouble = 1;
|
||||
}
|
||||
} else {
|
||||
deviceInfo.doubleFpConfig = 0;
|
||||
deviceInfo.nativeVectorWidthDouble = 0;
|
||||
deviceInfo.preferredVectorWidthDouble = 0;
|
||||
}
|
||||
}
|
||||
|
||||
deviceInfo.singleFpConfig = static_cast<cl_device_fp_config>(
|
||||
hwInfo.capabilityTable.ftrSupports64BitMath
|
||||
|
||||
@@ -99,6 +99,10 @@ std::string Program::getInternalOptions() const {
|
||||
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::enableImageSupport);
|
||||
}
|
||||
|
||||
if (pClDevice->getDevice().getExecutionEnvironment()->isFP64EmulationEnabled()) {
|
||||
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::enableFP64GenEmu);
|
||||
}
|
||||
|
||||
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::preserveVec3Type);
|
||||
auto isDebuggerActive = pClDevice->getDevice().isDebuggerActive() || pClDevice->getDevice().getDebugger() != nullptr;
|
||||
CompilerOptions::concatenateAppend(internalOptions, compilerProductHelper.getCachingPolicyOptions(isDebuggerActive));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -215,4 +215,48 @@ TEST(clGetPlatformIDsTest, givenEnabledExperimentalSupportAndZeroProgramDebuggin
|
||||
|
||||
platformsImpl->clear();
|
||||
}
|
||||
|
||||
TEST(clGetPlatformIDsTest, givenEnabledFP64EmulationWhenGettingPlatformIdsThenFP64EmulationIsEnabled) {
|
||||
VariableBackup<uint32_t> mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0);
|
||||
std::unordered_map<std::string, std::string> mockableEnvs = {{"NEO_FP64_EMULATION", "1"}};
|
||||
VariableBackup<std::unordered_map<std::string, std::string> *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs);
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_platform_id platformRet = nullptr;
|
||||
cl_uint numPlatforms = 0;
|
||||
|
||||
platformsImpl->clear();
|
||||
|
||||
retVal = clGetPlatformIDs(1, &platformRet, &numPlatforms);
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
ASSERT_NE(nullptr, platformsImpl);
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
EXPECT_TRUE(executionEnvironment->isFP64EmulationEnabled());
|
||||
|
||||
platformsImpl->clear();
|
||||
}
|
||||
|
||||
TEST(clGetPlatformIDsTest, givenDefaultFP64EmulationStateWhenGettingPlatformIdsThenFP64EmulationIsDisabled) {
|
||||
VariableBackup<uint32_t> mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0);
|
||||
std::unordered_map<std::string, std::string> mockableEnvs = {{"NEO_FP64_EMULATION", "0"}};
|
||||
VariableBackup<std::unordered_map<std::string, std::string> *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs);
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_platform_id platformRet = nullptr;
|
||||
cl_uint numPlatforms = 0;
|
||||
|
||||
platformsImpl->clear();
|
||||
|
||||
retVal = clGetPlatformIDs(1, &platformRet, &numPlatforms);
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
ASSERT_NE(nullptr, platformsImpl);
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
EXPECT_FALSE(executionEnvironment->isDebuggingEnabled());
|
||||
|
||||
platformsImpl->clear();
|
||||
}
|
||||
} // namespace ULT
|
||||
|
||||
@@ -1072,6 +1072,49 @@ TEST_F(DeviceGetCapsTest, givenFp64SupportForcedWhenCheckingFp64SupportThenFp64I
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(DeviceGetCapsTest, givenFp64EmulationSupportWithoutFp64EmulationEnvVarWhenCreatingDeviceThenDeviceCapsAreSetCorrectly) {
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
|
||||
hwInfo.capabilityTable.ftrSupportsFP64 = false;
|
||||
hwInfo.capabilityTable.ftrSupportsFP64Emulation = true;
|
||||
|
||||
auto executionEnvironment = MockClDevice::prepareExecutionEnvironment(&hwInfo, 0);
|
||||
auto pClDevice = std::make_unique<MockClDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(&hwInfo, executionEnvironment, 0));
|
||||
|
||||
auto &caps = pClDevice->getDeviceInfo();
|
||||
std::string extensionString = pClDevice->getDeviceInfo().deviceExtensions;
|
||||
|
||||
EXPECT_EQ(std::string::npos, extensionString.find(std::string("cl_khr_fp64")));
|
||||
EXPECT_FALSE(isValueSet(caps.doubleFpConfig, CL_FP_SOFT_FLOAT));
|
||||
}
|
||||
|
||||
TEST_F(DeviceGetCapsTest, givenFp64EmulationSupportWithFp64EmulationEnvVarSetWhenCreatingDeviceThenDeviceCapsAreSetCorrectly) {
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
|
||||
hwInfo.capabilityTable.ftrSupportsFP64 = false;
|
||||
hwInfo.capabilityTable.ftrSupportsFP64Emulation = true;
|
||||
|
||||
auto executionEnvironment = MockClDevice::prepareExecutionEnvironment(&hwInfo, 0);
|
||||
executionEnvironment->setFP64EmulationEnabled();
|
||||
auto pClDevice = std::make_unique<MockClDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(&hwInfo, executionEnvironment, 0));
|
||||
|
||||
auto &caps = pClDevice->getDeviceInfo();
|
||||
std::string extensionString = pClDevice->getDeviceInfo().deviceExtensions;
|
||||
|
||||
EXPECT_EQ(std::string::npos, extensionString.find(std::string("cl_khr_fp64")));
|
||||
EXPECT_TRUE(isValueSet(caps.doubleFpConfig, CL_FP_SOFT_FLOAT));
|
||||
|
||||
cl_device_fp_config defaultFpFlags = static_cast<cl_device_fp_config>(CL_FP_ROUND_TO_NEAREST |
|
||||
CL_FP_ROUND_TO_ZERO |
|
||||
CL_FP_ROUND_TO_INF |
|
||||
CL_FP_INF_NAN |
|
||||
CL_FP_DENORM |
|
||||
CL_FP_FMA);
|
||||
EXPECT_EQ(defaultFpFlags, caps.doubleFpConfig & defaultFpFlags);
|
||||
EXPECT_EQ(1u, caps.nativeVectorWidthDouble);
|
||||
EXPECT_EQ(1u, caps.preferredVectorWidthDouble);
|
||||
}
|
||||
|
||||
TEST(DeviceGetCaps, WhenPeekingCompilerExtensionsThenCompilerExtensionsAreReturned) {
|
||||
UltClDeviceFactory deviceFactory{1, 0};
|
||||
auto pClDevice = deviceFactory.rootDevices[0];
|
||||
|
||||
@@ -1765,6 +1765,20 @@ TEST_F(ProgramTests, Force32BitAddressessWhenProgramIsCreatedThenGreaterThan4gbB
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ProgramTests, givenFp64EmulationInDefaultStateWhenProgramIsCreatedThenEnableFP64GenEmuBuildOptionIsNotPresent) {
|
||||
std::unique_ptr<MockProgram> program{Program::createBuiltInFromSource<MockProgram>("", pContext, pContext->getDevices(), nullptr)};
|
||||
auto internalOptions = program->getInternalOptions();
|
||||
EXPECT_FALSE(CompilerOptions::contains(internalOptions, NEO::CompilerOptions::enableFP64GenEmu)) << internalOptions;
|
||||
}
|
||||
|
||||
TEST_F(ProgramTests, givenFp64EmulationEnabledTheWhenProgramIsCreatedThenEnableFP64GenEmuBuildOptionIsPresent) {
|
||||
std::unique_ptr<MockProgram> program{Program::createBuiltInFromSource<MockProgram>("", pContext, pContext->getDevices(), nullptr)};
|
||||
ASSERT_FALSE(pDevice->getExecutionEnvironment()->isFP64EmulationEnabled());
|
||||
pDevice->getExecutionEnvironment()->setFP64EmulationEnabled();
|
||||
auto internalOptions = program->getInternalOptions();
|
||||
EXPECT_TRUE(CompilerOptions::contains(internalOptions, NEO::CompilerOptions::enableFP64GenEmu)) << internalOptions;
|
||||
}
|
||||
|
||||
TEST_F(ProgramTests, whenContainsStatefulAccessIsCalledThenReturnCorrectResult) {
|
||||
std::vector<std::tuple<bool, SurfaceStateHeapOffset, CrossThreadDataOffset>> testParams = {
|
||||
{false, undefined<SurfaceStateHeapOffset>, undefined<CrossThreadDataOffset>},
|
||||
|
||||
@@ -44,6 +44,7 @@ inline constexpr ConstStringRef largeGrf = "-cl-intel-256-GRF-per-thread";
|
||||
inline constexpr ConstStringRef autoGrf = "-cl-intel-enable-auto-large-GRF-mode";
|
||||
inline constexpr ConstStringRef numThreadsPerEu = "-cl-intel-reqd-eu-thread-count";
|
||||
inline constexpr ConstStringRef useCMCompiler = "-cmc";
|
||||
inline constexpr ConstStringRef enableFP64GenEmu = "-cl-fp64-gen-emu";
|
||||
|
||||
inline constexpr size_t nullterminateSize = 1U;
|
||||
inline constexpr size_t spaceSeparatorSize = 1U;
|
||||
|
||||
@@ -42,6 +42,10 @@ class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment>
|
||||
this->metricsEnabled = value;
|
||||
}
|
||||
bool areMetricsEnabled() { return this->metricsEnabled; }
|
||||
void setFP64EmulationEnabled() {
|
||||
fp64EmulationEnabled = true;
|
||||
}
|
||||
bool isFP64EmulationEnabled() const { return fp64EmulationEnabled; }
|
||||
DirectSubmissionController *initializeDirectSubmissionController();
|
||||
|
||||
std::unique_ptr<MemoryManager> memoryManager;
|
||||
@@ -56,6 +60,7 @@ class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment>
|
||||
void configureNeoEnvironment();
|
||||
bool debuggingEnabled = false;
|
||||
bool metricsEnabled = false;
|
||||
bool fp64EmulationEnabled = false;
|
||||
std::unordered_map<uint32_t, uint32_t> rootDeviceNumCcsMap;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -51,6 +51,7 @@ const RuntimeCapabilityTable EHL::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
false, // ftrSupportsInteger64BitAtomics
|
||||
false, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
false, // ftrSupports64BitMath
|
||||
false, // ftrSvm
|
||||
false, // ftrSupportsCoherency
|
||||
|
||||
@@ -51,6 +51,7 @@ const RuntimeCapabilityTable ICLLP::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
true, // ftrSupportsInteger64BitAtomics
|
||||
false, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
false, // ftrSupports64BitMath
|
||||
true, // ftrSvm
|
||||
false, // ftrSupportsCoherency
|
||||
|
||||
@@ -51,6 +51,7 @@ const RuntimeCapabilityTable LKF::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
false, // ftrSupportsInteger64BitAtomics
|
||||
false, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
false, // ftrSupports64BitMath
|
||||
false, // ftrSvm
|
||||
false, // ftrSupportsCoherency
|
||||
|
||||
@@ -54,6 +54,7 @@ const RuntimeCapabilityTable ADLN::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
true, // ftrSupportsInteger64BitAtomics
|
||||
false, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
false, // ftrSupports64BitMath
|
||||
true, // ftrSvm
|
||||
false, // ftrSupportsCoherency
|
||||
|
||||
@@ -54,6 +54,7 @@ const RuntimeCapabilityTable ADLP::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
true, // ftrSupportsInteger64BitAtomics
|
||||
false, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
false, // ftrSupports64BitMath
|
||||
true, // ftrSvm
|
||||
false, // ftrSupportsCoherency
|
||||
|
||||
@@ -54,6 +54,7 @@ const RuntimeCapabilityTable ADLS::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
true, // ftrSupportsInteger64BitAtomics
|
||||
false, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
false, // ftrSupports64BitMath
|
||||
true, // ftrSvm
|
||||
false, // ftrSupportsCoherency
|
||||
|
||||
@@ -54,6 +54,7 @@ const RuntimeCapabilityTable DG1::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
true, // ftrSupportsInteger64BitAtomics
|
||||
false, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
false, // ftrSupports64BitMath
|
||||
true, // ftrSvm
|
||||
false, // ftrSupportsCoherency
|
||||
|
||||
@@ -54,6 +54,7 @@ const RuntimeCapabilityTable RKL::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
true, // ftrSupportsInteger64BitAtomics
|
||||
false, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
false, // ftrSupports64BitMath
|
||||
true, // ftrSvm
|
||||
false, // ftrSupportsCoherency
|
||||
|
||||
@@ -54,6 +54,7 @@ const RuntimeCapabilityTable TGLLP::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
true, // ftrSupportsInteger64BitAtomics
|
||||
false, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
false, // ftrSupports64BitMath
|
||||
true, // ftrSvm
|
||||
false, // ftrSupportsCoherency
|
||||
|
||||
@@ -51,6 +51,7 @@ const RuntimeCapabilityTable BDW::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
true, // ftrSupportsInteger64BitAtomics
|
||||
true, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
true, // ftrSupports64BitMath
|
||||
true, // ftrSvm
|
||||
true, // ftrSupportsCoherency
|
||||
|
||||
@@ -51,6 +51,7 @@ const RuntimeCapabilityTable BXT::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
false, // ftrSupportsInteger64BitAtomics
|
||||
true, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
true, // ftrSupports64BitMath
|
||||
false, // ftrSvm
|
||||
true, // ftrSupportsCoherency
|
||||
|
||||
@@ -51,6 +51,7 @@ const RuntimeCapabilityTable CFL::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
true, // ftrSupportsInteger64BitAtomics
|
||||
true, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
true, // ftrSupports64BitMath
|
||||
true, // ftrSvm
|
||||
true, // ftrSupportsCoherency
|
||||
|
||||
@@ -51,6 +51,7 @@ const RuntimeCapabilityTable GLK::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
false, // ftrSupportsInteger64BitAtomics
|
||||
true, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
true, // ftrSupports64BitMath
|
||||
false, // ftrSvm
|
||||
true, // ftrSupportsCoherency
|
||||
|
||||
@@ -51,6 +51,7 @@ const RuntimeCapabilityTable KBL::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
true, // ftrSupportsInteger64BitAtomics
|
||||
true, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
true, // ftrSupports64BitMath
|
||||
true, // ftrSvm
|
||||
true, // ftrSupportsCoherency
|
||||
|
||||
@@ -51,6 +51,7 @@ const RuntimeCapabilityTable SKL::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
true, // ftrSupportsInteger64BitAtomics
|
||||
true, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
true, // ftrSupports64BitMath
|
||||
true, // ftrSvm
|
||||
true, // ftrSupportsCoherency
|
||||
|
||||
@@ -38,6 +38,7 @@ struct RuntimeCapabilityTable {
|
||||
bool blitterOperationsSupported;
|
||||
bool ftrSupportsInteger64BitAtomics;
|
||||
bool ftrSupportsFP64;
|
||||
bool ftrSupportsFP64Emulation;
|
||||
bool ftrSupports64BitMath;
|
||||
bool ftrSvm;
|
||||
bool ftrSupportsCoherency;
|
||||
@@ -104,6 +105,7 @@ inline bool operator==(const RuntimeCapabilityTable &lhs, const RuntimeCapabilit
|
||||
result &= (lhs.blitterOperationsSupported == rhs.blitterOperationsSupported);
|
||||
result &= (lhs.ftrSupportsInteger64BitAtomics == rhs.ftrSupportsInteger64BitAtomics);
|
||||
result &= (lhs.ftrSupportsFP64 == rhs.ftrSupportsFP64);
|
||||
result &= (lhs.ftrSupportsFP64Emulation == rhs.ftrSupportsFP64Emulation);
|
||||
result &= (lhs.ftrSupports64BitMath == rhs.ftrSupports64BitMath);
|
||||
result &= (lhs.ftrSvm == rhs.ftrSvm);
|
||||
result &= (lhs.ftrSupportsCoherency == rhs.ftrSupportsCoherency);
|
||||
|
||||
@@ -54,6 +54,7 @@ const RuntimeCapabilityTable XE_HP_SDV::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
true, // ftrSupportsInteger64BitAtomics
|
||||
true, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
true, // ftrSupports64BitMath
|
||||
true, // ftrSvm
|
||||
false, // ftrSupportsCoherency
|
||||
|
||||
@@ -65,6 +65,7 @@ const RuntimeCapabilityTable PVC::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
true, // ftrSupportsInteger64BitAtomics
|
||||
true, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
true, // ftrSupports64BitMath
|
||||
true, // ftrSvm
|
||||
false, // ftrSupportsCoherency
|
||||
|
||||
@@ -57,6 +57,7 @@ const RuntimeCapabilityTable DG2::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
true, // ftrSupportsInteger64BitAtomics
|
||||
false, // ftrSupportsFP64
|
||||
true, // ftrSupportsFP64Emulation
|
||||
true, // ftrSupports64BitMath
|
||||
true, // ftrSvm
|
||||
false, // ftrSupportsCoherency
|
||||
|
||||
@@ -53,6 +53,7 @@ const RuntimeCapabilityTable MTL::capabilityTable{
|
||||
false, // blitterOperationsSupported
|
||||
true, // ftrSupportsInteger64BitAtomics
|
||||
true, // ftrSupportsFP64
|
||||
false, // ftrSupportsFP64Emulation
|
||||
true, // ftrSupports64BitMath
|
||||
true, // ftrSvm
|
||||
false, // ftrSupportsCoherency
|
||||
|
||||
@@ -444,3 +444,15 @@ TEST(ExecutionEnvironment, whenCalculateMaxOsContexCountThenGlobalVariableHasPro
|
||||
EXPECT_EQ(expectedOsContextCount + expectedOsContextCountForCcs, MemoryManager::maxOsContextCount);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ExecutionEnvironment, givenDefaultExecutionEnvironmentSettingsWhenCheckingFP64EmulationThenFP64EmulationIsDisabled) {
|
||||
ExecutionEnvironment executionEnvironment{};
|
||||
EXPECT_FALSE(executionEnvironment.isFP64EmulationEnabled());
|
||||
}
|
||||
|
||||
TEST(ExecutionEnvironment, givenExecutionEnvironmentWhenSettingFP64EmulationEnabledThenFP64EmulationIsEnabled) {
|
||||
ExecutionEnvironment executionEnvironment{};
|
||||
ASSERT_FALSE(executionEnvironment.isFP64EmulationEnabled());
|
||||
executionEnvironment.setFP64EmulationEnabled();
|
||||
EXPECT_TRUE(executionEnvironment.isFP64EmulationEnabled());
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@ DG2TEST_F(Dg2UsDeviceIdTest, givenDg2ProductWhenCheckFp64SupportThenReturnFalse)
|
||||
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsFP64);
|
||||
}
|
||||
|
||||
DG2TEST_F(Dg2UsDeviceIdTest, givenDg2ProductWhenCheckFp64EmulationSupportThenReturnTrue) {
|
||||
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsFP64Emulation);
|
||||
}
|
||||
|
||||
DG2TEST_F(Dg2UsDeviceIdTest, givenEnabledFtrPooledEuA0SteppingAndG10DevIdWhenCalculatingMaxEuPerSSThenDontIgnoreEuCountPerPoolMin) {
|
||||
HardwareInfo myHwInfo = *defaultHwInfo;
|
||||
GT_SYSTEM_INFO &mySysInfo = myHwInfo.gtSystemInfo;
|
||||
|
||||
Reference in New Issue
Block a user