2018-01-16 01:16:50 +08:00
|
|
|
/*
|
2020-01-08 22:15:01 +08:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2018-01-16 01:16:50 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-01-16 01:16:50 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/platform/extensions.h"
|
2018-01-16 01:16:50 +08:00
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/hw_info.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-01-16 01:16:50 +08:00
|
|
|
|
2020-02-14 21:07:31 +08:00
|
|
|
const char *deviceExtensionsList = "cl_khr_byte_addressable_store "
|
2018-01-16 01:16:50 +08:00
|
|
|
"cl_khr_fp16 "
|
|
|
|
"cl_khr_global_int32_base_atomics "
|
|
|
|
"cl_khr_global_int32_extended_atomics "
|
|
|
|
"cl_khr_icd "
|
|
|
|
"cl_khr_local_int32_base_atomics "
|
|
|
|
"cl_khr_local_int32_extended_atomics "
|
|
|
|
"cl_intel_subgroups "
|
|
|
|
"cl_intel_required_subgroup_size "
|
|
|
|
"cl_intel_subgroups_short "
|
|
|
|
"cl_khr_spir "
|
|
|
|
"cl_intel_accelerator "
|
|
|
|
"cl_intel_driver_diagnostics "
|
2018-01-29 18:18:34 +08:00
|
|
|
"cl_khr_priority_hints "
|
2018-02-13 18:41:32 +08:00
|
|
|
"cl_khr_throttle_hints "
|
2020-02-06 22:10:59 +08:00
|
|
|
"cl_khr_create_command_queue "
|
|
|
|
"cl_intel_subgroups_char "
|
|
|
|
"cl_intel_subgroups_long ";
|
2018-01-16 01:16:50 +08:00
|
|
|
|
|
|
|
std::string getExtensionsList(const HardwareInfo &hwInfo) {
|
|
|
|
std::string allExtensionsList;
|
|
|
|
allExtensionsList.reserve(1000);
|
|
|
|
|
|
|
|
allExtensionsList.append(deviceExtensionsList);
|
|
|
|
|
|
|
|
if (hwInfo.capabilityTable.clVersionSupport >= 21) {
|
|
|
|
allExtensionsList += "cl_khr_subgroups ";
|
|
|
|
allExtensionsList += "cl_khr_il_program ";
|
2019-12-12 23:48:58 +08:00
|
|
|
if (hwInfo.capabilityTable.supportsVme) {
|
|
|
|
allExtensionsList += "cl_intel_spirv_device_side_avc_motion_estimation ";
|
|
|
|
}
|
2020-01-08 22:15:01 +08:00
|
|
|
if (hwInfo.capabilityTable.supportsImages) {
|
|
|
|
allExtensionsList += "cl_intel_spirv_media_block_io ";
|
|
|
|
}
|
2018-12-17 17:03:08 +08:00
|
|
|
allExtensionsList += "cl_intel_spirv_subgroups ";
|
2019-03-18 21:12:57 +08:00
|
|
|
allExtensionsList += "cl_khr_spirv_no_integer_wrap_decoration ";
|
2018-01-16 01:16:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (hwInfo.capabilityTable.ftrSupportsFP64) {
|
|
|
|
allExtensionsList += "cl_khr_fp64 ";
|
|
|
|
}
|
|
|
|
|
2019-08-20 21:17:10 +08:00
|
|
|
if (hwInfo.capabilityTable.ftrSupportsInteger64BitAtomics) {
|
|
|
|
allExtensionsList += "cl_khr_int64_base_atomics ";
|
|
|
|
allExtensionsList += "cl_khr_int64_extended_atomics ";
|
|
|
|
}
|
|
|
|
|
2020-02-14 21:07:31 +08:00
|
|
|
if (hwInfo.capabilityTable.supportsImages) {
|
|
|
|
allExtensionsList += "cl_khr_3d_image_writes ";
|
|
|
|
}
|
|
|
|
|
2019-07-18 22:46:35 +08:00
|
|
|
if (hwInfo.capabilityTable.supportsVme) {
|
|
|
|
allExtensionsList += "cl_intel_motion_estimation cl_intel_device_side_avc_motion_estimation ";
|
|
|
|
}
|
|
|
|
|
2018-01-16 01:16:50 +08:00
|
|
|
return allExtensionsList;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string removeLastSpace(std::string &processedString) {
|
|
|
|
if (processedString.size() > 0) {
|
|
|
|
if (*processedString.rbegin() == ' ') {
|
|
|
|
processedString.pop_back();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return processedString;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string convertEnabledExtensionsToCompilerInternalOptions(const char *enabledExtensions) {
|
|
|
|
std::string extensionsList = enabledExtensions;
|
|
|
|
extensionsList.reserve(1000);
|
|
|
|
removeLastSpace(extensionsList);
|
|
|
|
std::string::size_type pos = 0;
|
|
|
|
while ((pos = extensionsList.find(" ", pos)) != std::string::npos) {
|
|
|
|
extensionsList.replace(pos, 1, ",+");
|
|
|
|
}
|
2020-02-14 21:07:31 +08:00
|
|
|
extensionsList = " -cl-ext=-all,+" + extensionsList + ",+cl_khr_3d_image_writes ";
|
|
|
|
|
2018-01-16 01:16:50 +08:00
|
|
|
return extensionsList;
|
|
|
|
}
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|