refactor: Add method for retrieving extra device info
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit is contained in:
parent
a22b9f454d
commit
cccd9a3703
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (C) 2020-2021 Intel Corporation
|
# Copyright (C) 2020-2024 Intel Corporation
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
#
|
#
|
||||||
|
@ -14,6 +14,7 @@ set(RUNTIME_SRCS_CL_DEVICE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_device_info.h
|
${CMAKE_CURRENT_SOURCE_DIR}/cl_device_info.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_device_info_map.h
|
${CMAKE_CURRENT_SOURCE_DIR}/cl_device_info_map.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_device_vector.h
|
${CMAKE_CURRENT_SOURCE_DIR}/cl_device_vector.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}cl_device_info_extra.cpp
|
||||||
)
|
)
|
||||||
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_CL_DEVICE})
|
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_CL_DEVICE})
|
||||||
set_property(GLOBAL PROPERTY RUNTIME_SRCS_CL_DEVICE ${RUNTIME_SRCS_CL_DEVICE})
|
set_property(GLOBAL PROPERTY RUNTIME_SRCS_CL_DEVICE ${RUNTIME_SRCS_CL_DEVICE})
|
||||||
|
|
|
@ -101,6 +101,11 @@ class ClDevice : public BaseObject<_cl_device_id> {
|
||||||
const void *&src,
|
const void *&src,
|
||||||
size_t &srcSize,
|
size_t &srcSize,
|
||||||
size_t &retSize);
|
size_t &retSize);
|
||||||
|
bool getDeviceInfoExtra(cl_device_info paramName,
|
||||||
|
ClDeviceInfoParam ¶m,
|
||||||
|
const void *&src,
|
||||||
|
size_t &srcSize,
|
||||||
|
size_t &retSize);
|
||||||
|
|
||||||
// This helper template is meant to simplify getDeviceInfo
|
// This helper template is meant to simplify getDeviceInfo
|
||||||
template <cl_device_info param>
|
template <cl_device_info param>
|
||||||
|
|
|
@ -357,10 +357,14 @@ cl_int ClDevice::getDeviceInfo(cl_device_info paramName,
|
||||||
retSize = srcSize = (getSharedDeviceInfo().threadsPerEUConfigs.size() * sizeof(uint32_t));
|
retSize = srcSize = (getSharedDeviceInfo().threadsPerEUConfigs.size() * sizeof(uint32_t));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (getDeviceInfoForImage(paramName, src, srcSize, retSize) && !getSharedDeviceInfo().imageSupport) {
|
if (getDeviceInfoForImage(paramName, src, srcSize, retSize)) {
|
||||||
src = &value;
|
if (false == getSharedDeviceInfo().imageSupport) {
|
||||||
|
src = &value;
|
||||||
|
}
|
||||||
|
} else if (getDeviceInfoExtra(paramName, param, src, srcSize, retSize)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto getInfoStatus = GetInfo::getInfo(paramValue, paramValueSize, src, srcSize);
|
auto getInfoStatus = GetInfo::getInfo(paramValue, paramValueSize, src, srcSize);
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2024 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "opencl/source/cl_device/cl_device.h"
|
||||||
|
#include "opencl/source/cl_device/cl_device_info.h"
|
||||||
|
|
||||||
|
namespace NEO {
|
||||||
|
bool ClDevice::getDeviceInfoExtra(cl_device_info paramName,
|
||||||
|
ClDeviceInfoParam ¶m,
|
||||||
|
const void *&src,
|
||||||
|
size_t &srcSize,
|
||||||
|
size_t &retSize) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}; // namespace NEO
|
|
@ -83,6 +83,7 @@ class ProductHelper {
|
||||||
virtual void getKernelFp16AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp16) const = 0;
|
virtual void getKernelFp16AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp16) const = 0;
|
||||||
virtual void getKernelFp32AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp32) const = 0;
|
virtual void getKernelFp32AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp32) const = 0;
|
||||||
virtual void getKernelFp64AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp64) const = 0;
|
virtual void getKernelFp64AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp64) const = 0;
|
||||||
|
virtual void getKernelCapabilitiesExtra(uint32_t &extraCaps) const = 0;
|
||||||
virtual void getKernelExtendedProperties(const HardwareInfo &hwInfo, uint32_t &fp16, uint32_t &fp32, uint32_t &fp64) const = 0;
|
virtual void getKernelExtendedProperties(const HardwareInfo &hwInfo, uint32_t &fp16, uint32_t &fp32, uint32_t &fp64) const = 0;
|
||||||
virtual std::vector<int32_t> getKernelSupportedThreadArbitrationPolicies() const = 0;
|
virtual std::vector<int32_t> getKernelSupportedThreadArbitrationPolicies() const = 0;
|
||||||
virtual uint32_t getDeviceMemoryMaxClkRate(const HardwareInfo &hwInfo, const OSInterface *osIface, uint32_t subDeviceIndex) const = 0;
|
virtual uint32_t getDeviceMemoryMaxClkRate(const HardwareInfo &hwInfo, const OSInterface *osIface, uint32_t subDeviceIndex) const = 0;
|
||||||
|
|
|
@ -52,6 +52,10 @@ void ProductHelperHw<gfxProduct>::getKernelFp64AtomicCapabilities(const Hardware
|
||||||
fp64 = (0u | FpAtomicExtFlags::minMaxAtomicCaps | FpAtomicExtFlags::loadStoreAtomicCaps | FpAtomicExtFlags::addAtomicCaps);
|
fp64 = (0u | FpAtomicExtFlags::minMaxAtomicCaps | FpAtomicExtFlags::loadStoreAtomicCaps | FpAtomicExtFlags::addAtomicCaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <PRODUCT_FAMILY gfxProduct>
|
||||||
|
void ProductHelperHw<gfxProduct>::getKernelCapabilitiesExtra(uint32_t &extraCaps) const {
|
||||||
|
}
|
||||||
|
|
||||||
template <PRODUCT_FAMILY gfxProduct>
|
template <PRODUCT_FAMILY gfxProduct>
|
||||||
void ProductHelperHw<gfxProduct>::getKernelExtendedProperties(const HardwareInfo &hwInfo, uint32_t &fp16, uint32_t &fp32, uint32_t &fp64) const {
|
void ProductHelperHw<gfxProduct>::getKernelExtendedProperties(const HardwareInfo &hwInfo, uint32_t &fp16, uint32_t &fp32, uint32_t &fp64) const {
|
||||||
getKernelFp16AtomicCapabilities(hwInfo, fp16);
|
getKernelFp16AtomicCapabilities(hwInfo, fp16);
|
||||||
|
|
|
@ -30,6 +30,7 @@ class ProductHelperHw : public ProductHelper {
|
||||||
void getKernelFp16AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp16) const override;
|
void getKernelFp16AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp16) const override;
|
||||||
void getKernelFp32AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp32) const override;
|
void getKernelFp32AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp32) const override;
|
||||||
void getKernelFp64AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp64) const override;
|
void getKernelFp64AtomicCapabilities(const HardwareInfo &hwInfo, uint32_t &fp64) const override;
|
||||||
|
void getKernelCapabilitiesExtra(uint32_t &extraCaps) const override;
|
||||||
void getKernelExtendedProperties(const HardwareInfo &hwInfo, uint32_t &fp16, uint32_t &fp32, uint32_t &fp64) const override;
|
void getKernelExtendedProperties(const HardwareInfo &hwInfo, uint32_t &fp16, uint32_t &fp32, uint32_t &fp64) const override;
|
||||||
std::vector<int32_t> getKernelSupportedThreadArbitrationPolicies() const override;
|
std::vector<int32_t> getKernelSupportedThreadArbitrationPolicies() const override;
|
||||||
uint32_t getDeviceMemoryMaxClkRate(const HardwareInfo &hwInfo, const OSInterface *osIface, uint32_t subDeviceIndex) const override;
|
uint32_t getDeviceMemoryMaxClkRate(const HardwareInfo &hwInfo, const OSInterface *osIface, uint32_t subDeviceIndex) const override;
|
||||||
|
|
|
@ -26,6 +26,7 @@ struct MockProductHelperHw : NEO::ProductHelperHw<productFamily> {
|
||||||
bool isUnlockingLockedPtrNecessary(const HardwareInfo &hwInfo) const override;
|
bool isUnlockingLockedPtrNecessary(const HardwareInfo &hwInfo) const override;
|
||||||
std::vector<uint32_t> getSupportedNumGrfs(const ReleaseHelper *releaseHelper) const override;
|
std::vector<uint32_t> getSupportedNumGrfs(const ReleaseHelper *releaseHelper) const override;
|
||||||
aub_stream::EngineType getDefaultCopyEngine() const override;
|
aub_stream::EngineType getDefaultCopyEngine() const override;
|
||||||
|
void getKernelCapabilitiesExtra(uint32_t &extraCaps) const override;
|
||||||
|
|
||||||
bool use128MbEdram = false;
|
bool use128MbEdram = false;
|
||||||
bool enableMidThreadPreemption = false;
|
bool enableMidThreadPreemption = false;
|
||||||
|
@ -37,6 +38,7 @@ struct MockProductHelperHw : NEO::ProductHelperHw<productFamily> {
|
||||||
uint32_t returnedStepping = 0;
|
uint32_t returnedStepping = 0;
|
||||||
uint32_t returnedL1CachePolicy = 0;
|
uint32_t returnedL1CachePolicy = 0;
|
||||||
uint32_t returnedL1CachePolicyIfDebugger = 0;
|
uint32_t returnedL1CachePolicyIfDebugger = 0;
|
||||||
|
uint32_t returnedExtraKernelCapabilities = 0;
|
||||||
std::vector<int32_t> threadArbPolicies = {};
|
std::vector<int32_t> threadArbPolicies = {};
|
||||||
aub_stream::EngineType mockDefaultCopyEngine = aub_stream::EngineType::ENGINE_BCS;
|
aub_stream::EngineType mockDefaultCopyEngine = aub_stream::EngineType::ENGINE_BCS;
|
||||||
};
|
};
|
||||||
|
|
|
@ -88,4 +88,9 @@ aub_stream::EngineType MockProductHelperHw<gfxProduct>::getDefaultCopyEngine() c
|
||||||
return this->mockDefaultCopyEngine;
|
return this->mockDefaultCopyEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void MockProductHelperHw<gfxProduct>::getKernelCapabilitiesExtra(uint32_t &extraCaps) const {
|
||||||
|
extraCaps = this->returnedExtraKernelCapabilities;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|
|
@ -879,4 +879,10 @@ HWTEST_F(ProductHelperTest, whenGettingPreferredAllocationMethodThenNoPreference
|
||||||
|
|
||||||
HWTEST_F(ProductHelperTest, whenAskingForLocalDispatchSizeThenReturnEmpty) {
|
HWTEST_F(ProductHelperTest, whenAskingForLocalDispatchSizeThenReturnEmpty) {
|
||||||
EXPECT_EQ(0u, productHelper->getSupportedLocalDispatchSizes().size());
|
EXPECT_EQ(0u, productHelper->getSupportedLocalDispatchSizes().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(ProductHelperTest, givenProductHelperWhenAskingForExtraKerneCapabilitiesThenReturnNone) {
|
||||||
|
uint32_t extraKernelCapabilities = 0u;
|
||||||
|
productHelper->getKernelCapabilitiesExtra(extraKernelCapabilities);
|
||||||
|
EXPECT_EQ(0u, extraKernelCapabilities);
|
||||||
}
|
}
|
Loading…
Reference in New Issue