From d46a9dd34794fe1301f22b4aac1483ea29aee9bc Mon Sep 17 00:00:00 2001 From: Compute-Runtime-Validation Date: Thu, 8 Dec 2022 16:11:41 +0100 Subject: [PATCH] Revert "Return 0 from fp64 queries when fp64 is unsupported" This reverts commit 92df163d8e63179b3d7ab9c5ba8e5da59b9a254d. Signed-off-by: Compute-Runtime-Validation --- opencl/source/cl_device/cl_device_caps.cpp | 15 ++++++--------- .../test/unit_test/device/device_caps_tests.cpp | 6 ++---- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/opencl/source/cl_device/cl_device_caps.cpp b/opencl/source/cl_device/cl_device_caps.cpp index ea9cc4f2e0..6e6e2e5c4e 100644 --- a/opencl/source/cl_device/cl_device_caps.cpp +++ b/opencl/source/cl_device/cl_device_caps.cpp @@ -46,24 +46,19 @@ void ClDevice::setupFp64Flags() { deviceExtensions += "cl_khr_fp64 "; deviceInfo.singleFpConfig = static_cast(CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT); deviceInfo.doubleFpConfig = defaultFpFlags; - deviceInfo.nativeVectorWidthDouble = 1; - deviceInfo.preferredVectorWidthDouble = 1; } else if (DebugManager.flags.OverrideDefaultFP64Settings.get() == -1) { if (hwInfo.capabilityTable.ftrSupportsFP64) { deviceExtensions += "cl_khr_fp64 "; - deviceInfo.doubleFpConfig = defaultFpFlags; - deviceInfo.nativeVectorWidthDouble = 1; - deviceInfo.preferredVectorWidthDouble = 1; - } else { - deviceInfo.doubleFpConfig = 0; - deviceInfo.nativeVectorWidthDouble = 0; - deviceInfo.preferredVectorWidthDouble = 0; } deviceInfo.singleFpConfig = static_cast( hwInfo.capabilityTable.ftrSupports64BitMath ? CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT : 0); + + deviceInfo.doubleFpConfig = hwInfo.capabilityTable.ftrSupportsFP64 + ? defaultFpFlags + : 0; } } @@ -272,12 +267,14 @@ void ClDevice::initializeCaps() { deviceInfo.preferredVectorWidthInt = 4; deviceInfo.preferredVectorWidthLong = 1; deviceInfo.preferredVectorWidthFloat = 1; + deviceInfo.preferredVectorWidthDouble = 1; deviceInfo.preferredVectorWidthHalf = 8; deviceInfo.nativeVectorWidthChar = 16; deviceInfo.nativeVectorWidthShort = 8; deviceInfo.nativeVectorWidthInt = 4; deviceInfo.nativeVectorWidthLong = 1; deviceInfo.nativeVectorWidthFloat = 1; + deviceInfo.nativeVectorWidthDouble = 1; deviceInfo.nativeVectorWidthHalf = 8; deviceInfo.maxReadWriteImageArgs = hwInfo.capabilityTable.supportsImages ? 128 : 0; deviceInfo.executionCapabilities = CL_EXEC_KERNEL; diff --git a/opencl/test/unit_test/device/device_caps_tests.cpp b/opencl/test/unit_test/device/device_caps_tests.cpp index 7b6ef16923..a490065340 100644 --- a/opencl/test/unit_test/device/device_caps_tests.cpp +++ b/opencl/test/unit_test/device/device_caps_tests.cpp @@ -146,12 +146,14 @@ TEST_F(DeviceGetCapsTest, WhenCreatingDeviceThenCapsArePopulatedCorrectly) { EXPECT_EQ(4u, caps.preferredVectorWidthInt); EXPECT_EQ(1u, caps.preferredVectorWidthLong); EXPECT_EQ(1u, caps.preferredVectorWidthFloat); + EXPECT_EQ(1u, caps.preferredVectorWidthDouble); EXPECT_EQ(8u, caps.preferredVectorWidthHalf); EXPECT_EQ(16u, caps.nativeVectorWidthChar); EXPECT_EQ(8u, caps.nativeVectorWidthShort); EXPECT_EQ(4u, caps.nativeVectorWidthInt); EXPECT_EQ(1u, caps.nativeVectorWidthLong); EXPECT_EQ(1u, caps.nativeVectorWidthFloat); + EXPECT_EQ(1u, caps.nativeVectorWidthDouble); EXPECT_EQ(8u, caps.nativeVectorWidthHalf); EXPECT_EQ(1u, caps.linkerAvailable); EXPECT_NE(0u, sharedCaps.globalMemCachelineSize); @@ -994,15 +996,11 @@ TEST_F(DeviceGetCapsTest, givenFp64SupportForcedWhenCheckingFp64SupportThenFp64I EXPECT_NE(std::string::npos, extensionString.find(std::string("cl_khr_fp64"))); EXPECT_NE(0u, caps.doubleFpConfig); EXPECT_EQ(1u, fp64FeaturesCount); - EXPECT_NE(0u, caps.nativeVectorWidthDouble); - EXPECT_NE(0u, caps.preferredVectorWidthDouble); EXPECT_TRUE(isValueSet(caps.singleFpConfig, CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT)); } else { EXPECT_EQ(std::string::npos, extensionString.find(std::string("cl_khr_fp64"))); EXPECT_EQ(0u, caps.doubleFpConfig); EXPECT_EQ(0u, fp64FeaturesCount); - EXPECT_EQ(0u, caps.nativeVectorWidthDouble); - EXPECT_EQ(0u, caps.preferredVectorWidthDouble); EXPECT_FALSE(isValueSet(caps.singleFpConfig, CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT)); } }