2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2020-01-08 22:15:01 +08:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/command_stream/command_stream_receiver.h"
|
|
|
|
#include "shared/source/device/device.h"
|
|
|
|
#include "shared/source/helpers/basic_math.h"
|
|
|
|
#include "shared/source/helpers/hw_helper.h"
|
|
|
|
#include "shared/source/memory_manager/memory_manager.h"
|
2020-03-16 19:41:25 +08:00
|
|
|
#include "shared/source/os_interface/driver_info.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/os_interface/hw_info_config.h"
|
|
|
|
#include "shared/source/os_interface/os_interface.h"
|
2020-03-06 17:11:44 +08:00
|
|
|
#include "shared/source/source_level_debugger/source_level_debugger.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-03-06 01:13:32 +08:00
|
|
|
#include "opencl/source/device/cl_device.h"
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/platform/extensions.h"
|
|
|
|
#include "opencl/source/sharings/sharing_factory.h"
|
2018-04-26 16:08:31 +08:00
|
|
|
|
|
|
|
#include "CL/cl_ext_intel.h"
|
|
|
|
#include "driver_version.h"
|
|
|
|
|
|
|
|
#include <algorithm>
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
extern const char *familyName[];
|
|
|
|
|
|
|
|
static std::string vendor = "Intel(R) Corporation";
|
|
|
|
static std::string profile = "FULL_PROFILE";
|
|
|
|
static std::string spirVersions = "1.2 ";
|
2019-04-19 18:39:25 +08:00
|
|
|
static const char *spirvVersion = "SPIR-V_1.2 ";
|
2018-03-29 05:55:09 +08:00
|
|
|
#define QTR(a) #a
|
|
|
|
#define TOSTR(b) QTR(b)
|
2020-03-22 17:53:13 +08:00
|
|
|
static std::string driverVersion = TOSTR(NEO_OCL_DRIVER_VERSION);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
const char *builtInKernels = ""; // the "always available" (extension-independent) builtin kernels
|
|
|
|
|
2018-06-05 21:39:17 +08: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);
|
|
|
|
|
2020-02-17 20:54:48 +08:00
|
|
|
bool releaseFP64Override();
|
|
|
|
|
2020-03-06 01:13:32 +08:00
|
|
|
void ClDevice::setupFp64Flags() {
|
2019-05-06 18:33:44 +08:00
|
|
|
auto &hwInfo = getHardwareInfo();
|
2020-02-17 20:54:48 +08:00
|
|
|
|
|
|
|
if (releaseFP64Override() || DebugManager.flags.OverrideDefaultFP64Settings.get() == 1) {
|
|
|
|
deviceExtensions += "cl_khr_fp64 ";
|
|
|
|
deviceInfo.singleFpConfig = static_cast<cl_device_fp_config>(CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT);
|
|
|
|
deviceInfo.doubleFpConfig = defaultFpFlags;
|
|
|
|
} else if (DebugManager.flags.OverrideDefaultFP64Settings.get() == -1) {
|
2018-06-05 21:39:17 +08:00
|
|
|
if (hwInfo.capabilityTable.ftrSupportsFP64) {
|
|
|
|
deviceExtensions += "cl_khr_fp64 ";
|
|
|
|
}
|
|
|
|
|
|
|
|
deviceInfo.singleFpConfig = static_cast<cl_device_fp_config>(
|
|
|
|
hwInfo.capabilityTable.ftrSupports64BitMath
|
|
|
|
? CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT
|
|
|
|
: 0);
|
|
|
|
|
|
|
|
deviceInfo.doubleFpConfig = hwInfo.capabilityTable.ftrSupportsFP64
|
|
|
|
? defaultFpFlags
|
|
|
|
: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
void Device::initializeCaps() {
|
2020-03-06 01:13:32 +08:00
|
|
|
auto &hwInfo = getHardwareInfo();
|
|
|
|
auto hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
|
|
|
auto addressing32bitAllowed = is64bit;
|
|
|
|
|
|
|
|
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
|
|
|
|
|
|
|
deviceInfo.ilVersion = "";
|
|
|
|
auto enabledClVersion = hwInfo.capabilityTable.clVersionSupport;
|
|
|
|
if (DebugManager.flags.ForceOCLVersion.get() != 0) {
|
|
|
|
enabledClVersion = DebugManager.flags.ForceOCLVersion.get();
|
|
|
|
}
|
|
|
|
switch (enabledClVersion) {
|
|
|
|
case 21:
|
|
|
|
deviceInfo.ilVersion = spirvVersion;
|
|
|
|
addressing32bitAllowed = false;
|
|
|
|
break;
|
|
|
|
case 20:
|
|
|
|
addressing32bitAllowed = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
deviceInfo.vendorId = 0x8086;
|
|
|
|
deviceInfo.maxReadImageArgs = 128;
|
|
|
|
deviceInfo.maxWriteImageArgs = 128;
|
|
|
|
deviceInfo.maxParameterSize = 1024;
|
|
|
|
|
|
|
|
deviceInfo.addressBits = 64;
|
|
|
|
|
|
|
|
//copy system info to prevent misaligned reads
|
|
|
|
const auto systemInfo = hwInfo.gtSystemInfo;
|
|
|
|
|
|
|
|
deviceInfo.globalMemCachelineSize = 64;
|
|
|
|
|
|
|
|
deviceInfo.globalMemSize = getMemoryManager()->isLocalMemorySupported(this->getRootDeviceIndex())
|
|
|
|
? getMemoryManager()->getLocalMemorySize(this->getRootDeviceIndex())
|
|
|
|
: getMemoryManager()->getSystemSharedMemory(this->getRootDeviceIndex());
|
|
|
|
deviceInfo.globalMemSize = std::min(deviceInfo.globalMemSize, getMemoryManager()->getMaxApplicationAddress() + 1);
|
|
|
|
deviceInfo.globalMemSize = static_cast<uint64_t>(static_cast<double>(deviceInfo.globalMemSize) * 0.8);
|
|
|
|
|
|
|
|
if (DebugManager.flags.Force32bitAddressing.get() || addressing32bitAllowed || is32bit) {
|
|
|
|
deviceInfo.globalMemSize = std::min(deviceInfo.globalMemSize, static_cast<uint64_t>(4 * GB * 0.8));
|
|
|
|
deviceInfo.addressBits = 32;
|
|
|
|
deviceInfo.force32BitAddressess = is64bit;
|
|
|
|
}
|
|
|
|
|
|
|
|
deviceInfo.globalMemSize = alignDown(deviceInfo.globalMemSize, MemoryConstants::pageSize);
|
|
|
|
|
|
|
|
deviceInfo.profilingTimerResolution = getProfilingTimerResolution();
|
|
|
|
deviceInfo.outProfilingTimerResolution = static_cast<size_t>(deviceInfo.profilingTimerResolution);
|
|
|
|
|
|
|
|
deviceInfo.maxOnDeviceQueues = 1;
|
|
|
|
|
|
|
|
// OpenCL 1.2 requires 128MB minimum
|
|
|
|
deviceInfo.maxMemAllocSize = std::min(std::max(deviceInfo.globalMemSize / 2, static_cast<uint64_t>(128llu * MB)), this->hardwareCapabilities.maxMemAllocSize);
|
|
|
|
|
|
|
|
static const int maxPixelSize = 16;
|
|
|
|
deviceInfo.imageMaxBufferSize = static_cast<size_t>(deviceInfo.maxMemAllocSize / maxPixelSize);
|
|
|
|
|
|
|
|
deviceInfo.maxNumEUsPerSubSlice = 0;
|
|
|
|
deviceInfo.numThreadsPerEU = 0;
|
|
|
|
auto simdSizeUsed = DebugManager.flags.UseMaxSimdSizeToDeduceMaxWorkgroupSize.get() ? 32u : hwHelper.getMinimalSIMDSize();
|
|
|
|
|
|
|
|
deviceInfo.maxNumEUsPerSubSlice = (systemInfo.EuCountPerPoolMin == 0 || hwInfo.featureTable.ftrPooledEuEnabled == 0)
|
|
|
|
? (systemInfo.EUCount / systemInfo.SubSliceCount)
|
|
|
|
: systemInfo.EuCountPerPoolMin;
|
|
|
|
deviceInfo.numThreadsPerEU = systemInfo.ThreadCount / systemInfo.EUCount;
|
|
|
|
auto maxWS = hwHelper.getMaxThreadsForWorkgroup(hwInfo, static_cast<uint32_t>(deviceInfo.maxNumEUsPerSubSlice)) * simdSizeUsed;
|
|
|
|
|
|
|
|
maxWS = Math::prevPowerOfTwo(maxWS);
|
|
|
|
deviceInfo.maxWorkGroupSize = std::min(maxWS, 1024u);
|
|
|
|
|
|
|
|
if (DebugManager.flags.OverrideMaxWorkgroupSize.get() != -1) {
|
|
|
|
deviceInfo.maxWorkGroupSize = DebugManager.flags.OverrideMaxWorkgroupSize.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
deviceInfo.maxWorkItemSizes[0] = deviceInfo.maxWorkGroupSize;
|
|
|
|
deviceInfo.maxWorkItemSizes[1] = deviceInfo.maxWorkGroupSize;
|
|
|
|
deviceInfo.maxWorkItemSizes[2] = deviceInfo.maxWorkGroupSize;
|
|
|
|
deviceInfo.maxSamplers = 16;
|
|
|
|
|
|
|
|
deviceInfo.computeUnitsUsedForScratch = hwHelper.getComputeUnitsUsedForScratch(&hwInfo);
|
|
|
|
deviceInfo.maxFrontEndThreads = HwHelper::getMaxThreadsForVfe(hwInfo);
|
|
|
|
|
|
|
|
deviceInfo.localMemSize = hwInfo.capabilityTable.slmSize * KB;
|
|
|
|
|
|
|
|
deviceInfo.imageSupport = hwInfo.capabilityTable.supportsImages;
|
|
|
|
deviceInfo.image2DMaxWidth = 16384;
|
|
|
|
deviceInfo.image2DMaxHeight = 16384;
|
|
|
|
deviceInfo.image3DMaxDepth = 2048;
|
|
|
|
deviceInfo.imageMaxArraySize = 2048;
|
|
|
|
|
2020-03-20 17:35:59 +08:00
|
|
|
deviceInfo.printfBufferSize = 4 * MB;
|
2020-03-06 01:13:32 +08:00
|
|
|
deviceInfo.maxClockFrequency = hwInfo.capabilityTable.maxRenderFrequency;
|
|
|
|
|
|
|
|
deviceInfo.maxSubGroups = hwHelper.getDeviceSubGroupSizes();
|
|
|
|
|
|
|
|
deviceInfo.vmeAvcSupportsPreemption = hwInfo.capabilityTable.ftrSupportsVmeAvcPreemption;
|
|
|
|
|
2020-03-11 15:56:55 +08:00
|
|
|
deviceInfo.debuggerActive = (getRootDeviceEnvironment().debugger.get()) ? getRootDeviceEnvironment().debugger->isDebuggerActive() : false;
|
2020-03-06 01:13:32 +08:00
|
|
|
if (deviceInfo.debuggerActive) {
|
|
|
|
this->preemptionMode = PreemptionMode::Disabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
deviceInfo.sharedSystemAllocationsSupport = hwInfoConfig->getSharedSystemMemCapabilities();
|
|
|
|
if (DebugManager.flags.EnableSharedSystemUsmSupport.get() != -1) {
|
|
|
|
deviceInfo.sharedSystemAllocationsSupport = DebugManager.flags.EnableSharedSystemUsmSupport.get();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ClDevice::initializeCaps() {
|
2019-05-06 18:33:44 +08:00
|
|
|
auto &hwInfo = getHardwareInfo();
|
2019-07-12 20:41:32 +08:00
|
|
|
auto hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
2020-03-12 16:33:20 +08:00
|
|
|
auto &sharedDeviceInfo = getSharedDeviceInfo();
|
2017-12-21 07:45:38 +08:00
|
|
|
deviceExtensions.clear();
|
|
|
|
deviceExtensions.append(deviceExtensionsList);
|
|
|
|
|
2020-03-22 17:53:13 +08:00
|
|
|
driverVersion = TOSTR(NEO_OCL_DRIVER_VERSION);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-03-06 01:13:32 +08:00
|
|
|
// Add our graphics family name to the device name
|
2018-06-21 16:47:21 +08:00
|
|
|
name += "Intel(R) ";
|
2019-05-08 22:00:24 +08:00
|
|
|
name += familyName[hwInfo.platform.eRenderCoreFamily];
|
2018-06-21 16:47:21 +08:00
|
|
|
name += " HD Graphics NEO";
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
if (driverInfo) {
|
2018-06-21 16:47:21 +08:00
|
|
|
name.assign(driverInfo.get()->getDeviceName(name).c_str());
|
2017-12-21 07:45:38 +08:00
|
|
|
driverVersion.assign(driverInfo.get()->getVersion(driverVersion).c_str());
|
2020-03-18 22:19:03 +08:00
|
|
|
sharingFactory.verifyExtensionSupport(driverInfo.get());
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2019-05-08 22:00:24 +08:00
|
|
|
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
2018-02-19 16:50:17 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
deviceInfo.name = name.c_str();
|
|
|
|
deviceInfo.driverVersion = driverVersion.c_str();
|
|
|
|
|
2018-06-05 21:39:17 +08:00
|
|
|
setupFp64Flags();
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
deviceInfo.vendor = vendor.c_str();
|
|
|
|
deviceInfo.profile = profile.c_str();
|
|
|
|
enabledClVersion = hwInfo.capabilityTable.clVersionSupport;
|
|
|
|
if (DebugManager.flags.ForceOCLVersion.get() != 0) {
|
|
|
|
enabledClVersion = DebugManager.flags.ForceOCLVersion.get();
|
|
|
|
}
|
|
|
|
switch (enabledClVersion) {
|
|
|
|
case 21:
|
|
|
|
deviceInfo.clVersion = "OpenCL 2.1 NEO ";
|
2018-02-05 20:32:14 +08:00
|
|
|
deviceInfo.clCVersion = "OpenCL C 2.0 ";
|
2017-12-21 07:45:38 +08:00
|
|
|
break;
|
|
|
|
case 20:
|
|
|
|
deviceInfo.clVersion = "OpenCL 2.0 NEO ";
|
|
|
|
deviceInfo.clCVersion = "OpenCL C 2.0 ";
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
default:
|
|
|
|
deviceInfo.clVersion = "OpenCL 1.2 NEO ";
|
|
|
|
deviceInfo.clCVersion = "OpenCL C 1.2 ";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
deviceInfo.platformLP = (hwInfo.capabilityTable.clVersionSupport == 12) ? true : false;
|
|
|
|
deviceInfo.spirVersions = spirVersions.c_str();
|
2018-10-24 21:59:36 +08:00
|
|
|
auto supportsVme = hwInfo.capabilityTable.supportsVme;
|
2019-09-06 18:30:35 +08:00
|
|
|
auto supportsAdvancedVme = hwInfo.capabilityTable.supportsVme;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
if (enabledClVersion >= 21) {
|
2019-10-16 16:23:46 +08:00
|
|
|
deviceInfo.independentForwardProgress = true;
|
|
|
|
deviceExtensions += "cl_khr_subgroups ";
|
2017-12-21 07:45:38 +08:00
|
|
|
deviceExtensions += "cl_khr_il_program ";
|
2019-12-12 23:48:58 +08:00
|
|
|
if (supportsVme) {
|
|
|
|
deviceExtensions += "cl_intel_spirv_device_side_avc_motion_estimation ";
|
|
|
|
}
|
2020-01-14 18:18:33 +08:00
|
|
|
if (hwInfo.capabilityTable.supportsImages) {
|
|
|
|
deviceExtensions += "cl_intel_spirv_media_block_io ";
|
|
|
|
}
|
2018-12-17 17:03:08 +08:00
|
|
|
deviceExtensions += "cl_intel_spirv_subgroups ";
|
2019-03-18 21:12:57 +08:00
|
|
|
deviceExtensions += "cl_khr_spirv_no_integer_wrap_decoration ";
|
2019-10-16 16:23:46 +08:00
|
|
|
} else {
|
|
|
|
deviceInfo.independentForwardProgress = false;
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2018-04-13 17:17:55 +08:00
|
|
|
if (enabledClVersion >= 20) {
|
2020-01-08 22:15:01 +08:00
|
|
|
deviceExtensions += "cl_intel_unified_shared_memory_preview ";
|
|
|
|
if (hwInfo.capabilityTable.supportsImages) {
|
|
|
|
deviceExtensions += "cl_khr_mipmap_image cl_khr_mipmap_image_writes ";
|
|
|
|
}
|
2018-04-13 17:17:55 +08:00
|
|
|
}
|
|
|
|
|
2020-01-08 22:15:01 +08:00
|
|
|
if (DebugManager.flags.EnableNV12.get() && hwInfo.capabilityTable.supportsImages) {
|
2017-12-21 07:45:38 +08:00
|
|
|
deviceExtensions += "cl_intel_planar_yuv ";
|
|
|
|
deviceInfo.nv12Extension = true;
|
|
|
|
}
|
2020-01-08 22:15:01 +08:00
|
|
|
if (DebugManager.flags.EnablePackedYuv.get() && hwInfo.capabilityTable.supportsImages) {
|
2017-12-21 07:45:38 +08:00
|
|
|
deviceExtensions += "cl_intel_packed_yuv ";
|
|
|
|
deviceInfo.packedYuvExtension = true;
|
|
|
|
}
|
2019-09-06 18:30:35 +08:00
|
|
|
if (DebugManager.flags.EnableIntelVme.get() != -1) {
|
|
|
|
supportsVme = !!DebugManager.flags.EnableIntelVme.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (supportsVme) {
|
2019-07-18 22:46:35 +08:00
|
|
|
deviceExtensions += "cl_intel_motion_estimation cl_intel_device_side_avc_motion_estimation ";
|
2017-12-21 07:45:38 +08:00
|
|
|
deviceInfo.vmeExtension = true;
|
|
|
|
}
|
2019-09-06 18:30:35 +08:00
|
|
|
|
|
|
|
if (DebugManager.flags.EnableIntelAdvancedVme.get() != -1) {
|
|
|
|
supportsAdvancedVme = !!DebugManager.flags.EnableIntelAdvancedVme.get();
|
|
|
|
}
|
|
|
|
if (supportsAdvancedVme) {
|
2017-12-21 07:45:38 +08:00
|
|
|
deviceExtensions += "cl_intel_advanced_motion_estimation ";
|
|
|
|
}
|
|
|
|
|
2019-09-02 23:12:26 +08:00
|
|
|
if (hwInfo.capabilityTable.ftrSupportsInteger64BitAtomics) {
|
|
|
|
deviceExtensions += "cl_khr_int64_base_atomics ";
|
|
|
|
deviceExtensions += "cl_khr_int64_extended_atomics ";
|
|
|
|
}
|
|
|
|
|
2020-01-08 22:15:01 +08:00
|
|
|
if (hwInfo.capabilityTable.supportsImages) {
|
|
|
|
deviceExtensions += "cl_khr_image2d_from_buffer ";
|
|
|
|
deviceExtensions += "cl_khr_depth_images ";
|
|
|
|
deviceExtensions += "cl_intel_media_block_io ";
|
2020-02-14 21:07:31 +08:00
|
|
|
deviceExtensions += "cl_khr_3d_image_writes ";
|
2020-01-08 22:15:01 +08:00
|
|
|
}
|
|
|
|
|
2020-01-21 20:43:34 +08:00
|
|
|
auto sharingAllowed = (HwHelper::getSubDevicesCount(&hwInfo) == 1u);
|
|
|
|
if (sharingAllowed) {
|
|
|
|
deviceExtensions += sharingFactory.getExtensions();
|
|
|
|
}
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-25 19:44:40 +08:00
|
|
|
deviceExtensions += hwHelper.getExtensions();
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
deviceInfo.deviceExtensions = deviceExtensions.c_str();
|
|
|
|
|
|
|
|
exposedBuiltinKernels = builtInKernels;
|
2019-09-06 18:30:35 +08:00
|
|
|
|
|
|
|
if (supportsVme) {
|
2017-12-21 07:45:38 +08:00
|
|
|
exposedBuiltinKernels.append("block_motion_estimate_intel;");
|
|
|
|
}
|
2019-09-06 18:30:35 +08:00
|
|
|
if (supportsAdvancedVme) {
|
2017-12-21 07:45:38 +08:00
|
|
|
auto advVmeKernels = "block_advanced_motion_estimate_check_intel;block_advanced_motion_estimate_bidirectional_check_intel;";
|
|
|
|
exposedBuiltinKernels.append(advVmeKernels);
|
|
|
|
}
|
|
|
|
|
|
|
|
deviceInfo.builtInKernels = exposedBuiltinKernels.c_str();
|
|
|
|
|
|
|
|
deviceInfo.deviceType = CL_DEVICE_TYPE_GPU;
|
|
|
|
deviceInfo.endianLittle = 1;
|
2019-12-10 23:47:41 +08:00
|
|
|
deviceInfo.hostUnifiedMemory = (false == hwHelper.isLocalMemoryEnabled(hwInfo));
|
2017-12-21 07:45:38 +08:00
|
|
|
deviceInfo.deviceAvailable = CL_TRUE;
|
|
|
|
deviceInfo.compilerAvailable = CL_TRUE;
|
2020-02-06 20:33:30 +08:00
|
|
|
deviceInfo.parentDevice = nullptr;
|
|
|
|
deviceInfo.partitionMaxSubDevices = HwHelper::getSubDevicesCount(&hwInfo);
|
2020-02-21 19:49:10 +08:00
|
|
|
if (deviceInfo.partitionMaxSubDevices > 1) {
|
|
|
|
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 20:33:30 +08:00
|
|
|
deviceInfo.partitionType[0] = 0;
|
2018-01-24 19:00:27 +08:00
|
|
|
deviceInfo.preferredVectorWidthChar = 16;
|
|
|
|
deviceInfo.preferredVectorWidthShort = 8;
|
|
|
|
deviceInfo.preferredVectorWidthInt = 4;
|
|
|
|
deviceInfo.preferredVectorWidthLong = 1;
|
|
|
|
deviceInfo.preferredVectorWidthFloat = 1;
|
2017-12-21 07:45:38 +08:00
|
|
|
deviceInfo.preferredVectorWidthDouble = 1;
|
2018-01-24 19:00:27 +08:00
|
|
|
deviceInfo.preferredVectorWidthHalf = 8;
|
|
|
|
deviceInfo.nativeVectorWidthChar = 16;
|
|
|
|
deviceInfo.nativeVectorWidthShort = 8;
|
|
|
|
deviceInfo.nativeVectorWidthInt = 4;
|
|
|
|
deviceInfo.nativeVectorWidthLong = 1;
|
|
|
|
deviceInfo.nativeVectorWidthFloat = 1;
|
|
|
|
deviceInfo.nativeVectorWidthDouble = 1;
|
|
|
|
deviceInfo.nativeVectorWidthHalf = 8;
|
2018-02-05 20:32:14 +08:00
|
|
|
deviceInfo.maxReadWriteImageArgs = 128;
|
2018-01-24 19:00:27 +08:00
|
|
|
deviceInfo.executionCapabilities = CL_EXEC_KERNEL;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
//copy system info to prevent misaligned reads
|
2019-05-08 22:00:24 +08:00
|
|
|
const auto systemInfo = hwInfo.gtSystemInfo;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
deviceInfo.globalMemCacheSize = systemInfo.L3BankCount * 128 * KB;
|
2019-12-17 15:55:09 +08:00
|
|
|
deviceInfo.grfSize = hwInfo.capabilityTable.grfSize;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
deviceInfo.globalMemCacheType = CL_READ_WRITE_CACHE;
|
|
|
|
deviceInfo.memBaseAddressAlign = 1024;
|
|
|
|
deviceInfo.minDataTypeAlignSize = 128;
|
|
|
|
|
|
|
|
deviceInfo.maxOnDeviceEvents = 1024;
|
|
|
|
deviceInfo.queueOnDeviceMaxSize = 64 * MB;
|
|
|
|
deviceInfo.queueOnDevicePreferredSize = 128 * KB;
|
|
|
|
deviceInfo.queueOnDeviceProperties = CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
|
|
|
|
|
|
|
|
deviceInfo.preferredInteropUserSync = 1u;
|
|
|
|
|
|
|
|
// OpenCL 1.2 requires 128MB minimum
|
2018-06-08 22:42:29 +08:00
|
|
|
|
2020-03-12 16:33:20 +08:00
|
|
|
deviceInfo.maxConstantBufferSize = sharedDeviceInfo.maxMemAllocSize;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
deviceInfo.maxWorkItemDimensions = 3;
|
|
|
|
|
|
|
|
deviceInfo.maxComputUnits = systemInfo.EUCount;
|
|
|
|
deviceInfo.maxConstantArgs = 8;
|
2019-07-15 17:13:40 +08:00
|
|
|
deviceInfo.maxSliceCount = systemInfo.SliceCount;
|
2020-01-28 01:02:27 +08:00
|
|
|
auto simdSizeUsed = DebugManager.flags.UseMaxSimdSizeToDeduceMaxWorkgroupSize.get() ? 32u : hwHelper.getMinimalSIMDSize();
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
// calculate a maximum number of subgroups in a workgroup (for the required SIMD size)
|
2020-03-12 16:33:20 +08:00
|
|
|
deviceInfo.maxNumOfSubGroups = static_cast<uint32_t>(sharedDeviceInfo.maxWorkGroupSize / simdSizeUsed);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-06-05 21:39:17 +08:00
|
|
|
deviceInfo.singleFpConfig |= defaultFpFlags;
|
|
|
|
|
|
|
|
deviceInfo.halfFpConfig = defaultFpFlags;
|
|
|
|
|
2020-03-12 16:33:20 +08:00
|
|
|
printDebugString(DebugManager.flags.PrintDebugMessages.get(), stderr, "computeUnitsUsedForScratch: %d\n", sharedDeviceInfo.computeUnitsUsedForScratch);
|
2020-03-06 01:13:32 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
printDebugString(DebugManager.flags.PrintDebugMessages.get(), stderr, "hwInfo: {%d, %d}: (%d, %d, %d)\n",
|
|
|
|
systemInfo.EUCount,
|
|
|
|
systemInfo.ThreadCount,
|
|
|
|
systemInfo.MaxEuPerSubSlice,
|
|
|
|
systemInfo.MaxSlicesSupported,
|
|
|
|
systemInfo.MaxSubSlicesSupported);
|
|
|
|
|
|
|
|
deviceInfo.localMemType = CL_LOCAL;
|
|
|
|
|
2020-03-06 01:13:32 +08:00
|
|
|
deviceInfo.image3DMaxWidth = this->getHardwareCapabilities().image3DMaxWidth;
|
|
|
|
deviceInfo.image3DMaxHeight = this->getHardwareCapabilities().image3DMaxHeight;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
// cl_khr_image2d_from_buffer
|
2019-08-23 06:23:10 +08:00
|
|
|
deviceInfo.imagePitchAlignment = hwHelper.getPitchAlignmentForImage(&hwInfo);
|
2017-12-21 07:45:38 +08:00
|
|
|
deviceInfo.imageBaseAddressAlignment = 4;
|
|
|
|
deviceInfo.maxPipeArgs = 16;
|
|
|
|
deviceInfo.pipeMaxPacketSize = 1024;
|
|
|
|
deviceInfo.pipeMaxActiveReservations = 1;
|
|
|
|
deviceInfo.queueOnHostProperties = CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
|
|
|
|
|
|
|
|
deviceInfo.linkerAvailable = true;
|
|
|
|
deviceInfo.svmCapabilities = hwInfo.capabilityTable.ftrSvm * CL_DEVICE_SVM_COARSE_GRAIN_BUFFER;
|
2020-03-23 15:55:55 +08:00
|
|
|
if (hwInfo.capabilityTable.ftrSvm) {
|
|
|
|
auto reportFineGrained = hwInfo.capabilityTable.ftrSvm * hwInfo.capabilityTable.ftrSupportsCoherency;
|
|
|
|
if (DebugManager.flags.ForceFineGrainedSVMSupport.get() != -1) {
|
|
|
|
reportFineGrained = !!DebugManager.flags.ForceFineGrainedSVMSupport.get();
|
|
|
|
}
|
|
|
|
if (reportFineGrained) {
|
|
|
|
deviceInfo.svmCapabilities |= static_cast<cl_device_svm_capabilities>(CL_DEVICE_SVM_FINE_GRAIN_BUFFER | CL_DEVICE_SVM_ATOMICS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
deviceInfo.preemptionSupported = false;
|
2020-03-20 17:35:59 +08:00
|
|
|
deviceInfo.maxGlobalVariableSize = 64 * KB;
|
2020-03-12 16:33:20 +08:00
|
|
|
deviceInfo.globalVariablePreferredTotalSize = static_cast<size_t>(sharedDeviceInfo.maxMemAllocSize);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
deviceInfo.planarYuvMaxWidth = 16384;
|
2019-01-17 18:23:38 +08:00
|
|
|
deviceInfo.planarYuvMaxHeight = 16352;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
deviceInfo.vmeAvcSupportsTextureSampler = hwInfo.capabilityTable.ftrSupportsVmeAvcTextureSampler;
|
2019-07-12 17:40:15 +08: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 07:45:38 +08:00
|
|
|
deviceInfo.platformHostTimerResolution = getPlatformHostTimerResolution();
|
|
|
|
|
|
|
|
deviceInfo.internalDriverVersion = CL_DEVICE_DRIVER_VERSION_INTEL_NEO1;
|
2018-02-20 00:23:31 +08:00
|
|
|
|
|
|
|
deviceInfo.preferredGlobalAtomicAlignment = MemoryConstants::cacheLineSize;
|
|
|
|
deviceInfo.preferredLocalAtomicAlignment = MemoryConstants::cacheLineSize;
|
|
|
|
deviceInfo.preferredPlatformAtomicAlignment = MemoryConstants::cacheLineSize;
|
2018-04-06 20:25:22 +08:00
|
|
|
|
2019-07-12 20:41:32 +08:00
|
|
|
deviceInfo.hostMemCapabilities = hwInfoConfig->getHostMemCapabilities();
|
|
|
|
deviceInfo.deviceMemCapabilities = hwInfoConfig->getDeviceMemCapabilities();
|
|
|
|
deviceInfo.singleDeviceSharedMemCapabilities = hwInfoConfig->getSingleDeviceSharedMemCapabilities();
|
|
|
|
deviceInfo.crossDeviceSharedMemCapabilities = hwInfoConfig->getCrossDeviceSharedMemCapabilities();
|
|
|
|
deviceInfo.sharedSystemMemCapabilities = hwInfoConfig->getSharedSystemMemCapabilities();
|
2019-09-04 22:05:27 +08:00
|
|
|
if (DebugManager.flags.EnableSharedSystemUsmSupport.get() != -1) {
|
|
|
|
if (DebugManager.flags.EnableSharedSystemUsmSupport.get() == 0) {
|
|
|
|
deviceInfo.sharedSystemMemCapabilities = 0u;
|
|
|
|
} else {
|
|
|
|
deviceInfo.sharedSystemMemCapabilities = CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ACCESS_INTEL | CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ATOMIC_ACCESS_INTEL;
|
|
|
|
}
|
|
|
|
}
|
2020-03-06 01:13:32 +08:00
|
|
|
|
|
|
|
initializeExtraCaps();
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
2020-01-14 21:32:11 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|