Enforce fp64 override key in linux release builds.

Related-To: NEO-4292

Change-Id: I3e4a6f94c6e2cf2edbbca350140f91a88f5302f7
Signed-off-by: Piotr Zdunowski <piotr.zdunowski@intel.com>
This commit is contained in:
Piotr Zdunowski 2020-02-17 13:54:48 +01:00 committed by sys_ocldev
parent ea172d2f24
commit 0b16d9cc26
8 changed files with 102 additions and 8 deletions

2
Jenkinsfile vendored
View File

@ -1,5 +1,5 @@
#!groovy
dependenciesRevision='b67325e72bcd5baa03886d87cac9afe6aea8cebd-1371'
strategy='EQUAL'
allowedCD=221
allowedCD=222
allowedF=11

View File

@ -68,6 +68,35 @@ Directly linking to the runtime library (igdrcl) is not supported.
The [Intel(R) GPU Compute Samples repository](https://github.com/intel/compute-samples/blob/master/compute_samples/applications/usm_hello_world/README.md)
has sample source code to demonstrate features of Intel(R) Graphics Compute Runtime for OpenCL(TM) Driver.
## Feature double-precision emulation (FP64)
By default NEO driver enables double precision operations only on platforms with supporting hardware. This is signified by exposing the "cl_khr_fp64" extension in the extension string. For other platforms, this support can be emulated by the compiler (IGC).
### How do I enable emulation?
FP64 emulation can only be enabled on Linux. There are two settings that have to be set.
#### Runtime setting:
There are two ways you can enable this feature in NEO:
* Set an environment variable **OverrideDefaultFP64Settings** to **1**:
`OverrideDefaultFP64Settings=1`
* In **igdrcl.config** configuration file in the same directory as application binary (you may have to create this file) add a line as such:
`OverrideDefaultFP64Settings = 1`
#### Compiler setting:
IGC reads flags only from environment, so set **IGC_EnableDPEmulation** to **1** as such:
`IGC_EnableDPEmulation=1`
After both settings have been set you can run the application normally.
### Known issues and limitations
Intel does not claim full specification conformance when using emulated mode. We reserve the right to not fix issues that appear only in emulation mode. Performance degradation is to be expected and has not been measured by Intel.
## How to provide feedback
By default, please submit an issue using native github.com interface: https://github.com/intel/compute-runtime/issues.

View File

@ -17,3 +17,5 @@ set(RUNTIME_SRCS_DEVICE
)
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_DEVICE})
set_property(GLOBAL PROPERTY RUNTIME_SRCS_DEVICE ${RUNTIME_SRCS_DEVICE})
add_subdirectories()

View File

@ -42,9 +42,16 @@ static constexpr cl_device_fp_config defaultFpFlags = static_cast<cl_device_fp_c
CL_FP_DENORM |
CL_FP_FMA);
bool releaseFP64Override();
void Device::setupFp64Flags() {
auto &hwInfo = getHardwareInfo();
if (DebugManager.flags.OverrideDefaultFP64Settings.get() == -1) {
if (releaseFP64Override() || 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;
} else if (DebugManager.flags.OverrideDefaultFP64Settings.get() == -1) {
if (hwInfo.capabilityTable.ftrSupportsFP64) {
deviceExtensions += "cl_khr_fp64 ";
}
@ -57,12 +64,6 @@ void Device::setupFp64Flags() {
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;
}
}
}

View File

@ -0,0 +1,15 @@
#
# Copyright (C) 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
set(RUNTIME_SRCS_DEVICE_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/fp64_override.cpp
)
if(UNIX)
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_DEVICE_LINUX})
endif()
set_property(GLOBAL PROPERTY RUNTIME_SRCS_DEVICE_LINUX ${RUNTIME_SRCS_DEVICE_LINUX})

View File

@ -0,0 +1,18 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "core/utilities/debug_settings_reader_creator.h"
#include "runtime/os_interface/ocl_reg_path.h"
namespace NEO {
bool releaseFP64Override() {
auto settingsReader = SettingsReaderCreator::create(oclRegPath);
return settingsReader->getSetting("OverrideDefaultFP64Settings", -1) == 1;
}
} // namespace NEO

View File

@ -0,0 +1,15 @@
#
# Copyright (C) 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
set(RUNTIME_SRCS_DEVICE_WINDOWS
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/fp64_override.cpp
)
if(WIN32)
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_DEVICE_WINDOWS})
endif()
set_property(GLOBAL PROPERTY RUNTIME_SRCS_DEVICE_WINDOWS ${RUNTIME_SRCS_DEVICE_WINDOWS})

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
namespace NEO {
bool releaseFP64Override() {
return false;
}
} // namespace NEO