Implement cl_intel_device_attribute_query extension

Related-To: NEO-5759

Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
This commit is contained in:
Milczarek, Slawomir
2021-04-21 16:38:00 +00:00
committed by Compute-Runtime-Automation
parent 1b513b5ddb
commit c99b223aed
21 changed files with 325 additions and 15 deletions

View File

@ -192,3 +192,21 @@ typedef struct _cl_queue_family_properties_intel {
cl_uint count;
char name[CL_QUEUE_FAMILY_MAX_NAME_SIZE_INTEL];
} cl_queue_family_properties_intel;
/******************************
* DEVICE ATTRIBUTE QUERY *
*******************************/
/* For GPU devices, version 1.0.0: */
#define CL_DEVICE_IP_VERSION_INTEL 0x4250
#define CL_DEVICE_ID_INTEL 0x4251
#define CL_DEVICE_NUM_SLICES_INTEL 0x4252
#define CL_DEVICE_NUM_SUB_SLICES_PER_SLICE_INTEL 0x4253
#define CL_DEVICE_NUM_EUS_PER_SUB_SLICE_INTEL 0x4254
#define CL_DEVICE_NUM_THREADS_PER_EU_INTEL 0x4255
#define CL_DEVICE_FEATURE_CAPABILITIES_INTEL 0x4256
typedef cl_bitfield cl_device_feature_capabilities_intel;
/* For GPU devices, version 1.0.0: */
#define CL_DEVICE_FEATURE_FLAG_DP4A_INTEL (1 << 0)

View File

@ -10,6 +10,7 @@
#include "shared/source/device/device.h"
#include "shared/source/device/device_info.h"
#include "shared/source/helpers/get_info.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/os_interface/os_time.h"
#include "opencl/source/cl_device/cl_device.h"
@ -65,7 +66,7 @@ cl_int ClDevice::getDeviceInfo(cl_device_info paramName,
size_t srcSize = GetInfo::invalidSourceSize;
size_t retSize = 0;
size_t value = 0u;
cl_uint param;
ClDeviceInfoParam param{};
const void *src = nullptr;
// clang-format off
@ -176,8 +177,8 @@ cl_int ClDevice::getDeviceInfo(cl_device_info paramName,
case CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES:
if (paramValueSize == sizeof(cl_bool)) {
srcSize = retSize = sizeof(cl_bool);
param = (deviceInfo.deviceEnqueueSupport > 0u) ? CL_TRUE : CL_FALSE;
src = &param;
param.boolean = (deviceInfo.deviceEnqueueSupport > 0u) ? CL_TRUE : CL_FALSE;
src = &param.boolean;
} else {
getCap<CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES>(src, srcSize, retSize);
}
@ -185,8 +186,8 @@ cl_int ClDevice::getDeviceInfo(cl_device_info paramName,
case CL_DEVICE_NUM_SIMULTANEOUS_INTEROPS_INTEL:
if (simultaneousInterops.size() > 1u) {
srcSize = retSize = sizeof(cl_uint);
param = 1u;
src = &param;
param.uint = 1u;
src = &param.uint;
}
break;
case CL_DEVICE_SIMULTANEOUS_INTEROPS_INTEL:
@ -202,9 +203,9 @@ cl_int ClDevice::getDeviceInfo(cl_device_info paramName,
case CL_DEVICE_REFERENCE_COUNT: {
cl_int ref = this->getReference();
DEBUG_BREAK_IF(ref != 1 && !deviceInfo.parentDevice);
param = static_cast<cl_uint>(ref);
src = &param;
retSize = srcSize = sizeof(param);
param.uint = static_cast<cl_uint>(ref);
src = &param.uint;
retSize = srcSize = sizeof(param.uint);
break;
}
case CL_DEVICE_PARTITION_PROPERTIES:
@ -242,6 +243,49 @@ cl_int ClDevice::getDeviceInfo(cl_device_info paramName,
src = deviceInfo.supportedThreadArbitrationPolicies.data();
retSize = srcSize = deviceInfo.supportedThreadArbitrationPolicies.size() * sizeof(cl_uint);
break;
case CL_DEVICE_IP_VERSION_INTEL: {
auto &clHwHelper = ClHwHelper::get(getHardwareInfo().platform.eRenderCoreFamily);
param.uint = clHwHelper.getDeviceIpVersion(getHardwareInfo());
src = &param.uint;
retSize = srcSize = sizeof(cl_version);
break;
}
case CL_DEVICE_ID_INTEL:
param.uint = getHardwareInfo().platform.usDeviceID;
src = &param.uint;
retSize = srcSize = sizeof(cl_uint);
break;
case CL_DEVICE_NUM_SLICES_INTEL:
param.uint = static_cast<cl_uint>(getHardwareInfo().gtSystemInfo.SliceCount * ((subDevices.size() > 0) ? subDevices.size() : 1));
src = &param.uint;
retSize = srcSize = sizeof(cl_uint);
break;
case CL_DEVICE_NUM_SUB_SLICES_PER_SLICE_INTEL: {
const auto &gtSysInfo = getHardwareInfo().gtSystemInfo;
param.uint = gtSysInfo.SubSliceCount / gtSysInfo.SliceCount;
src = &param.uint;
retSize = srcSize = sizeof(cl_uint);
break;
}
case CL_DEVICE_NUM_EUS_PER_SUB_SLICE_INTEL:
param.uint = getHardwareInfo().gtSystemInfo.MaxEuPerSubSlice;
src = &param.uint;
retSize = srcSize = sizeof(cl_uint);
break;
case CL_DEVICE_NUM_THREADS_PER_EU_INTEL: {
const auto &gtSysInfo = getHardwareInfo().gtSystemInfo;
param.uint = gtSysInfo.ThreadCount / gtSysInfo.EUCount;
src = &param.uint;
retSize = srcSize = sizeof(cl_uint);
break;
}
case CL_DEVICE_FEATURE_CAPABILITIES_INTEL: {
auto &clHwHelper = ClHwHelper::get(getHardwareInfo().platform.eRenderCoreFamily);
param.bitfield = clHwHelper.getSupportedDeviceFeatureCapabilities();
src = &param.bitfield;
retSize = srcSize = sizeof(cl_device_feature_capabilities_intel);
break;
}
default:
if (getDeviceInfoForImage(paramName, src, srcSize, retSize) && !getSharedDeviceInfo().imageSupport) {
src = &value;

View File

@ -19,6 +19,14 @@ namespace NEO {
using OpenClCFeaturesContainer = StackVec<cl_name_version, 15>;
struct ClDeviceInfoParam {
union {
cl_bool boolean;
cl_uint uint;
cl_bitfield bitfield;
};
};
// clang-format off
struct ClDeviceInfo {
cl_name_version ilsWithVersion[1];

View File

@ -23,6 +23,11 @@ void populateFactoryTable<ClHwHelperHw<Family>>() {
clHwHelperFactory[gfxCore] = &ClHwHelperHw<Family>::get();
}
template <>
cl_version ClHwHelperHw<Family>::getDeviceIpVersion(const HardwareInfo &hwInfo) const {
return makeDeviceIpVersion(11, 0, 0);
}
template class ClHwHelperHw<Family>;
} // namespace NEO

View File

@ -23,6 +23,16 @@ void populateFactoryTable<ClHwHelperHw<Family>>() {
clHwHelperFactory[gfxCore] = &ClHwHelperHw<Family>::get();
}
template <>
cl_device_feature_capabilities_intel ClHwHelperHw<Family>::getSupportedDeviceFeatureCapabilities() const {
return CL_DEVICE_FEATURE_FLAG_DP4A_INTEL;
}
template <>
cl_version ClHwHelperHw<Family>::getDeviceIpVersion(const HardwareInfo &hwInfo) const {
return makeDeviceIpVersion(12, 0, makeDeviceRevision(hwInfo));
}
template class ClHwHelperHw<Family>;
} // namespace NEO

View File

@ -23,6 +23,11 @@ void populateFactoryTable<ClHwHelperHw<Family>>() {
clHwHelperFactory[gfxCore] = &ClHwHelperHw<Family>::get();
}
template <>
cl_version ClHwHelperHw<Family>::getDeviceIpVersion(const HardwareInfo &hwInfo) const {
return makeDeviceIpVersion(8, 0, 0);
}
template class ClHwHelperHw<Family>;
} // namespace NEO

View File

@ -23,6 +23,11 @@ void populateFactoryTable<ClHwHelperHw<Family>>() {
clHwHelperFactory[gfxCore] = &ClHwHelperHw<Family>::get();
}
template <>
cl_version ClHwHelperHw<Family>::getDeviceIpVersion(const HardwareInfo &hwInfo) const {
return makeDeviceIpVersion(9, 0, 0);
}
template class ClHwHelperHw<Family>;
} // namespace NEO

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2020 Intel Corporation
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -8,5 +8,5 @@
#include "opencl/source/helpers/cl_device_helpers.h"
namespace NEO {
void ClDeviceHelper::getExtraDeviceInfo(const ClDevice &clDevice, cl_device_info paramName, cl_uint &param, const void *&src, size_t &size, size_t &retSize) {}
void ClDeviceHelper::getExtraDeviceInfo(const ClDevice &clDevice, cl_device_info paramName, ClDeviceInfoParam &param, const void *&src, size_t &size, size_t &retSize) {}
} // namespace NEO

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2020 Intel Corporation
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -11,8 +11,9 @@
#include <cstdint>
namespace NEO {
class ClDevice;
struct ClDeviceInfoParam;
namespace ClDeviceHelper {
void getExtraDeviceInfo(const ClDevice &clDevice, cl_device_info paramName, cl_uint &param, const void *&src, size_t &size, size_t &retSize);
void getExtraDeviceInfo(const ClDevice &clDevice, cl_device_info paramName, ClDeviceInfoParam &param, const void *&src, size_t &size, size_t &retSize);
}; // namespace ClDeviceHelper
} // namespace NEO

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -7,6 +7,8 @@
#include "opencl/source/helpers/cl_hw_helper.h"
#include "shared/source/helpers/hw_info.h"
namespace NEO {
ClHwHelper *clHwHelperFactory[IGFX_MAX_CORE] = {};
@ -15,4 +17,12 @@ ClHwHelper &ClHwHelper::get(GFXCORE_FAMILY gfxCore) {
return *clHwHelperFactory[gfxCore];
}
uint8_t ClHwHelper::makeDeviceRevision(const HardwareInfo &hwInfo) {
return static_cast<uint8_t>(!hwInfo.capabilityTable.isIntegratedDevice);
}
cl_version ClHwHelper::makeDeviceIpVersion(uint16_t major, uint8_t minor, uint8_t revision) {
return (major << 16) | (minor << 8) | revision;
}
} // namespace NEO

View File

@ -19,6 +19,7 @@ namespace NEO {
class Context;
class ClDevice;
struct HardwareInfo;
struct KernelInfo;
struct MultiDispatchInfo;
@ -34,10 +35,15 @@ class ClHwHelper {
virtual bool preferBlitterForLocalToLocalTransfers() const = 0;
virtual bool isSupportedKernelThreadArbitrationPolicy() const = 0;
virtual std::vector<uint32_t> getSupportedThreadArbitrationPolicies() const = 0;
virtual cl_version getDeviceIpVersion(const HardwareInfo &hwInfo) const = 0;
virtual cl_device_feature_capabilities_intel getSupportedDeviceFeatureCapabilities() const = 0;
protected:
virtual bool hasStatelessAccessToBuffer(const KernelInfo &kernelInfo) const = 0;
static uint8_t makeDeviceRevision(const HardwareInfo &hwInfo);
static cl_version makeDeviceIpVersion(uint16_t major, uint8_t minor, uint8_t revision);
ClHwHelper() = default;
};
@ -57,6 +63,8 @@ class ClHwHelperHw : public ClHwHelper {
bool preferBlitterForLocalToLocalTransfers() const override;
bool isSupportedKernelThreadArbitrationPolicy() const override;
std::vector<uint32_t> getSupportedThreadArbitrationPolicies() const override;
cl_version getDeviceIpVersion(const HardwareInfo &hwInfo) const override;
cl_device_feature_capabilities_intel getSupportedDeviceFeatureCapabilities() const override;
protected:
bool hasStatelessAccessToBuffer(const KernelInfo &kernelInfo) const override;

View File

@ -22,4 +22,9 @@ cl_ulong ClHwHelperHw<GfxFamily>::getKernelPrivateMemSize(const KernelInfo &kern
return kernelInfo.kernelDescriptor.kernelAttributes.perHwThreadPrivateMemorySize;
}
template <typename GfxFamily>
cl_device_feature_capabilities_intel ClHwHelperHw<GfxFamily>::getSupportedDeviceFeatureCapabilities() const {
return 0;
}
} // namespace NEO

View File

@ -41,7 +41,8 @@ const char *deviceExtensionsList = "cl_khr_byte_addressable_store "
"cl_khr_subgroup_non_uniform_arithmetic "
"cl_khr_subgroup_shuffle "
"cl_khr_subgroup_shuffle_relative "
"cl_khr_subgroup_clustered_reduce ";
"cl_khr_subgroup_clustered_reduce "
"cl_intel_device_attribute_query ";
std::string getExtensionsList(const HardwareInfo &hwInfo) {
std::string allExtensionsList;

View File

@ -243,7 +243,8 @@ TEST_F(clGetDeviceInfoTests, GivenClDeviceExtensionsParamWhenGettingDeviceInfoTh
"cl_khr_subgroup_non_uniform_arithmetic ",
"cl_khr_subgroup_shuffle ",
"cl_khr_subgroup_shuffle_relative ",
"cl_khr_subgroup_clustered_reduce "};
"cl_khr_subgroup_clustered_reduce "
"cl_intel_device_attribute_query "};
for (auto extension : supportedExtensions) {
auto foundOffset = extensionString.find(extension);

View File

@ -9,6 +9,7 @@
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "opencl/source/cl_device/cl_device_info_map.h"
#include "opencl/source/helpers/cl_hw_helper.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include "opencl/test/unit_test/fixtures/device_info_fixture.h"
#include "opencl/test/unit_test/helpers/raii_hw_helper.h"
@ -992,3 +993,124 @@ TEST(GetDeviceInfoTest, givenDeviceWithSubDevicesWhenGettingNumberOfComputeUnits
EXPECT_EQ(expectedComputeUnitsForRootDevice, numComputeUnits);
EXPECT_EQ(sizeof(numComputeUnits), retSize);
}
struct DeviceAttributeQueryTest : public ::testing::TestWithParam<uint32_t /*cl_device_info*/> {
void SetUp() override {
param = GetParam();
}
void verifyDeviceAttribute(ClDevice &device) {
size_t sizeReturned = GetInfo::invalidSourceSize;
auto retVal = device.getDeviceInfo(
param,
0,
nullptr,
&sizeReturned);
if (CL_SUCCESS != retVal) {
ASSERT_EQ(CL_SUCCESS, retVal) << " param = " << param;
}
ASSERT_NE(GetInfo::invalidSourceSize, sizeReturned);
auto object = std::make_unique<char[]>(sizeReturned);
retVal = device.getDeviceInfo(
param,
sizeReturned,
object.get(),
nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
switch (param) {
case CL_DEVICE_IP_VERSION_INTEL: {
auto pDeviceIpVersion = reinterpret_cast<cl_version *>(object.get());
auto &hwInfo = device.getHardwareInfo();
auto &clHwHelper = NEO::ClHwHelper::get(hwInfo.platform.eRenderCoreFamily);
EXPECT_EQ(clHwHelper.getDeviceIpVersion(hwInfo), *pDeviceIpVersion);
EXPECT_EQ(sizeof(cl_version), sizeReturned);
break;
}
case CL_DEVICE_ID_INTEL: {
auto pDeviceId = reinterpret_cast<cl_uint *>(object.get());
EXPECT_EQ(device.getHardwareInfo().platform.usDeviceID, *pDeviceId);
EXPECT_EQ(sizeof(cl_uint), sizeReturned);
break;
}
case CL_DEVICE_NUM_SLICES_INTEL: {
auto pNumSlices = reinterpret_cast<cl_uint *>(object.get());
const auto &gtSysInfo = device.getHardwareInfo().gtSystemInfo;
EXPECT_EQ(gtSysInfo.SliceCount * device.getNumAvailableDevices(), *pNumSlices);
EXPECT_EQ(sizeof(cl_uint), sizeReturned);
break;
}
case CL_DEVICE_NUM_SUB_SLICES_PER_SLICE_INTEL: {
auto pNumSubslicesPerSlice = reinterpret_cast<cl_uint *>(object.get());
const auto &gtSysInfo = device.getHardwareInfo().gtSystemInfo;
EXPECT_EQ(gtSysInfo.SubSliceCount / gtSysInfo.SliceCount, *pNumSubslicesPerSlice);
EXPECT_EQ(sizeof(cl_uint), sizeReturned);
break;
}
case CL_DEVICE_NUM_EUS_PER_SUB_SLICE_INTEL: {
auto pNumEusPerSubslice = reinterpret_cast<cl_uint *>(object.get());
const auto &gtSysInfo = device.getHardwareInfo().gtSystemInfo;
EXPECT_EQ(gtSysInfo.MaxEuPerSubSlice, *pNumEusPerSubslice);
EXPECT_EQ(sizeof(cl_uint), sizeReturned);
break;
}
case CL_DEVICE_NUM_THREADS_PER_EU_INTEL: {
auto pNumThreadsPerEu = reinterpret_cast<cl_uint *>(object.get());
const auto &gtSysInfo = device.getHardwareInfo().gtSystemInfo;
EXPECT_EQ(gtSysInfo.ThreadCount / gtSysInfo.EUCount, *pNumThreadsPerEu);
EXPECT_EQ(sizeof(cl_uint), sizeReturned);
break;
}
case CL_DEVICE_FEATURE_CAPABILITIES_INTEL: {
auto pCapabilities = reinterpret_cast<cl_device_feature_capabilities_intel *>(object.get());
auto &hwInfo = device.getHardwareInfo();
auto &clHwHelper = ClHwHelper::get(hwInfo.platform.eRenderCoreFamily);
EXPECT_EQ(clHwHelper.getSupportedDeviceFeatureCapabilities(), *pCapabilities);
EXPECT_EQ(sizeof(cl_device_feature_capabilities_intel), sizeReturned);
break;
}
default:
EXPECT_TRUE(false);
break;
}
}
cl_device_info param;
};
TEST_P(DeviceAttributeQueryTest, givenGetDeviceInfoWhenDeviceAttributeIsQueriedOnClDeviceThenReturnCorrectAttributeValue) {
auto pClDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
ASSERT_EQ(0u, pClDevice->subDevices.size());
verifyDeviceAttribute(*pClDevice);
}
TEST_P(DeviceAttributeQueryTest, givenGetDeviceInfoWhenDeviceAttributeIsQueriedOnRootDeviceAndSubDevicesThenReturnCorrectAttributeValues) {
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(2);
VariableBackup<bool> mockDeviceFlagBackup(&MockDevice::createSingleDevice, false);
auto pRootClDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
ASSERT_EQ(2u, pRootClDevice->subDevices.size());
verifyDeviceAttribute(*pRootClDevice);
for (const auto &pClSubDevice : pRootClDevice->subDevices) {
verifyDeviceAttribute(*pClSubDevice);
}
}
cl_device_info deviceAttributeQueryParams[] = {
CL_DEVICE_IP_VERSION_INTEL,
CL_DEVICE_ID_INTEL,
CL_DEVICE_NUM_SLICES_INTEL,
CL_DEVICE_NUM_SUB_SLICES_PER_SLICE_INTEL,
CL_DEVICE_NUM_EUS_PER_SUB_SLICE_INTEL,
CL_DEVICE_NUM_THREADS_PER_EU_INTEL,
CL_DEVICE_FEATURE_CAPABILITIES_INTEL};
INSTANTIATE_TEST_CASE_P(
Device_,
DeviceAttributeQueryTest,
testing::ValuesIn(deviceAttributeQueryParams));

View File

@ -7,8 +7,10 @@
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "opencl/source/helpers/cl_hw_helper.h"
#include "opencl/test/unit_test/helpers/get_gpgpu_engines_tests.inl"
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
#include "opencl/test/unit_test/mocks/mock_cl_hw_helper.h"
using HwHelperTestGen11 = HwHelperTest;
@ -49,6 +51,14 @@ GEN11TEST_F(HwHelperTestGen11, whenGetGpgpuEnginesThenReturnThreeRcsEngines) {
EXPECT_EQ(3u, pDevice->engines.size());
}
GEN11TEST_F(HwHelperTestGen11, WhenGettingDeviceIpVersionThenMakeCorrectDeviceIpVersion) {
EXPECT_EQ(ClHwHelperMock::makeDeviceIpVersion(11, 0, 0), ClHwHelper::get(renderCoreFamily).getDeviceIpVersion(*defaultHwInfo));
}
GEN11TEST_F(HwHelperTestGen11, WhenGettingSupportedDeviceFeatureCapabilitiesThenReturnCorrectValue) {
EXPECT_EQ(0u, ClHwHelper::get(renderCoreFamily).getSupportedDeviceFeatureCapabilities());
}
using MemorySynchronizatiopCommandsTestsGen11 = ::testing::Test;
GEN11TEST_F(MemorySynchronizatiopCommandsTestsGen11, WhenProgrammingCacheFlushThenExpectConstantCacheFieldSet) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;

View File

@ -8,6 +8,7 @@
#include "shared/source/utilities/compiler_support.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "opencl/source/helpers/cl_hw_helper.h"
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
using HwHelperTestDg1 = HwHelperTest;

View File

@ -11,6 +11,7 @@
#include "opencl/source/helpers/cl_hw_helper.h"
#include "opencl/test/unit_test/gen12lp/special_ult_helper_gen12lp.h"
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
#include "opencl/test/unit_test/mocks/mock_cl_hw_helper.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
#include "opencl/test/unit_test/mocks/mock_platform.h"
@ -478,3 +479,20 @@ HWTEST2_F(HwHelperTestGen12Lp, givenRevisionEnumThenProperValueForIsWorkaroundRe
}
}
}
HWTEST2_F(HwHelperTestGen12Lp, WhenGettingDeviceIpVersionThenMakeCorrectDeviceIpVersion, IsTGLLP) {
EXPECT_EQ(ClHwHelperMock::makeDeviceIpVersion(12, 0, 0), ClHwHelper::get(renderCoreFamily).getDeviceIpVersion(*defaultHwInfo));
}
HWTEST2_F(HwHelperTestGen12Lp, WhenGettingDeviceIpVersionThenMakeCorrectDeviceIpVersion, IsRKL) {
EXPECT_EQ(ClHwHelperMock::makeDeviceIpVersion(12, 0, 0), ClHwHelper::get(renderCoreFamily).getDeviceIpVersion(*defaultHwInfo));
}
HWTEST2_F(HwHelperTestGen12Lp, WhenGettingDeviceIpVersionThenMakeCorrectDeviceIpVersion, IsADLS) {
EXPECT_EQ(ClHwHelperMock::makeDeviceIpVersion(12, 0, 0), ClHwHelper::get(renderCoreFamily).getDeviceIpVersion(*defaultHwInfo));
}
GEN12LPTEST_F(HwHelperTestGen12Lp, WhenGettingSupportedDeviceFeatureCapabilitiesThenReturnCorrectValue) {
cl_device_feature_capabilities_intel expectedCapabilities = CL_DEVICE_FEATURE_FLAG_DP4A_INTEL;
EXPECT_EQ(expectedCapabilities, ClHwHelper::get(renderCoreFamily).getSupportedDeviceFeatureCapabilities());
}

View File

@ -8,9 +8,11 @@
#include "shared/source/helpers/constants.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "opencl/source/helpers/cl_hw_helper.h"
#include "opencl/source/helpers/hardware_commands_helper.h"
#include "opencl/test/unit_test/helpers/get_gpgpu_engines_tests.inl"
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
#include "opencl/test/unit_test/mocks/mock_cl_hw_helper.h"
using HwHelperTestGen8 = HwHelperTest;
@ -56,6 +58,14 @@ GEN8TEST_F(HwHelperTestGen8, whenGetGpgpuEnginesThenReturnThreeEngines) {
EXPECT_EQ(3u, pDevice->engines.size());
}
GEN8TEST_F(HwHelperTestGen8, WhenGettingDeviceIpVersionThenMakeCorrectDeviceIpVersion) {
EXPECT_EQ(ClHwHelperMock::makeDeviceIpVersion(8, 0, 0), ClHwHelper::get(renderCoreFamily).getDeviceIpVersion(*defaultHwInfo));
}
GEN8TEST_F(HwHelperTestGen8, WhenGettingSupportedDeviceFeatureCapabilitiesThenReturnCorrectValue) {
EXPECT_EQ(0u, ClHwHelper::get(renderCoreFamily).getSupportedDeviceFeatureCapabilities());
}
using MemorySynchronizatiopCommandsTestsGen8 = ::testing::Test;
GEN8TEST_F(MemorySynchronizatiopCommandsTestsGen8, WhenProgrammingCacheFlushThenExpectConstantCacheFieldSet) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;

View File

@ -7,8 +7,10 @@
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "opencl/source/helpers/cl_hw_helper.h"
#include "opencl/test/unit_test/helpers/get_gpgpu_engines_tests.inl"
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
#include "opencl/test/unit_test/mocks/mock_cl_hw_helper.h"
using HwHelperTestGen9 = HwHelperTest;
@ -61,6 +63,14 @@ GEN9TEST_F(HwHelperTestGen9, whenGetGpgpuEnginesThenReturnThreeRcsEngines) {
EXPECT_EQ(3u, pDevice->engines.size());
}
GEN9TEST_F(HwHelperTestGen9, WhenGettingDeviceIpVersionThenMakeCorrectDeviceIpVersion) {
EXPECT_EQ(ClHwHelperMock::makeDeviceIpVersion(9, 0, 0), ClHwHelper::get(renderCoreFamily).getDeviceIpVersion(*defaultHwInfo));
}
GEN9TEST_F(HwHelperTestGen9, WhenGettingSupportedDeviceFeatureCapabilitiesThenReturnCorrectValue) {
EXPECT_EQ(0u, ClHwHelper::get(renderCoreFamily).getSupportedDeviceFeatureCapabilities());
}
using MemorySynchronizatiopCommandsTestsGen9 = ::testing::Test;
GEN9TEST_F(MemorySynchronizatiopCommandsTestsGen9, WhenProgrammingCacheFlushThenExpectConstantCacheFieldSet) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;

View File

@ -0,0 +1,18 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "opencl/source/helpers/cl_hw_helper.h"
namespace NEO {
struct ClHwHelperMock : public ClHwHelper {
using ClHwHelper::makeDeviceIpVersion;
using ClHwHelper::makeDeviceRevision;
};
} // namespace NEO