mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Add debug flag to override fp64 capabilities
Change-Id: I5078aaaeeb58b4821e7c9ae4b01e0a8261a5c8da
This commit is contained in:
committed by
sys_ocldev
parent
a9566e0c05
commit
e6a9d30951
@@ -147,6 +147,7 @@ class Device : public BaseObject<_cl_device_id> {
|
||||
bool isRootDevice, Device &outDevice);
|
||||
static const HardwareInfo *getDeviceInitHwInfo(const HardwareInfo *pHwInfoIn);
|
||||
MOCKABLE_VIRTUAL void initializeCaps();
|
||||
void setupFp64Flags();
|
||||
void appendOSExtensions(std::string &deviceExtensions);
|
||||
|
||||
unsigned int enabledClVersion;
|
||||
|
||||
@@ -51,6 +51,13 @@ static std::string driverVersion = TOSTR(NEO_DRIVER_VERSION);
|
||||
|
||||
const char *builtInKernels = ""; // the "always available" (extension-independent) builtin kernels
|
||||
|
||||
static constexpr 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);
|
||||
|
||||
bool Device::getEnabled64kbPages() {
|
||||
if (DebugManager.flags.Enable64kbpages.get() == -1) {
|
||||
// assign value according to os and hw configuration
|
||||
@@ -61,6 +68,29 @@ bool Device::getEnabled64kbPages() {
|
||||
}
|
||||
};
|
||||
|
||||
void Device::setupFp64Flags() {
|
||||
if (DebugManager.flags.OverrideDefaultFP64Settings.get() == -1) {
|
||||
if (hwInfo.capabilityTable.ftrSupportsFP64) {
|
||||
deviceExtensions += "cl_khr_fp64 ";
|
||||
}
|
||||
|
||||
deviceInfo.singleFpConfig = static_cast<cl_device_fp_config>(
|
||||
hwInfo.capabilityTable.ftrSupports64BitMath
|
||||
? CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT
|
||||
: 0);
|
||||
|
||||
deviceInfo.doubleFpConfig = hwInfo.capabilityTable.ftrSupportsFP64
|
||||
? defaultFpFlags
|
||||
: 0;
|
||||
} else {
|
||||
if (DebugManager.flags.OverrideDefaultFP64Settings.get() == 1) {
|
||||
deviceExtensions += "cl_khr_fp64 ";
|
||||
deviceInfo.singleFpConfig = static_cast<cl_device_fp_config>(CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT);
|
||||
deviceInfo.doubleFpConfig = defaultFpFlags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Device::initializeCaps() {
|
||||
deviceExtensions.clear();
|
||||
deviceExtensions.append(deviceExtensionsList);
|
||||
@@ -90,6 +120,8 @@ void Device::initializeCaps() {
|
||||
deviceInfo.name = name.c_str();
|
||||
deviceInfo.driverVersion = driverVersion.c_str();
|
||||
|
||||
setupFp64Flags();
|
||||
|
||||
deviceInfo.vendor = vendor.c_str();
|
||||
deviceInfo.profile = profile.c_str();
|
||||
deviceInfo.ilVersion = "";
|
||||
@@ -131,10 +163,6 @@ void Device::initializeCaps() {
|
||||
deviceExtensions += "cl_khr_mipmap_image cl_khr_mipmap_image_writes ";
|
||||
}
|
||||
|
||||
if (hwInfo.capabilityTable.ftrSupportsFP64) {
|
||||
deviceExtensions += "cl_khr_fp64 ";
|
||||
}
|
||||
|
||||
if (DebugManager.flags.EnableNV12.get()) {
|
||||
deviceExtensions += "cl_intel_planar_yuv ";
|
||||
deviceInfo.nv12Extension = true;
|
||||
@@ -271,33 +299,10 @@ void Device::initializeCaps() {
|
||||
deviceInfo.maxWorkItemSizes[2] = deviceInfo.maxWorkGroupSize;
|
||||
deviceInfo.maxSamplers = 16;
|
||||
|
||||
deviceInfo.singleFpConfig = CL_FP_ROUND_TO_NEAREST |
|
||||
CL_FP_ROUND_TO_ZERO |
|
||||
CL_FP_ROUND_TO_INF |
|
||||
CL_FP_INF_NAN |
|
||||
CL_FP_FMA |
|
||||
CL_FP_DENORM;
|
||||
deviceInfo.singleFpConfig |= defaultFpFlags;
|
||||
|
||||
deviceInfo.singleFpConfig |= static_cast<cl_device_fp_config>(
|
||||
hwInfo.capabilityTable.ftrSupports64BitMath
|
||||
? CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT
|
||||
: 0);
|
||||
deviceInfo.halfFpConfig = defaultFpFlags;
|
||||
|
||||
deviceInfo.halfFpConfig = 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;
|
||||
|
||||
deviceInfo.doubleFpConfig = hwInfo.capabilityTable.ftrSupportsFP64
|
||||
? 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
|
||||
: 0;
|
||||
printDebugString(DebugManager.flags.PrintDebugMessages.get(), stderr, "hwInfo: {%d, %d}: (%d, %d, %d)\n",
|
||||
systemInfo.EUCount,
|
||||
systemInfo.ThreadCount,
|
||||
|
||||
@@ -85,6 +85,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, OverrideQuickKmdSleepDelayMicroseconds, -1, "-1:
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideEnableQuickKmdSleepForSporadicWaits, -1, "-1: dont override, 0: disable, 1: enable. It works only when QuickKmdSleep is enabled.")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideDelayQuickKmdSleepForSporadicWaitsMicroseconds, -1, "-1: dont override, >0: timeout in microseconds")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, CsrDispatchMode, 0, "Chooses DispatchMode for Csr")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideDefaultFP64Settings, -1, "-1: dont override, 0: disable, 1: enable.")
|
||||
/*DRIVER TOGGLES*/
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, ForceOCLVersion, 0, "Force specific OpenCL API version")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, ForcePreemptionMode, -1, "Keep this variable in sync with PreemptionMode enum. -1 - devices default mode, 1 - disable, 2 - midBatch, 3 - threadGroup, 4 - midThread")
|
||||
|
||||
@@ -583,6 +583,40 @@ TEST(Device_GetCaps, givenDeviceThatDoesntHaveFp64ThenExtensionIsNotReported) {
|
||||
EXPECT_EQ(0u, caps.doubleFpConfig);
|
||||
}
|
||||
|
||||
TEST(DeviceGetCaps, givenDeviceThatDoesntHaveFp64WhenDbgFlagEnablesFp64ThenReportFp64Flags) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.OverrideDefaultFP64Settings.set(1);
|
||||
HardwareInfo nonFp64Device = *platformDevices[0];
|
||||
nonFp64Device.capabilityTable.ftrSupportsFP64 = false;
|
||||
nonFp64Device.capabilityTable.ftrSupports64BitMath = false;
|
||||
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(&nonFp64Device));
|
||||
|
||||
const auto &caps = device->getDeviceInfo();
|
||||
std::string extensionString = caps.deviceExtensions;
|
||||
EXPECT_NE(std::string::npos, extensionString.find(std::string("cl_khr_fp64")));
|
||||
EXPECT_NE(0u, caps.doubleFpConfig);
|
||||
cl_device_fp_config actualSingleFp = caps.singleFpConfig & static_cast<cl_device_fp_config>(CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT);
|
||||
cl_device_fp_config expectedSingleFp = static_cast<cl_device_fp_config>(CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT);
|
||||
EXPECT_EQ(expectedSingleFp, actualSingleFp);
|
||||
}
|
||||
|
||||
TEST(DeviceGetCaps, givenDeviceThatDoesHaveFp64WhenDbgFlagDisablesFp64ThenDontReportFp64Flags) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.OverrideDefaultFP64Settings.set(0);
|
||||
HardwareInfo fp64Device = *platformDevices[0];
|
||||
fp64Device.capabilityTable.ftrSupportsFP64 = true;
|
||||
fp64Device.capabilityTable.ftrSupports64BitMath = true;
|
||||
auto device = std::unique_ptr<Device>(DeviceHelper<>::create(&fp64Device));
|
||||
|
||||
const auto &caps = device->getDeviceInfo();
|
||||
std::string extensionString = caps.deviceExtensions;
|
||||
EXPECT_EQ(std::string::npos, extensionString.find(std::string("cl_khr_fp64")));
|
||||
EXPECT_EQ(0u, caps.doubleFpConfig);
|
||||
cl_device_fp_config actualSingleFp = caps.singleFpConfig & static_cast<cl_device_fp_config>(CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT);
|
||||
cl_device_fp_config notExpectedSingleFp = static_cast<cl_device_fp_config>(CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT);
|
||||
EXPECT_NE(notExpectedSingleFp, actualSingleFp);
|
||||
}
|
||||
|
||||
TEST(Device_GetCaps, givenOclVersionLessThan21WhenCapsAreCreatedThenDeviceReportsNoSupportedIlVersions) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
{
|
||||
|
||||
@@ -39,6 +39,7 @@ EnableAsyncDestroyAllocations = 1
|
||||
EnableAsyncEventsHandler = 1
|
||||
EnableForcePin = false
|
||||
CsrDispatchMode = 0
|
||||
OverrideDefaultFP64Settings = -1
|
||||
OverrideEnableKmdNotify = -1
|
||||
OverrideKmdNotifyDelayMs = -1
|
||||
OverrideEnableQuickKmdSleep = -1
|
||||
|
||||
Reference in New Issue
Block a user