2017-12-21 00:45:38 +01:00
/*
2025-01-24 16:39:50 +00:00
* Copyright ( C ) 2020 - 2025 Intel Corporation
2017-12-21 00:45:38 +01:00
*
2018-09-18 09:11:08 +02:00
* SPDX - License - Identifier : MIT
2017-12-21 00:45:38 +01:00
*
*/
2020-10-22 16:13:05 +02:00
# include "shared/source/debug_settings/debug_settings_manager.h"
2020-07-21 13:25:14 +02:00
# include "shared/source/device/device.h"
2023-02-27 16:53:08 +00:00
# include "shared/source/execution_environment/execution_environment.h"
2022-12-15 17:32:03 +00:00
# include "shared/source/execution_environment/root_device_environment.h"
2023-03-10 12:57:57 +00:00
# include "shared/source/helpers/compiler_product_helper.h"
2023-02-01 16:23:01 +00:00
# include "shared/source/helpers/gfx_core_helper.h"
2023-02-06 09:05:43 +00:00
# include "shared/source/helpers/hw_info.h"
2024-02-02 17:52:05 +00:00
# include "shared/source/helpers/hw_info_helper.h"
2020-05-13 18:48:26 +02:00
# include "shared/source/helpers/string.h"
2024-02-08 16:27:20 +00:00
# include "shared/source/kernel/kernel_properties.h"
2025-01-24 16:39:50 +00:00
# include "shared/source/memory_manager/memory_manager.h"
2020-03-16 12:41:25 +01:00
# include "shared/source/os_interface/driver_info.h"
2025-02-06 23:56:09 +00:00
# include "shared/source/utilities/buffer_pool_allocator.inl"
2020-02-24 10:22:30 +01:00
2020-03-20 11:15:25 +01:00
# include "opencl/source/cl_device/cl_device.h"
2024-12-16 10:19:12 +00:00
# include "opencl/source/context/context.h"
2023-02-02 13:55:54 +00:00
# include "opencl/source/gtpin/gtpin_gfx_core_helper.h"
2023-01-23 14:32:50 +00:00
# include "opencl/source/helpers/cl_gfx_core_helper.h"
2020-02-22 22:50:57 +01:00
# include "opencl/source/sharings/sharing_factory.h"
2018-04-26 10:08:31 +02:00
# include "driver_version.h"
2022-11-23 15:09:23 +00:00
# include <iterator>
2022-05-17 19:04:23 +00:00
# include <sstream>
2017-12-21 00:45:38 +01:00
2019-03-26 11:59:46 +01:00
namespace NEO {
2017-12-21 00:45:38 +01:00
static std : : string vendor = " Intel(R) Corporation " ;
static std : : string profile = " FULL_PROFILE " ;
static std : : string spirVersions = " 1.2 " ;
2024-03-11 17:00:13 +00:00
const char * latestConformanceVersionPassed = " v2024-02-27-00 " ;
2018-03-28 23:55:09 +02:00
# define QTR(a) #a
# define TOSTR(b) QTR(b)
2020-03-22 10:53:13 +01:00
static std : : string driverVersion = TOSTR ( NEO_OCL_DRIVER_VERSION ) ;
2017-12-21 00:45:38 +01:00
2018-06-05 15:39:17 +02:00
static constexpr cl_device_fp_config defaultFpFlags = static_cast < cl_device_fp_config > ( CL_FP_ROUND_TO_NEAREST |
CL_FP_ROUND_TO_ZERO |
CL_FP_ROUND_TO_INF |
CL_FP_INF_NAN |
CL_FP_DENORM |
CL_FP_FMA ) ;
2023-02-17 19:00:29 +00:00
static constexpr cl_device_fp_atomic_capabilities_ext defaultFpAtomicCapabilities = static_cast < cl_device_fp_atomic_capabilities_ext > ( CL_DEVICE_GLOBAL_FP_ATOMIC_LOAD_STORE_EXT |
CL_DEVICE_LOCAL_FP_ATOMIC_LOAD_STORE_EXT ) ;
2020-03-05 18:13:32 +01:00
void ClDevice : : setupFp64Flags ( ) {
2019-05-06 12:33:44 +02:00
auto & hwInfo = getHardwareInfo ( ) ;
2020-02-17 13:54:48 +01:00
2023-11-30 08:32:25 +00:00
if ( debugManager . flags . OverrideDefaultFP64Settings . get ( ) = = 1 ) {
2020-02-17 13:54:48 +01:00
deviceInfo . singleFpConfig = static_cast < cl_device_fp_config > ( CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT ) ;
deviceInfo . doubleFpConfig = defaultFpFlags ;
2022-12-12 15:18:35 +00:00
deviceInfo . nativeVectorWidthDouble = 1 ;
deviceInfo . preferredVectorWidthDouble = 1 ;
2023-11-30 08:32:25 +00:00
} else if ( debugManager . flags . OverrideDefaultFP64Settings . get ( ) = = - 1 ) {
2018-06-05 15:39:17 +02:00
if ( hwInfo . capabilityTable . ftrSupportsFP64 ) {
2022-12-12 15:18:35 +00:00
deviceInfo . doubleFpConfig = defaultFpFlags ;
deviceInfo . nativeVectorWidthDouble = 1 ;
deviceInfo . preferredVectorWidthDouble = 1 ;
} else {
2023-02-27 16:53:08 +00:00
if ( hwInfo . capabilityTable . ftrSupportsFP64Emulation ) {
if ( getDevice ( ) . getExecutionEnvironment ( ) - > isFP64EmulationEnabled ( ) ) {
deviceInfo . doubleFpConfig = defaultFpFlags | CL_FP_SOFT_FLOAT ;
deviceInfo . nativeVectorWidthDouble = 1 ;
deviceInfo . preferredVectorWidthDouble = 1 ;
}
} else {
deviceInfo . doubleFpConfig = 0 ;
deviceInfo . nativeVectorWidthDouble = 0 ;
deviceInfo . preferredVectorWidthDouble = 0 ;
}
2018-06-05 15:39:17 +02:00
}
deviceInfo . singleFpConfig = static_cast < cl_device_fp_config > (
hwInfo . capabilityTable . ftrSupports64BitMath
? CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT
: 0 ) ;
}
}
2020-03-05 18:13:32 +01:00
void ClDevice : : initializeCaps ( ) {
2019-05-06 12:33:44 +02:00
auto & hwInfo = getHardwareInfo ( ) ;
2023-01-30 00:53:04 +00:00
auto & rootDeviceEnvironment = getRootDeviceEnvironment ( ) ;
2023-03-10 12:57:57 +00:00
auto & compilerProductHelper = rootDeviceEnvironment . getHelper < CompilerProductHelper > ( ) ;
2023-01-30 00:53:04 +00:00
auto & productHelper = rootDeviceEnvironment . getHelper < ProductHelper > ( ) ;
auto & gfxCoreHelper = rootDeviceEnvironment . getHelper < GfxCoreHelper > ( ) ;
2023-04-13 14:16:49 +00:00
auto * releaseHelper = rootDeviceEnvironment . getReleaseHelper ( ) ;
2020-03-12 09:33:20 +01:00
auto & sharedDeviceInfo = getSharedDeviceInfo ( ) ;
2017-12-21 00:45:38 +01:00
deviceExtensions . clear ( ) ;
2023-04-13 14:16:49 +00:00
deviceExtensions . append ( compilerProductHelper . getDeviceExtensions ( hwInfo , releaseHelper ) ) ;
2017-12-21 00:45:38 +01:00
2020-03-22 10:53:13 +01:00
driverVersion = TOSTR ( NEO_OCL_DRIVER_VERSION ) ;
2017-12-21 00:45:38 +01:00
2023-11-30 08:32:25 +00:00
if ( debugManager . flags . OverrideDeviceName . get ( ) ! = " unk " ) {
name . assign ( debugManager . flags . OverrideDeviceName . get ( ) . c_str ( ) ) ;
2022-05-19 00:48:02 +00:00
} else {
2023-01-13 08:35:43 +01:00
name = getClDeviceName ( ) ;
2022-05-19 00:48:02 +00:00
if ( driverInfo ) {
name . assign ( driverInfo - > getDeviceName ( name ) . c_str ( ) ) ;
}
}
2018-06-21 10:47:21 +02:00
2017-12-21 00:45:38 +01:00
if ( driverInfo ) {
2022-05-09 16:21:21 +00:00
driverVersion . assign ( driverInfo - > getVersion ( driverVersion ) . c_str ( ) ) ;
2020-03-18 15:19:03 +01:00
sharingFactory . verifyExtensionSupport ( driverInfo . get ( ) ) ;
2017-12-21 00:45:38 +01:00
}
deviceInfo . name = name . c_str ( ) ;
deviceInfo . driverVersion = driverVersion . c_str ( ) ;
2018-06-05 15:39:17 +02:00
setupFp64Flags ( ) ;
2017-12-21 00:45:38 +01:00
deviceInfo . vendor = vendor . c_str ( ) ;
deviceInfo . profile = profile . c_str ( ) ;
enabledClVersion = hwInfo . capabilityTable . clVersionSupport ;
2024-02-02 17:52:05 +00:00
ocl21FeaturesEnabled = HwInfoHelper : : checkIfOcl21FeaturesEnabledOrEnforced ( hwInfo ) ;
2023-11-30 08:32:25 +00:00
if ( debugManager . flags . ForceOCLVersion . get ( ) ! = 0 ) {
enabledClVersion = debugManager . flags . ForceOCLVersion . get ( ) ;
2017-12-21 00:45:38 +01:00
}
switch ( enabledClVersion ) {
2020-05-12 11:24:03 +02:00
case 30 :
deviceInfo . clVersion = " OpenCL 3.0 NEO " ;
2022-01-31 13:47:17 +00:00
deviceInfo . clCVersion = " OpenCL C 1.2 " ;
2020-05-26 15:28:40 +02:00
deviceInfo . numericClVersion = CL_MAKE_VERSION ( 3 , 0 , 0 ) ;
2020-05-12 11:24:03 +02:00
break ;
2017-12-21 00:45:38 +01:00
case 21 :
deviceInfo . clVersion = " OpenCL 2.1 NEO " ;
2018-02-05 13:32:14 +01:00
deviceInfo . clCVersion = " OpenCL C 2.0 " ;
2020-05-26 15:28:40 +02:00
deviceInfo . numericClVersion = CL_MAKE_VERSION ( 2 , 1 , 0 ) ;
2017-12-21 00:45:38 +01:00
break ;
case 12 :
default :
deviceInfo . clVersion = " OpenCL 1.2 NEO " ;
deviceInfo . clCVersion = " OpenCL C 1.2 " ;
2020-05-26 15:28:40 +02:00
deviceInfo . numericClVersion = CL_MAKE_VERSION ( 1 , 2 , 0 ) ;
2017-12-21 00:45:38 +01:00
break ;
}
2020-08-18 19:16:55 +02:00
deviceInfo . latestConformanceVersionPassed = latestConformanceVersionPassed ;
2020-05-26 15:28:40 +02:00
initializeOpenclCAllVersions ( ) ;
2020-04-30 15:47:43 +02:00
deviceInfo . platformLP = ( hwInfo . capabilityTable . supportsOcl21Features = = false ) ;
2017-12-21 00:45:38 +01:00
deviceInfo . spirVersions = spirVersions . c_str ( ) ;
2024-03-12 15:13:37 +00:00
initializeILsWithVersion ( ) ;
2017-12-21 00:45:38 +01:00
2020-06-18 15:07:58 +02:00
deviceInfo . independentForwardProgress = hwInfo . capabilityTable . supportsIndependentForwardProgress ;
2020-09-11 10:54:46 +02:00
deviceInfo . maxNumOfSubGroups = 0 ;
2020-03-25 13:06:45 +01:00
2020-05-05 16:40:31 +02:00
if ( ocl21FeaturesEnabled ) {
2020-09-11 10:54:46 +02:00
2023-11-30 08:32:25 +00:00
auto simdSizeUsed = debugManager . flags . UseMaxSimdSizeToDeduceMaxWorkgroupSize . get ( )
2020-09-11 10:54:46 +02:00
? CommonConstants : : maximalSimdSize
2022-12-08 12:22:35 +00:00
: gfxCoreHelper . getMinimalSIMDSize ( ) ;
2020-09-11 10:54:46 +02:00
// calculate a maximum number of subgroups in a workgroup (for the required SIMD size)
deviceInfo . maxNumOfSubGroups = static_cast < uint32_t > ( sharedDeviceInfo . maxWorkGroupSize / simdSizeUsed ) ;
2018-04-13 11:17:55 +02:00
}
2023-02-17 19:00:29 +00:00
if ( enabledClVersion > = 20 ) {
deviceInfo . singleFpAtomicCapabilities = defaultFpAtomicCapabilities ;
deviceInfo . halfFpAtomicCapabilities = 0 ;
if ( ocl21FeaturesEnabled & & hwInfo . capabilityTable . supportsFloatAtomics ) {
2024-02-08 16:27:20 +00:00
uint32_t fp16Caps = 0u ;
uint32_t fp32Caps = 0u ;
2024-03-28 13:47:16 +00:00
compilerProductHelper . getKernelFp16AtomicCapabilities ( releaseHelper , fp16Caps ) ;
compilerProductHelper . getKernelFp32AtomicCapabilities ( fp32Caps ) ;
2024-02-08 16:27:20 +00:00
deviceInfo . halfFpAtomicCapabilities = fp16Caps ;
deviceInfo . singleFpAtomicCapabilities = fp32Caps ;
2023-02-17 19:00:29 +00:00
}
const cl_device_fp_atomic_capabilities_ext baseFP64AtomicCapabilities = hwInfo . capabilityTable . ftrSupportsInteger64BitAtomics | | hwInfo . capabilityTable . supportsFloatAtomics ? defaultFpAtomicCapabilities : 0 ;
const cl_device_fp_atomic_capabilities_ext optionalFP64AtomicCapabilities = ocl21FeaturesEnabled & & hwInfo . capabilityTable . supportsFloatAtomics ? static_cast < cl_device_fp_atomic_capabilities_ext > (
CL_DEVICE_GLOBAL_FP_ATOMIC_ADD_EXT | CL_DEVICE_GLOBAL_FP_ATOMIC_MIN_MAX_EXT |
CL_DEVICE_LOCAL_FP_ATOMIC_ADD_EXT | CL_DEVICE_LOCAL_FP_ATOMIC_MIN_MAX_EXT )
: 0 ;
deviceInfo . doubleFpAtomicCapabilities = deviceInfo . doubleFpConfig ! = 0u ? baseFP64AtomicCapabilities | optionalFP64AtomicCapabilities : 0 ;
2024-02-08 16:27:20 +00:00
static_assert ( CL_DEVICE_GLOBAL_FP_ATOMIC_LOAD_STORE_EXT = = FpAtomicExtFlags : : globalLoadStore , " Mismatch between internal and API - specific capabilities. " ) ;
static_assert ( CL_DEVICE_GLOBAL_FP_ATOMIC_ADD_EXT = = FpAtomicExtFlags : : globalAdd , " Mismatch between internal and API - specific capabilities. " ) ;
static_assert ( CL_DEVICE_GLOBAL_FP_ATOMIC_MIN_MAX_EXT = = FpAtomicExtFlags : : globalMinMax , " Mismatch between internal and API - specific capabilities. " ) ;
static_assert ( CL_DEVICE_LOCAL_FP_ATOMIC_LOAD_STORE_EXT = = FpAtomicExtFlags : : localLoadStore , " Mismatch between internal and API - specific capabilities. " ) ;
static_assert ( CL_DEVICE_LOCAL_FP_ATOMIC_ADD_EXT = = FpAtomicExtFlags : : localAdd , " Mismatch between internal and API - specific capabilities. " ) ;
static_assert ( CL_DEVICE_LOCAL_FP_ATOMIC_MIN_MAX_EXT = = FpAtomicExtFlags : : localMinMax , " Mismatch between internal and API - specific capabilities. " ) ;
2023-02-17 19:00:29 +00:00
}
2023-11-30 08:32:25 +00:00
if ( debugManager . flags . EnableNV12 . get ( ) & & hwInfo . capabilityTable . supportsImages ) {
2017-12-21 00:45:38 +01:00
deviceInfo . nv12Extension = true ;
}
2023-11-30 08:32:25 +00:00
if ( debugManager . flags . EnablePackedYuv . get ( ) & & hwInfo . capabilityTable . supportsImages ) {
2017-12-21 00:45:38 +01:00
deviceInfo . packedYuvExtension = true ;
}
2023-03-14 15:24:23 +00:00
auto supportsVme = hwInfo . capabilityTable . supportsVme ;
2023-11-30 08:32:25 +00:00
if ( debugManager . flags . EnableIntelVme . get ( ) ! = - 1 ) {
supportsVme = ! ! debugManager . flags . EnableIntelVme . get ( ) ;
2019-09-06 12:30:35 +02:00
}
if ( supportsVme ) {
2017-12-21 00:45:38 +01:00
deviceInfo . vmeExtension = true ;
}
2019-09-06 12:30:35 +02:00
2025-02-13 17:19:05 +00:00
auto sharingAllowed = ( getNumGenericSubDevices ( ) < = 1u ) & & productHelper . isSharingWith3dOrMediaAllowed ( ) ;
2020-01-21 13:43:34 +01:00
if ( sharingAllowed ) {
2020-03-27 13:28:54 +01:00
deviceExtensions + = sharingFactory . getExtensions ( driverInfo . get ( ) ) ;
2020-01-21 13:43:34 +01:00
}
2017-12-21 00:45:38 +01:00
2022-05-09 17:40:30 +00:00
PhysicalDevicePciBusInfo pciBusInfo ( PhysicalDevicePciBusInfo : : invalidValue , PhysicalDevicePciBusInfo : : invalidValue , PhysicalDevicePciBusInfo : : invalidValue , PhysicalDevicePciBusInfo : : invalidValue ) ;
2020-11-05 15:40:03 +03:00
if ( driverInfo ) {
pciBusInfo = driverInfo - > getPciBusInfo ( ) ;
}
deviceInfo . pciBusInfo . pci_domain = pciBusInfo . pciDomain ;
deviceInfo . pciBusInfo . pci_bus = pciBusInfo . pciBus ;
deviceInfo . pciBusInfo . pci_device = pciBusInfo . pciDevice ;
deviceInfo . pciBusInfo . pci_function = pciBusInfo . pciFunction ;
if ( isPciBusInfoValid ( ) ) {
deviceExtensions + = " cl_khr_pci_bus_info " ;
}
2017-12-21 00:45:38 +01:00
deviceInfo . deviceExtensions = deviceExtensions . c_str ( ) ;
2020-05-26 15:28:40 +02:00
std : : vector < std : : string > exposedBuiltinKernelsVector ;
2019-09-06 12:30:35 +02:00
if ( supportsVme ) {
2020-05-26 15:28:40 +02:00
exposedBuiltinKernelsVector . push_back ( " block_motion_estimate_intel " ) ;
2017-12-21 00:45:38 +01:00
}
2023-03-14 15:24:23 +00:00
auto supportsAdvancedVme = hwInfo . capabilityTable . supportsVme ;
2023-11-30 08:32:25 +00:00
if ( debugManager . flags . EnableIntelAdvancedVme . get ( ) ! = - 1 ) {
supportsAdvancedVme = ! ! debugManager . flags . EnableIntelAdvancedVme . get ( ) ;
2023-03-14 15:24:23 +00:00
}
2019-09-06 12:30:35 +02:00
if ( supportsAdvancedVme ) {
2020-05-26 15:28:40 +02:00
exposedBuiltinKernelsVector . push_back ( " block_advanced_motion_estimate_check_intel " ) ;
exposedBuiltinKernelsVector . push_back ( " block_advanced_motion_estimate_bidirectional_check_intel " ) ;
}
2023-10-03 15:02:52 +00:00
for ( auto & builtInKernel : exposedBuiltinKernelsVector ) {
2020-05-26 15:28:40 +02:00
exposedBuiltinKernels . append ( builtInKernel ) ;
exposedBuiltinKernels . append ( " ; " ) ;
cl_name_version kernelNameVersion ;
kernelNameVersion . version = CL_MAKE_VERSION ( 1 , 0 , 0 ) ;
strcpy_s ( kernelNameVersion . name , CL_NAME_VERSION_MAX_NAME_SIZE , builtInKernel . c_str ( ) ) ;
deviceInfo . builtInKernelsWithVersion . push_back ( kernelNameVersion ) ;
2017-12-21 00:45:38 +01:00
}
deviceInfo . builtInKernels = exposedBuiltinKernels . c_str ( ) ;
deviceInfo . deviceType = CL_DEVICE_TYPE_GPU ;
deviceInfo . endianLittle = 1 ;
2022-12-08 12:22:35 +00:00
deviceInfo . hostUnifiedMemory = ( false = = gfxCoreHelper . isLocalMemoryEnabled ( hwInfo ) ) ;
2017-12-21 00:45:38 +01:00
deviceInfo . deviceAvailable = CL_TRUE ;
deviceInfo . compilerAvailable = CL_TRUE ;
2020-02-06 13:33:30 +01:00
deviceInfo . parentDevice = nullptr ;
2021-08-31 16:49:46 +00:00
deviceInfo . partitionMaxSubDevices = device . getNumSubDevices ( ) ;
if ( deviceInfo . partitionMaxSubDevices > 0 ) {
2020-02-21 12:49:10 +01:00
deviceInfo . partitionProperties [ 0 ] = CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN ;
deviceInfo . partitionProperties [ 1 ] = 0 ;
deviceInfo . partitionAffinityDomain = CL_DEVICE_AFFINITY_DOMAIN_NUMA | CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE ;
} else {
deviceInfo . partitionMaxSubDevices = 0 ;
deviceInfo . partitionProperties [ 0 ] = 0 ;
deviceInfo . partitionAffinityDomain = 0 ;
}
2020-02-06 13:33:30 +01:00
deviceInfo . partitionType [ 0 ] = 0 ;
2018-01-24 12:00:27 +01:00
deviceInfo . preferredVectorWidthChar = 16 ;
deviceInfo . preferredVectorWidthShort = 8 ;
deviceInfo . preferredVectorWidthInt = 4 ;
deviceInfo . preferredVectorWidthLong = 1 ;
deviceInfo . preferredVectorWidthFloat = 1 ;
deviceInfo . preferredVectorWidthHalf = 8 ;
deviceInfo . nativeVectorWidthChar = 16 ;
deviceInfo . nativeVectorWidthShort = 8 ;
deviceInfo . nativeVectorWidthInt = 4 ;
deviceInfo . nativeVectorWidthLong = 1 ;
deviceInfo . nativeVectorWidthFloat = 1 ;
deviceInfo . nativeVectorWidthHalf = 8 ;
2021-01-18 14:53:47 +00:00
deviceInfo . maxReadWriteImageArgs = hwInfo . capabilityTable . supportsImages ? 128 : 0 ;
2018-01-24 12:00:27 +01:00
deviceInfo . executionCapabilities = CL_EXEC_KERNEL ;
2017-12-21 00:45:38 +01:00
2022-11-14 16:34:34 +00:00
// copy system info to prevent misaligned reads
2019-05-08 16:00:24 +02:00
const auto systemInfo = hwInfo . gtSystemInfo ;
2017-12-21 00:45:38 +01:00
2022-05-25 15:19:35 +00:00
const auto subDevicesCount = std : : max ( getNumGenericSubDevices ( ) , 1u ) ;
2023-12-04 15:55:01 +00:00
deviceInfo . globalMemCacheSize = systemInfo . L3CacheSizeInKb * MemoryConstants : : kiloByte * subDevicesCount ;
2019-12-17 08:55:09 +01:00
deviceInfo . grfSize = hwInfo . capabilityTable . grfSize ;
2017-12-21 00:45:38 +01:00
deviceInfo . globalMemCacheType = CL_READ_WRITE_CACHE ;
deviceInfo . memBaseAddressAlign = 1024 ;
deviceInfo . minDataTypeAlignSize = 128 ;
deviceInfo . preferredInteropUserSync = 1u ;
// OpenCL 1.2 requires 128MB minimum
2018-06-08 16:42:29 +02:00
2020-03-12 09:33:20 +01:00
deviceInfo . maxConstantBufferSize = sharedDeviceInfo . maxMemAllocSize ;
2017-12-21 00:45:38 +01:00
deviceInfo . maxWorkItemDimensions = 3 ;
2022-05-25 15:19:35 +00:00
deviceInfo . maxComputUnits = systemInfo . EUCount * subDevicesCount ;
2021-08-31 16:49:46 +00:00
2017-12-21 00:45:38 +01:00
deviceInfo . maxConstantArgs = 8 ;
2019-07-15 11:13:40 +02:00
deviceInfo . maxSliceCount = systemInfo . SliceCount ;
2017-12-21 00:45:38 +01:00
2018-06-05 15:39:17 +02:00
deviceInfo . singleFpConfig | = defaultFpFlags ;
deviceInfo . halfFpConfig = defaultFpFlags ;
2023-11-30 08:32:25 +00:00
PRINT_DEBUG_STRING ( debugManager . flags . PrintDebugMessages . get ( ) , stderr , " computeUnitsUsedForScratch: %d \n " , sharedDeviceInfo . computeUnitsUsedForScratch ) ;
2020-09-25 11:24:15 +02:00
2023-11-30 08:32:25 +00:00
PRINT_DEBUG_STRING ( debugManager . flags . PrintDebugMessages . get ( ) , stderr , " hwInfo: {%d, %d}: (%d, %d, %d) \n " ,
2020-09-25 11:24:15 +02:00
systemInfo . EUCount ,
systemInfo . ThreadCount ,
systemInfo . MaxEuPerSubSlice ,
systemInfo . MaxSlicesSupported ,
systemInfo . MaxSubSlicesSupported ) ;
2017-12-21 00:45:38 +01:00
deviceInfo . localMemType = CL_LOCAL ;
2022-12-08 12:22:35 +00:00
deviceInfo . image3DMaxWidth = gfxCoreHelper . getMax3dImageWidthOrHeight ( ) ;
deviceInfo . image3DMaxHeight = gfxCoreHelper . getMax3dImageWidthOrHeight ( ) ;
2017-12-21 00:45:38 +01:00
// cl_khr_image2d_from_buffer
2023-01-30 00:53:04 +00:00
deviceInfo . imagePitchAlignment = gfxCoreHelper . getPitchAlignmentForImage ( rootDeviceEnvironment ) ;
2017-12-21 00:45:38 +01:00
deviceInfo . imageBaseAddressAlignment = 4 ;
deviceInfo . queueOnHostProperties = CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE ;
2020-05-13 18:48:26 +02:00
deviceInfo . pipeSupport = arePipesSupported ( ) ;
2020-04-29 14:51:40 +02:00
if ( arePipesSupported ( ) ) {
deviceInfo . maxPipeArgs = 16 ;
deviceInfo . pipeMaxPacketSize = 1024 ;
deviceInfo . pipeMaxActiveReservations = 1 ;
} else {
deviceInfo . maxPipeArgs = 0 ;
deviceInfo . pipeMaxPacketSize = 0 ;
deviceInfo . pipeMaxActiveReservations = 0 ;
}
2020-05-13 18:48:26 +02:00
deviceInfo . atomicMemoryCapabilities = CL_DEVICE_ATOMIC_ORDER_RELAXED | CL_DEVICE_ATOMIC_SCOPE_WORK_GROUP ;
if ( ocl21FeaturesEnabled ) {
deviceInfo . atomicMemoryCapabilities | = CL_DEVICE_ATOMIC_ORDER_ACQ_REL | CL_DEVICE_ATOMIC_ORDER_SEQ_CST |
CL_DEVICE_ATOMIC_SCOPE_ALL_DEVICES | CL_DEVICE_ATOMIC_SCOPE_DEVICE ;
}
deviceInfo . atomicFenceCapabilities = CL_DEVICE_ATOMIC_ORDER_RELAXED | CL_DEVICE_ATOMIC_ORDER_ACQ_REL |
CL_DEVICE_ATOMIC_SCOPE_WORK_GROUP ;
if ( ocl21FeaturesEnabled ) {
deviceInfo . atomicFenceCapabilities | = CL_DEVICE_ATOMIC_ORDER_SEQ_CST | CL_DEVICE_ATOMIC_SCOPE_ALL_DEVICES |
CL_DEVICE_ATOMIC_SCOPE_DEVICE | CL_DEVICE_ATOMIC_SCOPE_WORK_ITEM ;
}
2020-12-09 15:53:57 +00:00
deviceInfo . nonUniformWorkGroupSupport = true ;
2020-05-13 18:48:26 +02:00
deviceInfo . workGroupCollectiveFunctionsSupport = ocl21FeaturesEnabled ;
deviceInfo . genericAddressSpaceSupport = ocl21FeaturesEnabled ;
2017-12-21 00:45:38 +01:00
deviceInfo . linkerAvailable = true ;
deviceInfo . svmCapabilities = hwInfo . capabilityTable . ftrSvm * CL_DEVICE_SVM_COARSE_GRAIN_BUFFER ;
2020-03-23 08:55:55 +01:00
if ( hwInfo . capabilityTable . ftrSvm ) {
auto reportFineGrained = hwInfo . capabilityTable . ftrSvm * hwInfo . capabilityTable . ftrSupportsCoherency ;
2023-11-30 08:32:25 +00:00
if ( debugManager . flags . ForceFineGrainedSVMSupport . get ( ) ! = - 1 ) {
reportFineGrained = ! ! debugManager . flags . ForceFineGrainedSVMSupport . get ( ) ;
2020-03-23 08:55:55 +01:00
}
if ( reportFineGrained ) {
deviceInfo . svmCapabilities | = static_cast < cl_device_svm_capabilities > ( CL_DEVICE_SVM_FINE_GRAIN_BUFFER | CL_DEVICE_SVM_ATOMICS ) ;
}
}
2021-12-13 12:45:24 +00:00
for ( auto & engineGroup : this - > getDevice ( ) . getRegularEngineGroups ( ) ) {
2021-12-03 14:30:46 +00:00
cl_queue_family_properties_intel properties = { } ;
properties . capabilities = getQueueFamilyCapabilities ( engineGroup . engineGroupType ) ;
properties . count = static_cast < cl_uint > ( engineGroup . engines . size ( ) ) ;
properties . properties = deviceInfo . queueOnHostProperties ;
getQueueFamilyName ( properties . name , engineGroup . engineGroupType ) ;
deviceInfo . queueFamilyProperties . push_back ( properties ) ;
2020-11-16 11:43:03 +00:00
}
2023-01-30 00:53:04 +00:00
auto & clGfxCoreHelper = rootDeviceEnvironment . getHelper < ClGfxCoreHelper > ( ) ;
2022-11-30 17:06:04 +00:00
const std : : vector < uint32_t > & supportedThreadArbitrationPolicies = clGfxCoreHelper . getSupportedThreadArbitrationPolicies ( ) ;
2021-04-06 09:51:30 +00:00
deviceInfo . supportedThreadArbitrationPolicies . resize ( supportedThreadArbitrationPolicies . size ( ) ) ;
for ( size_t policy = 0u ; policy < supportedThreadArbitrationPolicies . size ( ) ; policy + + ) {
deviceInfo . supportedThreadArbitrationPolicies [ policy ] = supportedThreadArbitrationPolicies [ policy ] ;
}
2017-12-21 00:45:38 +01:00
deviceInfo . preemptionSupported = false ;
2023-12-04 15:55:01 +00:00
deviceInfo . maxGlobalVariableSize = ocl21FeaturesEnabled ? 64 * MemoryConstants : : kiloByte : 0 ;
2020-05-05 16:40:31 +02:00
deviceInfo . globalVariablePreferredTotalSize = ocl21FeaturesEnabled ? static_cast < size_t > ( sharedDeviceInfo . maxMemAllocSize ) : 0 ;
2017-12-21 00:45:38 +01:00
deviceInfo . planarYuvMaxWidth = 16384 ;
2022-12-08 12:22:35 +00:00
deviceInfo . planarYuvMaxHeight = gfxCoreHelper . getPlanarYuvMaxHeight ( ) ;
2017-12-21 00:45:38 +01:00
deviceInfo . vmeAvcSupportsTextureSampler = hwInfo . capabilityTable . ftrSupportsVmeAvcTextureSampler ;
2019-07-12 11:40:15 +02:00
if ( hwInfo . capabilityTable . supportsVme ) {
deviceInfo . vmeAvcVersion = CL_AVC_ME_VERSION_1_INTEL ;
deviceInfo . vmeVersion = CL_ME_VERSION_ADVANCED_VER_2_INTEL ;
}
2017-12-21 00:45:38 +01:00
deviceInfo . platformHostTimerResolution = getPlatformHostTimerResolution ( ) ;
deviceInfo . internalDriverVersion = CL_DEVICE_DRIVER_VERSION_INTEL_NEO1 ;
2018-02-19 17:23:31 +01:00
deviceInfo . preferredGlobalAtomicAlignment = MemoryConstants : : cacheLineSize ;
deviceInfo . preferredLocalAtomicAlignment = MemoryConstants : : cacheLineSize ;
deviceInfo . preferredPlatformAtomicAlignment = MemoryConstants : : cacheLineSize ;
2018-04-06 14:25:22 +02:00
2022-12-08 12:22:35 +00:00
deviceInfo . preferredWorkGroupSizeMultiple = gfxCoreHelper . isFusedEuDispatchEnabled ( hwInfo , false )
2020-05-26 14:11:22 +02:00
? CommonConstants : : maximalSimdSize * 2
: CommonConstants : : maximalSimdSize ;
2022-11-14 16:34:34 +00:00
deviceInfo . hostMemCapabilities = productHelper . getHostMemCapabilities ( & hwInfo ) ;
deviceInfo . deviceMemCapabilities = productHelper . getDeviceMemCapabilities ( ) ;
2025-01-24 16:39:50 +00:00
const bool isKmdMigrationAvailable { getMemoryManager ( ) - > isKmdMigrationAvailable ( getRootDeviceIndex ( ) ) } ;
deviceInfo . singleDeviceSharedMemCapabilities = productHelper . getSingleDeviceSharedMemCapabilities ( isKmdMigrationAvailable ) ;
2022-11-14 16:34:34 +00:00
deviceInfo . crossDeviceSharedMemCapabilities = productHelper . getCrossDeviceSharedMemCapabilities ( ) ;
deviceInfo . sharedSystemMemCapabilities = productHelper . getSharedSystemMemCapabilities ( & hwInfo ) ;
2020-03-05 18:13:32 +01:00
2022-07-04 12:03:50 +00:00
if ( compilerProductHelper . isDotIntegerProductExtensionSupported ( ) ) {
deviceInfo . integerDotCapabilities = CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_KHR | CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_PACKED_KHR ;
deviceInfo . integerDotAccelerationProperties8Bit = {
CL_TRUE , // signed_accelerated;
CL_TRUE , // unsigned_accelerated;
CL_TRUE , // mixed_signedness_accelerated;
CL_TRUE , // accumulating_saturating_signed_accelerated;
CL_TRUE , // accumulating_saturating_unsigned_accelerated;
CL_TRUE } ; // accumulating_saturating_mixed_signedness_accelerated;
deviceInfo . integerDotAccelerationProperties4x8BitPacked = {
CL_TRUE , // signed_accelerated;
CL_TRUE , // unsigned_accelerated;
CL_TRUE , // mixed_signedness_accelerated;
CL_TRUE , // accumulating_saturating_signed_accelerated;
CL_TRUE , // accumulating_saturating_unsigned_accelerated;
CL_TRUE } ; // accumulating_saturating_mixed_signedness_accelerated;
}
2020-05-14 12:25:54 +02:00
initializeOsSpecificCaps ( ) ;
2024-03-28 13:47:16 +00:00
getOpenclCFeaturesList ( hwInfo , deviceInfo . openclCFeatures , getDevice ( ) . getCompilerProductHelper ( ) , releaseHelper ) ;
2020-06-09 14:17:19 +02:00
}
2020-05-26 15:28:40 +02:00
2020-06-09 14:17:19 +02:00
void ClDevice : : initializeExtensionsWithVersion ( ) {
2020-05-26 15:28:40 +02:00
std : : stringstream deviceExtensionsStringStream { deviceExtensions } ;
std : : vector < std : : string > deviceExtensionsVector {
std : : istream_iterator < std : : string > { deviceExtensionsStringStream } , std : : istream_iterator < std : : string > { } } ;
2020-06-09 14:17:19 +02:00
deviceInfo . extensionsWithVersion . reserve ( deviceExtensionsVector . size ( ) ) ;
2023-10-03 15:02:52 +00:00
for ( auto & deviceExtension : deviceExtensionsVector ) {
2020-05-26 15:28:40 +02:00
cl_name_version deviceExtensionWithVersion ;
2022-07-04 12:03:50 +00:00
deviceExtensionWithVersion . version = getExtensionVersion ( deviceExtension ) ;
2020-05-26 15:28:40 +02:00
strcpy_s ( deviceExtensionWithVersion . name , CL_NAME_VERSION_MAX_NAME_SIZE , deviceExtension . c_str ( ) ) ;
deviceInfo . extensionsWithVersion . push_back ( deviceExtensionWithVersion ) ;
}
}
void ClDevice : : initializeOpenclCAllVersions ( ) {
2023-11-16 16:48:56 +00:00
auto deviceOpenCLCVersions = this - > getCompilerProductHelper ( ) . getDeviceOpenCLCVersions ( this - > getHardwareInfo ( ) , { static_cast < unsigned short > ( enabledClVersion / 10 ) , static_cast < unsigned short > ( enabledClVersion % 10 ) } ) ;
2020-05-26 15:28:40 +02:00
cl_name_version openClCVersion ;
strcpy_s ( openClCVersion . name , CL_NAME_VERSION_MAX_NAME_SIZE , " OpenCL C " ) ;
2023-11-16 16:48:56 +00:00
for ( auto & ver : deviceOpenCLCVersions ) {
openClCVersion . version = CL_MAKE_VERSION ( ver . major , ver . minor , 0 ) ;
2020-05-26 15:28:40 +02:00
deviceInfo . openclCAllVersions . push_back ( openClCVersion ) ;
}
2017-12-21 00:45:38 +01:00
}
2020-01-14 14:32:11 +01:00
2024-03-12 15:13:37 +00:00
void ClDevice : : initializeILsWithVersion ( ) {
std : : stringstream ilsStringStream { device . getDeviceInfo ( ) . ilVersion } ;
std : : vector < std : : string > ilsVector {
std : : istream_iterator < std : : string > { ilsStringStream } , std : : istream_iterator < std : : string > { } } ;
deviceInfo . ilsWithVersion . reserve ( ilsVector . size ( ) ) ;
for ( auto & il : ilsVector ) {
size_t majorVersionPos = il . find_last_of ( ' _ ' ) ;
size_t minorVersionPos = il . find_last_of ( ' . ' ) ;
if ( majorVersionPos ! = std : : string : : npos & & minorVersionPos ! = std : : string : : npos ) {
cl_name_version ilWithVersion ;
uint32_t majorVersion = static_cast < uint32_t > ( std : : stoul ( il . substr ( majorVersionPos + 1 ) ) ) ;
uint32_t minorVersion = static_cast < uint32_t > ( std : : stoul ( il . substr ( minorVersionPos + 1 ) ) ) ;
strcpy_s ( ilWithVersion . name , CL_NAME_VERSION_MAX_NAME_SIZE , il . substr ( 0 , majorVersionPos ) . c_str ( ) ) ;
ilWithVersion . version = CL_MAKE_VERSION ( majorVersion , minorVersion , 0 ) ;
deviceInfo . ilsWithVersion . push_back ( ilWithVersion ) ;
}
}
}
2024-12-16 10:19:12 +00:00
void ClDevice : : initializeMaxPoolCount ( ) {
auto & device = getDevice ( ) ;
const auto bitfield = device . getDeviceBitfield ( ) ;
const auto deviceMemory = device . getGlobalMemorySize ( static_cast < uint32_t > ( bitfield . to_ulong ( ) ) ) ;
2025-02-06 23:56:09 +00:00
const auto preferredBufferPoolParams = SmallBuffersParams : : getPreferredBufferPoolParams ( device . getProductHelper ( ) ) ;
const auto maxPoolCount = Context : : BufferPoolAllocator : : calculateMaxPoolCount ( preferredBufferPoolParams , deviceMemory , 2 ) ;
2024-12-16 10:19:12 +00:00
device . updateMaxPoolCount ( maxPoolCount ) ;
}
2023-01-13 08:35:43 +01:00
const std : : string ClDevice : : getClDeviceName ( ) const {
2020-10-20 15:33:41 -07:00
return this - > getDevice ( ) . getDeviceInfo ( ) . name ;
2020-07-21 13:25:14 +02:00
}
2019-03-26 11:59:46 +01:00
} // namespace NEO