mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 06:24:51 +08:00
refactor: Create function to check if OCL2.1 caps are enabled or enforced
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
7b12735ade
commit
ab1ffea592
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
* Copyright (C) 2020-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "shared/source/helpers/compiler_product_helper.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/helpers/hw_info_helper.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/source/os_interface/driver_info.h"
|
||||
|
||||
@@ -114,13 +115,9 @@ void ClDevice::initializeCaps() {
|
||||
deviceInfo.vendor = vendor.c_str();
|
||||
deviceInfo.profile = profile.c_str();
|
||||
enabledClVersion = hwInfo.capabilityTable.clVersionSupport;
|
||||
ocl21FeaturesEnabled = hwInfo.capabilityTable.supportsOcl21Features;
|
||||
ocl21FeaturesEnabled = HwInfoHelper::checkIfOcl21FeaturesEnabledOrEnforced(hwInfo);
|
||||
if (debugManager.flags.ForceOCLVersion.get() != 0) {
|
||||
enabledClVersion = debugManager.flags.ForceOCLVersion.get();
|
||||
ocl21FeaturesEnabled = (enabledClVersion == 21);
|
||||
}
|
||||
if (debugManager.flags.ForceOCL21FeaturesSupport.get() != -1) {
|
||||
ocl21FeaturesEnabled = debugManager.flags.ForceOCL21FeaturesSupport.get();
|
||||
}
|
||||
switch (enabledClVersion) {
|
||||
case 30:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2020-2023 Intel Corporation
|
||||
# Copyright (C) 2020-2024 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -62,6 +62,8 @@ set(CLOC_LIB_SRCS_LIB
|
||||
${NEO_SHARED_DIRECTORY}/helpers/debug_helpers.cpp
|
||||
${NEO_SHARED_DIRECTORY}/helpers/hw_info.cpp
|
||||
${NEO_SHARED_DIRECTORY}/helpers/hw_info.h
|
||||
${NEO_SHARED_DIRECTORY}/helpers/hw_info_helper.cpp
|
||||
${NEO_SHARED_DIRECTORY}/helpers/hw_info_helper.h
|
||||
${NEO_SHARED_DIRECTORY}/helpers/product_config_helper.cpp
|
||||
${NEO_SHARED_DIRECTORY}/helpers/product_config_helper.h
|
||||
${NEO_SHARED_DIRECTORY}/helpers${BRANCH_DIR_SUFFIX}product_config_helper_extra.cpp
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
* Copyright (C) 2020-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/helpers/hw_info_helper.h"
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/source/os_interface/product_helper.h"
|
||||
@@ -45,13 +46,7 @@ void Device::initializeCaps() {
|
||||
auto &gfxCoreHelper = this->getRootDeviceEnvironment().getHelper<NEO::GfxCoreHelper>();
|
||||
auto releaseHelper = this->getRootDeviceEnvironment().getReleaseHelper();
|
||||
|
||||
bool ocl21FeaturesEnabled = hwInfo.capabilityTable.supportsOcl21Features;
|
||||
if (debugManager.flags.ForceOCLVersion.get() != 0) {
|
||||
ocl21FeaturesEnabled = (debugManager.flags.ForceOCLVersion.get() == 21);
|
||||
}
|
||||
if (debugManager.flags.ForceOCL21FeaturesSupport.get() != -1) {
|
||||
ocl21FeaturesEnabled = debugManager.flags.ForceOCL21FeaturesSupport.get();
|
||||
}
|
||||
bool ocl21FeaturesEnabled = HwInfoHelper::checkIfOcl21FeaturesEnabledOrEnforced(hwInfo);
|
||||
if (ocl21FeaturesEnabled) {
|
||||
addressing32bitAllowed = false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2019-2023 Intel Corporation
|
||||
# Copyright (C) 2019-2024 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -96,6 +96,8 @@ set(NEO_CORE_HELPERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gfx_core_helper_tgllp_and_later.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_helper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_ip_version.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_mapper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_walk_order.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
* Copyright (C) 2021-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/helpers/compiler_product_helper.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/helpers/hw_info_helper.h"
|
||||
#include "shared/source/release_helper/release_helper.h"
|
||||
|
||||
namespace NEO {
|
||||
@@ -93,14 +94,11 @@ std::string CompilerProductHelperHw<gfxProduct>::getDeviceExtensions(const Hardw
|
||||
}
|
||||
|
||||
auto enabledClVersion = hwInfo.capabilityTable.clVersionSupport;
|
||||
auto ocl21FeaturesEnabled = hwInfo.capabilityTable.supportsOcl21Features;
|
||||
if (debugManager.flags.ForceOCLVersion.get() != 0) {
|
||||
enabledClVersion = debugManager.flags.ForceOCLVersion.get();
|
||||
ocl21FeaturesEnabled = (enabledClVersion == 21);
|
||||
}
|
||||
if (debugManager.flags.ForceOCL21FeaturesSupport.get() != -1) {
|
||||
ocl21FeaturesEnabled = debugManager.flags.ForceOCL21FeaturesSupport.get();
|
||||
}
|
||||
auto ocl21FeaturesEnabled = HwInfoHelper::checkIfOcl21FeaturesEnabledOrEnforced(hwInfo);
|
||||
|
||||
if (ocl21FeaturesEnabled) {
|
||||
|
||||
if (hwInfo.capabilityTable.supportsMediaBlock) {
|
||||
|
||||
26
shared/source/helpers/hw_info_helper.cpp
Normal file
26
shared/source/helpers/hw_info_helper.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/hw_info_helper.h"
|
||||
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
bool HwInfoHelper::checkIfOcl21FeaturesEnabledOrEnforced(const HardwareInfo &hwInfo) {
|
||||
|
||||
bool enabledOrEnforced = hwInfo.capabilityTable.supportsOcl21Features;
|
||||
if (const auto enforcedOclVersion = debugManager.flags.ForceOCLVersion.get(); enforcedOclVersion != 0) {
|
||||
enabledOrEnforced = (enforcedOclVersion == 21);
|
||||
}
|
||||
if (const auto enforcedOcl21Support = debugManager.flags.ForceOCL21FeaturesSupport.get(); enforcedOcl21Support != -1) {
|
||||
enabledOrEnforced = enforcedOcl21Support;
|
||||
}
|
||||
return enabledOrEnforced;
|
||||
}
|
||||
} // namespace NEO
|
||||
14
shared/source/helpers/hw_info_helper.h
Normal file
14
shared/source/helpers/hw_info_helper.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
namespace NEO {
|
||||
struct HardwareInfo;
|
||||
|
||||
struct HwInfoHelper {
|
||||
static bool checkIfOcl21FeaturesEnabledOrEnforced(const HardwareInfo &hwInfo);
|
||||
};
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user