mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-26 15:03:02 +08:00
Allow for overriding the reported FP64 support in L0
Change-Id: Ib876e00e198c07dbae7b921e1e7dc2b142aee049 Signed-off-by: Raiyan Latif <raiyan.latif@intel.com>
This commit is contained in:
@@ -42,6 +42,10 @@
|
||||
|
||||
#include "hw_helpers.h"
|
||||
|
||||
namespace NEO {
|
||||
bool releaseFP64Override();
|
||||
} // namespace NEO
|
||||
|
||||
namespace L0 {
|
||||
|
||||
uint32_t DeviceImp::getRootDeviceIndex() {
|
||||
@@ -286,10 +290,17 @@ ze_result_t DeviceImp::getKernelProperties(ze_device_kernel_properties_t *pKerne
|
||||
|
||||
pKernelProperties->fp16Supported = true;
|
||||
pKernelProperties->int64AtomicsSupported = hardwareInfo.capabilityTable.ftrSupportsInteger64BitAtomics;
|
||||
pKernelProperties->fp64Supported = hardwareInfo.capabilityTable.ftrSupportsFP64;
|
||||
pKernelProperties->halfFpCapabilities = defaultFpFlags;
|
||||
pKernelProperties->singleFpCapabilities = hardwareInfo.capabilityTable.ftrSupports64BitMath ? ZE_FP_CAPS_ROUNDED_DIVIDE_SQRT : ZE_FP_CAPS_NONE;
|
||||
pKernelProperties->doubleFpCapabilities = hardwareInfo.capabilityTable.ftrSupportsFP64 ? defaultFpFlags : ZE_FP_CAPS_NONE;
|
||||
|
||||
if (NEO::releaseFP64Override() || NEO::DebugManager.flags.OverrideDefaultFP64Settings.get() == 1) {
|
||||
pKernelProperties->fp64Supported = true;
|
||||
pKernelProperties->singleFpCapabilities = ZE_FP_CAPS_ROUNDED_DIVIDE_SQRT;
|
||||
pKernelProperties->doubleFpCapabilities = defaultFpFlags;
|
||||
} else {
|
||||
pKernelProperties->fp64Supported = hardwareInfo.capabilityTable.ftrSupportsFP64;
|
||||
pKernelProperties->singleFpCapabilities = hardwareInfo.capabilityTable.ftrSupports64BitMath ? ZE_FP_CAPS_ROUNDED_DIVIDE_SQRT : ZE_FP_CAPS_NONE;
|
||||
pKernelProperties->doubleFpCapabilities = hardwareInfo.capabilityTable.ftrSupportsFP64 ? defaultFpFlags : ZE_FP_CAPS_NONE;
|
||||
}
|
||||
|
||||
pKernelProperties->nativeKernelSupported.id[0] = 0;
|
||||
|
||||
|
||||
@@ -156,6 +156,45 @@ TEST_F(DeviceTest, givenDevicePropertiesStructureWhenDevicePropertiesCalledThenA
|
||||
EXPECT_NE(0, memcmp(&deviceProperties.name, &devicePropertiesBefore.name, sizeof(devicePropertiesBefore.name)));
|
||||
}
|
||||
|
||||
struct DeviceHasNoDoubleFp64Test : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
|
||||
HardwareInfo nonFp64Device = *defaultHwInfo;
|
||||
nonFp64Device.capabilityTable.ftrSupportsFP64 = false;
|
||||
nonFp64Device.capabilityTable.ftrSupports64BitMath = false;
|
||||
neoDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&nonFp64Device, 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];
|
||||
}
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
std::unique_ptr<Mock<L0::DriverHandleImp>> driverHandle;
|
||||
NEO::Device *neoDevice = nullptr;
|
||||
L0::Device *device = nullptr;
|
||||
const uint32_t rootDeviceIndex = 1u;
|
||||
const uint32_t numRootDevices = 2u;
|
||||
};
|
||||
|
||||
TEST_F(DeviceHasNoDoubleFp64Test, givenDeviceThatDoesntHaveFp64WhenDbgFlagEnablesFp64ThenReportFp64Flags) {
|
||||
ze_device_kernel_properties_t kernelProperties;
|
||||
memset(&kernelProperties, std::numeric_limits<int>::max(), sizeof(ze_device_kernel_properties_t));
|
||||
|
||||
device->getKernelProperties(&kernelProperties);
|
||||
EXPECT_EQ(ZE_FP_CAPS_NONE, kernelProperties.doubleFpCapabilities);
|
||||
EXPECT_EQ(ZE_FP_CAPS_NONE, kernelProperties.singleFpCapabilities);
|
||||
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.OverrideDefaultFP64Settings.set(1);
|
||||
|
||||
device->getKernelProperties(&kernelProperties);
|
||||
EXPECT_EQ(true, kernelProperties.fp64Supported);
|
||||
EXPECT_NE(ZE_FP_CAPS_NONE, kernelProperties.doubleFpCapabilities);
|
||||
EXPECT_EQ(ZE_FP_CAPS_ROUNDED_DIVIDE_SQRT, kernelProperties.singleFpCapabilities);
|
||||
}
|
||||
|
||||
struct MockMemoryManagerMultiDevice : public MemoryManagerMock {
|
||||
MockMemoryManagerMultiDevice(NEO::ExecutionEnvironment &executionEnvironment) : MemoryManagerMock(const_cast<NEO::ExecutionEnvironment &>(executionEnvironment)) {}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user