aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG87
-rw-r--r--MAINTAINERS32
-rw-r--r--README459
-rw-r--r--README.md36
-rw-r--r--README.sources17
-rw-r--r--SECURITY.md6
-rw-r--r--classes/uefi-comboapp.bbclass6
-rw-r--r--conf/include/maintainers.inc97
-rw-r--r--conf/layer.conf11
-rw-r--r--conf/machine/include/intel-common-pkgarch.inc26
-rw-r--r--conf/machine/include/intel-core2-32-common.inc4
-rw-r--r--conf/machine/include/intel-corei7-64-common.inc4
-rw-r--r--conf/machine/include/meta-intel.inc31
-rw-r--r--conf/machine/include/qemu-intel.inc2
-rw-r--r--conf/machine/include/qemuboot-intel.inc25
-rw-r--r--conf/machine/include/tune-skylake.inc48
-rw-r--r--conf/machine/intel-core2-32.conf2
-rw-r--r--conf/machine/intel-corei7-64.conf5
-rw-r--r--conf/machine/intel-skylake-64.conf9
-rw-r--r--custom-licenses/EULA392
-rw-r--r--custom-licenses/ISSL136
-rw-r--r--custom-licenses/syrah32
-rw-r--r--documentation/building_and_booting.md134
-rw-r--r--documentation/dpcpp-compiler.md107
-rw-r--r--documentation/openvino.md95
-rw-r--r--documentation/reporting_bugs.md22
-rw-r--r--documentation/secureboot/README38
-rw-r--r--documentation/submitting_patches.md26
-rw-r--r--documentation/tested_hardware.md24
-rw-r--r--dynamic-layers/clang-layer/recipes-core/dnn/files/fix-gcc-11-failures.patch38
-rw-r--r--dynamic-layers/clang-layer/recipes-core/dnn/onednn_3.4.1.bb (renamed from dynamic-layers/clang-layer/recipes-core/dnn/onednn_2.2.3.bb)21
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/0001-Fix-debug-info-of-work-item-builtin-translation-745.patch119
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/0001-Memory-leak-fix-for-Managed-Static-Mutex.patch35
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/0002-Add-cl_khr_extended_subgroup-extensions.patch812
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/BasicBlockUtils-Add-metadata-fixing-in-SplitBlockPre.patch111
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/IndVarSimplify-Do-not-use-SCEV-expander-for-IVCount-.patch146
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/fix-shared-libs.patch30
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-OpenCL-3.0-support.patch8259
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-Remove-repo-name-in-LLVM-IR.patch50
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-skip-building-tests.patch51
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-OpenCL-3.0-support.patch8453
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-Remove-repo-name-in-LLVM-IR.patch50
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-skip-building-tests.patch51
-rw-r--r--dynamic-layers/clang-layer/recipes-devtools/clang/llvm-project-source.bbappend35
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime/allow-to-find-cpp-generation-tool.patch71
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime/disable-werror.patch16
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime/external-ocloc.patch40
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime_21.04.18912.bb56
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime_24.13.29138.7.bb64
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-BiF-CMakeLists.txt-remove-opt-from-DEPENDS.patch35
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-Fix-build-with-LLVM-12.patch2433
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-external-SPIRV-Tools-change-path-to-tools-and-header.patch31
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-fix-tblgen.patch24
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-skip-execution-of-ElfPackager.patch43
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-Review-fixes-for-LLVM-12-phase-1.patch318
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/0003-Improve-Reproducibility-for-src-package.patch (renamed from dynamic-layers/clang-layer/recipes-opencl/igc/files/improve_src_package_reproducibility.patch)10
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/0003-Review-fixes-for-LLVM-12-phase-2.patch123
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/link-to-LLVMGenXIntrinsics.patch71
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.16510.2.bb75
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.6646.bb45
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0001-Building-in-tree-with-LLVM-10.0-with-the-LLVM_LINK_L.patch35
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0001-cl_headers-CMakeLists.txt-use-clang-from-native-sysr.patch49
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0001-don-t-redefine-LLVM_TABLEGEN_EXE.patch32
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0002-Request-native-clang-only-when-cross-compiling-464.patch60
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0002-make-sure-only-static-libraries-linked-for-native-bu.patch42
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang.inc (renamed from dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_11.0.0.bb)21
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_10.0.0.bb35
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_12.0.0.bb34
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_14.0.0.bb5
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_15.0.0.bb5
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/vc-intrinsics/vc-intrinsics_1.0.bb24
-rw-r--r--dynamic-layers/meta-python/recipes-opencv/dldt/openvino-model-optimizer_2024.1.0.bb (renamed from dynamic-layers/meta-python/recipes-opencv/dldt/openvino-model-optimizer_2021.3.bb)24
-rw-r--r--dynamic-layers/openembedded-layer/recipes-bsp/amt/lms_2406.0.0.0.bb (renamed from dynamic-layers/openembedded-layer/recipes-bsp/amt/lms_2109.0.0.0.bb)26
-rw-r--r--dynamic-layers/openembedded-layer/recipes-bsp/thermald/files/0001-Makefile-Fix-build-Issue.patch35
-rw-r--r--dynamic-layers/openembedded-layer/recipes-bsp/thermald/thermald_2.5.7.bb (renamed from dynamic-layers/openembedded-layer/recipes-bsp/thermald/thermald_2.4.4.bb)17
-rw-r--r--dynamic-layers/openembedded-layer/recipes-core/ispc/ispc/0001-Add-print-function-to-print-test-run-status-in-ptest.patch53
-rw-r--r--dynamic-layers/openembedded-layer/recipes-core/ispc/ispc/0001-Fix-QA-Issues.patch36
-rw-r--r--dynamic-layers/openembedded-layer/recipes-core/ispc/ispc/0002-cmake-don-t-build-for-32-bit-targets.patch52
-rw-r--r--dynamic-layers/openembedded-layer/recipes-core/ispc/ispc/run-ptest2
-rw-r--r--dynamic-layers/openembedded-layer/recipes-core/ispc/ispc_1.23.0.bb64
-rw-r--r--dynamic-layers/openembedded-layer/recipes-core/levelzero/level-zero_1.15.8.bb (renamed from dynamic-layers/openembedded-layer/recipes-core/levelzero/level-zero_1.2.3.bb)20
-rw-r--r--dynamic-layers/openembedded-layer/recipes-oneapi/dpcpp-compiler/intel-oneapi-dpcpp-cpp-runtime_2024.0.0-49819.bb54
-rw-r--r--dynamic-layers/openembedded-layer/recipes-oneapi/dpcpp-compiler/intel-oneapi-dpcpp-cpp_2024.0.0-49819.bb45
-rw-r--r--dynamic-layers/openembedded-layer/recipes-oneapi/embree/embree_4.3.1.bb30
-rw-r--r--dynamic-layers/openembedded-layer/recipes-oneapi/ipp/intel-oneapi-ipp_2021.10.0-653.bb35
-rw-r--r--dynamic-layers/openembedded-layer/recipes-oneapi/mkl/intel-oneapi-mkl_2024.0.0-49656.bb74
-rw-r--r--dynamic-layers/openembedded-layer/recipes-oneapi/oidn/oidn_2.1.0.bb23
-rw-r--r--dynamic-layers/openembedded-layer/recipes-oneapi/openvkl/openvkl_2.0.1.bb42
-rw-r--r--dynamic-layers/openembedded-layer/recipes-oneapi/ospray/ospray/0001-Fix-GCC11-Compile-Error-in-benchmark_register.h.patch28
-rw-r--r--dynamic-layers/openembedded-layer/recipes-oneapi/ospray/ospray_3.1.0.bb37
-rw-r--r--dynamic-layers/openembedded-layer/recipes-oneapi/rkcommon/rkcommon_1.13.0.bb19
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl/0001-CMakeLists-disable-Werror.patch38
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl/0001-Ignore-STATIC_ASSERTs-and-NULL-define-for-os-and-ut-builds.patch (renamed from dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl/0001-Ignore-STATIC_ASSERT-and-NULL-definition-so-we-can-c.patch)55
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl_03.00.00.0485.bb (renamed from dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl_03.00.00.0341.bb)24
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-cmake-yocto-specific-tweaks-to-the-build-process.patch86
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-dont-install-licenses-and-version-file.patch54
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-inference-engine-use-system-installed-packages.patch193
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-plugin_api-fix-build-with-gcc-11.patch36
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/files/0002-cldNN-disable-Werror.patch30
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/files/0002-cmake-Fix-overloaded-virtual-error.patch33
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/files/0003-inference-engine-installation-fixes.patch261
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/files/0003-protobuf-allow-target-protoc-to-be-built.patch45
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo/0001-use-oe-gflags.patch32
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo_2021.3.bb66
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo_2024.1.0.bb54
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/openvino-inference-engine_2021.3.bb124
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/openvino-inference-engine_2024.1.0.bb146
-rw-r--r--lib/oeqa/runtime/cases/jhi.py41
-rw-r--r--lib/oeqa/runtime/cases/parselogs-ignores-intel-core2-32.txt9
-rw-r--r--lib/oeqa/runtime/cases/parselogs-ignores-intel-corei7-64.txt14
-rw-r--r--recipes-bsp/formfactor/formfactor_0.0.bbappend2
-rw-r--r--recipes-bsp/intel-cmt-cat/intel-cmt-cat_23.11.1.bb29
-rw-r--r--recipes-bsp/metee/metee_3.2.4.bb (renamed from recipes-bsp/metee/metee_3.1.0.bb)5
-rw-r--r--recipes-core/images/core-image-minimal-initramfs.bbappend2
-rw-r--r--recipes-core/images/core-image-tiny.bb4
-rw-r--r--recipes-core/libxcam/libxcam/0001-fake_v4l2_device.h-fix-narrowing-warning.patch94
-rw-r--r--recipes-core/libxcam/libxcam_1.5.0.bb15
-rw-r--r--recipes-core/meta/icx-environment.inc15
-rw-r--r--recipes-core/meta/meta-environment-extsdk.bbappend3
-rw-r--r--recipes-core/meta/meta-environment.bbappend3
-rw-r--r--recipes-core/microcode/intel-microcode_20240312.bb (renamed from recipes-core/microcode/intel-microcode_20210608.bb)11
-rw-r--r--recipes-core/microcode/iucode-tool_2.3.1.bb6
-rw-r--r--recipes-core/ovmf/files/0001-ovmf-RefkitTestCA-TEST-UEFI-SecureBoot.patch55
-rw-r--r--recipes-core/ovmf/ovmf-shell-image-enrollkeys.bb4
-rw-r--r--recipes-core/ovmf/ovmf_%.bbappend6
-rw-r--r--recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend1
-rw-r--r--recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bbappend1
-rw-r--r--recipes-core/zlib/zlib-intel_1.2.11.1.jtkv6.3.bb18
-rw-r--r--recipes-devtools/slimboot/slimboot-tools_git.bb6
-rw-r--r--recipes-graphics/gmmlib/files/0001-Add-new-DG2-device-IDs-194.patch34
-rw-r--r--recipes-graphics/gmmlib/gmmlib_22.3.18.bb (renamed from recipes-graphics/gmmlib/gmmlib_21.1.1.bb)9
-rw-r--r--recipes-graphics/hdcp/hdcp/0001-main-fix-hdcpd-service-failure.patch2
-rw-r--r--recipes-graphics/hdcp/hdcp_21.2.0.bb (renamed from recipes-graphics/hdcp/hdcp_21.1.0.bb)6
-rw-r--r--recipes-graphics/libva/libva-intel-utils_2.21.0.bb (renamed from recipes-graphics/libva/libva-intel-utils_2.11.1.bb)6
-rw-r--r--recipes-graphics/libva/libva-intel_2.21.0.bb (renamed from recipes-graphics/libva/libva-intel_2.11.0.bb)26
-rw-r--r--recipes-graphics/metrics-discovery/metrics-discovery/0001-md_internal.h-Replace-string.h-with-string-C-header-.patch34
-rw-r--r--recipes-graphics/metrics-discovery/metrics-discovery_1.12.171.bb (renamed from recipes-graphics/metrics-discovery/metrics-discovery_1.5.108.bb)5
-rw-r--r--recipes-graphics/xorg-driver/xf86-video-ast_1.1.6.bb (renamed from recipes-graphics/xorg-driver/xf86-video-ast_1.1.5.bb)4
-rw-r--r--recipes-kernel/intel-ethernet/ixgbe_5.19.6.bb (renamed from recipes-kernel/intel-ethernet/ixgbe_5.11.3.bb)17
-rw-r--r--recipes-kernel/intel-ethernet/ixgbevf_4.18.7.bb (renamed from recipes-kernel/intel-ethernet/ixgbevf_4.11.1.bb)19
-rw-r--r--recipes-kernel/iwlwifi/backport-iwlwifi_git.bb20
-rw-r--r--recipes-kernel/linux/linux-intel-dev.bb34
-rw-r--r--recipes-kernel/linux/linux-intel-rt_5.10.bb35
-rw-r--r--recipes-kernel/linux/linux-intel-rt_5.4.bb30
-rw-r--r--recipes-kernel/linux/linux-intel-rt_6.6.bb33
-rw-r--r--recipes-kernel/linux/linux-intel.inc20
-rw-r--r--recipes-kernel/linux/linux-intel/0001-lib-build_OID_registry-fix-reproducibility-issues.patch48
-rw-r--r--recipes-kernel/linux/linux-intel/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch30
-rw-r--r--recipes-kernel/linux/linux-intel/0001-vt-conmakehash-improve-reproducibility.patch58
-rw-r--r--recipes-kernel/linux/linux-intel/0002-mconf-fix-output-of-cflags-and-libraries.patch40
-rw-r--r--recipes-kernel/linux/linux-intel/disable_skylake_sound.cfg7
-rw-r--r--recipes-kernel/linux/linux-intel/enable_lynxpoint_gpio.cfg1
-rw-r--r--recipes-kernel/linux/linux-intel/fix-perf-reproducibility.patch39
-rw-r--r--recipes-kernel/linux/linux-intel_5.10.bb32
-rw-r--r--recipes-kernel/linux/linux-intel_5.4.bb26
-rw-r--r--recipes-kernel/linux/linux-intel_6.6.bb21
-rw-r--r--recipes-kernel/linux/linux-intel_6.8.bb20
-rw-r--r--recipes-kernel/linux/linux-yocto-dev.bbappend22
-rw-r--r--recipes-kernel/linux/linux-yocto-rt_%.bbappend (renamed from recipes-kernel/linux/linux-yocto-rt_5.%.bbappend)0
-rw-r--r--recipes-kernel/linux/linux-yocto_%.bbappend4
-rw-r--r--recipes-kernel/linux/linux-yocto_5.%.bbappend1
-rw-r--r--recipes-kernel/linux/meta-intel-compat-kernel.inc12
-rw-r--r--recipes-multimedia/itt/itt_3.24.7.bb (renamed from recipes-multimedia/itt/itt_3.18.13.bb)10
-rw-r--r--recipes-multimedia/libva/files/0001-Disable-vp9-padding-on-mtl.patch35
-rw-r--r--recipes-multimedia/libva/files/0001-changed-VPHAL_MAX_SOURCES-set-to-65.patch33
-rw-r--r--recipes-multimedia/libva/files/0002-Force-ARGB-surface-to-tile4-for-ACM.patch44
-rw-r--r--recipes-multimedia/libva/files/8aa866dc650e6b0e0b7425bafc7b1039232c377a.patch154
-rw-r--r--recipes-multimedia/libva/intel-media-driver_24.1.5.bb (renamed from recipes-multimedia/libva/intel-media-driver_21.1.3.bb)18
-rw-r--r--recipes-multimedia/libva/intel-vaapi-driver_2.4.1.bb6
-rw-r--r--recipes-multimedia/libyami/libyami-utils/0001-Fix-build-with-clang.patch96
-rw-r--r--recipes-multimedia/libyami/libyami-utils_1.3.2.bb26
-rw-r--r--recipes-multimedia/libyami/libyami_1.3.2.bb24
-rw-r--r--recipes-multimedia/mediasdk/files/0001-Don-t-try-to-autheticate-with-render-node.patch44
-rw-r--r--recipes-multimedia/mediasdk/files/fix-gcc13.patch15
-rw-r--r--recipes-multimedia/mediasdk/intel-mediasdk_23.2.2.bb (renamed from recipes-multimedia/mediasdk/intel-mediasdk_21.1.3.bb)20
-rw-r--r--recipes-multimedia/onevpl/onevpl-intel-gpu/0001-ADLP-add-new-device-id-list.patch43
-rw-r--r--recipes-multimedia/onevpl/onevpl-intel-gpu_2021.2.3.bb24
-rw-r--r--recipes-multimedia/onevpl/onevpl/0001-Add-SMT-and-media_sdk_compatibility_headers.patch12988
-rw-r--r--recipes-multimedia/onevpl/onevpl/0001-Add-X11-support-to-legacy-tools.patch50
-rw-r--r--recipes-multimedia/onevpl/onevpl/0001-Adding-Wayland-support-to-legacy-tools.patch1301
-rw-r--r--recipes-multimedia/onevpl/onevpl/0001-Remove-duplicate-MFXVideoDECODE_VPP-from-samples.patch62
-rw-r--r--recipes-multimedia/onevpl/onevpl/0001-Update-headers-to-oneAPI-spec-v2.3-e170992.patch741
-rw-r--r--recipes-multimedia/onevpl/onevpl/0001-cmake-Allow-build-env-to-set-variables.patch65
-rw-r--r--recipes-multimedia/onevpl/onevpl_2021.2.2.bb46
-rw-r--r--recipes-multimedia/vpl/files/0001-vpl.pc.in-dont-pass-pcfiledir-to-cflags.patch25
-rw-r--r--recipes-multimedia/vpl/libvpl_2.10.2.bb43
-rw-r--r--recipes-multimedia/vpl/vpl-gpu-rt_24.1.5.bb33
-rw-r--r--recipes-oneapi/crypto/intel-crypto-mb/0001-CMakeLists.txt-exclude-host-system-headers.patch27
-rw-r--r--recipes-oneapi/crypto/intel-crypto-mb/0001-crypto-mb-Make-sure-libs-are-installed-correctly.patch42
-rw-r--r--recipes-oneapi/crypto/intel-crypto-mb/0002-cmake-exclude-Yocto-build-flags.patch45
-rw-r--r--recipes-oneapi/crypto/intel-crypto-mb_2021.11.1.bb28
-rw-r--r--recipes-oneapi/onedpl/onedpl_2022.3.0.bb26
-rw-r--r--recipes-oneapi/setup-oneapi-env/files/intel-oneapi-runtime.conf4
-rw-r--r--recipes-oneapi/setup-oneapi-env/setup-intel-oneapi-env_2023.0.0-25370.bb20
-rw-r--r--recipes-selftest/images/secureboot-selftest-image-unsigned.bb4
-rw-r--r--recipes-support/isa-l/isa-l_2.31.0.bb (renamed from recipes-support/isa-l/isa-l_2.30.0.bb)8
-rw-r--r--recipes-support/jhi/jhi_1.41.bb72
-rw-r--r--recipes-support/libipt/libipt_2.1.1.bb (renamed from recipes-support/libipt/libipt_2.0.4.bb)13
-rw-r--r--recipes-support/sbsigntool/sbsigntool-native_git.bb16
-rw-r--r--recipes-support/sbsigntool/sbsigntool/0001-configure-Fixup-build-dependencies-for-cross-compili.patch2
200 files changed, 3875 insertions, 39381 deletions
diff --git a/CHANGELOG b/CHANGELOG
deleted file mode 100644
index a99cbb1f..00000000
--- a/CHANGELOG
+++ /dev/null
@@ -1,87 +0,0 @@
-This file will only list major changes that occur within a release.
-For a full list of changes, view the git log of the repository.
-
-Rocko Release 11/2017
-=====================
-
-Moved qat support to separate layer
------------------------------------
-Quick Assist Technology (QAT) is more middleware and should not be part of the
-core BSP. The new layer can be found here:
-https://git.yoctoproject.org/cgit/cgit.cgi/meta-intel-qat/
-
-Moved dpdk support to separate layer
-------------------------------------
-We had some requests to make DPDK standalone so that it could be included
-without bringing in anything else from meta-intel, as it is not specific to
-Intel(R) hardware. The new layer is located here:
-https://git.yoctoproject.org/cgit/cgit.cgi/meta-dpdk/
-
-Added support for out-of-tree iwlwifi drivers
----------------------------------------------
-Backport-iwlwifi out-of-tree wifi modules are now available via meta-intel.
-Backport-iwlwifi brings the latest iwlwifi drivers to almost any kernel
-Note that mac80211 and cfg80211 backports are also necessary, which will most
-likely cause incompatibility with other in-tree wifi drivers.
-See https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi for more info.
-
-Added support for out-of-tree ixgbe drivers
--------------------------------------------
-The out-of-tree ixgbe drivers bring ixgbe support to nearly any kernel. See
-here: http://www.intel.com/network/connectivity/products/server_adapters.htm
-
-Added an implementation of Secure Boot
---------------------------------------
-meta-intel now supports a simple Secure Boot implementation. This implementation
-consists of a single binary consisting of an EFI stub, the kernel, an
-initrd, and a kernel command line. The binary is then signed via keys defined by
-the variables SECUREBOOT_SIGNING_KEY and SECUREBOOT_SIGNING_CERT. These keys
-should match the keys embedded in your hardware's firmware.
-See documentation/secureboot/README for more information on this feature.
-
-Improved Yocto Project Compatibility status
--------------------------------------------
-The common layer should now be considered Yocto Project compatible - it should
-no longer modify OE-core values when adding the layer to your bblayers.conf.
-The meta-tlk layer is still not Yocto Project compatible, however.
-
-Pyro Release 5/2017
-===================
-
-Changed default kernel provider from linux-yocto to linux-intel.
-----------------------------------------------------------------
-Linux-intel is an Intel(R)-maintained kernel based on the latest stable
-branch, along with backports from upstream to better support Intel(R)
-hardware. The intel-linux kernel also has a branch with the preempt-rt
-patches applied, providing a preempt-rt kernel with no additional work.
-
-Added QEMU support.
--------------------
-We now build several virtio drivers into the kernel by default, and
-have qemuboot.conf files for intel-corei7-64 and intel-core2-32
-targets. This allows one to do basic testing on meta-intel images
-without having to use hardware. The virtio drivers are added via
-KERNEL_FEATURES_INTEL_COMMON. This prevents them from being added to
-custom kernels by default. They can be removed by adding the
-following to a conf or kernel bbappend file:
- KERNEL_FEATURES_INTEL_COMMON_remove = “cfg/virtio.scc”
-OVMF firmware is also built and can be used in order to emulate a UEFI
-environment. A full runqemu command line for intel-corei7-64 could look
-like this:
- runqemu core-image-minimal intel-corei7-64 wic ovmf
-
-Musl support
-------------
-Meta-intel is now compatible with the musl C library. You can specify musl
-As your C library by adding the following to your local.conf:
- TCLIBC = “musl”
-Note: there is a known failure with DPDK.
-
-X32 support
------------
-The meta-intel layer can now build with the x32 tune settings in a multi-lib
-setting, it will not work in as the primary MACHINE tune as the bootloader needs
-to be built as a 64bit binary. The setup for this would be as follows:
- require conf/multilib.conf
- MULTILIBS = "multilib:libx32
- DEFAULTTUNE_virtclass-multilib-libx32 = "corei7-64-x32"
diff --git a/MAINTAINERS b/MAINTAINERS
deleted file mode 100644
index 73a9fe3a..00000000
--- a/MAINTAINERS
+++ /dev/null
@@ -1,32 +0,0 @@
-This file contains a list of BSP maintainers for the BSPs contained in
-the meta-intel repository.
-
-The purpose of this file is to provide contact information for
-specific BSPs and other code contained within meta-intel. You should
-address questions and patches for a particular BSP or other code to
-the appropriate maintainer listed in this file, cc'ing the meta-intel
-mailing list. This ensures that your question or patch will be
-addressed by the appropriate person, and that it will be seen by other
-users who may be facing similar problems or questions.
-
-Please see the top-level README file for guidelines relating to the
-details of submitting patches, reporting problems, or asking questions
-about any of the BSPs or other recipes contained within meta-intel.
-
-Descriptions of section entries:
-
- M: Mail patches to: FullName <address@domain>
- F: Files and directories with wildcard patterns.
- A trailing slash includes all files and subdirectory files.
- F: common/ all files in and below common
- F: common/* all files in common, but not below
- One pattern per line. Multiple F: lines acceptable.
-
-Please keep this list in alphabetical order.
-
-Maintainers List (try to look for most precise areas first)
-
- -----------------------------------
-
-M: Anuj Mittal <anuj.mittal@intel.com>
-F: *
diff --git a/README b/README
deleted file mode 100644
index f377c67b..00000000
--- a/README
+++ /dev/null
@@ -1,459 +0,0 @@
-meta-intel
-==========
-
-This README file contains information on building and booting
-meta-intel BSP layers. Please see the corresponding sections below
-for details.
-
-
-Yocto Project Compatible
-========================
-
-The BSPs contained in this layer are compatible with the Yocto Project
-as per the requirements listed here:
-
- https://www.yoctoproject.org/webform/yocto-project-compatible-registration
-
-
-Dependencies
-============
-
-This layer depends on:
-
- URI: git://git.openembedded.org/bitbake
-
- URI: git://git.openembedded.org/openembedded-core
- layers: meta
- branch: master
-
-
-Table of Contents
-=================
-
- I. Overview
- II. Building and booting meta-intel BSP layers
- a. Building the intel-common BSP layers
- b. Booting the intel-common BSP images
- c. Building the installer image
- III. Technical Miscellany
- Benefits of using meta-intel
- The intel-common kernel package architecture
- Intel-specific machine features
- IV. Tested Hardware
- V. Guidelines for submitting patches
-
-
-I. Overview
-===========
-
-This is the location for Intel-maintained BSPs.
-
-For details on the intel-common, see the information below.
-
-For all others, please see the README files contained in the
-individual BSP layers for BSP-specific information.
-
-If you have problems with or questions about a particular BSP, please
-contact the maintainer listed in the MAINTAINERS file directly (cc:ing
-the Yocto mailing list puts it in the archive and helps other people
-who might have the same questions in the future), but please try to do
-the following first:
-
- - look in the Yocto Project Bugzilla
- (http://bugzilla.yoctoproject.org/) to see if a problem has
- already been reported
-
- - look through recent entries of the meta-intel
- (https://lists.yoctoproject.org/pipermail/meta-intel/) and Yocto
- (https://lists.yoctoproject.org/pipermail/yocto/) mailing list
- archives to see if other people have run into similar problems or
- had similar questions answered.
-
-If you believe you have encountered a bug, you can open a new bug and
-enter the details in the Yocto Project Bugzilla
-(http://bugzilla.yoctoproject.org/). If you're relatively certain
-that it's a bug against the BSP itself, please use the 'Yocto Project
-Components: BSPs | meta-intel' category for the bug; otherwise, please
-submit the bug against the most likely category for the problem - if
-you're wrong, it's not a big deal and the bug will be recategorized
-upon triage.
-
-
-II. Building and booting meta-intel BSP layers
-==============================================
-
-The following sections contain information on building and booting the
-BSPs contained in the meta-intel layer.
-
-Note that these instructions specifically cover the intel-common, which
-may or may not be applicable to other BSPs contained in this layer - if
-a given BSP contains its own README, that version should be used instead,
-and these instructions can be ignored.
-
-a. Building the intel-common BSP layers
--------------------------------------------------
-
-In order to build an image with BSP support for a given release, you
-need to download the corresponding BSP tarball from the 'Board Support
-Package (BSP) Downloads' page of the Yocto Project website (or
-equivalently, check out the appropriate branch from the meta-intel git
-repository, see below). For the intel-common BSPs, those tarballs would
-correspond to the following choices in the BSP downloads section:
-
- - Intel-core2-32 Intel® Common Core BSP (Intel-core2-32)
- - Intel-corei7-64 Intel® Common Core BSP (Intel-corei7-64)
-
-The intel-* BSPs, also known as the intel-common BSPs, provide a few
-carefully selected tune options and generic hardware support to cover
-the majority of current Intel CPUs and devices. The naming follows the
-convention of intel-<TUNE>-<BITS>, where TUNE is the gcc cpu-type
-(used with mtune and march typically) and BITS is either 32 bit or 64
-bit.
-
-Having done that, and assuming you extracted the BSP tarball contents
-at the top-level of your yocto build tree, you can build a BSP image
-by adding the location of the meta-intel layer to bblayers.conf e.g.:
-
- yocto/meta-intel \
-
-To enable a particular machine, you need to add a MACHINE line naming
-the BSP to the local.conf file:
-
- MACHINE ?= "xxx"
-
-where 'xxx' is replaced by one of the following BSP names:
-
- - intel-core2-32
-
- This BSP is optimized for the Core2 family of CPUs as well as all
- Atom CPUs prior to the Silvermont core.
-
- - intel-corei7-64
-
- This BSP is optimized for Nehalem and later Core and Xeon CPUs as
- well as Silvermont and later Atom CPUs, such as the Baytrail SoCs.
-
-You should then be able to build an image as such:
-
- $ source oe-init-build-env
- $ bitbake core-image-sato
-
-At the end of a successful build, you should have an image that
-you can boot from a USB flash drive (see instructions on how to do
-that below, in the section 'Booting the intel-common BSP images').
-
-As an alternative to downloading the BSP tarball, you can also work
-directly from the meta-intel git repository. For each BSP in the
-'meta-intel' repository, there are multiple branches, one
-corresponding to each major release starting with 'laverne' (0.90), in
-addition to the latest code which tracks the current master (note that
-not all BSPs are present in every release). Instead of extracting
-a BSP tarball at the top level of your yocto build tree, you can
-equivalently check out the appropriate branch from the meta-intel
-repository at the same location.
-
-b. Booting the intel-common BSP images
---------------------------------------
-
-If you've built your own image, either from the downloaded BSP layer
-or from the meta-intel git repository, you'll find the bootable
-image in the build/tmp/deploy/images/xxx directory, where again
-'xxx' refers to the machine name used in the build.
-
-Under Linux, insert a USB flash drive. Assuming the USB flash drive
-takes device /dev/sdf, use dd to copy the image to it. Before the image
-can be burned onto a USB drive, it should be un-mounted. Some Linux distros
-may automatically mount a USB drive when it is plugged in. Using USB device
-/dev/sdf as an example, find all mounted partitions:
-
- $ mount | grep sdf
-
-and un-mount those that are mounted, for example:
-
- $ umount /dev/sdf1
- $ umount /dev/sdf2
-
-Now burn the image onto the USB drive:
-
- $ sudo dd if=core-image-sato-intel-corei7-64.wic of=/dev/sdf status=progress
- $ sync
- $ eject /dev/sdf
-
-This should give you a bootable USB flash device. Insert the device
-into a bootable USB socket on the target, and power on. This should
-result in a system booted to the Sato graphical desktop.
-
-If you want a terminal, use the arrows at the top of the UI to move to
-different pages of available applications, one of which is named
-'Terminal'. Clicking that should give you a root terminal.
-
-If you want to ssh into the system, you can use the root terminal to
-ifconfig the IP address and use that to ssh in. The root password is
-empty, so to log in type 'root' for the user name and hit 'Enter' at
-the Password prompt: and you should be in.
-
-If you find you're getting corrupt images on the USB (it doesn't show
-the syslinux boot: prompt, or the boot: prompt contains strange
-characters), try doing this first:
-
- $ dd if=/dev/zero of=/dev/sdf bs=1M count=512
-
-c. Building the installer image
------------------------------------------------
-
-If you plan to install your image to your target machine, you can build a wic
-based installer image instead of default wic image. To build it, you need to
-add below configuration to local.conf :
-
- WKS_FILE = "image-installer.wks.in"
- IMAGE_FSTYPES_append = " ext4"
- IMAGE_TYPEDEP_wic = "ext4"
- INITRD_IMAGE_LIVE="core-image-minimal-initramfs"
- do_image_wic[depends] += "${INITRD_IMAGE_LIVE}:do_image_complete"
- do_rootfs[depends] += "virtual/kernel:do_deploy"
- IMAGE_BOOT_FILES_append = "\
- ${KERNEL_IMAGETYPE} \
- microcode.cpio \
- ${IMGDEPLOYDIR}/${IMAGE_BASENAME}-${MACHINE}.ext4;rootfs.img \
- ${@bb.utils.contains('EFI_PROVIDER', 'grub-efi', 'grub-efi-bootx64.efi;EFI/BOOT/bootx64.efi', '', d)} \
- ${@bb.utils.contains('EFI_PROVIDER', 'grub-efi', '${IMAGE_ROOTFS}/boot/EFI/BOOT/grub.cfg;EFI/BOOT/grub.cfg', '', d)} \
- ${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', 'systemd-bootx64.efi;EFI/BOOT/bootx64.efi', '', d)} \
- ${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', '${IMAGE_ROOTFS}/boot/loader/loader.conf;loader/loader.conf ', '', d)} \
- ${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', '${IMAGE_ROOTFS}/boot/loader/entries/boot.conf;loader/entries/boot.conf', '', d)} "
-
-Burn the wic image onto USB flash device, insert the device to target machine
-and power on. This should start the installation process.
-
-III. Technical Miscellany
-=========================
-
-Benefits of using meta-intel
-----------------------------
-
-Using meta-intel has the following benefits over a generic BSP:
-
-tune flags
-++++++++++
-intel-* MACHINEs each have different compilation flags appropriate for their
-targeted hardware sets. intel-corei7-64 has tune flags appropriate for modern
-64-bit Intel Core i microarchitecture, and includes instruction sets up to
-SSE4.2. intel-core2-32 has tune flags appropriate for legacy 32-bit Intel Core2
-microarchitecture, and includes instruction sets up to SSE3.
-
-linux-intel kernel
-++++++++++++++++++
-The linux-intel kernel is an initiative to bring better Intel(R) hardware
-support to the current LTS linux kernel. It contains a base LTS kernel with
-additional backports from upstream Intel drivers. In addition, a default kernel
-config containing most features found on Intel boards is supplied via the
-yocto-kernel-cache.
-
-graphics stack
-++++++++++++++
-Meta-intel provides the latest Intel Graphics Linux Stack drivers to support
-Intel hardware as defined by the https://01.org/linuxgraphics.
-
-Other software
-++++++++++++++
- * intel ucode - provides the latest microcode updates for Intel processors
-
- * thermald - which proactively controls thermal, using P-states, T-states, and
-the Intel power clamp driver.
-(https://01.org/linux-thermal-daemon/documentation/introduction-thermal-daemon)
-
-The intel-common kernel package architecture
---------------------------------------------
-
-These BSPs use what we call the intel-common Linux kernel package
-architecture. This includes core2-32-intel-common and
-corei7-64-intel-common. These kernel packages can also be used by any
-of the BSPs in meta-intel that choose to include the
-intel-common-pkgarch.inc file.
-
-To minimize the proliferation of vendor trees, reduce the sources we
-must support, and consolidate QA efforts, all BSP maintainers are
-encouraged to make use of the intel-common Linux kernel package
-architecture.
-
-Intel-specific machine features
--------------------------------
-
-The meta-intel layer makes some additional machine features available
-to BSPs. These machine features can be used in a BSP layer in the
-same way that machine features are used in other layers based on
-oe-core, via the MACHINE_FEATURES variable.
-
-Requirements
-++++++++++++
-
-The meta-intel-specific machine features are only available to a BSP
-when the meta-intel layer is included in the build configuration, and
-the meta-intel.inc file is included in the machine configuration of
-that BSP.
-
-To make these features available for your machine, you will need to:
-
- 1. include a configuration line such as the below in bblayers.conf
- BBLAYERS += "<local path>/meta-intel"
- 2. include the following line in the machine configuration file
- require conf/machine/include/meta-intel.inc
-
-Once the above requirements are met, the machine features provided by
-the meta-intel layer will be available for the BSP to use.
-
-Available machine features
-++++++++++++++++++++++++++
-
-Currently, the meta-intel layer makes the following set of
-Intel-specific machine features available:
-
- * intel-ucode
-
-These machine features can be included by listing them in the
-MACHINE_FEATURES variable in the machine configuration file. For
-example:
-
- MACHINE_FEATURES += "intel-ucode"
-
-Machine feature details
-+++++++++++++++++++++++
-
- * intel-ucode
-
- This feature provides support for microcode updates to Intel
- processors. The intel-ucode feature runs at early boot and uses
- the microcode data file added by the feature into the BSP's
- initrd. It also puts the userland microcode-updating tool,
- iucode_tool, into the target images along with the microcode data
- file.
-
- Q. Why might a user want to enable the intel-ucode feature?
-
- A. Intel releases microcode updates to correct processor behavior
- as documented in the respective processor specification
- updates. While the normal approach to getting such microcode
- updates is via a BIOS upgrade, this can be an administrative
- hassle and not always possible in the field. The intel-ucode
- feature enables the microcode update capability present in the
- Linux kernel. It provides an easy path for upgrading processor
- microcode without the need to change the BIOS. If the feature
- is enabled, it is also possible to update the existing target
- images with a newer microcode update in the future.
-
- Q. How would a user bundle only target-specific microcode in the
- target image?
-
- A. The Intel microcode data file released by Intel contains
- microcode updates for multiple processors. If the BSP image is
- meant to run on only a certain subset of processor types, a
- processor-specific subset of microcode can be bundled into the
- target image via the UCODE_FILTER_PARAMETERS variable. This
- works by listing a sequence of iucode-tool parameters in the
- UCODE_FILTER_PARAMETERS variable, which in this case will
- select only the specific microcode relevant to the BSP. For
- more information on the underlying parameters refer to the
- iucode-tool manual page at http://manned.org/iucode-tool
-
- To define a set of parameters for microcode-filtering via the
- UCODE_FILTER_PARAMETERS variable, one needs to identify the
- cpuid signatures of all the processors the BSP is meant to run
- on. One way to determine the cpuid signature for a specific
- processor is to build and run an intel-ucode-feature-enabled
- image on the target hardware, without first assigning any value
- to the UCODE_FILTER_PARAMETERS variable, and then once the
- image is booted, run the "ucode_tool -S" command to have the
- ucode tool scan the system for processor signatures. These
- signatures can then be used in the UCODE_FILTER_PARAMETERS
- variable in conjunction with -s parameter. For example, for
- the fri2 BSP, the cpuid can be determined as such:
-
- [root@fri2 ~]# iucode_tool -S
- iucode_tool: system has processor(s) with signature 0x00020661
-
- Given that output, a suitable UCODE_FILTER_PARAMETERS variable
- definition could be specified in the machine configuration as
- such:
-
- UCODE_FILTER_PARAMETERS = "-s 0x00020661"
-
- Q. Are there any reasons a user might want to disable the
- intel-ucode feature?
-
- A. The microcode data file and associated tools occupy a small
- amount of space (a few KB) on the target image. BSPs which are
- highly sensitive to target image size and which are not
- experiencing microcode-related issues might consider not
- enabling this feature.
-
-
-IV. Tested Hardware
-===================
-
-The following undergo regular basic testing with their respective MACHINE types.
-Note that both 64-bit and 32-bit firmware is available for the MinnowBoard
-Turbot, so it is tested against both intel-corei7-64 and intel-core2-32.
-
-intel-corei7-64:
- NUC6i5SYH
- NUC7i7BNH
- Coffee Lake-H
-
-intel-core2-32:
- MinnowBoard Turbot
-
-
-V. Guidelines for submitting patches
-====================================
-
-Please submit any patches against meta-intel BSPs to the meta-intel
-mailing list (meta-intel@lists.yoctoproject.org). Also, if your patches are
-available via a public git repository, please also include a URL to
-the repo and branch containing your patches as that makes it easier
-for maintainers to grab and test your patches.
-
-There are patch submission scripts available that will, among other
-things, automatically include the repo URL and branch as mentioned.
-Please see the Yocto Project Development Manual sections entitled
-'Using Scripts to Push a Change Upstream and Request a Pull' and
-'Using Email to Submit a Patch' for details.
-
-Regardless of how you submit a patch or patchset, the patches should
-at minimum follow the suggestions outlined in the 'Submitting a Change
-to the Yocto Project' section in the Yocto Project Development Manual.
-Specifically, they should:
-
- - Include a 'Signed-off-by:' line. A commit can't legally be pulled
- in without this.
-
- - Provide a single-line, short summary of the change. This short
- description should be prefixed by the BSP or recipe name, as
- appropriate, followed by a colon. Capitalize the first character
- of the summary (following the colon).
-
- - For the body of the commit message, provide detailed information
- that describes what you changed, why you made the change, and the
- approach you used.
-
- - If the change addresses a specific bug or issue that is associated
- with a bug-tracking ID, include a reference to that ID in your
- detailed description in the following format: [YOCTO #<bug-id>].
-
- - Pay attention to line length - please don't allow any particular
- line in the commit message to stretch past 72 characters.
-
- - For any non-trivial patch, provide information about how you
- tested the patch, and for any non-trivial or non-obvious testing
- setup, provide details of that setup.
-
-Doing a quick 'git log' in meta-intel will provide you with many
-examples of good example commits if you have questions about any
-aspect of the preferred format.
-
-The meta-intel maintainers will do their best to review and/or pull in
-a patch or patchset within 24 hours of the time it was posted. For
-larger and/or more involved patches and patchsets, the review process
-may take longer.
-
-Please see the meta-intel/MAINTAINERS file for the list of maintainers
-and their specific areas; it's also a good idea to cc: the specific
-maintainer, if applicable.
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..91577f1d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,36 @@
+# meta-intel
+
+OpenEmbedded/Yocto BSP layer for Intel platforms.
+
+## Dependencies
+
+This layer primarily depends on OpenEmbedded-Core (OE-Core). However, certain
+recipes may require additional layers to support optional features or
+programming languages not supported by OE-Core. Such recipes are located within
+the `dynamic-layers` directory.
+
+Base dependencies:
+- [Bitbake](https://git.openembedded.org/bitbake)
+- [OE-Core](https://git.openembedded.org/openembedded-core)
+
+Dynamic additional dependencies:
+
+- [meta-openembedded](https://git.openembedded.org/meta-openembedded/tree/meta-oe)
+- [meta-python](https://git.openembedded.org/meta-openembedded/tree/meta-python)
+- [meta-clang](https://github.com/kraj/meta-clang.git)
+
+
+## Contents
+
+- [Building and booting meta-intel BSP layers](documentation/building_and_booting.md)
+- [Intel oneAPI DPC++/C++ Compiler](documentation/dpcpp-compiler.md)
+- [Build Image with OpenVINO™ toolkit](documentation/openvino.md)
+- [Tested Hardware](documentation/tested_hardware.md)
+- [Guidelines for submitting patches](documentation/submitting_patches.md)
+- [Reporting bugs](documentation/reporting_bugs.md)
+- [Reporting security bugs](SECURITY.md)
+
+## Maintainers
+
+- Anuj Mittal <anuj.mittal@intel.com>
+
diff --git a/README.sources b/README.sources
deleted file mode 100644
index 9b483ee0..00000000
--- a/README.sources
+++ /dev/null
@@ -1,17 +0,0 @@
-The sources for the packages comprising the images shipped with this
-BSP can be found at the following location:
-
-http://downloads.yoctoproject.org/mirror/sources/
-
-The metadata used to generate the images shipped with this BSP, in
-addition to the code contained in this BSP, can be found at the
-following location:
-
-http://downloads.yoctoproject.org/releases/yocto/yocto-2.7/poky-warrior-21.0.0.tar.bz2
-
-The metadata used to generate the images shipped with this BSP, in
-addition to the code contained in this BSP, can also be found at the
-following locations:
-
-git://git.yoctoproject.org/poky.git
-git://git.yoctoproject.org/meta-intel
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 00000000..e70fcb0f
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,6 @@
+# Security Policy
+Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation.
+
+## Reporting a Vulnerability
+Please report any security vulnerabilities in this project [utilizing the guidelines here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html).
+
diff --git a/classes/uefi-comboapp.bbclass b/classes/uefi-comboapp.bbclass
index 4ecc5535..a05e0ca0 100644
--- a/classes/uefi-comboapp.bbclass
+++ b/classes/uefi-comboapp.bbclass
@@ -4,8 +4,8 @@
# it with the efi stub obtained from systemd-boot.
# Don't add syslinux or build an ISO
-PCBIOS_forcevariable = "0"
-NOISO_forcevariable = "1"
+PCBIOS:forcevariable = "0"
+NOISO:forcevariable = "1"
# image-live.bbclass will default INITRD_LIVE to the image INITRD_IMAGE creates.
# We want behavior to be consistent whether or not "live" is in IMAGE_FSTYPES, so
@@ -138,7 +138,7 @@ build_efi_cfg() {
:
}
-populate_kernel_append() {
+populate_kernel:append() {
# The kernel and initrd are built into the app, so we don't need these
if [ -f $dest/initrd ]; then
rm $dest/initrd
diff --git a/conf/include/maintainers.inc b/conf/include/maintainers.inc
index 96e218e9..9849d0d8 100644
--- a/conf/include/maintainers.inc
+++ b/conf/include/maintainers.inc
@@ -1,47 +1,54 @@
# This file contains a list of recipe maintainers for meta-intel
-RECIPE_MAINTAINER_pn-backport-iwlwifi = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-core-image-rt = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-core-image-rt-sdk = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-core-image-tiny = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-core-image-minimal-initramfs = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-gmmlib = "Lim Siew Hoon <siew.hoon.lim@intel.com>"
-RECIPE_MAINTAINER_pn-hdcp = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-intel-graphics-compiler = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-intel-compute-runtime = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-intel-media-driver = "Lim Siew Hoon <siew.hoon.lim@intel.com>"
-RECIPE_MAINTAINER_pn-intel-mediasdk = "Lim Siew Hoon <siew.hoon.lim@intel.com>"
-RECIPE_MAINTAINER_pn-intel-microcode = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-intel-vaapi-driver = "Lim Siew Hoon <siew.hoon.lim@intel.com>"
-RECIPE_MAINTAINER_pn-ipmctl = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-isa-l = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-itt = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-ixgbe = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-ixgbevf = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-iucode-tool = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-jhi = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-level-zero = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-libipt = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-libyami = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-libyami-utils = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-libxcam = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-linux-intel = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-linux-intel-rt = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-linux-intel-dev = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-lms = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-metee = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-metrics-discovery = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-onednn = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-onevpl = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-onevpl-intel-gpu = "Yew Chang Ching <chang.ching.yew@intel.com>"
-RECIPE_MAINTAINER_pn-open-model-zoo = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-opencl-clang = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-openvino-inference-engine = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-openvino-model-optimizer = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-ovmf-shell-image-enrollkeys = "Naveen Saini <naveen.kumar.saini@intel.com>"
-RECIPE_MAINTAINER_pn-sbsigntool-native = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-secureboot-selftest-image-signed = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-secureboot-selftest-image-unsigned = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-thermald = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-xf86-video-ast = "Anuj Mittal <anuj.mittal@intel.com>"
-RECIPE_MAINTAINER_pn-zlib-intel = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-backport-iwlwifi = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-core-image-rt = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-core-image-rt-sdk = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-core-image-tiny = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-core-image-minimal-initramfs = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-embree = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-gmmlib = "Lim Siew Hoon <siew.hoon.lim@intel.com>"
+RECIPE_MAINTAINER:pn-hdcp = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-intel-cmt-cat = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-intel-compute-runtime = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-intel-crypto-mb = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-intel-graphics-compiler = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-intel-media-driver = "Lim Siew Hoon <siew.hoon.lim@intel.com>"
+RECIPE_MAINTAINER:pn-intel-mediasdk = "Lim Siew Hoon <siew.hoon.lim@intel.com>"
+RECIPE_MAINTAINER:pn-intel-microcode = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-intel-vaapi-driver = "Lim Siew Hoon <siew.hoon.lim@intel.com>"
+RECIPE_MAINTAINER:pn-ipmctl = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-isa-l = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-ispc = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-itt = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-ixgbe = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-ixgbevf = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-iucode-tool = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-level-zero = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-libipt = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-libva-intel = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-libva-intel-utils = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-libxcam = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-linux-intel = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-linux-intel-rt = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-linux-intel-dev = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-lms = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-metee = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-metrics-discovery = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-oidn = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-onednn = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-onedpl = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-onevpl = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-onevpl-intel-gpu = "Yew Chang Ching <chang.ching.yew@intel.com>"
+RECIPE_MAINTAINER:pn-open-model-zoo = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-opencl-clang = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-openvino-inference-engine = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-openvino-model-optimizer = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-openvkl = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-ospray = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-ovmf-shell-image-enrollkeys = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-rkcommon = "Naveen Saini <naveen.kumar.saini@intel.com>"
+RECIPE_MAINTAINER:pn-sbsigntool-native = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-secureboot-selftest-image-signed = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-secureboot-selftest-image-unsigned = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-thermald = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-xf86-video-ast = "Anuj Mittal <anuj.mittal@intel.com>"
diff --git a/conf/layer.conf b/conf/layer.conf
index 33977a24..97dfb897 100644
--- a/conf/layer.conf
+++ b/conf/layer.conf
@@ -10,7 +10,8 @@ BBFILE_PATTERN_intel := "^${LAYERDIR}/"
BBFILE_PRIORITY_intel = "5"
# Additional license directories.
-LICENSE_PATH += "${LAYERDIR}/custom-licenses"
+CUSTOM_LICENSES_PATH = "${LAYERDIR}/custom-licenses"
+LICENSE_PATH += "${CUSTOM_LICENSES_PATH}"
LAYERDEPENDS_intel = "core"
LAYERRECOMMENDS_intel = "dpdk"
@@ -18,7 +19,7 @@ LAYERRECOMMENDS_intel = "dpdk"
# This should only be incremented on significant changes that will
# cause compatibility issues with other layers
LAYERVERSION_intel = "5"
-LAYERSERIES_COMPAT_intel = "dunfell gatesgarth hardknott"
+LAYERSERIES_COMPAT_intel = "kirkstone scarthgap"
BBFILES_DYNAMIC += " \
clang-layer:${LAYERDIR}/dynamic-layers/clang-layer/*/*/*.bb \
@@ -31,10 +32,6 @@ BBFILES_DYNAMIC += " \
require ${LAYERDIR}/conf/include/maintainers.inc
-PREFERRED_PROVIDER_zlib ?= "zlib"
-PREFERRED_PROVIDER_zlib-native ?= "zlib-native"
-PREFERRED_PROVIDER_nativesdk-zlib ?= "nativesdk-zlib"
-
# Use the libva from OE-Core when layer is included but no MACHINE
# from meta-intel is being used.
PREFERRED_PROVIDER_libva ?= "libva"
@@ -44,3 +41,5 @@ PREFERRED_PROVIDER_nativesdk-libva ?= "nativesdk-libva"
PREFERRED_PROVIDER_libva-utils ?= "libva-utils"
PREFERRED_PROVIDER_libva-utils-native ?= "libva-utils-native"
PREFERRED_PROVIDER_nativesdk-libva-utils ?= "nativesdk-libva-utils"
+
+# addpylib ${LAYERDIR}/lib oeqa
diff --git a/conf/machine/include/intel-common-pkgarch.inc b/conf/machine/include/intel-common-pkgarch.inc
index d0f208bd..94d77e06 100644
--- a/conf/machine/include/intel-common-pkgarch.inc
+++ b/conf/machine/include/intel-common-pkgarch.inc
@@ -1,15 +1,15 @@
INTEL_COMMON_PACKAGE_ARCH ?= "${TUNE_PKGARCH}-intel-common"
-PACKAGE_ARCH_pn-linux-intel = "${INTEL_COMMON_PACKAGE_ARCH}"
-PACKAGE_ARCH_pn-linux-intel-rt = "${INTEL_COMMON_PACKAGE_ARCH}"
-PACKAGE_ARCH_pn-linux-intel-tiny = "${INTEL_COMMON_PACKAGE_ARCH}"
-PACKAGE_ARCH_pn-linux-intel-dev = "${INTEL_COMMON_PACKAGE_ARCH}"
-PACKAGE_ARCH_pn-linux-yocto = "${INTEL_COMMON_PACKAGE_ARCH}"
-PACKAGE_ARCH_pn-linux-yocto-rt = "${INTEL_COMMON_PACKAGE_ARCH}"
-PACKAGE_ARCH_pn-linux-yocto-tiny = "${INTEL_COMMON_PACKAGE_ARCH}"
-PACKAGE_ARCH_pn-linux-yocto-dev = "${INTEL_COMMON_PACKAGE_ARCH}"
-PACKAGE_ARCH_pn-intel-microcode = "${INTEL_COMMON_PACKAGE_ARCH}"
-PACKAGE_ARCH_pn-backport-iwlwifi = "${INTEL_COMMON_PACKAGE_ARCH}"
-PACKAGE_ARCH_pn-ixgbe = "${INTEL_COMMON_PACKAGE_ARCH}"
-PACKAGE_ARCH_pn-ixgbevf = "${INTEL_COMMON_PACKAGE_ARCH}"
-PACKAGE_EXTRA_ARCHS_append += "${INTEL_COMMON_PACKAGE_ARCH}"
+PACKAGE_ARCH:pn-linux-intel = "${INTEL_COMMON_PACKAGE_ARCH}"
+PACKAGE_ARCH:pn-linux-intel-rt = "${INTEL_COMMON_PACKAGE_ARCH}"
+PACKAGE_ARCH:pn-linux-intel-tiny = "${INTEL_COMMON_PACKAGE_ARCH}"
+PACKAGE_ARCH:pn-linux-intel-dev = "${INTEL_COMMON_PACKAGE_ARCH}"
+PACKAGE_ARCH:pn-linux-yocto = "${INTEL_COMMON_PACKAGE_ARCH}"
+PACKAGE_ARCH:pn-linux-yocto-rt = "${INTEL_COMMON_PACKAGE_ARCH}"
+PACKAGE_ARCH:pn-linux-yocto-tiny = "${INTEL_COMMON_PACKAGE_ARCH}"
+PACKAGE_ARCH:pn-linux-yocto-dev = "${INTEL_COMMON_PACKAGE_ARCH}"
+PACKAGE_ARCH:pn-intel-microcode = "${INTEL_COMMON_PACKAGE_ARCH}"
+PACKAGE_ARCH:pn-backport-iwlwifi = "${INTEL_COMMON_PACKAGE_ARCH}"
+PACKAGE_ARCH:pn-ixgbe = "${INTEL_COMMON_PACKAGE_ARCH}"
+PACKAGE_ARCH:pn-ixgbevf = "${INTEL_COMMON_PACKAGE_ARCH}"
+PACKAGE_EXTRA_ARCHS:append = " ${INTEL_COMMON_PACKAGE_ARCH}"
MACHINEOVERRIDES =. "${INTEL_COMMON_PACKAGE_ARCH}:"
diff --git a/conf/machine/include/intel-core2-32-common.inc b/conf/machine/include/intel-core2-32-common.inc
index 8c469499..ce34d9bb 100644
--- a/conf/machine/include/intel-core2-32-common.inc
+++ b/conf/machine/include/intel-core2-32-common.inc
@@ -3,5 +3,5 @@
#
DEFAULTTUNE ?= "core2-32"
-require conf/machine/include/tune-core2.inc
-require conf/machine/include/x86-base.inc
+require conf/machine/include/x86/tune-core2.inc
+require conf/machine/include/x86/x86-base.inc
diff --git a/conf/machine/include/intel-corei7-64-common.inc b/conf/machine/include/intel-corei7-64-common.inc
index 00282569..3498ebe3 100644
--- a/conf/machine/include/intel-corei7-64-common.inc
+++ b/conf/machine/include/intel-corei7-64-common.inc
@@ -3,5 +3,5 @@
#
DEFAULTTUNE ?= "corei7-64"
-require conf/machine/include/tune-corei7.inc
-require conf/machine/include/x86-base.inc
+require conf/machine/include/x86/tune-corei7.inc
+require conf/machine/include/x86/x86-base.inc
diff --git a/conf/machine/include/meta-intel.inc b/conf/machine/include/meta-intel.inc
index 19f7857d..230d0253 100644
--- a/conf/machine/include/meta-intel.inc
+++ b/conf/machine/include/meta-intel.inc
@@ -5,17 +5,11 @@
#
PREFERRED_PROVIDER_virtual/kernel ?= "linux-intel"
-PREFERRED_PROVIDER_virtual/kernel_poky-tiny ?= "linux-intel"
+PREFERRED_PROVIDER_virtual/kernel:poky-tiny ?= "linux-intel"
-# Only use the Intel-tuned zlib for target builds to improve reuse
-PREFERRED_PROVIDER_zlib = "zlib-intel"
-PREFERRED_PROVIDER_zlib-native = "zlib-native"
-PREFERRED_PROVIDER_nativesdk-zlib = "nativesdk-zlib"
-
-PREFERRED_VERSION_linux-intel ?= "5.10%"
-PREFERRED_VERSION_linux-intel-rt ?= "5.10%"
-PREFERRED_VERSION_linux-intel_poky-altcfg ?= "5.4%"
-PREFERRED_VERSION_linux-intel-rt_poky-altcfg ?= "5.4%"
+PREFERRED_VERSION_linux-intel ?= "6.6%"
+PREFERRED_VERSION_linux-intel-rt ?= "6.6%"
+PREFERRED_VERSION_linux-intel:poky-altcfg ?= "6.8%"
# Need to point to latest version of libva needed for media components
PREFERRED_PROVIDER_libva = "libva-intel"
@@ -26,29 +20,28 @@ PREFERRED_PROVIDER_libva-utils = "libva-intel-utils"
PREFERRED_PROVIDER_libva-utils-native = "libva-intel-utils-native"
PREFERRED_PROVIDER_nativesdk-libva-utils = "nativesdk-libva-intel-utils"
-PREFERRED_VERSION_opencl-clang ?= "${@bb.utils.contains('LLVMVERSION', '10.0.1', '10.0.0', \
- bb.utils.contains('LLVMVERSION', '11.1.0', '11.0.0', '12.0.0', d), d)}"
-PREFERRED_VERSION_opencl-clang-native ?= "${@bb.utils.contains('LLVMVERSION', '10.0.1', '10.0.0', \
- bb.utils.contains('LLVMVERSION', '11.1.0', '11.0.0', '12.0.0', d), d)}"
+LLVM_MAJOR_VERSION = "${@d.getVar('LLVMVERSION').split('.')[0]}"
+PREFERRED_VERSION_opencl-clang ?= "${@bb.utils.contains('LLVM_MAJOR_VERSION', '14', '14.0.0', '15.0.0', d)}"
+PREFERRED_VERSION_opencl-clang-native ?= "${@bb.utils.contains('LLVM_MAJOR_VERSION', '14', '14.0.0', '15.0.0', d)}"
XSERVER_X86_ASPEED_AST = "xf86-video-ast \
"
# include the user space intel microcode loading support in the generated images.
-MACHINE_ESSENTIAL_EXTRA_RDEPENDS_append = "${@bb.utils.contains('MACHINE_FEATURES', 'intel-ucode', ' intel-microcode', '', d)}"
+MACHINE_ESSENTIAL_EXTRA_RDEPENDS:append = "${@bb.utils.contains('MACHINE_FEATURES', 'intel-ucode', ' intel-microcode', '', d)}"
# recommended extra packages common to all intel machines
-MACHINE_EXTRA_RRECOMMENDS_append = " kernel-modules linux-firmware"
-MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS_append = " kernel-module-i915 linux-firmware-i915"
+MACHINE_EXTRA_RRECOMMENDS:append = " kernel-modules linux-firmware"
+MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS:append = " kernel-module-i915 linux-firmware-i915 kernel-module-igc kernel-module-r8152"
# for the early boot time kernel microcode loading support,
# merge the microcode data in the final initrd image.
-INITRD_LIVE_prepend = "${@bb.utils.contains('MACHINE_FEATURES', 'intel-ucode', '${DEPLOY_DIR_IMAGE}/microcode.cpio ', '', d)}"
+INITRD_LIVE:prepend = "${@bb.utils.contains('MACHINE_FEATURES', 'intel-ucode', '${DEPLOY_DIR_IMAGE}/microcode.cpio ', '', d)}"
DISK_SIGNATURE_UUID ??= "deadbeef-dead-beef-dead-beefdeadbeef"
EFI_PROVIDER ?= "systemd-boot"
-EFI_PROVIDER_x86-x32 = "grub-efi"
+EFI_PROVIDER:x86-x32 = "grub-efi"
# Add general MACHINEOVERRIDE for meta-intel
MACHINEOVERRIDES =. "intel-x86-common:"
diff --git a/conf/machine/include/qemu-intel.inc b/conf/machine/include/qemu-intel.inc
index 81510404..4608db99 100644
--- a/conf/machine/include/qemu-intel.inc
+++ b/conf/machine/include/qemu-intel.inc
@@ -2,7 +2,7 @@
# distro content (in particular the kernel) less than qemu.inc.
# Ensure that qemu gets built when building images.
-EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native"
+EXTRA_IMAGEDEPENDS += "qemu-system-native qemu-helper-native:do_addto_recipe_sysroot"
# Build ovmf firmware for uefi support in qemu.
EXTRA_IMAGEDEPENDS += "ovmf"
diff --git a/conf/machine/include/qemuboot-intel.inc b/conf/machine/include/qemuboot-intel.inc
index befcc250..17a1234d 100644
--- a/conf/machine/include/qemuboot-intel.inc
+++ b/conf/machine/include/qemuboot-intel.inc
@@ -1,19 +1,18 @@
# For runqemu
IMAGE_CLASSES += "qemuboot"
-QB_SYSTEM_NAME_intel-core2-32 = "qemu-system-i386"
-QB_CPU_intel-core2-32 = "-cpu coreduo"
-QB_CPU_KVM_intel-core2-32 = "-cpu kvm32"
+QB_SYSTEM_NAME:intel-core2-32 = "qemu-system-i386"
+QB_CPU:intel-core2-32 = "-cpu coreduo"
+QB_CPU_KVM:intel-core2-32 = "-cpu kvm32"
-QB_SYSTEM_NAME_intel-corei7-64 = "qemu-system-x86_64"
-QB_CPU_intel-corei7-64 = "-cpu Nehalem"
-QB_CPU_KVM_intel-corei7-64 = "-cpu kvm64"
+QB_SYSTEM_NAME:intel-corei7-64 = "qemu-system-x86_64"
+QB_CPU:intel-corei7-64 = "-cpu Nehalem"
+QB_CPU_KVM:intel-corei7-64 = "-cpu kvm64"
-QB_SYSTEM_NAME_intel-skylake-64 = "qemu-system-x86_64"
-QB_CPU_intel-skylake-64 = "-cpu Skylake-Client"
-QB_CPU_KVM_intel-skylake-64 = "-cpu Skylake-Client"
+QB_SYSTEM_NAME:intel-skylake-64 = "qemu-system-x86_64"
+QB_CPU:intel-skylake-64 = "-cpu Skylake-Client"
+QB_CPU_KVM:intel-skylake-64 = "-cpu Skylake-Client"
QB_AUDIO_DRV = "alsa"
-QB_AUDIO_OPT = "-soundhw ac97,es1370"
-QB_KERNEL_CMDLINE_APPEND = "vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 uvesafb.task_timeout=-1"
-# Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy
-QB_OPT_APPEND = "-vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci"
+QB_AUDIO_OPT = "-device AC97"
+QB_KERNEL_CMDLINE_APPEND = " oprofile.timer=1"
+QB_OPT_APPEND = " -usb -usbdevice tablet "
diff --git a/conf/machine/include/tune-skylake.inc b/conf/machine/include/tune-skylake.inc
deleted file mode 100644
index 4882600b..00000000
--- a/conf/machine/include/tune-skylake.inc
+++ /dev/null
@@ -1,48 +0,0 @@
-# Settings for the GCC(1) cpu-type "skylake":
-#
-# Intel Skylake CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
-# SSE4.2, AVX, AVX2 and POPCNT instruction set support.
-#
-# This tune is recommended for Intel Skylake CPU (and beyond).
-#
-DEFAULTTUNE ?= "skylake-64"
-
-# Include the previous tune to pull in PACKAGE_EXTRA_ARCHS
-require conf/machine/include/tune-corei7.inc
-
-# Extra tune features
-TUNEVALID[skylake] = "Enable skylake specific processor optimizations"
-TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'skylake', ' -march=skylake ${SKYLAKE_TUNE} -mfpmath=sse', '', d)}"
-
-# Extra tune selections
-
-AVAILTUNES += "skylake-64"
-TUNE_FEATURES_tune-skylake-64 = "${TUNE_FEATURES_tune-x86-64} skylake"
-BASE_LIB_tune-skylake-64 = "lib64"
-TUNE_PKGARCH_tune-skylake-64 = "skylake-64"
-PACKAGE_EXTRA_ARCHS_tune-skylake-64 = "${PACKAGE_EXTRA_ARCHS_tune-core2-64} skylake-64"
-QEMU_EXTRAOPTIONS_skylake-64 = " -cpu Skylake-Client"
-
-
-# Disable QEMU usermode by default (get avx2)
-MACHINE_FEATURES_remove = "qemu-usermode"
-
-# If qemu-usermode is enabled, we have to disable avx2 ISA extensions, but we can keep mtune as skylake vs generic
-SKYLAKE_TUNE .= "${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', ' -mtune=skylake ${QEMU_UNAVAILABLE_ISA}', '-mtune=generic -mavx2', d)}"
-
-QEMU_UNAVAILABLE_ISA = " \
--mno-avx \
--mno-avx2 \
--mno-avx512f \
--mno-avx512er \
--mno-avx512cd \
--mno-avx512pf \
--mno-avx512dq \
--mno-avx512bw \
--mno-avx512vl \
--mno-avx512ifma \
--mno-avx512vbmi \
--mno-avx512vbmi2 \
--mno-avx512vnni \
--mno-avx512bitalg \
-"
diff --git a/conf/machine/intel-core2-32.conf b/conf/machine/intel-core2-32.conf
index 36cd9fa6..5b134dc3 100644
--- a/conf/machine/intel-core2-32.conf
+++ b/conf/machine/intel-core2-32.conf
@@ -29,4 +29,4 @@ APPEND += "rootwait console=ttyS0,115200 console=ttyPCH0,115200 console=tty0"
IMAGE_FSTYPES += "wic"
WKS_FILE ?= "${@bb.utils.contains_any("EFI_PROVIDER", "systemd-boot", "systemd-bootdisk-microcode.wks.in", "grub-bootdisk-microcode.wks.in", d)}"
-WKS_FILE_DEPENDS_append = " intel-microcode"
+WKS_FILE_DEPENDS:append = " intel-microcode"
diff --git a/conf/machine/intel-corei7-64.conf b/conf/machine/intel-corei7-64.conf
index 7b94344c..968395fe 100644
--- a/conf/machine/intel-corei7-64.conf
+++ b/conf/machine/intel-corei7-64.conf
@@ -14,7 +14,8 @@ MACHINE_FEATURES += "intel-ucode"
MACHINE_HWCODECS ?= "${@bb.utils.contains('TUNE_FEATURES', 'mx32', '', 'intel-media-driver intel-mediasdk', d)} gstreamer1.0-vaapi"
# Enable optional dpdk:
-COMPATIBLE_MACHINE_pn-dpdk = "intel-corei7-64"
+COMPATIBLE_MACHINE:pn-dpdk = "intel-corei7-64"
+COMPATIBLE_MACHINE:pn-dpdk-module = "intel-corei7-64"
XSERVER ?= "${XSERVER_X86_BASE} \
${XSERVER_X86_EXT} \
@@ -32,4 +33,4 @@ APPEND += "rootwait console=ttyS0,115200 console=tty0"
IMAGE_FSTYPES += "wic"
WKS_FILE ?= "${@bb.utils.contains_any("EFI_PROVIDER", "systemd-boot", "systemd-bootdisk-microcode.wks.in", "grub-bootdisk-microcode.wks.in", d)}"
-WKS_FILE_DEPENDS_append = " intel-microcode"
+WKS_FILE_DEPENDS:append = " intel-microcode"
diff --git a/conf/machine/intel-skylake-64.conf b/conf/machine/intel-skylake-64.conf
index eccd59b8..a2b392c2 100644
--- a/conf/machine/intel-skylake-64.conf
+++ b/conf/machine/intel-skylake-64.conf
@@ -4,8 +4,8 @@
#@DESCRIPTION: Machine configuration for 64 bit Intel Skylake CPU (and later) with MMX, SSE, SSE2, SSE3, SSE4.1, SSE4.2, AVX, and AVX2 instruction set support. Supports a moderately wide range of drivers that should boot and be usable on "typical" hardware.
require conf/machine/include/meta-intel.inc
-require conf/machine/include/x86-base.inc
-require conf/machine/include/tune-skylake.inc
+require conf/machine/include/x86/x86-base.inc
+require conf/machine/include/x86/tune-x86-64-v3.inc
require conf/machine/include/intel-common-pkgarch.inc
MACHINE_FEATURES += "efi"
@@ -14,7 +14,8 @@ MACHINE_FEATURES += "intel-ucode"
MACHINE_HWCODECS ?= "intel-media-driver intel-mediasdk gstreamer1.0-vaapi"
-COMPATIBLE_MACHINE_pn-dpdk = "intel-skylake-64"
+COMPATIBLE_MACHINE:pn-dpdk = "intel-skylake-64"
+COMPATIBLE_MACHINE:pn-dpdk-module = "intel-skylake-64"
XSERVER ?= "${XSERVER_X86_BASE} \
${XSERVER_X86_EXT} \
@@ -32,4 +33,4 @@ APPEND += "rootwait console=ttyS0,115200 console=tty0"
IMAGE_FSTYPES += "wic"
WKS_FILE ?= "${@bb.utils.contains_any("EFI_PROVIDER", "systemd-boot", "systemd-bootdisk-microcode.wks.in", "grub-bootdisk-microcode.wks.in", d)}"
-WKS_FILE_DEPENDS_append = " intel-microcode"
+WKS_FILE_DEPENDS:append = " intel-microcode"
diff --git a/custom-licenses/EULA b/custom-licenses/EULA
new file mode 100644
index 00000000..549f78e1
--- /dev/null
+++ b/custom-licenses/EULA
@@ -0,0 +1,392 @@
+Intel End User License Agreement for Developer Tools (Version October 2021)
+
+IMPORTANT NOTICE - PLEASE READ AND AGREE BEFORE DOWNLOADING, INSTALLING, COPYING
+OR USING
+
+This Agreement is between you, or the company or other legal entity that you
+represent and warrant you have the legal authority to bind, (each, "You" or
+"Your") and Intel Corporation and its subsidiaries (collectively, "Intel")
+regarding Your use of the Materials. By downloading, installing, copying or
+using the Materials, You agree to be bound by the terms of this Agreement. If
+You do not agree to the terms of this Agreement, or do not have legal authority
+or required age to agree to them, do not download, install, copy or use the
+Materials.
+
+1. LICENSE DEFINITIONS.
+
+ A. "Cloud Provider" means a third party service provider offering a cloud-based
+ platform, infrastructure, application or storage services, such as Microsoft
+ Azure or Amazon Web Services, which You may only utilize to host the
+ Materials subject to the restrictions set forth in Section 2.3 B.
+
+ B. "Derivative Work" means a derivative work, as defined in 17 U.S.C. 101, of
+ the Source Code.
+
+ C. "Executable Code" means computer programming code in binary form suitable
+ for machine execution by a processor without the intervening steps of
+ interpretation or compilation.
+
+ D. "Materials" mean the software, documentation, the software product serial
+ number, and other collateral, including any updates, made available to You
+ by Intel under this Agreement. Materials include Redistributables,
+ Executable Code, Source Code, Sample Source Code, and Pre-Release Materials,
+ but do not include Third Party Software.
+
+ E. "Pre-Release Materials" mean the Materials, or portions of the Materials,
+ that are identified (in the product release notes, on Intel's download
+ website for the Materials or elsewhere) or labeled as pre-release,
+ prototype, alpha or beta code and, as such, are deemed to be pre-release
+ code (i) which may not be fully functional or tested and may contain bugs or
+ errors; (ii) which Intel may substantially modify in its development of a
+ production version; or (iii) for which Intel makes no assurances that it
+ will ever develop or make a production version generally available.
+ Pre-Release Materials are subject to the terms of Section 3.2.
+
+ F. "Reciprocal Open Source Software" means any software that is subject to a
+ license which requires that (i) it must be distributed in source code form;
+ (ii) it must be licensed under the same open source license terms; and (iii)
+ its derivative works must be licensed under the same open source license
+ terms. Examples of this type of license are the GNU General Public License
+ or the Mozilla Public License.
+
+ G. "Redistributables" mean the files (if any) listed in the "redist.txt,"
+ "redist-rt.txt" or similarly-named text files that may be included in the
+ Materials. Redistributables include Sample Source Code.
+
+ H. "Sample Source Code" means those portions of the Materials that are Source
+ Code and are identified as sample code. Sample Source Code may not have been
+ tested or validated by Intel and is provided purely as a programming example.
+
+ I. "Source Code" means the software portion of the Materials provided in human
+ readable format.
+
+ J. "Third Party Software" mean the files (if any) listed in the
+ "third-party-software.txt" or other similarly-named text file that may be
+ included in the Materials for the applicable software. Third Party Software
+ is subject to the terms of Section 2.2.
+
+ K. "Your Product" means one or more applications, products or projects
+ developed by or for You using the Materials.
+
+2. LICENSE GRANTS.
+
+2.1 License to the Materials. Subject to the terms and conditions of this
+ Agreement, Intel grants You a non-exclusive, worldwide, non-assignable,
+ non-sublicensable, limited right and license under its copyrights, to:
+
+ A. reproduce internally a reasonable number of copies of the Materials for Your
+ personal or business use;
+
+ B. use the Materials solely for Your personal or business use to develop Your
+ Product, in accordance with the documentation included as part of the
+ Materials;
+
+ C. modify or create Derivative Works only of the Redistributables, or any
+ portions, that are provided to You in Source Code;
+
+ D. distribute (directly and through Your distributors, resellers, and other
+ channel partners, if applicable), the Redistributables, including any
+ modifications to or Derivative Works of the Redistributables or any portions
+ made pursuant to Section 2.1.C subject to the following conditions:
+
+ (1) Any distribution of the Redistributables must only be as part of Your
+ Product which must add significant primary functionality different than
+ that of the Redistributables themselves;
+
+ (2) You must only distribute the Redistributables originally provided to You
+ by Intel only in Executable Code subject to a license agreement that
+ prohibits reverse engineering, decompiling or disassembling the
+ Redistributables;
+
+ (3) This distribution right includes a limited right to sublicense only the
+ Intel copyrights in the Redistributables and only to the extent necessary
+ to perform, display, and distribute the Redistributables (including Your
+ modifications and Derivative Works of the Redistributables provided in
+ Source Code) solely as incorporated in Your Product; and
+
+ (4) You: (i) will be solely responsible to Your customers for any update,
+ support obligation or other obligation or liability which may arise from
+ the distribution of Your Product, (ii) will not make any statement that
+ Your Product is "certified" or that its performance is guaranteed by Intel
+ or its suppliers, (iii) will not use Intel's or its suppliers' names or
+ trademarks to market Your Product, (iv) will comply with any additional
+ restrictions which are included in the text files with the
+ Redistributables and in Section 3 below, (v) will indemnify, hold
+ harmless, and defend Intel and its suppliers from and against any claims
+ or lawsuits, costs, damages, and expenses, including attorney's fees, that
+ arise or result from (a) Your modifications or Derivative Works of the
+ Materials or (b) Your distribution of Your Product.
+
+2.2 Third Party Software. Third Party Software, even if included with the
+ distribution of the Materials, may be governed by separate license terms,
+ including without limitation, third party license terms, open source
+ software notices and terms, and/or other Intel software license terms. These
+ separate license terms solely govern Your use of the Third Party Software.
+
+2.3 Third Party Use.
+
+ A. If You are an entity, Your contractors may use the Materials under the
+ license specified in Section 2, provided: (i) their use of the Materials is
+ solely on behalf of and in support of Your business, (ii) they agree to the
+ terms and conditions of this Agreement, and (iii) You are solely responsible
+ for their use, misuse or disclosure of the Materials.
+
+ B. You may utilize a Cloud Provider to host the Materials for You, provided:
+ (i) the Cloud Provider may only host the Materials for Your exclusive use
+ and may not use the Materials for any other purpose whatsoever, including the
+ restriction set forth in Section 3.1(xi); (ii) the Cloud Provider's use of
+ the Materials must be solely on behalf of and in support of Your Product, and
+ (iii) You will indemnify, hold harmless, and defend Intel and its suppliers
+ from and against any claims or lawsuits, costs, damages, and expenses,
+ including attorney's fees, that arise or result from Your Cloud Provider's
+ use, misuse or disclosure of the Materials.
+
+3. LICENSE CONDITIONS.
+
+3.1 Restrictions. Except as expressly provided in this Agreement, You may NOT:
+ (i) use, reproduce, disclose, distribute, or publicly display the
+ Materials; (ii) share, publish, rent or lease the Materials to any third
+ party; (iii) assign this Agreement or transfer the Materials; (iv) modify,
+ adapt, or translate the Materials in whole or in part; (v) reverse engineer,
+ decompile, or disassemble the Materials, or otherwise attempt to derive the
+ source code for the software; (vi) work around any technical limitations in
+ the Materials; (vii) distribute, sublicense or transfer any Source Code,
+ modifications or Derivative Works of any Source Code to any third party;
+ (viii) remove, minimize, block or modify any notices of Intel or its
+ suppliers in the Materials; (ix) include the Redistributables in malicious,
+ deceptive, or unlawful programs or products or use the Materials in any way
+ that is against the law; (x) modify, create a Derivative Work, link, or
+ distribute the Materials so that any part of it becomes Reciprocal Open
+ Source Software; (xi) use the Materials directly or indirectly for SaaS
+ services or service bureau purposes (i.e., a service that allows use of or
+ access to the Materials by a third party as part of that service, such as
+ the salesforce.com service business model).
+
+3.2 Pre-Release Materials. If You receive Pre-Release Materials, You may
+ reproduce a reasonable number of copies and use the Pre-Release Materials
+ for evaluation and testing purposes only. You may not (i) modify or
+ incorporate the Pre-Release Materials into Your Product; (ii) continue to
+ use the Pre-Release Materials once a commercial version is released; or
+ (iii) disclose to any third party any benchmarks, performance results, or
+ other information relating to the Pre-Release Materials. Intel may waive
+ these restrictions in writing at its sole discretion; however, if You decide
+ to use the Pre-Release Materials in Your Product (even with Intel's waiver),
+ You acknowledge and agree that You are fully responsible for any and all
+ issues that result from such use.
+
+3.3 Safety-Critical, and Life-Saving Applications; Indemnity. The Materials may
+ provide information relevant to safety-critical applications
+ ("Safety-Critical Applications") to allow compliance with functional safety
+ standards or requirements. You acknowledge and agree that safety is Your
+ responsibility. To the extent You use the Materials to create, or as part
+ of, products used in Safety-Critical Applications, it is Your responsibility
+ to design, manage, and ensure that there are system-level safeguards to
+ anticipate, monitor, and control system failures, and You agree that You are
+ solely responsible for all applicable regulatory standards and
+ safety-related requirements concerning Your use of the Materials in Safety
+ Critical Applications.
+
+ Should You use the Materials for Safety-Critical Applications or in any type
+ of a system or application in which the failure of the Materials could
+ create a situation where personal injury or death may occur (e.g., medical
+ systems, life-sustaining or life-saving systems) ("Life-Saving
+ Applications"), You agree to indemnify, defend, and hold Intel and its
+ representatives harmless against any claims or lawsuits, costs, damages, and
+ expenses, including reasonable attorney fees, arising in any way out of Your
+ use of the Materials in Safety-Critical Applications or Life-Saving
+ Applications and claims of product liability, personal injury or death
+ associated with those applications; even if such claims allege that Intel
+ was negligent or strictly liable regarding the design or manufacture of the
+ Materials or its failure to warn regarding the Materials.
+
+3.4 Media Format Codecs and Digital Rights Management. You acknowledge and agree
+ that Your use of the Materials or distribution of the Redistributables with
+ Your Product as permitted by this Agreement may require You to procure
+ license(s) from third parties that may hold intellectual property rights
+ applicable to any media decoding, encoding or transcoding technology (e.g.,
+ the use of an audio or video codec) and/or digital rights management
+ capabilities of the Materials, if any. Should any such additional licenses
+ be required, You are solely responsible for obtaining any such licenses and
+ agree to obtain any such licenses at Your own expense.
+
+4. DATA COLLECTION AND PRIVACY.
+
+4.1 Data Collection. The Materials may generate and collect anonymous data
+ and/or provisioning data about the Materials and/or the development
+ environment and transmit the data to Intel as a one-time event during
+ installation. Optional data may also be collected by the Materials, however,
+ You will be provided notice of the request to collect optional data and no
+ optional data will be collected without Your consent. All data collection by
+ Intel is performed pursuant to relevant privacy laws, including notice and
+ consent requirements.
+
+4.2 Intel's Privacy Notice. Intel is committed to respecting Your privacy. To
+ learn more about Intel's privacy practices, please visit
+ http://www.intel.com/privacy.
+
+5. OWNERSHIP. Title to the Materials and all copies remain with Intel or its
+ suppliers. The Materials are protected by intellectual property rights,
+ including without limitation, United States copyright laws and international
+ treaty provisions. You will not remove any copyright or other proprietary
+ notices from the Materials. Except as expressly provided herein, no license
+ or right is granted to You directly or by implication, inducement, estoppel
+ or otherwise; specifically, Intel does not grant any express or implied right
+ to You under Intel patents, copyrights, trademarks, or trade secrets.
+
+6. NO WARRANTY AND NO SUPPORT.
+
+6.1 No Warranty. Disclaimer. Intel disclaims all warranties of any kind and the
+ terms and remedies provided in this Agreement are instead of any other
+ warranty or condition, express, implied or statutory, including those
+ regarding merchantability, fitness for any particular purpose,
+ non-infringement or any warranty arising out of any course of dealing, usage
+ of trade, proposal, specification or sample. Intel does not assume (and does
+ not authorize any person to assume on its behalf) any liability.
+
+6.2 No Support; Priority Support. Intel may make changes to the Materials, or to
+ items referenced therein, at any time without notice, but is not obligated
+ to support, update or provide training for the Materials under the terms of
+ this Agreement. Intel offers free community and paid priority support
+ options. More information on these support options can be found at:
+ https://software.intel.com/content/www/us/en/develop/support/priority-support.html.
+
+7. LIMITATION OF LIABILITY.
+
+7.1 Intel will not be liable for any of the following losses or damages (whether
+ such losses or damages were foreseen, foreseeable, known or otherwise): (i)
+ loss of revenue; (ii) loss of actual or anticipated profits; (iii) loss of
+ the use of money; (iv) loss of anticipated savings; (v) loss of business;
+ (vi) loss of opportunity; (vii) loss of goodwill; (viii) loss of use of the
+ Materials; (ix) loss of reputation; (x) loss of, damage to, or corruption of
+ data; or (xi) any indirect, incidental, special or consequential loss of
+ damage however caused (including loss or damage of the type specified in
+ this Section 7).
+
+7.2 Intel's total cumulative liability to You, including for direct damages for
+ claims relating to this Agreement, and whether for breach of contract,
+ negligence, or for any other reason, will not exceed $100.
+
+7.3 You acknowledge that the limitations of liability provided in this Section 7
+ are an essential part of this Agreement. You agree that the limitations of
+ liability provided in this Agreement with respect to Intel will be conveyed
+ to and made binding upon any customer of Yours that acquires the
+ Redistributables.
+
+8. USER SUBMISSIONS. Should you provide Intel with comments, modifications,
+ corrections, enhancements or other input ("Feedback") related to the
+ Materials, Intel will be free to use, disclose, reproduce, license or
+ otherwise distribute or exploit the Feedback in its sole discretion without
+ any obligations or restrictions of any kind, including without limitation,
+ intellectual property rights or licensing obligations. If You wish to provide
+ Intel with information that You intend to be treated as confidential
+ information, Intel requires that such confidential information be provided
+ pursuant to a non-disclosure agreement ("NDA"); please contact Your Intel
+ representative to ensure the proper NDA is in place.
+
+9. NON-DISCLOSURE. Information provided by Intel to You may include information
+ marked as confidential. You must treat such information as confidential under
+ the terms of the applicable NDA between Intel and You. If You have not
+ entered into an NDA with Intel, You must not disclose, distribute or make use
+ of any information marked as confidential, except as expressly authorized in
+ writing by Intel. Intel retains all rights in and to its confidential
+ information specifications, designs, engineering details, discoveries,
+ inventions, patents, copyrights, trademarks, trade secrets, and other
+ proprietary rights relating to the Materials. Any breach by You of the
+ confidentiality obligations provided for in this Section 9 will cause
+ irreparable injury to Intel for which money damages may be inadequate to
+ compensate Intel for losses arising from such a breach. Intel may obtain
+ equitable relief, including injunctive relief, if You breach or threaten to
+ breach Your confidentiality obligations.
+
+10. TERM AND TERMINATION. This Agreement becomes effective on the date You
+ accept this Agreement and will continue until terminated as provided for in
+ this Agreement. The term for any Pre-Release Materials terminates upon
+ release of a commercial version. This Agreement will terminate if You are in
+ breach of any of its terms and conditions. Upon termination, You will
+ promptly destroy the Materials and all copies. In the event of termination of
+ this Agreement, Your license to any Redistributables distributed by You in
+ accordance with the terms and conditions of this Agreement, prior to the
+ effective date of such termination, will survive any such termination of this
+ Agreement. Sections 1, 2.1.D(4)(v), 2.2, 2.3.A(iii), 2.3.B(iii), 3.3, 5, 6,
+ 7, 8, 9, 10 (with respect to these survival provisions in the last sentence),
+ and 12 will survive expiration or termination of this Agreement.
+
+11. U.S. GOVERNMENT RESTRICTED RIGHTS. The technical data and computer software
+ covered by this license is a "Commercial Item," as such term is defined by
+ the FAR 2.101 (48 C.F.R. 2.101) and is "commercial computer software" and
+ "commercial computer software documentation" as specified under FAR 12.212
+ (48 C.F.R. 12.212) or DFARS 227.7202 (48 C.F.R. 227.7202), as applicable.
+ This commercial computer software and related documentation is provided to
+ end users for use by and on behalf of the U.S. Government with only those
+ rights as are granted to all other end users pursuant to the terms and
+ conditions of this Agreement.
+
+12. GENERAL PROVISIONS.
+
+12.1 ENTIRE AGREEMENT. This Agreement contains the complete and exclusive
+ agreement and understanding between the parties concerning the subject
+ matter of this Agreement, and supersedes all prior and contemporaneous
+ proposals, agreements, understanding, negotiations, representations,
+ warranties, conditions, and communications, oral or written, between the
+ parties relating to the same subject matter. Each party acknowledges and
+ agrees that in entering into this Agreement it has not relied on, and will
+ not be entitled to rely on, any oral or written representations,
+ warranties, conditions, understanding, or communications between the
+ parties that are not expressly set forth in this Agreement. The express
+ provisions of this Agreement control over any course of performance, course
+ of dealing, or usage of the trade inconsistent with any of the provisions
+ of this Agreement. The provisions of this Agreement will prevail
+ notwithstanding any different, conflicting, or additional provisions that
+ may appear on any purchase order, acknowledgement, invoice, or other
+ writing issued by either party in connection with this Agreement. No
+ modification or amendment to this Agreement will be effective unless in
+ writing and signed by authorized representatives of each party, and must
+ specifically identify this Agreement by its title and version (e.g., "Intel
+ End User License Agreement for Developer Tools (Version October 2021)");
+ except that Intel may make changes to this Agreement as it distributes new
+ versions of the Materials. When changes are made, Intel will make a new
+ version of the Agreement available on its website. If You received a copy
+ of this Agreement translated into another language, the English language
+ version of this Agreement will prevail in the event of any conflict between
+ versions.
+
+12.2 EXPORT. You acknowledge that the Materials and all related technical
+ information are subject to export controls and you agree to comply with all
+ laws and regulations of the United States and other applicable governments
+ governing export, re-export, import, transfer, distribution, and use of the
+ Materials. In particular, but without limitation, the Materials may not be
+ exported or re-exported (i) into any U.S. embargoed countries or (ii) to
+ any person or entity listed on a denial order published by the U.S.
+ government or any other applicable governments. By using the Materials, You
+ represent and warrant that You are not located in any such country or on
+ any such list. You also agree that You will not use the Materials for, or
+ sell or transfer them to a third party who is known or suspected to be
+ involved in, any purposes prohibited by the U.S. government or other
+ applicable governments, including, without limitation, the development,
+ design, manufacture, or production of nuclear, missile, chemical or
+ biological weapons.
+
+12.3 GOVERNING LAW, JURISDICTION, AND VENUE. All disputes arising out of or
+ related to this Agreement, whether based on contract, tort, or any other
+ legal or equitable theory, will in all respects be governed by, and
+ construed and interpreted under, the laws of the United States of America
+ and the State of Delaware, without reference to conflict of laws
+ principles. The parties agree that the United Nations Convention on
+ Contracts for the International Sale of Goods (1980) is specifically
+ excluded from and will not apply to this Agreement. All disputes arising
+ out of or related to this Agreement, whether based on contract, tort, or
+ any other legal or equitable theory, will be subject to the exclusive
+ jurisdiction of the courts of the State of Delaware or of the Federal
+ courts sitting in that State. Each party submits to the personal
+ jurisdiction of those courts and waives all objections to that jurisdiction
+ and venue for those disputes.
+
+12.4 SEVERABILITY. The parties intend that if a court holds that any provision
+ or part of this Agreement is invalid or unenforceable under applicable law,
+ the court will modify the provision to the minimum extent necessary to make
+ it valid and enforceable, or if it cannot be made valid and enforceable,
+ the parties intend that the court will sever and delete the provision or
+ part from this Agreement. Any change to or deletion of a provision or part
+ of this Agreement under this Section will not affect the validity or
+ enforceability of the remainder of this Agreement, which will continue in
+ full force and effect.
diff --git a/custom-licenses/ISSL b/custom-licenses/ISSL
index eae71fc7..f987e502 100644
--- a/custom-licenses/ISSL
+++ b/custom-licenses/ISSL
@@ -1,63 +1,73 @@
-Intel Simplified Software License (Version February 2020)
-
-Use and Redistribution. You may use and redistribute the software (the “Software”), without modification,
-provided the following conditions are met:
-
-* Redistributions must reproduce the above copyright notice and the following terms of use in the Software
-and in the documentation and/or other materials provided with the distribution.
-
-* Neither the name of Intel nor the names of its suppliers may be used to endorse or promote products derived
-from this Software without specific prior written permission.
-
-* No reverse engineering, decompilation, or disassembly of this Software is permitted.
-
-Limited patent license. Intel grants you a world-wide, royalty-free, non-exclusive license under patents
-it now or hereafter owns or controls to make, have made, use, import, offer to sell and sell (“Utilize”)
-this Software, but solely to the extent that any such patent is necessary to Utilize the Software alone.
-The patent license shall not apply to any combinations which include this software. No hardware per se
-is licensed hereunder.
-
-Third party programs. The Software may contain Third Party Programs. “Third Party Programs” are third party
-software, open source software or other Intel software listed in the “third-party-programs.txt” or other similarly
-named text file that is included with the Software. Third Party Programs, even if included with the distribution
-of the Software, may be governed by separate license terms, including without limitation, third party license terms,
-open source software notices and terms, and/or other Intel software license terms. These separate license terms may
-govern your use of the Third Party Programs.
-
-DISCLAIMER. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
-AND NON-INFRINGEMENT ARE DISCLAIMED. THIS SOFTWARE IS NOT INTENDED FOR USE IN SYSTEMS OR APPLICATIONS
-WHERE FAILURE OF THE SOFTWARE MAY CAUSE PERSONAL INJURY OR DEATH AND YOU AGREE THAT YOU ARE FULLY RESPONSIBLE
-FOR ANY CLAIMS, COSTS, DAMAGES, EXPENSES, AND ATTORNEYS’ FEES ARISING OUT OF ANY SUCH USE, EVEN IF ANY CLAIM
-ALLEGES THAT INTEL WAS NEGLIGENT REGARDING THE DESIGN OR MANUFACTURE OF THE MATERIALS.
-
-LIMITATION OF LIABILITY. IN NO EVENT WILL INTEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. YOU AGREE TO
-INDEMNIFY AND HOLD INTEL HARMLESS AGAINST ANY CLAIMS AND EXPENSES RESULTING FROM YOUR USE OR UNAUTHORIZED
-USE OF THE SOFTWARE.
-
-No support. Intel may make changes to the Software, at any time without notice, and is not obligated to
-support, update or provide training for the Software.
-
-Termination. Intel may terminate your right to use the Software in the event of your breach of this Agreement
-and you fail to cure the breach within a reasonable period of time.
-
-Feedback. Should you provide Intel with comments, modifications, corrections, enhancements or other input
-(“Feedback”) related to the Software Intel will be free to use, disclose, reproduce, license or otherwise
-distribute or exploit the Feedback in its sole discretion without any obligations or restrictions of any
-kind, including without limitation, intellectual property rights or licensing obligations.
-
-Compliance with laws. You agree to comply with all relevant laws and regulations governing your use,
-transfer, import or export (or prohibition thereof) of the Software.
-
-Governing law. All disputes will be governed by the laws of the United States of America and the State
-of Delaware without reference to conflict of law principles and subject to the exclusive jurisdiction of
-the state or federal courts sitting in the State of Delaware, and each party agrees that it submits to
-the personal jurisdiction and venue of those courts and waives any objections. The United Nations
-Convention on Contracts for the International Sale of Goods (1980) is specifically excluded and will
-not apply to the Software.
-
-*Other names and brands may be claimed as the property of others.
+Intel Simplified Software License (Version August 2021)
+
+Use and Redistribution. You may use and redistribute the software (the
+"Software"), without modification, provided the following conditions are met:
+
+* Redistributions must reproduce the above copyright notice and the following
+ terms of use in the Software and in the documentation and/or other materials
+ provided with the distribution.
+* Neither the name of Intel nor the names of its suppliers may be used to
+ endorse or promote products derived from this Software without specific
+ prior written permission.
+* No reverse engineering, decompilation, or disassembly of this Software is
+ permitted.
+
+No other licenses. Except as provided in the preceding section, Intel grants no
+licenses or other rights by implication, estoppel or otherwise to, patent,
+copyright, trademark, trade name, service mark or other intellectual property
+licenses or rights of Intel.
+
+Third party software. The Software may contain Third Party Software. "Third
+Party Software" is open source software, third party software, or other Intel
+software that may be identified in the Software itself or in the files (if any)
+listed in the "third-party-software.txt" or similarly named text file included
+with the Software. Third Party Software, even if included with the distribution
+of the Software, may be governed by separate license terms, including without
+limitation, open source software license terms, third party software license
+terms, and other Intel software license terms. Those separate license terms
+solely govern your use of the Third Party Software, and nothing in this license
+limits any rights under, or grants rights that supersede, the terms of the
+applicable license terms.
+
+DISCLAIMER. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT ARE
+DISCLAIMED. THIS SOFTWARE IS NOT INTENDED FOR USE IN SYSTEMS OR APPLICATIONS
+WHERE FAILURE OF THE SOFTWARE MAY CAUSE PERSONAL INJURY OR DEATH AND YOU AGREE
+THAT YOU ARE FULLY RESPONSIBLE FOR ANY CLAIMS, COSTS, DAMAGES, EXPENSES, AND
+ATTORNEYS' FEES ARISING OUT OF ANY SUCH USE, EVEN IF ANY CLAIM ALLEGES THAT
+INTEL WAS NEGLIGENT REGARDING THE DESIGN OR MANUFACTURE OF THE SOFTWARE.
+
+LIMITATION OF LIABILITY. IN NO EVENT WILL INTEL BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+No support. Intel may make changes to the Software, at any time without notice,
+and is not obligated to support, update or provide training for the Software.
+
+Termination. Your right to use the Software is terminated in the event of your
+breach of this license.
+
+Feedback. Should you provide Intel with comments, modifications, corrections,
+enhancements or other input ("Feedback") related to the Software, Intel will be
+free to use, disclose, reproduce, license or otherwise distribute or exploit the
+Feedback in its sole discretion without any obligations or restrictions of any
+kind, including without limitation, intellectual property rights or licensing
+obligations.
+
+Compliance with laws. You agree to comply with all relevant laws and regulations
+governing your use, transfer, import or export (or prohibition thereof) of the
+Software.
+
+Governing law. All disputes will be governed by the laws of the United States of
+America and the State of Delaware without reference to conflict of law
+principles and subject to the exclusive jurisdiction of the state or federal
+courts sitting in the State of Delaware, and each party agrees that it submits
+to the personal jurisdiction and venue of those courts and waives any
+objections. The United Nations Convention on Contracts for the International
+Sale of Goods (1980) is specifically excluded and will not apply to the
+Software.
diff --git a/custom-licenses/syrah b/custom-licenses/syrah
new file mode 100644
index 00000000..5cd7f4e6
--- /dev/null
+++ b/custom-licenses/syrah
@@ -0,0 +1,32 @@
+Copyright (c) 2009, Stanford University, and authors listed below.
+All rights reserved.
+
+Original authors:
+ Solomon Boulos
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+Neither the name of Stanford University nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file
diff --git a/documentation/building_and_booting.md b/documentation/building_and_booting.md
new file mode 100644
index 00000000..478a4fb0
--- /dev/null
+++ b/documentation/building_and_booting.md
@@ -0,0 +1,134 @@
+### Building the Intel BSP layers
+
+The intel-common BSP provide a few carefully selected tune options and
+generic hardware support to cover the majority of current Intel CPUs and
+devices. The naming follows the convention of intel-<TUNE>-<BITS>, where
+TUNE is the gcc cpu-type (used with mtune and march typically) and BITS
+is either 32 bit or 64 bit.
+
+In order to build an image with BSP support for a given release, you
+need to clone the meta-intel layer from git repository:
+```
+git clone https://git.yoctoproject.org/meta-intel
+```
+
+Check out the appropriate branch or release tags. The branch name and tags
+would align with Yocto Project
+[Release Codenames](https://wiki.yoctoproject.org/wiki/Releases).
+Assuming meta-intel repository is cloned at the top-level of
+OE-Core build tree, you can build a BSP image by adding the location of
+the meta-intel layer to bblayers.conf:
+```
+BBLAYERS = " \
+ /openembedded-core/meta \
+ /openembedded-core/meta-intel "
+```
+
+To enable a particular machine, add a MACHINE line naming the BSP
+to the local.conf file:
+```
+MACHINE ?= "intel-corei7-64"
+```
+
+where this can be replaced by other MACHINE types available:
+
+ - intel-core2-32
+
+ This BSP is optimized for the Core2 family of CPUs as well as all
+ Atom CPUs prior to the Silvermont core.
+
+ - intel-corei7-64
+
+ This BSP is optimized for Nehalem and later Core and Xeon CPUs as
+ well as Silvermont and later Atom CPUs, such as the Baytrail SoCs.
+
+ - intel-skylake-64
+
+ This BSP uses [x86-64-v3 tuning](https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html).
+
+You should then be able to build an image as such:
+```
+$ source oe-init-build-env
+$ bitbake core-image-sato
+```
+
+At the end of a successful build, you should have an image that
+you can boot from a USB flash drive.
+
+
+## Booting the intel-common BSP images
+
+If you've built your own image, you'll find the bootable
+image in the build/tmp/deploy/images/{MACHINE} directory, where
+'MACHINE' refers to the machine name used in the build.
+
+Under Linux, insert a USB flash drive. Assuming the USB flash drive
+takes device /dev/sdf, use dd to copy the image to it. Before the image
+can be burned onto a USB drive, it should be un-mounted. Some Linux distros
+may automatically mount a USB drive when it is plugged in. Using USB device
+/dev/sdf as an example, find all mounted partitions:
+```
+$ mount | grep sdf
+```
+
+and un-mount those that are mounted, for example:
+```
+$ umount /dev/sdf1
+$ umount /dev/sdf2
+```
+
+Now burn the image onto the USB drive:
+```
+$ sudo dd if=core-image-sato-intel-corei7-64.wic of=/dev/sdf status=progress
+$ sync
+$ eject /dev/sdf
+```
+
+This should give you a bootable USB flash device. Insert the device
+into a bootable USB socket on the target, and power on. This should
+result in a system booted to the Sato graphical desktop.
+
+If you want a terminal, use the arrows at the top of the UI to move to
+different pages of available applications, one of which is named
+'Terminal'. Clicking that should give you a root terminal.
+
+If you want to ssh into the system, you can use the root terminal to
+ifconfig the IP address and use that to ssh in. The root password is
+empty, so to log in type 'root' for the user name and hit 'Enter' at
+the Password prompt: and you should be in.
+
+If you find you're getting corrupt images on the USB (it doesn't show
+the syslinux boot: prompt, or the boot: prompt contains strange
+characters), try doing this first:
+```
+$ dd if=/dev/zero of=/dev/sdf bs=1M count=512
+```
+
+## Building the installer image
+
+If you plan to install your image to your target machine, you can build a wic
+based installer image instead of default wic image. To build it, you need to
+add below configuration to local.conf :
+
+```
+WKS_FILE = "image-installer.wks.in"
+IMAGE_FSTYPES:append = " ext4"
+IMAGE_TYPEDEP:wic = "ext4"
+INITRD_IMAGE_LIVE="core-image-minimal-initramfs"
+do_image_wic[depends] += "${INITRD_IMAGE_LIVE}:do_image_complete"
+do_rootfs[depends] += "virtual/kernel:do_deploy"
+IMAGE_BOOT_FILES:append = "\
+ ${KERNEL_IMAGETYPE} \
+ microcode.cpio \
+ ${IMGDEPLOYDIR}/${IMAGE_BASENAME}-${MACHINE}.rootfs.ext4;rootfs.img \
+ ${@bb.utils.contains('EFI_PROVIDER', 'grub-efi', 'grub-efi-bootx64.efi;EFI/BOOT/bootx64.efi', '', d)} \
+ ${@bb.utils.contains('EFI_PROVIDER', 'grub-efi', '${IMAGE_ROOTFS}/boot/EFI/BOOT/grub.cfg;EFI/BOOT/grub.cfg', '', d)} \
+ ${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', 'systemd-bootx64.efi;EFI/BOOT/bootx64.efi', '', d)} \
+ ${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', '${IMAGE_ROOTFS}/boot/loader/loader.conf;loader/loader.conf ', '', d)} \
+ ${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', '${IMAGE_ROOTFS}/boot/loader/entries/boot.conf;loader/entries/boot.conf', '', d)} "
+```
+
+Burn the wic image onto USB flash device, insert the device to target machine
+and power on. This should start the installation process.
+
+
diff --git a/documentation/dpcpp-compiler.md b/documentation/dpcpp-compiler.md
new file mode 100644
index 00000000..b709a685
--- /dev/null
+++ b/documentation/dpcpp-compiler.md
@@ -0,0 +1,107 @@
+Intel(R) oneAPI DPC++/C++ Compiler (ICX) toolchain
+==========================================================================
+
+Get Started with the Intel oneAPI DPC++/C++ Compiler:
+
+https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compiler.html#
+
+
+Getting Started
+===============
+
+Clone the required layers and include them in bblayers.conf:
+
+```
+git clone https://git.openembedded.org/openembedded-core
+git clone https://git.openembedded.org/bitbake
+git clone https://git.openembedded.org/meta-openembedded
+git clone https://github.com/kraj/meta-clang.git
+git clone https://git.yoctoproject.org/meta-intel
+
+$ source openembedded-core/oe-init-build-env
+
+$ bitbake-layers add-layer ../meta-openembedded/meta-oe/
+$ bitbake-layers add-layer ../meta-intel
+$ bitbake-layers add-layer ../meta-clang
+```
+
+Distro
+======
+
+Note that oneAPI DPC++/C++ compiler currently only works when the vendor string is "oe".
+
+```
+DISTRO ?= "nodistro"
+```
+
+MACHINE configuration
+=====================
+
+```
+MACHINE ?= "intel-skylake-64"
+```
+
+Package installation
+====================
+
+```
+# To include OpenCL driver that might be needed when compiling SYCL programs, include:
+IMAGE_INSTALL:append = " intel-compute-runtime intel-graphics-compiler"
+
+# To install only runtime libraries, include:
+IMAGE_INSTALL:append = " intel-oneapi-dpcpp-cpp-runtime intel-oneapi-dpcpp-cpp-runtime-dev"
+
+# To install the toolchain, include:
+IMAGE_INSTALL:append = " intel-oneapi-dpcpp-cpp intel-oneapi-dpcpp-cpp-dev"
+```
+in local.conf.
+
+Build an image
+==============
+
+```
+$ bitbake core-image-minimal
+```
+
+Including oneAPI C++/DPC++ compiler in generated SDK toolchain
+==============================================================
+
+The compiler is not included in the generated SDK by default. If it is expected to be part of SDK, add ICXSDK = "1" in local.conf:
+
+```
+ICXSDK = "1"
+```
+
+Generate SDK:
+```
+bitbake core-image-minimal -c populate_sdk
+```
+
+
+To setup PATH variables on target
+=================================
+
+Once image is booted successfully, some variables would need to be exported to make sure compiler can be used:
+
+```
+$ source /opt/intel/oneapi/compiler/2022.1.0/env/vars.sh
+
+$ mkdir -p /lib64
+
+$ ln -sf /lib/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2
+```
+
+Build application and run
+=========================
+
+To compile a sycl application, for example:
+
+```
+$ icpx --target=x86_64-oe-linux -fsycl simple-sycl-app.c -o simple-sycl-app
+```
+
+To run:
+
+```
+$ ./simple-sycl-app
+```
diff --git a/documentation/openvino.md b/documentation/openvino.md
new file mode 100644
index 00000000..50dc680d
--- /dev/null
+++ b/documentation/openvino.md
@@ -0,0 +1,95 @@
+Build a Yocto Image with OpenVINO™ toolkit
+==========================================
+
+Follow the [Yocto Project official documentation](https://docs.yoctoproject.org/brief-yoctoprojectqs/index.html#compatible-linux-distribution) to set up and configure your host machine to be compatible with BitBake.
+
+## Step 1: Set Up Environment
+
+1. Clone the repositories.
+
+```
+ git clone https://git.yoctoproject.org/git/poky
+ git clone https://github.com/openembedded/meta-openembedded
+ git clone https://git.yoctoproject.org/git/meta-intel
+```
+
+
+2. Set up the OpenEmbedded build environment.
+
+```
+ source poky/oe-init-build-env
+
+```
+
+
+
+3. Add BitBake layers.
+
+
+```
+ bitbake-layers add-layer ../meta-openembedded/meta-oe
+ bitbake-layers add-layer ../meta-openembedded/meta-python
+ bitbake-layers add-layer ../meta-intel
+
+```
+
+
+4. Set up BitBake configurations.
+ Include extra configuration in the `conf/local.conf` file in your build directory as required.
+
+
+```
+ MACHINE = "intel-skylake-64"
+
+ # Enable building OpenVINO Python API.
+ # This requires meta-python layer to be included in bblayers.conf.
+ PACKAGECONFIG:append:pn-openvino-inference-engine = " python3"
+
+ # This adds OpenVINO related libraries in the target image.
+ CORE_IMAGE_EXTRA_INSTALL:append = " openvino-inference-engine"
+
+ # This adds OpenVINO samples in the target image.
+ CORE_IMAGE_EXTRA_INSTALL:append = " openvino-inference-engine-samples"
+
+ # Include OpenVINO Python API package in the target image.
+ CORE_IMAGE_EXTRA_INSTALL:append = " openvino-inference-engine-python3"
+
+ # Include model conversion API in the target image.
+ CORE_IMAGE_EXTRA_INSTALL:append = " openvino-model-optimizer"
+
+```
+
+## Step 2: Build a Yocto Image with OpenVINO Packages
+
+Run BitBake to build your image with OpenVINO packages. For example, to build the minimal image, run the following command:
+
+
+```
+ bitbake core-image-minimal
+
+```
+
+## Step 3: Verify the Yocto Image
+
+Verify that OpenVINO packages were built successfully. Run the following command:
+
+```
+ oe-pkgdata-util list-pkgs | grep openvino
+
+```
+
+
+If the image build is successful, it will return the list of packages as below:
+
+```
+ openvino-inference-engine
+ openvino-inference-engine-dbg
+ openvino-inference-engine-dev
+ openvino-inference-engine-python3
+ openvino-inference-engine-samples
+ openvino-inference-engine-src
+ openvino-model-optimizer
+ openvino-model-optimizer-dbg
+ openvino-model-optimizer-dev
+
+```
diff --git a/documentation/reporting_bugs.md b/documentation/reporting_bugs.md
new file mode 100644
index 00000000..5fbc3d27
--- /dev/null
+++ b/documentation/reporting_bugs.md
@@ -0,0 +1,22 @@
+## Reporting bugs
+
+If you have problems with or questions about a particular BSP, please
+contact the maintainer listed in the [Maintainer](../README.md#maintainers) section directly (cc:ing
+the Yocto mailing list puts it in the archive and helps other people
+who might have the same questions in the future), but please try to do
+the following first:
+
+- look in the [Yocto Project Bugzilla](http://bugzilla.yoctoproject.org/) to see if a
+ problem has already been reported
+
+- look through recent entries of the [meta-intel](https://lists.yoctoproject.org/g/meta-intel/messages)
+ and [Yocto Archives](https://lists.yoctoproject.org/g/yocto/messages) mailing list archives to see
+ if other people have run into similar problems or had similar questions answered.
+
+If you believe you have encountered a bug, you can open a new bug and
+enter the details in the [Yocto Project Bugzilla](https://bugzilla.yoctoproject.org/).
+If you're relatively certain that it's a bug against the BSP itself, please use the
+'BSPs | bsps-meta-intel' category for the bug; otherwise, please submit the bug against
+the most likely category for the problem. if you're wrong, it's not a big deal and
+the bug will be recategorized upon triage.
+
diff --git a/documentation/secureboot/README b/documentation/secureboot/README
deleted file mode 100644
index 3d5703bb..00000000
--- a/documentation/secureboot/README
+++ /dev/null
@@ -1,38 +0,0 @@
-Currently, only one implementation of Secure Boot is available out of the box,
-which is using a single signed EFI application to directly boot the kernel with
-an optional initramfs.
-
-This can be added to your build either through local.conf, or via your own
-custom image recipe.
-
-If you are adding it via local.conf, set the following variables:
-
-IMAGE_FEATURES += "secureboot"
-WKS_FILE = "generic-bootdisk.wks.in"
-SECURE_BOOT_SIGNING_KEY = "/path/to/your/signing/key"
-SECURE_BOOT_SIGNING_CERT = "/path/to/your/signing/cert"
-IMAGE_CLASSES += "uefi-comboapp"
-
-If working with an image recipe, you can inherit uefi-comboapp directly instead
-of using the IMAGE_CLASSES variable.
-
-The signing keys and certs can be created via openssl commands. Here's an
-example:
-openssl req -new -x509 -newkey rsa:2048 -subj "/CN=your-subject/" -keyout \
-your-key.key -out your-key.crt -days 365 -nodes -sha256
-openssl x509 -in your-key.crt -out your-key.cer -outform DER
-
-The .crt file is your SECURE_BOOT_SIGNING_CERT, and the .key file is your
-SECURE_BOOT_SIGNING_KEY.
-
-You should enroll the .crt key in your firmware under the PK, KEK, and DB
-options (methods are different depending on your firmware). If a key should ever
-become invalid, enroll it under DBX to blacklist it.
-
-The comboapp can be further manipulated in a number of ways. You can modify the
-kernel command line via the APPEND variable, you can change the default UUID via
-the DISK_SIGNATURE_UUID variable, and you can modify the contents of the
-initramfs via the INITRD_IMAGE or INITRD_LIVE variables.
-
-A simple Secure Boot enabled image used for testing can be viewed at:
-common/recipes-selftest/images/secureboot-selftest-image-signed.bb
diff --git a/documentation/submitting_patches.md b/documentation/submitting_patches.md
new file mode 100644
index 00000000..f36c4b08
--- /dev/null
+++ b/documentation/submitting_patches.md
@@ -0,0 +1,26 @@
+## Guidelines for submitting patches
+
+Please submit any patches against meta-intel BSPs to the
+[meta-intel mailing list](https://lists.yoctoproject.org/g/meta-intel)
+(email: meta-intel@lists.yoctoproject.org). Also, if your patches are
+available via a public git repository, please also include a URL to
+the repo and branch containing your patches as that makes it easier
+for maintainers to grab and test your patches.
+
+The patches should follow the suggestions outlined in the
+[Yocto Project and OpenEmbedded Contributor Guide](https://docs.yoctoproject.org/dev/contributor-guide/index.html).
+In addition, for any non-trivial patch, provide information about how you
+tested the patch, and for any non-trivial or non-obvious testing
+setup, provide details of that setup.
+
+Doing a quick 'git log' in meta-intel will provide you with many
+examples of good example commits if you have questions about any
+aspect of the preferred format.
+
+The meta-intel maintainers will do their best to review and/or pull in
+a patch or patch sets within 24 hours of the time it was posted. For
+larger and/or more involved patches and patch sets, the review process
+may take longer.
+
+Please see the [maintainers](../README.md#maintainers) section for the list of maintainers. It's also
+a good idea to cc: the maintainer, if applicable.
diff --git a/documentation/tested_hardware.md b/documentation/tested_hardware.md
new file mode 100644
index 00000000..48a25ab4
--- /dev/null
+++ b/documentation/tested_hardware.md
@@ -0,0 +1,24 @@
+## Tested Hardware
+
+The following undergo regular basic testing with their respective MACHINE types.
+
+- intel-corei7-64:
+ * Alder Lake-P
+ * Alder Lake-S
+ * Alder Lake-PS
+ * Elkhart Lake
+ * Metor Lake-P
+ * Raptor Lake-P
+ * Tiger Lake
+
+- intel-skylake-64:
+ * Alder Lake-P
+ * Alder Lake-S
+ * Alder Lake-PS
+ * Elkhart Lake
+ * Metor Lake-P
+ * Raptor Lake-P
+ * Tiger Lake
+
+- intel-core2-32:
+ * MinnowBoard Turbot
diff --git a/dynamic-layers/clang-layer/recipes-core/dnn/files/fix-gcc-11-failures.patch b/dynamic-layers/clang-layer/recipes-core/dnn/files/fix-gcc-11-failures.patch
deleted file mode 100644
index 758cc45d..00000000
--- a/dynamic-layers/clang-layer/recipes-core/dnn/files/fix-gcc-11-failures.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From f04b34854b42a0f5bd754398fdefd4573bb38b66 Mon Sep 17 00:00:00 2001
-From: Denis Samoilov <denis.samoylov@intel.com>
-Date: Fri, 2 Apr 2021 19:46:22 -0700
-Subject: [PATCH] common, gpu: include thread and limit headers to fix GCC 11
- build issues
-
-Upstream-Status: Backport [https://github.com/oneapi-src/oneDNN/commit/1fe0f2594a1bfc6386fd8f6537f971d5ae9c1214]
-Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
-
----
- src/common/primitive_cache.hpp | 1 +
- src/gpu/jit/ngen/ngen_auto_swsb.hpp | 1 +
- 2 files changed, 2 insertions(+)
-
-diff --git a/src/common/primitive_cache.hpp b/src/common/primitive_cache.hpp
-index 73cb1224f..05a3e53e5 100644
---- a/src/common/primitive_cache.hpp
-+++ b/src/common/primitive_cache.hpp
-@@ -20,6 +20,7 @@
- #include <future>
- #include <list>
- #include <memory>
-+#include <thread>
- #include <unordered_map>
-
- #include "c_types_map.hpp"
-diff --git a/src/gpu/jit/ngen/ngen_auto_swsb.hpp b/src/gpu/jit/ngen/ngen_auto_swsb.hpp
-index de3417af3..62ef2a571 100644
---- a/src/gpu/jit/ngen/ngen_auto_swsb.hpp
-+++ b/src/gpu/jit/ngen/ngen_auto_swsb.hpp
-@@ -33,6 +33,7 @@
-
- #include <list>
- #include <map>
-+#include <limits>
-
- namespace ngen {
- namespace autoswsb {
diff --git a/dynamic-layers/clang-layer/recipes-core/dnn/onednn_2.2.3.bb b/dynamic-layers/clang-layer/recipes-core/dnn/onednn_3.4.1.bb
index ebc33d20..2fa3f627 100644
--- a/dynamic-layers/clang-layer/recipes-core/dnn/onednn_2.2.3.bb
+++ b/dynamic-layers/clang-layer/recipes-core/dnn/onednn_3.4.1.bb
@@ -3,20 +3,20 @@ SUMMARY = "Deep Neural Network Library"
DESCRIPTION = "This software is a user mode library that accelerates\
deep-learning applications and frameworks on Intel architecture."
LICENSE = "Apache-2.0 & BSD-3-Clause & BSL-1.0"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=8e17c0f9656ebaf0c380d9b22707c846 \
+LIC_FILES_CHKSUM = "file://LICENSE;md5=3b64000f6e7d52516017622a37a94ce9 \
file://tests/gtests/gtest/LICENSE;md5=cbbd27594afd089daa160d3a16dd515a \
file://src/cpu/x64/xbyak/COPYRIGHT;md5=3b9bf048d063d54cdb28964db558bcc7 \
file://src/common/ittnotify/LICENSE.BSD;md5=e671ff178b24a95a382ba670503c66fb \
- file://doc/assets/mathjax/MathJax.js;endline=17;md5=25a014ad78c3d72a0e15d15f1d007c20 \
"
SECTION = "lib"
inherit pkgconfig cmake ptest
+DNN_BRANCH = "rls-v${@'.'.join(d.getVar('PV').split('.')[0:2])}"
+
S = "${WORKDIR}/git"
-SRCREV = "7336ca9f055cf1bfa13efb658fe15dc9b41f0740"
-SRC_URI = "git://github.com/oneapi-src/oneDNN.git;branch=rls-v2.2 \
- file://fix-gcc-11-failures.patch \
+SRCREV = "f5ff0a6de16c130053bec1a1aec3a9b826c66f78"
+SRC_URI = "git://github.com/oneapi-src/oneDNN.git;branch=${DNN_BRANCH};protocol=https \
file://run-ptest \
"
@@ -25,7 +25,7 @@ UPSTREAM_CHECK_GITTAGREGEX = "^v(?P<pver>(\d+(\.\d+)+))$"
CVE_PRODUCT = "intel:math_kernel_library"
COMPATIBLE_HOST = '(x86_64).*-linux'
-COMPATIBLE_HOST_libc-musl = 'null'
+COMPATIBLE_HOST:libc-musl = 'null'
EXTRA_OECMAKE += " \
-DDNNL_LIBRARY_TYPE=SHARED \
@@ -34,12 +34,13 @@ EXTRA_OECMAKE += " \
-DDNNL_CPU_RUNTIME=OMP \
-DDNNL_ARCH_OPT_FLAGS="" \
-DCMAKE_SKIP_RPATH=ON \
+ -DONEDNN_BUILD_GRAPH=OFF \
"
-PACKAGECONFIG ??= ""
-PACKAGECONFIG[gpu] = "-DDNNL_GPU_RUNTIME=OCL, , opencl-headers ocl-icd, intel-compute-runtime"
+PACKAGECONFIG ??= "gpu"
+PACKAGECONFIG[gpu] = "-DDNNL_GPU_RUNTIME=OCL, , opencl-headers virtual/opencl-icd, intel-compute-runtime"
-do_install_append () {
+do_install:append () {
install -d ${D}${bindir}/mkl-dnn/tests/benchdnn/inputs
install -m 0755 ${B}/tests/benchdnn/benchdnn ${D}${bindir}/mkl-dnn/tests/benchdnn
cp -r ${B}/tests/benchdnn/inputs/* ${D}${bindir}/mkl-dnn/tests/benchdnn/inputs
@@ -53,4 +54,4 @@ do_install_ptest () {
PACKAGES =+ "${PN}-test"
-FILES_${PN}-test = "${bindir}/mkl-dnn/*"
+FILES:${PN}-test = "${bindir}/mkl-dnn/*"
diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/0001-Fix-debug-info-of-work-item-builtin-translation-745.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/0001-Fix-debug-info-of-work-item-builtin-translation-745.patch
deleted file mode 100644
index 923b871f..00000000
--- a/dynamic-layers/clang-layer/recipes-devtools/clang/files/0001-Fix-debug-info-of-work-item-builtin-translation-745.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-From 200c200eb19602ffd7c8f29d0b2df9df1fd311bf Mon Sep 17 00:00:00 2001
-From: Naveen Saini <naveen.kumar.saini@intel.com>
-Date: Wed, 7 Apr 2021 17:44:20 +0800
-Subject: [PATCH] Fix debug info of work-item builtin translation (#745)
-
-debug info of work-item builtins are lost in both llvm IR -> spirv and
-spirv -> llvm IR translations. See #744
-
-Upstream-Status: Backport [https://github.com/KhronosGroup/SPIRV-LLVM-Translator/commit/c734c5c8bbd3012a09c610e4be68e90cc603c580]
-Signed-off-by: Wenju He <wenju.he@intel.com>
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
----
- lib/SPIRV/OCL20ToSPIRV.cpp | 5 ++-
- lib/SPIRV/SPIRVReader.cpp | 1 +
- test/DebugInfo/builtin-get-global-id.ll | 60 +++++++++++++++++++++++++
- 3 files changed, 65 insertions(+), 1 deletion(-)
- create mode 100644 test/DebugInfo/builtin-get-global-id.ll
-
-diff --git a/lib/SPIRV/OCL20ToSPIRV.cpp b/lib/SPIRV/OCL20ToSPIRV.cpp
-index 1262c48c..a742c8cf 100644
---- a/lib/SPIRV/OCL20ToSPIRV.cpp
-+++ b/lib/SPIRV/OCL20ToSPIRV.cpp
-@@ -1297,11 +1297,14 @@ void OCL20ToSPIRV::transWorkItemBuiltinsToVariables() {
- for (auto UI = I.user_begin(), UE = I.user_end(); UI != UE; ++UI) {
- auto CI = dyn_cast<CallInst>(*UI);
- assert(CI && "invalid instruction");
-- Value *NewValue = new LoadInst(BV, "", CI);
-+ const DebugLoc &DLoc = CI->getDebugLoc();
-+ Instruction *NewValue = new LoadInst(BV, "", CI);
-+ NewValue->setDebugLoc(DLoc);
- LLVM_DEBUG(dbgs() << "Transform: " << *CI << " => " << *NewValue << '\n');
- if (IsVec) {
- NewValue =
- ExtractElementInst::Create(NewValue, CI->getArgOperand(0), "", CI);
-+ NewValue->setDebugLoc(DLoc);
- LLVM_DEBUG(dbgs() << *NewValue << '\n');
- }
- NewValue->takeName(CI);
-diff --git a/lib/SPIRV/SPIRVReader.cpp b/lib/SPIRV/SPIRVReader.cpp
-index 16a3dd38..528f6663 100644
---- a/lib/SPIRV/SPIRVReader.cpp
-+++ b/lib/SPIRV/SPIRVReader.cpp
-@@ -307,6 +307,7 @@ bool SPIRVToLLVM::transOCLBuiltinFromVariable(GlobalVariable *GV,
- auto Replace = [&](std::vector<Value *> Arg, Instruction *I) {
- auto Call = CallInst::Create(Func, Arg, "", I);
- Call->takeName(I);
-+ Call->setDebugLoc(I->getDebugLoc());
- setAttrByCalledFunc(Call);
- SPIRVDBG(dbgs() << "[transOCLBuiltinFromVariable] " << *I << " -> " << *Call
- << '\n';)
-diff --git a/test/DebugInfo/builtin-get-global-id.ll b/test/DebugInfo/builtin-get-global-id.ll
-new file mode 100644
-index 00000000..a4a00e63
---- /dev/null
-+++ b/test/DebugInfo/builtin-get-global-id.ll
-@@ -0,0 +1,60 @@
-+; Check debug info of builtin get_global_id is preserved from LLVM IR to spirv
-+; and spirv to LLVM IR translation.
-+
-+; Original .cl source:
-+; kernel void test() {
-+; size_t gid = get_global_id(0);
-+; }
-+
-+; Command line:
-+; ./clang -cc1 1.cl -triple spir64 -cl-std=cl2.0 -emit-llvm -finclude-default-header -debug-info-kind=line-tables-only -O0
-+
-+; RUN: llvm-as %s -o %t.bc
-+; RUN: llvm-spirv %t.bc -spirv-text -o - | FileCheck %s --check-prefix CHECK-SPIRV
-+; RUN: llvm-spirv %t.bc -o %t.spv
-+; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o - | FileCheck %s
-+
-+target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
-+target triple = "spir64"
-+
-+; CHECK-SPIRV: ExtInst {{.*}} DebugScope
-+; CHECK-SPIRV-NEXT: Line {{[0-9]+}} 2 16
-+; CHECK-SPIRV-NEXT: Load {{[0-9]+}} [[LoadRes:[0-9]+]]
-+; CHECK-SPIRV-NEXT: CompositeExtract {{[0-9]+}} {{[0-9]+}} [[LoadRes]] 0
-+
-+; Function Attrs: convergent noinline norecurse nounwind optnone
-+define spir_kernel void @test() #0 !dbg !7 !kernel_arg_addr_space !2 !kernel_arg_access_qual !2 !kernel_arg_type !2 !kernel_arg_base_type !2 !kernel_arg_type_qual !2 {
-+entry:
-+ %gid = alloca i64, align 8
-+ %call = call spir_func i64 @_Z13get_global_idj(i32 0) #2, !dbg !10
-+; CHECK: %call = call spir_func i64 @_Z13get_global_idj(i32 0) #1, !dbg [[DBG:![0-9]+]]
-+ store i64 %call, i64* %gid, align 8, !dbg !11
-+ ret void, !dbg !12
-+}
-+
-+; Function Attrs: convergent nounwind readnone
-+declare spir_func i64 @_Z13get_global_idj(i32) #1
-+
-+attributes #0 = { convergent noinline norecurse nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
-+attributes #1 = { convergent nounwind readnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
-+attributes #2 = { convergent nounwind readnone }
-+
-+!llvm.dbg.cu = !{!0}
-+!llvm.module.flags = !{!3, !4}
-+!opencl.ocl.version = !{!5}
-+!opencl.spir.version = !{!5}
-+!llvm.ident = !{!6}
-+
-+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0 (https://github.com/llvm/llvm-project.git b5bc56da8aa23dc57db9d286b0591dbcf9b1bdd3)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, nameTableKind: None)
-+!1 = !DIFile(filename: "<stdin>", directory: "")
-+!2 = !{}
-+!3 = !{i32 2, !"Debug Info Version", i32 3}
-+!4 = !{i32 1, !"wchar_size", i32 4}
-+!5 = !{i32 2, i32 0}
-+!6 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project.git b5bc56da8aa23dc57db9d286b0591dbcf9b1bdd3)"}
-+!7 = distinct !DISubprogram(name: "test", scope: !8, file: !8, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
-+!8 = !DIFile(filename: "1.cl", directory: "")
-+!9 = !DISubroutineType(types: !2)
-+!10 = !DILocation(line: 2, column: 16, scope: !7)
-+!11 = !DILocation(line: 2, column: 10, scope: !7)
-+!12 = !DILocation(line: 3, column: 1, scope: !7)
---
-2.17.1
-
diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/0001-Memory-leak-fix-for-Managed-Static-Mutex.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/0001-Memory-leak-fix-for-Managed-Static-Mutex.patch
deleted file mode 100644
index 103dad5e..00000000
--- a/dynamic-layers/clang-layer/recipes-devtools/clang/files/0001-Memory-leak-fix-for-Managed-Static-Mutex.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From c86c43b70e029b102543e8a85d269cbeb5c00279 Mon Sep 17 00:00:00 2001
-From: juanrod2 <>
-Date: Tue, 22 Dec 2020 08:33:08 +0800
-Subject: [PATCH] Memory leak fix for Managed Static Mutex
-
-Upstream-Status: Backport [Taken from opencl-clang patches; https://github.com/intel/opencl-clang/blob/ocl-open-100/patches/llvm/0001-Memory-leak-fix-for-Managed-Static-Mutex.patch]
-
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
-
-Cleaning a mutex inside ManagedStatic llvm class.
----
- llvm/lib/Support/ManagedStatic.cpp | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/llvm/lib/Support/ManagedStatic.cpp b/llvm/lib/Support/ManagedStatic.cpp
-index 053493f72fb5..6571580ccecf 100644
---- a/llvm/lib/Support/ManagedStatic.cpp
-+++ b/llvm/lib/Support/ManagedStatic.cpp
-@@ -76,8 +76,12 @@ void ManagedStaticBase::destroy() const {
-
- /// llvm_shutdown - Deallocate and destroy all ManagedStatic variables.
- void llvm::llvm_shutdown() {
-- std::lock_guard<std::recursive_mutex> Lock(*getManagedStaticMutex());
-+ getManagedStaticMutex()->lock();
-
- while (StaticList)
- StaticList->destroy();
-+
-+ getManagedStaticMutex()->unlock();
-+ delete ManagedStaticMutex;
-+ ManagedStaticMutex = nullptr;
- }
---
-2.29.2
-
diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/0002-Add-cl_khr_extended_subgroup-extensions.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/0002-Add-cl_khr_extended_subgroup-extensions.patch
deleted file mode 100644
index cbe492c4..00000000
--- a/dynamic-layers/clang-layer/recipes-devtools/clang/files/0002-Add-cl_khr_extended_subgroup-extensions.patch
+++ /dev/null
@@ -1,812 +0,0 @@
-From 27d47f1a17c8921b07acc8cdc26e38cc609de4a9 Mon Sep 17 00:00:00 2001
-From: Naveen Saini <naveen.kumar.saini@intel.com>
-Date: Wed, 7 Apr 2021 16:38:38 +0800
-Subject: [PATCH 2/2] Add cl_khr_extended_subgroup extensions.
-
-Added extensions and their function declarations into
-the standard header.
-
-Patch by Piotr Fusik!
-
-Tags: #clang
-
-Upstream-Status: Backport [https://github.com/llvm/llvm-project/commit/4a4402f0d72167477a6252e4c3daf5089ebc8f9a]
-Signed-off-by: Anastasia Stulova <anastasia.stulova@arm.com>
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
----
- .../include/clang/Basic/OpenCLExtensions.def | 7 +
- clang/lib/Headers/opencl-c.h | 668 ++++++++++++++++++
- clang/test/SemaOpenCL/extension-version.cl | 83 +++
- 3 files changed, 758 insertions(+)
-
-diff --git a/clang/include/clang/Basic/OpenCLExtensions.def b/clang/include/clang/Basic/OpenCLExtensions.def
-index 608f78a13eef..d1574164f9b2 100644
---- a/clang/include/clang/Basic/OpenCLExtensions.def
-+++ b/clang/include/clang/Basic/OpenCLExtensions.def
-@@ -74,6 +74,13 @@ OPENCLEXT_INTERNAL(cl_khr_mipmap_image_writes, 200, ~0U)
- OPENCLEXT_INTERNAL(cl_khr_srgb_image_writes, 200, ~0U)
- OPENCLEXT_INTERNAL(cl_khr_subgroups, 200, ~0U)
- OPENCLEXT_INTERNAL(cl_khr_terminate_context, 200, ~0U)
-+OPENCLEXT_INTERNAL(cl_khr_subgroup_extended_types, 200, ~0U)
-+OPENCLEXT_INTERNAL(cl_khr_subgroup_non_uniform_vote, 200, ~0U)
-+OPENCLEXT_INTERNAL(cl_khr_subgroup_ballot, 200, ~0U)
-+OPENCLEXT_INTERNAL(cl_khr_subgroup_non_uniform_arithmetic, 200, ~0U)
-+OPENCLEXT_INTERNAL(cl_khr_subgroup_shuffle, 200, ~0U)
-+OPENCLEXT_INTERNAL(cl_khr_subgroup_shuffle_relative, 200, ~0U)
-+OPENCLEXT_INTERNAL(cl_khr_subgroup_clustered_reduce, 200, ~0U)
-
- // Clang Extensions.
- OPENCLEXT_INTERNAL(cl_clang_storage_class_specifiers, 100, ~0U)
-diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
-index 93a946cec5b1..67d900eb1c3d 100644
---- a/clang/lib/Headers/opencl-c.h
-+++ b/clang/lib/Headers/opencl-c.h
-@@ -17530,6 +17530,674 @@ double __ovld __conv sub_group_scan_inclusive_max(double x);
-
- #endif //cl_khr_subgroups cl_intel_subgroups
-
-+#if defined(cl_khr_subgroup_extended_types)
-+char __ovld __conv sub_group_broadcast( char value, uint index );
-+char2 __ovld __conv sub_group_broadcast( char2 value, uint index );
-+char3 __ovld __conv sub_group_broadcast( char3 value, uint index );
-+char4 __ovld __conv sub_group_broadcast( char4 value, uint index );
-+char8 __ovld __conv sub_group_broadcast( char8 value, uint index );
-+char16 __ovld __conv sub_group_broadcast( char16 value, uint index );
-+
-+uchar __ovld __conv sub_group_broadcast( uchar value, uint index );
-+uchar2 __ovld __conv sub_group_broadcast( uchar2 value, uint index );
-+uchar3 __ovld __conv sub_group_broadcast( uchar3 value, uint index );
-+uchar4 __ovld __conv sub_group_broadcast( uchar4 value, uint index );
-+uchar8 __ovld __conv sub_group_broadcast( uchar8 value, uint index );
-+uchar16 __ovld __conv sub_group_broadcast( uchar16 value, uint index );
-+
-+short __ovld __conv sub_group_broadcast( short value, uint index );
-+short2 __ovld __conv sub_group_broadcast( short2 value, uint index );
-+short3 __ovld __conv sub_group_broadcast( short3 value, uint index );
-+short4 __ovld __conv sub_group_broadcast( short4 value, uint index );
-+short8 __ovld __conv sub_group_broadcast( short8 value, uint index );
-+short16 __ovld __conv sub_group_broadcast( short16 value, uint index );
-+
-+ushort __ovld __conv sub_group_broadcast( ushort value, uint index );
-+ushort2 __ovld __conv sub_group_broadcast( ushort2 value, uint index );
-+ushort3 __ovld __conv sub_group_broadcast( ushort3 value, uint index );
-+ushort4 __ovld __conv sub_group_broadcast( ushort4 value, uint index );
-+ushort8 __ovld __conv sub_group_broadcast( ushort8 value, uint index );
-+ushort16 __ovld __conv sub_group_broadcast( ushort16 value, uint index );
-+
-+// scalar int broadcast is part of cl_khr_subgroups
-+int2 __ovld __conv sub_group_broadcast( int2 value, uint index );
-+int3 __ovld __conv sub_group_broadcast( int3 value, uint index );
-+int4 __ovld __conv sub_group_broadcast( int4 value, uint index );
-+int8 __ovld __conv sub_group_broadcast( int8 value, uint index );
-+int16 __ovld __conv sub_group_broadcast( int16 value, uint index );
-+
-+// scalar uint broadcast is part of cl_khr_subgroups
-+uint2 __ovld __conv sub_group_broadcast( uint2 value, uint index );
-+uint3 __ovld __conv sub_group_broadcast( uint3 value, uint index );
-+uint4 __ovld __conv sub_group_broadcast( uint4 value, uint index );
-+uint8 __ovld __conv sub_group_broadcast( uint8 value, uint index );
-+uint16 __ovld __conv sub_group_broadcast( uint16 value, uint index );
-+
-+// scalar long broadcast is part of cl_khr_subgroups
-+long2 __ovld __conv sub_group_broadcast( long2 value, uint index );
-+long3 __ovld __conv sub_group_broadcast( long3 value, uint index );
-+long4 __ovld __conv sub_group_broadcast( long4 value, uint index );
-+long8 __ovld __conv sub_group_broadcast( long8 value, uint index );
-+long16 __ovld __conv sub_group_broadcast( long16 value, uint index );
-+
-+// scalar ulong broadcast is part of cl_khr_subgroups
-+ulong2 __ovld __conv sub_group_broadcast( ulong2 value, uint index );
-+ulong3 __ovld __conv sub_group_broadcast( ulong3 value, uint index );
-+ulong4 __ovld __conv sub_group_broadcast( ulong4 value, uint index );
-+ulong8 __ovld __conv sub_group_broadcast( ulong8 value, uint index );
-+ulong16 __ovld __conv sub_group_broadcast( ulong16 value, uint index );
-+
-+// scalar float broadcast is part of cl_khr_subgroups
-+float2 __ovld __conv sub_group_broadcast( float2 value, uint index );
-+float3 __ovld __conv sub_group_broadcast( float3 value, uint index );
-+float4 __ovld __conv sub_group_broadcast( float4 value, uint index );
-+float8 __ovld __conv sub_group_broadcast( float8 value, uint index );
-+float16 __ovld __conv sub_group_broadcast( float16 value, uint index );
-+
-+char __ovld __conv sub_group_reduce_add( char value );
-+uchar __ovld __conv sub_group_reduce_add( uchar value );
-+short __ovld __conv sub_group_reduce_add( short value );
-+ushort __ovld __conv sub_group_reduce_add( ushort value );
-+
-+char __ovld __conv sub_group_reduce_min( char value );
-+uchar __ovld __conv sub_group_reduce_min( uchar value );
-+short __ovld __conv sub_group_reduce_min( short value );
-+ushort __ovld __conv sub_group_reduce_min( ushort value );
-+
-+char __ovld __conv sub_group_reduce_max( char value );
-+uchar __ovld __conv sub_group_reduce_max( uchar value );
-+short __ovld __conv sub_group_reduce_max( short value );
-+ushort __ovld __conv sub_group_reduce_max( ushort value );
-+
-+char __ovld __conv sub_group_scan_inclusive_add( char value );
-+uchar __ovld __conv sub_group_scan_inclusive_add( uchar value );
-+short __ovld __conv sub_group_scan_inclusive_add( short value );
-+ushort __ovld __conv sub_group_scan_inclusive_add( ushort value );
-+
-+char __ovld __conv sub_group_scan_inclusive_min( char value );
-+uchar __ovld __conv sub_group_scan_inclusive_min( uchar value );
-+short __ovld __conv sub_group_scan_inclusive_min( short value );
-+ushort __ovld __conv sub_group_scan_inclusive_min( ushort value );
-+
-+char __ovld __conv sub_group_scan_inclusive_max( char value );
-+uchar __ovld __conv sub_group_scan_inclusive_max( uchar value );
-+short __ovld __conv sub_group_scan_inclusive_max( short value );
-+ushort __ovld __conv sub_group_scan_inclusive_max( ushort value );
-+
-+char __ovld __conv sub_group_scan_exclusive_add( char value );
-+uchar __ovld __conv sub_group_scan_exclusive_add( uchar value );
-+short __ovld __conv sub_group_scan_exclusive_add( short value );
-+ushort __ovld __conv sub_group_scan_exclusive_add( ushort value );
-+
-+char __ovld __conv sub_group_scan_exclusive_min( char value );
-+uchar __ovld __conv sub_group_scan_exclusive_min( uchar value );
-+short __ovld __conv sub_group_scan_exclusive_min( short value );
-+ushort __ovld __conv sub_group_scan_exclusive_min( ushort value );
-+
-+char __ovld __conv sub_group_scan_exclusive_max( char value );
-+uchar __ovld __conv sub_group_scan_exclusive_max( uchar value );
-+short __ovld __conv sub_group_scan_exclusive_max( short value );
-+ushort __ovld __conv sub_group_scan_exclusive_max( ushort value );
-+
-+#if defined(cl_khr_fp16)
-+// scalar half broadcast is part of cl_khr_subgroups
-+half2 __ovld __conv sub_group_broadcast( half2 value, uint index );
-+half3 __ovld __conv sub_group_broadcast( half3 value, uint index );
-+half4 __ovld __conv sub_group_broadcast( half4 value, uint index );
-+half8 __ovld __conv sub_group_broadcast( half8 value, uint index );
-+half16 __ovld __conv sub_group_broadcast( half16 value, uint index );
-+#endif // cl_khr_fp16
-+
-+#if defined(cl_khr_fp64)
-+// scalar double broadcast is part of cl_khr_subgroups
-+double2 __ovld __conv sub_group_broadcast( double2 value, uint index );
-+double3 __ovld __conv sub_group_broadcast( double3 value, uint index );
-+double4 __ovld __conv sub_group_broadcast( double4 value, uint index );
-+double8 __ovld __conv sub_group_broadcast( double8 value, uint index );
-+double16 __ovld __conv sub_group_broadcast( double16 value, uint index );
-+#endif // cl_khr_fp64
-+
-+#endif // cl_khr_subgroup_extended_types
-+
-+#if defined(cl_khr_subgroup_non_uniform_vote)
-+int __ovld sub_group_elect(void);
-+int __ovld sub_group_non_uniform_all( int predicate );
-+int __ovld sub_group_non_uniform_any( int predicate );
-+
-+int __ovld sub_group_non_uniform_all_equal( char value );
-+int __ovld sub_group_non_uniform_all_equal( uchar value );
-+int __ovld sub_group_non_uniform_all_equal( short value );
-+int __ovld sub_group_non_uniform_all_equal( ushort value );
-+int __ovld sub_group_non_uniform_all_equal( int value );
-+int __ovld sub_group_non_uniform_all_equal( uint value );
-+int __ovld sub_group_non_uniform_all_equal( long value );
-+int __ovld sub_group_non_uniform_all_equal( ulong value );
-+int __ovld sub_group_non_uniform_all_equal( float value );
-+
-+#if defined(cl_khr_fp16)
-+int __ovld sub_group_non_uniform_all_equal( half value );
-+#endif // cl_khr_fp16
-+
-+#if defined(cl_khr_fp64)
-+int __ovld sub_group_non_uniform_all_equal( double value );
-+#endif // cl_khr_fp64
-+
-+#endif // cl_khr_subgroup_non_uniform_vote
-+
-+#if defined(cl_khr_subgroup_ballot)
-+char __ovld sub_group_non_uniform_broadcast( char value, uint index );
-+char2 __ovld sub_group_non_uniform_broadcast( char2 value, uint index );
-+char3 __ovld sub_group_non_uniform_broadcast( char3 value, uint index );
-+char4 __ovld sub_group_non_uniform_broadcast( char4 value, uint index );
-+char8 __ovld sub_group_non_uniform_broadcast( char8 value, uint index );
-+char16 __ovld sub_group_non_uniform_broadcast( char16 value, uint index );
-+
-+uchar __ovld sub_group_non_uniform_broadcast( uchar value, uint index );
-+uchar2 __ovld sub_group_non_uniform_broadcast( uchar2 value, uint index );
-+uchar3 __ovld sub_group_non_uniform_broadcast( uchar3 value, uint index );
-+uchar4 __ovld sub_group_non_uniform_broadcast( uchar4 value, uint index );
-+uchar8 __ovld sub_group_non_uniform_broadcast( uchar8 value, uint index );
-+uchar16 __ovld sub_group_non_uniform_broadcast( uchar16 value, uint index );
-+
-+short __ovld sub_group_non_uniform_broadcast( short value, uint index );
-+short2 __ovld sub_group_non_uniform_broadcast( short2 value, uint index );
-+short3 __ovld sub_group_non_uniform_broadcast( short3 value, uint index );
-+short4 __ovld sub_group_non_uniform_broadcast( short4 value, uint index );
-+short8 __ovld sub_group_non_uniform_broadcast( short8 value, uint index );
-+short16 __ovld sub_group_non_uniform_broadcast( short16 value, uint index );
-+
-+ushort __ovld sub_group_non_uniform_broadcast( ushort value, uint index );
-+ushort2 __ovld sub_group_non_uniform_broadcast( ushort2 value, uint index );
-+ushort3 __ovld sub_group_non_uniform_broadcast( ushort3 value, uint index );
-+ushort4 __ovld sub_group_non_uniform_broadcast( ushort4 value, uint index );
-+ushort8 __ovld sub_group_non_uniform_broadcast( ushort8 value, uint index );
-+ushort16 __ovld sub_group_non_uniform_broadcast( ushort16 value, uint index );
-+
-+int __ovld sub_group_non_uniform_broadcast( int value, uint index );
-+int2 __ovld sub_group_non_uniform_broadcast( int2 value, uint index );
-+int3 __ovld sub_group_non_uniform_broadcast( int3 value, uint index );
-+int4 __ovld sub_group_non_uniform_broadcast( int4 value, uint index );
-+int8 __ovld sub_group_non_uniform_broadcast( int8 value, uint index );
-+int16 __ovld sub_group_non_uniform_broadcast( int16 value, uint index );
-+
-+uint __ovld sub_group_non_uniform_broadcast( uint value, uint index );
-+uint2 __ovld sub_group_non_uniform_broadcast( uint2 value, uint index );
-+uint3 __ovld sub_group_non_uniform_broadcast( uint3 value, uint index );
-+uint4 __ovld sub_group_non_uniform_broadcast( uint4 value, uint index );
-+uint8 __ovld sub_group_non_uniform_broadcast( uint8 value, uint index );
-+uint16 __ovld sub_group_non_uniform_broadcast( uint16 value, uint index );
-+
-+long __ovld sub_group_non_uniform_broadcast( long value, uint index );
-+long2 __ovld sub_group_non_uniform_broadcast( long2 value, uint index );
-+long3 __ovld sub_group_non_uniform_broadcast( long3 value, uint index );
-+long4 __ovld sub_group_non_uniform_broadcast( long4 value, uint index );
-+long8 __ovld sub_group_non_uniform_broadcast( long8 value, uint index );
-+long16 __ovld sub_group_non_uniform_broadcast( long16 value, uint index );
-+
-+ulong __ovld sub_group_non_uniform_broadcast( ulong value, uint index );
-+ulong2 __ovld sub_group_non_uniform_broadcast( ulong2 value, uint index );
-+ulong3 __ovld sub_group_non_uniform_broadcast( ulong3 value, uint index );
-+ulong4 __ovld sub_group_non_uniform_broadcast( ulong4 value, uint index );
-+ulong8 __ovld sub_group_non_uniform_broadcast( ulong8 value, uint index );
-+ulong16 __ovld sub_group_non_uniform_broadcast( ulong16 value, uint index );
-+
-+float __ovld sub_group_non_uniform_broadcast( float value, uint index );
-+float2 __ovld sub_group_non_uniform_broadcast( float2 value, uint index );
-+float3 __ovld sub_group_non_uniform_broadcast( float3 value, uint index );
-+float4 __ovld sub_group_non_uniform_broadcast( float4 value, uint index );
-+float8 __ovld sub_group_non_uniform_broadcast( float8 value, uint index );
-+float16 __ovld sub_group_non_uniform_broadcast( float16 value, uint index );
-+
-+char __ovld sub_group_broadcast_first( char value );
-+uchar __ovld sub_group_broadcast_first( uchar value );
-+short __ovld sub_group_broadcast_first( short value );
-+ushort __ovld sub_group_broadcast_first( ushort value );
-+int __ovld sub_group_broadcast_first( int value );
-+uint __ovld sub_group_broadcast_first( uint value );
-+long __ovld sub_group_broadcast_first( long value );
-+ulong __ovld sub_group_broadcast_first( ulong value );
-+float __ovld sub_group_broadcast_first( float value );
-+
-+uint4 __ovld sub_group_ballot( int predicate );
-+int __ovld __cnfn sub_group_inverse_ballot( uint4 value );
-+int __ovld __cnfn sub_group_ballot_bit_extract( uint4 value, uint index );
-+uint __ovld __cnfn sub_group_ballot_bit_count( uint4 value );
-+
-+uint __ovld sub_group_ballot_inclusive_scan( uint4 value );
-+uint __ovld sub_group_ballot_exclusive_scan( uint4 value );
-+uint __ovld sub_group_ballot_find_lsb( uint4 value );
-+uint __ovld sub_group_ballot_find_msb( uint4 value );
-+
-+uint4 __ovld __cnfn get_sub_group_eq_mask(void);
-+uint4 __ovld __cnfn get_sub_group_ge_mask(void);
-+uint4 __ovld __cnfn get_sub_group_gt_mask(void);
-+uint4 __ovld __cnfn get_sub_group_le_mask(void);
-+uint4 __ovld __cnfn get_sub_group_lt_mask(void);
-+
-+#if defined(cl_khr_fp16)
-+half __ovld sub_group_non_uniform_broadcast( half value, uint index );
-+half2 __ovld sub_group_non_uniform_broadcast( half2 value, uint index );
-+half3 __ovld sub_group_non_uniform_broadcast( half3 value, uint index );
-+half4 __ovld sub_group_non_uniform_broadcast( half4 value, uint index );
-+half8 __ovld sub_group_non_uniform_broadcast( half8 value, uint index );
-+half16 __ovld sub_group_non_uniform_broadcast( half16 value, uint index );
-+
-+half __ovld sub_group_broadcast_first( half value );
-+#endif // cl_khr_fp16
-+
-+#if defined(cl_khr_fp64)
-+double __ovld sub_group_non_uniform_broadcast( double value, uint index );
-+double2 __ovld sub_group_non_uniform_broadcast( double2 value, uint index );
-+double3 __ovld sub_group_non_uniform_broadcast( double3 value, uint index );
-+double4 __ovld sub_group_non_uniform_broadcast( double4 value, uint index );
-+double8 __ovld sub_group_non_uniform_broadcast( double8 value, uint index );
-+double16 __ovld sub_group_non_uniform_broadcast( double16 value, uint index );
-+
-+double __ovld sub_group_broadcast_first( double value );
-+#endif // cl_khr_fp64
-+
-+#endif // cl_khr_subgroup_ballot
-+
-+#if defined(cl_khr_subgroup_non_uniform_arithmetic)
-+char __ovld sub_group_non_uniform_reduce_add( char value );
-+uchar __ovld sub_group_non_uniform_reduce_add( uchar value );
-+short __ovld sub_group_non_uniform_reduce_add( short value );
-+ushort __ovld sub_group_non_uniform_reduce_add( ushort value );
-+int __ovld sub_group_non_uniform_reduce_add( int value );
-+uint __ovld sub_group_non_uniform_reduce_add( uint value );
-+long __ovld sub_group_non_uniform_reduce_add( long value );
-+ulong __ovld sub_group_non_uniform_reduce_add( ulong value );
-+float __ovld sub_group_non_uniform_reduce_add( float value );
-+
-+char __ovld sub_group_non_uniform_reduce_mul( char value );
-+uchar __ovld sub_group_non_uniform_reduce_mul( uchar value );
-+short __ovld sub_group_non_uniform_reduce_mul( short value );
-+ushort __ovld sub_group_non_uniform_reduce_mul( ushort value );
-+int __ovld sub_group_non_uniform_reduce_mul( int value );
-+uint __ovld sub_group_non_uniform_reduce_mul( uint value );
-+long __ovld sub_group_non_uniform_reduce_mul( long value );
-+ulong __ovld sub_group_non_uniform_reduce_mul( ulong value );
-+float __ovld sub_group_non_uniform_reduce_mul( float value );
-+
-+char __ovld sub_group_non_uniform_reduce_min( char value );
-+uchar __ovld sub_group_non_uniform_reduce_min( uchar value );
-+short __ovld sub_group_non_uniform_reduce_min( short value );
-+ushort __ovld sub_group_non_uniform_reduce_min( ushort value );
-+int __ovld sub_group_non_uniform_reduce_min( int value );
-+uint __ovld sub_group_non_uniform_reduce_min( uint value );
-+long __ovld sub_group_non_uniform_reduce_min( long value );
-+ulong __ovld sub_group_non_uniform_reduce_min( ulong value );
-+float __ovld sub_group_non_uniform_reduce_min( float value );
-+
-+char __ovld sub_group_non_uniform_reduce_max( char value );
-+uchar __ovld sub_group_non_uniform_reduce_max( uchar value );
-+short __ovld sub_group_non_uniform_reduce_max( short value );
-+ushort __ovld sub_group_non_uniform_reduce_max( ushort value );
-+int __ovld sub_group_non_uniform_reduce_max( int value );
-+uint __ovld sub_group_non_uniform_reduce_max( uint value );
-+long __ovld sub_group_non_uniform_reduce_max( long value );
-+ulong __ovld sub_group_non_uniform_reduce_max( ulong value );
-+float __ovld sub_group_non_uniform_reduce_max( float value );
-+
-+char __ovld sub_group_non_uniform_scan_inclusive_add( char value );
-+uchar __ovld sub_group_non_uniform_scan_inclusive_add( uchar value );
-+short __ovld sub_group_non_uniform_scan_inclusive_add( short value );
-+ushort __ovld sub_group_non_uniform_scan_inclusive_add( ushort value );
-+int __ovld sub_group_non_uniform_scan_inclusive_add( int value );
-+uint __ovld sub_group_non_uniform_scan_inclusive_add( uint value );
-+long __ovld sub_group_non_uniform_scan_inclusive_add( long value );
-+ulong __ovld sub_group_non_uniform_scan_inclusive_add( ulong value );
-+float __ovld sub_group_non_uniform_scan_inclusive_add( float value );
-+
-+char __ovld sub_group_non_uniform_scan_inclusive_mul( char value );
-+uchar __ovld sub_group_non_uniform_scan_inclusive_mul( uchar value );
-+short __ovld sub_group_non_uniform_scan_inclusive_mul( short value );
-+ushort __ovld sub_group_non_uniform_scan_inclusive_mul( ushort value );
-+int __ovld sub_group_non_uniform_scan_inclusive_mul( int value );
-+uint __ovld sub_group_non_uniform_scan_inclusive_mul( uint value );
-+long __ovld sub_group_non_uniform_scan_inclusive_mul( long value );
-+ulong __ovld sub_group_non_uniform_scan_inclusive_mul( ulong value );
-+float __ovld sub_group_non_uniform_scan_inclusive_mul( float value );
-+
-+char __ovld sub_group_non_uniform_scan_inclusive_min( char value );
-+uchar __ovld sub_group_non_uniform_scan_inclusive_min( uchar value );
-+short __ovld sub_group_non_uniform_scan_inclusive_min( short value );
-+ushort __ovld sub_group_non_uniform_scan_inclusive_min( ushort value );
-+int __ovld sub_group_non_uniform_scan_inclusive_min( int value );
-+uint __ovld sub_group_non_uniform_scan_inclusive_min( uint value );
-+long __ovld sub_group_non_uniform_scan_inclusive_min( long value );
-+ulong __ovld sub_group_non_uniform_scan_inclusive_min( ulong value );
-+float __ovld sub_group_non_uniform_scan_inclusive_min( float value );
-+
-+char __ovld sub_group_non_uniform_scan_inclusive_max( char value );
-+uchar __ovld sub_group_non_uniform_scan_inclusive_max( uchar value );
-+short __ovld sub_group_non_uniform_scan_inclusive_max( short value );
-+ushort __ovld sub_group_non_uniform_scan_inclusive_max( ushort value );
-+int __ovld sub_group_non_uniform_scan_inclusive_max( int value );
-+uint __ovld sub_group_non_uniform_scan_inclusive_max( uint value );
-+long __ovld sub_group_non_uniform_scan_inclusive_max( long value );
-+ulong __ovld sub_group_non_uniform_scan_inclusive_max( ulong value );
-+float __ovld sub_group_non_uniform_scan_inclusive_max( float value );
-+
-+char __ovld sub_group_non_uniform_scan_exclusive_add( char value );
-+uchar __ovld sub_group_non_uniform_scan_exclusive_add( uchar value );
-+short __ovld sub_group_non_uniform_scan_exclusive_add( short value );
-+ushort __ovld sub_group_non_uniform_scan_exclusive_add( ushort value );
-+int __ovld sub_group_non_uniform_scan_exclusive_add( int value );
-+uint __ovld sub_group_non_uniform_scan_exclusive_add( uint value );
-+long __ovld sub_group_non_uniform_scan_exclusive_add( long value );
-+ulong __ovld sub_group_non_uniform_scan_exclusive_add( ulong value );
-+float __ovld sub_group_non_uniform_scan_exclusive_add( float value );
-+
-+char __ovld sub_group_non_uniform_scan_exclusive_mul( char value );
-+uchar __ovld sub_group_non_uniform_scan_exclusive_mul( uchar value );
-+short __ovld sub_group_non_uniform_scan_exclusive_mul( short value );
-+ushort __ovld sub_group_non_uniform_scan_exclusive_mul( ushort value );
-+int __ovld sub_group_non_uniform_scan_exclusive_mul( int value );
-+uint __ovld sub_group_non_uniform_scan_exclusive_mul( uint value );
-+long __ovld sub_group_non_uniform_scan_exclusive_mul( long value );
-+ulong __ovld sub_group_non_uniform_scan_exclusive_mul( ulong value );
-+float __ovld sub_group_non_uniform_scan_exclusive_mul( float value );
-+
-+char __ovld sub_group_non_uniform_scan_exclusive_min( char value );
-+uchar __ovld sub_group_non_uniform_scan_exclusive_min( uchar value );
-+short __ovld sub_group_non_uniform_scan_exclusive_min( short value );
-+ushort __ovld sub_group_non_uniform_scan_exclusive_min( ushort value );
-+int __ovld sub_group_non_uniform_scan_exclusive_min( int value );
-+uint __ovld sub_group_non_uniform_scan_exclusive_min( uint value );
-+long __ovld sub_group_non_uniform_scan_exclusive_min( long value );
-+ulong __ovld sub_group_non_uniform_scan_exclusive_min( ulong value );
-+float __ovld sub_group_non_uniform_scan_exclusive_min( float value );
-+
-+char __ovld sub_group_non_uniform_scan_exclusive_max( char value );
-+uchar __ovld sub_group_non_uniform_scan_exclusive_max( uchar value );
-+short __ovld sub_group_non_uniform_scan_exclusive_max( short value );
-+ushort __ovld sub_group_non_uniform_scan_exclusive_max( ushort value );
-+int __ovld sub_group_non_uniform_scan_exclusive_max( int value );
-+uint __ovld sub_group_non_uniform_scan_exclusive_max( uint value );
-+long __ovld sub_group_non_uniform_scan_exclusive_max( long value );
-+ulong __ovld sub_group_non_uniform_scan_exclusive_max( ulong value );
-+float __ovld sub_group_non_uniform_scan_exclusive_max( float value );
-+
-+char __ovld sub_group_non_uniform_reduce_and( char value );
-+uchar __ovld sub_group_non_uniform_reduce_and( uchar value );
-+short __ovld sub_group_non_uniform_reduce_and( short value );
-+ushort __ovld sub_group_non_uniform_reduce_and( ushort value );
-+int __ovld sub_group_non_uniform_reduce_and( int value );
-+uint __ovld sub_group_non_uniform_reduce_and( uint value );
-+long __ovld sub_group_non_uniform_reduce_and( long value );
-+ulong __ovld sub_group_non_uniform_reduce_and( ulong value );
-+
-+char __ovld sub_group_non_uniform_reduce_or( char value );
-+uchar __ovld sub_group_non_uniform_reduce_or( uchar value );
-+short __ovld sub_group_non_uniform_reduce_or( short value );
-+ushort __ovld sub_group_non_uniform_reduce_or( ushort value );
-+int __ovld sub_group_non_uniform_reduce_or( int value );
-+uint __ovld sub_group_non_uniform_reduce_or( uint value );
-+long __ovld sub_group_non_uniform_reduce_or( long value );
-+ulong __ovld sub_group_non_uniform_reduce_or( ulong value );
-+
-+char __ovld sub_group_non_uniform_reduce_xor( char value );
-+uchar __ovld sub_group_non_uniform_reduce_xor( uchar value );
-+short __ovld sub_group_non_uniform_reduce_xor( short value );
-+ushort __ovld sub_group_non_uniform_reduce_xor( ushort value );
-+int __ovld sub_group_non_uniform_reduce_xor( int value );
-+uint __ovld sub_group_non_uniform_reduce_xor( uint value );
-+long __ovld sub_group_non_uniform_reduce_xor( long value );
-+ulong __ovld sub_group_non_uniform_reduce_xor( ulong value );
-+
-+char __ovld sub_group_non_uniform_scan_inclusive_and( char value );
-+uchar __ovld sub_group_non_uniform_scan_inclusive_and( uchar value );
-+short __ovld sub_group_non_uniform_scan_inclusive_and( short value );
-+ushort __ovld sub_group_non_uniform_scan_inclusive_and( ushort value );
-+int __ovld sub_group_non_uniform_scan_inclusive_and( int value );
-+uint __ovld sub_group_non_uniform_scan_inclusive_and( uint value );
-+long __ovld sub_group_non_uniform_scan_inclusive_and( long value );
-+ulong __ovld sub_group_non_uniform_scan_inclusive_and( ulong value );
-+
-+char __ovld sub_group_non_uniform_scan_inclusive_or( char value );
-+uchar __ovld sub_group_non_uniform_scan_inclusive_or( uchar value );
-+short __ovld sub_group_non_uniform_scan_inclusive_or( short value );
-+ushort __ovld sub_group_non_uniform_scan_inclusive_or( ushort value );
-+int __ovld sub_group_non_uniform_scan_inclusive_or( int value );
-+uint __ovld sub_group_non_uniform_scan_inclusive_or( uint value );
-+long __ovld sub_group_non_uniform_scan_inclusive_or( long value );
-+ulong __ovld sub_group_non_uniform_scan_inclusive_or( ulong value );
-+
-+char __ovld sub_group_non_uniform_scan_inclusive_xor( char value );
-+uchar __ovld sub_group_non_uniform_scan_inclusive_xor( uchar value );
-+short __ovld sub_group_non_uniform_scan_inclusive_xor( short value );
-+ushort __ovld sub_group_non_uniform_scan_inclusive_xor( ushort value );
-+int __ovld sub_group_non_uniform_scan_inclusive_xor( int value );
-+uint __ovld sub_group_non_uniform_scan_inclusive_xor( uint value );
-+long __ovld sub_group_non_uniform_scan_inclusive_xor( long value );
-+ulong __ovld sub_group_non_uniform_scan_inclusive_xor( ulong value );
-+
-+char __ovld sub_group_non_uniform_scan_exclusive_and( char value );
-+uchar __ovld sub_group_non_uniform_scan_exclusive_and( uchar value );
-+short __ovld sub_group_non_uniform_scan_exclusive_and( short value );
-+ushort __ovld sub_group_non_uniform_scan_exclusive_and( ushort value );
-+int __ovld sub_group_non_uniform_scan_exclusive_and( int value );
-+uint __ovld sub_group_non_uniform_scan_exclusive_and( uint value );
-+long __ovld sub_group_non_uniform_scan_exclusive_and( long value );
-+ulong __ovld sub_group_non_uniform_scan_exclusive_and( ulong value );
-+
-+char __ovld sub_group_non_uniform_scan_exclusive_or( char value );
-+uchar __ovld sub_group_non_uniform_scan_exclusive_or( uchar value );
-+short __ovld sub_group_non_uniform_scan_exclusive_or( short value );
-+ushort __ovld sub_group_non_uniform_scan_exclusive_or( ushort value );
-+int __ovld sub_group_non_uniform_scan_exclusive_or( int value );
-+uint __ovld sub_group_non_uniform_scan_exclusive_or( uint value );
-+long __ovld sub_group_non_uniform_scan_exclusive_or( long value );
-+ulong __ovld sub_group_non_uniform_scan_exclusive_or( ulong value );
-+
-+char __ovld sub_group_non_uniform_scan_exclusive_xor( char value );
-+uchar __ovld sub_group_non_uniform_scan_exclusive_xor( uchar value );
-+short __ovld sub_group_non_uniform_scan_exclusive_xor( short value );
-+ushort __ovld sub_group_non_uniform_scan_exclusive_xor( ushort value );
-+int __ovld sub_group_non_uniform_scan_exclusive_xor( int value );
-+uint __ovld sub_group_non_uniform_scan_exclusive_xor( uint value );
-+long __ovld sub_group_non_uniform_scan_exclusive_xor( long value );
-+ulong __ovld sub_group_non_uniform_scan_exclusive_xor( ulong value );
-+
-+int __ovld sub_group_non_uniform_reduce_logical_and( int predicate );
-+int __ovld sub_group_non_uniform_reduce_logical_or( int predicate );
-+int __ovld sub_group_non_uniform_reduce_logical_xor( int predicate );
-+
-+int __ovld sub_group_non_uniform_scan_inclusive_logical_and( int predicate );
-+int __ovld sub_group_non_uniform_scan_inclusive_logical_or( int predicate );
-+int __ovld sub_group_non_uniform_scan_inclusive_logical_xor( int predicate );
-+
-+int __ovld sub_group_non_uniform_scan_exclusive_logical_and( int predicate );
-+int __ovld sub_group_non_uniform_scan_exclusive_logical_or( int predicate );
-+int __ovld sub_group_non_uniform_scan_exclusive_logical_xor( int predicate );
-+
-+#if defined(cl_khr_fp16)
-+half __ovld sub_group_non_uniform_reduce_add( half value );
-+half __ovld sub_group_non_uniform_reduce_mul( half value );
-+half __ovld sub_group_non_uniform_reduce_min( half value );
-+half __ovld sub_group_non_uniform_reduce_max( half value );
-+half __ovld sub_group_non_uniform_scan_inclusive_add( half value );
-+half __ovld sub_group_non_uniform_scan_inclusive_mul( half value );
-+half __ovld sub_group_non_uniform_scan_inclusive_min( half value );
-+half __ovld sub_group_non_uniform_scan_inclusive_max( half value );
-+half __ovld sub_group_non_uniform_scan_exclusive_add( half value );
-+half __ovld sub_group_non_uniform_scan_exclusive_mul( half value );
-+half __ovld sub_group_non_uniform_scan_exclusive_min( half value );
-+half __ovld sub_group_non_uniform_scan_exclusive_max( half value );
-+#endif // cl_khr_fp16
-+
-+#if defined(cl_khr_fp64)
-+double __ovld sub_group_non_uniform_reduce_add( double value );
-+double __ovld sub_group_non_uniform_reduce_mul( double value );
-+double __ovld sub_group_non_uniform_reduce_min( double value );
-+double __ovld sub_group_non_uniform_reduce_max( double value );
-+double __ovld sub_group_non_uniform_scan_inclusive_add( double value );
-+double __ovld sub_group_non_uniform_scan_inclusive_mul( double value );
-+double __ovld sub_group_non_uniform_scan_inclusive_min( double value );
-+double __ovld sub_group_non_uniform_scan_inclusive_max( double value );
-+double __ovld sub_group_non_uniform_scan_exclusive_add( double value );
-+double __ovld sub_group_non_uniform_scan_exclusive_mul( double value );
-+double __ovld sub_group_non_uniform_scan_exclusive_min( double value );
-+double __ovld sub_group_non_uniform_scan_exclusive_max( double value );
-+#endif // cl_khr_fp64
-+
-+#endif // cl_khr_subgroup_non_uniform_arithmetic
-+
-+#if defined(cl_khr_subgroup_shuffle)
-+char __ovld sub_group_shuffle( char value, uint index );
-+uchar __ovld sub_group_shuffle( uchar value, uint index );
-+short __ovld sub_group_shuffle( short value, uint index );
-+ushort __ovld sub_group_shuffle( ushort value, uint index );
-+int __ovld sub_group_shuffle( int value, uint index );
-+uint __ovld sub_group_shuffle( uint value, uint index );
-+long __ovld sub_group_shuffle( long value, uint index );
-+ulong __ovld sub_group_shuffle( ulong value, uint index );
-+float __ovld sub_group_shuffle( float value, uint index );
-+
-+char __ovld sub_group_shuffle_xor( char value, uint mask );
-+uchar __ovld sub_group_shuffle_xor( uchar value, uint mask );
-+short __ovld sub_group_shuffle_xor( short value, uint mask );
-+ushort __ovld sub_group_shuffle_xor( ushort value, uint mask );
-+int __ovld sub_group_shuffle_xor( int value, uint mask );
-+uint __ovld sub_group_shuffle_xor( uint value, uint mask );
-+long __ovld sub_group_shuffle_xor( long value, uint mask );
-+ulong __ovld sub_group_shuffle_xor( ulong value, uint mask );
-+float __ovld sub_group_shuffle_xor( float value, uint mask );
-+
-+#if defined(cl_khr_fp16)
-+half __ovld sub_group_shuffle( half value, uint index );
-+half __ovld sub_group_shuffle_xor( half value, uint mask );
-+#endif // cl_khr_fp16
-+
-+#if defined(cl_khr_fp64)
-+double __ovld sub_group_shuffle( double value, uint index );
-+double __ovld sub_group_shuffle_xor( double value, uint mask );
-+#endif // cl_khr_fp64
-+
-+#endif // cl_khr_subgroup_shuffle
-+
-+#if defined(cl_khr_subgroup_shuffle_relative)
-+char __ovld sub_group_shuffle_up( char value, uint delta );
-+uchar __ovld sub_group_shuffle_up( uchar value, uint delta );
-+short __ovld sub_group_shuffle_up( short value, uint delta );
-+ushort __ovld sub_group_shuffle_up( ushort value, uint delta );
-+int __ovld sub_group_shuffle_up( int value, uint delta );
-+uint __ovld sub_group_shuffle_up( uint value, uint delta );
-+long __ovld sub_group_shuffle_up( long value, uint delta );
-+ulong __ovld sub_group_shuffle_up( ulong value, uint delta );
-+float __ovld sub_group_shuffle_up( float value, uint delta );
-+
-+char __ovld sub_group_shuffle_down( char value, uint delta );
-+uchar __ovld sub_group_shuffle_down( uchar value, uint delta );
-+short __ovld sub_group_shuffle_down( short value, uint delta );
-+ushort __ovld sub_group_shuffle_down( ushort value, uint delta );
-+int __ovld sub_group_shuffle_down( int value, uint delta );
-+uint __ovld sub_group_shuffle_down( uint value, uint delta );
-+long __ovld sub_group_shuffle_down( long value, uint delta );
-+ulong __ovld sub_group_shuffle_down( ulong value, uint delta );
-+float __ovld sub_group_shuffle_down( float value, uint delta );
-+
-+#if defined(cl_khr_fp16)
-+half __ovld sub_group_shuffle_up( half value, uint delta );
-+half __ovld sub_group_shuffle_down( half value, uint delta );
-+#endif // cl_khr_fp16
-+
-+#if defined(cl_khr_fp64)
-+double __ovld sub_group_shuffle_up( double value, uint delta );
-+double __ovld sub_group_shuffle_down( double value, uint delta );
-+#endif // cl_khr_fp64
-+
-+#endif // cl_khr_subgroup_shuffle_relative
-+
-+#if defined(cl_khr_subgroup_clustered_reduce)
-+char __ovld sub_group_clustered_reduce_add( char value, uint clustersize );
-+uchar __ovld sub_group_clustered_reduce_add( uchar value, uint clustersize );
-+short __ovld sub_group_clustered_reduce_add( short value, uint clustersize );
-+ushort __ovld sub_group_clustered_reduce_add( ushort value, uint clustersize );
-+int __ovld sub_group_clustered_reduce_add( int value, uint clustersize );
-+uint __ovld sub_group_clustered_reduce_add( uint value, uint clustersize );
-+long __ovld sub_group_clustered_reduce_add( long value, uint clustersize );
-+ulong __ovld sub_group_clustered_reduce_add( ulong value, uint clustersize );
-+float __ovld sub_group_clustered_reduce_add( float value, uint clustersize );
-+
-+char __ovld sub_group_clustered_reduce_mul( char value, uint clustersize );
-+uchar __ovld sub_group_clustered_reduce_mul( uchar value, uint clustersize );
-+short __ovld sub_group_clustered_reduce_mul( short value, uint clustersize );
-+ushort __ovld sub_group_clustered_reduce_mul( ushort value, uint clustersize );
-+int __ovld sub_group_clustered_reduce_mul( int value, uint clustersize );
-+uint __ovld sub_group_clustered_reduce_mul( uint value, uint clustersize );
-+long __ovld sub_group_clustered_reduce_mul( long value, uint clustersize );
-+ulong __ovld sub_group_clustered_reduce_mul( ulong value, uint clustersize );
-+float __ovld sub_group_clustered_reduce_mul( float value, uint clustersize );
-+
-+char __ovld sub_group_clustered_reduce_min( char value, uint clustersize );
-+uchar __ovld sub_group_clustered_reduce_min( uchar value, uint clustersize );
-+short __ovld sub_group_clustered_reduce_min( short value, uint clustersize );
-+ushort __ovld sub_group_clustered_reduce_min( ushort value, uint clustersize );
-+int __ovld sub_group_clustered_reduce_min( int value, uint clustersize );
-+uint __ovld sub_group_clustered_reduce_min( uint value, uint clustersize );
-+long __ovld sub_group_clustered_reduce_min( long value, uint clustersize );
-+ulong __ovld sub_group_clustered_reduce_min( ulong value, uint clustersize );
-+float __ovld sub_group_clustered_reduce_min( float value, uint clustersize );
-+
-+char __ovld sub_group_clustered_reduce_max( char value, uint clustersize );
-+uchar __ovld sub_group_clustered_reduce_max( uchar value, uint clustersize );
-+short __ovld sub_group_clustered_reduce_max( short value, uint clustersize );
-+ushort __ovld sub_group_clustered_reduce_max( ushort value, uint clustersize );
-+int __ovld sub_group_clustered_reduce_max( int value, uint clustersize );
-+uint __ovld sub_group_clustered_reduce_max( uint value, uint clustersize );
-+long __ovld sub_group_clustered_reduce_max( long value, uint clustersize );
-+ulong __ovld sub_group_clustered_reduce_max( ulong value, uint clustersize );
-+float __ovld sub_group_clustered_reduce_max( float value, uint clustersize );
-+
-+char __ovld sub_group_clustered_reduce_and( char value, uint clustersize );
-+uchar __ovld sub_group_clustered_reduce_and( uchar value, uint clustersize );
-+short __ovld sub_group_clustered_reduce_and( short value, uint clustersize );
-+ushort __ovld sub_group_clustered_reduce_and( ushort value, uint clustersize );
-+int __ovld sub_group_clustered_reduce_and( int value, uint clustersize );
-+uint __ovld sub_group_clustered_reduce_and( uint value, uint clustersize );
-+long __ovld sub_group_clustered_reduce_and( long value, uint clustersize );
-+ulong __ovld sub_group_clustered_reduce_and( ulong value, uint clustersize );
-+
-+char __ovld sub_group_clustered_reduce_or( char value, uint clustersize );
-+uchar __ovld sub_group_clustered_reduce_or( uchar value, uint clustersize );
-+short __ovld sub_group_clustered_reduce_or( short value, uint clustersize );
-+ushort __ovld sub_group_clustered_reduce_or( ushort value, uint clustersize );
-+int __ovld sub_group_clustered_reduce_or( int value, uint clustersize );
-+uint __ovld sub_group_clustered_reduce_or( uint value, uint clustersize );
-+long __ovld sub_group_clustered_reduce_or( long value, uint clustersize );
-+ulong __ovld sub_group_clustered_reduce_or( ulong value, uint clustersize );
-+
-+char __ovld sub_group_clustered_reduce_xor( char value, uint clustersize );
-+uchar __ovld sub_group_clustered_reduce_xor( uchar value, uint clustersize );
-+short __ovld sub_group_clustered_reduce_xor( short value, uint clustersize );
-+ushort __ovld sub_group_clustered_reduce_xor( ushort value, uint clustersize );
-+int __ovld sub_group_clustered_reduce_xor( int value, uint clustersize );
-+uint __ovld sub_group_clustered_reduce_xor( uint value, uint clustersize );
-+long __ovld sub_group_clustered_reduce_xor( long value, uint clustersize );
-+ulong __ovld sub_group_clustered_reduce_xor( ulong value, uint clustersize );
-+
-+int __ovld sub_group_clustered_reduce_logical_and( int predicate, uint clustersize );
-+int __ovld sub_group_clustered_reduce_logical_or( int predicate, uint clustersize );
-+int __ovld sub_group_clustered_reduce_logical_xor( int predicate, uint clustersize );
-+
-+#if defined(cl_khr_fp16)
-+half __ovld sub_group_clustered_reduce_add( half value, uint clustersize );
-+half __ovld sub_group_clustered_reduce_mul( half value, uint clustersize );
-+half __ovld sub_group_clustered_reduce_min( half value, uint clustersize );
-+half __ovld sub_group_clustered_reduce_max( half value, uint clustersize );
-+#endif // cl_khr_fp16
-+
-+#if defined(cl_khr_fp64)
-+double __ovld sub_group_clustered_reduce_add( double value, uint clustersize );
-+double __ovld sub_group_clustered_reduce_mul( double value, uint clustersize );
-+double __ovld sub_group_clustered_reduce_min( double value, uint clustersize );
-+double __ovld sub_group_clustered_reduce_max( double value, uint clustersize );
-+#endif // cl_khr_fp64
-+
-+#endif // cl_khr_subgroup_clustered_reduce
-+
- #if defined(cl_intel_subgroups)
- // Intel-Specific Sub Group Functions
- float __ovld __conv intel_sub_group_shuffle( float x, uint c );
-diff --git a/clang/test/SemaOpenCL/extension-version.cl b/clang/test/SemaOpenCL/extension-version.cl
-index 0e6bbb7d3bcd..86c78143a0eb 100644
---- a/clang/test/SemaOpenCL/extension-version.cl
-+++ b/clang/test/SemaOpenCL/extension-version.cl
-@@ -333,3 +333,86 @@
- #endif
- #pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : enable
-
-+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
-+#ifndef cl_khr_subgroup_extended_types
-+#error "Missing cl_khr_subgroup_extended_types"
-+#endif
-+#else
-+#ifdef cl_khr_subgroup_extended_types
-+#error "Incorrect cl_khr_subgroup_extended_types define"
-+#endif
-+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_extended_types' - ignoring}}
-+#endif
-+#pragma OPENCL EXTENSION cl_khr_subgroup_extended_types : enable
-+
-+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
-+#ifndef cl_khr_subgroup_non_uniform_vote
-+#error "Missing cl_khr_subgroup_non_uniform_vote"
-+#endif
-+#else
-+#ifdef cl_khr_subgroup_non_uniform_vote
-+#error "Incorrect cl_khr_subgroup_non_uniform_vote define"
-+#endif
-+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_non_uniform_vote' - ignoring}}
-+#endif
-+#pragma OPENCL EXTENSION cl_khr_subgroup_non_uniform_vote : enable
-+
-+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
-+#ifndef cl_khr_subgroup_ballot
-+#error "Missing cl_khr_subgroup_ballot"
-+#endif
-+#else
-+#ifdef cl_khr_subgroup_ballot
-+#error "Incorrect cl_khr_subgroup_ballot define"
-+#endif
-+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_ballot' - ignoring}}
-+#endif
-+#pragma OPENCL EXTENSION cl_khr_subgroup_ballot : enable
-+
-+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
-+#ifndef cl_khr_subgroup_non_uniform_arithmetic
-+#error "Missing cl_khr_subgroup_non_uniform_arithmetic"
-+#endif
-+#else
-+#ifdef cl_khr_subgroup_non_uniform_arithmetic
-+#error "Incorrect cl_khr_subgroup_non_uniform_arithmetic define"
-+#endif
-+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_non_uniform_arithmetic' - ignoring}}
-+#endif
-+#pragma OPENCL EXTENSION cl_khr_subgroup_non_uniform_arithmetic : enable
-+
-+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
-+#ifndef cl_khr_subgroup_shuffle
-+#error "Missing cl_khr_subgroup_shuffle"
-+#endif
-+#else
-+#ifdef cl_khr_subgroup_shuffle
-+#error "Incorrect cl_khr_subgroup_shuffle define"
-+#endif
-+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_shuffle' - ignoring}}
-+#endif
-+#pragma OPENCL EXTENSION cl_khr_subgroup_shuffle : enable
-+
-+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
-+#ifndef cl_khr_subgroup_shuffle_relative
-+#error "Missing cl_khr_subgroup_shuffle_relative"
-+#endif
-+#else
-+#ifdef cl_khr_subgroup_shuffle_relative
-+#error "Incorrect cl_khr_subgroup_shuffle_relative define"
-+#endif
-+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_shuffle_relative' - ignoring}}
-+#endif
-+#pragma OPENCL EXTENSION cl_khr_subgroup_shuffle_relative : enable
-+
-+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
-+#ifndef cl_khr_subgroup_clustered_reduce
-+#error "Missing cl_khr_subgroup_clustered_reduce"
-+#endif
-+#else
-+#ifdef cl_khr_subgroup_clustered_reduce
-+#error "Incorrect cl_khr_subgroup_clustered_reduce define"
-+#endif
-+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_clustered_reduce' - ignoring}}
-+#endif
-+#pragma OPENCL EXTENSION cl_khr_subgroup_clustered_reduce : enable
---
-2.17.1
-
diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/BasicBlockUtils-Add-metadata-fixing-in-SplitBlockPre.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/BasicBlockUtils-Add-metadata-fixing-in-SplitBlockPre.patch
deleted file mode 100644
index cd519971..00000000
--- a/dynamic-layers/clang-layer/recipes-devtools/clang/files/BasicBlockUtils-Add-metadata-fixing-in-SplitBlockPre.patch
+++ /dev/null
@@ -1,111 +0,0 @@
-From eeb816d95f0910bd246e37bb2bb3923acf0edf6b Mon Sep 17 00:00:00 2001
-From: Aleksander Us <aleksander.us@intel.com>
-Date: Mon, 26 Aug 2019 15:47:41 +0300
-Subject: [PATCH] [BasicBlockUtils] Add metadata fixing in
- SplitBlockPredecessors.
-
-In case when BB is header of some loop and predecessor is latch of
-this loop, metadata was not attached to newly created basic block.
-This led to loss of loop metadata for other passes.
-
-Upstream-Status: Submitted [https://reviews.llvm.org/D66892]
-
-https://github.com/intel/llvm-patches/commit/8af4449e2d201707f7f2f832b473a0439e255f32
-
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
----
- lib/Transforms/Utils/BasicBlockUtils.cpp | 23 ++++++++----
- test/Transforms/LoopSimplify/loop_metadata.ll | 36 +++++++++++++++++++
- 2 files changed, 52 insertions(+), 7 deletions(-)
- create mode 100644 test/Transforms/LoopSimplify/loop_metadata.ll
-
-diff --git a/lib/Transforms/Utils/BasicBlockUtils.cpp b/lib/Transforms/Utils/BasicBlockUtils.cpp
-index 5fa371377c8..3a90ae061fb 100644
---- a/lib/Transforms/Utils/BasicBlockUtils.cpp
-+++ b/lib/Transforms/Utils/BasicBlockUtils.cpp
-@@ -579,24 +579,33 @@ BasicBlock *llvm::SplitBlockPredecessors(BasicBlock *BB,
-
- // The new block unconditionally branches to the old block.
- BranchInst *BI = BranchInst::Create(BB, NewBB);
-+ bool IsBBHeader = LI && LI->isLoopHeader(BB);
-+ Loop *BBLoop = LI ? LI->getLoopFor(BB) : nullptr;
- // Splitting the predecessors of a loop header creates a preheader block.
-- if (LI && LI->isLoopHeader(BB))
-+ if (IsBBHeader)
- // Using the loop start line number prevents debuggers stepping into the
- // loop body for this instruction.
-- BI->setDebugLoc(LI->getLoopFor(BB)->getStartLoc());
-+ BI->setDebugLoc(BBLoop->getStartLoc());
- else
- BI->setDebugLoc(BB->getFirstNonPHIOrDbg()->getDebugLoc());
-
- // Move the edges from Preds to point to NewBB instead of BB.
-- for (unsigned i = 0, e = Preds.size(); i != e; ++i) {
-+ for (BasicBlock *Pred : Preds) {
-+ Instruction *PI = Pred->getTerminator();
- // This is slightly more strict than necessary; the minimum requirement
- // is that there be no more than one indirectbr branching to BB. And
- // all BlockAddress uses would need to be updated.
-- assert(!isa<IndirectBrInst>(Preds[i]->getTerminator()) &&
-+ assert(!isa<IndirectBrInst>(PI) &&
- "Cannot split an edge from an IndirectBrInst");
-- assert(!isa<CallBrInst>(Preds[i]->getTerminator()) &&
-- "Cannot split an edge from a CallBrInst");
-- Preds[i]->getTerminator()->replaceUsesOfWith(BB, NewBB);
-+ assert(!isa<CallBrInst>(PI) && "Cannot split an edge from a CallBrInst");
-+ if (IsBBHeader && BBLoop->contains(Pred) && BBLoop->isLoopLatch(Pred)) {
-+ // Update loop metadata if it exists.
-+ if (MDNode *LoopMD = PI->getMetadata(LLVMContext::MD_loop)) {
-+ BI->setMetadata(LLVMContext::MD_loop, LoopMD);
-+ PI->setMetadata(LLVMContext::MD_loop, nullptr);
-+ }
-+ }
-+ PI->replaceUsesOfWith(BB, NewBB);
- }
-
- // Insert a new PHI node into NewBB for every PHI node in BB and that new PHI
-diff --git a/test/Transforms/LoopSimplify/loop_metadata.ll b/test/Transforms/LoopSimplify/loop_metadata.ll
-new file mode 100644
-index 00000000000..c15c92fe3ae
---- /dev/null
-+++ b/test/Transforms/LoopSimplify/loop_metadata.ll
-@@ -0,0 +1,36 @@
-+; RUN: opt -S -loop-simplify < %s | FileCheck %s
-+
-+; CHECK: for.cond.loopexit:
-+; CHECK: br label %for.cond, !llvm.loop !0
-+; CHECK: br i1 %cmp1, label %for.body1, label %for.cond.loopexit
-+
-+define void @foo() {
-+entry:
-+ br label %for.cond
-+
-+for.cond: ; preds = %for.cond1, %entry
-+ %j = phi i32 [ 0, %entry ], [ %add, %for.cond1 ]
-+ %cmp = icmp ult i32 %j, 8
-+ br i1 %cmp, label %for.body, label %for.end
-+
-+for.body: ; preds = %for.cond
-+ %dummy1 = add i32 1, 1
-+ %add = add nuw nsw i32 %j, 1
-+ br label %for.cond1
-+
-+for.cond1: ; preds = %for.body1, %for.body
-+ %i.0 = phi i32 [ 1, %for.body ], [ %inc, %for.body1 ]
-+ %cmp1 = icmp ult i32 %i.0, 8
-+ br i1 %cmp1, label %for.body1, label %for.cond, !llvm.loop !0
-+
-+for.body1: ; preds = %for.cond1
-+ %dummy2 = add i32 1, 1
-+ %inc = add nuw nsw i32 %i.0, 1
-+ br label %for.cond1
-+
-+for.end: ; preds = %for.cond
-+ ret void
-+}
-+
-+!0 = distinct !{!0, !1}
-+!1 = !{!"llvm.loop.unroll.full"}
---
-2.18.0
-
diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/IndVarSimplify-Do-not-use-SCEV-expander-for-IVCount-.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/IndVarSimplify-Do-not-use-SCEV-expander-for-IVCount-.patch
deleted file mode 100644
index 48307deb..00000000
--- a/dynamic-layers/clang-layer/recipes-devtools/clang/files/IndVarSimplify-Do-not-use-SCEV-expander-for-IVCount-.patch
+++ /dev/null
@@ -1,146 +0,0 @@
-From 35e218a886f4c066eabd18685240d55270bd5a6d Mon Sep 17 00:00:00 2001
-From: Aleksander Us <aleksander.us@intel.com>
-Date: Mon, 26 Aug 2019 15:45:47 +0300
-Subject: [PATCH] [IndVarSimplify] Do not use SCEV expander for IVCount in
- LFTR when possible.
-
-SCEV analysis cannot properly cache instruction with poison flags
-(for example, add nsw outside of loop will not be reused by expander).
-This can lead to generating of additional instructions by SCEV expander.
-
-Example IR:
-
- ...
- %maxval = add nuw nsw i32 %a1, %a2
- ...
-for.body:
- ...
- %cmp22 = icmp ult i32 %ivadd, %maxval
- br i1 %cmp22, label %for.body, label %for.end
- ...
-
-SCEV expander will generate copy of %maxval in preheader but without
-nuw/nsw flags. This can be avoided by explicit check that iv count
-value gives the same SCEV expressions as calculated by LFTR.
-
-Upstream-Status: Submitted [https://reviews.llvm.org/D66890]
-
-https://github.com/intel/llvm-patches/commit/fd6a6c97341a56fd21bc32bc940afea751312e8f
-
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
----
- lib/Transforms/Scalar/IndVarSimplify.cpp | 12 +++++++++-
- test/Transforms/IndVarSimplify/add_nsw.ll | 23 ++++++++++++++++++++
- test/Transforms/IndVarSimplify/lftr-reuse.ll | 9 +++-----
- test/Transforms/IndVarSimplify/udiv.ll | 1 +
- 4 files changed, 38 insertions(+), 7 deletions(-)
- create mode 100644 test/Transforms/IndVarSimplify/add_nsw.ll
-
-diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
-index f9fc698a4a9..5e04dac8aa6 100644
---- a/lib/Transforms/Scalar/IndVarSimplify.cpp
-+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
-@@ -2375,6 +2375,17 @@ static Value *genLoopLimit(PHINode *IndVar, BasicBlock *ExitingBB,
- if (UsePostInc)
- IVLimit = SE->getAddExpr(IVLimit, SE->getOne(IVLimit->getType()));
-
-+ // If computed limit is equal to old limit then do not use SCEV expander
-+ // because it can lost NUW/NSW flags and create extra instructions.
-+ BranchInst *BI = cast<BranchInst>(ExitingBB->getTerminator());
-+ if (ICmpInst *Cmp = dyn_cast<ICmpInst>(BI->getOperand(0))) {
-+ Value *Limit = Cmp->getOperand(0);
-+ if (!L->isLoopInvariant(Limit))
-+ Limit = Cmp->getOperand(1);
-+ if (SE->getSCEV(Limit) == IVLimit)
-+ return Limit;
-+ }
-+
- // Expand the code for the iteration count.
- assert(SE->isLoopInvariant(IVLimit, L) &&
- "Computed iteration count is not loop invariant!");
-@@ -2383,7 +2394,6 @@ static Value *genLoopLimit(PHINode *IndVar, BasicBlock *ExitingBB,
- // SCEV expression (IVInit) for a pointer type IV value (IndVar).
- Type *LimitTy = ExitCount->getType()->isPointerTy() ?
- IndVar->getType() : ExitCount->getType();
-- BranchInst *BI = cast<BranchInst>(ExitingBB->getTerminator());
- return Rewriter.expandCodeFor(IVLimit, LimitTy, BI);
- }
- }
-diff --git a/test/Transforms/IndVarSimplify/add_nsw.ll b/test/Transforms/IndVarSimplify/add_nsw.ll
-new file mode 100644
-index 00000000000..abd1cbb6c51
---- /dev/null
-+++ b/test/Transforms/IndVarSimplify/add_nsw.ll
-@@ -0,0 +1,23 @@
-+; RUN: opt -indvars -S %s | FileCheck %s
-+
-+target datalayout = "e-p:32:32-i64:64-n8:16:32"
-+
-+; CHECK: for.body.preheader:
-+; CHECK-NOT: add
-+; CHECK: for.body:
-+
-+define void @foo(i32 %a1, i32 %a2) {
-+entry:
-+ %maxval = add nuw nsw i32 %a1, %a2
-+ %cmp = icmp slt i32 %maxval, 1
-+ br i1 %cmp, label %for.end, label %for.body
-+
-+for.body: ; preds = %entry, %for.body
-+ %j.02 = phi i32 [ 0, %entry ], [ %add31, %for.body ]
-+ %add31 = add nuw nsw i32 %j.02, 1
-+ %cmp22 = icmp slt i32 %add31, %maxval
-+ br i1 %cmp22, label %for.body, label %for.end
-+
-+for.end: ; preds = %for.body
-+ ret void
-+}
-diff --git a/test/Transforms/IndVarSimplify/lftr-reuse.ll b/test/Transforms/IndVarSimplify/lftr-reuse.ll
-index 14ae9738696..509d662b767 100644
---- a/test/Transforms/IndVarSimplify/lftr-reuse.ll
-+++ b/test/Transforms/IndVarSimplify/lftr-reuse.ll
-@@ -67,11 +67,9 @@ define void @expandOuterRecurrence(i32 %arg) nounwind {
- ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 0, [[SUB1]]
- ; CHECK-NEXT: br i1 [[CMP1]], label [[OUTER_PREHEADER:%.*]], label [[EXIT:%.*]]
- ; CHECK: outer.preheader:
--; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[ARG]], -1
- ; CHECK-NEXT: br label [[OUTER:%.*]]
- ; CHECK: outer:
--; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i32 [ [[TMP0]], [[OUTER_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], [[OUTER_INC:%.*]] ]
--; CHECK-NEXT: [[I:%.*]] = phi i32 [ [[I_INC:%.*]], [[OUTER_INC]] ], [ 0, [[OUTER_PREHEADER]] ]
-+; CHECK-NEXT: [[I:%.*]] = phi i32 [ [[I_INC:%.*]], [[OUTER_INC:%.*]] ], [ 0, [[OUTER_PREHEADER]] ]
- ; CHECK-NEXT: [[SUB2:%.*]] = sub nsw i32 [[ARG]], [[I]]
- ; CHECK-NEXT: [[SUB3:%.*]] = sub nsw i32 [[SUB2]], 1
- ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 0, [[SUB3]]
-@@ -81,14 +79,13 @@ define void @expandOuterRecurrence(i32 %arg) nounwind {
- ; CHECK: inner:
- ; CHECK-NEXT: [[J:%.*]] = phi i32 [ 0, [[INNER_PH]] ], [ [[J_INC:%.*]], [[INNER]] ]
- ; CHECK-NEXT: [[J_INC]] = add nuw nsw i32 [[J]], 1
--; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[J_INC]], [[INDVARS_IV]]
-+; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[J_INC]], [[SUB3]]
- ; CHECK-NEXT: br i1 [[EXITCOND]], label [[INNER]], label [[OUTER_INC_LOOPEXIT:%.*]]
- ; CHECK: outer.inc.loopexit:
- ; CHECK-NEXT: br label [[OUTER_INC]]
- ; CHECK: outer.inc:
- ; CHECK-NEXT: [[I_INC]] = add nuw nsw i32 [[I]], 1
--; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add i32 [[INDVARS_IV]], -1
--; CHECK-NEXT: [[EXITCOND1:%.*]] = icmp ne i32 [[I_INC]], [[TMP0]]
-+; CHECK-NEXT: [[EXITCOND1:%.*]] = icmp ne i32 [[I_INC]], [[SUB1]]
- ; CHECK-NEXT: br i1 [[EXITCOND1]], label [[OUTER]], label [[EXIT_LOOPEXIT:%.*]]
- ; CHECK: exit.loopexit:
- ; CHECK-NEXT: br label [[EXIT]]
-diff --git a/test/Transforms/IndVarSimplify/udiv.ll b/test/Transforms/IndVarSimplify/udiv.ll
-index b3f2c2a6a66..3530343ef4a 100644
---- a/test/Transforms/IndVarSimplify/udiv.ll
-+++ b/test/Transforms/IndVarSimplify/udiv.ll
-@@ -133,6 +133,7 @@ declare i32 @printf(i8* nocapture, ...) nounwind
- ; CHECK-LABEL: @foo(
- ; CHECK: for.body.preheader:
- ; CHECK-NOT: udiv
-+; CHECK: for.body:
-
- define void @foo(double* %p, i64 %n) nounwind {
- entry:
---
-2.18.0
-
diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/fix-shared-libs.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/fix-shared-libs.patch
deleted file mode 100644
index d69d2a97..00000000
--- a/dynamic-layers/clang-layer/recipes-devtools/clang/files/fix-shared-libs.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From a6d4ccf082858e63e139ca06c02a071c343d2657 Mon Sep 17 00:00:00 2001
-From: Andrea Bocci <andrea.bocci@cern.ch>
-Date: Sun, 15 Mar 2020 17:35:44 +0100
-Subject: [PATCH] Fix building in-tree with cmake -DLLVM_LINK_LLVM_DYLIB=ON
-
-Building in-tree with LLVM 11.0 master with the LLVM_LINK_LLVM_DYLIB
-cmake flag fails to link with the LLVMSPIRVLib library.
-
-Add an explicit dependency to force the correct build order and linking.
-
-Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
-Upstream-Status: Backport
-Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
----
- tools/llvm-spirv/CMakeLists.txt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/llvm-spirv/CMakeLists.txt b/tools/llvm-spirv/CMakeLists.txt
-index 9aa96d9c..501c0daf 100644
---- a/tools/llvm-spirv/CMakeLists.txt
-+++ b/tools/llvm-spirv/CMakeLists.txt
-@@ -14,7 +14,7 @@ add_llvm_tool(llvm-spirv
- NO_INSTALL_RPATH
- )
-
--if (LLVM_SPIRV_BUILD_EXTERNAL)
-+if (LLVM_SPIRV_BUILD_EXTERNAL OR LLVM_LINK_LLVM_DYLIB)
- target_link_libraries(llvm-spirv PRIVATE LLVMSPIRVLib)
- endif()
-
diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-OpenCL-3.0-support.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-OpenCL-3.0-support.patch
deleted file mode 100644
index 53395ea0..00000000
--- a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-OpenCL-3.0-support.patch
+++ /dev/null
@@ -1,8259 +0,0 @@
-From 31ec702cb365f4d02dd2146fb4329d642b8fc30b Mon Sep 17 00:00:00 2001
-From: Naveen Saini <naveen.kumar.saini@intel.com>
-Date: Wed, 7 Apr 2021 16:36:10 +0800
-Subject: [PATCH 1/2] OpenCL 3.0 support
-
-Upstream-Status: Backport [Taken from opencl-clang patches, https://github.com/intel/opencl-clang/blob/ocl-open-100/patches/clang/0001-OpenCL-3.0-support.patch]
-Signed-off-by: Anton Zabaznov <anton.zabaznov@intel.com>
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
----
- clang/include/clang/Basic/Builtins.def | 65 +-
- clang/include/clang/Basic/Builtins.h | 13 +-
- .../clang/Basic/DiagnosticParseKinds.td | 2 +
- .../clang/Basic/DiagnosticSemaKinds.td | 7 +
- clang/include/clang/Basic/LangOptions.def | 2 +
- clang/include/clang/Basic/LangStandards.def | 4 +
- .../include/clang/Basic/OpenCLExtensions.def | 15 +
- clang/include/clang/Basic/OpenCLOptions.h | 175 +-
- clang/include/clang/Driver/Options.td | 2 +-
- clang/include/clang/Sema/Sema.h | 9 +
- clang/lib/AST/ASTContext.cpp | 3 +-
- clang/lib/Basic/Builtins.cpp | 28 +-
- clang/lib/Basic/TargetInfo.cpp | 11 +
- clang/lib/Basic/Targets.cpp | 1 -
- clang/lib/CodeGen/CodeGenFunction.cpp | 6 +-
- clang/lib/Frontend/CompilerInvocation.cpp | 22 +-
- clang/lib/Frontend/InitPreprocessor.cpp | 6 +-
- clang/lib/Headers/opencl-c-base.h | 75 +-
- clang/lib/Headers/opencl-c.h | 3228 ++++++++++++++---
- clang/lib/Parse/ParseDecl.cpp | 12 +-
- clang/lib/Parse/ParsePragma.cpp | 10 +-
- clang/lib/Sema/OpenCLBuiltins.td | 49 +-
- clang/lib/Sema/Sema.cpp | 47 +-
- clang/lib/Sema/SemaChecking.cpp | 38 +-
- clang/lib/Sema/SemaDecl.cpp | 15 +-
- clang/lib/Sema/SemaDeclAttr.cpp | 9 +-
- clang/lib/Sema/SemaDeclCXX.cpp | 10 +
- clang/lib/Sema/SemaLookup.cpp | 19 +-
- clang/lib/Sema/SemaType.cpp | 14 +-
- .../CodeGenOpenCL/addr-space-struct-arg.cl | 7 +-
- .../address-spaces-conversions.cl | 2 +
- .../CodeGenOpenCL/address-spaces-mangling.cl | 3 +-
- clang/test/CodeGenOpenCL/address-spaces.cl | 4 +
- .../amdgcn-automatic-variable.cl | 1 +
- .../CodeGenOpenCL/amdgpu-sizeof-alignof.cl | 21 +-
- .../CodeGenOpenCL/arm-integer-dot-product.cl | 1 +
- .../test/CodeGenOpenCL/cl-uniform-wg-size.cl | 2 +
- clang/test/CodeGenOpenCL/fpmath.cl | 2 +
- .../generic-address-space-feature.cl | 28 +
- .../intel-subgroups-avc-ext-types.cl | 1 +
- .../kernels-have-spir-cc-by-default.cl | 3 +
- clang/test/CodeGenOpenCL/logical-ops.cl | 1 +
- clang/test/CodeGenOpenCL/no-half.cl | 1 +
- clang/test/CodeGenOpenCL/pipe_builtin.cl | 3 +
- clang/test/CodeGenOpenCL/pipe_types.cl | 1 +
- clang/test/CodeGenOpenCL/printf.cl | 2 +
- clang/test/CodeGenOpenCL/unroll-hint.cl | 1 +
- clang/test/Driver/autocomplete.c | 2 +
- clang/test/Driver/opencl.cl | 2 +
- clang/test/Driver/unknown-std.cl | 1 +
- clang/test/Frontend/stdlang.c | 1 +
- clang/test/Headers/opencl-c-header.cl | 7 +-
- clang/test/Index/pipe-size.cl | 7 +
- clang/test/Preprocessor/predefined-macros.c | 13 +
- .../Sema/feature-extensions-simult-support.cl | 75 +
- clang/test/Sema/features-ignore-pragma.cl | 24 +
- clang/test/Sema/opencl-features-pipes.cl | 18 +
- clang/test/Sema/opencl-features.cl | 128 +
- clang/test/Sema/pipe_builtins_feature.cl | 21 +
- .../address-spaces-conversions-cl2.0.cl | 3 +
- clang/test/SemaOpenCL/address-spaces.cl | 1 +
- .../SemaOpenCL/cl20-device-side-enqueue.cl | 16 +-
- .../SemaOpenCL/forget-unsupported-builtins.cl | 22 +
- clang/test/SemaOpenCL/image-features.cl | 20 +
- .../SemaOpenCL/invalid-pipe-builtin-cl2.0.cl | 1 +
- clang/test/SemaOpenCL/storageclass-cl20.cl | 1 +
- .../TableGen/ClangOpenCLBuiltinEmitter.cpp | 35 +-
- 67 files changed, 3656 insertions(+), 723 deletions(-)
- create mode 100644 clang/test/CodeGenOpenCL/generic-address-space-feature.cl
- create mode 100644 clang/test/Sema/feature-extensions-simult-support.cl
- create mode 100644 clang/test/Sema/features-ignore-pragma.cl
- create mode 100644 clang/test/Sema/opencl-features-pipes.cl
- create mode 100644 clang/test/Sema/opencl-features.cl
- create mode 100644 clang/test/Sema/pipe_builtins_feature.cl
- create mode 100644 clang/test/SemaOpenCL/forget-unsupported-builtins.cl
- create mode 100644 clang/test/SemaOpenCL/image-features.cl
-
-diff --git a/clang/include/clang/Basic/Builtins.def b/clang/include/clang/Basic/Builtins.def
-index 1a6c85ce2dd3..b76e277f0337 100644
---- a/clang/include/clang/Basic/Builtins.def
-+++ b/clang/include/clang/Basic/Builtins.def
-@@ -106,6 +106,10 @@
- # define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
- #endif
-
-+#if defined(BUILTIN) && !defined(OPENCLBUILTIN)
-+# define OPENCLBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG, FEATURE) BUILTIN(ID, TYPE, ATTRS)
-+#endif
-+
- // Standard libc/libm functions:
- BUILTIN(__builtin_atan2 , "ddd" , "Fne")
- BUILTIN(__builtin_atan2f, "fff" , "Fne")
-@@ -1514,50 +1518,54 @@ BUILTIN(__builtin_coro_param, "bv*v*", "n")
-
- // OpenCL v2.0 s6.13.16, s9.17.3.5 - Pipe functions.
- // We need the generic prototype, since the packet type could be anything.
--LANGBUILTIN(read_pipe, "i.", "tn", OCLC20_LANG)
--LANGBUILTIN(write_pipe, "i.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-+OPENCLBUILTIN(write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-
--LANGBUILTIN(reserve_read_pipe, "i.", "tn", OCLC20_LANG)
--LANGBUILTIN(reserve_write_pipe, "i.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(reserve_read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-+OPENCLBUILTIN(reserve_write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-
--LANGBUILTIN(commit_write_pipe, "v.", "tn", OCLC20_LANG)
--LANGBUILTIN(commit_read_pipe, "v.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(commit_write_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-+OPENCLBUILTIN(commit_read_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-
--LANGBUILTIN(sub_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG)
--LANGBUILTIN(sub_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(sub_group_reserve_read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-+OPENCLBUILTIN(sub_group_reserve_write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-
--LANGBUILTIN(sub_group_commit_read_pipe, "v.", "tn", OCLC20_LANG)
--LANGBUILTIN(sub_group_commit_write_pipe, "v.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(sub_group_commit_read_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-+OPENCLBUILTIN(sub_group_commit_write_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-
--LANGBUILTIN(work_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG)
--LANGBUILTIN(work_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(work_group_reserve_read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-+OPENCLBUILTIN(work_group_reserve_write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-
--LANGBUILTIN(work_group_commit_read_pipe, "v.", "tn", OCLC20_LANG)
--LANGBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(work_group_commit_read_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-+OPENCLBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-
--LANGBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC20_LANG)
--LANGBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-+OPENCLBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-
- // OpenCL v2.0 s6.13.17 - Enqueue kernel functions.
- // Custom builtin check allows to perform special check of passed block arguments.
--LANGBUILTIN(enqueue_kernel, "i.", "tn", OCLC20_LANG)
--LANGBUILTIN(get_kernel_work_group_size, "Ui.", "tn", OCLC20_LANG)
--LANGBUILTIN(get_kernel_preferred_work_group_size_multiple, "Ui.", "tn", OCLC20_LANG)
--LANGBUILTIN(get_kernel_max_sub_group_size_for_ndrange, "Ui.", "tn", OCLC20_LANG)
--LANGBUILTIN(get_kernel_sub_group_count_for_ndrange, "Ui.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(enqueue_kernel, "i.", "tn", OCLC2P_LANG,
-+ "__opencl_c_device_enqueue")
-+OPENCLBUILTIN(get_kernel_work_group_size, "Ui.", "tn", OCLC2P_LANG,
-+ "__opencl_c_device_enqueue")
-+OPENCLBUILTIN(get_kernel_preferred_work_group_size_multiple, "Ui.", "tn",
-+ OCLC2P_LANG, "__opencl_c_device_enqueue")
-+OPENCLBUILTIN(get_kernel_max_sub_group_size_for_ndrange, "Ui.", "tn",
-+ OCLC2P_LANG, "__opencl_c_device_enqueue")
-+OPENCLBUILTIN(get_kernel_sub_group_count_for_ndrange, "Ui.", "tn", OCLC2P_LANG, "__opencl_c_device_enqueue")
-
- // OpenCL v2.0 s6.13.9 - Address space qualifier functions.
- // FIXME: Pointer parameters of OpenCL builtins should have their address space
- // requirement defined.
--LANGBUILTIN(to_global, "v*v*", "tn", OCLC20_LANG)
--LANGBUILTIN(to_local, "v*v*", "tn", OCLC20_LANG)
--LANGBUILTIN(to_private, "v*v*", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(to_global, "v*v*", "tn", OCLC2P_LANG, "__opencl_c_generic_address_space")
-+OPENCLBUILTIN(to_local, "v*v*", "tn", OCLC2P_LANG, "__opencl_c_generic_address_space")
-+OPENCLBUILTIN(to_private, "v*v*", "tn", OCLC2P_LANG, "__opencl_c_generic_address_space")
-
- // OpenCL half load/store builtin
--LANGBUILTIN(__builtin_store_half, "vdh*", "n", ALL_OCLC_LANGUAGES)
--LANGBUILTIN(__builtin_store_halff, "vfh*", "n", ALL_OCLC_LANGUAGES)
--LANGBUILTIN(__builtin_load_half, "dhC*", "nc", ALL_OCLC_LANGUAGES)
--LANGBUILTIN(__builtin_load_halff, "fhC*", "nc", ALL_OCLC_LANGUAGES)
-+OPENCLBUILTIN(__builtin_store_half, "vdh*", "n", ALL_OCLC_LANGUAGES, "")
-+OPENCLBUILTIN(__builtin_store_halff, "vfh*", "n", ALL_OCLC_LANGUAGES, "")
-+OPENCLBUILTIN(__builtin_load_half, "dhC*", "nc", ALL_OCLC_LANGUAGES, "")
-+OPENCLBUILTIN(__builtin_load_halff, "fhC*", "nc", ALL_OCLC_LANGUAGES, "")
-
- // Builtins for os_log/os_trace
- BUILTIN(__builtin_os_log_format_buffer_size, "zcC*.", "p:0:nut")
-@@ -1578,3 +1586,4 @@ BUILTIN(__builtin_ms_va_copy, "vc*&c*&", "n")
- #undef BUILTIN
- #undef LIBBUILTIN
- #undef LANGBUILTIN
-+#undef OPENCLBUILTIN
-diff --git a/clang/include/clang/Basic/Builtins.h b/clang/include/clang/Basic/Builtins.h
-index e4ed482d9068..713ea4bc267d 100644
---- a/clang/include/clang/Basic/Builtins.h
-+++ b/clang/include/clang/Basic/Builtins.h
-@@ -33,13 +33,13 @@ enum LanguageID {
- CXX_LANG = 0x4, // builtin for cplusplus only.
- OBJC_LANG = 0x8, // builtin for objective-c and objective-c++
- MS_LANG = 0x10, // builtin requires MS mode.
-- OCLC20_LANG = 0x20, // builtin for OpenCL C 2.0 only.
-+ OCLC2P_LANG = 0x20, // builtin for OpenCL C 2.0+ versions.
- OCLC1X_LANG = 0x40, // builtin for OpenCL C 1.x only.
- OMP_LANG = 0x80, // builtin requires OpenMP.
- ALL_LANGUAGES = C_LANG | CXX_LANG | OBJC_LANG, // builtin for all languages.
- ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG, // builtin requires GNU mode.
- ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG, // builtin requires MS mode.
-- ALL_OCLC_LANGUAGES = OCLC1X_LANG | OCLC20_LANG // builtin for OCLC languages.
-+ ALL_OCLC_LANGUAGES = OCLC1X_LANG | OCLC2P_LANG // builtin for OCLC languages.
- };
-
- namespace Builtin {
-@@ -228,6 +228,10 @@ public:
- /// for non-builtins.
- bool canBeRedeclared(unsigned ID) const;
-
-+ bool requiresFeatures(unsigned ID) const {
-+ return requiresFeatures(getRecord(ID));
-+ }
-+
- private:
- const Info &getRecord(unsigned ID) const;
-
-@@ -235,6 +239,11 @@ private:
- bool builtinIsSupported(const Builtin::Info &BuiltinInfo,
- const LangOptions &LangOpts);
-
-+ bool OclBuiltinIsSupported(const Builtin::Info &BuiltinInfo,
-+ const LangOptions &LangOpts) const;
-+
-+ bool requiresFeatures(const Builtin::Info &BuiltinInfo) const;
-+
- /// Helper function for isPrintfLike and isScanfLike.
- bool isLike(unsigned ID, unsigned &FormatIdx, bool &HasVAListArg,
- const char *Fmt) const;
-diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
-index 33adf093693f..43ea63586f91 100644
---- a/clang/include/clang/Basic/DiagnosticParseKinds.td
-+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
-@@ -1199,6 +1199,8 @@ def warn_pragma_unsupported_extension : Warning<
- "unsupported OpenCL extension %0 - ignoring">, InGroup<IgnoredPragmas>;
- def warn_pragma_extension_is_core : Warning<
- "OpenCL extension %0 is core feature or supported optional core feature - ignoring">, InGroup<DiagGroup<"pedantic-core-features">>, DefaultIgnore;
-+def warn_opencl_pragma_feature_ignore : Warning<
-+ "OpenCL feature support can't be controlled via pragma, ignoring">, InGroup<IgnoredPragmas>;
-
- // OpenCL errors.
- def err_opencl_taking_function_address_parser : Error<
-diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
-index 917377420505..91648aa27820 100644
---- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
-+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
-@@ -9378,6 +9378,13 @@ def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
- def err_openclcxx_placement_new : Error<
- "use of placement new requires explicit declaration">;
-
-+def err_opencl_pipes_require_feat : Error<
-+ "usage of OpenCL pipes requires feature support">;
-+def err_opencl_memory_scope_require_feat : Error<
-+ "usage of memory scope requires feature support">;
-+def err_opencl_memory_ordering_require_feat : Error<
-+ "usage of memory ordering requires feature support">;
-+
- // MIG routine annotations.
- def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
- "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
-diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def
-index 3319a3123976..406f45c0be69 100644
---- a/clang/include/clang/Basic/LangOptions.def
-+++ b/clang/include/clang/Basic/LangOptions.def
-@@ -203,6 +203,8 @@ LANGOPT(OpenCL , 1, 0, "OpenCL")
- LANGOPT(OpenCLVersion , 32, 0, "OpenCL C version")
- LANGOPT(OpenCLCPlusPlus , 1, 0, "C++ for OpenCL")
- LANGOPT(OpenCLCPlusPlusVersion , 32, 0, "C++ for OpenCL version")
-+LANGOPT(OpenCLGenericKeyword , 1, 0, "OpenCL generic keyword")
-+LANGOPT(OpenCLPipeKeyword , 1, 0, "OpenCL pipe keyword")
- LANGOPT(NativeHalfType , 1, 0, "Native half type support")
- LANGOPT(NativeHalfArgsAndReturns, 1, 0, "Native half args and returns")
- LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns")
-diff --git a/clang/include/clang/Basic/LangStandards.def b/clang/include/clang/Basic/LangStandards.def
-index 7f1a24db7e9b..69aaba3ff5a2 100644
---- a/clang/include/clang/Basic/LangStandards.def
-+++ b/clang/include/clang/Basic/LangStandards.def
-@@ -167,6 +167,9 @@ LANGSTANDARD(opencl12, "cl1.2",
- LANGSTANDARD(opencl20, "cl2.0",
- OpenCL, "OpenCL 2.0",
- LineComment | C99 | Digraphs | HexFloat | OpenCL)
-+LANGSTANDARD(opencl30, "cl3.0",
-+ OpenCL, "OpenCL 3.0",
-+ LineComment | C99 | Digraphs | HexFloat | OpenCL)
- LANGSTANDARD(openclcpp, "clc++",
- OpenCL, "C++ for OpenCL",
- LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
-@@ -176,6 +179,7 @@ LANGSTANDARD_ALIAS_DEPR(opencl10, "CL")
- LANGSTANDARD_ALIAS_DEPR(opencl11, "CL1.1")
- LANGSTANDARD_ALIAS_DEPR(opencl12, "CL1.2")
- LANGSTANDARD_ALIAS_DEPR(opencl20, "CL2.0")
-+LANGSTANDARD_ALIAS_DEPR(opencl30, "CL3.0")
- LANGSTANDARD_ALIAS_DEPR(openclcpp, "CLC++")
-
- // CUDA
-diff --git a/clang/include/clang/Basic/OpenCLExtensions.def b/clang/include/clang/Basic/OpenCLExtensions.def
-index 517481584313..608f78a13eef 100644
---- a/clang/include/clang/Basic/OpenCLExtensions.def
-+++ b/clang/include/clang/Basic/OpenCLExtensions.def
-@@ -93,6 +93,21 @@ OPENCLEXT_INTERNAL(cl_intel_subgroups, 120, ~0U)
- OPENCLEXT_INTERNAL(cl_intel_subgroups_short, 120, ~0U)
- OPENCLEXT_INTERNAL(cl_intel_device_side_avc_motion_estimation, 120, ~0U)
-
-+OPENCLEXT_INTERNAL(__opencl_c_pipes, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_generic_address_space, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_work_group_collective_functions, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_atomic_order_acq_rel, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_atomic_order_seq_cst, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_atomic_scope_device, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_atomic_scope_all_devices, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_subgroups, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_3d_image_writes, 100, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_device_enqueue, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_read_write_images, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_program_scope_global_variables, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_fp64, 120, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_int64, 100, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_images, 100, ~0U)
- #undef OPENCLEXT_INTERNAL
-
- #ifdef OPENCLEXT
-diff --git a/clang/include/clang/Basic/OpenCLOptions.h b/clang/include/clang/Basic/OpenCLOptions.h
-index 15661154eab5..9a3a8e33cadd 100644
---- a/clang/include/clang/Basic/OpenCLOptions.h
-+++ b/clang/include/clang/Basic/OpenCLOptions.h
-@@ -16,11 +16,16 @@
-
- #include "clang/Basic/LangOptions.h"
- #include "llvm/ADT/StringMap.h"
-+#include "llvm/ADT/StringSwitch.h"
-
- namespace clang {
-
- /// OpenCL supported extensions and optional core features
- class OpenCLOptions {
-+ // OpenCL Version
-+ unsigned CLVer = 120;
-+ bool IsOpenCLCPlusPlus = false;
-+
- struct Info {
- bool Supported; // Is this option supported
- bool Enabled; // Is this option enabled
-@@ -31,7 +36,38 @@ class OpenCLOptions {
- :Supported(S), Enabled(E), Avail(A), Core(C){}
- };
- llvm::StringMap<Info> OptMap;
-+
- public:
-+ void setOpenCLVersion(const LangOptions &LO) {
-+ IsOpenCLCPlusPlus = LO.OpenCLCPlusPlus;
-+ CLVer = IsOpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
-+ }
-+
-+ // Get extension which is semantically equivalent to a given feature
-+ // if exists (e.g. __opencl_c_subgroups -> cl_khr_subgroups)
-+ llvm::Optional<StringRef> getEquivalentExtension(StringRef Feature) const {
-+ return llvm::StringSwitch<llvm::Optional<StringRef>>(Feature)
-+ .Case("__opencl_c_3d_image_writes",
-+ Optional<StringRef>("cl_khr_3d_image_writes"))
-+ .Case("__opencl_c_subgroups", Optional<StringRef>("cl_khr_subgroups"))
-+ .Case("__opencl_c_fp64", Optional<StringRef>("cl_khr_fp64"))
-+ .Default(Optional<StringRef>());
-+ }
-+
-+ // Same as above but for extensions
-+ llvm::Optional<StringRef> getEquivalentFeature(StringRef Extension) const {
-+ return llvm::StringSwitch<llvm::Optional<StringRef>>(Extension)
-+ .Case("cl_khr_3d_image_writes",
-+ Optional<StringRef>("__opencl_c_3d_image_writes"))
-+ .Case("cl_khr_subgroups", Optional<StringRef>("__opencl_c_subgroups"))
-+ .Case("cl_khr_fp64", Optional<StringRef>("__opencl_c_fp64"))
-+ .Default(Optional<StringRef>());
-+ }
-+
-+ bool isFeature(llvm::StringRef Ext) const {
-+ return Ext.startswith("__opencl_c");
-+ }
-+
- bool isKnown(llvm::StringRef Ext) const {
- return OptMap.find(Ext) != OptMap.end();
- }
-@@ -42,32 +78,88 @@ public:
-
- // Is supported as either an extension or an (optional) core feature for
- // OpenCL version \p CLVer.
-- bool isSupported(llvm::StringRef Ext, const LangOptions &LO) const {
-+ bool isSupported(llvm::StringRef Ext) const {
- // In C++ mode all extensions should work at least as in v2.0.
-- auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
- auto I = OptMap.find(Ext)->getValue();
- return I.Supported && I.Avail <= CLVer;
- }
-
- // Is supported (optional) OpenCL core features for OpenCL version \p CLVer.
- // For supported extension, return false.
-- bool isSupportedCore(llvm::StringRef Ext, const LangOptions &LO) const {
-+ bool isSupportedCore(llvm::StringRef Ext) const {
- // In C++ mode all extensions should work at least as in v2.0.
-- auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
- auto I = OptMap.find(Ext)->getValue();
- return I.Supported && I.Avail <= CLVer && I.Core != ~0U && CLVer >= I.Core;
- }
-
- // Is supported OpenCL extension for OpenCL version \p CLVer.
- // For supported (optional) core feature, return false.
-- bool isSupportedExtension(llvm::StringRef Ext, const LangOptions &LO) const {
-+ bool isSupportedExtension(llvm::StringRef Ext) const {
- // In C++ mode all extensions should work at least as in v2.0.
-- auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
- auto I = OptMap.find(Ext)->getValue();
- return I.Supported && I.Avail <= CLVer && (I.Core == ~0U || CLVer < I.Core);
- }
-
-+ // Support features whose support is directly related to the
-+ // specific OpenCL version. For example, OpenCL 2.0 supports
-+ // all features that are optional in 3.0
-+ void adjustFeatures() {
-+ // Support int64 by default (assume compiling for FULL profile)
-+ OptMap["__opencl_c_int64"].Supported = true;
-+
-+ if (CLVer >= 300) {
-+ // Simultaneously support extension and corresponding feature
-+ for (llvm::StringRef F :
-+ {"__opencl_c_subgroups", "__opencl_c_3d_image_writes",
-+ "__opencl_c_fp64"}) {
-+ auto Ext = getEquivalentExtension(F);
-+ OptMap[*Ext].Supported = OptMap[F].Supported;
-+ }
-+
-+ // OpenCL C compilers that define the feature macro __opencl_c_pipes or
-+ // or __opencl_c_device_enqueue must also define the
-+ // feature macro __opencl_c_generic_address_space.
-+ if (OptMap["__opencl_c_pipes"].Supported ||
-+ OptMap["__opencl_c_device_enqueue"].Supported)
-+ OptMap["__opencl_c_generic_address_space"].Supported = true;
-+
-+ // OpenCL C compilers that define the feature macro
-+ // __opencl_c_3d_image_writes or __opencl_c_read_write_images must also
-+ // define the feature macro __opencl_c_images
-+ if (OptMap["__opencl_c_3d_image_writes"].Supported ||
-+ OptMap["__opencl_c_read_write_images"].Supported)
-+ OptMap["__opencl_c_images"].Supported = true;
-+
-+ // All other features are already supported with options
-+ // or in target settings
-+ return;
-+ }
-+
-+ auto FeaturesRange = llvm::make_filter_range(
-+ OptMap, [&](llvm::StringMapEntry<Info> &OptVal) {
-+ auto Opt = OptVal.getKey();
-+ return isFeature(Opt);
-+ });
-+
-+ for (auto &It : FeaturesRange) {
-+ auto &Info = It.getValue();
-+ // For OpenCL version less then 3.0 some
-+ // features should be supported simulateneously
-+ // with specific extension
-+ if (Optional<llvm::StringRef> Ext = getEquivalentExtension(It.getKey()))
-+ Info.Supported = Info.Enabled = OptMap[*Ext].Supported;
-+ else if (Info.Avail <= CLVer)
-+ Info.Supported = Info.Enabled = true;
-+ }
-+ }
-+
- void enable(llvm::StringRef Ext, bool V = true) {
-+ // Ignore disabling extensions if corresponding features
-+ // already supported for OpenCL version higher then 3.0
-+ if (CLVer >= 300)
-+ if (Optional<llvm::StringRef> F = getEquivalentFeature(Ext))
-+ if (V != OptMap[*F].Enabled)
-+ return;
- OptMap[Ext].Enabled = V;
- }
-
-@@ -96,7 +188,7 @@ public:
- OptMap[Ext].Supported = V;
- }
-
-- OpenCLOptions(){
-+ OpenCLOptions() {
- #define OPENCLEXT_INTERNAL(Ext, AvailVer, CoreVer) \
- OptMap[#Ext].Avail = AvailVer; \
- OptMap[#Ext].Core = CoreVer;
-@@ -104,35 +196,86 @@ public:
- }
-
- void addSupport(const OpenCLOptions &Opts) {
-+ assert(IsOpenCLCPlusPlus == Opts.IsOpenCLCPlusPlus && CLVer == Opts.CLVer);
- for (auto &I:Opts.OptMap)
-- if (I.second.Supported)
-+ if (I.second.Supported) {
- OptMap[I.getKey()].Supported = true;
-+ // All features are enabled as they are supported
-+ if (isFeature(I.getKey()))
-+ OptMap[I.getKey()].Enabled = true;
-+ }
-+ if (CLVer >= 300) {
-+ // Enabling extensions with respect to features
-+ for (llvm::StringRef Ext :
-+ {"cl_khr_3d_image_writes", "cl_khr_subgroups", "cl_khr_fp64"}) {
-+ auto Feature = getEquivalentFeature(Ext);
-+ enable(Ext, OptMap[*Feature].Enabled);
-+ }
-+ }
- }
-
- void copy(const OpenCLOptions &Opts) {
-+ CLVer = Opts.CLVer;
-+ IsOpenCLCPlusPlus = Opts.IsOpenCLCPlusPlus;
- OptMap = Opts.OptMap;
- }
-
- // Turn on or off support of all options.
- void supportAll(bool On = true) {
-- for (llvm::StringMap<Info>::iterator I = OptMap.begin(),
-- E = OptMap.end(); I != E; ++I)
-- I->second.Supported = On;
-+ for (llvm::StringMap<Info>::iterator I = OptMap.begin(), E = OptMap.end();
-+ I != E; ++I)
-+ if (!isFeature(I->getKey()))
-+ I->second.Supported = On;
- }
-
- void disableAll() {
-- for (llvm::StringMap<Info>::iterator I = OptMap.begin(),
-- E = OptMap.end(); I != E; ++I)
-- I->second.Enabled = false;
-+ for (llvm::StringMap<Info>::iterator I = OptMap.begin(), E = OptMap.end();
-+ I != E; ++I) {
-+ auto Ext = I->getKey();
-+ if (!isFeature(Ext))
-+ enable(Ext, false);
-+ }
- }
-
-- void enableSupportedCore(LangOptions LO) {
-+ void enableSupportedCore() {
- for (llvm::StringMap<Info>::iterator I = OptMap.begin(), E = OptMap.end();
- I != E; ++I)
-- if (isSupportedCore(I->getKey(), LO))
-+ if (isSupportedCore(I->getKey()))
- I->second.Enabled = true;
- }
-
-+ // This enum specifies how OpenCL versions map into values
-+ // for encoding. This is used when generating built-ins
-+ // from tablegen
-+ enum OpenCLVersionsEncodings : unsigned short {
-+ OPENCL_C_100_CODE = 0x1,
-+ OPENCL_C_110_CODE = 0x2,
-+ OPENCL_C_120_CODE = 0x4,
-+ OPENCL_C_200_CODE = 0x8,
-+ OPENCL_C_300_CODE = 0x10,
-+ OPENCL_C_ALL_CODE = 0x1f
-+ };
-+
-+ // Encode version into single integer
-+ static unsigned short EncodeVersion(unsigned OpenCLVersion) {
-+ switch (OpenCLVersion) {
-+ default:
-+ llvm_unreachable("Unknown OpenCL version");
-+ case 0:
-+ return OpenCLVersionsEncodings::OPENCL_C_ALL_CODE;
-+ case 100:
-+ return OpenCLVersionsEncodings::OPENCL_C_100_CODE;
-+ case 110:
-+ return OpenCLVersionsEncodings::OPENCL_C_110_CODE;
-+ case 120:
-+ return OpenCLVersionsEncodings::OPENCL_C_120_CODE;
-+ case 200:
-+ return OpenCLVersionsEncodings::OPENCL_C_200_CODE;
-+ case 300:
-+ return OpenCLVersionsEncodings::OPENCL_C_300_CODE;
-+ }
-+ }
-+
- friend class ASTWriter;
- friend class ASTReader;
- };
-diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
-index 391c895a453b..e03c22c749ad 100644
---- a/clang/include/clang/Driver/Options.td
-+++ b/clang/include/clang/Driver/Options.td
-@@ -522,7 +522,7 @@ def cl_mad_enable : Flag<["-"], "cl-mad-enable">, Group<opencl_Group>, Flags<[CC
- def cl_no_signed_zeros : Flag<["-"], "cl-no-signed-zeros">, Group<opencl_Group>, Flags<[CC1Option]>,
- HelpText<"OpenCL only. Allow use of less precise no signed zeros computations in the generated binary.">;
- def cl_std_EQ : Joined<["-"], "cl-std=">, Group<opencl_Group>, Flags<[CC1Option]>,
-- HelpText<"OpenCL language standard to compile for.">, Values<"cl,CL,cl1.1,CL1.1,cl1.2,CL1.2,cl2.0,CL2.0,clc++,CLC++">;
-+ HelpText<"OpenCL language standard to compile for.">, Values<"cl,CL,cl1.1,CL1.1,cl1.2,CL1.2,cl2.0,CL2.0,cl3.0,CL3.0,clc++,CLC++">;
- def cl_denorms_are_zero : Flag<["-"], "cl-denorms-are-zero">, Group<opencl_Group>, Flags<[CC1Option]>,
- HelpText<"OpenCL only. Allow denormals to be flushed to zero.">;
- def cl_fp32_correctly_rounded_divide_sqrt : Flag<["-"], "cl-fp32-correctly-rounded-divide-sqrt">, Group<opencl_Group>, Flags<[CC1Option]>,
-diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
-index 842e49602274..d8ac91bc8a31 100644
---- a/clang/include/clang/Sema/Sema.h
-+++ b/clang/include/clang/Sema/Sema.h
-@@ -9632,6 +9632,10 @@ public:
- /// \return true if type is disabled.
- bool checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E);
-
-+ bool checkOpenCLSubgroupExtForCallExpr(CallExpr *Call);
-+
-+ bool isSupportedOpenCLOMemoryOrdering(int64_t Ordering) const;
-+
- //===--------------------------------------------------------------------===//
- // OpenMP directives and clauses.
- //
-@@ -11102,6 +11106,11 @@ public:
- /// that the user intended an assignment used as condition.
- void DiagnoseEqualityWithExtraParens(ParenExpr *ParenE);
-
-+ template <typename DiagLocT, typename DiagInfoT>
-+ void DiagnoseOpenCLRequiresOption(llvm::StringRef OpenCLOptName,
-+ DiagLocT DiagLoc, DiagInfoT DiagInfo,
-+ unsigned Selector, SourceRange SrcRange);
-+
- /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
- ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr = false);
-
-diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
-index 1be72efe4de8..2a81fbcde79d 100644
---- a/clang/lib/AST/ASTContext.cpp
-+++ b/clang/lib/AST/ASTContext.cpp
-@@ -1490,7 +1490,8 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target,
- ObjCSuperType = QualType();
-
- // void * type
-- if (LangOpts.OpenCLVersion >= 200) {
-+ if (Target.getSupportedOpenCLOpts().isEnabled(
-+ "__opencl_c_generic_address_space")) {
- auto Q = VoidTy.getQualifiers();
- Q.setAddressSpace(LangAS::opencl_generic);
- VoidPtrTy = getPointerType(getCanonicalType(
-diff --git a/clang/lib/Basic/Builtins.cpp b/clang/lib/Basic/Builtins.cpp
-index 0cd89df41b67..7a3067345098 100644
---- a/clang/lib/Basic/Builtins.cpp
-+++ b/clang/lib/Basic/Builtins.cpp
-@@ -23,6 +23,8 @@ static const Builtin::Info BuiltinInfo[] = {
- { #ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr },
- #define LANGBUILTIN(ID, TYPE, ATTRS, LANGS) \
- { #ID, TYPE, ATTRS, nullptr, LANGS, nullptr },
-+#define OPENCLBUILTIN(ID, TYPE, ATTRS, LANGS, FEATURE) \
-+ {#ID, TYPE, ATTRS, nullptr, LANGS, FEATURE},
- #define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, LANGS) \
- { #ID, TYPE, ATTRS, HEADER, LANGS, nullptr },
- #include "clang/Basic/Builtins.def"
-@@ -69,16 +71,17 @@ bool Builtin::Context::builtinIsSupported(const Builtin::Info &BuiltinInfo,
- bool ObjCUnsupported = !LangOpts.ObjC && BuiltinInfo.Langs == OBJC_LANG;
- bool OclC1Unsupported = (LangOpts.OpenCLVersion / 100) != 1 &&
- (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES ) == OCLC1X_LANG;
-- bool OclC2Unsupported =
-- (LangOpts.OpenCLVersion != 200 && !LangOpts.OpenCLCPlusPlus) &&
-- (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES) == OCLC20_LANG;
-+ bool OclC2PUnsupported =
-+ (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES) == OCLC2P_LANG &&
-+ ((LangOpts.OpenCLVersion < 200 && !LangOpts.OpenCLCPlusPlus) ||
-+ !OclBuiltinIsSupported(BuiltinInfo, LangOpts));
- bool OclCUnsupported = !LangOpts.OpenCL &&
- (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES);
- bool OpenMPUnsupported = !LangOpts.OpenMP && BuiltinInfo.Langs == OMP_LANG;
- bool CPlusPlusUnsupported =
- !LangOpts.CPlusPlus && BuiltinInfo.Langs == CXX_LANG;
- return !BuiltinsUnsupported && !MathBuiltinsUnsupported && !OclCUnsupported &&
-- !OclC1Unsupported && !OclC2Unsupported && !OpenMPUnsupported &&
-+ !OclC1Unsupported && !OclC2PUnsupported && !OpenMPUnsupported &&
- !GnuModeUnsupported && !MSModeUnsupported && !ObjCUnsupported &&
- !CPlusPlusUnsupported;
- }
-@@ -191,3 +194,20 @@ bool Builtin::Context::canBeRedeclared(unsigned ID) const {
- (!hasReferenceArgsOrResult(ID) &&
- !hasCustomTypechecking(ID));
- }
-+
-+bool Builtin::Context::OclBuiltinIsSupported(
-+ const Builtin::Info &BuiltinInfo, const LangOptions &LangOpts) const {
-+ if (!requiresFeatures(BuiltinInfo))
-+ return true;
-+
-+ return llvm::StringSwitch<bool>(BuiltinInfo.Features)
-+ .Case("__opencl_c_device_enqueue", LangOpts.Blocks)
-+ .Case("__opencl_c_generic_address_space", LangOpts.OpenCLGenericKeyword)
-+ .Case("__opencl_c_pipes", LangOpts.OpenCLPipeKeyword)
-+ .Default(false);
-+}
-+
-+bool Builtin::Context::requiresFeatures(
-+ const Builtin::Info &BuiltinInfo) const {
-+ return BuiltinInfo.Features && llvm::StringRef(BuiltinInfo.Features) != "";
-+}
-diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
-index 3a21a19e1f19..795311d5934e 100644
---- a/clang/lib/Basic/TargetInfo.cpp
-+++ b/clang/lib/Basic/TargetInfo.cpp
-@@ -377,6 +377,17 @@ void TargetInfo::adjust(LangOptions &Opts) {
- HalfFormat = &llvm::APFloat::IEEEhalf();
- FloatFormat = &llvm::APFloat::IEEEsingle();
- LongDoubleFormat = &llvm::APFloat::IEEEquad();
-+
-+ auto &SupportedOCLOpts = getTargetOpts().SupportedOpenCLOptions;
-+
-+ SupportedOCLOpts.setOpenCLVersion(Opts);
-+ SupportedOCLOpts.adjustFeatures();
-+
-+ if (!Opts.OpenCLCPlusPlus && Opts.OpenCLVersion >= 200)
-+ Opts.Blocks = SupportedOCLOpts.isSupported("__opencl_c_device_enqueue");
-+ Opts.OpenCLGenericKeyword =
-+ SupportedOCLOpts.isSupported("__opencl_c_generic_address_space");
-+ Opts.OpenCLPipeKeyword = SupportedOCLOpts.isSupported("__opencl_c_pipes");
- }
-
- if (Opts.LongDoubleSize) {
-diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
-index c063f8ca4472..b394be18a234 100644
---- a/clang/lib/Basic/Targets.cpp
-+++ b/clang/lib/Basic/Targets.cpp
-@@ -39,7 +39,6 @@
- #include "clang/Basic/Diagnostic.h"
- #include "llvm/ADT/StringExtras.h"
- #include "llvm/ADT/Triple.h"
--
- using namespace clang;
-
- namespace clang {
-diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
-index 648e6d9c214a..6d839fa61abc 100644
---- a/clang/lib/CodeGen/CodeGenFunction.cpp
-+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
-@@ -2303,11 +2303,11 @@ void CodeGenFunction::checkTargetFeatures(SourceLocation Loc,
- std::string MissingFeature;
- if (BuiltinID) {
- SmallVector<StringRef, 1> ReqFeatures;
-- const char *FeatureList =
-- CGM.getContext().BuiltinInfo.getRequiredFeatures(BuiltinID);
- // Return if the builtin doesn't have any required features.
-- if (!FeatureList || StringRef(FeatureList) == "")
-+ if (!CGM.getContext().BuiltinInfo.requiresFeatures(BuiltinID))
- return;
-+ const char *FeatureList =
-+ CGM.getContext().BuiltinInfo.getRequiredFeatures(BuiltinID);
- StringRef(FeatureList).split(ReqFeatures, ',');
- if (!hasRequiredFeatures(ReqFeatures, CGM, FD, MissingFeature))
- CGM.getDiags().Report(Loc, diag::err_builtin_needs_feature)
-diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
-index e98a407ac42f..18fa06bf3c6d 100644
---- a/clang/lib/Frontend/CompilerInvocation.cpp
-+++ b/clang/lib/Frontend/CompilerInvocation.cpp
-@@ -2298,6 +2298,8 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
- Opts.OpenCLVersion = 120;
- else if (LangStd == LangStandard::lang_opencl20)
- Opts.OpenCLVersion = 200;
-+ else if (LangStd == LangStandard::lang_opencl30)
-+ Opts.OpenCLVersion = 300;
- else if (LangStd == LangStandard::lang_openclcpp)
- Opts.OpenCLCPlusPlusVersion = 100;
-
-@@ -2498,14 +2500,15 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
- // -cl-std only applies for OpenCL language standards.
- // Override the -std option in this case.
- if (const Arg *A = Args.getLastArg(OPT_cl_std_EQ)) {
-- LangStandard::Kind OpenCLLangStd
-- = llvm::StringSwitch<LangStandard::Kind>(A->getValue())
-- .Cases("cl", "CL", LangStandard::lang_opencl10)
-- .Cases("cl1.1", "CL1.1", LangStandard::lang_opencl11)
-- .Cases("cl1.2", "CL1.2", LangStandard::lang_opencl12)
-- .Cases("cl2.0", "CL2.0", LangStandard::lang_opencl20)
-- .Cases("clc++", "CLC++", LangStandard::lang_openclcpp)
-- .Default(LangStandard::lang_unspecified);
-+ LangStandard::Kind OpenCLLangStd =
-+ llvm::StringSwitch<LangStandard::Kind>(A->getValue())
-+ .Cases("cl", "CL", LangStandard::lang_opencl10)
-+ .Cases("cl1.1", "CL1.1", LangStandard::lang_opencl11)
-+ .Cases("cl1.2", "CL1.2", LangStandard::lang_opencl12)
-+ .Cases("cl2.0", "CL2.0", LangStandard::lang_opencl20)
-+ .Cases("cl3.0", "CL3.0", LangStandard::lang_opencl30)
-+ .Cases("clc++", "CLC++", LangStandard::lang_openclcpp)
-+ .Default(LangStandard::lang_unspecified);
-
- if (OpenCLLangStd == LangStandard::lang_unspecified) {
- Diags.Report(diag::err_drv_invalid_value)
-@@ -2787,8 +2790,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
-
- Opts.RTTI = Opts.CPlusPlus && !Args.hasArg(OPT_fno_rtti);
- Opts.RTTIData = Opts.RTTI && !Args.hasArg(OPT_fno_rtti_data);
-- Opts.Blocks = Args.hasArg(OPT_fblocks) || (Opts.OpenCL
-- && Opts.OpenCLVersion == 200);
-+ Opts.Blocks = Args.hasArg(OPT_fblocks);
- Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);
- Opts.Coroutines = Opts.CPlusPlus2a || Args.hasArg(OPT_fcoroutines_ts);
-
-diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
-index c273cb96d9b9..aefd208e6cd3 100644
---- a/clang/lib/Frontend/InitPreprocessor.cpp
-+++ b/clang/lib/Frontend/InitPreprocessor.cpp
-@@ -445,6 +445,9 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
- case 200:
- Builder.defineMacro("__OPENCL_C_VERSION__", "200");
- break;
-+ case 300:
-+ Builder.defineMacro("__OPENCL_C_VERSION__", "300");
-+ break;
- default:
- llvm_unreachable("Unsupported OpenCL version");
- }
-@@ -453,6 +456,7 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
- Builder.defineMacro("CL_VERSION_1_1", "110");
- Builder.defineMacro("CL_VERSION_1_2", "120");
- Builder.defineMacro("CL_VERSION_2_0", "200");
-+ Builder.defineMacro("CL_VERSION_3_0", "300");
-
- if (TI.isLittleEndian())
- Builder.defineMacro("__ENDIAN_LITTLE__");
-@@ -1101,7 +1105,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
- // OpenCL definitions.
- if (LangOpts.OpenCL) {
- #define OPENCLEXT(Ext) \
-- if (TI.getSupportedOpenCLOpts().isSupported(#Ext, LangOpts)) \
-+ if (TI.getSupportedOpenCLOpts().isSupported(#Ext)) \
- Builder.defineMacro(#Ext);
- #include "clang/Basic/OpenCLExtensions.def"
-
-diff --git a/clang/lib/Headers/opencl-c-base.h b/clang/lib/Headers/opencl-c-base.h
-index 430e07d36f62..2cc688ccc3da 100644
---- a/clang/lib/Headers/opencl-c-base.h
-+++ b/clang/lib/Headers/opencl-c-base.h
-@@ -9,6 +9,59 @@
- #ifndef _OPENCL_BASE_H_
- #define _OPENCL_BASE_H_
-
-+// Add predefined macros to build headers with standalone executable
-+#ifndef CL_VERSION_3_0
-+ #define CL_VERSION_3_0 300
-+#endif
-+
-+// Define features for 2.0 for header backward compatibility
-+#ifndef __opencl_c_int64
-+ #define __opencl_c_int64 1
-+#endif
-+#if __OPENCL_C_VERSION__ != CL_VERSION_3_0
-+ #ifndef __opencl_c_images
-+ #define __opencl_c_images 1
-+ #endif
-+#endif
-+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
-+#ifndef __opencl_c_pipes
-+ #define __opencl_c_pipes 1
-+#endif
-+#ifndef __opencl_c_generic_address_space
-+ #define __opencl_c_generic_address_space 1
-+#endif
-+#ifndef __opencl_c_work_group_collective_functions
-+ #define __opencl_c_work_group_collective_functions 1
-+#endif
-+#ifndef __opencl_c_atomic_order_acq_rel
-+ #define __opencl_c_atomic_order_acq_rel 1
-+#endif
-+#ifndef __opencl_c_atomic_order_seq_cst
-+ #define __opencl_c_atomic_order_seq_cst 1
-+#endif
-+#ifndef __opencl_c_atomic_scope_device
-+ #define __opencl_c_atomic_scope_device 1
-+#endif
-+#ifndef __opencl_c_atomic_scope_all_devices
-+ #define __opencl_c_atomic_scope_all_devices 1
-+#endif
-+#ifndef __opencl_c_subgroups
-+ #define __opencl_c_subgroups 1
-+#endif
-+#ifndef __opencl_c_3d_image_writes
-+ #define __opencl_c_3d_image_writes 1
-+#endif
-+#ifndef __opencl_c_device_enqueue
-+ #define __opencl_c_device_enqueue 1
-+#endif
-+#ifndef __opencl_c_read_write_images
-+ #define __opencl_c_read_write_images 1
-+#endif
-+#ifndef __opencl_c_program_scope_global_variables
-+ #define __opencl_c_program_scope_global_variables 1
-+#endif
-+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
-+
- // built-in scalar data types:
-
- /**
-@@ -115,7 +168,12 @@ typedef half half4 __attribute__((ext_vector_type(4)));
- typedef half half8 __attribute__((ext_vector_type(8)));
- typedef half half16 __attribute__((ext_vector_type(16)));
- #endif
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+
-+#ifndef __opencl_c_fp64
-+ #define __opencl_c_fp64 1
-+#endif
-+
- #if __OPENCL_C_VERSION__ < CL_VERSION_1_2
- #pragma OPENCL EXTENSION cl_khr_fp64 : enable
- #endif
-@@ -281,9 +339,17 @@ typedef uint cl_mem_fence_flags;
- typedef enum memory_scope {
- memory_scope_work_item = __OPENCL_MEMORY_SCOPE_WORK_ITEM,
- memory_scope_work_group = __OPENCL_MEMORY_SCOPE_WORK_GROUP,
-+#ifdef __opencl_c_atomic_scope_device
- memory_scope_device = __OPENCL_MEMORY_SCOPE_DEVICE,
-+#endif
-+#ifdef __opencl_c_atomic_scope_all_devices
-+ #if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+ memory_scope_all_devices = __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES,
-+ #endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
- memory_scope_all_svm_devices = __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES,
--#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups)
-+#endif
-+#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups) || \
-+ defined(__opencl_c_subgroups)
- memory_scope_sub_group = __OPENCL_MEMORY_SCOPE_SUB_GROUP
- #endif
- } memory_scope;
-@@ -301,13 +367,14 @@ typedef enum memory_scope {
- #define ATOMIC_FLAG_INIT 0
-
- // enum values aligned with what clang uses in EmitAtomicExpr()
--typedef enum memory_order
--{
-+typedef enum memory_order {
- memory_order_relaxed = __ATOMIC_RELAXED,
- memory_order_acquire = __ATOMIC_ACQUIRE,
- memory_order_release = __ATOMIC_RELEASE,
- memory_order_acq_rel = __ATOMIC_ACQ_REL,
-+#ifdef __opencl_c_atomic_order_seq_cst
- memory_order_seq_cst = __ATOMIC_SEQ_CST
-+#endif //__opencl_c_atomic_order_seq_cst
- } memory_order;
-
- #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
-index 3210f93cc851..93a946cec5b1 100644
---- a/clang/lib/Headers/opencl-c.h
-+++ b/clang/lib/Headers/opencl-c.h
-@@ -35,7 +35,6 @@
- #define __purefn __attribute__((pure))
- #define __cnfn __attribute__((const))
-
--
- // OpenCL v1.1/1.2/2.0 s6.2.3 - Explicit conversions
-
- char __ovld __cnfn convert_char_rte(char);
-@@ -4632,7 +4631,7 @@ float16 __ovld __cnfn convert_float16(float16);
-
- // Conversions with double data type parameters or return value.
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- char __ovld __cnfn convert_char(double);
- char __ovld __cnfn convert_char_rte(double);
- char __ovld __cnfn convert_char_rtn(double);
-@@ -5452,7 +5451,7 @@ double16 __ovld __cnfn convert_double16_rtz(uchar16);
- double16 __ovld __cnfn convert_double16_rtz(uint16);
- double16 __ovld __cnfn convert_double16_rtz(ulong16);
- double16 __ovld __cnfn convert_double16_rtz(ushort16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #ifdef cl_khr_fp16
- // Convert half types to non-double types.
-@@ -6270,7 +6269,7 @@ half16 __ovld __cnfn convert_half16_rtz(float16);
- half16 __ovld __cnfn convert_half16_rtz(half16);
-
- // Convert half types to double types.
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn convert_double(half);
- double __ovld __cnfn convert_double_rte(half);
- double __ovld __cnfn convert_double_rtp(half);
-@@ -6333,7 +6332,7 @@ half16 __ovld __cnfn convert_half16_rte(double16);
- half16 __ovld __cnfn convert_half16_rtp(double16);
- half16 __ovld __cnfn convert_half16_rtn(double16);
- half16 __ovld __cnfn convert_half16_rtz(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #endif // cl_khr_fp16
-
-@@ -6404,14 +6403,14 @@ half16 __ovld __cnfn convert_half16_rtz(double16);
- #define as_float8(x) __builtin_astype((x), float8)
- #define as_float16(x) __builtin_astype((x), float16)
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #define as_double(x) __builtin_astype((x), double)
- #define as_double2(x) __builtin_astype((x), double2)
- #define as_double3(x) __builtin_astype((x), double3)
- #define as_double4(x) __builtin_astype((x), double4)
- #define as_double8(x) __builtin_astype((x), double8)
- #define as_double16(x) __builtin_astype((x), double16)
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #ifdef cl_khr_fp16
- #define as_half(x) __builtin_astype((x), half)
-@@ -6534,14 +6533,14 @@ float3 __ovld __cnfn acos(float3);
- float4 __ovld __cnfn acos(float4);
- float8 __ovld __cnfn acos(float8);
- float16 __ovld __cnfn acos(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn acos(double);
- double2 __ovld __cnfn acos(double2);
- double3 __ovld __cnfn acos(double3);
- double4 __ovld __cnfn acos(double4);
- double8 __ovld __cnfn acos(double8);
- double16 __ovld __cnfn acos(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn acos(half);
- half2 __ovld __cnfn acos(half2);
-@@ -6560,14 +6559,14 @@ float3 __ovld __cnfn acosh(float3);
- float4 __ovld __cnfn acosh(float4);
- float8 __ovld __cnfn acosh(float8);
- float16 __ovld __cnfn acosh(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn acosh(double);
- double2 __ovld __cnfn acosh(double2);
- double3 __ovld __cnfn acosh(double3);
- double4 __ovld __cnfn acosh(double4);
- double8 __ovld __cnfn acosh(double8);
- double16 __ovld __cnfn acosh(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn acosh(half);
- half2 __ovld __cnfn acosh(half2);
-@@ -6586,14 +6585,14 @@ float3 __ovld __cnfn acospi(float3 x);
- float4 __ovld __cnfn acospi(float4 x);
- float8 __ovld __cnfn acospi(float8 x);
- float16 __ovld __cnfn acospi(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn acospi(double x);
- double2 __ovld __cnfn acospi(double2 x);
- double3 __ovld __cnfn acospi(double3 x);
- double4 __ovld __cnfn acospi(double4 x);
- double8 __ovld __cnfn acospi(double8 x);
- double16 __ovld __cnfn acospi(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn acospi(half x);
- half2 __ovld __cnfn acospi(half2 x);
-@@ -6612,14 +6611,14 @@ float3 __ovld __cnfn asin(float3);
- float4 __ovld __cnfn asin(float4);
- float8 __ovld __cnfn asin(float8);
- float16 __ovld __cnfn asin(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn asin(double);
- double2 __ovld __cnfn asin(double2);
- double3 __ovld __cnfn asin(double3);
- double4 __ovld __cnfn asin(double4);
- double8 __ovld __cnfn asin(double8);
- double16 __ovld __cnfn asin(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn asin(half);
- half2 __ovld __cnfn asin(half2);
-@@ -6638,14 +6637,14 @@ float3 __ovld __cnfn asinh(float3);
- float4 __ovld __cnfn asinh(float4);
- float8 __ovld __cnfn asinh(float8);
- float16 __ovld __cnfn asinh(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn asinh(double);
- double2 __ovld __cnfn asinh(double2);
- double3 __ovld __cnfn asinh(double3);
- double4 __ovld __cnfn asinh(double4);
- double8 __ovld __cnfn asinh(double8);
- double16 __ovld __cnfn asinh(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn asinh(half);
- half2 __ovld __cnfn asinh(half2);
-@@ -6664,14 +6663,14 @@ float3 __ovld __cnfn asinpi(float3 x);
- float4 __ovld __cnfn asinpi(float4 x);
- float8 __ovld __cnfn asinpi(float8 x);
- float16 __ovld __cnfn asinpi(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn asinpi(double x);
- double2 __ovld __cnfn asinpi(double2 x);
- double3 __ovld __cnfn asinpi(double3 x);
- double4 __ovld __cnfn asinpi(double4 x);
- double8 __ovld __cnfn asinpi(double8 x);
- double16 __ovld __cnfn asinpi(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn asinpi(half x);
- half2 __ovld __cnfn asinpi(half2 x);
-@@ -6690,14 +6689,14 @@ float3 __ovld __cnfn atan(float3 y_over_x);
- float4 __ovld __cnfn atan(float4 y_over_x);
- float8 __ovld __cnfn atan(float8 y_over_x);
- float16 __ovld __cnfn atan(float16 y_over_x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn atan(double y_over_x);
- double2 __ovld __cnfn atan(double2 y_over_x);
- double3 __ovld __cnfn atan(double3 y_over_x);
- double4 __ovld __cnfn atan(double4 y_over_x);
- double8 __ovld __cnfn atan(double8 y_over_x);
- double16 __ovld __cnfn atan(double16 y_over_x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn atan(half y_over_x);
- half2 __ovld __cnfn atan(half2 y_over_x);
-@@ -6716,14 +6715,14 @@ float3 __ovld __cnfn atan2(float3 y, float3 x);
- float4 __ovld __cnfn atan2(float4 y, float4 x);
- float8 __ovld __cnfn atan2(float8 y, float8 x);
- float16 __ovld __cnfn atan2(float16 y, float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn atan2(double y, double x);
- double2 __ovld __cnfn atan2(double2 y, double2 x);
- double3 __ovld __cnfn atan2(double3 y, double3 x);
- double4 __ovld __cnfn atan2(double4 y, double4 x);
- double8 __ovld __cnfn atan2(double8 y, double8 x);
- double16 __ovld __cnfn atan2(double16 y, double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn atan2(half y, half x);
- half2 __ovld __cnfn atan2(half2 y, half2 x);
-@@ -6742,14 +6741,14 @@ float3 __ovld __cnfn atanh(float3);
- float4 __ovld __cnfn atanh(float4);
- float8 __ovld __cnfn atanh(float8);
- float16 __ovld __cnfn atanh(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn atanh(double);
- double2 __ovld __cnfn atanh(double2);
- double3 __ovld __cnfn atanh(double3);
- double4 __ovld __cnfn atanh(double4);
- double8 __ovld __cnfn atanh(double8);
- double16 __ovld __cnfn atanh(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn atanh(half);
- half2 __ovld __cnfn atanh(half2);
-@@ -6768,14 +6767,14 @@ float3 __ovld __cnfn atanpi(float3 x);
- float4 __ovld __cnfn atanpi(float4 x);
- float8 __ovld __cnfn atanpi(float8 x);
- float16 __ovld __cnfn atanpi(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn atanpi(double x);
- double2 __ovld __cnfn atanpi(double2 x);
- double3 __ovld __cnfn atanpi(double3 x);
- double4 __ovld __cnfn atanpi(double4 x);
- double8 __ovld __cnfn atanpi(double8 x);
- double16 __ovld __cnfn atanpi(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn atanpi(half x);
- half2 __ovld __cnfn atanpi(half2 x);
-@@ -6794,14 +6793,14 @@ float3 __ovld __cnfn atan2pi(float3 y, float3 x);
- float4 __ovld __cnfn atan2pi(float4 y, float4 x);
- float8 __ovld __cnfn atan2pi(float8 y, float8 x);
- float16 __ovld __cnfn atan2pi(float16 y, float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn atan2pi(double y, double x);
- double2 __ovld __cnfn atan2pi(double2 y, double2 x);
- double3 __ovld __cnfn atan2pi(double3 y, double3 x);
- double4 __ovld __cnfn atan2pi(double4 y, double4 x);
- double8 __ovld __cnfn atan2pi(double8 y, double8 x);
- double16 __ovld __cnfn atan2pi(double16 y, double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn atan2pi(half y, half x);
- half2 __ovld __cnfn atan2pi(half2 y, half2 x);
-@@ -6820,14 +6819,14 @@ float3 __ovld __cnfn cbrt(float3);
- float4 __ovld __cnfn cbrt(float4);
- float8 __ovld __cnfn cbrt(float8);
- float16 __ovld __cnfn cbrt(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn cbrt(double);
- double2 __ovld __cnfn cbrt(double2);
- double3 __ovld __cnfn cbrt(double3);
- double4 __ovld __cnfn cbrt(double4);
- double8 __ovld __cnfn cbrt(double8);
- double16 __ovld __cnfn cbrt(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn cbrt(half);
- half2 __ovld __cnfn cbrt(half2);
-@@ -6847,14 +6846,14 @@ float3 __ovld __cnfn ceil(float3);
- float4 __ovld __cnfn ceil(float4);
- float8 __ovld __cnfn ceil(float8);
- float16 __ovld __cnfn ceil(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn ceil(double);
- double2 __ovld __cnfn ceil(double2);
- double3 __ovld __cnfn ceil(double3);
- double4 __ovld __cnfn ceil(double4);
- double8 __ovld __cnfn ceil(double8);
- double16 __ovld __cnfn ceil(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn ceil(half);
- half2 __ovld __cnfn ceil(half2);
-@@ -6873,14 +6872,14 @@ float3 __ovld __cnfn copysign(float3 x, float3 y);
- float4 __ovld __cnfn copysign(float4 x, float4 y);
- float8 __ovld __cnfn copysign(float8 x, float8 y);
- float16 __ovld __cnfn copysign(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn copysign(double x, double y);
- double2 __ovld __cnfn copysign(double2 x, double2 y);
- double3 __ovld __cnfn copysign(double3 x, double3 y);
- double4 __ovld __cnfn copysign(double4 x, double4 y);
- double8 __ovld __cnfn copysign(double8 x, double8 y);
- double16 __ovld __cnfn copysign(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn copysign(half x, half y);
- half2 __ovld __cnfn copysign(half2 x, half2 y);
-@@ -6899,14 +6898,14 @@ float3 __ovld __cnfn cos(float3);
- float4 __ovld __cnfn cos(float4);
- float8 __ovld __cnfn cos(float8);
- float16 __ovld __cnfn cos(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn cos(double);
- double2 __ovld __cnfn cos(double2);
- double3 __ovld __cnfn cos(double3);
- double4 __ovld __cnfn cos(double4);
- double8 __ovld __cnfn cos(double8);
- double16 __ovld __cnfn cos(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn cos(half);
- half2 __ovld __cnfn cos(half2);
-@@ -6925,14 +6924,14 @@ float3 __ovld __cnfn cosh(float3);
- float4 __ovld __cnfn cosh(float4);
- float8 __ovld __cnfn cosh(float8);
- float16 __ovld __cnfn cosh(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn cosh(double);
- double2 __ovld __cnfn cosh(double2);
- double3 __ovld __cnfn cosh(double3);
- double4 __ovld __cnfn cosh(double4);
- double8 __ovld __cnfn cosh(double8);
- double16 __ovld __cnfn cosh(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn cosh(half);
- half2 __ovld __cnfn cosh(half2);
-@@ -6951,14 +6950,14 @@ float3 __ovld __cnfn cospi(float3 x);
- float4 __ovld __cnfn cospi(float4 x);
- float8 __ovld __cnfn cospi(float8 x);
- float16 __ovld __cnfn cospi(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn cospi(double x);
- double2 __ovld __cnfn cospi(double2 x);
- double3 __ovld __cnfn cospi(double3 x);
- double4 __ovld __cnfn cospi(double4 x);
- double8 __ovld __cnfn cospi(double8 x);
- double16 __ovld __cnfn cospi(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn cospi(half x);
- half2 __ovld __cnfn cospi(half2 x);
-@@ -6977,14 +6976,14 @@ float3 __ovld __cnfn erfc(float3);
- float4 __ovld __cnfn erfc(float4);
- float8 __ovld __cnfn erfc(float8);
- float16 __ovld __cnfn erfc(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn erfc(double);
- double2 __ovld __cnfn erfc(double2);
- double3 __ovld __cnfn erfc(double3);
- double4 __ovld __cnfn erfc(double4);
- double8 __ovld __cnfn erfc(double8);
- double16 __ovld __cnfn erfc(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn erfc(half);
- half2 __ovld __cnfn erfc(half2);
-@@ -7004,14 +7003,14 @@ float3 __ovld __cnfn erf(float3);
- float4 __ovld __cnfn erf(float4);
- float8 __ovld __cnfn erf(float8);
- float16 __ovld __cnfn erf(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn erf(double);
- double2 __ovld __cnfn erf(double2);
- double3 __ovld __cnfn erf(double3);
- double4 __ovld __cnfn erf(double4);
- double8 __ovld __cnfn erf(double8);
- double16 __ovld __cnfn erf(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn erf(half);
- half2 __ovld __cnfn erf(half2);
-@@ -7030,14 +7029,14 @@ float3 __ovld __cnfn exp(float3 x);
- float4 __ovld __cnfn exp(float4 x);
- float8 __ovld __cnfn exp(float8 x);
- float16 __ovld __cnfn exp(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn exp(double x);
- double2 __ovld __cnfn exp(double2 x);
- double3 __ovld __cnfn exp(double3 x);
- double4 __ovld __cnfn exp(double4 x);
- double8 __ovld __cnfn exp(double8 x);
- double16 __ovld __cnfn exp(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn exp(half x);
- half2 __ovld __cnfn exp(half2 x);
-@@ -7056,14 +7055,14 @@ float3 __ovld __cnfn exp2(float3);
- float4 __ovld __cnfn exp2(float4);
- float8 __ovld __cnfn exp2(float8);
- float16 __ovld __cnfn exp2(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn exp2(double);
- double2 __ovld __cnfn exp2(double2);
- double3 __ovld __cnfn exp2(double3);
- double4 __ovld __cnfn exp2(double4);
- double8 __ovld __cnfn exp2(double8);
- double16 __ovld __cnfn exp2(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn exp2(half);
- half2 __ovld __cnfn exp2(half2);
-@@ -7082,14 +7081,14 @@ float3 __ovld __cnfn exp10(float3);
- float4 __ovld __cnfn exp10(float4);
- float8 __ovld __cnfn exp10(float8);
- float16 __ovld __cnfn exp10(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn exp10(double);
- double2 __ovld __cnfn exp10(double2);
- double3 __ovld __cnfn exp10(double3);
- double4 __ovld __cnfn exp10(double4);
- double8 __ovld __cnfn exp10(double8);
- double16 __ovld __cnfn exp10(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn exp10(half);
- half2 __ovld __cnfn exp10(half2);
-@@ -7108,14 +7107,14 @@ float3 __ovld __cnfn expm1(float3 x);
- float4 __ovld __cnfn expm1(float4 x);
- float8 __ovld __cnfn expm1(float8 x);
- float16 __ovld __cnfn expm1(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn expm1(double x);
- double2 __ovld __cnfn expm1(double2 x);
- double3 __ovld __cnfn expm1(double3 x);
- double4 __ovld __cnfn expm1(double4 x);
- double8 __ovld __cnfn expm1(double8 x);
- double16 __ovld __cnfn expm1(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn expm1(half x);
- half2 __ovld __cnfn expm1(half2 x);
-@@ -7134,14 +7133,14 @@ float3 __ovld __cnfn fabs(float3);
- float4 __ovld __cnfn fabs(float4);
- float8 __ovld __cnfn fabs(float8);
- float16 __ovld __cnfn fabs(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn fabs(double);
- double2 __ovld __cnfn fabs(double2);
- double3 __ovld __cnfn fabs(double3);
- double4 __ovld __cnfn fabs(double4);
- double8 __ovld __cnfn fabs(double8);
- double16 __ovld __cnfn fabs(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn fabs(half);
- half2 __ovld __cnfn fabs(half2);
-@@ -7160,14 +7159,14 @@ float3 __ovld __cnfn fdim(float3 x, float3 y);
- float4 __ovld __cnfn fdim(float4 x, float4 y);
- float8 __ovld __cnfn fdim(float8 x, float8 y);
- float16 __ovld __cnfn fdim(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn fdim(double x, double y);
- double2 __ovld __cnfn fdim(double2 x, double2 y);
- double3 __ovld __cnfn fdim(double3 x, double3 y);
- double4 __ovld __cnfn fdim(double4 x, double4 y);
- double8 __ovld __cnfn fdim(double8 x, double8 y);
- double16 __ovld __cnfn fdim(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn fdim(half x, half y);
- half2 __ovld __cnfn fdim(half2 x, half2 y);
-@@ -7187,14 +7186,14 @@ float3 __ovld __cnfn floor(float3);
- float4 __ovld __cnfn floor(float4);
- float8 __ovld __cnfn floor(float8);
- float16 __ovld __cnfn floor(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn floor(double);
- double2 __ovld __cnfn floor(double2);
- double3 __ovld __cnfn floor(double3);
- double4 __ovld __cnfn floor(double4);
- double8 __ovld __cnfn floor(double8);
- double16 __ovld __cnfn floor(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn floor(half);
- half2 __ovld __cnfn floor(half2);
-@@ -7217,14 +7216,14 @@ float3 __ovld __cnfn fma(float3 a, float3 b, float3 c);
- float4 __ovld __cnfn fma(float4 a, float4 b, float4 c);
- float8 __ovld __cnfn fma(float8 a, float8 b, float8 c);
- float16 __ovld __cnfn fma(float16 a, float16 b, float16 c);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn fma(double a, double b, double c);
- double2 __ovld __cnfn fma(double2 a, double2 b, double2 c);
- double3 __ovld __cnfn fma(double3 a, double3 b, double3 c);
- double4 __ovld __cnfn fma(double4 a, double4 b, double4 c);
- double8 __ovld __cnfn fma(double8 a, double8 b, double8 c);
- double16 __ovld __cnfn fma(double16 a, double16 b, double16 c);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn fma(half a, half b, half c);
- half2 __ovld __cnfn fma(half2 a, half2 b, half2 c);
-@@ -7251,7 +7250,7 @@ float3 __ovld __cnfn fmax(float3 x, float y);
- float4 __ovld __cnfn fmax(float4 x, float y);
- float8 __ovld __cnfn fmax(float8 x, float y);
- float16 __ovld __cnfn fmax(float16 x, float y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn fmax(double x, double y);
- double2 __ovld __cnfn fmax(double2 x, double2 y);
- double3 __ovld __cnfn fmax(double3 x, double3 y);
-@@ -7263,7 +7262,7 @@ double3 __ovld __cnfn fmax(double3 x, double y);
- double4 __ovld __cnfn fmax(double4 x, double y);
- double8 __ovld __cnfn fmax(double8 x, double y);
- double16 __ovld __cnfn fmax(double16 x, double y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn fmax(half x, half y);
- half2 __ovld __cnfn fmax(half2 x, half2 y);
-@@ -7295,7 +7294,7 @@ float3 __ovld __cnfn fmin(float3 x, float y);
- float4 __ovld __cnfn fmin(float4 x, float y);
- float8 __ovld __cnfn fmin(float8 x, float y);
- float16 __ovld __cnfn fmin(float16 x, float y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn fmin(double x, double y);
- double2 __ovld __cnfn fmin(double2 x, double2 y);
- double3 __ovld __cnfn fmin(double3 x, double3 y);
-@@ -7307,7 +7306,7 @@ double3 __ovld __cnfn fmin(double3 x, double y);
- double4 __ovld __cnfn fmin(double4 x, double y);
- double8 __ovld __cnfn fmin(double8 x, double y);
- double16 __ovld __cnfn fmin(double16 x, double y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn fmin(half x, half y);
- half2 __ovld __cnfn fmin(half2 x, half2 y);
-@@ -7331,14 +7330,14 @@ float3 __ovld __cnfn fmod(float3 x, float3 y);
- float4 __ovld __cnfn fmod(float4 x, float4 y);
- float8 __ovld __cnfn fmod(float8 x, float8 y);
- float16 __ovld __cnfn fmod(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn fmod(double x, double y);
- double2 __ovld __cnfn fmod(double2 x, double2 y);
- double3 __ovld __cnfn fmod(double3 x, double3 y);
- double4 __ovld __cnfn fmod(double4 x, double4 y);
- double8 __ovld __cnfn fmod(double8 x, double8 y);
- double16 __ovld __cnfn fmod(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn fmod(half x, half y);
- half2 __ovld __cnfn fmod(half2 x, half2 y);
-@@ -7352,21 +7351,21 @@ half16 __ovld __cnfn fmod(half16 x, half16 y);
- * Returns fmin(x - floor (x), 0x1.fffffep-1f ).
- * floor(x) is returned in iptr.
- */
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float __ovld fract(float x, float *iptr);
- float2 __ovld fract(float2 x, float2 *iptr);
- float3 __ovld fract(float3 x, float3 *iptr);
- float4 __ovld fract(float4 x, float4 *iptr);
- float8 __ovld fract(float8 x, float8 *iptr);
- float16 __ovld fract(float16 x, float16 *iptr);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld fract(double x, double *iptr);
- double2 __ovld fract(double2 x, double2 *iptr);
- double3 __ovld fract(double3 x, double3 *iptr);
- double4 __ovld fract(double4 x, double4 *iptr);
- double8 __ovld fract(double8 x, double8 *iptr);
- double16 __ovld fract(double16 x, double16 *iptr);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld fract(half x, half *iptr);
- half2 __ovld fract(half2 x, half2 *iptr);
-@@ -7375,7 +7374,9 @@ half4 __ovld fract(half4 x, half4 *iptr);
- half8 __ovld fract(half8 x, half8 *iptr);
- half16 __ovld fract(half16 x, half16 *iptr);
- #endif //cl_khr_fp16
--#else
-+#endif //__opencl_c_generic_address_space
-+
-+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
- float __ovld fract(float x, __global float *iptr);
- float2 __ovld fract(float2 x, __global float2 *iptr);
- float3 __ovld fract(float3 x, __global float3 *iptr);
-@@ -7394,7 +7395,7 @@ float3 __ovld fract(float3 x, __private float3 *iptr);
- float4 __ovld fract(float4 x, __private float4 *iptr);
- float8 __ovld fract(float8 x, __private float8 *iptr);
- float16 __ovld fract(float16 x, __private float16 *iptr);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld fract(double x, __global double *iptr);
- double2 __ovld fract(double2 x, __global double2 *iptr);
- double3 __ovld fract(double3 x, __global double3 *iptr);
-@@ -7413,7 +7414,7 @@ double3 __ovld fract(double3 x, __private double3 *iptr);
- double4 __ovld fract(double4 x, __private double4 *iptr);
- double8 __ovld fract(double8 x, __private double8 *iptr);
- double16 __ovld fract(double16 x, __private double16 *iptr);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld fract(half x, __global half *iptr);
- half2 __ovld fract(half2 x, __global half2 *iptr);
-@@ -7434,29 +7435,29 @@ half4 __ovld fract(half4 x, __private half4 *iptr);
- half8 __ovld fract(half8 x, __private half8 *iptr);
- half16 __ovld fract(half16 x, __private half16 *iptr);
- #endif //cl_khr_fp16
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
--
-+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
-+ //! CL_VERSION_2_0)
- /**
- * Extract mantissa and exponent from x. For each
- * component the mantissa returned is a float with
- * magnitude in the interval [1/2, 1) or 0. Each
- * component of x equals mantissa returned * 2^exp.
- */
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float __ovld frexp(float x, int *exp);
- float2 __ovld frexp(float2 x, int2 *exp);
- float3 __ovld frexp(float3 x, int3 *exp);
- float4 __ovld frexp(float4 x, int4 *exp);
- float8 __ovld frexp(float8 x, int8 *exp);
- float16 __ovld frexp(float16 x, int16 *exp);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld frexp(double x, int *exp);
- double2 __ovld frexp(double2 x, int2 *exp);
- double3 __ovld frexp(double3 x, int3 *exp);
- double4 __ovld frexp(double4 x, int4 *exp);
- double8 __ovld frexp(double8 x, int8 *exp);
- double16 __ovld frexp(double16 x, int16 *exp);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld frexp(half x, int *exp);
- half2 __ovld frexp(half2 x, int2 *exp);
-@@ -7465,7 +7466,9 @@ half4 __ovld frexp(half4 x, int4 *exp);
- half8 __ovld frexp(half8 x, int8 *exp);
- half16 __ovld frexp(half16 x, int16 *exp);
- #endif //cl_khr_fp16
--#else
-+#endif //__opencl_c_generic_address_space
-+
-+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
- float __ovld frexp(float x, __global int *exp);
- float2 __ovld frexp(float2 x, __global int2 *exp);
- float3 __ovld frexp(float3 x, __global int3 *exp);
-@@ -7484,7 +7487,7 @@ float3 __ovld frexp(float3 x, __private int3 *exp);
- float4 __ovld frexp(float4 x, __private int4 *exp);
- float8 __ovld frexp(float8 x, __private int8 *exp);
- float16 __ovld frexp(float16 x, __private int16 *exp);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld frexp(double x, __global int *exp);
- double2 __ovld frexp(double2 x, __global int2 *exp);
- double3 __ovld frexp(double3 x, __global int3 *exp);
-@@ -7503,7 +7506,7 @@ double3 __ovld frexp(double3 x, __private int3 *exp);
- double4 __ovld frexp(double4 x, __private int4 *exp);
- double8 __ovld frexp(double8 x, __private int8 *exp);
- double16 __ovld frexp(double16 x, __private int16 *exp);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld frexp(half x, __global int *exp);
- half2 __ovld frexp(half2 x, __global int2 *exp);
-@@ -7524,7 +7527,8 @@ half4 __ovld frexp(half4 x, __private int4 *exp);
- half8 __ovld frexp(half8 x, __private int8 *exp);
- half16 __ovld frexp(half16 x, __private int16 *exp);
- #endif //cl_khr_fp16
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
-+ //! CL_VERSION_2_0)
-
- /**
- * Compute the value of the square root of x^2 + y^2
-@@ -7536,14 +7540,14 @@ float3 __ovld __cnfn hypot(float3 x, float3 y);
- float4 __ovld __cnfn hypot(float4 x, float4 y);
- float8 __ovld __cnfn hypot(float8 x, float8 y);
- float16 __ovld __cnfn hypot(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn hypot(double x, double y);
- double2 __ovld __cnfn hypot(double2 x, double2 y);
- double3 __ovld __cnfn hypot(double3 x, double3 y);
- double4 __ovld __cnfn hypot(double4 x, double4 y);
- double8 __ovld __cnfn hypot(double8 x, double8 y);
- double16 __ovld __cnfn hypot(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn hypot(half x, half y);
- half2 __ovld __cnfn hypot(half2 x, half2 y);
-@@ -7562,14 +7566,14 @@ int3 __ovld __cnfn ilogb(float3 x);
- int4 __ovld __cnfn ilogb(float4 x);
- int8 __ovld __cnfn ilogb(float8 x);
- int16 __ovld __cnfn ilogb(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn ilogb(double x);
- int2 __ovld __cnfn ilogb(double2 x);
- int3 __ovld __cnfn ilogb(double3 x);
- int4 __ovld __cnfn ilogb(double4 x);
- int8 __ovld __cnfn ilogb(double8 x);
- int16 __ovld __cnfn ilogb(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn ilogb(half x);
- int2 __ovld __cnfn ilogb(half2 x);
-@@ -7593,7 +7597,7 @@ float3 __ovld __cnfn ldexp(float3 x, int n);
- float4 __ovld __cnfn ldexp(float4 x, int n);
- float8 __ovld __cnfn ldexp(float8 x, int n);
- float16 __ovld __cnfn ldexp(float16 x, int n);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn ldexp(double x, int n);
- double2 __ovld __cnfn ldexp(double2 x, int2 n);
- double3 __ovld __cnfn ldexp(double3 x, int3 n);
-@@ -7605,7 +7609,7 @@ double3 __ovld __cnfn ldexp(double3 x, int n);
- double4 __ovld __cnfn ldexp(double4 x, int n);
- double8 __ovld __cnfn ldexp(double8 x, int n);
- double16 __ovld __cnfn ldexp(double16 x, int n);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn ldexp(half x, int n);
- half2 __ovld __cnfn ldexp(half2 x, int2 n);
-@@ -7632,14 +7636,14 @@ float3 __ovld __cnfn lgamma(float3 x);
- float4 __ovld __cnfn lgamma(float4 x);
- float8 __ovld __cnfn lgamma(float8 x);
- float16 __ovld __cnfn lgamma(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn lgamma(double x);
- double2 __ovld __cnfn lgamma(double2 x);
- double3 __ovld __cnfn lgamma(double3 x);
- double4 __ovld __cnfn lgamma(double4 x);
- double8 __ovld __cnfn lgamma(double8 x);
- double16 __ovld __cnfn lgamma(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn lgamma(half x);
- half2 __ovld __cnfn lgamma(half2 x);
-@@ -7649,21 +7653,21 @@ half8 __ovld __cnfn lgamma(half8 x);
- half16 __ovld __cnfn lgamma(half16 x);
- #endif //cl_khr_fp16
-
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float __ovld lgamma_r(float x, int *signp);
- float2 __ovld lgamma_r(float2 x, int2 *signp);
- float3 __ovld lgamma_r(float3 x, int3 *signp);
- float4 __ovld lgamma_r(float4 x, int4 *signp);
- float8 __ovld lgamma_r(float8 x, int8 *signp);
- float16 __ovld lgamma_r(float16 x, int16 *signp);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld lgamma_r(double x, int *signp);
- double2 __ovld lgamma_r(double2 x, int2 *signp);
- double3 __ovld lgamma_r(double3 x, int3 *signp);
- double4 __ovld lgamma_r(double4 x, int4 *signp);
- double8 __ovld lgamma_r(double8 x, int8 *signp);
- double16 __ovld lgamma_r(double16 x, int16 *signp);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld lgamma_r(half x, int *signp);
- half2 __ovld lgamma_r(half2 x, int2 *signp);
-@@ -7672,7 +7676,9 @@ half4 __ovld lgamma_r(half4 x, int4 *signp);
- half8 __ovld lgamma_r(half8 x, int8 *signp);
- half16 __ovld lgamma_r(half16 x, int16 *signp);
- #endif //cl_khr_fp16
--#else
-+#endif //__opencl_c_generic_address_space
-+
-+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
- float __ovld lgamma_r(float x, __global int *signp);
- float2 __ovld lgamma_r(float2 x, __global int2 *signp);
- float3 __ovld lgamma_r(float3 x, __global int3 *signp);
-@@ -7691,7 +7697,7 @@ float3 __ovld lgamma_r(float3 x, __private int3 *signp);
- float4 __ovld lgamma_r(float4 x, __private int4 *signp);
- float8 __ovld lgamma_r(float8 x, __private int8 *signp);
- float16 __ovld lgamma_r(float16 x, __private int16 *signp);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld lgamma_r(double x, __global int *signp);
- double2 __ovld lgamma_r(double2 x, __global int2 *signp);
- double3 __ovld lgamma_r(double3 x, __global int3 *signp);
-@@ -7710,7 +7716,7 @@ double3 __ovld lgamma_r(double3 x, __private int3 *signp);
- double4 __ovld lgamma_r(double4 x, __private int4 *signp);
- double8 __ovld lgamma_r(double8 x, __private int8 *signp);
- double16 __ovld lgamma_r(double16 x, __private int16 *signp);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld lgamma_r(half x, __global int *signp);
- half2 __ovld lgamma_r(half2 x, __global int2 *signp);
-@@ -7731,8 +7737,8 @@ half4 __ovld lgamma_r(half4 x, __private int4 *signp);
- half8 __ovld lgamma_r(half8 x, __private int8 *signp);
- half16 __ovld lgamma_r(half16 x, __private int16 *signp);
- #endif //cl_khr_fp16
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
--
-+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
-+ //! CL_VERSION_2_0)
- /**
- * Compute natural logarithm.
- */
-@@ -7742,14 +7748,14 @@ float3 __ovld __cnfn log(float3);
- float4 __ovld __cnfn log(float4);
- float8 __ovld __cnfn log(float8);
- float16 __ovld __cnfn log(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn log(double);
- double2 __ovld __cnfn log(double2);
- double3 __ovld __cnfn log(double3);
- double4 __ovld __cnfn log(double4);
- double8 __ovld __cnfn log(double8);
- double16 __ovld __cnfn log(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn log(half);
- half2 __ovld __cnfn log(half2);
-@@ -7760,7 +7766,7 @@ half16 __ovld __cnfn log(half16);
- #endif //cl_khr_fp16
-
- /**
-- * Compute a base 2 logarithm.
-+ * Compute a base 2 logarithm
- */
- float __ovld __cnfn log2(float);
- float2 __ovld __cnfn log2(float2);
-@@ -7768,14 +7774,14 @@ float3 __ovld __cnfn log2(float3);
- float4 __ovld __cnfn log2(float4);
- float8 __ovld __cnfn log2(float8);
- float16 __ovld __cnfn log2(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn log2(double);
- double2 __ovld __cnfn log2(double2);
- double3 __ovld __cnfn log2(double3);
- double4 __ovld __cnfn log2(double4);
- double8 __ovld __cnfn log2(double8);
- double16 __ovld __cnfn log2(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn log2(half);
- half2 __ovld __cnfn log2(half2);
-@@ -7794,14 +7800,14 @@ float3 __ovld __cnfn log10(float3);
- float4 __ovld __cnfn log10(float4);
- float8 __ovld __cnfn log10(float8);
- float16 __ovld __cnfn log10(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn log10(double);
- double2 __ovld __cnfn log10(double2);
- double3 __ovld __cnfn log10(double3);
- double4 __ovld __cnfn log10(double4);
- double8 __ovld __cnfn log10(double8);
- double16 __ovld __cnfn log10(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn log10(half);
- half2 __ovld __cnfn log10(half2);
-@@ -7820,14 +7826,14 @@ float3 __ovld __cnfn log1p(float3 x);
- float4 __ovld __cnfn log1p(float4 x);
- float8 __ovld __cnfn log1p(float8 x);
- float16 __ovld __cnfn log1p(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn log1p(double x);
- double2 __ovld __cnfn log1p(double2 x);
- double3 __ovld __cnfn log1p(double3 x);
- double4 __ovld __cnfn log1p(double4 x);
- double8 __ovld __cnfn log1p(double8 x);
- double16 __ovld __cnfn log1p(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn log1p(half x);
- half2 __ovld __cnfn log1p(half2 x);
-@@ -7847,14 +7853,14 @@ float3 __ovld __cnfn logb(float3 x);
- float4 __ovld __cnfn logb(float4 x);
- float8 __ovld __cnfn logb(float8 x);
- float16 __ovld __cnfn logb(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn logb(double x);
- double2 __ovld __cnfn logb(double2 x);
- double3 __ovld __cnfn logb(double3 x);
- double4 __ovld __cnfn logb(double4 x);
- double8 __ovld __cnfn logb(double8 x);
- double16 __ovld __cnfn logb(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn logb(half x);
- half2 __ovld __cnfn logb(half2 x);
-@@ -7877,14 +7883,14 @@ float3 __ovld __cnfn mad(float3 a, float3 b, float3 c);
- float4 __ovld __cnfn mad(float4 a, float4 b, float4 c);
- float8 __ovld __cnfn mad(float8 a, float8 b, float8 c);
- float16 __ovld __cnfn mad(float16 a, float16 b, float16 c);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn mad(double a, double b, double c);
- double2 __ovld __cnfn mad(double2 a, double2 b, double2 c);
- double3 __ovld __cnfn mad(double3 a, double3 b, double3 c);
- double4 __ovld __cnfn mad(double4 a, double4 b, double4 c);
- double8 __ovld __cnfn mad(double8 a, double8 b, double8 c);
- double16 __ovld __cnfn mad(double16 a, double16 b, double16 c);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn mad(half a, half b, half c);
- half2 __ovld __cnfn mad(half2 a, half2 b, half2 c);
-@@ -7904,14 +7910,14 @@ float3 __ovld __cnfn maxmag(float3 x, float3 y);
- float4 __ovld __cnfn maxmag(float4 x, float4 y);
- float8 __ovld __cnfn maxmag(float8 x, float8 y);
- float16 __ovld __cnfn maxmag(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn maxmag(double x, double y);
- double2 __ovld __cnfn maxmag(double2 x, double2 y);
- double3 __ovld __cnfn maxmag(double3 x, double3 y);
- double4 __ovld __cnfn maxmag(double4 x, double4 y);
- double8 __ovld __cnfn maxmag(double8 x, double8 y);
- double16 __ovld __cnfn maxmag(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn maxmag(half x, half y);
- half2 __ovld __cnfn maxmag(half2 x, half2 y);
-@@ -7931,14 +7937,14 @@ float3 __ovld __cnfn minmag(float3 x, float3 y);
- float4 __ovld __cnfn minmag(float4 x, float4 y);
- float8 __ovld __cnfn minmag(float8 x, float8 y);
- float16 __ovld __cnfn minmag(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn minmag(double x, double y);
- double2 __ovld __cnfn minmag(double2 x, double2 y);
- double3 __ovld __cnfn minmag(double3 x, double3 y);
- double4 __ovld __cnfn minmag(double4 x, double4 y);
- double8 __ovld __cnfn minmag(double8 x, double8 y);
- double16 __ovld __cnfn minmag(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn minmag(half x, half y);
- half2 __ovld __cnfn minmag(half2 x, half2 y);
-@@ -7955,21 +7961,21 @@ half16 __ovld __cnfn minmag(half16 x, half16 y);
- * the argument. It stores the integral part in the object
- * pointed to by iptr.
- */
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float __ovld modf(float x, float *iptr);
- float2 __ovld modf(float2 x, float2 *iptr);
- float3 __ovld modf(float3 x, float3 *iptr);
- float4 __ovld modf(float4 x, float4 *iptr);
- float8 __ovld modf(float8 x, float8 *iptr);
- float16 __ovld modf(float16 x, float16 *iptr);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld modf(double x, double *iptr);
- double2 __ovld modf(double2 x, double2 *iptr);
- double3 __ovld modf(double3 x, double3 *iptr);
- double4 __ovld modf(double4 x, double4 *iptr);
- double8 __ovld modf(double8 x, double8 *iptr);
- double16 __ovld modf(double16 x, double16 *iptr);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld modf(half x, half *iptr);
- half2 __ovld modf(half2 x, half2 *iptr);
-@@ -7978,7 +7984,9 @@ half4 __ovld modf(half4 x, half4 *iptr);
- half8 __ovld modf(half8 x, half8 *iptr);
- half16 __ovld modf(half16 x, half16 *iptr);
- #endif //cl_khr_fp16
--#else
-+#endif //__opencl_c_generic_address_space
-+
-+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
- float __ovld modf(float x, __global float *iptr);
- float2 __ovld modf(float2 x, __global float2 *iptr);
- float3 __ovld modf(float3 x, __global float3 *iptr);
-@@ -7997,7 +8005,7 @@ float3 __ovld modf(float3 x, __private float3 *iptr);
- float4 __ovld modf(float4 x, __private float4 *iptr);
- float8 __ovld modf(float8 x, __private float8 *iptr);
- float16 __ovld modf(float16 x, __private float16 *iptr);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld modf(double x, __global double *iptr);
- double2 __ovld modf(double2 x, __global double2 *iptr);
- double3 __ovld modf(double3 x, __global double3 *iptr);
-@@ -8016,7 +8024,7 @@ double3 __ovld modf(double3 x, __private double3 *iptr);
- double4 __ovld modf(double4 x, __private double4 *iptr);
- double8 __ovld modf(double8 x, __private double8 *iptr);
- double16 __ovld modf(double16 x, __private double16 *iptr);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld modf(half x, __global half *iptr);
- half2 __ovld modf(half2 x, __global half2 *iptr);
-@@ -8037,7 +8045,8 @@ half4 __ovld modf(half4 x, __private half4 *iptr);
- half8 __ovld modf(half8 x, __private half8 *iptr);
- half16 __ovld modf(half16 x, __private half16 *iptr);
- #endif //cl_khr_fp16
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
-+ //! CL_VERSION_2_0)
-
- /**
- * Returns a quiet NaN. The nancode may be placed
-@@ -8049,14 +8058,14 @@ float3 __ovld __cnfn nan(uint3 nancode);
- float4 __ovld __cnfn nan(uint4 nancode);
- float8 __ovld __cnfn nan(uint8 nancode);
- float16 __ovld __cnfn nan(uint16 nancode);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn nan(ulong nancode);
- double2 __ovld __cnfn nan(ulong2 nancode);
- double3 __ovld __cnfn nan(ulong3 nancode);
- double4 __ovld __cnfn nan(ulong4 nancode);
- double8 __ovld __cnfn nan(ulong8 nancode);
- double16 __ovld __cnfn nan(ulong16 nancode);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn nan(ushort nancode);
- half2 __ovld __cnfn nan(ushort2 nancode);
-@@ -8079,14 +8088,14 @@ float3 __ovld __cnfn nextafter(float3 x, float3 y);
- float4 __ovld __cnfn nextafter(float4 x, float4 y);
- float8 __ovld __cnfn nextafter(float8 x, float8 y);
- float16 __ovld __cnfn nextafter(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn nextafter(double x, double y);
- double2 __ovld __cnfn nextafter(double2 x, double2 y);
- double3 __ovld __cnfn nextafter(double3 x, double3 y);
- double4 __ovld __cnfn nextafter(double4 x, double4 y);
- double8 __ovld __cnfn nextafter(double8 x, double8 y);
- double16 __ovld __cnfn nextafter(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn nextafter(half x, half y);
- half2 __ovld __cnfn nextafter(half2 x, half2 y);
-@@ -8105,14 +8114,14 @@ float3 __ovld __cnfn pow(float3 x, float3 y);
- float4 __ovld __cnfn pow(float4 x, float4 y);
- float8 __ovld __cnfn pow(float8 x, float8 y);
- float16 __ovld __cnfn pow(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn pow(double x, double y);
- double2 __ovld __cnfn pow(double2 x, double2 y);
- double3 __ovld __cnfn pow(double3 x, double3 y);
- double4 __ovld __cnfn pow(double4 x, double4 y);
- double8 __ovld __cnfn pow(double8 x, double8 y);
- double16 __ovld __cnfn pow(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn pow(half x, half y);
- half2 __ovld __cnfn pow(half2 x, half2 y);
-@@ -8131,14 +8140,14 @@ float3 __ovld __cnfn pown(float3 x, int3 y);
- float4 __ovld __cnfn pown(float4 x, int4 y);
- float8 __ovld __cnfn pown(float8 x, int8 y);
- float16 __ovld __cnfn pown(float16 x, int16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn pown(double x, int y);
- double2 __ovld __cnfn pown(double2 x, int2 y);
- double3 __ovld __cnfn pown(double3 x, int3 y);
- double4 __ovld __cnfn pown(double4 x, int4 y);
- double8 __ovld __cnfn pown(double8 x, int8 y);
- double16 __ovld __cnfn pown(double16 x, int16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn pown(half x, int y);
- half2 __ovld __cnfn pown(half2 x, int2 y);
-@@ -8157,14 +8166,14 @@ float3 __ovld __cnfn powr(float3 x, float3 y);
- float4 __ovld __cnfn powr(float4 x, float4 y);
- float8 __ovld __cnfn powr(float8 x, float8 y);
- float16 __ovld __cnfn powr(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn powr(double x, double y);
- double2 __ovld __cnfn powr(double2 x, double2 y);
- double3 __ovld __cnfn powr(double3 x, double3 y);
- double4 __ovld __cnfn powr(double4 x, double4 y);
- double8 __ovld __cnfn powr(double8 x, double8 y);
- double16 __ovld __cnfn powr(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn powr(half x, half y);
- half2 __ovld __cnfn powr(half2 x, half2 y);
-@@ -8186,14 +8195,14 @@ float3 __ovld __cnfn remainder(float3 x, float3 y);
- float4 __ovld __cnfn remainder(float4 x, float4 y);
- float8 __ovld __cnfn remainder(float8 x, float8 y);
- float16 __ovld __cnfn remainder(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn remainder(double x, double y);
- double2 __ovld __cnfn remainder(double2 x, double2 y);
- double3 __ovld __cnfn remainder(double3 x, double3 y);
- double4 __ovld __cnfn remainder(double4 x, double4 y);
- double8 __ovld __cnfn remainder(double8 x, double8 y);
- double16 __ovld __cnfn remainder(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn remainder(half x, half y);
- half2 __ovld __cnfn remainder(half2 x, half2 y);
-@@ -8215,21 +8224,21 @@ half16 __ovld __cnfn remainder(half16 x, half16 y);
- * sign as x/y. It stores this signed value in the object
- * pointed to by quo.
- */
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float __ovld remquo(float x, float y, int *quo);
- float2 __ovld remquo(float2 x, float2 y, int2 *quo);
- float3 __ovld remquo(float3 x, float3 y, int3 *quo);
- float4 __ovld remquo(float4 x, float4 y, int4 *quo);
- float8 __ovld remquo(float8 x, float8 y, int8 *quo);
- float16 __ovld remquo(float16 x, float16 y, int16 *quo);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld remquo(double x, double y, int *quo);
- double2 __ovld remquo(double2 x, double2 y, int2 *quo);
- double3 __ovld remquo(double3 x, double3 y, int3 *quo);
- double4 __ovld remquo(double4 x, double4 y, int4 *quo);
- double8 __ovld remquo(double8 x, double8 y, int8 *quo);
- double16 __ovld remquo(double16 x, double16 y, int16 *quo);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld remquo(half x, half y, int *quo);
- half2 __ovld remquo(half2 x, half2 y, int2 *quo);
-@@ -8237,9 +8246,10 @@ half3 __ovld remquo(half3 x, half3 y, int3 *quo);
- half4 __ovld remquo(half4 x, half4 y, int4 *quo);
- half8 __ovld remquo(half8 x, half8 y, int8 *quo);
- half16 __ovld remquo(half16 x, half16 y, int16 *quo);
--
- #endif //cl_khr_fp16
--#else
-+#endif //__opencl_c_generic_address_space
-+
-+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
- float __ovld remquo(float x, float y, __global int *quo);
- float2 __ovld remquo(float2 x, float2 y, __global int2 *quo);
- float3 __ovld remquo(float3 x, float3 y, __global int3 *quo);
-@@ -8258,7 +8268,7 @@ float3 __ovld remquo(float3 x, float3 y, __private int3 *quo);
- float4 __ovld remquo(float4 x, float4 y, __private int4 *quo);
- float8 __ovld remquo(float8 x, float8 y, __private int8 *quo);
- float16 __ovld remquo(float16 x, float16 y, __private int16 *quo);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld remquo(double x, double y, __global int *quo);
- double2 __ovld remquo(double2 x, double2 y, __global int2 *quo);
- double3 __ovld remquo(double3 x, double3 y, __global int3 *quo);
-@@ -8277,7 +8287,7 @@ double3 __ovld remquo(double3 x, double3 y, __private int3 *quo);
- double4 __ovld remquo(double4 x, double4 y, __private int4 *quo);
- double8 __ovld remquo(double8 x, double8 y, __private int8 *quo);
- double16 __ovld remquo(double16 x, double16 y, __private int16 *quo);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld remquo(half x, half y, __global int *quo);
- half2 __ovld remquo(half2 x, half2 y, __global int2 *quo);
-@@ -8298,7 +8308,8 @@ half4 __ovld remquo(half4 x, half4 y, __private int4 *quo);
- half8 __ovld remquo(half8 x, half8 y, __private int8 *quo);
- half16 __ovld remquo(half16 x, half16 y, __private int16 *quo);
- #endif //cl_khr_fp16
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
-+ //! CL_VERSION_2_0)
- /**
- * Round to integral value (using round to nearest
- * even rounding mode) in floating-point format.
-@@ -8311,14 +8322,14 @@ float3 __ovld __cnfn rint(float3);
- float4 __ovld __cnfn rint(float4);
- float8 __ovld __cnfn rint(float8);
- float16 __ovld __cnfn rint(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn rint(double);
- double2 __ovld __cnfn rint(double2);
- double3 __ovld __cnfn rint(double3);
- double4 __ovld __cnfn rint(double4);
- double8 __ovld __cnfn rint(double8);
- double16 __ovld __cnfn rint(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn rint(half);
- half2 __ovld __cnfn rint(half2);
-@@ -8337,14 +8348,14 @@ float3 __ovld __cnfn rootn(float3 x, int3 y);
- float4 __ovld __cnfn rootn(float4 x, int4 y);
- float8 __ovld __cnfn rootn(float8 x, int8 y);
- float16 __ovld __cnfn rootn(float16 x, int16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn rootn(double x, int y);
- double2 __ovld __cnfn rootn(double2 x, int2 y);
- double3 __ovld __cnfn rootn(double3 x, int3 y);
- double4 __ovld __cnfn rootn(double4 x, int4 y);
- double8 __ovld __cnfn rootn(double8 x, int8 y);
- double16 __ovld __cnfn rootn(double16 x, int16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn rootn(half x, int y);
- half2 __ovld __cnfn rootn(half2 x, int2 y);
-@@ -8365,14 +8376,14 @@ float3 __ovld __cnfn round(float3 x);
- float4 __ovld __cnfn round(float4 x);
- float8 __ovld __cnfn round(float8 x);
- float16 __ovld __cnfn round(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn round(double x);
- double2 __ovld __cnfn round(double2 x);
- double3 __ovld __cnfn round(double3 x);
- double4 __ovld __cnfn round(double4 x);
- double8 __ovld __cnfn round(double8 x);
- double16 __ovld __cnfn round(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn round(half x);
- half2 __ovld __cnfn round(half2 x);
-@@ -8391,14 +8402,14 @@ float3 __ovld __cnfn rsqrt(float3);
- float4 __ovld __cnfn rsqrt(float4);
- float8 __ovld __cnfn rsqrt(float8);
- float16 __ovld __cnfn rsqrt(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn rsqrt(double);
- double2 __ovld __cnfn rsqrt(double2);
- double3 __ovld __cnfn rsqrt(double3);
- double4 __ovld __cnfn rsqrt(double4);
- double8 __ovld __cnfn rsqrt(double8);
- double16 __ovld __cnfn rsqrt(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn rsqrt(half);
- half2 __ovld __cnfn rsqrt(half2);
-@@ -8417,14 +8428,14 @@ float3 __ovld __cnfn sin(float3);
- float4 __ovld __cnfn sin(float4);
- float8 __ovld __cnfn sin(float8);
- float16 __ovld __cnfn sin(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn sin(double);
- double2 __ovld __cnfn sin(double2);
- double3 __ovld __cnfn sin(double3);
- double4 __ovld __cnfn sin(double4);
- double8 __ovld __cnfn sin(double8);
- double16 __ovld __cnfn sin(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn sin(half);
- half2 __ovld __cnfn sin(half2);
-@@ -8439,21 +8450,21 @@ half16 __ovld __cnfn sin(half16);
- * is the return value and computed cosine is returned
- * in cosval.
- */
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float __ovld sincos(float x, float *cosval);
- float2 __ovld sincos(float2 x, float2 *cosval);
- float3 __ovld sincos(float3 x, float3 *cosval);
- float4 __ovld sincos(float4 x, float4 *cosval);
- float8 __ovld sincos(float8 x, float8 *cosval);
- float16 __ovld sincos(float16 x, float16 *cosval);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld sincos(double x, double *cosval);
- double2 __ovld sincos(double2 x, double2 *cosval);
- double3 __ovld sincos(double3 x, double3 *cosval);
- double4 __ovld sincos(double4 x, double4 *cosval);
- double8 __ovld sincos(double8 x, double8 *cosval);
- double16 __ovld sincos(double16 x, double16 *cosval);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld sincos(half x, half *cosval);
- half2 __ovld sincos(half2 x, half2 *cosval);
-@@ -8462,7 +8473,9 @@ half4 __ovld sincos(half4 x, half4 *cosval);
- half8 __ovld sincos(half8 x, half8 *cosval);
- half16 __ovld sincos(half16 x, half16 *cosval);
- #endif //cl_khr_fp16
--#else
-+#endif //__opencl_c_generic_address_space
-+
-+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
- float __ovld sincos(float x, __global float *cosval);
- float2 __ovld sincos(float2 x, __global float2 *cosval);
- float3 __ovld sincos(float3 x, __global float3 *cosval);
-@@ -8481,7 +8494,7 @@ float3 __ovld sincos(float3 x, __private float3 *cosval);
- float4 __ovld sincos(float4 x, __private float4 *cosval);
- float8 __ovld sincos(float8 x, __private float8 *cosval);
- float16 __ovld sincos(float16 x, __private float16 *cosval);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld sincos(double x, __global double *cosval);
- double2 __ovld sincos(double2 x, __global double2 *cosval);
- double3 __ovld sincos(double3 x, __global double3 *cosval);
-@@ -8500,7 +8513,7 @@ double3 __ovld sincos(double3 x, __private double3 *cosval);
- double4 __ovld sincos(double4 x, __private double4 *cosval);
- double8 __ovld sincos(double8 x, __private double8 *cosval);
- double16 __ovld sincos(double16 x, __private double16 *cosval);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld sincos(half x, __global half *cosval);
- half2 __ovld sincos(half2 x, __global half2 *cosval);
-@@ -8521,8 +8534,8 @@ half4 __ovld sincos(half4 x, __private half4 *cosval);
- half8 __ovld sincos(half8 x, __private half8 *cosval);
- half16 __ovld sincos(half16 x, __private half16 *cosval);
- #endif //cl_khr_fp16
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
--
-+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
-+ //! CL_VERSION_2_0)
- /**
- * Compute hyperbolic sine.
- */
-@@ -8532,14 +8545,14 @@ float3 __ovld __cnfn sinh(float3);
- float4 __ovld __cnfn sinh(float4);
- float8 __ovld __cnfn sinh(float8);
- float16 __ovld __cnfn sinh(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn sinh(double);
- double2 __ovld __cnfn sinh(double2);
- double3 __ovld __cnfn sinh(double3);
- double4 __ovld __cnfn sinh(double4);
- double8 __ovld __cnfn sinh(double8);
- double16 __ovld __cnfn sinh(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn sinh(half);
- half2 __ovld __cnfn sinh(half2);
-@@ -8558,14 +8571,14 @@ float3 __ovld __cnfn sinpi(float3 x);
- float4 __ovld __cnfn sinpi(float4 x);
- float8 __ovld __cnfn sinpi(float8 x);
- float16 __ovld __cnfn sinpi(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn sinpi(double x);
- double2 __ovld __cnfn sinpi(double2 x);
- double3 __ovld __cnfn sinpi(double3 x);
- double4 __ovld __cnfn sinpi(double4 x);
- double8 __ovld __cnfn sinpi(double8 x);
- double16 __ovld __cnfn sinpi(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn sinpi(half x);
- half2 __ovld __cnfn sinpi(half2 x);
-@@ -8584,14 +8597,14 @@ float3 __ovld __cnfn sqrt(float3);
- float4 __ovld __cnfn sqrt(float4);
- float8 __ovld __cnfn sqrt(float8);
- float16 __ovld __cnfn sqrt(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn sqrt(double);
- double2 __ovld __cnfn sqrt(double2);
- double3 __ovld __cnfn sqrt(double3);
- double4 __ovld __cnfn sqrt(double4);
- double8 __ovld __cnfn sqrt(double8);
- double16 __ovld __cnfn sqrt(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn sqrt(half);
- half2 __ovld __cnfn sqrt(half2);
-@@ -8610,14 +8623,14 @@ float3 __ovld __cnfn tan(float3);
- float4 __ovld __cnfn tan(float4);
- float8 __ovld __cnfn tan(float8);
- float16 __ovld __cnfn tan(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn tan(double);
- double2 __ovld __cnfn tan(double2);
- double3 __ovld __cnfn tan(double3);
- double4 __ovld __cnfn tan(double4);
- double8 __ovld __cnfn tan(double8);
- double16 __ovld __cnfn tan(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn tan(half);
- half2 __ovld __cnfn tan(half2);
-@@ -8636,14 +8649,14 @@ float3 __ovld __cnfn tanh(float3);
- float4 __ovld __cnfn tanh(float4);
- float8 __ovld __cnfn tanh(float8);
- float16 __ovld __cnfn tanh(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn tanh(double);
- double2 __ovld __cnfn tanh(double2);
- double3 __ovld __cnfn tanh(double3);
- double4 __ovld __cnfn tanh(double4);
- double8 __ovld __cnfn tanh(double8);
- double16 __ovld __cnfn tanh(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn tanh(half);
- half2 __ovld __cnfn tanh(half2);
-@@ -8662,14 +8675,14 @@ float3 __ovld __cnfn tanpi(float3 x);
- float4 __ovld __cnfn tanpi(float4 x);
- float8 __ovld __cnfn tanpi(float8 x);
- float16 __ovld __cnfn tanpi(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn tanpi(double x);
- double2 __ovld __cnfn tanpi(double2 x);
- double3 __ovld __cnfn tanpi(double3 x);
- double4 __ovld __cnfn tanpi(double4 x);
- double8 __ovld __cnfn tanpi(double8 x);
- double16 __ovld __cnfn tanpi(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn tanpi(half x);
- half2 __ovld __cnfn tanpi(half2 x);
-@@ -8688,14 +8701,14 @@ float3 __ovld __cnfn tgamma(float3);
- float4 __ovld __cnfn tgamma(float4);
- float8 __ovld __cnfn tgamma(float8);
- float16 __ovld __cnfn tgamma(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn tgamma(double);
- double2 __ovld __cnfn tgamma(double2);
- double3 __ovld __cnfn tgamma(double3);
- double4 __ovld __cnfn tgamma(double4);
- double8 __ovld __cnfn tgamma(double8);
- double16 __ovld __cnfn tgamma(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn tgamma(half);
- half2 __ovld __cnfn tgamma(half2);
-@@ -8715,14 +8728,14 @@ float3 __ovld __cnfn trunc(float3);
- float4 __ovld __cnfn trunc(float4);
- float8 __ovld __cnfn trunc(float8);
- float16 __ovld __cnfn trunc(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn trunc(double);
- double2 __ovld __cnfn trunc(double2);
- double3 __ovld __cnfn trunc(double3);
- double4 __ovld __cnfn trunc(double4);
- double8 __ovld __cnfn trunc(double8);
- double16 __ovld __cnfn trunc(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn trunc(half);
- half2 __ovld __cnfn trunc(half2);
-@@ -10108,7 +10121,7 @@ float3 __ovld __cnfn clamp(float3 x, float minval, float maxval);
- float4 __ovld __cnfn clamp(float4 x, float minval, float maxval);
- float8 __ovld __cnfn clamp(float8 x, float minval, float maxval);
- float16 __ovld __cnfn clamp(float16 x, float minval, float maxval);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn clamp(double x, double minval, double maxval);
- double2 __ovld __cnfn clamp(double2 x, double2 minval, double2 maxval);
- double3 __ovld __cnfn clamp(double3 x, double3 minval, double3 maxval);
-@@ -10120,7 +10133,7 @@ double3 __ovld __cnfn clamp(double3 x, double minval, double maxval);
- double4 __ovld __cnfn clamp(double4 x, double minval, double maxval);
- double8 __ovld __cnfn clamp(double8 x, double minval, double maxval);
- double16 __ovld __cnfn clamp(double16 x, double minval, double maxval);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn clamp(half x, half minval, half maxval);
- half2 __ovld __cnfn clamp(half2 x, half2 minval, half2 maxval);
-@@ -10145,14 +10158,14 @@ float3 __ovld __cnfn degrees(float3 radians);
- float4 __ovld __cnfn degrees(float4 radians);
- float8 __ovld __cnfn degrees(float8 radians);
- float16 __ovld __cnfn degrees(float16 radians);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn degrees(double radians);
- double2 __ovld __cnfn degrees(double2 radians);
- double3 __ovld __cnfn degrees(double3 radians);
- double4 __ovld __cnfn degrees(double4 radians);
- double8 __ovld __cnfn degrees(double8 radians);
- double16 __ovld __cnfn degrees(double16 radians);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn degrees(half radians);
- half2 __ovld __cnfn degrees(half2 radians);
-@@ -10177,7 +10190,7 @@ float3 __ovld __cnfn max(float3 x, float y);
- float4 __ovld __cnfn max(float4 x, float y);
- float8 __ovld __cnfn max(float8 x, float y);
- float16 __ovld __cnfn max(float16 x, float y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn max(double x, double y);
- double2 __ovld __cnfn max(double2 x, double2 y);
- double3 __ovld __cnfn max(double3 x, double3 y);
-@@ -10189,7 +10202,7 @@ double3 __ovld __cnfn max(double3 x, double y);
- double4 __ovld __cnfn max(double4 x, double y);
- double8 __ovld __cnfn max(double8 x, double y);
- double16 __ovld __cnfn max(double16 x, double y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn max(half x, half y);
- half2 __ovld __cnfn max(half2 x, half2 y);
-@@ -10219,7 +10232,7 @@ float3 __ovld __cnfn min(float3 x, float y);
- float4 __ovld __cnfn min(float4 x, float y);
- float8 __ovld __cnfn min(float8 x, float y);
- float16 __ovld __cnfn min(float16 x, float y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn min(double x, double y);
- double2 __ovld __cnfn min(double2 x, double2 y);
- double3 __ovld __cnfn min(double3 x, double3 y);
-@@ -10231,7 +10244,7 @@ double3 __ovld __cnfn min(double3 x, double y);
- double4 __ovld __cnfn min(double4 x, double y);
- double8 __ovld __cnfn min(double8 x, double y);
- double16 __ovld __cnfn min(double16 x, double y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn min(half x, half y);
- half2 __ovld __cnfn min(half2 x, half2 y);
-@@ -10264,7 +10277,7 @@ float3 __ovld __cnfn mix(float3 x, float3 y, float a);
- float4 __ovld __cnfn mix(float4 x, float4 y, float a);
- float8 __ovld __cnfn mix(float8 x, float8 y, float a);
- float16 __ovld __cnfn mix(float16 x, float16 y, float a);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn mix(double x, double y, double a);
- double2 __ovld __cnfn mix(double2 x, double2 y, double2 a);
- double3 __ovld __cnfn mix(double3 x, double3 y, double3 a);
-@@ -10276,7 +10289,7 @@ double3 __ovld __cnfn mix(double3 x, double3 y, double a);
- double4 __ovld __cnfn mix(double4 x, double4 y, double a);
- double8 __ovld __cnfn mix(double8 x, double8 y, double a);
- double16 __ovld __cnfn mix(double16 x, double16 y, double a);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn mix(half x, half y, half a);
- half2 __ovld __cnfn mix(half2 x, half2 y, half2 a);
-@@ -10301,14 +10314,14 @@ float3 __ovld __cnfn radians(float3 degrees);
- float4 __ovld __cnfn radians(float4 degrees);
- float8 __ovld __cnfn radians(float8 degrees);
- float16 __ovld __cnfn radians(float16 degrees);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn radians(double degrees);
- double2 __ovld __cnfn radians(double2 degrees);
- double3 __ovld __cnfn radians(double3 degrees);
- double4 __ovld __cnfn radians(double4 degrees);
- double8 __ovld __cnfn radians(double8 degrees);
- double16 __ovld __cnfn radians(double16 degrees);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn radians(half degrees);
- half2 __ovld __cnfn radians(half2 degrees);
-@@ -10332,7 +10345,7 @@ float3 __ovld __cnfn step(float edge, float3 x);
- float4 __ovld __cnfn step(float edge, float4 x);
- float8 __ovld __cnfn step(float edge, float8 x);
- float16 __ovld __cnfn step(float edge, float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn step(double edge, double x);
- double2 __ovld __cnfn step(double2 edge, double2 x);
- double3 __ovld __cnfn step(double3 edge, double3 x);
-@@ -10344,7 +10357,7 @@ double3 __ovld __cnfn step(double edge, double3 x);
- double4 __ovld __cnfn step(double edge, double4 x);
- double8 __ovld __cnfn step(double edge, double8 x);
- double16 __ovld __cnfn step(double edge, double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn step(half edge, half x);
- half2 __ovld __cnfn step(half2 edge, half2 x);
-@@ -10383,7 +10396,7 @@ float3 __ovld __cnfn smoothstep(float edge0, float edge1, float3 x);
- float4 __ovld __cnfn smoothstep(float edge0, float edge1, float4 x);
- float8 __ovld __cnfn smoothstep(float edge0, float edge1, float8 x);
- float16 __ovld __cnfn smoothstep(float edge0, float edge1, float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn smoothstep(double edge0, double edge1, double x);
- double2 __ovld __cnfn smoothstep(double2 edge0, double2 edge1, double2 x);
- double3 __ovld __cnfn smoothstep(double3 edge0, double3 edge1, double3 x);
-@@ -10395,7 +10408,7 @@ double3 __ovld __cnfn smoothstep(double edge0, double edge1, double3 x);
- double4 __ovld __cnfn smoothstep(double edge0, double edge1, double4 x);
- double8 __ovld __cnfn smoothstep(double edge0, double edge1, double8 x);
- double16 __ovld __cnfn smoothstep(double edge0, double edge1, double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn smoothstep(half edge0, half edge1, half x);
- half2 __ovld __cnfn smoothstep(half2 edge0, half2 edge1, half2 x);
-@@ -10420,14 +10433,14 @@ float3 __ovld __cnfn sign(float3 x);
- float4 __ovld __cnfn sign(float4 x);
- float8 __ovld __cnfn sign(float8 x);
- float16 __ovld __cnfn sign(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn sign(double x);
- double2 __ovld __cnfn sign(double2 x);
- double3 __ovld __cnfn sign(double3 x);
- double4 __ovld __cnfn sign(double4 x);
- double8 __ovld __cnfn sign(double8 x);
- double16 __ovld __cnfn sign(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn sign(half x);
- half2 __ovld __cnfn sign(half2 x);
-@@ -10445,10 +10458,10 @@ half16 __ovld __cnfn sign(half16 x);
- */
- float4 __ovld __cnfn cross(float4 p0, float4 p1);
- float3 __ovld __cnfn cross(float3 p0, float3 p1);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double4 __ovld __cnfn cross(double4 p0, double4 p1);
- double3 __ovld __cnfn cross(double3 p0, double3 p1);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half4 __ovld __cnfn cross(half4 p0, half4 p1);
- half3 __ovld __cnfn cross(half3 p0, half3 p1);
-@@ -10461,12 +10474,12 @@ float __ovld __cnfn dot(float p0, float p1);
- float __ovld __cnfn dot(float2 p0, float2 p1);
- float __ovld __cnfn dot(float3 p0, float3 p1);
- float __ovld __cnfn dot(float4 p0, float4 p1);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn dot(double p0, double p1);
- double __ovld __cnfn dot(double2 p0, double2 p1);
- double __ovld __cnfn dot(double3 p0, double3 p1);
- double __ovld __cnfn dot(double4 p0, double4 p1);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn dot(half p0, half p1);
- half __ovld __cnfn dot(half2 p0, half2 p1);
-@@ -10482,12 +10495,12 @@ float __ovld __cnfn distance(float p0, float p1);
- float __ovld __cnfn distance(float2 p0, float2 p1);
- float __ovld __cnfn distance(float3 p0, float3 p1);
- float __ovld __cnfn distance(float4 p0, float4 p1);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn distance(double p0, double p1);
- double __ovld __cnfn distance(double2 p0, double2 p1);
- double __ovld __cnfn distance(double3 p0, double3 p1);
- double __ovld __cnfn distance(double4 p0, double4 p1);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn distance(half p0, half p1);
- half __ovld __cnfn distance(half2 p0, half2 p1);
-@@ -10503,12 +10516,12 @@ float __ovld __cnfn length(float p);
- float __ovld __cnfn length(float2 p);
- float __ovld __cnfn length(float3 p);
- float __ovld __cnfn length(float4 p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn length(double p);
- double __ovld __cnfn length(double2 p);
- double __ovld __cnfn length(double3 p);
- double __ovld __cnfn length(double4 p);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn length(half p);
- half __ovld __cnfn length(half2 p);
-@@ -10524,12 +10537,12 @@ float __ovld __cnfn normalize(float p);
- float2 __ovld __cnfn normalize(float2 p);
- float3 __ovld __cnfn normalize(float3 p);
- float4 __ovld __cnfn normalize(float4 p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn normalize(double p);
- double2 __ovld __cnfn normalize(double2 p);
- double3 __ovld __cnfn normalize(double3 p);
- double4 __ovld __cnfn normalize(double4 p);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn normalize(half p);
- half2 __ovld __cnfn normalize(half2 p);
-@@ -10610,14 +10623,14 @@ int3 __ovld __cnfn isequal(float3 x, float3 y);
- int4 __ovld __cnfn isequal(float4 x, float4 y);
- int8 __ovld __cnfn isequal(float8 x, float8 y);
- int16 __ovld __cnfn isequal(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isequal(double x, double y);
- long2 __ovld __cnfn isequal(double2 x, double2 y);
- long3 __ovld __cnfn isequal(double3 x, double3 y);
- long4 __ovld __cnfn isequal(double4 x, double4 y);
- long8 __ovld __cnfn isequal(double8 x, double8 y);
- long16 __ovld __cnfn isequal(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isequal(half x, half y);
- short2 __ovld __cnfn isequal(half2 x, half2 y);
-@@ -10636,14 +10649,14 @@ int3 __ovld __cnfn isnotequal(float3 x, float3 y);
- int4 __ovld __cnfn isnotequal(float4 x, float4 y);
- int8 __ovld __cnfn isnotequal(float8 x, float8 y);
- int16 __ovld __cnfn isnotequal(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isnotequal(double x, double y);
- long2 __ovld __cnfn isnotequal(double2 x, double2 y);
- long3 __ovld __cnfn isnotequal(double3 x, double3 y);
- long4 __ovld __cnfn isnotequal(double4 x, double4 y);
- long8 __ovld __cnfn isnotequal(double8 x, double8 y);
- long16 __ovld __cnfn isnotequal(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isnotequal(half x, half y);
- short2 __ovld __cnfn isnotequal(half2 x, half2 y);
-@@ -10662,14 +10675,14 @@ int3 __ovld __cnfn isgreater(float3 x, float3 y);
- int4 __ovld __cnfn isgreater(float4 x, float4 y);
- int8 __ovld __cnfn isgreater(float8 x, float8 y);
- int16 __ovld __cnfn isgreater(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isgreater(double x, double y);
- long2 __ovld __cnfn isgreater(double2 x, double2 y);
- long3 __ovld __cnfn isgreater(double3 x, double3 y);
- long4 __ovld __cnfn isgreater(double4 x, double4 y);
- long8 __ovld __cnfn isgreater(double8 x, double8 y);
- long16 __ovld __cnfn isgreater(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isgreater(half x, half y);
- short2 __ovld __cnfn isgreater(half2 x, half2 y);
-@@ -10688,14 +10701,14 @@ int3 __ovld __cnfn isgreaterequal(float3 x, float3 y);
- int4 __ovld __cnfn isgreaterequal(float4 x, float4 y);
- int8 __ovld __cnfn isgreaterequal(float8 x, float8 y);
- int16 __ovld __cnfn isgreaterequal(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isgreaterequal(double x, double y);
- long2 __ovld __cnfn isgreaterequal(double2 x, double2 y);
- long3 __ovld __cnfn isgreaterequal(double3 x, double3 y);
- long4 __ovld __cnfn isgreaterequal(double4 x, double4 y);
- long8 __ovld __cnfn isgreaterequal(double8 x, double8 y);
- long16 __ovld __cnfn isgreaterequal(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isgreaterequal(half x, half y);
- short2 __ovld __cnfn isgreaterequal(half2 x, half2 y);
-@@ -10714,14 +10727,14 @@ int3 __ovld __cnfn isless(float3 x, float3 y);
- int4 __ovld __cnfn isless(float4 x, float4 y);
- int8 __ovld __cnfn isless(float8 x, float8 y);
- int16 __ovld __cnfn isless(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isless(double x, double y);
- long2 __ovld __cnfn isless(double2 x, double2 y);
- long3 __ovld __cnfn isless(double3 x, double3 y);
- long4 __ovld __cnfn isless(double4 x, double4 y);
- long8 __ovld __cnfn isless(double8 x, double8 y);
- long16 __ovld __cnfn isless(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isless(half x, half y);
- short2 __ovld __cnfn isless(half2 x, half2 y);
-@@ -10740,14 +10753,14 @@ int3 __ovld __cnfn islessequal(float3 x, float3 y);
- int4 __ovld __cnfn islessequal(float4 x, float4 y);
- int8 __ovld __cnfn islessequal(float8 x, float8 y);
- int16 __ovld __cnfn islessequal(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn islessequal(double x, double y);
- long2 __ovld __cnfn islessequal(double2 x, double2 y);
- long3 __ovld __cnfn islessequal(double3 x, double3 y);
- long4 __ovld __cnfn islessequal(double4 x, double4 y);
- long8 __ovld __cnfn islessequal(double8 x, double8 y);
- long16 __ovld __cnfn islessequal(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn islessequal(half x, half y);
- short2 __ovld __cnfn islessequal(half2 x, half2 y);
-@@ -10767,14 +10780,14 @@ int3 __ovld __cnfn islessgreater(float3 x, float3 y);
- int4 __ovld __cnfn islessgreater(float4 x, float4 y);
- int8 __ovld __cnfn islessgreater(float8 x, float8 y);
- int16 __ovld __cnfn islessgreater(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn islessgreater(double x, double y);
- long2 __ovld __cnfn islessgreater(double2 x, double2 y);
- long3 __ovld __cnfn islessgreater(double3 x, double3 y);
- long4 __ovld __cnfn islessgreater(double4 x, double4 y);
- long8 __ovld __cnfn islessgreater(double8 x, double8 y);
- long16 __ovld __cnfn islessgreater(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn islessgreater(half x, half y);
- short2 __ovld __cnfn islessgreater(half2 x, half2 y);
-@@ -10793,14 +10806,14 @@ int3 __ovld __cnfn isfinite(float3);
- int4 __ovld __cnfn isfinite(float4);
- int8 __ovld __cnfn isfinite(float8);
- int16 __ovld __cnfn isfinite(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isfinite(double);
- long2 __ovld __cnfn isfinite(double2);
- long3 __ovld __cnfn isfinite(double3);
- long4 __ovld __cnfn isfinite(double4);
- long8 __ovld __cnfn isfinite(double8);
- long16 __ovld __cnfn isfinite(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isfinite(half);
- short2 __ovld __cnfn isfinite(half2);
-@@ -10819,14 +10832,14 @@ int3 __ovld __cnfn isinf(float3);
- int4 __ovld __cnfn isinf(float4);
- int8 __ovld __cnfn isinf(float8);
- int16 __ovld __cnfn isinf(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isinf(double);
- long2 __ovld __cnfn isinf(double2);
- long3 __ovld __cnfn isinf(double3);
- long4 __ovld __cnfn isinf(double4);
- long8 __ovld __cnfn isinf(double8);
- long16 __ovld __cnfn isinf(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isinf(half);
- short2 __ovld __cnfn isinf(half2);
-@@ -10845,14 +10858,14 @@ int3 __ovld __cnfn isnan(float3);
- int4 __ovld __cnfn isnan(float4);
- int8 __ovld __cnfn isnan(float8);
- int16 __ovld __cnfn isnan(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isnan(double);
- long2 __ovld __cnfn isnan(double2);
- long3 __ovld __cnfn isnan(double3);
- long4 __ovld __cnfn isnan(double4);
- long8 __ovld __cnfn isnan(double8);
- long16 __ovld __cnfn isnan(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isnan(half);
- short2 __ovld __cnfn isnan(half2);
-@@ -10871,14 +10884,14 @@ int3 __ovld __cnfn isnormal(float3);
- int4 __ovld __cnfn isnormal(float4);
- int8 __ovld __cnfn isnormal(float8);
- int16 __ovld __cnfn isnormal(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isnormal(double);
- long2 __ovld __cnfn isnormal(double2);
- long3 __ovld __cnfn isnormal(double3);
- long4 __ovld __cnfn isnormal(double4);
- long8 __ovld __cnfn isnormal(double8);
- long16 __ovld __cnfn isnormal(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isnormal(half);
- short2 __ovld __cnfn isnormal(half2);
-@@ -10899,14 +10912,14 @@ int3 __ovld __cnfn isordered(float3 x, float3 y);
- int4 __ovld __cnfn isordered(float4 x, float4 y);
- int8 __ovld __cnfn isordered(float8 x, float8 y);
- int16 __ovld __cnfn isordered(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isordered(double x, double y);
- long2 __ovld __cnfn isordered(double2 x, double2 y);
- long3 __ovld __cnfn isordered(double3 x, double3 y);
- long4 __ovld __cnfn isordered(double4 x, double4 y);
- long8 __ovld __cnfn isordered(double8 x, double8 y);
- long16 __ovld __cnfn isordered(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isordered(half x, half y);
- short2 __ovld __cnfn isordered(half2 x, half2 y);
-@@ -10927,14 +10940,14 @@ int3 __ovld __cnfn isunordered(float3 x, float3 y);
- int4 __ovld __cnfn isunordered(float4 x, float4 y);
- int8 __ovld __cnfn isunordered(float8 x, float8 y);
- int16 __ovld __cnfn isunordered(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isunordered(double x, double y);
- long2 __ovld __cnfn isunordered(double2 x, double2 y);
- long3 __ovld __cnfn isunordered(double3 x, double3 y);
- long4 __ovld __cnfn isunordered(double4 x, double4 y);
- long8 __ovld __cnfn isunordered(double8 x, double8 y);
- long16 __ovld __cnfn isunordered(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isunordered(half x, half y);
- short2 __ovld __cnfn isunordered(half2 x, half2 y);
-@@ -10957,14 +10970,14 @@ int3 __ovld __cnfn signbit(float3);
- int4 __ovld __cnfn signbit(float4);
- int8 __ovld __cnfn signbit(float8);
- int16 __ovld __cnfn signbit(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn signbit(double);
- long2 __ovld __cnfn signbit(double2);
- long3 __ovld __cnfn signbit(double3);
- long4 __ovld __cnfn signbit(double4);
- long8 __ovld __cnfn signbit(double8);
- long16 __ovld __cnfn signbit(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn signbit(half);
- short2 __ovld __cnfn signbit(half2);
-@@ -11091,14 +11104,14 @@ float3 __ovld __cnfn bitselect(float3 a, float3 b, float3 c);
- float4 __ovld __cnfn bitselect(float4 a, float4 b, float4 c);
- float8 __ovld __cnfn bitselect(float8 a, float8 b, float8 c);
- float16 __ovld __cnfn bitselect(float16 a, float16 b, float16 c);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn bitselect(double a, double b, double c);
- double2 __ovld __cnfn bitselect(double2 a, double2 b, double2 c);
- double3 __ovld __cnfn bitselect(double3 a, double3 b, double3 c);
- double4 __ovld __cnfn bitselect(double4 a, double4 b, double4 c);
- double8 __ovld __cnfn bitselect(double8 a, double8 b, double8 c);
- double16 __ovld __cnfn bitselect(double16 a, double16 b, double16 c);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn bitselect(half a, half b, half c);
- half2 __ovld __cnfn bitselect(half2 a, half2 b, half2 c);
-@@ -11231,7 +11244,7 @@ ulong8 __ovld __cnfn select(ulong8 a, ulong8 b, ulong8 c);
- long16 __ovld __cnfn select(long16 a, long16 b, ulong16 c);
- ulong16 __ovld __cnfn select(ulong16 a, ulong16 b, ulong16 c);
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn select(double a, double b, long c);
- double2 __ovld __cnfn select(double2 a, double2 b, long2 c);
- double3 __ovld __cnfn select(double3 a, double3 b, long3 c);
-@@ -11244,7 +11257,7 @@ double3 __ovld __cnfn select(double3 a, double3 b, ulong3 c);
- double4 __ovld __cnfn select(double4 a, double4 b, ulong4 c);
- double8 __ovld __cnfn select(double8 a, double8 b, ulong8 c);
- double16 __ovld __cnfn select(double16 a, double16 b, ulong16 c);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn select(half a, half b, short c);
- half2 __ovld __cnfn select(half2 a, half2 b, short2 c);
-@@ -11323,13 +11336,13 @@ uint16 __ovld vload16(size_t offset, const __constant uint *p);
- long16 __ovld vload16(size_t offset, const __constant long *p);
- ulong16 __ovld vload16(size_t offset, const __constant ulong *p);
- float16 __ovld vload16(size_t offset, const __constant float *p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double2 __ovld vload2(size_t offset, const __constant double *p);
- double3 __ovld vload3(size_t offset, const __constant double *p);
- double4 __ovld vload4(size_t offset, const __constant double *p);
- double8 __ovld vload8(size_t offset, const __constant double *p);
- double16 __ovld vload16(size_t offset, const __constant double *p);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #ifdef cl_khr_fp16
- half __ovld vload(size_t offset, const __constant half *p);
-@@ -11340,7 +11353,7 @@ half8 __ovld vload8(size_t offset, const __constant half *p);
- half16 __ovld vload16(size_t offset, const __constant half *p);
- #endif //cl_khr_fp16
-
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- char2 __ovld vload2(size_t offset, const char *p);
- uchar2 __ovld vload2(size_t offset, const uchar *p);
- short2 __ovld vload2(size_t offset, const short *p);
-@@ -11387,13 +11400,13 @@ long16 __ovld vload16(size_t offset, const long *p);
- ulong16 __ovld vload16(size_t offset, const ulong *p);
- float16 __ovld vload16(size_t offset, const float *p);
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double2 __ovld vload2(size_t offset, const double *p);
- double3 __ovld vload3(size_t offset, const double *p);
- double4 __ovld vload4(size_t offset, const double *p);
- double8 __ovld vload8(size_t offset, const double *p);
- double16 __ovld vload16(size_t offset, const double *p);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #ifdef cl_khr_fp16
- half __ovld vload(size_t offset, const half *p);
-@@ -11403,7 +11416,7 @@ half4 __ovld vload4(size_t offset, const half *p);
- half8 __ovld vload8(size_t offset, const half *p);
- half16 __ovld vload16(size_t offset, const half *p);
- #endif //cl_khr_fp16
--#else
-+#endif //__opencl_c_generic_address_space
- char2 __ovld vload2(size_t offset, const __global char *p);
- uchar2 __ovld vload2(size_t offset, const __global uchar *p);
- short2 __ovld vload2(size_t offset, const __global short *p);
-@@ -11540,7 +11553,7 @@ long16 __ovld vload16(size_t offset, const __private long *p);
- ulong16 __ovld vload16(size_t offset, const __private ulong *p);
- float16 __ovld vload16(size_t offset, const __private float *p);
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double2 __ovld vload2(size_t offset, const __global double *p);
- double3 __ovld vload3(size_t offset, const __global double *p);
- double4 __ovld vload4(size_t offset, const __global double *p);
-@@ -11556,7 +11569,7 @@ double3 __ovld vload3(size_t offset, const __private double *p);
- double4 __ovld vload4(size_t offset, const __private double *p);
- double8 __ovld vload8(size_t offset, const __private double *p);
- double16 __ovld vload16(size_t offset, const __private double *p);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #ifdef cl_khr_fp16
- half __ovld vload(size_t offset, const __global half *p);
-@@ -11578,9 +11591,8 @@ half4 __ovld vload4(size_t offset, const __private half *p);
- half8 __ovld vload8(size_t offset, const __private half *p);
- half16 __ovld vload16(size_t offset, const __private half *p);
- #endif //cl_khr_fp16
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- void __ovld vstore2(char2 data, size_t offset, char *p);
- void __ovld vstore2(uchar2 data, size_t offset, uchar *p);
- void __ovld vstore2(short2 data, size_t offset, short *p);
-@@ -11626,13 +11638,13 @@ void __ovld vstore16(uint16 data, size_t offset, uint *p);
- void __ovld vstore16(long16 data, size_t offset, long *p);
- void __ovld vstore16(ulong16 data, size_t offset, ulong *p);
- void __ovld vstore16(float16 data, size_t offset, float *p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld vstore2(double2 data, size_t offset, double *p);
- void __ovld vstore3(double3 data, size_t offset, double *p);
- void __ovld vstore4(double4 data, size_t offset, double *p);
- void __ovld vstore8(double8 data, size_t offset, double *p);
- void __ovld vstore16(double16 data, size_t offset, double *p);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- void __ovld vstore(half data, size_t offset, half *p);
- void __ovld vstore2(half2 data, size_t offset, half *p);
-@@ -11641,7 +11653,7 @@ void __ovld vstore4(half4 data, size_t offset, half *p);
- void __ovld vstore8(half8 data, size_t offset, half *p);
- void __ovld vstore16(half16 data, size_t offset, half *p);
- #endif //cl_khr_fp16
--#else
-+#endif //__opencl_c_generic_address_space
- void __ovld vstore2(char2 data, size_t offset, __global char *p);
- void __ovld vstore2(uchar2 data, size_t offset, __global uchar *p);
- void __ovld vstore2(short2 data, size_t offset, __global short *p);
-@@ -11777,7 +11789,7 @@ void __ovld vstore16(uint16 data, size_t offset, __private uint *p);
- void __ovld vstore16(long16 data, size_t offset, __private long *p);
- void __ovld vstore16(ulong16 data, size_t offset, __private ulong *p);
- void __ovld vstore16(float16 data, size_t offset, __private float *p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld vstore2(double2 data, size_t offset, __global double *p);
- void __ovld vstore3(double3 data, size_t offset, __global double *p);
- void __ovld vstore4(double4 data, size_t offset, __global double *p);
-@@ -11793,7 +11805,7 @@ void __ovld vstore3(double3 data, size_t offset, __private double *p);
- void __ovld vstore4(double4 data, size_t offset, __private double *p);
- void __ovld vstore8(double8 data, size_t offset, __private double *p);
- void __ovld vstore16(double16 data, size_t offset, __private double *p);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- void __ovld vstore(half data, size_t offset, __global half *p);
- void __ovld vstore2(half2 data, size_t offset, __global half *p);
-@@ -11814,7 +11826,6 @@ void __ovld vstore4(half4 data, size_t offset, __private half *p);
- void __ovld vstore8(half8 data, size_t offset, __private half *p);
- void __ovld vstore16(half16 data, size_t offset, __private half *p);
- #endif //cl_khr_fp16
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
- * Read sizeof (half) bytes of data from address
-@@ -11825,13 +11836,12 @@ void __ovld vstore16(half16 data, size_t offset, __private half *p);
- * must be 16-bit aligned.
- */
- float __ovld vload_half(size_t offset, const __constant half *p);
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float __ovld vload_half(size_t offset, const half *p);
--#else
-+#endif //__opencl_c_generic_address_space
- float __ovld vload_half(size_t offset, const __global half *p);
- float __ovld vload_half(size_t offset, const __local half *p);
- float __ovld vload_half(size_t offset, const __private half *p);
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
- * Read sizeof (halfn) bytes of data from address
-@@ -11846,13 +11856,13 @@ float3 __ovld vload_half3(size_t offset, const __constant half *p);
- float4 __ovld vload_half4(size_t offset, const __constant half *p);
- float8 __ovld vload_half8(size_t offset, const __constant half *p);
- float16 __ovld vload_half16(size_t offset, const __constant half *p);
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float2 __ovld vload_half2(size_t offset, const half *p);
- float3 __ovld vload_half3(size_t offset, const half *p);
- float4 __ovld vload_half4(size_t offset, const half *p);
- float8 __ovld vload_half8(size_t offset, const half *p);
- float16 __ovld vload_half16(size_t offset, const half *p);
--#else
-+#endif //__opencl_c_generic_address_space
- float2 __ovld vload_half2(size_t offset, const __global half *p);
- float3 __ovld vload_half3(size_t offset, const __global half *p);
- float4 __ovld vload_half4(size_t offset, const __global half *p);
-@@ -11868,7 +11878,6 @@ float3 __ovld vload_half3(size_t offset, const __private half *p);
- float4 __ovld vload_half4(size_t offset, const __private half *p);
- float8 __ovld vload_half8(size_t offset, const __private half *p);
- float16 __ovld vload_half16(size_t offset, const __private half *p);
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
- * The float value given by data is first
-@@ -11881,20 +11890,20 @@ float16 __ovld vload_half16(size_t offset, const __private half *p);
- * The default current rounding mode is round to
- * nearest even.
- */
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- void __ovld vstore_half(float data, size_t offset, half *p);
- void __ovld vstore_half_rte(float data, size_t offset, half *p);
- void __ovld vstore_half_rtz(float data, size_t offset, half *p);
- void __ovld vstore_half_rtp(float data, size_t offset, half *p);
- void __ovld vstore_half_rtn(float data, size_t offset, half *p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld vstore_half(double data, size_t offset, half *p);
- void __ovld vstore_half_rte(double data, size_t offset, half *p);
- void __ovld vstore_half_rtz(double data, size_t offset, half *p);
- void __ovld vstore_half_rtp(double data, size_t offset, half *p);
- void __ovld vstore_half_rtn(double data, size_t offset, half *p);
--#endif //cl_khr_fp64
--#else
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#endif //__opencl_c_generic_address_space
- void __ovld vstore_half(float data, size_t offset, __global half *p);
- void __ovld vstore_half_rte(float data, size_t offset, __global half *p);
- void __ovld vstore_half_rtz(float data, size_t offset, __global half *p);
-@@ -11910,7 +11919,7 @@ void __ovld vstore_half_rte(float data, size_t offset, __private half *p);
- void __ovld vstore_half_rtz(float data, size_t offset, __private half *p);
- void __ovld vstore_half_rtp(float data, size_t offset, __private half *p);
- void __ovld vstore_half_rtn(float data, size_t offset, __private half *p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld vstore_half(double data, size_t offset, __global half *p);
- void __ovld vstore_half_rte(double data, size_t offset, __global half *p);
- void __ovld vstore_half_rtz(double data, size_t offset, __global half *p);
-@@ -11926,8 +11935,7 @@ void __ovld vstore_half_rte(double data, size_t offset, __private half *p);
- void __ovld vstore_half_rtz(double data, size_t offset, __private half *p);
- void __ovld vstore_half_rtp(double data, size_t offset, __private half *p);
- void __ovld vstore_half_rtn(double data, size_t offset, __private half *p);
--#endif //cl_khr_fp64
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- /**
- * The floatn value given by data is converted to
-@@ -11940,7 +11948,7 @@ void __ovld vstore_half_rtn(double data, size_t offset, __private half *p);
- * The default current rounding mode is round to
- * nearest even.
- */
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- void __ovld vstore_half2(float2 data, size_t offset, half *p);
- void __ovld vstore_half3(float3 data, size_t offset, half *p);
- void __ovld vstore_half4(float4 data, size_t offset, half *p);
-@@ -11966,7 +11974,7 @@ void __ovld vstore_half3_rtn(float3 data, size_t offset, half *p);
- void __ovld vstore_half4_rtn(float4 data, size_t offset, half *p);
- void __ovld vstore_half8_rtn(float8 data, size_t offset, half *p);
- void __ovld vstore_half16_rtn(float16 data, size_t offset, half *p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld vstore_half2(double2 data, size_t offset, half *p);
- void __ovld vstore_half3(double3 data, size_t offset, half *p);
- void __ovld vstore_half4(double4 data, size_t offset, half *p);
-@@ -11992,8 +12000,8 @@ void __ovld vstore_half3_rtn(double3 data, size_t offset, half *p);
- void __ovld vstore_half4_rtn(double4 data, size_t offset, half *p);
- void __ovld vstore_half8_rtn(double8 data, size_t offset, half *p);
- void __ovld vstore_half16_rtn(double16 data, size_t offset, half *p);
--#endif //cl_khr_fp64
--#else
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#endif //__opencl_c_generic_address_space
- void __ovld vstore_half2(float2 data, size_t offset, __global half *p);
- void __ovld vstore_half3(float3 data, size_t offset, __global half *p);
- void __ovld vstore_half4(float4 data, size_t offset, __global half *p);
-@@ -12069,7 +12077,7 @@ void __ovld vstore_half3_rtn(float3 data, size_t offset, __private half *p);
- void __ovld vstore_half4_rtn(float4 data, size_t offset, __private half *p);
- void __ovld vstore_half8_rtn(float8 data, size_t offset, __private half *p);
- void __ovld vstore_half16_rtn(float16 data, size_t offset, __private half *p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld vstore_half2(double2 data, size_t offset, __global half *p);
- void __ovld vstore_half3(double3 data, size_t offset, __global half *p);
- void __ovld vstore_half4(double4 data, size_t offset, __global half *p);
-@@ -12145,8 +12153,7 @@ void __ovld vstore_half3_rtn(double3 data, size_t offset, __private half *p);
- void __ovld vstore_half4_rtn(double4 data, size_t offset, __private half *p);
- void __ovld vstore_half8_rtn(double8 data, size_t offset, __private half *p);
- void __ovld vstore_half16_rtn(double16 data, size_t offset, __private half *p);
--#endif //cl_khr_fp64
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- /**
- * For n = 1, 2, 4, 8 and 16 read sizeof (halfn)
-@@ -12167,14 +12174,14 @@ float3 __ovld vloada_half3(size_t offset, const __constant half *p);
- float4 __ovld vloada_half4(size_t offset, const __constant half *p);
- float8 __ovld vloada_half8(size_t offset, const __constant half *p);
- float16 __ovld vloada_half16(size_t offset, const __constant half *p);
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float __ovld vloada_half(size_t offset, const half *p);
- float2 __ovld vloada_half2(size_t offset, const half *p);
- float3 __ovld vloada_half3(size_t offset, const half *p);
- float4 __ovld vloada_half4(size_t offset, const half *p);
- float8 __ovld vloada_half8(size_t offset, const half *p);
- float16 __ovld vloada_half16(size_t offset, const half *p);
--#else
-+#endif //__opencl_c_generic_address_space
- float __ovld vloada_half(size_t offset, const __global half *p);
- float2 __ovld vloada_half2(size_t offset, const __global half *p);
- float3 __ovld vloada_half3(size_t offset, const __global half *p);
-@@ -12193,7 +12200,6 @@ float3 __ovld vloada_half3(size_t offset, const __private half *p);
- float4 __ovld vloada_half4(size_t offset, const __private half *p);
- float8 __ovld vloada_half8(size_t offset, const __private half *p);
- float16 __ovld vloada_half16(size_t offset, const __private half *p);
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
- * The floatn value given by data is converted to
-@@ -12211,7 +12217,7 @@ float16 __ovld vloada_half16(size_t offset, const __private half *p);
- * mode. The default current rounding mode is
- * round to nearest even.
- */
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- void __ovld vstorea_half(float data, size_t offset, half *p);
- void __ovld vstorea_half2(float2 data, size_t offset, half *p);
- void __ovld vstorea_half3(float3 data, size_t offset, half *p);
-@@ -12247,7 +12253,7 @@ void __ovld vstorea_half4_rtn(float4 data, size_t offset, half *p);
- void __ovld vstorea_half8_rtn(float8 data, size_t offset, half *p);
- void __ovld vstorea_half16_rtn(float16 data, size_t offset, half *p);
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld vstorea_half(double data, size_t offset, half *p);
- void __ovld vstorea_half2(double2 data, size_t offset, half *p);
- void __ovld vstorea_half3(double3 data, size_t offset, half *p);
-@@ -12282,9 +12288,9 @@ void __ovld vstorea_half3_rtn(double3 data, size_t offset, half *p);
- void __ovld vstorea_half4_rtn(double4 data, size_t offset, half *p);
- void __ovld vstorea_half8_rtn(double8 data, size_t offset, half *p);
- void __ovld vstorea_half16_rtn(double16 data, size_t offset, half *p);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#endif //__opencl_c_generic_address_space
-
--#else
- void __ovld vstorea_half(float data, size_t offset, __global half *p);
- void __ovld vstorea_half2(float2 data, size_t offset, __global half *p);
- void __ovld vstorea_half3(float3 data, size_t offset, __global half *p);
-@@ -12390,7 +12396,7 @@ void __ovld vstorea_half4_rtn(float4 data, size_t offset, __private half *p);
- void __ovld vstorea_half8_rtn(float8 data, size_t offset, __private half *p);
- void __ovld vstorea_half16_rtn(float16 data, size_t offset, __private half *p);
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld vstorea_half(double data, size_t offset, __global half *p);
- void __ovld vstorea_half2(double2 data, size_t offset, __global half *p);
- void __ovld vstorea_half3(double3 data, size_t offset, __global half *p);
-@@ -12495,8 +12501,7 @@ void __ovld vstorea_half3_rtn(double3 data,size_t offset, __private half *p);
- void __ovld vstorea_half4_rtn(double4 data,size_t offset, __private half *p);
- void __ovld vstorea_half8_rtn(double8 data,size_t offset, __private half *p);
- void __ovld vstorea_half16_rtn(double16 data,size_t offset, __private half *p);
--#endif //cl_khr_fp64
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- // OpenCL v1.1 s6.11.8, v1.2 s6.12.8, v2.0 s6.13.8 - Synchronization Functions
-
-@@ -12580,7 +12585,7 @@ void __ovld write_mem_fence(cl_mem_fence_flags flags);
-
- // OpenCL v2.0 s6.13.9 - Address Space Qualifier Functions
-
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- cl_mem_fence_flags __ovld get_fence(const void *ptr);
- cl_mem_fence_flags __ovld get_fence(void *ptr);
-
-@@ -12591,7 +12596,7 @@ cl_mem_fence_flags __ovld get_fence(void *ptr);
- * where gentype is builtin type or user defined type.
- */
-
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#endif //__opencl_c_generic_address_space
-
- // OpenCL v1.1 s6.11.10, v1.2 s6.12.10, v2.0 s6.13.10 - Async Copies from Global to Local Memory, Local to Global Memory, and Prefetch
-
-@@ -12730,7 +12735,7 @@ event_t __ovld async_work_group_copy(__global uint16 *dst, const __local uint16
- event_t __ovld async_work_group_copy(__global long16 *dst, const __local long16 *src, size_t num_elements, event_t event);
- event_t __ovld async_work_group_copy(__global ulong16 *dst, const __local ulong16 *src, size_t num_elements, event_t event);
- event_t __ovld async_work_group_copy(__global float16 *dst, const __local float16 *src, size_t num_elements, event_t event);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- event_t __ovld async_work_group_copy(__local double *dst, const __global double *src, size_t num_elements, event_t event);
- event_t __ovld async_work_group_copy(__local double2 *dst, const __global double2 *src, size_t num_elements, event_t event);
- event_t __ovld async_work_group_copy(__local double3 *dst, const __global double3 *src, size_t num_elements, event_t event);
-@@ -12743,7 +12748,7 @@ event_t __ovld async_work_group_copy(__global double3 *dst, const __local double
- event_t __ovld async_work_group_copy(__global double4 *dst, const __local double4 *src, size_t num_elements, event_t event);
- event_t __ovld async_work_group_copy(__global double8 *dst, const __local double8 *src, size_t num_elements, event_t event);
- event_t __ovld async_work_group_copy(__global double16 *dst, const __local double16 *src, size_t num_elements, event_t event);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- event_t __ovld async_work_group_copy(__local half *dst, const __global half *src, size_t num_elements, event_t event);
- event_t __ovld async_work_group_copy(__local half2 *dst, const __global half2 *src, size_t num_elements, event_t event);
-@@ -12893,7 +12898,7 @@ event_t __ovld async_work_group_strided_copy(__global uint16 *dst, const __local
- event_t __ovld async_work_group_strided_copy(__global long16 *dst, const __local long16 *src, size_t num_elements, size_t dst_stride, event_t event);
- event_t __ovld async_work_group_strided_copy(__global ulong16 *dst, const __local ulong16 *src, size_t num_elements, size_t dst_stride, event_t event);
- event_t __ovld async_work_group_strided_copy(__global float16 *dst, const __local float16 *src, size_t num_elements, size_t dst_stride, event_t event);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- event_t __ovld async_work_group_strided_copy(__local double *dst, const __global double *src, size_t num_elements, size_t src_stride, event_t event);
- event_t __ovld async_work_group_strided_copy(__local double2 *dst, const __global double2 *src, size_t num_elements, size_t src_stride, event_t event);
- event_t __ovld async_work_group_strided_copy(__local double3 *dst, const __global double3 *src, size_t num_elements, size_t src_stride, event_t event);
-@@ -12906,7 +12911,7 @@ event_t __ovld async_work_group_strided_copy(__global double3 *dst, const __loca
- event_t __ovld async_work_group_strided_copy(__global double4 *dst, const __local double4 *src, size_t num_elements, size_t dst_stride, event_t event);
- event_t __ovld async_work_group_strided_copy(__global double8 *dst, const __local double8 *src, size_t num_elements, size_t dst_stride, event_t event);
- event_t __ovld async_work_group_strided_copy(__global double16 *dst, const __local double16 *src, size_t num_elements, size_t dst_stride, event_t event);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- event_t __ovld async_work_group_strided_copy(__local half *dst, const __global half *src, size_t num_elements, size_t src_stride, event_t event);
- event_t __ovld async_work_group_strided_copy(__local half2 *dst, const __global half2 *src, size_t num_elements, size_t src_stride, event_t event);
-@@ -12996,14 +13001,14 @@ void __ovld prefetch(const __global uint16 *p, size_t num_elements);
- void __ovld prefetch(const __global long16 *p, size_t num_elements);
- void __ovld prefetch(const __global ulong16 *p, size_t num_elements);
- void __ovld prefetch(const __global float16 *p, size_t num_elements);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld prefetch(const __global double *p, size_t num_elements);
- void __ovld prefetch(const __global double2 *p, size_t num_elements);
- void __ovld prefetch(const __global double3 *p, size_t num_elements);
- void __ovld prefetch(const __global double4 *p, size_t num_elements);
- void __ovld prefetch(const __global double8 *p, size_t num_elements);
- void __ovld prefetch(const __global double16 *p, size_t num_elements);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- void __ovld prefetch(const __global half *p, size_t num_elements);
- void __ovld prefetch(const __global half2 *p, size_t num_elements);
-@@ -13026,9 +13031,11 @@ void __ovld prefetch(const __global half16 *p, size_t num_elements);
- * pointed by p. The function returns old.
- */
- int __ovld atomic_add(volatile __global int *p, int val);
--unsigned int __ovld atomic_add(volatile __global unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_add(volatile __global unsigned int *p,
-+ unsigned int val);
- int __ovld atomic_add(volatile __local int *p, int val);
--unsigned int __ovld atomic_add(volatile __local unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_add(volatile __local unsigned int *p,
-+ unsigned int val);
- #ifdef __OPENCL_CPP_VERSION__
- int __ovld atomic_add(volatile int *p, int val);
- unsigned int __ovld atomic_add(volatile unsigned int *p, unsigned int val);
-@@ -13056,9 +13063,11 @@ unsigned long __ovld atom_add(volatile __local unsigned long *p, unsigned long v
- * returns old.
- */
- int __ovld atomic_sub(volatile __global int *p, int val);
--unsigned int __ovld atomic_sub(volatile __global unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_sub(volatile __global unsigned int *p,
-+ unsigned int val);
- int __ovld atomic_sub(volatile __local int *p, int val);
--unsigned int __ovld atomic_sub(volatile __local unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_sub(volatile __local unsigned int *p,
-+ unsigned int val);
- #ifdef __OPENCL_CPP_VERSION__
- int __ovld atomic_sub(volatile int *p, int val);
- unsigned int __ovld atomic_sub(volatile unsigned int *p, unsigned int val);
-@@ -13086,9 +13095,11 @@ unsigned long __ovld atom_sub(volatile __local unsigned long *p, unsigned long v
- * value.
- */
- int __ovld atomic_xchg(volatile __global int *p, int val);
--unsigned int __ovld atomic_xchg(volatile __global unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_xchg(volatile __global unsigned int *p,
-+ unsigned int val);
- int __ovld atomic_xchg(volatile __local int *p, int val);
--unsigned int __ovld atomic_xchg(volatile __local unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_xchg(volatile __local unsigned int *p,
-+ unsigned int val);
- float __ovld atomic_xchg(volatile __global float *p, float val);
- float __ovld atomic_xchg(volatile __local float *p, float val);
- #ifdef __OPENCL_CPP_VERSION__
-@@ -13183,12 +13194,15 @@ unsigned long __ovld atom_dec(volatile __local unsigned long *p);
- * returns old.
- */
- int __ovld atomic_cmpxchg(volatile __global int *p, int cmp, int val);
--unsigned int __ovld atomic_cmpxchg(volatile __global unsigned int *p, unsigned int cmp, unsigned int val);
-+unsigned int __ovld atomic_cmpxchg(volatile __global unsigned int *p,
-+ unsigned int cmp, unsigned int val);
- int __ovld atomic_cmpxchg(volatile __local int *p, int cmp, int val);
--unsigned int __ovld atomic_cmpxchg(volatile __local unsigned int *p, unsigned int cmp, unsigned int val);
-+unsigned int __ovld atomic_cmpxchg(volatile __local unsigned int *p,
-+ unsigned int cmp, unsigned int val);
- #ifdef __OPENCL_CPP_VERSION__
- int __ovld atomic_cmpxchg(volatile int *p, int cmp, int val);
--unsigned int __ovld atomic_cmpxchg(volatile unsigned int *p, unsigned int cmp, unsigned int val);
-+unsigned int __ovld atomic_cmpxchg(volatile unsigned int *p, unsigned int cmp,
-+ unsigned int val);
- #endif
-
- #if defined(cl_khr_global_int32_base_atomics)
-@@ -13215,9 +13229,11 @@ unsigned long __ovld atom_cmpxchg(volatile __local unsigned long *p, unsigned lo
- * returns old.
- */
- int __ovld atomic_min(volatile __global int *p, int val);
--unsigned int __ovld atomic_min(volatile __global unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_min(volatile __global unsigned int *p,
-+ unsigned int val);
- int __ovld atomic_min(volatile __local int *p, int val);
--unsigned int __ovld atomic_min(volatile __local unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_min(volatile __local unsigned int *p,
-+ unsigned int val);
- #ifdef __OPENCL_CPP_VERSION__
- int __ovld atomic_min(volatile int *p, int val);
- unsigned int __ovld atomic_min(volatile unsigned int *p, unsigned int val);
-@@ -13247,9 +13263,11 @@ unsigned long __ovld atom_min(volatile __local unsigned long *p, unsigned long v
- * returns old.
- */
- int __ovld atomic_max(volatile __global int *p, int val);
--unsigned int __ovld atomic_max(volatile __global unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_max(volatile __global unsigned int *p,
-+ unsigned int val);
- int __ovld atomic_max(volatile __local int *p, int val);
--unsigned int __ovld atomic_max(volatile __local unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_max(volatile __local unsigned int *p,
-+ unsigned int val);
- #ifdef __OPENCL_CPP_VERSION__
- int __ovld atomic_max(volatile int *p, int val);
- unsigned int __ovld atomic_max(volatile unsigned int *p, unsigned int val);
-@@ -13278,9 +13296,11 @@ unsigned long __ovld atom_max(volatile __local unsigned long *p, unsigned long v
- * pointed by p. The function returns old.
- */
- int __ovld atomic_and(volatile __global int *p, int val);
--unsigned int __ovld atomic_and(volatile __global unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_and(volatile __global unsigned int *p,
-+ unsigned int val);
- int __ovld atomic_and(volatile __local int *p, int val);
--unsigned int __ovld atomic_and(volatile __local unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_and(volatile __local unsigned int *p,
-+ unsigned int val);
- #ifdef __OPENCL_CPP_VERSION__
- int __ovld atomic_and(volatile int *p, int val);
- unsigned int __ovld atomic_and(volatile unsigned int *p, unsigned int val);
-@@ -13309,9 +13329,11 @@ unsigned long __ovld atom_and(volatile __local unsigned long *p, unsigned long v
- * pointed by p. The function returns old.
- */
- int __ovld atomic_or(volatile __global int *p, int val);
--unsigned int __ovld atomic_or(volatile __global unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_or(volatile __global unsigned int *p,
-+ unsigned int val);
- int __ovld atomic_or(volatile __local int *p, int val);
--unsigned int __ovld atomic_or(volatile __local unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_or(volatile __local unsigned int *p,
-+ unsigned int val);
- #ifdef __OPENCL_CPP_VERSION__
- int __ovld atomic_or(volatile int *p, int val);
- unsigned int __ovld atomic_or(volatile unsigned int *p, unsigned int val);
-@@ -13340,9 +13362,11 @@ unsigned long __ovld atom_or(volatile __local unsigned long *p, unsigned long va
- * pointed by p. The function returns old.
- */
- int __ovld atomic_xor(volatile __global int *p, int val);
--unsigned int __ovld atomic_xor(volatile __global unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_xor(volatile __global unsigned int *p,
-+ unsigned int val);
- int __ovld atomic_xor(volatile __local int *p, int val);
--unsigned int __ovld atomic_xor(volatile __local unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_xor(volatile __local unsigned int *p,
-+ unsigned int val);
- #ifdef __OPENCL_CPP_VERSION__
- int __ovld atomic_xor(volatile int *p, int val);
- unsigned int __ovld atomic_xor(volatile unsigned int *p, unsigned int val);
-@@ -13380,120 +13404,78 @@ unsigned long __ovld atom_xor(volatile __local unsigned long *p, unsigned long v
- #endif
-
- // atomic_init()
-+#ifdef __opencl_c_generic_address_space
- void __ovld atomic_init(volatile atomic_int *object, int value);
- void __ovld atomic_init(volatile atomic_uint *object, uint value);
- void __ovld atomic_init(volatile atomic_float *object, float value);
- #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
- void __ovld atomic_init(volatile atomic_long *object, long value);
- void __ovld atomic_init(volatile atomic_ulong *object, ulong value);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld atomic_init(volatile atomic_double *object, double value);
--#endif //cl_khr_fp64
--#endif
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+void __ovld atomic_init(volatile atomic_int __global *object, int value);
-+void __ovld atomic_init(volatile atomic_int __local *object, int value);
-+void __ovld atomic_init(volatile atomic_uint __global *object, uint value);
-+void __ovld atomic_init(volatile atomic_uint __local *object, uint value);
-+void __ovld atomic_init(volatile atomic_float __global *object, float value);
-+void __ovld atomic_init(volatile atomic_float __local *object, float value);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+void __ovld atomic_init(volatile atomic_long __global *object, long value);
-+void __ovld atomic_init(volatile atomic_long __local *object, long value);
-+void __ovld atomic_init(volatile atomic_ulong __global *object, ulong value);
-+void __ovld atomic_init(volatile atomic_ulong __local *object, ulong value);
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+void __ovld atomic_init(volatile atomic_double __global *object, double value);
-+void __ovld atomic_init(volatile atomic_double __local *object, double value);
-+#endif // cl_khr_fp64
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-
- // atomic_work_item_fence()
--void __ovld atomic_work_item_fence(cl_mem_fence_flags flags, memory_order order, memory_scope scope);
-+void __ovld atomic_work_item_fence(cl_mem_fence_flags flags, memory_order order,
-+ memory_scope scope);
-
- // atomic_fetch()
--
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
-+#ifdef __opencl_c_generic_address_space
- int __ovld atomic_fetch_add(volatile atomic_int *object, int operand);
--int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand, memory_order order);
--int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
- uint __ovld atomic_fetch_add(volatile atomic_uint *object, uint operand);
--uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object, uint operand, memory_order order);
--uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
- int __ovld atomic_fetch_sub(volatile atomic_int *object, int operand);
--int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand, memory_order order);
--int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
- uint __ovld atomic_fetch_sub(volatile atomic_uint *object, uint operand);
--uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object, uint operand, memory_order order);
--uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
- int __ovld atomic_fetch_or(volatile atomic_int *object, int operand);
--int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand, memory_order order);
--int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
- uint __ovld atomic_fetch_or(volatile atomic_uint *object, uint operand);
--uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand, memory_order order);
--uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
- int __ovld atomic_fetch_xor(volatile atomic_int *object, int operand);
--int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand, memory_order order);
--int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
- uint __ovld atomic_fetch_xor(volatile atomic_uint *object, uint operand);
--uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object, uint operand, memory_order order);
--uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
- int __ovld atomic_fetch_and(volatile atomic_int *object, int operand);
--int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand, memory_order order);
--int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
- uint __ovld atomic_fetch_and(volatile atomic_uint *object, uint operand);
--uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object, uint operand, memory_order order);
--uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
- int __ovld atomic_fetch_min(volatile atomic_int *object, int operand);
--int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand, memory_order order);
--int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
- uint __ovld atomic_fetch_min(volatile atomic_uint *object, uint operand);
--uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object, uint operand, memory_order order);
--uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
--uint __ovld atomic_fetch_min(volatile atomic_uint *object, int operand);
--uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object, int operand, memory_order order);
--uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object, int operand, memory_order order, memory_scope scope);
- int __ovld atomic_fetch_max(volatile atomic_int *object, int operand);
--int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand, memory_order order);
--int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
- uint __ovld atomic_fetch_max(volatile atomic_uint *object, uint operand);
--uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object, uint operand, memory_order order);
--uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
--uint __ovld atomic_fetch_max(volatile atomic_uint *object, int operand);
--uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object, int operand, memory_order order);
--uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object, int operand, memory_order order, memory_scope scope);
-
- #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
- long __ovld atomic_fetch_add(volatile atomic_long *object, long operand);
--long __ovld atomic_fetch_add_explicit(volatile atomic_long *object, long operand, memory_order order);
--long __ovld atomic_fetch_add_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
- ulong __ovld atomic_fetch_add(volatile atomic_ulong *object, ulong operand);
--ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
--ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
- long __ovld atomic_fetch_sub(volatile atomic_long *object, long operand);
--long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object, long operand, memory_order order);
--long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
- ulong __ovld atomic_fetch_sub(volatile atomic_ulong *object, ulong operand);
--ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
--ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
- long __ovld atomic_fetch_or(volatile atomic_long *object, long operand);
--long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand, memory_order order);
--long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
- ulong __ovld atomic_fetch_or(volatile atomic_ulong *object, ulong operand);
--ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
--ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
- long __ovld atomic_fetch_xor(volatile atomic_long *object, long operand);
--long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object, long operand, memory_order order);
--long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
- ulong __ovld atomic_fetch_xor(volatile atomic_ulong *object, ulong operand);
--ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
--ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
- long __ovld atomic_fetch_and(volatile atomic_long *object, long operand);
--long __ovld atomic_fetch_and_explicit(volatile atomic_long *object, long operand, memory_order order);
--long __ovld atomic_fetch_and_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
- ulong __ovld atomic_fetch_and(volatile atomic_ulong *object, ulong operand);
--ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
--ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
- long __ovld atomic_fetch_min(volatile atomic_long *object, long operand);
--long __ovld atomic_fetch_min_explicit(volatile atomic_long *object, long operand, memory_order order);
--long __ovld atomic_fetch_min_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
- ulong __ovld atomic_fetch_min(volatile atomic_ulong *object, ulong operand);
--ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
--ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
--ulong __ovld atomic_fetch_min(volatile atomic_ulong *object, long operand);
--ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object, long operand, memory_order order);
--ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object, long operand, memory_order order, memory_scope scope);
- long __ovld atomic_fetch_max(volatile atomic_long *object, long operand);
--long __ovld atomic_fetch_max_explicit(volatile atomic_long *object, long operand, memory_order order);
--long __ovld atomic_fetch_max_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
- ulong __ovld atomic_fetch_max(volatile atomic_ulong *object, ulong operand);
--ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
--ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
--ulong __ovld atomic_fetch_max(volatile atomic_ulong *object, long operand);
--ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, long operand, memory_order order);
--ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, long operand, memory_order order, memory_scope scope);
- #endif //defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-
- // OpenCL v2.0 s6.13.11.7.5:
-@@ -13501,196 +13483,2239 @@ ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, long opera
- // or/xor/and/min/max: atomic type argument can be intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t.
-
- #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
--uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t *object, ptrdiff_t operand);
--uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order);
--uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order, memory_scope scope);
--uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t *object, ptrdiff_t operand);
--uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order);
--uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order, memory_scope scope);
--
--uintptr_t __ovld atomic_fetch_or(volatile atomic_uintptr_t *object, intptr_t operand);
--uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order);
--uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order, memory_scope scope);
--uintptr_t __ovld atomic_fetch_xor(volatile atomic_uintptr_t *object, intptr_t operand);
--uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order);
--uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order, memory_scope scope);
--uintptr_t __ovld atomic_fetch_and(volatile atomic_uintptr_t *object, intptr_t operand);
--uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order);
--uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order, memory_scope scope);
--uintptr_t __ovld atomic_fetch_min(volatile atomic_uintptr_t *object, intptr_t opermax);
--uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder);
--uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder, memory_scope scope);
--uintptr_t __ovld atomic_fetch_max(volatile atomic_uintptr_t *object, intptr_t opermax);
--uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder);
--uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder, memory_scope scope);
--
--intptr_t __ovld atomic_fetch_or(volatile atomic_intptr_t *object, uintptr_t operand);
--intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order);
--intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order, memory_scope scope);
--intptr_t __ovld atomic_fetch_xor(volatile atomic_intptr_t *object, uintptr_t operand);
--intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order);
--intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order, memory_scope scope);
--intptr_t __ovld atomic_fetch_and(volatile atomic_intptr_t *object, uintptr_t operand);
--intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order);
--intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order, memory_scope scope);
--intptr_t __ovld atomic_fetch_min(volatile atomic_intptr_t *object, uintptr_t opermax);
--intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder);
--intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder, memory_scope scope);
--intptr_t __ovld atomic_fetch_max(volatile atomic_intptr_t *object, uintptr_t opermax);
--intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder);
--intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t *object,
-+ ptrdiff_t operand);
-+uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t *object,
-+ ptrdiff_t operand);
-+
-+uintptr_t __ovld atomic_fetch_or(volatile atomic_uintptr_t *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_xor(volatile atomic_uintptr_t *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_and(volatile atomic_uintptr_t *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_min(volatile atomic_uintptr_t *object,
-+ intptr_t opermax);
-+uintptr_t __ovld atomic_fetch_max(volatile atomic_uintptr_t *object,
-+ intptr_t opermax);
-+
-+intptr_t __ovld atomic_fetch_or(volatile atomic_intptr_t *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_xor(volatile atomic_intptr_t *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_and(volatile atomic_intptr_t *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_min(volatile atomic_intptr_t *object,
-+ uintptr_t opermax);
-+intptr_t __ovld atomic_fetch_max(volatile atomic_intptr_t *object,
-+ uintptr_t opermax);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // __opencl_c_generic_address_space
-+
-+#if(__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+int __ovld atomic_fetch_add(volatile atomic_int __global *object, int operand);
-+uint __ovld atomic_fetch_add(volatile atomic_uint __local *object,
-+ uint operand);
-+int __ovld atomic_fetch_sub(volatile atomic_int __global *object, int operand);
-+int __ovld atomic_fetch_sub(volatile atomic_int __local *object, int operand);
-+uint __ovld atomic_fetch_sub(volatile atomic_uint __local *object,
-+ uint operand);
-+uint __ovld atomic_fetch_sub(volatile atomic_uint __global *object,
-+ uint operand);
-+int __ovld atomic_fetch_or(volatile atomic_int __global *object, int operand);
-+uint __ovld atomic_fetch_sub(volatile atomic_uint __local *object,
-+ uint operand);
-+uint __ovld atomic_fetch_or(volatile atomic_uint __global *object,
-+ uint operand);
-+uint __ovld atomic_fetch_or(volatile atomic_uint __local *object, uint operand);
-+int __ovld atomic_fetch_xor(volatile atomic_int __global *object, int operand);
-+int __ovld atomic_fetch_xor(volatile atomic_int __local *object, int operand);
-+uint __ovld atomic_fetch_xor(volatile atomic_uint __global *object,
-+ uint operand);
-+uint __ovld atomic_fetch_xor(volatile atomic_uint __local *object,
-+ uint operand);
-+int __ovld atomic_fetch_and(volatile atomic_int __global *object, int operand);
-+int __ovld atomic_fetch_and(volatile atomic_int __local *object, int operand);
-+uint __ovld atomic_fetch_and(volatile atomic_uint __global *object,
-+ uint operand);
-+uint __ovld atomic_fetch_and(volatile atomic_uint __local *object,
-+ uint operand);
-+int __ovld atomic_fetch_min(volatile atomic_int __global *object, int operand);
-+int __ovld atomic_fetch_min(volatile atomic_int __local *object, int operand);
-+uint __ovld atomic_fetch_min(volatile atomic_uint __global *object,
-+ uint operand);
-+uint __ovld atomic_fetch_min(volatile atomic_uint __local *object,
-+ uint operand);
-+int __ovld atomic_fetch_max(volatile atomic_int __global *object, int operand);
-+int __ovld atomic_fetch_max(volatile atomic_int __local *object, int operand);
-+uint __ovld atomic_fetch_max(volatile atomic_uint __global *object,
-+ uint operand);
-+uint __ovld atomic_fetch_max(volatile atomic_uint __local *object,
-+ uint operand);
-+
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+long __ovld atomic_fetch_add(volatile atomic_long __global *object,
-+ long operand);
-+long __ovld atomic_fetch_add(volatile atomic_long __local *object,
-+ long operand);
-+ulong __ovld atomic_fetch_add(volatile atomic_ulong __global *object,
-+ ulong operand);
-+ulong __ovld atomic_fetch_add(volatile atomic_ulong __local *object,
-+ ulong operand);
-+long __ovld atomic_fetch_sub(volatile atomic_long __global *object,
-+ long operand);
-+long __ovld atomic_fetch_sub(volatile atomic_long __local *object,
-+ long operand);
-+ulong __ovld atomic_fetch_sub(volatile atomic_ulong __global *object,
-+ ulong operand);
-+ulong __ovld atomic_fetch_sub(volatile atomic_ulong __local *object,
-+ ulong operand);
-+long __ovld atomic_fetch_or(volatile atomic_long __global *object,
-+ long operand);
-+long __ovld atomic_fetch_or(volatile atomic_long __local *object, long operand);
-+ulong __ovld atomic_fetch_or(volatile atomic_ulong __global *object,
-+ ulong operand);
-+ulong __ovld atomic_fetch_or(volatile atomic_ulong __local *object,
-+ ulong operand);
-+long __ovld atomic_fetch_xor(volatile atomic_long __global *object,
-+ long operand);
-+long __ovld atomic_fetch_xor(volatile atomic_long __local *object,
-+ long operand);
-+ulong __ovld atomic_fetch_xor(volatile atomic_ulong __global *object,
-+ ulong operand);
-+ulong __ovld atomic_fetch_xor(volatile atomic_ulong __local *object,
-+ ulong operand);
-+long __ovld atomic_fetch_and(volatile atomic_long __global *object,
-+ long operand);
-+long __ovld atomic_fetch_and(volatile atomic_long __local *object,
-+ long operand);
-+ulong __ovld atomic_fetch_and(volatile atomic_ulong __global *object,
-+ ulong operand);
-+ulong __ovld atomic_fetch_and(volatile atomic_ulong __local *object,
-+ ulong operand);
-+long __ovld atomic_fetch_min(volatile atomic_long __global *object,
-+ long operand);
-+long __ovld atomic_fetch_min(volatile atomic_long __local *object,
-+ long operand);
-+ulong __ovld atomic_fetch_min(volatile atomic_ulong __global *object,
-+ ulong operand);
-+ulong __ovld atomic_fetch_min(volatile atomic_ulong __local *object,
-+ ulong operand);
-+long __ovld atomic_fetch_max(volatile atomic_long __global *object,
-+ long operand);
-+long __ovld atomic_fetch_max(volatile atomic_long __local *object,
-+ long operand);
-+ulong __ovld atomic_fetch_max(volatile atomic_ulong __global *object,
-+ ulong operand);
-+ulong __ovld atomic_fetch_max(volatile atomic_ulong __local *object,
-+ ulong operand);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+
-+// OpenCL v2.0 s6.13.11.7.5:
-+// add/sub: atomic type argument can be uintptr_t/intptr_t, value type argument
-+// can be ptrdiff_t. or/xor/and/min/max: atomic type argument can be
-+// intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t.
-+
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t __global *object,
-+ ptrdiff_t operand);
-+uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t __local *object,
-+ ptrdiff_t operand);
-+uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t __global *object,
-+ ptrdiff_t operand);
-+uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t __local *object,
-+ ptrdiff_t operand);
-+
-+uintptr_t __ovld atomic_fetch_or(volatile atomic_uintptr_t __global *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_or(volatile atomic_uintptr_t __local *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_xor(volatile atomic_uintptr_t __global *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_xor(volatile atomic_uintptr_t __local *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_and(volatile atomic_uintptr_t __global *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_and(volatile atomic_uintptr_t __local *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_min(volatile atomic_uintptr_t __global *object,
-+ intptr_t opermax);
-+uintptr_t __ovld atomic_fetch_min(volatile atomic_uintptr_t __local *object,
-+ intptr_t opermax);
-+uintptr_t __ovld atomic_fetch_max(volatile atomic_uintptr_t __global *object,
-+ intptr_t opermax);
-+uintptr_t __ovld atomic_fetch_max(volatile atomic_uintptr_t __local *object,
-+ intptr_t opermax);
-+
-+intptr_t __ovld atomic_fetch_or(volatile atomic_intptr_t __global *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_or(volatile atomic_intptr_t __local *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_xor(volatile atomic_intptr_t __global *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_xor(volatile atomic_intptr_t __local *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_and(volatile atomic_intptr_t __global *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_and(volatile atomic_intptr_t __local *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_min(volatile atomic_intptr_t __global *object,
-+ uintptr_t opermax);
-+intptr_t __ovld atomic_fetch_min(volatile atomic_intptr_t __local *object,
-+ uintptr_t opermax);
-+intptr_t __ovld atomic_fetch_max(volatile atomic_intptr_t __global *object,
-+ uintptr_t opermax);
-+intptr_t __ovld atomic_fetch_max(volatile atomic_intptr_t __local *object,
-+ uintptr_t opermax);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+
-+#ifdef __opencl_c_generic_address_space
-+#ifdef __opencl_c_atomic_scope_device
-+int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand,
-+ memory_order order);
-+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand,
-+ memory_order order);
-+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand,
-+ memory_order order);
-+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand,
-+ memory_order order);
-+int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand,
-+ memory_order order);
-+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand,
-+ memory_order order);
-+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand,
-+ memory_order order);
-+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand,
-+ memory_order order);
-+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand,
-+ memory_order order, memory_scope scope);
-+int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#ifdef __opencl_c_atomic_scope_device
-+long __ovld atomic_fetch_add_explicit(volatile atomic_long *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand,
-+ memory_order order);
-+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_and_explicit(volatile atomic_long *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_min_explicit(volatile atomic_long *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_max_explicit(volatile atomic_long *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+long __ovld atomic_fetch_add_explicit(volatile atomic_long *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand,
-+ memory_order order, memory_scope scope);
-+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_and_explicit(volatile atomic_long *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_min_explicit(volatile atomic_long *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_max_explicit(volatile atomic_long *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+
-+// OpenCL v2.0 s6.13.11.7.5:
-+// add/sub: atomic type argument can be uintptr_t/intptr_t, value type argument
-+// can be ptrdiff_t. or/xor/and/min/max: atomic type argument can be
-+// intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t.
-+
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#ifdef __opencl_c_atomic_scope_device
-+uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object,
-+ ptrdiff_t operand,
-+ memory_order order);
-+uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object,
-+ ptrdiff_t operand,
-+ memory_order order);
-+uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t operand, memory_order order);
-+uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t operand,
-+ memory_order order);
-+uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t operand,
-+ memory_order order);
-+uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t opermax,
-+ memory_order minder);
-+uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t opermax,
-+ memory_order minder);
-+intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t operand, memory_order order);
-+intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t operand,
-+ memory_order order);
-+intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t operand,
-+ memory_order order);
-+intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t opermax,
-+ memory_order minder);
-+intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t opermax,
-+ memory_order minder);
-+#endif // __opencl_c_atomic_scope_device
-+uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object,
-+ ptrdiff_t operand,
-+ memory_order order,
-+ memory_scope scope);
-+uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object,
-+ ptrdiff_t operand,
-+ memory_order order,
-+ memory_scope scope);
-+
-+uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t operand, memory_order order,
-+ memory_scope scope);
-+uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t operand, memory_order order,
-+ memory_scope scope);
-+uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t operand, memory_order order,
-+ memory_scope scope);
-+uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t opermax,
-+ memory_order minder,
-+ memory_scope scope);
-+uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t opermax,
-+ memory_order minder,
-+ memory_scope scope);
-+
-+intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t operand, memory_order order,
-+ memory_scope scope);
-+intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t operand, memory_order order,
-+ memory_scope scope);
-+intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t operand, memory_order order,
-+ memory_scope scope);
-+intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t opermax,
-+ memory_order minder,
-+ memory_scope scope);
-+intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t opermax,
-+ memory_order minder,
-+ memory_scope scope);
- #endif
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#ifdef __opencl_c_atomic_scope_device
-+int __ovld atomic_fetch_add_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order);
-+int __ovld atomic_fetch_add_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order);
-+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order);
-+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_sub_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order);
-+int __ovld atomic_fetch_sub_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order);
-+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order);
-+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_or_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order);
-+int __ovld atomic_fetch_or_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order);
-+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order);
-+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_xor_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order);
-+int __ovld atomic_fetch_xor_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order);
-+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order);
-+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_and_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order);
-+int __ovld atomic_fetch_and_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order);
-+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order);
-+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_min_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order);
-+int __ovld atomic_fetch_min_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order);
-+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order);
-+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_max_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order);
-+int __ovld atomic_fetch_max_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order);
-+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order);
-+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+int __ovld atomic_fetch_add_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_add_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_sub_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_sub_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_or_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_or_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_xor_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_xor_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_and_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_and_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_min_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_min_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_max_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_max_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#ifdef __opencl_c_atomic_scope_device
-+long __ovld atomic_fetch_add_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order);
-+long __ovld atomic_fetch_add_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order);
-+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_sub_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order);
-+long __ovld atomic_fetch_sub_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order);
-+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_or_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order);
-+long __ovld atomic_fetch_or_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order);
-+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_xor_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order);
-+long __ovld atomic_fetch_xor_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order);
-+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_and_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order);
-+long __ovld atomic_fetch_and_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order);
-+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_min_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order);
-+long __ovld atomic_fetch_min_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order);
-+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_max_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order);
-+long __ovld atomic_fetch_max_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order);
-+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+long __ovld atomic_fetch_add_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_add_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_sub_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_sub_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_or_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_or_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_xor_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_xor_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_and_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_and_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_min_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_min_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_max_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_max_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+
-+// OpenCL v2.0 s6.13.11.7.5:
-+// add/sub: atomic type argument can be uintptr_t/intptr_t, value type argument
-+// can be ptrdiff_t. or/xor/and/min/max: atomic type argument can be
-+// intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t.
-+
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#ifdef __opencl_c_atomic_scope_device
-+uintptr_t __ovld
-+atomic_fetch_add_explicit(volatile atomic_uintptr_t __global *object,
-+ ptrdiff_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_add_explicit(volatile atomic_uintptr_t __local *object,
-+ ptrdiff_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_sub_explicit(volatile atomic_uintptr_t __global *object,
-+ ptrdiff_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_sub_explicit(volatile atomic_uintptr_t __local *object,
-+ ptrdiff_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_or_explicit(volatile atomic_uintptr_t __global *object,
-+ intptr_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_or_explicit(volatile atomic_uintptr_t __local *object,
-+ intptr_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_xor_explicit(volatile atomic_uintptr_t __global *object,
-+ intptr_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_xor_explicit(volatile atomic_uintptr_t __local *object,
-+ intptr_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_and_explicit(volatile atomic_uintptr_t __global *object,
-+ intptr_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_and_explicit(volatile atomic_uintptr_t __local *object,
-+ intptr_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_min_explicit(volatile atomic_uintptr_t __global *object,
-+ intptr_t opermax, memory_order minder);
-+uintptr_t __ovld
-+atomic_fetch_min_explicit(volatile atomic_uintptr_t __local *object,
-+ intptr_t opermax, memory_order minder);
-+uintptr_t __ovld
-+atomic_fetch_max_explicit(volatile atomic_uintptr_t __global *object,
-+ intptr_t opermax, memory_order minder);
-+uintptr_t __ovld
-+atomic_fetch_max_explicit(volatile atomic_uintptr_t __local *object,
-+ intptr_t opermax, memory_order minder);
-+intptr_t __ovld
-+atomic_fetch_or_explicit(volatile atomic_intptr_t __global *object,
-+ uintptr_t operand, memory_order order);
-+intptr_t __ovld
-+atomic_fetch_or_explicit(volatile atomic_intptr_t __local *object,
-+ uintptr_t operand, memory_order order);
-+intptr_t __ovld
-+atomic_fetch_xor_explicit(volatile atomic_intptr_t __global *object,
-+ uintptr_t operand, memory_order order);
-+intptr_t __ovld
-+atomic_fetch_xor_explicit(volatile atomic_intptr_t __local *object,
-+ uintptr_t operand, memory_order order);
-+intptr_t __ovld
-+atomic_fetch_and_explicit(volatile atomic_intptr_t __global *object,
-+ uintptr_t operand, memory_order order);
-+intptr_t __ovld
-+atomic_fetch_and_explicit(volatile atomic_intptr_t __local *object,
-+ uintptr_t operand, memory_order order);
-+intptr_t __ovld
-+atomic_fetch_min_explicit(volatile atomic_intptr_t __global *object,
-+ uintptr_t opermax, memory_order minder);
-+intptr_t __ovld
-+atomic_fetch_min_explicit(volatile atomic_intptr_t __local *object,
-+ uintptr_t opermax, memory_order minder);
-+intptr_t __ovld
-+atomic_fetch_max_explicit(volatile atomic_intptr_t __global *object,
-+ uintptr_t opermax, memory_order minder);
-+intptr_t __ovld
-+atomic_fetch_max_explicit(volatile atomic_intptr_t __local *object,
-+ uintptr_t opermax, memory_order minder);
-+#endif // __opencl_c_atomic_scope_device
-+uintptr_t __ovld atomic_fetch_add_explicit(
-+ volatile atomic_uintptr_t __global *object, ptrdiff_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_add_explicit(
-+ volatile atomic_uintptr_t __local *object, ptrdiff_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_sub_explicit(
-+ volatile atomic_uintptr_t __global *object, ptrdiff_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_sub_explicit(
-+ volatile atomic_uintptr_t __local *object, ptrdiff_t operand,
-+ memory_order order, memory_scope scope);
-+
-+uintptr_t __ovld atomic_fetch_or_explicit(
-+ volatile atomic_uintptr_t __global *object, intptr_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_or_explicit(
-+ volatile atomic_uintptr_t __local *object, intptr_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_xor_explicit(
-+ volatile atomic_uintptr_t __global *object, intptr_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_xor_explicit(
-+ volatile atomic_uintptr_t __local *object, intptr_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_and_explicit(
-+ volatile atomic_uintptr_t __global *object, intptr_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_and_explicit(
-+ volatile atomic_uintptr_t __local *object, intptr_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_min_explicit(
-+ volatile atomic_uintptr_t __global *object, intptr_t opermax,
-+ memory_order minder, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_min_explicit(
-+ volatile atomic_uintptr_t __local *object, intptr_t opermax,
-+ memory_order minder, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_max_explicit(
-+ volatile atomic_uintptr_t __global *object, intptr_t opermax,
-+ memory_order minder, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_max_explicit(
-+ volatile atomic_uintptr_t __local *object, intptr_t opermax,
-+ memory_order minder, memory_scope scope);
-+
-+intptr_t __ovld atomic_fetch_or_explicit(
-+ volatile atomic_intptr_t __global *object, uintptr_t operand,
-+ memory_order order, memory_scope scope);
-+intptr_t __ovld atomic_fetch_or_explicit(
-+ volatile atomic_intptr_t __local *object, uintptr_t operand,
-+ memory_order order, memory_scope scope);
-+intptr_t __ovld atomic_fetch_xor_explicit(
-+ volatile atomic_intptr_t __global *object, uintptr_t operand,
-+ memory_order order, memory_scope scope);
-+intptr_t __ovld atomic_fetch_xor_explicit(
-+ volatile atomic_intptr_t __local *object, uintptr_t operand,
-+ memory_order order, memory_scope scope);
-+intptr_t __ovld atomic_fetch_and_explicit(
-+ volatile atomic_intptr_t __global *object, uintptr_t operand,
-+ memory_order order, memory_scope scope);
-+intptr_t __ovld atomic_fetch_and_explicit(
-+ volatile atomic_intptr_t __local *object, uintptr_t operand,
-+ memory_order order, memory_scope scope);
-+intptr_t __ovld atomic_fetch_min_explicit(
-+ volatile atomic_intptr_t __global *object, uintptr_t opermax,
-+ memory_order minder, memory_scope scope);
-+intptr_t __ovld atomic_fetch_min_explicit(
-+ volatile atomic_intptr_t __local *object, uintptr_t opermax,
-+ memory_order minder, memory_scope scope);
-+intptr_t __ovld atomic_fetch_max_explicit(
-+ volatile atomic_intptr_t __global *object, uintptr_t opermax,
-+ memory_order minder, memory_scope scope);
-+intptr_t __ovld atomic_fetch_max_explicit(
-+ volatile atomic_intptr_t __local *object, uintptr_t opermax,
-+ memory_order minder, memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-
- // atomic_store()
-
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
-+
-+#ifdef __opencl_c_generic_address_space
- void __ovld atomic_store(volatile atomic_int *object, int desired);
--void __ovld atomic_store_explicit(volatile atomic_int *object, int desired, memory_order order);
--void __ovld atomic_store_explicit(volatile atomic_int *object, int desired, memory_order order, memory_scope scope);
- void __ovld atomic_store(volatile atomic_uint *object, uint desired);
--void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired, memory_order order);
--void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired, memory_order order, memory_scope scope);
- void __ovld atomic_store(volatile atomic_float *object, float desired);
--void __ovld atomic_store_explicit(volatile atomic_float *object, float desired, memory_order order);
--void __ovld atomic_store_explicit(volatile atomic_float *object, float desired, memory_order order, memory_scope scope);
- #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld atomic_store(volatile atomic_double *object, double desired);
--void __ovld atomic_store_explicit(volatile atomic_double *object, double desired, memory_order order);
--void __ovld atomic_store_explicit(volatile atomic_double *object, double desired, memory_order order, memory_scope scope);
--#endif //cl_khr_fp64
-+#endif
- void __ovld atomic_store(volatile atomic_long *object, long desired);
--void __ovld atomic_store_explicit(volatile atomic_long *object, long desired, memory_order order);
--void __ovld atomic_store_explicit(volatile atomic_long *object, long desired, memory_order order, memory_scope scope);
- void __ovld atomic_store(volatile atomic_ulong *object, ulong desired);
--void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired, memory_order order);
--void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired, memory_order order, memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+void __ovld atomic_store(volatile atomic_int __global *object, int desired);
-+void __ovld atomic_store(volatile atomic_int __local *object, int desired);
-+void __ovld atomic_store(volatile atomic_uint __global *object, uint desired);
-+void __ovld atomic_store(volatile atomic_uint __local *object, uint desired);
-+void __ovld atomic_store(volatile atomic_float __global *object, float desired);
-+void __ovld atomic_store(volatile atomic_float __local *object, float desired);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+void __ovld atomic_store(volatile atomic_double __global *object,
-+ double desired);
-+void __ovld atomic_store(volatile atomic_double __local *object,
-+ double desired);
- #endif
-+void __ovld atomic_store(volatile atomic_long __global *object, long desired);
-+void __ovld atomic_store(volatile atomic_long __local *object, long desired);
-+void __ovld atomic_store(volatile atomic_ulong __global *object, ulong desired);
-+void __ovld atomic_store(volatile atomic_ulong __local *object, ulong desired);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+
-+#ifdef __opencl_c_generic_address_space
-+#ifdef __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_int *object, int desired,
-+ memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired,
-+ memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_float *object, float desired,
-+ memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_int *object, int desired,
-+ memory_order order, memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired,
-+ memory_order order, memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_float *object, float desired,
-+ memory_order order, memory_scope scope);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_double *object,
-+ double desired, memory_order order);
-+#endif //__opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_double *object,
-+ double desired, memory_order order,
-+ memory_scope scope);
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_long *object, long desired,
-+ memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired,
-+ memory_order order);
-+#endif //__opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_long *object, long desired,
-+ memory_order order, memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired,
-+ memory_order order, memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#ifdef __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_int __global *object,
-+ int desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_int __local *object,
-+ int desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_uint __global *object,
-+ uint desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_uint __local *object,
-+ uint desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_float __global *object,
-+ float desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_float __local *object,
-+ float desired, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_int __global *object,
-+ int desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_int __local *object,
-+ int desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_uint __global *object,
-+ uint desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_uint __local *object,
-+ uint desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_float __global *object,
-+ float desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_float __local *object,
-+ float desired, memory_order order,
-+ memory_scope scope);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_double __global *object,
-+ double desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_double __local *object,
-+ double desired, memory_order order);
-+#endif //__opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_double __global *object,
-+ double desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_double __local *object,
-+ double desired, memory_order order,
-+ memory_scope scope);
-+#endif // cl_khr_fp64
-+#ifdef __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_long __global *object,
-+ long desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_long __local *object,
-+ long desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_ulong __global *object,
-+ ulong desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_ulong __local *object,
-+ ulong desired, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_long __global *object,
-+ long desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_long __local *object,
-+ long desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_ulong __global *object,
-+ ulong desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_ulong __local *object,
-+ ulong desired, memory_order order,
-+ memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-
- // atomic_load()
--
-+#ifdef __opencl_c_generic_address_space
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
- int __ovld atomic_load(volatile atomic_int *object);
--int __ovld atomic_load_explicit(volatile atomic_int *object, memory_order order);
--int __ovld atomic_load_explicit(volatile atomic_int *object, memory_order order, memory_scope scope);
- uint __ovld atomic_load(volatile atomic_uint *object);
--uint __ovld atomic_load_explicit(volatile atomic_uint *object, memory_order order);
--uint __ovld atomic_load_explicit(volatile atomic_uint *object, memory_order order, memory_scope scope);
- float __ovld atomic_load(volatile atomic_float *object);
--float __ovld atomic_load_explicit(volatile atomic_float *object, memory_order order);
--float __ovld atomic_load_explicit(volatile atomic_float *object, memory_order order, memory_scope scope);
- #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld atomic_load(volatile atomic_double *object);
--double __ovld atomic_load_explicit(volatile atomic_double *object, memory_order order);
--double __ovld atomic_load_explicit(volatile atomic_double *object, memory_order order, memory_scope scope);
--#endif //cl_khr_fp64
-+#endif // cl_khr_fp64
- long __ovld atomic_load(volatile atomic_long *object);
--long __ovld atomic_load_explicit(volatile atomic_long *object, memory_order order);
--long __ovld atomic_load_explicit(volatile atomic_long *object, memory_order order, memory_scope scope);
- ulong __ovld atomic_load(volatile atomic_ulong *object);
--ulong __ovld atomic_load_explicit(volatile atomic_ulong *object, memory_order order);
--ulong __ovld atomic_load_explicit(volatile atomic_ulong *object, memory_order order, memory_scope scope);
--#endif
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+#endif //__opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
-+int __ovld atomic_load(volatile atomic_int __global *object);
-+int __ovld atomic_load(volatile atomic_int __local *object);
-+uint __ovld atomic_load(volatile atomic_uint __global *object);
-+uint __ovld atomic_load(volatile atomic_uint __local *object);
-+float __ovld atomic_load(volatile atomic_float __global *object);
-+float __ovld atomic_load(volatile atomic_float __local *object);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+double __ovld atomic_load(volatile atomic_double __global *object);
-+double __ovld atomic_load(volatile atomic_double __local *object);
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+long __ovld atomic_load(volatile atomic_long __global *object);
-+long __ovld atomic_load(volatile atomic_long __local *object);
-+ulong __ovld atomic_load(volatile atomic_ulong __global *object);
-+ulong __ovld atomic_load(volatile atomic_ulong __local *object);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+
-+#ifdef __opencl_c_generic_address_space
-+#ifdef __opencl_c_atomic_scope_device
-+int __ovld atomic_load_explicit(volatile atomic_int *object,
-+ memory_order order);
-+uint __ovld atomic_load_explicit(volatile atomic_uint *object,
-+ memory_order order);
-+float __ovld atomic_load_explicit(volatile atomic_float *object,
-+ memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+int __ovld atomic_load_explicit(volatile atomic_int *object, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_load_explicit(volatile atomic_uint *object,
-+ memory_order order, memory_scope scope);
-+float __ovld atomic_load_explicit(volatile atomic_float *object,
-+ memory_order order, memory_scope scope);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+double __ovld atomic_load_explicit(volatile atomic_double *object,
-+ memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+double __ovld atomic_load_explicit(volatile atomic_double *object,
-+ memory_order order, memory_scope scope);
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+long __ovld atomic_load_explicit(volatile atomic_long *object,
-+ memory_order order);
-+ulong __ovld atomic_load_explicit(volatile atomic_ulong *object,
-+ memory_order order);
-+#endif //__opencl_c_atomic_scope_device
-+long __ovld atomic_load_explicit(volatile atomic_long *object,
-+ memory_order order, memory_scope scope);
-+ulong __ovld atomic_load_explicit(volatile atomic_ulong *object,
-+ memory_order order, memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#ifdef __opencl_c_atomic_scope_device
-+int __ovld atomic_load_explicit(volatile atomic_int __global *object,
-+ memory_order order);
-+int __ovld atomic_load_explicit(volatile atomic_int __local *object,
-+ memory_order order);
-+uint __ovld atomic_load_explicit(volatile atomic_uint __global *object,
-+ memory_order order);
-+uint __ovld atomic_load_explicit(volatile atomic_uint __local *object,
-+ memory_order order);
-+float __ovld atomic_load_explicit(volatile atomic_float __global *object,
-+ memory_order order);
-+float __ovld atomic_load_explicit(volatile atomic_float __local *object,
-+ memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+int __ovld atomic_load_explicit(volatile atomic_int __global *object,
-+ memory_order order, memory_scope scope);
-+int __ovld atomic_load_explicit(volatile atomic_int __local *object,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_load_explicit(volatile atomic_uint __global *object,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_load_explicit(volatile atomic_uint __local *object,
-+ memory_order order, memory_scope scope);
-+float __ovld atomic_load_explicit(volatile atomic_float __global *object,
-+ memory_order order, memory_scope scope);
-+float __ovld atomic_load_explicit(volatile atomic_float __local *object,
-+ memory_order order, memory_scope scope);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+double __ovld atomic_load_explicit(volatile atomic_double __global *object,
-+ memory_order order);
-+double __ovld atomic_load_explicit(volatile atomic_double __local *object,
-+ memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+double __ovld atomic_load_explicit(volatile atomic_double __global *object,
-+ memory_order order, memory_scope scope);
-+double __ovld atomic_load_explicit(volatile atomic_double __local *object,
-+ memory_order order, memory_scope scope);
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+long __ovld atomic_load_explicit(volatile atomic_long __global *object,
-+ memory_order order);
-+long __ovld atomic_load_explicit(volatile atomic_long __local *object,
-+ memory_order order);
-+ulong __ovld atomic_load_explicit(volatile atomic_ulong __global *object,
-+ memory_order order);
-+ulong __ovld atomic_load_explicit(volatile atomic_ulong __local *object,
-+ memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+long __ovld atomic_load_explicit(volatile atomic_long __global *object,
-+ memory_order order, memory_scope scope);
-+long __ovld atomic_load_explicit(volatile atomic_long __local *object,
-+ memory_order order, memory_scope scope);
-+ulong __ovld atomic_load_explicit(volatile atomic_ulong __global *object,
-+ memory_order order, memory_scope scope);
-+ulong __ovld atomic_load_explicit(volatile atomic_ulong __local *object,
-+ memory_order order, memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-
- // atomic_exchange()
--
-+#ifdef __opencl_c_generic_address_space
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
- int __ovld atomic_exchange(volatile atomic_int *object, int desired);
--int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired, memory_order order);
--int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired, memory_order order, memory_scope scope);
- uint __ovld atomic_exchange(volatile atomic_uint *object, uint desired);
--uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired, memory_order order);
--uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired, memory_order order, memory_scope scope);
- float __ovld atomic_exchange(volatile atomic_float *object, float desired);
--float __ovld atomic_exchange_explicit(volatile atomic_float *object, float desired, memory_order order);
--float __ovld atomic_exchange_explicit(volatile atomic_float *object, float desired, memory_order order, memory_scope scope);
- #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld atomic_exchange(volatile atomic_double *object, double desired);
--double __ovld atomic_exchange_explicit(volatile atomic_double *object, double desired, memory_order order);
--double __ovld atomic_exchange_explicit(volatile atomic_double *object, double desired, memory_order order, memory_scope scope);
--#endif //cl_khr_fp64
-+#endif
- long __ovld atomic_exchange(volatile atomic_long *object, long desired);
--long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired, memory_order order);
--long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired, memory_order order, memory_scope scope);
- ulong __ovld atomic_exchange(volatile atomic_ulong *object, ulong desired);
--ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object, ulong desired, memory_order order);
--ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object, ulong desired, memory_order order, memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
-+int __ovld atomic_exchange(volatile atomic_int __global *object, int desired);
-+int __ovld atomic_exchange(volatile atomic_int __local *object, int desired);
-+uint __ovld atomic_exchange(volatile atomic_uint __global *object,
-+ uint desired);
-+uint __ovld atomic_exchange(volatile atomic_uint __local *object, uint desired);
-+float __ovld atomic_exchange(volatile atomic_float __global *object,
-+ float desired);
-+float __ovld atomic_exchange(volatile atomic_float __local *object,
-+ float desired);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+double __ovld atomic_exchange(volatile atomic_double __global *object,
-+ double desired);
-+double __ovld atomic_exchange(volatile atomic_double __local *object,
-+ double desired);
- #endif
-+long __ovld atomic_exchange(volatile atomic_long __global *object,
-+ long desired);
-+long __ovld atomic_exchange(volatile atomic_long __local *object, long desired);
-+ulong __ovld atomic_exchange(volatile atomic_ulong __global *object,
-+ ulong desired);
-+ulong __ovld atomic_exchange(volatile atomic_ulong __local *object,
-+ ulong desired);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+
-+#ifdef __opencl_c_generic_address_space
-+#ifdef __opencl_c_atomic_scope_device
-+int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired,
-+ memory_order order);
-+uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired,
-+ memory_order order);
-+float __ovld atomic_exchange_explicit(volatile atomic_float *object,
-+ float desired, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired,
-+ memory_order order, memory_scope scope);
-+float __ovld atomic_exchange_explicit(volatile atomic_float *object,
-+ float desired, memory_order order,
-+ memory_scope scope);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+double __ovld atomic_exchange_explicit(volatile atomic_double *object,
-+ double desired, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+double __ovld atomic_exchange_explicit(volatile atomic_double *object,
-+ double desired, memory_order order,
-+ memory_scope scope);
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired,
-+ memory_order order);
-+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object,
-+ ulong desired, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired,
-+ memory_order order, memory_scope scope);
-+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object,
-+ ulong desired, memory_order order,
-+ memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#ifdef __opencl_c_atomic_scope_device
-+int __ovld atomic_exchange_explicit(volatile atomic_int __global *object,
-+ int desired, memory_order order);
-+int __ovld atomic_exchange_explicit(volatile atomic_int __local *object,
-+ int desired, memory_order order);
-+uint __ovld atomic_exchange_explicit(volatile atomic_uint __global *object,
-+ uint desired, memory_order order);
-+uint __ovld atomic_exchange_explicit(volatile atomic_uint __local *object,
-+ uint desired, memory_order order);
-+float __ovld atomic_exchange_explicit(volatile atomic_float __global *object,
-+ float desired, memory_order order);
-+float __ovld atomic_exchange_explicit(volatile atomic_float __local *object,
-+ float desired, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+int __ovld atomic_exchange_explicit(volatile atomic_int __global *object,
-+ int desired, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_exchange_explicit(volatile atomic_int __local *object,
-+ int desired, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_exchange_explicit(volatile atomic_uint __global *object,
-+ uint desired, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_exchange_explicit(volatile atomic_uint __local *object,
-+ uint desired, memory_order order,
-+ memory_scope scope);
-+float __ovld atomic_exchange_explicit(volatile atomic_float __global *object,
-+ float desired, memory_order order,
-+ memory_scope scope);
-+float __ovld atomic_exchange_explicit(volatile atomic_float __local *object,
-+ float desired, memory_order order,
-+ memory_scope scope);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+double __ovld atomic_exchange_explicit(volatile atomic_double __global *object,
-+ double desired, memory_order order);
-+double __ovld atomic_exchange_explicit(volatile atomic_double __local *object,
-+ double desired, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+double __ovld atomic_exchange_explicit(volatile atomic_double __global *object,
-+ double desired, memory_order order,
-+ memory_scope scope);
-+double __ovld atomic_exchange_explicit(volatile atomic_double __local *object,
-+ double desired, memory_order order,
-+ memory_scope scope);
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+long __ovld atomic_exchange_explicit(volatile atomic_long __global *object,
-+ long desired, memory_order order);
-+long __ovld atomic_exchange_explicit(volatile atomic_long __local *object,
-+ long desired, memory_order order);
-+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong __global *object,
-+ ulong desired, memory_order order);
-+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong __local *object,
-+ ulong desired, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+long __ovld atomic_exchange_explicit(volatile atomic_long __global *object,
-+ long desired, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_exchange_explicit(volatile atomic_long __local *object,
-+ long desired, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong __global *object,
-+ ulong desired, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong __local *object,
-+ ulong desired, memory_order order,
-+ memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-
- // atomic_compare_exchange_strong() and atomic_compare_exchange_weak()
--
--bool __ovld atomic_compare_exchange_strong(volatile atomic_int *object, int *expected, int desired);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object, int *expected,
-- int desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object, int *expected,
-- int desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_strong(volatile atomic_uint *object, uint *expected, uint desired);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_uint *object, uint *expected,
-- uint desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_uint *object, uint *expected,
-- uint desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_weak(volatile atomic_int *object, int *expected, int desired);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object, int *expected,
-- int desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object, int *expected,
-- int desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_weak(volatile atomic_uint *object, uint *expected, uint desired);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object, uint *expected,
-- uint desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object, uint *expected,
-- uint desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_strong(volatile atomic_float *object, float *expected, float desired);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_float *object, float *expected,
-- float desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_float *object, float *expected,
-- float desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_weak(volatile atomic_float *object, float *expected, float desired);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_float *object, float *expected,
-- float desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_float *object, float *expected,
-- float desired, memory_order success, memory_order failure, memory_scope scope);
-+#ifdef __opencl_c_generic_address_space
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_int *object,
-+ int *expected, int desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_uint *object,
-+ uint *expected, uint desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_int *object,
-+ int *expected, int desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint *object,
-+ uint *expected, uint desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_float *object,
-+ float *expected, float desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_float *object,
-+ float *expected, float desired);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_double *object,
-+ double *expected, double desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_double *object,
-+ double *expected, double desired);
-+#endif
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_long *object,
-+ long *expected, long desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_long *object,
-+ long *expected, long desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_ulong *object,
-+ ulong *expected, ulong desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong *object,
-+ ulong *expected, ulong desired);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __global *object,
-+ int __global *expected, int desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __local *object,
-+ int __global *expected, int desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __global *object,
-+ int __local *expected, int desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __local *object,
-+ int __local *expected, int desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __global *object,
-+ int __private *expected,
-+ int desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __local *object,
-+ int __private *expected,
-+ int desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_uint __global *object,
-+ uint __global *expected, uint desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_uint __local *object,
-+ uint __global *expected,
-+ uint desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_uint __global *object,
-+ uint __local *expected, uint desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_uint __local *object,
-+ uint __local *expected,
-+ uint desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_uint __global *object,
-+ uint __private *expected, uint desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_uint __local *object,
-+ uint __private *expected,
-+ uint desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __global *object,
-+ int __global *expected, int desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __local *object,
-+ int __global *expected, int desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __global *object,
-+ int __local *expected, int desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __local *object,
-+ int __local *expected, int desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __global *object,
-+ int __private *expected, int desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __local *object,
-+ int __private *expected, int desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __global *object,
-+ uint __global *expected, uint desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __local *object,
-+ uint __global *expected, uint desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __global *object,
-+ uint __local *expected, uint desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __local *object,
-+ uint __local *expected, uint desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __global *object,
-+ uint __private *expected,
-+ uint desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __local *object,
-+ uint __private *expected,
-+ uint desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_float __global *object,
-+ float __global *expected, float desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_float __local *object,
-+ float __global *expected, float desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_float __global *object,
-+ float __local *expected, float desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_float __local *object,
-+ float __local *expected, float desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_float __global *object,
-+ float __private *expected, float desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_float __local *object,
-+ float __private *expected, float desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __global *object,
-+ float __global *expected,
-+ float desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __local *object,
-+ float __global *expected,
-+ float desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __global *object,
-+ float __local *expected,
-+ float desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __local *object,
-+ float __local *expected,
-+ float desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __global *object,
-+ float __private *expected,
-+ float desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __local *object,
-+ float __private *expected,
-+ float desired);
- #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
--#ifdef cl_khr_fp64
--bool __ovld atomic_compare_exchange_strong(volatile atomic_double *object, double *expected, double desired);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_double *object, double *expected,
-- double desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_double *object, double *expected,
-- double desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_weak(volatile atomic_double *object, double *expected, double desired);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_double *object, double *expected,
-- double desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_double *object, double *expected,
-- double desired, memory_order success, memory_order failure, memory_scope scope);
--#endif //cl_khr_fp64
--bool __ovld atomic_compare_exchange_strong(volatile atomic_long *object, long *expected, long desired);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_long *object, long *expected,
-- long desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_long *object, long *expected,
-- long desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_weak(volatile atomic_long *object, long *expected, long desired);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object, long *expected,
-- long desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object, long *expected,
-- long desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_strong(volatile atomic_ulong *object, ulong *expected, ulong desired);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_ulong *object, ulong *expected,
-- ulong desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_ulong *object, ulong *expected,
-- ulong desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong *object, ulong *expected, ulong desired);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_ulong *object, ulong *expected,
-- ulong desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_ulong *object, ulong *expected,
-- ulong desired, memory_order success, memory_order failure, memory_scope scope);
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_double __global *object,
-+ double __global *expected, double desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_double __local *object,
-+ double __global *expected, double desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_double __global *object,
-+ double __local *expected, double desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_double __local *object,
-+ double __local *expected, double desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_double __global *object,
-+ double __private *expected, double desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_double __local *object,
-+ double __private *expected, double desired);
-+bool __ovld
-+atomic_compare_exchange_weak(volatile atomic_double __global *object,
-+ double __global *expected, double desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_double __local *object,
-+ double __global *expected,
-+ double desired);
-+bool __ovld
-+atomic_compare_exchange_weak(volatile atomic_double __global *object,
-+ double __local *expected, double desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_double __local *object,
-+ double __local *expected,
-+ double desired);
-+bool __ovld
-+atomic_compare_exchange_weak(volatile atomic_double __global *object,
-+ double __private *expected, double desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_double __local *object,
-+ double __private *expected,
-+ double desired);
- #endif
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_long __global *object,
-+ long __global *expected, long desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_long __local *object,
-+ long __global *expected,
-+ long desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_long __global *object,
-+ long __local *expected, long desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_long __local *object,
-+ long __local *expected,
-+ long desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_long __global *object,
-+ long __private *expected, long desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_long __local *object,
-+ long __private *expected,
-+ long desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __global *object,
-+ long __global *expected, long desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __local *object,
-+ long __global *expected, long desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __global *object,
-+ long __local *expected, long desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __local *object,
-+ long __local *expected, long desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __global *object,
-+ long __private *expected,
-+ long desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __local *object,
-+ long __private *expected,
-+ long desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_ulong __global *object,
-+ ulong __global *expected, ulong desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_ulong __local *object,
-+ ulong __global *expected, ulong desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_ulong __global *object,
-+ ulong __local *expected, ulong desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_ulong __local *object,
-+ ulong __local *expected, ulong desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_ulong __global *object,
-+ ulong __private *expected, ulong desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_ulong __local *object,
-+ ulong __private *expected, ulong desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __global *object,
-+ ulong __global *expected,
-+ ulong desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __local *object,
-+ ulong __global *expected,
-+ ulong desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __global *object,
-+ ulong __local *expected,
-+ ulong desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __local *object,
-+ ulong __local *expected,
-+ ulong desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __global *object,
-+ ulong __private *expected,
-+ ulong desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __local *object,
-+ ulong __private *expected,
-+ ulong desired);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+
-+#ifdef __opencl_c_generic_address_space
-+#ifdef __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object,
-+ int *expected, int desired,
-+ memory_order success,
-+ memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint *object, uint *expected, uint desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object,
-+ int *expected, int desired,
-+ memory_order success,
-+ memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object,
-+ uint *expected, uint desired,
-+ memory_order success,
-+ memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float *object, float *expected, float desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_float *object,
-+ float *expected,
-+ float desired,
-+ memory_order success,
-+ memory_order failure);
-+#endif // __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object,
-+ int *expected, int desired,
-+ memory_order success,
-+ memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint *object, uint *expected, uint desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object,
-+ int *expected, int desired,
-+ memory_order success,
-+ memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object,
-+ uint *expected, uint desired,
-+ memory_order success,
-+ memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float *object, float *expected, float desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float *object, float *expected, float desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double *object, double *expected, double desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double *object, double *expected, double desired,
-+ memory_order success, memory_order failure);
-+#endif // __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double *object, double *expected, double desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double *object, double *expected, double desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long *object, long *expected, long desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object,
-+ long *expected, long desired,
-+ memory_order success,
-+ memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong *object, ulong *expected, ulong desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_ulong *object,
-+ ulong *expected,
-+ ulong desired,
-+ memory_order success,
-+ memory_order failure);
-+#endif // __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long *object, long *expected, long desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object,
-+ long *expected, long desired,
-+ memory_order success,
-+ memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong *object, ulong *expected, ulong desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong *object, ulong *expected, ulong desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#ifdef __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __global *object, int __global *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __local *object, int __global *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __global *object, int __local *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __local *object, int __local *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __global *object, int __private *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __local *object, int __private *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __global *object, uint __global *expected,
-+ uint desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __local *object, uint __global *expected, uint desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __global *object, uint __local *expected, uint desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __local *object, uint __local *expected, uint desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __global *object, uint __private *expected,
-+ uint desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __local *object, uint __private *expected,
-+ uint desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __global *object, int __global *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __local *object, int __global *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __global *object, int __local *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __local *object, int __local *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __global *object, int __private *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __local *object, int __private *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __global *object, uint __global *expected,
-+ uint desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __local *object, uint __global *expected, uint desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __global *object, uint __local *expected, uint desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __local *object, uint __local *expected, uint desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __global *object, uint __private *expected,
-+ uint desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __local *object, uint __private *expected,
-+ uint desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __global *object, float __global *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __local *object, float __global *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __global *object, float __local *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __local *object, float __local *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __global *object, float __private *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __local *object, float __private *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __global *object, float __global *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __local *object, float __global *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __global *object, float __local *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __local *object, float __local *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __global *object, float __private *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __local *object, float __private *expected,
-+ float desired, memory_order success, memory_order failure);
-+#endif // __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __global *object, int __global *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __local *object, int __global *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __global *object, int __local *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __local *object, int __local *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __global *object, int __private *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __local *object, int __private *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __global *object, uint __global *expected,
-+ uint desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __local *object, uint __global *expected, uint desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __global *object, uint __local *expected, uint desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __local *object, uint __local *expected, uint desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __global *object, uint __private *expected,
-+ uint desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __local *object, uint __private *expected,
-+ uint desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __global *object, int __global *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __local *object, int __global *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __global *object, int __local *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __local *object, int __local *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __global *object, int __private *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __local *object, int __private *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __global *object, uint __global *expected,
-+ uint desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __local *object, uint __global *expected, uint desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __global *object, uint __local *expected, uint desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __local *object, uint __local *expected, uint desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __global *object, uint __private *expected,
-+ uint desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __local *object, uint __private *expected,
-+ uint desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __global *object, float __global *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __local *object, float __global *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __global *object, float __local *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __local *object, float __local *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __global *object, float __private *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __local *object, float __private *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __global *object, float __global *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __local *object, float __global *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __global *object, float __local *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __local *object, float __local *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __global *object, float __private *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __local *object, float __private *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __global *object, double __global *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __local *object, double __global *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __global *object, double __local *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __local *object, double __local *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __global *object, double __private *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __local *object, double __private *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __global *object, double __global *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __local *object, double __global *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __global *object, double __local *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __local *object, double __local *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __global *object, double __private *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __local *object, double __private *expected,
-+ double desired, memory_order success, memory_order failure);
-+#endif // __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __global *object, double __global *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __local *object, double __global *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __global *object, double __local *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __local *object, double __local *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __global *object, double __private *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __local *object, double __private *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __global *object, double __global *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __local *object, double __global *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __global *object, double __local *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __local *object, double __local *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __global *object, double __private *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __local *object, double __private *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __global *object, long __global *expected,
-+ long desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __local *object, long __global *expected, long desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __global *object, long __local *expected, long desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __local *object, long __local *expected, long desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __global *object, long __private *expected,
-+ long desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __local *object, long __private *expected,
-+ long desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __global *object, long __global *expected,
-+ long desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __local *object, long __global *expected, long desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __global *object, long __local *expected, long desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __local *object, long __local *expected, long desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __global *object, long __private *expected,
-+ long desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __local *object, long __private *expected,
-+ long desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __global *object, ulong __global *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __local *object, ulong __global *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __global *object, ulong __local *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __local *object, ulong __local *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __global *object, ulong __private *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __local *object, ulong __private *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __global *object, ulong __global *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __local *object, ulong __global *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __global *object, ulong __local *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __local *object, ulong __local *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __global *object, ulong __private *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __local *object, ulong __private *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+#endif // __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __global *object, long __global *expected,
-+ long desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __local *object, long __global *expected, long desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __global *object, long __local *expected, long desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __local *object, long __local *expected, long desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __global *object, long __private *expected,
-+ long desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __local *object, long __private *expected,
-+ long desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __global *object, long __global *expected,
-+ long desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __local *object, long __global *expected, long desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __global *object, long __local *expected, long desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __local *object, long __local *expected, long desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __global *object, long __private *expected,
-+ long desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __local *object, long __private *expected,
-+ long desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __global *object, ulong __global *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __local *object, ulong __global *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __global *object, ulong __local *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __local *object, ulong __local *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __global *object, ulong __private *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __local *object, ulong __private *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __global *object, ulong __global *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __local *object, ulong __global *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __global *object, ulong __local *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __local *object, ulong __local *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __global *object, ulong __private *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __local *object, ulong __private *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-
- // atomic_flag_test_and_set() and atomic_flag_clear()
--
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
-+#ifdef __opencl_c_generic_address_space
- bool __ovld atomic_flag_test_and_set(volatile atomic_flag *object);
--bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object, memory_order order);
--bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object, memory_order order, memory_scope scope);
- void __ovld atomic_flag_clear(volatile atomic_flag *object);
--void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object, memory_order order);
--void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object, memory_order order, memory_scope scope);
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+bool __ovld atomic_flag_test_and_set(volatile atomic_flag __global *object);
-+bool __ovld atomic_flag_test_and_set(volatile atomic_flag __local *object);
-+void __ovld atomic_flag_clear(volatile atomic_flag __global *object);
-+void __ovld atomic_flag_clear(volatile atomic_flag __local *object);
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+
-+#ifdef __opencl_c_generic_address_space
-+#ifdef __opencl_c_atomic_scope_device
-+bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object,
-+ memory_order order);
-+void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object,
-+ memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object,
-+ memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object,
-+ memory_order order, memory_scope scope);
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#ifdef __opencl_c_atomic_scope_device
-+bool __ovld atomic_flag_test_and_set_explicit(
-+ volatile atomic_flag __global *object, memory_order order);
-+bool __ovld atomic_flag_test_and_set_explicit(
-+ volatile atomic_flag __local *object, memory_order order);
-+void __ovld atomic_flag_clear_explicit(volatile atomic_flag __global *object,
-+ memory_order order);
-+void __ovld atomic_flag_clear_explicit(volatile atomic_flag __local *object,
-+ memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+bool __ovld
-+atomic_flag_test_and_set_explicit(volatile atomic_flag __global *object,
-+ memory_order order, memory_scope scope);
-+bool __ovld
-+atomic_flag_test_and_set_explicit(volatile atomic_flag __local *object,
-+ memory_order order, memory_scope scope);
-+void __ovld atomic_flag_clear_explicit(volatile atomic_flag __global *object,
-+ memory_order order, memory_scope scope);
-+void __ovld atomic_flag_clear_explicit(volatile atomic_flag __local *object,
-+ memory_order order, memory_scope scope);
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
-@@ -13918,7 +15943,7 @@ float16 __ovld __cnfn shuffle(float4 x, uint16 mask);
- float16 __ovld __cnfn shuffle(float8 x, uint16 mask);
- float16 __ovld __cnfn shuffle(float16 x, uint16 mask);
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double2 __ovld __cnfn shuffle(double2 x, ulong2 mask);
- double2 __ovld __cnfn shuffle(double4 x, ulong2 mask);
- double2 __ovld __cnfn shuffle(double8 x, ulong2 mask);
-@@ -13938,7 +15963,7 @@ double16 __ovld __cnfn shuffle(double2 x, ulong16 mask);
- double16 __ovld __cnfn shuffle(double4 x, ulong16 mask);
- double16 __ovld __cnfn shuffle(double8 x, ulong16 mask);
- double16 __ovld __cnfn shuffle(double16 x, ulong16 mask);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #ifdef cl_khr_fp16
- half2 __ovld __cnfn shuffle(half2 x, ushort2 mask);
-@@ -14142,7 +16167,7 @@ float16 __ovld __cnfn shuffle2(float4 x, float4 y, uint16 mask);
- float16 __ovld __cnfn shuffle2(float8 x, float8 y, uint16 mask);
- float16 __ovld __cnfn shuffle2(float16 x, float16 y, uint16 mask);
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double2 __ovld __cnfn shuffle2(double2 x, double2 y, ulong2 mask);
- double2 __ovld __cnfn shuffle2(double4 x, double4 y, ulong2 mask);
- double2 __ovld __cnfn shuffle2(double8 x, double8 y, ulong2 mask);
-@@ -14162,7 +16187,7 @@ double16 __ovld __cnfn shuffle2(double2 x, double2 y, ulong16 mask);
- double16 __ovld __cnfn shuffle2(double4 x, double4 y, ulong16 mask);
- double16 __ovld __cnfn shuffle2(double8 x, double8 y, ulong16 mask);
- double16 __ovld __cnfn shuffle2(double16 x, double16 y, ulong16 mask);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #ifdef cl_khr_fp16
- half2 __ovld __cnfn shuffle2(half2 x, half2 y, ushort2 mask);
-@@ -14198,6 +16223,7 @@ int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2)))
- #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable
- #endif //cl_khr_gl_msaa_sharing
-
-+#ifdef __opencl_c_images
- /**
- * Use the coordinate (coord.xy) to do an element lookup in
- * the 2D image object specified by image.
-@@ -14476,6 +16502,7 @@ half4 __purefn __ovld read_imageh(read_only image1d_buffer_t image, int coord);
-
- // Image read functions for read_write images
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- float4 __purefn __ovld read_imagef(read_write image1d_t image, int coord);
- int4 __purefn __ovld read_imagei(read_write image1d_t image, int coord);
- uint4 __purefn __ovld read_imageui(read_write image1d_t image, int coord);
-@@ -14519,6 +16546,7 @@ float __purefn __ovld read_imagef(read_write image2d_array_msaa_depth_t image, i
- #endif //cl_khr_gl_msaa_sharing
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- #ifdef cl_khr_mipmap_image
- float4 __purefn __ovld read_imagef(read_write image1d_t image, sampler_t sampler, float coord, float lod);
- int4 __purefn __ovld read_imagei(read_write image1d_t image, sampler_t sampler, float coord, float lod);
-@@ -14569,6 +16597,7 @@ int4 __purefn __ovld read_imagei(read_write image3d_t image, sampler_t sampler,
- uint4 __purefn __ovld read_imageui(read_write image3d_t image, sampler_t sampler, float4 coord, float4 gradientX, float4 gradientY);
-
- #endif //cl_khr_mipmap_image
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- // Image read functions returning half4 type
-@@ -14580,6 +16609,7 @@ half4 __purefn __ovld read_imageh(read_write image1d_array_t image, int2 coord);
- half4 __purefn __ovld read_imageh(read_write image2d_array_t image, int4 coord);
- half4 __purefn __ovld read_imageh(read_write image1d_buffer_t image, int coord);
- #endif //cl_khr_fp16
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
-@@ -14669,7 +16699,7 @@ void __ovld write_imagef(write_only image1d_array_t image_array, int2 coord, flo
- void __ovld write_imagei(write_only image1d_array_t image_array, int2 coord, int4 color);
- void __ovld write_imageui(write_only image1d_array_t image_array, int2 coord, uint4 color);
-
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- void __ovld write_imagef(write_only image3d_t image, int4 coord, float4 color);
- void __ovld write_imagei(write_only image3d_t image, int4 coord, int4 color);
- void __ovld write_imageui(write_only image3d_t image, int4 coord, uint4 color);
-@@ -14702,7 +16732,7 @@ void __ovld write_imageui(write_only image2d_array_t image_array, int4 coord, in
- void __ovld write_imagef(write_only image2d_depth_t image, int2 coord, int lod, float depth);
- void __ovld write_imagef(write_only image2d_array_depth_t image, int4 coord, int lod, float depth);
-
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- void __ovld write_imagef(write_only image3d_t image, int4 coord, int lod, float4 color);
- void __ovld write_imagei(write_only image3d_t image, int4 coord, int lod, int4 color);
- void __ovld write_imageui(write_only image3d_t image, int4 coord, int lod, uint4 color);
-@@ -14715,7 +16745,7 @@ void __ovld write_imageui(write_only image3d_t image, int4 coord, int lod, uint4
- #ifdef cl_khr_fp16
- void __ovld write_imageh(write_only image1d_t image, int coord, half4 color);
- void __ovld write_imageh(write_only image2d_t image, int2 coord, half4 color);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- void __ovld write_imageh(write_only image3d_t image, int4 coord, half4 color);
- #endif
- void __ovld write_imageh(write_only image1d_array_t image, int2 coord, half4 color);
-@@ -14725,6 +16755,7 @@ void __ovld write_imageh(write_only image1d_buffer_t image, int coord, half4 col
-
- // Image write functions for read_write images
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- void __ovld write_imagef(read_write image2d_t image, int2 coord, float4 color);
- void __ovld write_imagei(read_write image2d_t image, int2 coord, int4 color);
- void __ovld write_imageui(read_write image2d_t image, int2 coord, uint4 color);
-@@ -14745,7 +16776,7 @@ void __ovld write_imagef(read_write image1d_array_t image_array, int2 coord, flo
- void __ovld write_imagei(read_write image1d_array_t image_array, int2 coord, int4 color);
- void __ovld write_imageui(read_write image1d_array_t image_array, int2 coord, uint4 color);
-
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- void __ovld write_imagef(read_write image3d_t image, int4 coord, float4 color);
- void __ovld write_imagei(read_write image3d_t image, int4 coord, int4 color);
- void __ovld write_imageui(read_write image3d_t image, int4 coord, uint4 color);
-@@ -14777,7 +16808,7 @@ void __ovld write_imageui(read_write image2d_array_t image_array, int4 coord, in
- void __ovld write_imagef(read_write image2d_depth_t image, int2 coord, int lod, float color);
- void __ovld write_imagef(read_write image2d_array_depth_t image, int4 coord, int lod, float color);
-
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- void __ovld write_imagef(read_write image3d_t image, int4 coord, int lod, float4 color);
- void __ovld write_imagei(read_write image3d_t image, int4 coord, int lod, int4 color);
- void __ovld write_imageui(read_write image3d_t image, int4 coord, int lod, uint4 color);
-@@ -14790,13 +16821,14 @@ void __ovld write_imageui(read_write image3d_t image, int4 coord, int lod, uint4
- #ifdef cl_khr_fp16
- void __ovld write_imageh(read_write image1d_t image, int coord, half4 color);
- void __ovld write_imageh(read_write image2d_t image, int2 coord, half4 color);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- void __ovld write_imageh(read_write image3d_t image, int4 coord, half4 color);
- #endif
- void __ovld write_imageh(read_write image1d_array_t image, int2 coord, half4 color);
- void __ovld write_imageh(read_write image2d_array_t image, int4 coord, half4 color);
- void __ovld write_imageh(read_write image1d_buffer_t image, int coord, half4 color);
- #endif //cl_khr_fp16
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- // Note: In OpenCL v1.0/1.1/1.2, image argument of image query builtin functions does not have
-@@ -14810,7 +16842,7 @@ void __ovld write_imageh(read_write image1d_buffer_t image, int coord, half4 col
- int __ovld __cnfn get_image_width(read_only image1d_t image);
- int __ovld __cnfn get_image_width(read_only image1d_buffer_t image);
- int __ovld __cnfn get_image_width(read_only image2d_t image);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- int __ovld __cnfn get_image_width(read_only image3d_t image);
- #endif
- int __ovld __cnfn get_image_width(read_only image1d_array_t image);
-@@ -14829,7 +16861,7 @@ int __ovld __cnfn get_image_width(read_only image2d_array_msaa_depth_t image);
- int __ovld __cnfn get_image_width(write_only image1d_t image);
- int __ovld __cnfn get_image_width(write_only image1d_buffer_t image);
- int __ovld __cnfn get_image_width(write_only image2d_t image);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- int __ovld __cnfn get_image_width(write_only image3d_t image);
- #endif
- int __ovld __cnfn get_image_width(write_only image1d_array_t image);
-@@ -14846,6 +16878,7 @@ int __ovld __cnfn get_image_width(write_only image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- int __ovld __cnfn get_image_width(read_write image1d_t image);
- int __ovld __cnfn get_image_width(read_write image1d_buffer_t image);
- int __ovld __cnfn get_image_width(read_write image2d_t image);
-@@ -14862,6 +16895,7 @@ int __ovld __cnfn get_image_width(read_write image2d_msaa_depth_t image);
- int __ovld __cnfn get_image_width(read_write image2d_array_msaa_t image);
- int __ovld __cnfn get_image_width(read_write image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
-@@ -14882,7 +16916,7 @@ int __ovld __cnfn get_image_height(read_only image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-
- int __ovld __cnfn get_image_height(write_only image2d_t image);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- int __ovld __cnfn get_image_height(write_only image3d_t image);
- #endif
- int __ovld __cnfn get_image_height(write_only image2d_array_t image);
-@@ -14898,6 +16932,7 @@ int __ovld __cnfn get_image_height(write_only image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- int __ovld __cnfn get_image_height(read_write image2d_t image);
- int __ovld __cnfn get_image_height(read_write image3d_t image);
- int __ovld __cnfn get_image_height(read_write image2d_array_t image);
-@@ -14911,6 +16946,7 @@ int __ovld __cnfn get_image_height(read_write image2d_msaa_depth_t image);
- int __ovld __cnfn get_image_height(read_write image2d_array_msaa_t image);
- int __ovld __cnfn get_image_height(read_write image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
-@@ -14918,12 +16954,14 @@ int __ovld __cnfn get_image_height(read_write image2d_array_msaa_depth_t image);
- */
- int __ovld __cnfn get_image_depth(read_only image3d_t image);
-
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- int __ovld __cnfn get_image_depth(write_only image3d_t image);
- #endif
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- int __ovld __cnfn get_image_depth(read_write image3d_t image);
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- // OpenCL Extension v2.0 s9.18 - Mipmaps
-@@ -14939,13 +16977,15 @@ int __ovld get_image_num_mip_levels(read_only image3d_t image);
-
- int __ovld get_image_num_mip_levels(write_only image1d_t image);
- int __ovld get_image_num_mip_levels(write_only image2d_t image);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- int __ovld get_image_num_mip_levels(write_only image3d_t image);
- #endif
-
-+#ifdef __opencl_c_read_write_images
- int __ovld get_image_num_mip_levels(read_write image1d_t image);
- int __ovld get_image_num_mip_levels(read_write image2d_t image);
- int __ovld get_image_num_mip_levels(read_write image3d_t image);
-+#endif //__opencl_c_read_write_images
-
- int __ovld get_image_num_mip_levels(read_only image1d_array_t image);
- int __ovld get_image_num_mip_levels(read_only image2d_array_t image);
-@@ -14957,10 +16997,12 @@ int __ovld get_image_num_mip_levels(write_only image2d_array_t image);
- int __ovld get_image_num_mip_levels(write_only image2d_array_depth_t image);
- int __ovld get_image_num_mip_levels(write_only image2d_depth_t image);
-
-+#ifdef __opencl_c_read_write_images
- int __ovld get_image_num_mip_levels(read_write image1d_array_t image);
- int __ovld get_image_num_mip_levels(read_write image2d_array_t image);
- int __ovld get_image_num_mip_levels(read_write image2d_array_depth_t image);
- int __ovld get_image_num_mip_levels(read_write image2d_depth_t image);
-+#endif //__opencl_c_read_write_images
-
- #endif //cl_khr_mipmap_image
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-@@ -15004,7 +17046,7 @@ int __ovld __cnfn get_image_channel_data_type(read_only image2d_array_msaa_depth
- int __ovld __cnfn get_image_channel_data_type(write_only image1d_t image);
- int __ovld __cnfn get_image_channel_data_type(write_only image1d_buffer_t image);
- int __ovld __cnfn get_image_channel_data_type(write_only image2d_t image);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- int __ovld __cnfn get_image_channel_data_type(write_only image3d_t image);
- #endif
- int __ovld __cnfn get_image_channel_data_type(write_only image1d_array_t image);
-@@ -15021,6 +17063,7 @@ int __ovld __cnfn get_image_channel_data_type(write_only image2d_array_msaa_dept
- #endif //cl_khr_gl_msaa_sharing
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- int __ovld __cnfn get_image_channel_data_type(read_write image1d_t image);
- int __ovld __cnfn get_image_channel_data_type(read_write image1d_buffer_t image);
- int __ovld __cnfn get_image_channel_data_type(read_write image2d_t image);
-@@ -15037,6 +17080,7 @@ int __ovld __cnfn get_image_channel_data_type(read_write image2d_msaa_depth_t im
- int __ovld __cnfn get_image_channel_data_type(read_write image2d_array_msaa_t image);
- int __ovld __cnfn get_image_channel_data_type(read_write image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
-@@ -15076,7 +17120,7 @@ int __ovld __cnfn get_image_channel_order(read_only image2d_array_msaa_depth_t i
- int __ovld __cnfn get_image_channel_order(write_only image1d_t image);
- int __ovld __cnfn get_image_channel_order(write_only image1d_buffer_t image);
- int __ovld __cnfn get_image_channel_order(write_only image2d_t image);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- int __ovld __cnfn get_image_channel_order(write_only image3d_t image);
- #endif
- int __ovld __cnfn get_image_channel_order(write_only image1d_array_t image);
-@@ -15093,6 +17137,7 @@ int __ovld __cnfn get_image_channel_order(write_only image2d_array_msaa_depth_t
- #endif //cl_khr_gl_msaa_sharing
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- int __ovld __cnfn get_image_channel_order(read_write image1d_t image);
- int __ovld __cnfn get_image_channel_order(read_write image1d_buffer_t image);
- int __ovld __cnfn get_image_channel_order(read_write image2d_t image);
-@@ -15109,6 +17154,7 @@ int __ovld __cnfn get_image_channel_order(read_write image2d_msaa_depth_t image)
- int __ovld __cnfn get_image_channel_order(read_write image2d_array_msaa_t image);
- int __ovld __cnfn get_image_channel_order(read_write image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
-@@ -15143,6 +17189,7 @@ int2 __ovld __cnfn get_image_dim(write_only image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- int2 __ovld __cnfn get_image_dim(read_write image2d_t image);
- int2 __ovld __cnfn get_image_dim(read_write image2d_array_t image);
- #ifdef cl_khr_depth_images
-@@ -15155,6 +17202,7 @@ int2 __ovld __cnfn get_image_dim(read_write image2d_msaa_depth_t image);
- int2 __ovld __cnfn get_image_dim(read_write image2d_array_msaa_t image);
- int2 __ovld __cnfn get_image_dim(read_write image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
-@@ -15164,11 +17212,13 @@ int2 __ovld __cnfn get_image_dim(read_write image2d_array_msaa_depth_t image);
- * component and the w component is 0.
- */
- int4 __ovld __cnfn get_image_dim(read_only image3d_t image);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- int4 __ovld __cnfn get_image_dim(write_only image3d_t image);
- #endif
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- int4 __ovld __cnfn get_image_dim(read_write image3d_t image);
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
-@@ -15196,6 +17246,7 @@ size_t __ovld __cnfn get_image_array_size(write_only image2d_array_msaa_depth_t
- #endif //cl_khr_gl_msaa_sharing
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- size_t __ovld __cnfn get_image_array_size(read_write image1d_array_t image_array);
- size_t __ovld __cnfn get_image_array_size(read_write image2d_array_t image_array);
- #ifdef cl_khr_depth_images
-@@ -15205,6 +17256,7 @@ size_t __ovld __cnfn get_image_array_size(read_write image2d_array_depth_t image
- size_t __ovld __cnfn get_image_array_size(read_write image2d_array_msaa_t image_array);
- size_t __ovld __cnfn get_image_array_size(read_write image2d_array_msaa_depth_t image_array);
- #endif //cl_khr_gl_msaa_sharing
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
-@@ -15222,16 +17274,21 @@ int __ovld get_image_num_samples(write_only image2d_array_msaa_t image);
- int __ovld get_image_num_samples(write_only image2d_array_msaa_depth_t image);
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- int __ovld get_image_num_samples(read_write image2d_msaa_t image);
- int __ovld get_image_num_samples(read_write image2d_msaa_depth_t image);
- int __ovld get_image_num_samples(read_write image2d_array_msaa_t image);
- int __ovld get_image_num_samples(read_write image2d_array_msaa_depth_t image);
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
- #endif
-
-+#endif //__opencl_c_images
-+
- // OpenCL v2.0 s6.13.15 - Work-group Functions
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_work_group_collective_functions
- int __ovld __conv work_group_all(int predicate);
- int __ovld __conv work_group_any(int predicate);
-
-@@ -15255,11 +17312,11 @@ ulong __ovld __conv work_group_broadcast(ulong a, size_t x, size_t y, size_t z);
- float __ovld __conv work_group_broadcast(float a, size_t local_id);
- float __ovld __conv work_group_broadcast(float a, size_t x, size_t y);
- float __ovld __conv work_group_broadcast(float a, size_t x, size_t y, size_t z);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __conv work_group_broadcast(double a, size_t local_id);
- double __ovld __conv work_group_broadcast(double a, size_t x, size_t y);
- double __ovld __conv work_group_broadcast(double a, size_t x, size_t y, size_t z);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #ifdef cl_khr_fp16
- half __ovld __conv work_group_reduce_add(half x);
-@@ -15317,7 +17374,7 @@ float __ovld __conv work_group_scan_exclusive_max(float x);
- float __ovld __conv work_group_scan_inclusive_add(float x);
- float __ovld __conv work_group_scan_inclusive_min(float x);
- float __ovld __conv work_group_scan_inclusive_max(float x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __conv work_group_reduce_add(double x);
- double __ovld __conv work_group_reduce_min(double x);
- double __ovld __conv work_group_reduce_max(double x);
-@@ -15327,19 +17384,18 @@ double __ovld __conv work_group_scan_exclusive_max(double x);
- double __ovld __conv work_group_scan_inclusive_add(double x);
- double __ovld __conv work_group_scan_inclusive_min(double x);
- double __ovld __conv work_group_scan_inclusive_max(double x);
--#endif //cl_khr_fp64
--
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#endif //__opencl_c_work_group_collective_functions
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- // OpenCL v2.0 s6.13.16 - Pipe Functions
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_pipes
- bool __ovld is_valid_reserve_id(reserve_id_t reserve_id);
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
--
-+#endif //__opencl_c_pipes
-
- // OpenCL v2.0 s6.13.17 - Enqueue Kernels
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
--
-+#ifdef __opencl_c_device_enqueue
- ndrange_t __ovld ndrange_1D(size_t);
- ndrange_t __ovld ndrange_1D(size_t, size_t);
- ndrange_t __ovld ndrange_1D(size_t, size_t, size_t);
-@@ -15367,11 +17423,13 @@ bool __ovld is_valid_event (clk_event_t event);
- void __ovld capture_event_profiling_info(clk_event_t, clk_profiling_info, __global void* value);
-
- queue_t __ovld get_default_queue(void);
-+#endif //__opencl_c_device_enqueue
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- // OpenCL Extension v2.0 s9.17 - Sub-groups
-
--#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups)
-+#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups) || \
-+ defined(__opencl_c_subgroups)
- // Shared Sub Group Functions
- uint __ovld get_sub_group_size(void);
- uint __ovld get_max_sub_group_size(void);
-@@ -15457,7 +17515,7 @@ half __ovld __conv sub_group_scan_inclusive_min(half x);
- half __ovld __conv sub_group_scan_inclusive_max(half x);
- #endif //cl_khr_fp16
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __conv sub_group_broadcast(double x, uint sub_group_local_id);
- double __ovld __conv sub_group_reduce_add(double x);
- double __ovld __conv sub_group_reduce_min(double x);
-@@ -15468,7 +17526,7 @@ double __ovld __conv sub_group_scan_exclusive_max(double x);
- double __ovld __conv sub_group_scan_inclusive_add(double x);
- double __ovld __conv sub_group_scan_inclusive_min(double x);
- double __ovld __conv sub_group_scan_inclusive_max(double x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #endif //cl_khr_subgroups cl_intel_subgroups
-
-@@ -15570,16 +17628,22 @@ uint16 __ovld __conv intel_sub_group_shuffle_xor( uint16 x, uint c );
- long __ovld __conv intel_sub_group_shuffle_xor( long x, uint c );
- ulong __ovld __conv intel_sub_group_shuffle_xor( ulong x, uint c );
-
-+#ifdef __opencl_c_images
- uint __ovld __conv intel_sub_group_block_read( read_only image2d_t image, int2 coord );
- uint2 __ovld __conv intel_sub_group_block_read2( read_only image2d_t image, int2 coord );
- uint4 __ovld __conv intel_sub_group_block_read4( read_only image2d_t image, int2 coord );
- uint8 __ovld __conv intel_sub_group_block_read8( read_only image2d_t image, int2 coord );
-+#endif //__opencl_c_images
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_images
-+#ifdef __opencl_c_read_write_images
- uint __ovld __conv intel_sub_group_block_read(read_write image2d_t image, int2 coord);
- uint2 __ovld __conv intel_sub_group_block_read2(read_write image2d_t image, int2 coord);
- uint4 __ovld __conv intel_sub_group_block_read4(read_write image2d_t image, int2 coord);
- uint8 __ovld __conv intel_sub_group_block_read8(read_write image2d_t image, int2 coord);
-+#endif //__opencl_c_read_write_images
-+#endif //__opencl_c_images
- #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- uint __ovld __conv intel_sub_group_block_read( const __global uint* p );
-@@ -15587,16 +17651,22 @@ uint2 __ovld __conv intel_sub_group_block_read2( const __global uint* p );
- uint4 __ovld __conv intel_sub_group_block_read4( const __global uint* p );
- uint8 __ovld __conv intel_sub_group_block_read8( const __global uint* p );
-
-+#ifdef __opencl_c_images
- void __ovld __conv intel_sub_group_block_write(write_only image2d_t image, int2 coord, uint data);
- void __ovld __conv intel_sub_group_block_write2(write_only image2d_t image, int2 coord, uint2 data);
- void __ovld __conv intel_sub_group_block_write4(write_only image2d_t image, int2 coord, uint4 data);
- void __ovld __conv intel_sub_group_block_write8(write_only image2d_t image, int2 coord, uint8 data);
-+#endif //__opencl_c_images
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_images
-+#ifdef __opencl_c_read_write_images
- void __ovld __conv intel_sub_group_block_write(read_write image2d_t image, int2 coord, uint data);
- void __ovld __conv intel_sub_group_block_write2(read_write image2d_t image, int2 coord, uint2 data);
- void __ovld __conv intel_sub_group_block_write4(read_write image2d_t image, int2 coord, uint4 data);
- void __ovld __conv intel_sub_group_block_write8(read_write image2d_t image, int2 coord, uint8 data);
-+#endif // __opencl_c_read_write_images
-+#endif // __opencl_c_images
- #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- void __ovld __conv intel_sub_group_block_write( __global uint* p, uint data );
-@@ -15611,7 +17681,7 @@ half __ovld __conv intel_sub_group_shuffle_up( half prev, half cur, uint c );
- half __ovld __conv intel_sub_group_shuffle_xor( half x, uint c );
- #endif
-
--#if defined(cl_khr_fp64)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __conv intel_sub_group_shuffle( double x, uint c );
- double __ovld __conv intel_sub_group_shuffle_down( double prev, double cur, uint c );
- double __ovld __conv intel_sub_group_shuffle_up( double prev, double cur, uint c );
-@@ -15710,16 +17780,22 @@ ushort __ovld __conv intel_sub_group_scan_inclusive_min( ushort x );
- short __ovld __conv intel_sub_group_scan_inclusive_max( short x );
- ushort __ovld __conv intel_sub_group_scan_inclusive_max( ushort x );
-
-+#ifdef __opencl_c_images
- uint __ovld __conv intel_sub_group_block_read_ui( read_only image2d_t image, int2 byte_coord );
- uint2 __ovld __conv intel_sub_group_block_read_ui2( read_only image2d_t image, int2 byte_coord );
- uint4 __ovld __conv intel_sub_group_block_read_ui4( read_only image2d_t image, int2 byte_coord );
- uint8 __ovld __conv intel_sub_group_block_read_ui8( read_only image2d_t image, int2 byte_coord );
-+#endif //__opencl_c_images
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_images
-+#ifdef __opencl_c_read_write_images
- uint __ovld __conv intel_sub_group_block_read_ui( read_write image2d_t image, int2 byte_coord );
- uint2 __ovld __conv intel_sub_group_block_read_ui2( read_write image2d_t image, int2 byte_coord );
- uint4 __ovld __conv intel_sub_group_block_read_ui4( read_write image2d_t image, int2 byte_coord );
- uint8 __ovld __conv intel_sub_group_block_read_ui8( read_write image2d_t image, int2 byte_coord );
-+#endif //__opencl_c_read_write_images
-+#endif //__opencl_c_images
- #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- uint __ovld __conv intel_sub_group_block_read_ui( const __global uint* p );
-@@ -15727,16 +17803,22 @@ uint2 __ovld __conv intel_sub_group_block_read_ui2( const __global uint* p
- uint4 __ovld __conv intel_sub_group_block_read_ui4( const __global uint* p );
- uint8 __ovld __conv intel_sub_group_block_read_ui8( const __global uint* p );
-
-+#ifdef __opencl_c_images
- void __ovld __conv intel_sub_group_block_write_ui( read_only image2d_t image, int2 byte_coord, uint data );
- void __ovld __conv intel_sub_group_block_write_ui2( read_only image2d_t image, int2 byte_coord, uint2 data );
- void __ovld __conv intel_sub_group_block_write_ui4( read_only image2d_t image, int2 byte_coord, uint4 data );
- void __ovld __conv intel_sub_group_block_write_ui8( read_only image2d_t image, int2 byte_coord, uint8 data );
-+#endif //__opencl_c_images
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_images
-+#ifdef __opencl_c_read_write_images
- void __ovld __conv intel_sub_group_block_write_ui( read_write image2d_t image, int2 byte_coord, uint data );
- void __ovld __conv intel_sub_group_block_write_ui2( read_write image2d_t image, int2 byte_coord, uint2 data );
- void __ovld __conv intel_sub_group_block_write_ui4( read_write image2d_t image, int2 byte_coord, uint4 data );
- void __ovld __conv intel_sub_group_block_write_ui8( read_write image2d_t image, int2 byte_coord, uint8 data );
-+#endif //__opencl_c_read_write_images
-+#endif //__opencl_c_images
- #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- void __ovld __conv intel_sub_group_block_write_ui( __global uint* p, uint data );
-@@ -15744,16 +17826,22 @@ void __ovld __conv intel_sub_group_block_write_ui2( __global uint* p, uint
- void __ovld __conv intel_sub_group_block_write_ui4( __global uint* p, uint4 data );
- void __ovld __conv intel_sub_group_block_write_ui8( __global uint* p, uint8 data );
-
-+#ifdef __opencl_c_images
- ushort __ovld __conv intel_sub_group_block_read_us( read_only image2d_t image, int2 coord );
- ushort2 __ovld __conv intel_sub_group_block_read_us2( read_only image2d_t image, int2 coord );
- ushort4 __ovld __conv intel_sub_group_block_read_us4( read_only image2d_t image, int2 coord );
- ushort8 __ovld __conv intel_sub_group_block_read_us8( read_only image2d_t image, int2 coord );
-+#endif //__opencl_c_images
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_images
-+#ifdef __opencl_c_read_write_images
- ushort __ovld __conv intel_sub_group_block_read_us(read_write image2d_t image, int2 coord);
- ushort2 __ovld __conv intel_sub_group_block_read_us2(read_write image2d_t image, int2 coord);
- ushort4 __ovld __conv intel_sub_group_block_read_us4(read_write image2d_t image, int2 coord);
- ushort8 __ovld __conv intel_sub_group_block_read_us8(read_write image2d_t image, int2 coord);
-+#endif //__opencl_c_read_write_images
-+#endif //__opencl_c_images
- #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- ushort __ovld __conv intel_sub_group_block_read_us( const __global ushort* p );
-@@ -15761,16 +17849,22 @@ ushort2 __ovld __conv intel_sub_group_block_read_us2( const __global ushort*
- ushort4 __ovld __conv intel_sub_group_block_read_us4( const __global ushort* p );
- ushort8 __ovld __conv intel_sub_group_block_read_us8( const __global ushort* p );
-
-+#ifdef __opencl_c_images
- void __ovld __conv intel_sub_group_block_write_us(write_only image2d_t image, int2 coord, ushort data);
- void __ovld __conv intel_sub_group_block_write_us2(write_only image2d_t image, int2 coord, ushort2 data);
- void __ovld __conv intel_sub_group_block_write_us4(write_only image2d_t image, int2 coord, ushort4 data);
- void __ovld __conv intel_sub_group_block_write_us8(write_only image2d_t image, int2 coord, ushort8 data);
-+#endif //__opencl_c_images
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_images
-+#ifdef __opencl_c_read_write_images
- void __ovld __conv intel_sub_group_block_write_us(read_write image2d_t image, int2 coord, ushort data);
- void __ovld __conv intel_sub_group_block_write_us2(read_write image2d_t image, int2 coord, ushort2 data);
- void __ovld __conv intel_sub_group_block_write_us4(read_write image2d_t image, int2 coord, ushort4 data);
- void __ovld __conv intel_sub_group_block_write_us8(read_write image2d_t image, int2 coord, ushort8 data);
-+#endif //__opencl_c_read_write_images
-+#endif //__opencl_c_images
- #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- void __ovld __conv intel_sub_group_block_write_us( __global ushort* p, ushort data );
-@@ -15889,6 +17983,7 @@ short2 __ovld intel_sub_group_avc_ime_adjust_ref_offset(
- short2 ref_offset, ushort2 src_coord, ushort2 ref_window_size,
- ushort2 image_size);
-
-+#ifdef __opencl_c_images
- intel_sub_group_avc_ime_result_t __ovld
- intel_sub_group_avc_ime_evaluate_with_single_reference(
- read_only image2d_t src_image, read_only image2d_t ref_image,
-@@ -15929,6 +18024,7 @@ intel_sub_group_avc_ime_evaluate_with_dual_reference_streaminout(
- read_only image2d_t bwd_ref_image, sampler_t vme_media_sampler,
- intel_sub_group_avc_ime_payload_t payload,
- intel_sub_group_avc_ime_dual_reference_streamin_t streamin_components);
-+#endif //__opencl_c_images
-
- intel_sub_group_avc_ime_single_reference_streamin_t __ovld
- intel_sub_group_avc_ime_get_single_reference_streamin(
-@@ -15993,6 +18089,7 @@ intel_sub_group_avc_ref_payload_t __ovld
- intel_sub_group_avc_ref_set_bilinear_filter_enable(
- intel_sub_group_avc_ref_payload_t payload);
-
-+#ifdef __opencl_c_images
- intel_sub_group_avc_ref_result_t __ovld
- intel_sub_group_avc_ref_evaluate_with_single_reference(
- read_only image2d_t src_image, read_only image2d_t ref_image,
-@@ -16011,6 +18108,7 @@ intel_sub_group_avc_ref_evaluate_with_multi_reference(
- read_only image2d_t src_image, uint packed_reference_ids,
- uchar packed_reference_field_polarities, sampler_t vme_media_sampler,
- intel_sub_group_avc_ref_payload_t payload);
-+#endif //__opencl_c_images
-
- // SIC built-in functions
- intel_sub_group_avc_sic_payload_t __ovld
-@@ -16061,6 +18159,7 @@ intel_sub_group_avc_sic_set_block_based_raw_skip_sad(
- uchar block_based_skip_type,
- intel_sub_group_avc_sic_payload_t payload);
-
-+#ifdef __opencl_c_images
- intel_sub_group_avc_sic_result_t __ovld
- intel_sub_group_avc_sic_evaluate_ipe(
- read_only image2d_t src_image, sampler_t vme_media_sampler,
-@@ -16083,6 +18182,7 @@ intel_sub_group_avc_sic_evaluate_with_multi_reference(
- read_only image2d_t src_image, uint packed_reference_ids,
- uchar packed_reference_field_polarities, sampler_t vme_media_sampler,
- intel_sub_group_avc_sic_payload_t payload);
-+#endif //__opencl_c_images
-
- uchar __ovld intel_sub_group_avc_sic_get_ipe_luma_shape(
- intel_sub_group_avc_sic_result_t result);
-diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
-index 6353e14bc41a..a8c216de6e04 100644
---- a/clang/lib/Parse/ParseDecl.cpp
-+++ b/clang/lib/Parse/ParseDecl.cpp
-@@ -3904,8 +3904,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
- isInvalid = DS.SetTypeAltiVecBool(true, Loc, PrevSpec, DiagID, Policy);
- break;
- case tok::kw_pipe:
-- if (!getLangOpts().OpenCL || (getLangOpts().OpenCLVersion < 200 &&
-- !getLangOpts().OpenCLCPlusPlus)) {
-+ if (!getLangOpts().OpenCLPipeKeyword) {
- // OpenCL 2.0 defined this keyword. OpenCL 1.2 and earlier should
- // support the "pipe" word as identifier.
- Tok.getIdentifierInfo()->revertTokenIDToIdentifier();
-@@ -4027,8 +4026,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
- case tok::kw___generic:
- // generic address space is introduced only in OpenCL v2.0
- // see OpenCL C Spec v2.0 s6.5.5
-- if (Actions.getLangOpts().OpenCLVersion < 200 &&
-- !Actions.getLangOpts().OpenCLCPlusPlus) {
-+ if (!Actions.getLangOpts().OpenCLGenericKeyword) {
- DiagID = diag::err_opencl_unknown_type_specifier;
- PrevSpec = Tok.getIdentifierInfo()->getNameStart();
- isInvalid = true;
-@@ -5050,8 +5048,7 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) {
- default: return false;
-
- case tok::kw_pipe:
-- return (getLangOpts().OpenCL && getLangOpts().OpenCLVersion >= 200) ||
-- getLangOpts().OpenCLCPlusPlus;
-+ return getLangOpts().OpenCLPipeKeyword;
-
- case tok::identifier: // foo::bar
- // Unfortunate hack to support "Class.factoryMethod" notation.
-@@ -5557,8 +5554,7 @@ static bool isPtrOperatorToken(tok::TokenKind Kind, const LangOptions &Lang,
- if (Kind == tok::star || Kind == tok::caret)
- return true;
-
-- if (Kind == tok::kw_pipe &&
-- ((Lang.OpenCL && Lang.OpenCLVersion >= 200) || Lang.OpenCLCPlusPlus))
-+ if (Kind == tok::kw_pipe && Lang.OpenCLPipeKeyword)
- return true;
-
- if (!Lang.CPlusPlus)
-diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp
-index df411e1928d6..9a40ce888695 100644
---- a/clang/lib/Parse/ParsePragma.cpp
-+++ b/clang/lib/Parse/ParsePragma.cpp
-@@ -697,12 +697,14 @@ void Parser::HandlePragmaOpenCLExtension() {
- if (Name == "all") {
- if (State == Disable) {
- Opt.disableAll();
-- Opt.enableSupportedCore(getLangOpts());
-+ Opt.enableSupportedCore();
- } else {
- PP.Diag(NameLoc, diag::warn_pragma_expected_predicate) << 1;
- }
-+ } else if (Opt.isFeature(Name)) {
-+ PP.Diag(NameLoc, diag::warn_opencl_pragma_feature_ignore) << Ident;
- } else if (State == Begin) {
-- if (!Opt.isKnown(Name) || !Opt.isSupported(Name, getLangOpts())) {
-+ if (!Opt.isKnown(Name) || !Opt.isSupported(Name)) {
- Opt.support(Name);
- }
- Actions.setCurrentOpenCLExtension(Name);
-@@ -712,9 +714,9 @@ void Parser::HandlePragmaOpenCLExtension() {
- Actions.setCurrentOpenCLExtension("");
- } else if (!Opt.isKnown(Name))
- PP.Diag(NameLoc, diag::warn_pragma_unknown_extension) << Ident;
-- else if (Opt.isSupportedExtension(Name, getLangOpts()))
-+ else if (Opt.isSupportedExtension(Name))
- Opt.enable(Name, State == Enable);
-- else if (Opt.isSupportedCore(Name, getLangOpts()))
-+ else if (Opt.isSupportedCore(Name))
- PP.Diag(NameLoc, diag::warn_pragma_extension_is_core) << Ident;
- else
- PP.Diag(NameLoc, diag::warn_pragma_unsupported_extension) << Ident;
-diff --git a/clang/lib/Sema/OpenCLBuiltins.td b/clang/lib/Sema/OpenCLBuiltins.td
-index 9d6bb411eff8..d352d35f1e46 100644
---- a/clang/lib/Sema/OpenCLBuiltins.td
-+++ b/clang/lib/Sema/OpenCLBuiltins.td
-@@ -22,11 +22,13 @@
- class Version<int _Version> {
- int ID = _Version;
- }
-+
- def CLAll : Version< 0>;
- def CL10 : Version<100>;
- def CL11 : Version<110>;
- def CL12 : Version<120>;
- def CL20 : Version<200>;
-+def CL30 : Version<300>;
-
- // Address spaces
- // Pointer types need to be assigned an address space.
-@@ -65,6 +67,14 @@ def FuncExtKhrGlMsaaSharing : FunctionExtension<"cl_khr_gl_msaa_sha
- // Multiple extensions
- def FuncExtKhrMipmapAndWrite3d : FunctionExtension<"cl_khr_mipmap_image cl_khr_3d_image_writes">;
-
-+// Features
-+def FuncExtGenericAddressSpace : FunctionExtension<"__opencl_c_generic_address_space">;
-+def FuncExtWorkGroupCollective : FunctionExtension<"__opencl_c_work_group_collective_functions">;
-+def FuncExtPipes : FunctionExtension<"__opencl_c_pipes">;
-+def FuncExtDeviceSidEenqueue : FunctionExtension<"__opencl_c_device_enqueue">;
-+def FuncNonExplicitAtomicFeatures : FunctionExtension<"__opencl_c_atomic_order_seq_cst __opencl_c_atomic_scope_device">;
-+def FuncNonExplicitAtomicFeaturesAndGenericAS : FunctionExtension<"__opencl_c_atomic_order_seq_cst __opencl_c_atomic_scope_device __opencl_c_generic_address_space">;
-+
- // Qualified Type. These map to ASTContext::QualType.
- class QualType<string _Name, bit _IsAbstract=0> {
- // Name of the field or function in a clang::ASTContext
-@@ -230,13 +240,9 @@ class Builtin<string _Name, list<Type> _Signature, list<bit> _Attributes = Attr.
- bit IsConv = _Attributes[2];
- // OpenCL extensions to which the function belongs.
- FunctionExtension Extension = FuncExtNone;
-- // Version of OpenCL from which the function is available (e.g.: CL10).
-- // MinVersion is inclusive.
-- Version MinVersion = CL10;
-- // Version of OpenCL from which the function is not supported anymore.
-- // MaxVersion is exclusive.
-+ // List of OpenCL version in which this function available.
- // CLAll makes the function available for all versions.
-- Version MaxVersion = CLAll;
-+ list<Version> Versions = [CLAll];
- }
-
- //===----------------------------------------------------------------------===//
-@@ -398,7 +404,7 @@ foreach name = ["get_global_size", "get_global_id", "get_local_size",
- def : Builtin<name, [Size, UInt], Attr.Const>;
- }
-
--let MinVersion = CL20 in {
-+let Versions = [CL20, CL30] in {
- def : Builtin<"get_enqueued_local_size", [Size, UInt]>;
- foreach name = ["get_global_linear_id", "get_local_linear_id"] in {
- def : Builtin<name, [Size]>;
-@@ -471,7 +477,7 @@ foreach name = ["fma", "mad"] in {
- }
-
- // --- Version dependent ---
--let MaxVersion = CL20 in {
-+let Versions = [CL10, CL11, CL12, CL30] in {
- foreach AS = [GlobalAS, LocalAS, PrivateAS] in {
- foreach name = ["fract", "modf", "sincos"] in {
- def : Builtin<name, [FGenTypeN, FGenTypeN, PointerType<FGenTypeN, AS>]>;
-@@ -488,7 +494,9 @@ let MaxVersion = CL20 in {
- }
- }
- }
--let MinVersion = CL20 in {
-+
-+let Versions = [CL20, CL30] in {
-+ let Extension = FuncExtGenericAddressSpace in {
- foreach name = ["fract", "modf", "sincos"] in {
- def : Builtin<name, [FGenTypeN, FGenTypeN, PointerType<FGenTypeN, GenericAS>]>;
- }
-@@ -501,6 +509,7 @@ let MinVersion = CL20 in {
- def : Builtin<name, [Type, Type, Type, PointerType<GenTypeIntVecAndScalar, GenericAS>]>;
- }
- }
-+ }
- }
-
- // --- Table 9 ---
-@@ -531,7 +540,7 @@ foreach name = ["abs"] in {
- foreach name = ["clz", "popcount"] in {
- def : Builtin<name, [AIGenTypeN, AIGenTypeN], Attr.Const>;
- }
--let MinVersion = CL20 in {
-+let Versions = [CL20, CL30] in {
- foreach name = ["ctz"] in {
- def : Builtin<name, [AIGenTypeN, AIGenTypeN]>;
- }
-@@ -705,7 +714,7 @@ foreach name = ["select"] in {
- // --- Table 15 ---
- // Variants for OpenCL versions below 2.0, using pointers to the global, local
- // and private address spaces.
--let MaxVersion = CL20 in {
-+let Versions = [CL10, CL11, CL12, CL30] in {
- foreach AS = [GlobalAS, LocalAS, PrivateAS] in {
- foreach VSize = [2, 3, 4, 8, 16] in {
- foreach name = ["vload" # VSize] in {
-@@ -748,7 +757,8 @@ let MaxVersion = CL20 in {
- }
- // Variants for OpenCL versions above 2.0, using pointers to the generic
- // address space.
--let MinVersion = CL20 in {
-+let Versions = [CL20, CL30] in {
-+ let Extension = FuncExtGenericAddressSpace in {
- foreach VSize = [2, 3, 4, 8, 16] in {
- foreach name = ["vload" # VSize] in {
- def : Builtin<name, [VectorType<Char, VSize>, Size, PointerType<ConstType<Char>, GenericAS>]>;
-@@ -786,6 +796,7 @@ let MinVersion = CL20 in {
- }
- }
- }
-+ }
- }
- // Variants using pointers to the constant address space.
- foreach VSize = [2, 3, 4, 8, 16] in {
-@@ -812,7 +823,7 @@ foreach VSize = [2, 3, 4, 8, 16] in {
- }
- }
- }
--let MaxVersion = CL20 in {
-+let Versions = [CL10, CL11, CL12, CL30] in {
- foreach AS = [GlobalAS, LocalAS, PrivateAS] in {
- def : Builtin<"vload_half", [Float, Size, PointerType<ConstType<Half>, AS>]>;
- foreach VSize = [2, 3, 4, 8, 16] in {
-@@ -832,7 +843,8 @@ let MaxVersion = CL20 in {
- }
- }
- }
--let MinVersion = CL20 in {
-+let Versions = [CL20, CL30] in {
-+ let Extension = FuncExtGenericAddressSpace in {
- foreach AS = [GenericAS] in {
- def : Builtin<"vload_half", [Float, Size, PointerType<ConstType<Half>, AS>]>;
- foreach VSize = [2, 3, 4, 8, 16] in {
-@@ -851,6 +863,7 @@ let MinVersion = CL20 in {
- }
- }
- }
-+ }
- }
-
- foreach AS = [ConstantAS] in {
-@@ -875,7 +888,9 @@ foreach name = ["async_work_group_strided_copy"] in {
- def : Builtin<name, [Event, PointerType<AGenTypeN, GlobalAS>, PointerType<ConstType<AGenTypeN>, LocalAS>, Size, Size, Event]>;
- }
- foreach name = ["wait_group_events"] in {
-+ let Extension = FuncExtGenericAddressSpace in {
- def : Builtin<name, [Void, Int, PointerType<Event, GenericAS>]>;
-+ }
- }
- foreach name = ["prefetch"] in {
- def : Builtin<name, [Void, PointerType<ConstType<AGenTypeN>, GlobalAS>, Size]>;
-@@ -1154,7 +1169,8 @@ foreach aQual = ["WO", "RW"] in {
- //--------------------------------------------------------------------
- // OpenCL v2.0 s6.13.15 - Work-group Functions
- // --- Table 26 ---
--let MinVersion = CL20 in {
-+let Versions = [CL20, CL30] in {
-+ let Extension = FuncExtWorkGroupCollective in {
- foreach name = ["work_group_all", "work_group_any"] in {
- def : Builtin<name, [Int, Int], Attr.Convergent>;
- }
-@@ -1169,11 +1185,12 @@ let MinVersion = CL20 in {
- def : Builtin<name # op, [IntLongFloatGenType1, IntLongFloatGenType1], Attr.Convergent>;
- }
- }
-+ }
- }
-
-
- // OpenCL v2.0 s9.17.3: Additions to section 6.13.1: Work-Item Functions
--let MinVersion = CL20 in {
-+let Versions = [CL20] in {
- let Extension = FuncExtKhrSubgroups in {
- def get_sub_group_size : Builtin<"get_sub_group_size", [UInt]>;
- def get_max_sub_group_size : Builtin<"get_max_sub_group_size", [UInt]>;
-diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
-index 9cfce5a63b1d..c26f45f62668 100644
---- a/clang/lib/Sema/Sema.cpp
-+++ b/clang/lib/Sema/Sema.cpp
-@@ -286,9 +286,10 @@ void Sema::Initialize() {
- // Initialize predefined OpenCL types and supported extensions and (optional)
- // core features.
- if (getLangOpts().OpenCL) {
-+ getOpenCLOptions().setOpenCLVersion(getLangOpts());
- getOpenCLOptions().addSupport(
- Context.getTargetInfo().getSupportedOpenCLOpts());
-- getOpenCLOptions().enableSupportedCore(getLangOpts());
-+ getOpenCLOptions().enableSupportedCore();
- addImplicitTypedef("sampler_t", Context.OCLSamplerTy);
- addImplicitTypedef("event_t", Context.OCLEventTy);
- if (getLangOpts().OpenCLCPlusPlus || getLangOpts().OpenCLVersion >= 200) {
-@@ -344,12 +345,18 @@ void Sema::Initialize() {
- "cl_khr_int64_base_atomics cl_khr_int64_extended_atomics");
-
- setOpenCLExtensionForType(AtomicDoubleT, "cl_khr_fp64");
-+ setOpenCLExtensionForType(Context.OCLReserveIDTy, "__opencl_c_pipes");
-+ setOpenCLExtensionForType(Context.OCLClkEventTy,
-+ "__opencl_c_device_enqueue");
-+ setOpenCLExtensionForType(Context.OCLQueueTy,
-+ "__opencl_c_device_enqueue");
- }
-
- setOpenCLExtensionForType(Context.DoubleTy, "cl_khr_fp64");
-
--#define GENERIC_IMAGE_TYPE_EXT(Type, Id, Ext) \
-- setOpenCLExtensionForType(Context.Id, Ext);
-+#define GENERIC_IMAGE_TYPE_EXT(Type, Id, Ext) \
-+ setOpenCLExtensionForType(Context.Id, Ext); \
-+ setOpenCLExtensionForType(Context.Id, "__opencl_c_images");
- #include "clang/Basic/OpenCLImageTypes.def"
- #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
- addImplicitTypedef(#ExtType, Context.Id##Ty); \
-@@ -2293,6 +2300,27 @@ bool Sema::isOpenCLDisabledDecl(Decl *FD) {
- return false;
- }
-
-+template <typename DiagLocT, typename DiagInfoT>
-+void Sema::DiagnoseOpenCLRequiresOption(llvm::StringRef OpenCLOptName,
-+ DiagLocT DiagLoc, DiagInfoT DiagInfo,
-+ unsigned Selector,
-+ SourceRange SrcRange) {
-+ const auto &LO = getLangOpts();
-+ auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
-+ // For versions higher that 3.0 diagnosing feature
-+ if (CLVer >= 300) {
-+ OpenCLOptName =
-+ llvm::StringSwitch<llvm::StringRef>(OpenCLOptName)
-+ .Case("cl_khr_3d_image_writes", "__opencl_c_3d_image_writes")
-+ .Case("cl_khr_subgroups", "__opencl_c_subgroups")
-+ .Case("cl_khr_fp64", "__opencl_c_fp64")
-+ .Default(OpenCLOptName);
-+ }
-+
-+ Diag(DiagLoc, diag::err_opencl_requires_extension)
-+ << Selector << DiagInfo << OpenCLOptName << SrcRange;
-+}
-+
- template <typename T, typename DiagLocT, typename DiagInfoT, typename MapT>
- bool Sema::checkOpenCLDisabledTypeOrDecl(T D, DiagLocT DiagLoc,
- DiagInfoT DiagInfo, MapT &Map,
-@@ -2304,8 +2332,7 @@ bool Sema::checkOpenCLDisabledTypeOrDecl(T D, DiagLocT DiagLoc,
- bool Disabled = false;
- for (auto &I : Loc->second) {
- if (I != CurrOpenCLExtension && !getOpenCLOptions().isEnabled(I)) {
-- Diag(DiagLoc, diag::err_opencl_requires_extension) << Selector << DiagInfo
-- << I << SrcRange;
-+ DiagnoseOpenCLRequiresOption(I, DiagLoc, DiagInfo, Selector, SrcRange);
- Disabled = true;
- }
- }
-@@ -2341,3 +2368,13 @@ bool Sema::checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E) {
- return checkOpenCLDisabledTypeOrDecl(&D, E.getBeginLoc(), FnName,
- OpenCLDeclExtMap, 1, D.getSourceRange());
- }
-+
-+bool Sema::checkOpenCLSubgroupExtForCallExpr(CallExpr *Call) {
-+ if (!getOpenCLOptions().isEnabled("cl_khr_subgroups")) {
-+ DiagnoseOpenCLRequiresOption("cl_khr_subgroups", Call->getBeginLoc(),
-+ Call->getDirectCallee(), 1,
-+ Call->getSourceRange());
-+ return true;
-+ }
-+ return false;
-+}
-diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
-index 74742023d1b3..efa3b6ab0eb6 100644
---- a/clang/lib/Sema/SemaChecking.cpp
-+++ b/clang/lib/Sema/SemaChecking.cpp
-@@ -597,20 +597,11 @@ static bool checkOpenCLBlockArgs(Sema &S, Expr *BlockArg) {
- return IllegalParams;
- }
-
--static bool checkOpenCLSubgroupExt(Sema &S, CallExpr *Call) {
-- if (!S.getOpenCLOptions().isEnabled("cl_khr_subgroups")) {
-- S.Diag(Call->getBeginLoc(), diag::err_opencl_requires_extension)
-- << 1 << Call->getDirectCallee() << "cl_khr_subgroups";
-- return true;
-- }
-- return false;
--}
--
- static bool SemaOpenCLBuiltinNDRangeAndBlock(Sema &S, CallExpr *TheCall) {
- if (checkArgCount(S, TheCall, 2))
- return true;
-
-- if (checkOpenCLSubgroupExt(S, TheCall))
-+ if (S.checkOpenCLSubgroupExtForCallExpr(TheCall))
- return true;
-
- // First argument is an ndrange_t type.
-@@ -1564,7 +1555,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
- break;
- case Builtin::BIsub_group_reserve_read_pipe:
- case Builtin::BIsub_group_reserve_write_pipe:
-- if (checkOpenCLSubgroupExt(*this, TheCall) ||
-+ if (checkOpenCLSubgroupExtForCallExpr(TheCall) ||
- SemaBuiltinReserveRWPipe(*this, TheCall))
- return ExprError();
- break;
-@@ -1577,7 +1568,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
- break;
- case Builtin::BIsub_group_commit_read_pipe:
- case Builtin::BIsub_group_commit_write_pipe:
-- if (checkOpenCLSubgroupExt(*this, TheCall) ||
-+ if (checkOpenCLSubgroupExtForCallExpr(TheCall) ||
- SemaBuiltinCommitRWPipe(*this, TheCall))
- return ExprError();
- break;
-@@ -4314,6 +4305,20 @@ DiagnoseCStringFormatDirectiveInCFAPI(Sema &S,
- }
- }
-
-+bool Sema::isSupportedOpenCLOMemoryOrdering(int64_t Ordering) const {
-+ assert(llvm::isValidAtomicOrderingCABI(Ordering));
-+ auto OrderingCABI = (llvm::AtomicOrderingCABI)Ordering;
-+ switch (OrderingCABI) {
-+ case llvm::AtomicOrderingCABI::acquire:
-+ case llvm::AtomicOrderingCABI::release:
-+ case llvm::AtomicOrderingCABI::acq_rel:
-+ return OpenCLFeatures.isEnabled("__opencl_c_atomic_order_acq_rel");
-+
-+ default:
-+ return true;
-+ }
-+}
-+
- /// Determine whether the given type has a non-null nullability annotation.
- static bool isNonNullType(ASTContext &ctx, QualType type) {
- if (auto nullability = type->getNullability(ctx))
-@@ -5067,10 +5072,17 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
- if (SubExprs.size() >= 2 && Form != Init) {
- llvm::APSInt Result(32);
- if (SubExprs[1]->isIntegerConstantExpr(Result, Context) &&
-- !isValidOrderingForOp(Result.getSExtValue(), Op))
-+ !isValidOrderingForOp(Result.getSExtValue(), Op)) {
- Diag(SubExprs[1]->getBeginLoc(),
- diag::warn_atomic_op_has_invalid_memory_order)
- << SubExprs[1]->getSourceRange();
-+ } else if (IsOpenCL &&
-+ !isSupportedOpenCLOMemoryOrdering(Result.getSExtValue())) {
-+ Diag(SubExprs[1]->getBeginLoc(),
-+ diag::err_opencl_memory_ordering_require_feat)
-+ << SubExprs[1]->getSourceRange();
-+ return ExprError();
-+ }
- }
-
- if (auto ScopeModel = AtomicExpr::getScopeModel(Op)) {
-diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
-index 64146f4a912f..c1e629b5dc76 100644
---- a/clang/lib/Sema/SemaDecl.cpp
-+++ b/clang/lib/Sema/SemaDecl.cpp
-@@ -6152,7 +6152,9 @@ void Sema::deduceOpenCLAddressSpace(ValueDecl *Decl) {
- if (Type->isSamplerT() || Type->isVoidType())
- return;
- LangAS ImplAS = LangAS::opencl_private;
-- if ((getLangOpts().OpenCLCPlusPlus || getLangOpts().OpenCLVersion >= 200) &&
-+ if ((getLangOpts().OpenCLCPlusPlus ||
-+ getOpenCLOptions().isEnabled(
-+ "__opencl_c_program_scope_global_variables")) &&
- Var->hasGlobalStorage())
- ImplAS = LangAS::opencl_global;
- // If the original type from a decayed type is an array type and that array
-@@ -7682,6 +7684,10 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {
- // OpenCL C v2.0 s6.5.1 - Variables defined at program scope and static
- // variables inside a function can also be declared in the global
- // address space.
-+ // OpenCL C v3.0 s5.5 - For OpenCL C 2.0, or with the
-+ // __opencl_c_program_scope_global_variables feature macro, the
-+ // address space for a variable at program scope or a static variable
-+ // also be __global
- // C++ for OpenCL inherits rule from OpenCL C v2.0.
- // FIXME: Adding local AS in C++ for OpenCL might make sense.
- if (NewVD->isFileVarDecl() || NewVD->isStaticLocal() ||
-@@ -7689,10 +7695,11 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {
- if (!T->isSamplerT() &&
- !(T.getAddressSpace() == LangAS::opencl_constant ||
- (T.getAddressSpace() == LangAS::opencl_global &&
-- (getLangOpts().OpenCLVersion == 200 ||
-- getLangOpts().OpenCLCPlusPlus)))) {
-+ (OpenCLFeatures.isEnabled(
-+ "__opencl_c_program_scope_global_variables"))))) {
- int Scope = NewVD->isStaticLocal() | NewVD->hasExternalStorage() << 1;
-- if (getLangOpts().OpenCLVersion == 200 || getLangOpts().OpenCLCPlusPlus)
-+ if (OpenCLFeatures.isEnabled(
-+ "__opencl_c_program_scope_global_variables"))
- Diag(NewVD->getLocation(), diag::err_opencl_global_invalid_addr_space)
- << Scope << "global or constant";
- else
-diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
-index 849bc09063b3..c963b95b131a 100644
---- a/clang/lib/Sema/SemaDeclAttr.cpp
-+++ b/clang/lib/Sema/SemaDeclAttr.cpp
-@@ -6362,7 +6362,7 @@ static void handleInternalLinkageAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
- }
-
- static void handleOpenCLNoSVMAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
-- if (S.LangOpts.OpenCLVersion != 200)
-+ if (S.LangOpts.OpenCLVersion < 200)
- S.Diag(AL.getLoc(), diag::err_attribute_requires_opencl_version)
- << AL << "2.0" << 0;
- else
-@@ -6446,6 +6446,13 @@ static void handleOpenCLAccessAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
- << AL << PDecl->getType() << DeclTy->isImageType();
- D->setInvalidDecl(true);
- return;
-+ } else if ((!S.getLangOpts().OpenCLCPlusPlus &&
-+ S.getLangOpts().OpenCLVersion >= 200) &&
-+ !S.getOpenCLOptions().isEnabled(
-+ "__opencl_c_read_write_images")) {
-+ S.Diag(AL.getLoc(), diag::err_opencl_requires_extension)
-+ << 0 << PDecl->getType() << "__opencl_c_read_write_images";
-+ return;
- }
- }
- }
-diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
-index 831e55046e80..4481a59b4517 100644
---- a/clang/lib/Sema/SemaDeclCXX.cpp
-+++ b/clang/lib/Sema/SemaDeclCXX.cpp
-@@ -14906,6 +14906,11 @@ CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl,
- if (auto *PtrTy = ResultType->getAs<PointerType>()) {
- ResultType = RemoveAddressSpaceFromPtr(SemaRef, PtrTy);
- }
-+ if (CanQual<PointerType> ExpectedPtrTy =
-+ ExpectedResultType->getAs<PointerType>()) {
-+ ExpectedResultType = SemaRef.Context.getCanonicalType(
-+ RemoveAddressSpaceFromPtr(SemaRef, ExpectedPtrTy->getTypePtr()));
-+ }
- }
-
- // Check that the result type is what we expect.
-@@ -14939,6 +14944,11 @@ CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl,
- FnDecl->getParamDecl(0)->getType()->getAs<PointerType>()) {
- FirstParamType = RemoveAddressSpaceFromPtr(SemaRef, PtrTy);
- }
-+ if (CanQual<PointerType> ExpectedPtrTy =
-+ ExpectedFirstParamType->getAs<PointerType>()) {
-+ ExpectedFirstParamType = SemaRef.Context.getCanonicalType(
-+ RemoveAddressSpaceFromPtr(SemaRef, ExpectedPtrTy->getTypePtr()));
-+ }
- }
- if (SemaRef.Context.getCanonicalType(FirstParamType).getUnqualifiedType() !=
- ExpectedFirstParamType)
-diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
-index 8d96404a5c27..8f21203b9508 100644
---- a/clang/lib/Sema/SemaLookup.cpp
-+++ b/clang/lib/Sema/SemaLookup.cpp
-@@ -771,19 +771,20 @@ static void InsertOCLBuiltinDeclarationsFromTable(Sema &S, LookupResult &LR,
- // as argument. Only meaningful for generic types, otherwise equals 1.
- unsigned GenTypeMaxCnt;
-
-+ ASTContext &Context = S.Context;
-+
-+ // Ignore this BIF if its version does not match the language options.
-+ unsigned OpenCLVersion = Context.getLangOpts().OpenCLVersion;
-+ if (Context.getLangOpts().OpenCLCPlusPlus)
-+ OpenCLVersion = 200;
-+
-+ unsigned short VersionCode = OpenCLOptions::EncodeVersion(OpenCLVersion);
-+
- for (unsigned SignatureIndex = 0; SignatureIndex < Len; SignatureIndex++) {
- const OpenCLBuiltinStruct &OpenCLBuiltin =
- BuiltinTable[FctIndex + SignatureIndex];
-- ASTContext &Context = S.Context;
-
-- // Ignore this BIF if its version does not match the language options.
-- unsigned OpenCLVersion = Context.getLangOpts().OpenCLVersion;
-- if (Context.getLangOpts().OpenCLCPlusPlus)
-- OpenCLVersion = 200;
-- if (OpenCLVersion < OpenCLBuiltin.MinVersion)
-- continue;
-- if ((OpenCLBuiltin.MaxVersion != 0) &&
-- (OpenCLVersion >= OpenCLBuiltin.MaxVersion))
-+ if (!(OpenCLBuiltin.AllVersions & VersionCode))
- continue;
-
- SmallVector<QualType, 1> RetTypes;
-diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
-index 93ddd047e09b..93211b801f8d 100644
---- a/clang/lib/Sema/SemaType.cpp
-+++ b/clang/lib/Sema/SemaType.cpp
-@@ -2016,7 +2016,7 @@ static QualType deduceOpenCLPointeeAddrSpace(Sema &S, QualType PointeeType) {
- !PointeeType.hasAddressSpace())
- PointeeType = S.getASTContext().getAddrSpaceQualType(
- PointeeType,
-- S.getLangOpts().OpenCLCPlusPlus || S.getLangOpts().OpenCLVersion == 200
-+ S.getOpenCLOptions().isEnabled("__opencl_c_generic_address_space")
- ? LangAS::opencl_generic
- : LangAS::opencl_private);
- return PointeeType;
-@@ -5160,9 +5160,15 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
- }
-
- case DeclaratorChunk::Pipe: {
-- T = S.BuildReadPipeType(T, DeclType.Loc);
-- processTypeAttrs(state, T, TAL_DeclSpec,
-- D.getMutableDeclSpec().getAttributes());
-+ if (S.getOpenCLOptions().isEnabled("__opencl_c_pipes")) {
-+ T = S.BuildReadPipeType(T, DeclType.Loc);
-+ processTypeAttrs(state, T, TAL_DeclSpec,
-+ D.getMutableDeclSpec().getAttributes());
-+ } else {
-+ D.setInvalidType(true);
-+ T = Context.IntTy;
-+ S.Diag(D.getIdentifierLoc(), diag::err_opencl_pipes_require_feat);
-+ }
- break;
- }
- }
-diff --git a/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl b/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
-index cdbf28bbcad8..0bedff5ef0f3 100644
---- a/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
-+++ b/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
-@@ -2,7 +2,8 @@
- // RUN: %clang_cc1 %s -emit-llvm -o - -O0 -triple amdgcn | FileCheck -enable-var-scope -check-prefixes=COM,AMDGCN %s
- // RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL2.0 -O0 -triple amdgcn | FileCheck -enable-var-scope -check-prefixes=COM,AMDGCN,AMDGCN20 %s
- // RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL1.2 -O0 -triple spir-unknown-unknown-unknown | FileCheck -enable-var-scope -check-prefixes=SPIR %s
--
-+// RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL3.0 -O0 -triple spir-unknown-unknown-unknown | FileCheck -enable-var-scope -check-prefixes=SPIR %s
-+// RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL3.0 -cl-ext=__opencl_c_program_scope_global_variables -O0 -triple spir-unknown-unknown-unknown | FileCheck -enable-var-scope -check-prefixes=SPIR %s
- typedef int int2 __attribute__((ext_vector_type(2)));
-
- typedef struct {
-@@ -39,7 +40,7 @@ struct LargeStructTwoMember {
- int2 y[20];
- };
-
--#if __OPENCL_C_VERSION__ >= 200
-+#ifdef __opencl_c_program_scope_global_variables
- struct LargeStructOneMember g_s;
- #endif
-
-@@ -98,7 +99,7 @@ void FuncOneLargeMember(struct LargeStructOneMember u) {
- // AMDGCN20: %[[r0:.*]] = bitcast %struct.LargeStructOneMember addrspace(5)* %[[byval_temp]] to i8 addrspace(5)*
- // AMDGCN20: call void @llvm.memcpy.p5i8.p1i8.i64(i8 addrspace(5)* align 8 %[[r0]], i8 addrspace(1)* align 8 bitcast (%struct.LargeStructOneMember addrspace(1)* @g_s to i8 addrspace(1)*), i64 800, i1 false)
- // AMDGCN20: call void @FuncOneLargeMember(%struct.LargeStructOneMember addrspace(5)* byval(%struct.LargeStructOneMember) align 8 %[[byval_temp]])
--#if __OPENCL_C_VERSION__ >= 200
-+#ifdef __opencl_c_program_scope_global_variables
- void test_indirect_arg_globl(void) {
- FuncOneLargeMember(g_s);
- }
-diff --git a/clang/test/CodeGenOpenCL/address-spaces-conversions.cl b/clang/test/CodeGenOpenCL/address-spaces-conversions.cl
-index 52feccc540bb..9ecffcca5ee9 100644
---- a/clang/test/CodeGenOpenCL/address-spaces-conversions.cl
-+++ b/clang/test/CodeGenOpenCL/address-spaces-conversions.cl
-@@ -1,5 +1,7 @@
- // RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -O0 -ffake-address-space-map -cl-std=CL2.0 -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -O0 -ffake-address-space-map -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space -emit-llvm -o - | FileCheck %s
- // RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -O0 -cl-std=CL2.0 -emit-llvm -o - | FileCheck --check-prefix=CHECK-NOFAKE %s
-+// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -O0 -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space -emit-llvm -o - | FileCheck --check-prefix=CHECK-NOFAKE %s
- // When -ffake-address-space-map is not used, all addr space mapped to 0 for x86_64.
-
- // test that we generate address space casts everywhere we need conversions of
-diff --git a/clang/test/CodeGenOpenCL/address-spaces-mangling.cl b/clang/test/CodeGenOpenCL/address-spaces-mangling.cl
-index 50622f099143..e19ec8451d0d 100644
---- a/clang/test/CodeGenOpenCL/address-spaces-mangling.cl
-+++ b/clang/test/CodeGenOpenCL/address-spaces-mangling.cl
-@@ -6,6 +6,7 @@
- // We check that the address spaces are mangled the same in both version of OpenCL
- // RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL2.0 -emit-llvm -o - | FileCheck -check-prefix=OCL-20 %s
- // RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -emit-llvm -o - | FileCheck -check-prefix=OCL-12 %s
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL3.0 -emit-llvm -o - | FileCheck -check-prefix=OCL-12 %s
-
- // We can't name this f as private is equivalent to default
- // no specifier given address space so we get multiple definition
-@@ -47,7 +48,7 @@ void f(constant int *arg) { }
- // OCL-20-DAG: @_Z1fPU3AS2i
- // OCL-12-DAG: @_Z1fPU3AS2i
-
--#if __OPENCL_C_VERSION__ >= 200
-+#if __OPENCL_C_VERSION__ == 200
- __attribute__((overloadable))
- void f(generic int *arg) { }
- // ASMANG20: @_Z1fPU3AS4i
-diff --git a/clang/test/CodeGenOpenCL/address-spaces.cl b/clang/test/CodeGenOpenCL/address-spaces.cl
-index 3c8fea2a80bc..26a741338b3a 100644
---- a/clang/test/CodeGenOpenCL/address-spaces.cl
-+++ b/clang/test/CodeGenOpenCL/address-spaces.cl
-@@ -1,9 +1,13 @@
- // RUN: %clang_cc1 %s -O0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,SPIR
-+// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,SPIR
- // RUN: %clang_cc1 %s -O0 -DCL20 -cl-std=CL2.0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CL20,CL20SPIR
- // RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
-+// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -triple amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
- // RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -DCL20 -cl-std=CL2.0 -emit-llvm -o - | FileCheck %s --check-prefixes=CL20,CL20AMDGCN
- // RUN: %clang_cc1 %s -O0 -triple amdgcn-mesa-mesa3d -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
-+// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -triple amdgcn-mesa-mesa3d -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
- // RUN: %clang_cc1 %s -O0 -triple r600-- -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
-+// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -triple r600-- -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
-
- // SPIR: %struct.S = type { i32, i32, i32* }
- // CL20SPIR: %struct.S = type { i32, i32, i32 addrspace(4)* }
-diff --git a/clang/test/CodeGenOpenCL/amdgcn-automatic-variable.cl b/clang/test/CodeGenOpenCL/amdgcn-automatic-variable.cl
-index 7216cb517495..8d3b30fe8074 100644
---- a/clang/test/CodeGenOpenCL/amdgcn-automatic-variable.cl
-+++ b/clang/test/CodeGenOpenCL/amdgcn-automatic-variable.cl
-@@ -1,4 +1,5 @@
- // RUN: %clang_cc1 -O0 -cl-std=CL1.2 -triple amdgcn---amdgizcl -emit-llvm %s -o - | FileCheck -check-prefixes=CHECK,CL12 %s
-+// RUN: %clang_cc1 -O0 -cl-std=CL3.0 -triple amdgcn---amdgizcl -emit-llvm %s -o - | FileCheck -check-prefixes=CHECK,CL12 %s
- // RUN: %clang_cc1 -O0 -cl-std=CL2.0 -triple amdgcn---amdgizcl -emit-llvm %s -o - | FileCheck -check-prefixes=CHECK,CL20 %s
-
- // CL12-LABEL: define void @func1(i32 addrspace(5)* %x)
-diff --git a/clang/test/CodeGenOpenCL/amdgpu-sizeof-alignof.cl b/clang/test/CodeGenOpenCL/amdgpu-sizeof-alignof.cl
-index a5d438933fa4..8073c7756eb6 100644
---- a/clang/test/CodeGenOpenCL/amdgpu-sizeof-alignof.cl
-+++ b/clang/test/CodeGenOpenCL/amdgpu-sizeof-alignof.cl
-@@ -4,6 +4,17 @@
- // RUN: %clang_cc1 -triple amdgcn---opencl -cl-std=CL2.0 %s -emit-llvm -o - | FileCheck %s
- // RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-std=CL1.2 %s -emit-llvm -o - | FileCheck %s
- // RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-std=CL2.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple r600 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn-mesa-mesa3d -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn---opencl -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn-mesa-mesa3d -cl-ext=__opencl_c_generic_address_space -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn---opencl -cl-ext=__opencl_c_generic_address_space -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-ext=__opencl_c_generic_address_space -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple r600 -cl-ext=__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn-mesa-mesa3d -cl-ext=__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn---opencl -cl-ext=__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-ext=__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-
- #ifdef __AMDGCN__
- #define PTSIZE 8
-@@ -11,7 +22,7 @@
- #define PTSIZE 4
- #endif
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #pragma OPENCL EXTENSION cl_khr_fp64 : enable
- #endif
- #ifdef cl_khr_fp16
-@@ -59,8 +70,12 @@ void test() {
- check(__alignof__(double) == 8);
- #endif
-
-- check(sizeof(void*) == (__OPENCL_C_VERSION__ >= 200 ? 8 : 4));
-- check(__alignof__(void*) == (__OPENCL_C_VERSION__ >= 200 ? 8 : 4));
-+ check(sizeof(private void*) == 4);
-+ check(__alignof__(private void*) == 4);
-+#ifdef __opencl_c_generic_address_space
-+ check(sizeof(generic void*) == 8);
-+ check(__alignof__(generic void*) == 8);
-+#endif
- check(sizeof(global_ptr_t) == PTSIZE);
- check(__alignof__(global_ptr_t) == PTSIZE);
- check(sizeof(constant_ptr_t) == PTSIZE);
-diff --git a/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl b/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl
-index d1ab6aceac5c..70c5bace023b 100644
---- a/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl
-+++ b/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl
-@@ -1,4 +1,5 @@
- // RUN: %clang_cc1 %s -triple spir-unknown-unknown -finclude-default-header -cl-std=CL1.2 -emit-llvm -o - -O0 | FileCheck %s
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -finclude-default-header -cl-std=CL3.0 -emit-llvm -o - -O0 | FileCheck %s
-
- #pragma OPENCL EXTENSION cl_arm_integer_dot_product_int8 : enable
- void test_int8(uchar4 ua, uchar4 ub, char4 sa, char4 sb) {
-diff --git a/clang/test/CodeGenOpenCL/cl-uniform-wg-size.cl b/clang/test/CodeGenOpenCL/cl-uniform-wg-size.cl
-index 76ace5dca21e..5dc43e222f75 100644
---- a/clang/test/CodeGenOpenCL/cl-uniform-wg-size.cl
-+++ b/clang/test/CodeGenOpenCL/cl-uniform-wg-size.cl
-@@ -1,6 +1,8 @@
- // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL1.2 -o - %s 2>&1 | FileCheck %s -check-prefixes CHECK,CHECK-UNIFORM
- // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s 2>&1 | FileCheck %s -check-prefixes CHECK,CHECK-NONUNIFORM
- // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -cl-uniform-work-group-size -o - %s 2>&1 | FileCheck %s -check-prefixes CHECK,CHECK-UNIFORM
-+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL3.0 -o - %s 2>&1 | FileCheck %s -check-prefixes CHECK,CHECK-NONUNIFORM
-+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL3.0 -cl-uniform-work-group-size -o - %s 2>&1 | FileCheck %s -check-prefixes CHECK,CHECK-UNIFORM
-
- kernel void ker() {};
- // CHECK: define{{.*}}@ker() #0
-diff --git a/clang/test/CodeGenOpenCL/fpmath.cl b/clang/test/CodeGenOpenCL/fpmath.cl
-index 0108d909c94e..b28392739c71 100644
---- a/clang/test/CodeGenOpenCL/fpmath.cl
-+++ b/clang/test/CodeGenOpenCL/fpmath.cl
-@@ -2,6 +2,8 @@
- // RUN: %clang_cc1 %s -emit-llvm -o - -triple spir-unknown-unknown -cl-fp32-correctly-rounded-divide-sqrt | FileCheck --check-prefix=CHECK --check-prefix=DIVOPT %s
- // RUN: %clang_cc1 %s -emit-llvm -o - -DNOFP64 -cl-std=CL1.2 -triple r600-unknown-unknown -target-cpu r600 -pedantic | FileCheck --check-prefix=CHECK-FLT %s
- // RUN: %clang_cc1 %s -emit-llvm -o - -DFP64 -cl-std=CL1.2 -triple spir-unknown-unknown -pedantic | FileCheck --check-prefix=CHECK-DBL %s
-+// RUN: %clang_cc1 %s -emit-llvm -o - -DNOFP64 -cl-std=CL3.0 -triple r600-unknown-unknown -target-cpu r600 -pedantic | FileCheck --check-prefix=CHECK-FLT %s
-+// RUN: %clang_cc1 %s -emit-llvm -o - -DFP64 -cl-std=CL3.0 -cl-ext=__opencl_c_fp64 -triple spir-unknown-unknown -pedantic | FileCheck --check-prefix=CHECK-DBL %s
-
- typedef __attribute__(( ext_vector_type(4) )) float float4;
-
-diff --git a/clang/test/CodeGenOpenCL/generic-address-space-feature.cl b/clang/test/CodeGenOpenCL/generic-address-space-feature.cl
-new file mode 100644
-index 000000000000..890860abe4d9
---- /dev/null
-+++ b/clang/test/CodeGenOpenCL/generic-address-space-feature.cl
-@@ -0,0 +1,28 @@
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -cl-std=CL1.2 -cl-ext=-cl_khr_fp64 -finclude-default-header -emit-llvm -o - | FileCheck %s --check-prefixes=CL12
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -cl-std=CL1.2 -cl-ext=-cl_khr_fp64 -fdeclare-opencl-builtins -emit-llvm -o - | FileCheck %s --check-prefixes=CL12
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -cl-std=CL2.0 -cl-ext=-cl_khr_fp64 -finclude-default-header -emit-llvm -o - | FileCheck %s --check-prefixes=CL20
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -cl-std=CL2.0 -cl-ext=-cl_khr_fp64 -fdeclare-opencl-builtins -emit-llvm -o - | FileCheck %s --check-prefixes=CL20
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -cl-std=CL3.0 -cl-ext=-cl_khr_fp64 -finclude-default-header -emit-llvm -o - | FileCheck %s --check-prefixes=CL30
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -cl-std=CL3.0 -cl-ext=-cl_khr_fp64,__opencl_c_generic_address_space -finclude-default-header -emit-llvm -o - | FileCheck %s --check-prefixes=CL30-GENERIC
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -cl-std=CL3.0 -cl-ext=-cl_khr_fp64 -fdeclare-opencl-builtins -emit-llvm -o - | FileCheck %s --check-prefixes=CL30
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -cl-std=CL3.0 -cl-ext=-cl_khr_fp64,__opencl_c_generic_address_space -fdeclare-opencl-builtins -emit-llvm -o - | FileCheck %s --check-prefixes=CL30-GENERIC
-+
-+void test(global float* src1, local float *src2, private float *src3, float *src4, float tmp) {
-+ // CL20: %{{.+}} = addrspacecast float addrspace(1)* %{{.+}} to float addrspace(4)*
-+ // CL12-NOT: addrspacecast
-+ // CL30-NOT: addrspacecast
-+ // CL30-GENERIC-NOT: addrspacecast
-+ tmp = sincos(tmp, src1);
-+ // CL20: %{{.+}} = addrspacecast float addrspace(3)* %{{.+}} to float addrspace(4)*
-+ // CL12-NOT: addrspacecast
-+ // CL30-NOT: addrspacecast
-+ // CL30-GENERIC-NOT: addrspacecast
-+ tmp = sincos(tmp, src2);
-+
-+ // CL12: %{{.+}} = call {{(spir_func )?}}float [[FUNCNAME:@.*sincos.*]](float %{{.+}}, float* {{.+}})
-+ // CL20: %{{.+}} = call {{(spir_func )?}}float [[FUNCNAME:@.*sincos.*]](float %{{.+}}, float addrspace(4)* {{.+}})
-+ // CL30: %{{.+}} = call {{(spir_func )?}}float [[FUNCNAME:@.*sincos.*]](float %{{.+}}, float* {{.+}})
-+ // CL30-GENERIC: %{{.+}} = call {{(spir_func )?}}float [[FUNCNAME:@.*sincos.*]](float %{{.+}}, float addrspace(4)* {{.+}})
-+ // CHECK: addrspacecast
-+ tmp = sincos(tmp, src4);
-+}
-diff --git a/clang/test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl b/clang/test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl
-index 515f13f6e768..5aa31ac6f345 100644
---- a/clang/test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl
-+++ b/clang/test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl
-@@ -1,4 +1,5 @@
- // RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -cl-ext=+cl_intel_device_side_avc_motion_estimation -emit-llvm -o - -O0 | FileCheck %s
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL3.0 -cl-ext=+cl_intel_device_side_avc_motion_estimation -emit-llvm -o - -O0 | FileCheck %s
-
- // CHECK: %opencl.intel_sub_group_avc_mce_payload_t = type opaque
- // CHECK: %opencl.intel_sub_group_avc_ime_payload_t = type opaque
-diff --git a/clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl b/clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl
-index e89237623478..3d6708ac361f 100644
---- a/clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl
-+++ b/clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl
-@@ -1,5 +1,8 @@
- // RUN: %clang_cc1 %s -cl-std=CL1.2 -emit-llvm -triple x86_64-unknown-unknown -o - | FileCheck %s
- // RUN: %clang_cc1 %s -cl-std=CL1.2 -emit-llvm -triple amdgcn-unknown-unknown -o - | FileCheck -check-prefixes=AMDGCN %s
-+// RUN: %clang_cc1 %s -cl-std=CL3.0 -cl-ext=__opencl_c_fp64 -emit-llvm -triple x86_64-unknown-unknown -o - | FileCheck %s
-+// RUN: %clang_cc1 %s -cl-std=CL3.0 -cl-ext=__opencl_c_fp64 -emit-llvm -triple amdgcn-unknown-unknown -o - | FileCheck -check-prefixes=AMDGCN %s
-+
- // Test that the kernels always use the SPIR calling convention
- // to have unambiguous mapping of arguments to feasibly implement
- // clSetKernelArg().
-diff --git a/clang/test/CodeGenOpenCL/logical-ops.cl b/clang/test/CodeGenOpenCL/logical-ops.cl
-index f083a8580ee7..499eab65039b 100644
---- a/clang/test/CodeGenOpenCL/logical-ops.cl
-+++ b/clang/test/CodeGenOpenCL/logical-ops.cl
-@@ -1,4 +1,5 @@
- // RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL1.2 -O1 -triple x86_64-unknown-linux-gnu | FileCheck %s
-+// RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL3.0 -cl-ext=__opencl_c_fp64 -O1 -triple x86_64-unknown-linux-gnu | FileCheck %s
- // RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=clc++ -O1 -triple x86_64-unknown-linux-gnu | FileCheck %s
-
- #pragma OPENCL EXTENSION cl_khr_fp64 : enable
-diff --git a/clang/test/CodeGenOpenCL/no-half.cl b/clang/test/CodeGenOpenCL/no-half.cl
-index aee8f678f01a..46da7fa339e8 100644
---- a/clang/test/CodeGenOpenCL/no-half.cl
-+++ b/clang/test/CodeGenOpenCL/no-half.cl
-@@ -1,6 +1,7 @@
- // RUN: %clang_cc1 %s -cl-std=cl2.0 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
- // RUN: %clang_cc1 %s -cl-std=cl1.2 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
- // RUN: %clang_cc1 %s -cl-std=cl1.1 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
-+// RUN: %clang_cc1 %s -cl-std=cl3.0 -cl-ext=__opencl_c_fp64 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
-
- #pragma OPENCL EXTENSION cl_khr_fp64:enable
-
-diff --git a/clang/test/CodeGenOpenCL/pipe_builtin.cl b/clang/test/CodeGenOpenCL/pipe_builtin.cl
-index 02b9669b7ab1..0bf35c336199 100644
---- a/clang/test/CodeGenOpenCL/pipe_builtin.cl
-+++ b/clang/test/CodeGenOpenCL/pipe_builtin.cl
-@@ -1,4 +1,7 @@
- // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -cl-ext=+cl_khr_subgroups -O0 -cl-std=clc++ -o - %s | FileCheck %s
-+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -cl-ext=+cl_khr_subgroups -O0 -cl-std=cl2.0 -o - %s | FileCheck %s
-+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -cl-ext=+cl_khr_subgroups -O0 -cl-std=cl3.0 -cl-ext=__opencl_c_pipes,__opencl_c_subgroups -o - %s | FileCheck %s
-+
- // FIXME: Add MS ABI manglings of OpenCL things and remove %itanium_abi_triple
- // above to support OpenCL in the MS C++ ABI.
-
-diff --git a/clang/test/CodeGenOpenCL/pipe_types.cl b/clang/test/CodeGenOpenCL/pipe_types.cl
-index ba064c6d7557..b7a523d4f084 100644
---- a/clang/test/CodeGenOpenCL/pipe_types.cl
-+++ b/clang/test/CodeGenOpenCL/pipe_types.cl
-@@ -1,4 +1,5 @@
- // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
-+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -o - %s | FileCheck %s
-
- // CHECK: %opencl.pipe_ro_t = type opaque
- // CHECK: %opencl.pipe_wo_t = type opaque
-diff --git a/clang/test/CodeGenOpenCL/printf.cl b/clang/test/CodeGenOpenCL/printf.cl
-index fc139d776db6..0133c5595d81 100644
---- a/clang/test/CodeGenOpenCL/printf.cl
-+++ b/clang/test/CodeGenOpenCL/printf.cl
-@@ -1,5 +1,7 @@
- // RUN: %clang_cc1 -cl-std=CL1.2 -cl-ext=-+cl_khr_fp64 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=FP64,ALL %s
- // RUN: %clang_cc1 -cl-std=CL1.2 -cl-ext=-cl_khr_fp64 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=NOFP64,ALL %s
-+// RUN: %clang_cc1 -cl-std=CL3.0 -cl-ext=+__opencl_c_fp64 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=FP64,ALL %s
-+// RUN: %clang_cc1 -cl-std=CL3.0 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=NOFP64,ALL %s
-
- typedef __attribute__((ext_vector_type(2))) float float2;
- typedef __attribute__((ext_vector_type(2))) half half2;
-diff --git a/clang/test/CodeGenOpenCL/unroll-hint.cl b/clang/test/CodeGenOpenCL/unroll-hint.cl
-index 0f84450a1ae6..9347c935869b 100644
---- a/clang/test/CodeGenOpenCL/unroll-hint.cl
-+++ b/clang/test/CodeGenOpenCL/unroll-hint.cl
-@@ -1,5 +1,6 @@
- // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
- // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL1.2 -o - %s | FileCheck %s
-+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL3.0 -o - %s | FileCheck %s
-
- /*** for ***/
- void for_count()
-diff --git a/clang/test/Driver/autocomplete.c b/clang/test/Driver/autocomplete.c
-index 5c0bfb69f9a3..eabdf0b5938d 100644
---- a/clang/test/Driver/autocomplete.c
-+++ b/clang/test/Driver/autocomplete.c
-@@ -43,6 +43,8 @@
- // CLSTDALL-NEXT: CL1.2
- // CLSTDALL-NEXT: cl2.0
- // CLSTDALL-NEXT: CL2.0
-+// CLSTDALL-NEXT: cl3.0
-+// CLSTDALL-NEXT: CL3.0
- // CLSTDALL-NEXT: clc++
- // CLSTDALL-NEXT: CLC++
- // RUN: %clang --autocomplete=-fno-sanitize-coverage=,f | FileCheck %s -check-prefix=FNOSANICOVER
-diff --git a/clang/test/Driver/opencl.cl b/clang/test/Driver/opencl.cl
-index 63b04bc1af41..ffdd4f7d65bb 100644
---- a/clang/test/Driver/opencl.cl
-+++ b/clang/test/Driver/opencl.cl
-@@ -2,6 +2,7 @@
- // RUN: %clang -S -### -cl-std=CL1.1 %s 2>&1 | FileCheck --check-prefix=CHECK-CL11 %s
- // RUN: %clang -S -### -cl-std=CL1.2 %s 2>&1 | FileCheck --check-prefix=CHECK-CL12 %s
- // RUN: %clang -S -### -cl-std=CL2.0 %s 2>&1 | FileCheck --check-prefix=CHECK-CL20 %s
-+// RUN: %clang -S -### -cl-std=CL3.0 %s 2>&1 | FileCheck --check-prefix=CHECK-CL30 %s
- // RUN: %clang -S -### -cl-std=clc++ %s 2>&1 | FileCheck --check-prefix=CHECK-CLCPP %s
- // RUN: %clang -S -### -cl-opt-disable %s 2>&1 | FileCheck --check-prefix=CHECK-OPT-DISABLE %s
- // RUN: %clang -S -### -cl-strict-aliasing %s 2>&1 | FileCheck --check-prefix=CHECK-STRICT-ALIASING %s
-@@ -22,6 +23,7 @@
- // CHECK-CL11: "-cc1" {{.*}} "-cl-std=CL1.1"
- // CHECK-CL12: "-cc1" {{.*}} "-cl-std=CL1.2"
- // CHECK-CL20: "-cc1" {{.*}} "-cl-std=CL2.0"
-+// CHECK-CL30: "-cc1" {{.*}} "-cl-std=CL3.0"
- // CHECK-CLCPP: "-cc1" {{.*}} "-cl-std=clc++"
- // CHECK-OPT-DISABLE: "-cc1" {{.*}} "-cl-opt-disable"
- // CHECK-STRICT-ALIASING: "-cc1" {{.*}} "-cl-strict-aliasing"
-diff --git a/clang/test/Driver/unknown-std.cl b/clang/test/Driver/unknown-std.cl
-index 6f371bac13ac..00209fb62556 100644
---- a/clang/test/Driver/unknown-std.cl
-+++ b/clang/test/Driver/unknown-std.cl
-@@ -10,6 +10,7 @@
- // CHECK-NEXT: note: use 'cl1.1' for 'OpenCL 1.1' standard
- // CHECK-NEXT: note: use 'cl1.2' for 'OpenCL 1.2' standard
- // CHECK-NEXT: note: use 'cl2.0' for 'OpenCL 2.0' standard
-+// CHECK-NEXT: note: use 'cl3.0' for 'OpenCL 3.0' standard
- // CHECK-NEXT: note: use 'clc++' for 'C++ for OpenCL' standard
-
- // Make sure that no other output is present.
-diff --git a/clang/test/Frontend/stdlang.c b/clang/test/Frontend/stdlang.c
-index 51484999e37a..eac4632fbdd6 100644
---- a/clang/test/Frontend/stdlang.c
-+++ b/clang/test/Frontend/stdlang.c
-@@ -9,6 +9,7 @@
- // RUN: %clang_cc1 -x cl -cl-std=CL1.1 -DOPENCL %s
- // RUN: %clang_cc1 -x cl -cl-std=CL1.2 -DOPENCL %s
- // RUN: %clang_cc1 -x cl -cl-std=CL2.0 -DOPENCL %s
-+// RUN: %clang_cc1 -x cl -cl-std=CL3.0 -DOPENCL %s
- // RUN: %clang_cc1 -x cl -cl-std=CLC++ -DOPENCL %s
- // RUN: not %clang_cc1 -x cl -std=c99 -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-C99 %s
- // RUN: not %clang_cc1 -x cl -cl-std=invalid -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID %s
-diff --git a/clang/test/Headers/opencl-c-header.cl b/clang/test/Headers/opencl-c-header.cl
-index 1b151ffdd16a..2716076acdcf 100644
---- a/clang/test/Headers/opencl-c-header.cl
-+++ b/clang/test/Headers/opencl-c-header.cl
-@@ -1,6 +1,7 @@
- // RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -verify | FileCheck %s
- // RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -verify -cl-std=CL1.1 | FileCheck %s
- // RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -verify -cl-std=CL1.2 | FileCheck %s
-+// RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -verify -cl-std=CL3.0 | FileCheck %s
- // RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -verify -cl-std=clc++ | FileCheck %s --check-prefix=CHECK20
-
- // Test including the default header as a module.
-@@ -39,9 +40,11 @@
- // RUN: rm -rf %t
- // RUN: mkdir -p %t
- // RUN: %clang_cc1 -triple spir64-unknown-unknown -emit-llvm -o - -cl-std=CL1.2 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-MOD %s
-+// RUN: %clang_cc1 -triple spir64-unknown-unknown -emit-llvm -o - -cl-std=CL3.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-MOD %s
- // RUN: %clang_cc1 -triple amdgcn--amdhsa -O0 -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK20 --check-prefix=CHECK-MOD %s
- // RUN: chmod u-w %t
- // RUN: %clang_cc1 -triple spir64-unknown-unknown -emit-llvm -o - -cl-std=CL1.2 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-MOD %s
-+// RUN: %clang_cc1 -triple spir64-unknown-unknown -emit-llvm -o - -cl-std=CL3.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-MOD %s
- // RUN: %clang_cc1 -triple amdgcn--amdhsa -O0 -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK20 --check-prefix=CHECK-MOD %s
- // RUN: chmod u+w %t
-
-@@ -67,7 +70,7 @@ char f(char x) {
- // from OpenCL 2.0 onwards.
-
- // CHECK20: _Z12write_imagef14ocl_image3d_wo
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
- void test_image3dwo(write_only image3d_t img) {
- write_imagef(img, (0), (0.0f));
- }
-@@ -81,7 +84,7 @@ void test_atomics(__generic volatile unsigned int* a) {
- #endif
-
- // Verify that ATOMIC_VAR_INIT is defined.
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
- global atomic_int z = ATOMIC_VAR_INIT(99);
- #endif //__OPENCL_C_VERSION__
-
-diff --git a/clang/test/Index/pipe-size.cl b/clang/test/Index/pipe-size.cl
-index 94a1255f0a48..59b76051eda1 100644
---- a/clang/test/Index/pipe-size.cl
-+++ b/clang/test/Index/pipe-size.cl
-@@ -2,6 +2,13 @@
- // RUN: %clang_cc1 -x cl -O0 -cl-std=CL2.0 -emit-llvm -triple spir-unknown-unknown %s -o - | FileCheck %s --check-prefix=SPIR
- // RUN: %clang_cc1 -x cl -O0 -cl-std=CL2.0 -emit-llvm -triple spir64-unknown-unknown %s -o - | FileCheck %s --check-prefix=SPIR64
- // RUN: %clang_cc1 -x cl -O0 -cl-std=CL2.0 -emit-llvm -triple amdgcn-amd-amdhsa %s -o - | FileCheck %s --check-prefix=AMDGCN
-+// RUN: %clang_cc1 -x cl -O0 -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -emit-llvm -triple x86_64-unknown-linux-gnu %s -o - | FileCheck %s --check-prefix=X86
-+// RUN: %clang_cc1 -x cl -O0 -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -emit-llvm -triple spir-unknown-unknown %s -o - | FileCheck %s --check-prefix=SPIR
-+// RUN: %clang_cc1 -x cl -O0 -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -emit-llvm -triple spir64-unknown-unknown %s -o - | FileCheck %s --check-prefix=SPIR64
-+// RUN: %clang_cc1 -x cl -O0 -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -emit-llvm -triple amdgcn-amd-amdhsa %s -o - | FileCheck %s --check-prefix=AMDGCN
-+
-+
-+
- __kernel void testPipe( pipe int test )
- {
- int s = sizeof(test);
-diff --git a/clang/test/Preprocessor/predefined-macros.c b/clang/test/Preprocessor/predefined-macros.c
-index def105f4c52e..b088a37ba665 100644
---- a/clang/test/Preprocessor/predefined-macros.c
-+++ b/clang/test/Preprocessor/predefined-macros.c
-@@ -129,6 +129,8 @@
- // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL12
- // RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=CL2.0 \
- // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL20
-+// RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=CL3.0 \
-+// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL30
- // RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-fast-relaxed-math \
- // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-FRM
- // RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=clc++ \
-@@ -137,26 +139,37 @@
- // CHECK-CL10: #define CL_VERSION_1_1 110
- // CHECK-CL10: #define CL_VERSION_1_2 120
- // CHECK-CL10: #define CL_VERSION_2_0 200
-+// CHECK-CL10: #define CL_VERSION_3_0 300
- // CHECK-CL10: #define __OPENCL_C_VERSION__ 100
- // CHECK-CL10-NOT: #define __FAST_RELAXED_MATH__ 1
- // CHECK-CL11: #define CL_VERSION_1_0 100
- // CHECK-CL11: #define CL_VERSION_1_1 110
- // CHECK-CL11: #define CL_VERSION_1_2 120
- // CHECK-CL11: #define CL_VERSION_2_0 200
-+// CHECK-CL11: #define CL_VERSION_3_0 300
- // CHECK-CL11: #define __OPENCL_C_VERSION__ 110
- // CHECK-CL11-NOT: #define __FAST_RELAXED_MATH__ 1
- // CHECK-CL12: #define CL_VERSION_1_0 100
- // CHECK-CL12: #define CL_VERSION_1_1 110
- // CHECK-CL12: #define CL_VERSION_1_2 120
- // CHECK-CL12: #define CL_VERSION_2_0 200
-+// CHECK-CL12: #define CL_VERSION_3_0 300
- // CHECK-CL12: #define __OPENCL_C_VERSION__ 120
- // CHECK-CL12-NOT: #define __FAST_RELAXED_MATH__ 1
- // CHECK-CL20: #define CL_VERSION_1_0 100
- // CHECK-CL20: #define CL_VERSION_1_1 110
- // CHECK-CL20: #define CL_VERSION_1_2 120
- // CHECK-CL20: #define CL_VERSION_2_0 200
-+// CHECK-CL20: #define CL_VERSION_3_0 300
- // CHECK-CL20: #define __OPENCL_C_VERSION__ 200
- // CHECK-CL20-NOT: #define __FAST_RELAXED_MATH__ 1
-+// CHECK-CL30: #define CL_VERSION_1_0 100
-+// CHECK-CL30: #define CL_VERSION_1_1 110
-+// CHECK-CL30: #define CL_VERSION_1_2 120
-+// CHECK-CL30: #define CL_VERSION_2_0 200
-+// CHECK-CL30: #define CL_VERSION_3_0 300
-+// CHECK-CL30: #define __OPENCL_C_VERSION__ 300
-+// CHECK-CL30-NOT: #define __FAST_RELAXED_MATH__ 1
- // CHECK-FRM: #define __FAST_RELAXED_MATH__ 1
- // CHECK-CLCPP10: #define __CL_CPP_VERSION_1_0__ 100
- // CHECK-CLCPP10: #define __OPENCL_CPP_VERSION__ 100
-diff --git a/clang/test/Sema/feature-extensions-simult-support.cl b/clang/test/Sema/feature-extensions-simult-support.cl
-new file mode 100644
-index 000000000000..0789105002b2
---- /dev/null
-+++ b/clang/test/Sema/feature-extensions-simult-support.cl
-@@ -0,0 +1,75 @@
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=-cl_khr_fp64
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=+cl_khr_fp64
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=-cl_khr_3d_image_writes
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=+cl_khr_3d_image_writes
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=-cl_khr_subgroups
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=+cl_khr_subgroups
-+
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=-cl_khr_fp64
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_fp64
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=-cl_khr_3d_image_writes
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_3d_image_writes
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=-cl_khr_subgroups
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_subgroups
-+
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_fp64
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_3d_image_writes
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_subgroups
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_pipes
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_device_enqueue
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_read_write_images
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_fp64,-cl_khr_fp64
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_3d_image_writes,-cl_khr_3d_image_writes
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_subgroups,-cl_khr_subgroups
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+cl_khr_fp64
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+cl_khr_3d_image_writes
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+cl_khr_subgroups
-+
-+// expected-no-diagnostics
-+
-+#ifdef cl_khr_fp64
-+ #ifndef __opencl_c_fp64
-+ #error macros were not properly set up
-+ #endif
-+#endif
-+#ifdef __opencl_c_fp64
-+ #ifndef cl_khr_fp64
-+ #error macros were not properly set up
-+ #endif
-+#endif
-+
-+#ifdef cl_khr_3d_image_writes
-+ #ifndef __opencl_c_3d_image_writes
-+ #error macros were not properly set up
-+ #endif
-+#endif
-+#ifdef __opencl_c_3d_image_writes
-+ #ifndef cl_khr_3d_image_writes
-+ #error macros were not properly set up
-+ #endif
-+#endif
-+
-+#ifdef cl_khr_subgroups
-+ #ifndef __opencl_c_subgroups
-+ #error macros were not properly set up
-+ #endif
-+#endif
-+#ifdef __opencl_c_subgroups
-+ #ifndef cl_khr_subgroups
-+ #error macros were not properly set up
-+ #endif
-+#endif
-+
-+#if defined(__opencl_c_pipes) || defined(__opencl_c_device_enqueue)
-+ #ifndef __opencl_c_generic_address_space
-+ #error macros were not properly set up
-+ #endif
-+#endif
-+
-+#if defined(__opencl_c_3d_image_writes) || defined(__opencl_c_read_write_images)
-+ #ifndef __opencl_c_images
-+ #error macros were not properly set up
-+ #endif
-+#endif
-+
-+kernel void test(){}
-diff --git a/clang/test/Sema/features-ignore-pragma.cl b/clang/test/Sema/features-ignore-pragma.cl
-new file mode 100644
-index 000000000000..046ce5390754
---- /dev/null
-+++ b/clang/test/Sema/features-ignore-pragma.cl
-@@ -0,0 +1,24 @@
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_fp64
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_subgroups
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_3d_image_writes
-+
-+#pragma OPENCL EXTENSION __opencl_c_fp64 : enable
-+// expected-warning@-1 {{OpenCL feature support can't be controlled via pragma, ignoring}}
-+
-+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-+#ifndef __opencl_c_fp64
-+// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_fp64' - ignoring}}
-+#endif
-+
-+#pragma OPENCL EXTENSION cl_khr_subgroups : enable
-+#ifndef __opencl_c_subgroups
-+// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_subgroups' - ignoring}}
-+#endif
-+
-+#pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable
-+#ifndef __opencl_c_3d_image_writes
-+// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_3d_image_writes' - ignoring}}
-+#endif
-+
-+kernel void foo() {}
-diff --git a/clang/test/Sema/opencl-features-pipes.cl b/clang/test/Sema/opencl-features-pipes.cl
-new file mode 100644
-index 000000000000..c0ac778f24a6
---- /dev/null
-+++ b/clang/test/Sema/opencl-features-pipes.cl
-@@ -0,0 +1,18 @@
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.1
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -DHAS
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -DHAS
-+// expected-no-diagnostics
-+
-+#ifdef HAS
-+ #ifndef __opencl_c_pipes
-+ #error Feature should be defined
-+ #endif
-+#else
-+ #ifdef __opencl_c_pipes
-+ #error Feature should not be defined
-+ #endif
-+#endif
-+
-+kernel void foo() {}
-diff --git a/clang/test/Sema/opencl-features.cl b/clang/test/Sema/opencl-features.cl
-new file mode 100644
-index 000000000000..aa432f6b60bf
---- /dev/null
-+++ b/clang/test/Sema/opencl-features.cl
-@@ -0,0 +1,128 @@
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=-__opencl_c_device_enqueue,-__opencl_c_pipes,-__opencl_c_read_write_images
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CLC++
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0
-+// expected-no-diagnostics
-+
-+#ifndef __opencl_c_int64
-+ #error Feature __opencl_c_int64 shouldn't be defined
-+#endif
-+
-+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
-+ #ifndef __opencl_c_3d_image_writes
-+ #error Feature __opencl_c_3d_image_writes should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_atomic_order_acq_rel
-+ #error Feature __opencl_c_atomic_order_acq_rel should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_atomic_order_seq_cst
-+ #error Feature __opencl_c_atomic_order_seq_cst should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_atomic_scope_device
-+ #error Feature __opencl_c_atomic_scope_device should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_atomic_scope_all_devices
-+ #error Feature __opencl_c_atomic_scope_all_devices should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_device_enqueue
-+ #error Feature __opencl_c_device_enqueue should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_generic_address_space
-+ #error Feature __opencl_c_generic_address_space should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_pipes
-+ #error Feature __opencl_c_pipes should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_program_scope_global_variables
-+ #error Feature __opencl_c_program_scope_global_variables should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_read_write_images
-+ #error Feature __opencl_c_read_write_images should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_subgroups
-+ #error Feature __opencl_c_subgroups should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_work_group_collective_functions
-+ #error Feature __opencl_c_work_group_collective_functions should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_fp64
-+ #error Feature __opencl_c_fp64 should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_images
-+ #error Feature __opencl_c_images should be defined
-+ #endif
-+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+
-+
-+#if __OPENCL_C_VERSION__ == CL_VERSION_3_0
-+ #ifdef __opencl_c_3d_image_writes
-+ #error Feature __opencl_c_3d_image_writes shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_atomic_order_acq_rel
-+ #error Feature __opencl_c_atomic_order_acq_rel shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_atomic_order_seq_cst
-+ #error Feature __opencl_c_atomic_order_seq_cst shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_atomic_scope_device
-+ #error Feature __opencl_c_atomic_scope_device shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_atomic_scope_all_devices
-+ #error Feature __opencl_c_atomic_scope_all_devices shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_device_enqueue
-+ #error Feature __opencl_c_device_enqueue shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_generic_address_space
-+ #error Feature __opencl_c_generic_address_space shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_pipes
-+ #error Feature __opencl_c_pipes shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_program_scope_global_variables
-+ #error Feature __opencl_c_program_scope_global_variables shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_read_write_images
-+ #error Feature __opencl_c_read_write_images shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_subgroups
-+ #error Feature __opencl_c_subgroups shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_work_group_collective_functions
-+ #error Feature __opencl_c_work_group_collective_functions shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_fp64
-+ #error Feature __opencl_c_fp64 shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_images
-+ #error Feature __opencl_c_images shouldn't be defined
-+ #endif
-+#endif // __OPENCL_C_VERSION__ == CL_VERSION_3_0
-+
-+kernel void foo() {}
-diff --git a/clang/test/Sema/pipe_builtins_feature.cl b/clang/test/Sema/pipe_builtins_feature.cl
-new file mode 100644
-index 000000000000..56fa94fc7705
---- /dev/null
-+++ b/clang/test/Sema/pipe_builtins_feature.cl
-@@ -0,0 +1,21 @@
-+// RUN: %clang_cc1 -cl-std=CL2.0 -fsyntax-only -verify %s
-+// RUN: %clang_cc1 -cl-std=CL3.0 -fsyntax-only -verify %s
-+// RUN: %clang_cc1 -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -fsyntax-only -verify %s
-+
-+#ifdef __opencl_c_pipes
-+ #ifndef __opencl_c_generic_address_space
-+ #error Generic address space feature must also be defined
-+ #endif
-+// CHECK: expected-no-diagnostics
-+// check that pragma disable all doesn't touch feature support
-+ #pragma OPENCL EXTENSION all : disable
-+#endif
-+
-+void test(read_only pipe int p, global int *ptr) {
-+ reserve_id_t rid;
-+}
-+
-+#ifndef __opencl_c_pipes
-+// expected-error@-5 {{expected parameter declarator}} expected-error@-5 {{expected ')'}} expected-note@-5 {{to match this '('}}
-+// expected-error@-5 {{use of type 'reserve_id_t' requires __opencl_c_pipes extension to be enabled}}
-+#endif
-diff --git a/clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl b/clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
-index 5efea216346a..09aea27ae6de 100644
---- a/clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
-+++ b/clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
-@@ -1,6 +1,9 @@
- // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std=CL2.0
- // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std=CL2.0
- // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std=CL2.0
-+// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space
-+// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space
-+// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space
- // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std=clc++
- // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std=clc++
- // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std=clc++
-diff --git a/clang/test/SemaOpenCL/address-spaces.cl b/clang/test/SemaOpenCL/address-spaces.cl
-index 07547ea19680..e367a7c57292 100644
---- a/clang/test/SemaOpenCL/address-spaces.cl
-+++ b/clang/test/SemaOpenCL/address-spaces.cl
-@@ -1,5 +1,6 @@
- // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
- // RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only
-+// RUN: %clang_cc1 %s -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space -verify -pedantic -fsyntax-only
- // RUN: %clang_cc1 %s -cl-std=clc++ -verify -pedantic -fsyntax-only
-
- __constant int ci = 1;
-diff --git a/clang/test/SemaOpenCL/cl20-device-side-enqueue.cl b/clang/test/SemaOpenCL/cl20-device-side-enqueue.cl
-index f63e2913c749..727141190a0b 100644
---- a/clang/test/SemaOpenCL/cl20-device-side-enqueue.cl
-+++ b/clang/test/SemaOpenCL/cl20-device-side-enqueue.cl
-@@ -2,6 +2,12 @@
- // RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir-unknown-unknown" -verify -pedantic -fsyntax-only -DB32 -DQUALS="const volatile"
- // RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS=
- // RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS="const volatile"
-+// RUN: %clang_cc1 %s -cl-std=CL3.0 -triple "spir-unknown-unknown" -cl-ext=__opencl_c_device_enqueue,__opencl_c_subgroups -verify -pedantic -fsyntax-only -DB32 -DQUALS=
-+// RUN: %clang_cc1 %s -cl-std=CL3.0 -triple "spir-unknown-unknown" -cl-ext=__opencl_c_device_enqueue,__opencl_c_subgroups -verify -pedantic -fsyntax-only -DB32 -DQUALS="const volatile"
-+// RUN: %clang_cc1 %s -cl-std=CL3.0 -triple "spir64-unknown-unknown" -cl-ext=__opencl_c_device_enqueue,__opencl_c_subgroups -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS=
-+// RUN: %clang_cc1 %s -cl-std=CL3.0 -triple "spir64-unknown-unknown" -cl-ext=__opencl_c_device_enqueue,__opencl_c_subgroups -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS="const volatile"
-+
-+
-
- typedef struct {int a;} ndrange_t;
- // Diagnostic tests for different overloads of enqueue_kernel from Table 6.13.17.1 of OpenCL 2.0 Spec.
-@@ -235,11 +241,17 @@ kernel void bar(global unsigned int *buf)
- kernel void foo1(global unsigned int *buf)
- {
- ndrange_t n;
-- buf[0] = get_kernel_max_sub_group_size_for_ndrange(n, ^(){}); // expected-error {{use of declaration 'get_kernel_max_sub_group_size_for_ndrange' requires cl_khr_subgroups extension to be enabled}}
-+ buf[0] = get_kernel_max_sub_group_size_for_ndrange(n, ^(){});
-+#if __OPENCL_C_VERSION__ < 300
-+// expected-error@-2 {{use of declaration 'get_kernel_max_sub_group_size_for_ndrange' requires cl_khr_subgroups extension to be enabled}}
-+#endif
- }
-
- kernel void bar1(global unsigned int *buf)
- {
- ndrange_t n;
-- buf[0] = get_kernel_sub_group_count_for_ndrange(n, ^(){}); // expected-error {{use of declaration 'get_kernel_sub_group_count_for_ndrange' requires cl_khr_subgroups extension to be enabled}}
-+ buf[0] = get_kernel_sub_group_count_for_ndrange(n, ^(){});
-+#if __OPENCL_C_VERSION__ < 300
-+// expected-error@-2 {{use of declaration 'get_kernel_sub_group_count_for_ndrange' requires cl_khr_subgroups extension to be enabled}}
-+#endif
- }
-diff --git a/clang/test/SemaOpenCL/forget-unsupported-builtins.cl b/clang/test/SemaOpenCL/forget-unsupported-builtins.cl
-new file mode 100644
-index 000000000000..14dd03e2c7db
---- /dev/null
-+++ b/clang/test/SemaOpenCL/forget-unsupported-builtins.cl
-@@ -0,0 +1,22 @@
-+// RUN: %clang_cc1 -cl-std=cl3.0 -fsyntax-only -verify %s -triple spir-unknown-unknown
-+// RUN: %clang_cc1 -cl-std=cl3.0 -fsyntax-only -cl-ext=__opencl_c_pipes,__opencl_c_generic_address_space,__opencl_c_device_enqueue -verify %s -triple spir-unknown-unknown -DFEATURES
-+
-+#ifndef FEATURES
-+ // expected-no-diagnostics
-+#else
-+ // expected-error@+10 {{cannot redeclare builtin function 'get_pipe_max_packets'}}
-+ // expected-note@+9 {{'get_pipe_max_packets' is a builtin with type 'unsigned int ()'}}
-+ // expected-error@+9 {{cannot redeclare builtin function 'to_local'}}
-+ // expected-note@+8 {{'to_local' is a builtin with type 'void *(void *)'}}
-+ // expected-error@+8 {{cannot redeclare builtin function 'to_global'}}
-+ // expected-note@+7 {{'to_global' is a builtin with type 'void *(void *)'}}
-+ // expected-error@+7 {{cannot redeclare builtin function 'get_kernel_work_group_size'}}
-+ // expected-note@+6 {{'get_kernel_work_group_size' is a builtin with type 'unsigned int ()'}}
-+#endif
-+
-+int get_pipe_max_packets(int);
-+int to_local(int);
-+int to_global(int);
-+int get_kernel_work_group_size(int);
-+
-+kernel void test(global int *dst) {}
-diff --git a/clang/test/SemaOpenCL/image-features.cl b/clang/test/SemaOpenCL/image-features.cl
-new file mode 100644
-index 000000000000..ace6913bb31e
---- /dev/null
-+++ b/clang/test/SemaOpenCL/image-features.cl
-@@ -0,0 +1,20 @@
-+// RUN: %clang_cc1 -cl-std=cl2.0 -fsyntax-only -verify %s -triple spir-unknown-unknown
-+// RUN: %clang_cc1 -cl-std=cl3.0 -cl-ext=__opencl_c_images -fsyntax-only -verify %s -triple spir-unknown-unknown
-+// RUN: %clang_cc1 -cl-std=cl3.0 -cl-ext=__opencl_c_3d_image_writes -fsyntax-only -verify %s -triple spir-unknown-unknown
-+// RUN: %clang_cc1 -cl-std=cl3.0 -cl-ext=__opencl_c_read_write_images -fsyntax-only -verify %s -triple spir-unknown-unknown
-+
-+#if defined(__opencl_c_read_write_images) && defined(__opencl_c_3d_image_writes)
-+ // expected-no-diagnostics
-+#endif
-+
-+__kernel void write_3d_image(__write_only image3d_t i) {}
-+
-+#ifndef __opencl_c_3d_image_writes
-+ // expected-error@-3 {{use of type '__write_only image3d_t' requires __opencl_c_3d_image_writes extension to be enabled}}
-+#endif
-+
-+__kernel void read_write_3d_image(__read_write image3d_t i) { }
-+
-+#ifndef __opencl_c_read_write_images
-+ // expected-error@-3 {{use of type '__read_write image3d_t' requires __opencl_c_read_write_images extension to be enabled}}
-+#endif
-diff --git a/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl b/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
-index 36e76621d24a..38b0a04726e3 100644
---- a/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
-+++ b/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
-@@ -1,4 +1,5 @@
- // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_subgroups
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_subgroups,__opencl_c_pipes
-
- #pragma OPENCL EXTENSION cl_khr_subgroups : enable
-
-diff --git a/clang/test/SemaOpenCL/storageclass-cl20.cl b/clang/test/SemaOpenCL/storageclass-cl20.cl
-index 581701d2a6a5..469c526ebc30 100644
---- a/clang/test/SemaOpenCL/storageclass-cl20.cl
-+++ b/clang/test/SemaOpenCL/storageclass-cl20.cl
-@@ -1,4 +1,5 @@
- // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_program_scope_global_variables,__opencl_c_generic_address_space
-
- int G2 = 0;
- global int G3 = 0;
-diff --git a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
-index 41d33b550680..f50652493e5e 100644
---- a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
-+++ b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
-@@ -56,6 +56,7 @@
- //===----------------------------------------------------------------------===//
-
- #include "TableGenBackends.h"
-+#include "clang/Basic/OpenCLOptions.h"
- #include "llvm/ADT/MapVector.h"
- #include "llvm/ADT/STLExtras.h"
- #include "llvm/ADT/SmallString.h"
-@@ -69,6 +70,7 @@
- #include "llvm/TableGen/Record.h"
- #include "llvm/TableGen/StringMatcher.h"
- #include "llvm/TableGen/TableGenBackend.h"
-+#include <numeric>
- #include <set>
-
- using namespace llvm;
-@@ -228,6 +230,10 @@ private:
- // The function "tan", having the same signatures, would be mapped to the
- // same entry (<I1, I2, I3>).
- MapVector<BuiltinIndexListTy *, BuiltinTableEntries> SignatureListMap;
-+
-+ // Encode all versions
-+ unsigned short
-+ EncodeBuiltinVersions(std::vector<Record *> BuiltinVersionsRecords) const;
- };
- } // namespace
-
-@@ -338,12 +344,10 @@ struct OpenCLBuiltinStruct {
- const bool IsConst;
- // Function attribute __attribute__((convergent))
- const bool IsConv;
-+ // All opencl versions encoded
-+ const unsigned char AllVersions : 5;
- // OpenCL extension(s) required for this overload.
- const unsigned short Extension;
-- // First OpenCL version in which this overload was introduced (e.g. CL20).
-- const unsigned short MinVersion;
-- // First OpenCL version in which this overload was removed (e.g. CL20).
-- const unsigned short MaxVersion;
- };
-
- )";
-@@ -503,11 +507,9 @@ void BuiltinNameEmitter::EmitBuiltinTable() {
- << (Overload.first->getValueAsBit("IsPure")) << ", "
- << (Overload.first->getValueAsBit("IsConst")) << ", "
- << (Overload.first->getValueAsBit("IsConv")) << ", "
-- << FunctionExtensionIndex[ExtName] << ", "
-- << Overload.first->getValueAsDef("MinVersion")->getValueAsInt("ID")
-- << ", "
-- << Overload.first->getValueAsDef("MaxVersion")->getValueAsInt("ID")
-- << " },\n";
-+ << EncodeBuiltinVersions(
-+ Overload.first->getValueAsListOfDefs("Versions"))
-+ << ", " << FunctionExtensionIndex[ExtName] << " },\n";
- Index++;
- }
- }
-@@ -528,10 +530,8 @@ bool BuiltinNameEmitter::CanReuseSignature(
- if (Rec->getValueAsBit("IsPure") == Rec2->getValueAsBit("IsPure") &&
- Rec->getValueAsBit("IsConst") == Rec2->getValueAsBit("IsConst") &&
- Rec->getValueAsBit("IsConv") == Rec2->getValueAsBit("IsConv") &&
-- Rec->getValueAsDef("MinVersion")->getValueAsInt("ID") ==
-- Rec2->getValueAsDef("MinVersion")->getValueAsInt("ID") &&
-- Rec->getValueAsDef("MaxVersion")->getValueAsInt("ID") ==
-- Rec2->getValueAsDef("MaxVersion")->getValueAsInt("ID") &&
-+ EncodeBuiltinVersions(Rec->getValueAsListOfDefs("Versions")) ==
-+ EncodeBuiltinVersions(Rec2->getValueAsListOfDefs("Versions")) &&
- Rec->getValueAsDef("Extension")->getName() ==
- Rec2->getValueAsDef("Extension")->getName()) {
- return true;
-@@ -806,6 +806,15 @@ static void OCL2Qual(ASTContext &Context, const OpenCLTypeStruct &Ty,
- OS << "\n} // OCL2Qual\n";
- }
-
-+unsigned short BuiltinNameEmitter::EncodeBuiltinVersions(
-+ std::vector<Record *> BuiltinVersionsRecords) const {
-+ return std::accumulate(
-+ BuiltinVersionsRecords.begin(), BuiltinVersionsRecords.end(),
-+ (unsigned short)0, [](unsigned short C, Record *R) {
-+ return C |= clang::OpenCLOptions::EncodeVersion(R->getValueAsInt("ID"));
-+ });
-+}
-+
- void clang::EmitClangOpenCLBuiltins(RecordKeeper &Records, raw_ostream &OS) {
- BuiltinNameEmitter NameChecker(Records, OS);
- NameChecker.Emit();
---
-2.17.1
-
diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-Remove-repo-name-in-LLVM-IR.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-Remove-repo-name-in-LLVM-IR.patch
deleted file mode 100644
index 232ae063..00000000
--- a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-Remove-repo-name-in-LLVM-IR.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From b53fd86ffdeacb9b13624bdb110fd25e8c35cb92 Mon Sep 17 00:00:00 2001
-From: Feng Zou <feng.zou@intel.com>
-Date: Mon, 19 Oct 2020 14:43:38 +0800
-Subject: [PATCH] Remove repo name in LLVM IR
-
-Upstream-Status: Backport [Taken from opencl-clang patches, https://github.com/intel/opencl-clang/blob/ocl-open-100/patches/llvm/0003-Remove-repo-name-in-LLVM-IR.patch]
-Signed-off-by: Feng Zou <feng.zou@intel.com>
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
-
----
- llvm/cmake/modules/VersionFromVCS.cmake | 23 ++++++++++++-----------
- 1 file changed, 12 insertions(+), 11 deletions(-)
-
-diff --git a/llvm/cmake/modules/VersionFromVCS.cmake b/llvm/cmake/modules/VersionFromVCS.cmake
-index 1b6519b4b7c..8fd6b23bb34 100644
---- a/llvm/cmake/modules/VersionFromVCS.cmake
-+++ b/llvm/cmake/modules/VersionFromVCS.cmake
-@@ -33,17 +33,18 @@ function(get_source_info path revision repository)
- else()
- set(remote "origin")
- endif()
-- execute_process(COMMAND ${GIT_EXECUTABLE} remote get-url ${remote}
-- WORKING_DIRECTORY ${path}
-- RESULT_VARIABLE git_result
-- OUTPUT_VARIABLE git_output
-- ERROR_QUIET)
-- if(git_result EQUAL 0)
-- string(STRIP "${git_output}" git_output)
-- set(${repository} ${git_output} PARENT_SCOPE)
-- else()
-- set(${repository} ${path} PARENT_SCOPE)
-- endif()
-+ # Do not show repo name in IR
-+ # execute_process(COMMAND ${GIT_EXECUTABLE} remote get-url ${remote}
-+ # WORKING_DIRECTORY ${path}
-+ # RESULT_VARIABLE git_result
-+ # OUTPUT_VARIABLE git_output
-+ # ERROR_QUIET)
-+ # if(git_result EQUAL 0)
-+ # string(STRIP "${git_output}" git_output)
-+ # set(${repository} ${git_output} PARENT_SCOPE)
-+ # else()
-+ # set(${repository} ${path} PARENT_SCOPE)
-+ # endif()
- endif()
- endif()
- endfunction()
---
-2.18.1
-
diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-skip-building-tests.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-skip-building-tests.patch
deleted file mode 100644
index 8e58ec25..00000000
--- a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm10-skip-building-tests.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 455ce9c25df5313f4a6649cc27075bdfbe25af18 Mon Sep 17 00:00:00 2001
-From: Naveen Saini <naveen.kumar.saini@intel.com>
-Date: Wed, 21 Aug 2019 14:35:31 +0800
-Subject: [PATCH] llvm-spirv: skip building tests
-
-Some of these need clang to be built and since we're building this in-tree,
-that leads to problems when compiling libcxx, compiler-rt which aren't built
-in-tree.
-
-Instead of using SPIRV_SKIP_CLANG_BUILD to skip clang build and adding this to
-all components, disable the building of tests altogether.
-
-Upstream-Status: Inappropriate
-
-Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
----
- CMakeLists.txt | 10 ----------
- 1 file changed, 10 deletions(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index b718c00..9805140 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -24,13 +24,6 @@ if(LLVM_SPIRV_BUILD_EXTERNAL)
- set(CMAKE_CXX_STANDARD 14)
- set(CMAKE_CXX_STANDARD_REQUIRED ON)
-
-- if(LLVM_SPIRV_INCLUDE_TESTS)
-- set(LLVM_TEST_COMPONENTS
-- llvm-as
-- llvm-dis
-- )
-- endif(LLVM_SPIRV_INCLUDE_TESTS)
--
- find_package(LLVM 10.0.0 REQUIRED
- COMPONENTS
- Analysis
-@@ -61,9 +54,6 @@ set(LLVM_SPIRV_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
-
- add_subdirectory(lib/SPIRV)
- add_subdirectory(tools/llvm-spirv)
--if(LLVM_SPIRV_INCLUDE_TESTS)
-- add_subdirectory(test)
--endif(LLVM_SPIRV_INCLUDE_TESTS)
-
- install(
- FILES
---
-2.7.4
-
diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-OpenCL-3.0-support.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-OpenCL-3.0-support.patch
deleted file mode 100644
index 98545db0..00000000
--- a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-OpenCL-3.0-support.patch
+++ /dev/null
@@ -1,8453 +0,0 @@
-From d767afa79d1c8153081eac1ef33e348cadbea5bb Mon Sep 17 00:00:00 2001
-From: Anton Zabaznov <anton.zabaznov@intel.com>
-Date: Tue, 22 Sep 2020 19:03:50 +0300
-Subject: [PATCH] OpenCL 3.0 support
-
-Upstream-Status: Backport [Taken from opencl-clang patches, https://github.com/intel/opencl-clang/blob/ocl-open-110/patches/clang/0001-OpenCL-3.0-support.patch]
-Signed-off-by: Anton Zabaznov <anton.zabaznov@intel.com>
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
-
-
----
- clang/include/clang/Basic/Builtins.def | 65 +-
- clang/include/clang/Basic/Builtins.h | 13 +-
- .../clang/Basic/DiagnosticParseKinds.td | 2 +
- .../clang/Basic/DiagnosticSemaKinds.td | 7 +
- clang/include/clang/Basic/LangOptions.def | 2 +
- clang/include/clang/Basic/LangStandards.def | 4 +
- .../include/clang/Basic/OpenCLExtensions.def | 15 +
- clang/include/clang/Basic/OpenCLOptions.h | 174 +-
- clang/include/clang/Driver/Options.td | 2 +-
- clang/include/clang/Sema/Sema.h | 9 +
- clang/lib/AST/ASTContext.cpp | 3 +-
- clang/lib/Basic/Builtins.cpp | 28 +-
- clang/lib/Basic/TargetInfo.cpp | 11 +
- clang/lib/Basic/Targets.cpp | 1 -
- clang/lib/CodeGen/CodeGenFunction.cpp | 6 +-
- clang/lib/Frontend/CompilerInvocation.cpp | 22 +-
- clang/lib/Frontend/InitPreprocessor.cpp | 6 +-
- clang/lib/Headers/opencl-c-base.h | 75 +-
- clang/lib/Headers/opencl-c.h | 3216 ++++++++++++++---
- clang/lib/Parse/ParseDecl.cpp | 12 +-
- clang/lib/Parse/ParsePragma.cpp | 10 +-
- clang/lib/Sema/OpenCLBuiltins.td | 153 +-
- clang/lib/Sema/Sema.cpp | 47 +-
- clang/lib/Sema/SemaChecking.cpp | 38 +-
- clang/lib/Sema/SemaDecl.cpp | 18 +-
- clang/lib/Sema/SemaDeclAttr.cpp | 9 +-
- clang/lib/Sema/SemaDeclCXX.cpp | 12 +-
- clang/lib/Sema/SemaLookup.cpp | 19 +-
- clang/lib/Sema/SemaType.cpp | 14 +-
- .../CodeGenOpenCL/addr-space-struct-arg.cl | 7 +-
- .../address-spaces-conversions.cl | 2 +
- .../CodeGenOpenCL/address-spaces-mangling.cl | 3 +-
- clang/test/CodeGenOpenCL/address-spaces.cl | 4 +
- .../amdgcn-automatic-variable.cl | 1 +
- .../CodeGenOpenCL/amdgpu-sizeof-alignof.cl | 21 +-
- .../CodeGenOpenCL/arm-integer-dot-product.cl | 1 +
- .../test/CodeGenOpenCL/cl-uniform-wg-size.cl | 2 +
- clang/test/CodeGenOpenCL/fpmath.cl | 2 +
- .../generic-address-space-feature.cl | 28 +
- .../intel-subgroups-avc-ext-types.cl | 1 +
- .../kernels-have-spir-cc-by-default.cl | 3 +
- clang/test/CodeGenOpenCL/logical-ops.cl | 1 +
- clang/test/CodeGenOpenCL/no-half.cl | 1 +
- clang/test/CodeGenOpenCL/pipe_builtin.cl | 3 +
- clang/test/CodeGenOpenCL/pipe_types.cl | 1 +
- clang/test/CodeGenOpenCL/printf.cl | 2 +
- clang/test/CodeGenOpenCL/unroll-hint.cl | 1 +
- clang/test/Driver/autocomplete.c | 2 +
- clang/test/Driver/opencl.cl | 2 +
- clang/test/Driver/unknown-std.cl | 1 +
- clang/test/Frontend/stdlang.c | 1 +
- clang/test/Headers/opencl-c-header.cl | 7 +-
- clang/test/Index/pipe-size.cl | 7 +
- clang/test/Preprocessor/init-aarch64.c | 12 +-
- clang/test/Preprocessor/predefined-macros.c | 13 +
- .../Sema/feature-extensions-simult-support.cl | 75 +
- clang/test/Sema/features-ignore-pragma.cl | 24 +
- clang/test/Sema/opencl-features-pipes.cl | 18 +
- clang/test/Sema/opencl-features.cl | 128 +
- clang/test/Sema/pipe_builtins_feature.cl | 21 +
- .../address-spaces-conversions-cl2.0.cl | 3 +
- clang/test/SemaOpenCL/address-spaces.cl | 1 +
- .../SemaOpenCL/cl20-device-side-enqueue.cl | 16 +-
- .../SemaOpenCL/forget-unsupported-builtins.cl | 22 +
- clang/test/SemaOpenCL/image-features.cl | 20 +
- .../SemaOpenCL/invalid-pipe-builtin-cl2.0.cl | 1 +
- clang/test/SemaOpenCL/storageclass-cl20.cl | 1 +
- .../TableGen/ClangOpenCLBuiltinEmitter.cpp | 35 +-
- 68 files changed, 3749 insertions(+), 738 deletions(-)
- create mode 100644 clang/test/CodeGenOpenCL/generic-address-space-feature.cl
- create mode 100644 clang/test/Sema/feature-extensions-simult-support.cl
- create mode 100644 clang/test/Sema/features-ignore-pragma.cl
- create mode 100644 clang/test/Sema/opencl-features-pipes.cl
- create mode 100644 clang/test/Sema/opencl-features.cl
- create mode 100644 clang/test/Sema/pipe_builtins_feature.cl
- create mode 100644 clang/test/SemaOpenCL/forget-unsupported-builtins.cl
- create mode 100644 clang/test/SemaOpenCL/image-features.cl
-
-diff --git a/clang/include/clang/Basic/Builtins.def b/clang/include/clang/Basic/Builtins.def
-index 5463b7dfc18c..e094beab9a6c 100644
---- a/clang/include/clang/Basic/Builtins.def
-+++ b/clang/include/clang/Basic/Builtins.def
-@@ -111,6 +111,10 @@
- # define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
- #endif
-
-+#if defined(BUILTIN) && !defined(OPENCLBUILTIN)
-+# define OPENCLBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG, FEATURE) BUILTIN(ID, TYPE, ATTRS)
-+#endif
-+
- // Standard libc/libm functions:
- BUILTIN(__builtin_atan2 , "ddd" , "Fne")
- BUILTIN(__builtin_atan2f, "fff" , "Fne")
-@@ -1529,50 +1533,54 @@ BUILTIN(__builtin_coro_param, "bv*v*", "n")
-
- // OpenCL v2.0 s6.13.16, s9.17.3.5 - Pipe functions.
- // We need the generic prototype, since the packet type could be anything.
--LANGBUILTIN(read_pipe, "i.", "tn", OCLC20_LANG)
--LANGBUILTIN(write_pipe, "i.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-+OPENCLBUILTIN(write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-
--LANGBUILTIN(reserve_read_pipe, "i.", "tn", OCLC20_LANG)
--LANGBUILTIN(reserve_write_pipe, "i.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(reserve_read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-+OPENCLBUILTIN(reserve_write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-
--LANGBUILTIN(commit_write_pipe, "v.", "tn", OCLC20_LANG)
--LANGBUILTIN(commit_read_pipe, "v.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(commit_write_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-+OPENCLBUILTIN(commit_read_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-
--LANGBUILTIN(sub_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG)
--LANGBUILTIN(sub_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(sub_group_reserve_read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-+OPENCLBUILTIN(sub_group_reserve_write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-
--LANGBUILTIN(sub_group_commit_read_pipe, "v.", "tn", OCLC20_LANG)
--LANGBUILTIN(sub_group_commit_write_pipe, "v.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(sub_group_commit_read_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-+OPENCLBUILTIN(sub_group_commit_write_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-
--LANGBUILTIN(work_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG)
--LANGBUILTIN(work_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(work_group_reserve_read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-+OPENCLBUILTIN(work_group_reserve_write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-
--LANGBUILTIN(work_group_commit_read_pipe, "v.", "tn", OCLC20_LANG)
--LANGBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(work_group_commit_read_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-+OPENCLBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-
--LANGBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC20_LANG)
--LANGBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-+OPENCLBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
-
- // OpenCL v2.0 s6.13.17 - Enqueue kernel functions.
- // Custom builtin check allows to perform special check of passed block arguments.
--LANGBUILTIN(enqueue_kernel, "i.", "tn", OCLC20_LANG)
--LANGBUILTIN(get_kernel_work_group_size, "Ui.", "tn", OCLC20_LANG)
--LANGBUILTIN(get_kernel_preferred_work_group_size_multiple, "Ui.", "tn", OCLC20_LANG)
--LANGBUILTIN(get_kernel_max_sub_group_size_for_ndrange, "Ui.", "tn", OCLC20_LANG)
--LANGBUILTIN(get_kernel_sub_group_count_for_ndrange, "Ui.", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(enqueue_kernel, "i.", "tn", OCLC2P_LANG,
-+ "__opencl_c_device_enqueue")
-+OPENCLBUILTIN(get_kernel_work_group_size, "Ui.", "tn", OCLC2P_LANG,
-+ "__opencl_c_device_enqueue")
-+OPENCLBUILTIN(get_kernel_preferred_work_group_size_multiple, "Ui.", "tn",
-+ OCLC2P_LANG, "__opencl_c_device_enqueue")
-+OPENCLBUILTIN(get_kernel_max_sub_group_size_for_ndrange, "Ui.", "tn",
-+ OCLC2P_LANG, "__opencl_c_device_enqueue")
-+OPENCLBUILTIN(get_kernel_sub_group_count_for_ndrange, "Ui.", "tn", OCLC2P_LANG, "__opencl_c_device_enqueue")
-
- // OpenCL v2.0 s6.13.9 - Address space qualifier functions.
- // FIXME: Pointer parameters of OpenCL builtins should have their address space
- // requirement defined.
--LANGBUILTIN(to_global, "v*v*", "tn", OCLC20_LANG)
--LANGBUILTIN(to_local, "v*v*", "tn", OCLC20_LANG)
--LANGBUILTIN(to_private, "v*v*", "tn", OCLC20_LANG)
-+OPENCLBUILTIN(to_global, "v*v*", "tn", OCLC2P_LANG, "__opencl_c_generic_address_space")
-+OPENCLBUILTIN(to_local, "v*v*", "tn", OCLC2P_LANG, "__opencl_c_generic_address_space")
-+OPENCLBUILTIN(to_private, "v*v*", "tn", OCLC2P_LANG, "__opencl_c_generic_address_space")
-
- // OpenCL half load/store builtin
--LANGBUILTIN(__builtin_store_half, "vdh*", "n", ALL_OCLC_LANGUAGES)
--LANGBUILTIN(__builtin_store_halff, "vfh*", "n", ALL_OCLC_LANGUAGES)
--LANGBUILTIN(__builtin_load_half, "dhC*", "nc", ALL_OCLC_LANGUAGES)
--LANGBUILTIN(__builtin_load_halff, "fhC*", "nc", ALL_OCLC_LANGUAGES)
-+OPENCLBUILTIN(__builtin_store_half, "vdh*", "n", ALL_OCLC_LANGUAGES, "")
-+OPENCLBUILTIN(__builtin_store_halff, "vfh*", "n", ALL_OCLC_LANGUAGES, "")
-+OPENCLBUILTIN(__builtin_load_half, "dhC*", "nc", ALL_OCLC_LANGUAGES, "")
-+OPENCLBUILTIN(__builtin_load_halff, "fhC*", "nc", ALL_OCLC_LANGUAGES, "")
-
- // Builtins for os_log/os_trace
- BUILTIN(__builtin_os_log_format_buffer_size, "zcC*.", "p:0:nut")
-@@ -1593,3 +1601,4 @@ BUILTIN(__builtin_ms_va_copy, "vc*&c*&", "n")
- #undef BUILTIN
- #undef LIBBUILTIN
- #undef LANGBUILTIN
-+#undef OPENCLBUILTIN
-diff --git a/clang/include/clang/Basic/Builtins.h b/clang/include/clang/Basic/Builtins.h
-index 15bfcf797917..ba3e7853444c 100644
---- a/clang/include/clang/Basic/Builtins.h
-+++ b/clang/include/clang/Basic/Builtins.h
-@@ -33,13 +33,13 @@ enum LanguageID {
- CXX_LANG = 0x4, // builtin for cplusplus only.
- OBJC_LANG = 0x8, // builtin for objective-c and objective-c++
- MS_LANG = 0x10, // builtin requires MS mode.
-- OCLC20_LANG = 0x20, // builtin for OpenCL C 2.0 only.
-+ OCLC2P_LANG = 0x20, // builtin for OpenCL C 2.0+ versions.
- OCLC1X_LANG = 0x40, // builtin for OpenCL C 1.x only.
- OMP_LANG = 0x80, // builtin requires OpenMP.
- ALL_LANGUAGES = C_LANG | CXX_LANG | OBJC_LANG, // builtin for all languages.
- ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG, // builtin requires GNU mode.
- ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG, // builtin requires MS mode.
-- ALL_OCLC_LANGUAGES = OCLC1X_LANG | OCLC20_LANG // builtin for OCLC languages.
-+ ALL_OCLC_LANGUAGES = OCLC1X_LANG | OCLC2P_LANG // builtin for OCLC languages.
- };
-
- namespace Builtin {
-@@ -235,6 +235,10 @@ public:
- /// for non-builtins.
- bool canBeRedeclared(unsigned ID) const;
-
-+ bool requiresFeatures(unsigned ID) const {
-+ return requiresFeatures(getRecord(ID));
-+ }
-+
- private:
- const Info &getRecord(unsigned ID) const;
-
-@@ -242,6 +246,11 @@ private:
- bool builtinIsSupported(const Builtin::Info &BuiltinInfo,
- const LangOptions &LangOpts);
-
-+ bool OclBuiltinIsSupported(const Builtin::Info &BuiltinInfo,
-+ const LangOptions &LangOpts) const;
-+
-+ bool requiresFeatures(const Builtin::Info &BuiltinInfo) const;
-+
- /// Helper function for isPrintfLike and isScanfLike.
- bool isLike(unsigned ID, unsigned &FormatIdx, bool &HasVAListArg,
- const char *Fmt) const;
-diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
-index 1038a4119d4c..ba1b1b67a131 100644
---- a/clang/include/clang/Basic/DiagnosticParseKinds.td
-+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
-@@ -1206,6 +1206,8 @@ def warn_pragma_unsupported_extension : Warning<
- "unsupported OpenCL extension %0 - ignoring">, InGroup<IgnoredPragmas>;
- def warn_pragma_extension_is_core : Warning<
- "OpenCL extension %0 is core feature or supported optional core feature - ignoring">, InGroup<DiagGroup<"pedantic-core-features">>, DefaultIgnore;
-+def warn_opencl_pragma_feature_ignore : Warning<
-+ "OpenCL feature support can't be controlled via pragma, ignoring">, InGroup<IgnoredPragmas>;
-
- // OpenCL errors.
- def err_opencl_taking_function_address_parser : Error<
-diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
-index 941f2cafc372..aa9e8b7b011b 100644
---- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
-+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
-@@ -9741,6 +9741,13 @@ def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
- def err_openclcxx_placement_new : Error<
- "use of placement new requires explicit declaration">;
-
-+def err_opencl_pipes_require_feat : Error<
-+ "usage of OpenCL pipes requires feature support">;
-+def err_opencl_memory_scope_require_feat : Error<
-+ "usage of memory scope requires feature support">;
-+def err_opencl_memory_ordering_require_feat : Error<
-+ "usage of memory ordering requires feature support">;
-+
- // MIG routine annotations.
- def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
- "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
-diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def
-index 70f68d664bb7..e683f5956975 100644
---- a/clang/include/clang/Basic/LangOptions.def
-+++ b/clang/include/clang/Basic/LangOptions.def
-@@ -215,6 +215,8 @@ LANGOPT(OpenCL , 1, 0, "OpenCL")
- LANGOPT(OpenCLVersion , 32, 0, "OpenCL C version")
- LANGOPT(OpenCLCPlusPlus , 1, 0, "C++ for OpenCL")
- LANGOPT(OpenCLCPlusPlusVersion , 32, 0, "C++ for OpenCL version")
-+LANGOPT(OpenCLGenericKeyword , 1, 0, "OpenCL generic keyword")
-+LANGOPT(OpenCLPipeKeyword , 1, 0, "OpenCL pipe keyword")
- LANGOPT(NativeHalfType , 1, 0, "Native half type support")
- LANGOPT(NativeHalfArgsAndReturns, 1, 0, "Native half args and returns")
- LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns")
-diff --git a/clang/include/clang/Basic/LangStandards.def b/clang/include/clang/Basic/LangStandards.def
-index b09568e8b3e8..7b915c312746 100644
---- a/clang/include/clang/Basic/LangStandards.def
-+++ b/clang/include/clang/Basic/LangStandards.def
-@@ -167,6 +167,9 @@ LANGSTANDARD(opencl12, "cl1.2",
- LANGSTANDARD(opencl20, "cl2.0",
- OpenCL, "OpenCL 2.0",
- LineComment | C99 | Digraphs | HexFloat | OpenCL)
-+LANGSTANDARD(opencl30, "cl3.0",
-+ OpenCL, "OpenCL 3.0",
-+ LineComment | C99 | Digraphs | HexFloat | OpenCL)
- LANGSTANDARD(openclcpp, "clc++",
- OpenCL, "C++ for OpenCL",
- LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
-@@ -176,6 +179,7 @@ LANGSTANDARD_ALIAS_DEPR(opencl10, "CL")
- LANGSTANDARD_ALIAS_DEPR(opencl11, "CL1.1")
- LANGSTANDARD_ALIAS_DEPR(opencl12, "CL1.2")
- LANGSTANDARD_ALIAS_DEPR(opencl20, "CL2.0")
-+LANGSTANDARD_ALIAS_DEPR(opencl30, "CL3.0")
- LANGSTANDARD_ALIAS_DEPR(openclcpp, "CLC++")
-
- // CUDA
-diff --git a/clang/include/clang/Basic/OpenCLExtensions.def b/clang/include/clang/Basic/OpenCLExtensions.def
-index 1ae36b32fb0a..d1574164f9b2 100644
---- a/clang/include/clang/Basic/OpenCLExtensions.def
-+++ b/clang/include/clang/Basic/OpenCLExtensions.def
-@@ -100,6 +100,21 @@ OPENCLEXT_INTERNAL(cl_intel_subgroups, 120, ~0U)
- OPENCLEXT_INTERNAL(cl_intel_subgroups_short, 120, ~0U)
- OPENCLEXT_INTERNAL(cl_intel_device_side_avc_motion_estimation, 120, ~0U)
-
-+OPENCLEXT_INTERNAL(__opencl_c_pipes, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_generic_address_space, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_work_group_collective_functions, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_atomic_order_acq_rel, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_atomic_order_seq_cst, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_atomic_scope_device, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_atomic_scope_all_devices, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_subgroups, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_3d_image_writes, 100, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_device_enqueue, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_read_write_images, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_program_scope_global_variables, 200, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_fp64, 120, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_int64, 100, ~0U)
-+OPENCLEXT_INTERNAL(__opencl_c_images, 100, ~0U)
- #undef OPENCLEXT_INTERNAL
-
- #ifdef OPENCLEXT
-diff --git a/clang/include/clang/Basic/OpenCLOptions.h b/clang/include/clang/Basic/OpenCLOptions.h
-index 15661154eab5..d5800f5611c6 100644
---- a/clang/include/clang/Basic/OpenCLOptions.h
-+++ b/clang/include/clang/Basic/OpenCLOptions.h
-@@ -21,6 +21,10 @@ namespace clang {
-
- /// OpenCL supported extensions and optional core features
- class OpenCLOptions {
-+ // OpenCL Version
-+ unsigned CLVer = 120;
-+ bool IsOpenCLCPlusPlus = false;
-+
- struct Info {
- bool Supported; // Is this option supported
- bool Enabled; // Is this option enabled
-@@ -31,7 +35,38 @@ class OpenCLOptions {
- :Supported(S), Enabled(E), Avail(A), Core(C){}
- };
- llvm::StringMap<Info> OptMap;
-+
- public:
-+ void setOpenCLVersion(const LangOptions &LO) {
-+ IsOpenCLCPlusPlus = LO.OpenCLCPlusPlus;
-+ CLVer = IsOpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
-+ }
-+
-+ // Get extension which is semantically equivalent to a given feature
-+ // if exists (e.g. __opencl_c_subgroups -> cl_khr_subgroups)
-+ llvm::Optional<StringRef> getEquivalentExtension(StringRef Feature) const {
-+ return llvm::StringSwitch<llvm::Optional<StringRef>>(Feature)
-+ .Case("__opencl_c_3d_image_writes",
-+ Optional<StringRef>("cl_khr_3d_image_writes"))
-+ .Case("__opencl_c_subgroups", Optional<StringRef>("cl_khr_subgroups"))
-+ .Case("__opencl_c_fp64", Optional<StringRef>("cl_khr_fp64"))
-+ .Default(Optional<StringRef>());
-+ }
-+
-+ // Same as above but for extensions
-+ llvm::Optional<StringRef> getEquivalentFeature(StringRef Extension) const {
-+ return llvm::StringSwitch<llvm::Optional<StringRef>>(Extension)
-+ .Case("cl_khr_3d_image_writes",
-+ Optional<StringRef>("__opencl_c_3d_image_writes"))
-+ .Case("cl_khr_subgroups", Optional<StringRef>("__opencl_c_subgroups"))
-+ .Case("cl_khr_fp64", Optional<StringRef>("__opencl_c_fp64"))
-+ .Default(Optional<StringRef>());
-+ }
-+
-+ bool isFeature(llvm::StringRef Ext) const {
-+ return Ext.startswith("__opencl_c");
-+ }
-+
- bool isKnown(llvm::StringRef Ext) const {
- return OptMap.find(Ext) != OptMap.end();
- }
-@@ -42,32 +77,88 @@ public:
-
- // Is supported as either an extension or an (optional) core feature for
- // OpenCL version \p CLVer.
-- bool isSupported(llvm::StringRef Ext, const LangOptions &LO) const {
-+ bool isSupported(llvm::StringRef Ext) const {
- // In C++ mode all extensions should work at least as in v2.0.
-- auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
- auto I = OptMap.find(Ext)->getValue();
- return I.Supported && I.Avail <= CLVer;
- }
-
- // Is supported (optional) OpenCL core features for OpenCL version \p CLVer.
- // For supported extension, return false.
-- bool isSupportedCore(llvm::StringRef Ext, const LangOptions &LO) const {
-+ bool isSupportedCore(llvm::StringRef Ext) const {
- // In C++ mode all extensions should work at least as in v2.0.
-- auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
- auto I = OptMap.find(Ext)->getValue();
- return I.Supported && I.Avail <= CLVer && I.Core != ~0U && CLVer >= I.Core;
- }
-
- // Is supported OpenCL extension for OpenCL version \p CLVer.
- // For supported (optional) core feature, return false.
-- bool isSupportedExtension(llvm::StringRef Ext, const LangOptions &LO) const {
-+ bool isSupportedExtension(llvm::StringRef Ext) const {
- // In C++ mode all extensions should work at least as in v2.0.
-- auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
- auto I = OptMap.find(Ext)->getValue();
- return I.Supported && I.Avail <= CLVer && (I.Core == ~0U || CLVer < I.Core);
- }
-
-+ // Support features whose support is directly related to the
-+ // specific OpenCL version. For example, OpenCL 2.0 supports
-+ // all features that are optional in 3.0
-+ void adjustFeatures() {
-+ // Support int64 by default (assume compiling for FULL profile)
-+ OptMap["__opencl_c_int64"].Supported = true;
-+
-+ if (CLVer >= 300) {
-+ // Simultaneously support extension and corresponding feature
-+ for (llvm::StringRef F :
-+ {"__opencl_c_subgroups", "__opencl_c_3d_image_writes",
-+ "__opencl_c_fp64"}) {
-+ auto Ext = getEquivalentExtension(F);
-+ OptMap[*Ext].Supported = OptMap[F].Supported;
-+ }
-+
-+ // OpenCL C compilers that define the feature macro __opencl_c_pipes or
-+ // or __opencl_c_device_enqueue must also define the
-+ // feature macro __opencl_c_generic_address_space.
-+ if (OptMap["__opencl_c_pipes"].Supported ||
-+ OptMap["__opencl_c_device_enqueue"].Supported)
-+ OptMap["__opencl_c_generic_address_space"].Supported = true;
-+
-+ // OpenCL C compilers that define the feature macro
-+ // __opencl_c_3d_image_writes or __opencl_c_read_write_images must also
-+ // define the feature macro __opencl_c_images
-+ if (OptMap["__opencl_c_3d_image_writes"].Supported ||
-+ OptMap["__opencl_c_read_write_images"].Supported)
-+ OptMap["__opencl_c_images"].Supported = true;
-+
-+ // All other features are already supported with options
-+ // or in target settings
-+ return;
-+ }
-+
-+ auto FeaturesRange = llvm::make_filter_range(
-+ OptMap, [&](llvm::StringMapEntry<Info> &OptVal) {
-+ auto Opt = OptVal.getKey();
-+ return isFeature(Opt);
-+ });
-+
-+ for (auto &It : FeaturesRange) {
-+ auto &Info = It.getValue();
-+ // For OpenCL version less then 3.0 some
-+ // features should be supported simulateneously
-+ // with specific extension
-+ if (Optional<llvm::StringRef> Ext = getEquivalentExtension(It.getKey()))
-+ Info.Supported = Info.Enabled = OptMap[*Ext].Supported;
-+ else if (Info.Avail <= CLVer)
-+ Info.Supported = Info.Enabled = true;
-+ }
-+ }
-+
- void enable(llvm::StringRef Ext, bool V = true) {
-+ // Ignore disabling extensions if corresponding features
-+ // already supported for OpenCL version higher then 3.0
-+ if (CLVer >= 300)
-+ if (Optional<llvm::StringRef> F = getEquivalentFeature(Ext))
-+ if (V != OptMap[*F].Enabled)
-+ return;
- OptMap[Ext].Enabled = V;
- }
-
-@@ -96,7 +187,7 @@ public:
- OptMap[Ext].Supported = V;
- }
-
-- OpenCLOptions(){
-+ OpenCLOptions() {
- #define OPENCLEXT_INTERNAL(Ext, AvailVer, CoreVer) \
- OptMap[#Ext].Avail = AvailVer; \
- OptMap[#Ext].Core = CoreVer;
-@@ -104,35 +195,86 @@ public:
- }
-
- void addSupport(const OpenCLOptions &Opts) {
-+ assert(IsOpenCLCPlusPlus == Opts.IsOpenCLCPlusPlus && CLVer == Opts.CLVer);
- for (auto &I:Opts.OptMap)
-- if (I.second.Supported)
-+ if (I.second.Supported) {
- OptMap[I.getKey()].Supported = true;
-+ // All features are enabled as they are supported
-+ if (isFeature(I.getKey()))
-+ OptMap[I.getKey()].Enabled = true;
-+ }
-+ if (CLVer >= 300) {
-+ // Enabling extensions with respect to features
-+ for (llvm::StringRef Ext :
-+ {"cl_khr_3d_image_writes", "cl_khr_subgroups", "cl_khr_fp64"}) {
-+ auto Feature = getEquivalentFeature(Ext);
-+ enable(Ext, OptMap[*Feature].Enabled);
-+ }
-+ }
- }
-
- void copy(const OpenCLOptions &Opts) {
-+ CLVer = Opts.CLVer;
-+ IsOpenCLCPlusPlus = Opts.IsOpenCLCPlusPlus;
- OptMap = Opts.OptMap;
- }
-
- // Turn on or off support of all options.
- void supportAll(bool On = true) {
-- for (llvm::StringMap<Info>::iterator I = OptMap.begin(),
-- E = OptMap.end(); I != E; ++I)
-- I->second.Supported = On;
-+ for (llvm::StringMap<Info>::iterator I = OptMap.begin(), E = OptMap.end();
-+ I != E; ++I)
-+ if (!isFeature(I->getKey()))
-+ I->second.Supported = On;
- }
-
- void disableAll() {
-- for (llvm::StringMap<Info>::iterator I = OptMap.begin(),
-- E = OptMap.end(); I != E; ++I)
-- I->second.Enabled = false;
-+ for (llvm::StringMap<Info>::iterator I = OptMap.begin(), E = OptMap.end();
-+ I != E; ++I) {
-+ auto Ext = I->getKey();
-+ if (!isFeature(Ext))
-+ enable(Ext, false);
-+ }
- }
-
-- void enableSupportedCore(LangOptions LO) {
-+ void enableSupportedCore() {
- for (llvm::StringMap<Info>::iterator I = OptMap.begin(), E = OptMap.end();
- I != E; ++I)
-- if (isSupportedCore(I->getKey(), LO))
-+ if (isSupportedCore(I->getKey()))
- I->second.Enabled = true;
- }
-
-+ // This enum specifies how OpenCL versions map into values
-+ // for encoding. This is used when generating built-ins
-+ // from tablegen
-+ enum OpenCLVersionsEncodings : unsigned short {
-+ OPENCL_C_100_CODE = 0x1,
-+ OPENCL_C_110_CODE = 0x2,
-+ OPENCL_C_120_CODE = 0x4,
-+ OPENCL_C_200_CODE = 0x8,
-+ OPENCL_C_300_CODE = 0x10,
-+ OPENCL_C_ALL_CODE = 0x1f
-+ };
-+
-+ // Encode version into single integer
-+ static unsigned short EncodeVersion(unsigned OpenCLVersion) {
-+ switch (OpenCLVersion) {
-+ default:
-+ llvm_unreachable("Unknown OpenCL version");
-+ case 0:
-+ return OpenCLVersionsEncodings::OPENCL_C_ALL_CODE;
-+ case 100:
-+ return OpenCLVersionsEncodings::OPENCL_C_100_CODE;
-+ case 110:
-+ return OpenCLVersionsEncodings::OPENCL_C_110_CODE;
-+ case 120:
-+ return OpenCLVersionsEncodings::OPENCL_C_120_CODE;
-+ case 200:
-+ return OpenCLVersionsEncodings::OPENCL_C_200_CODE;
-+ case 300:
-+ return OpenCLVersionsEncodings::OPENCL_C_300_CODE;
-+ }
-+ }
-+
- friend class ASTWriter;
- friend class ASTReader;
- };
-diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
-index 966cb907b7e2..62536f2470c2 100644
---- a/clang/include/clang/Driver/Options.td
-+++ b/clang/include/clang/Driver/Options.td
-@@ -557,7 +557,7 @@ def cl_mad_enable : Flag<["-"], "cl-mad-enable">, Group<opencl_Group>, Flags<[CC
- def cl_no_signed_zeros : Flag<["-"], "cl-no-signed-zeros">, Group<opencl_Group>, Flags<[CC1Option]>,
- HelpText<"OpenCL only. Allow use of less precise no signed zeros computations in the generated binary.">;
- def cl_std_EQ : Joined<["-"], "cl-std=">, Group<opencl_Group>, Flags<[CC1Option]>,
-- HelpText<"OpenCL language standard to compile for.">, Values<"cl,CL,cl1.1,CL1.1,cl1.2,CL1.2,cl2.0,CL2.0,clc++,CLC++">;
-+ HelpText<"OpenCL language standard to compile for.">, Values<"cl,CL,cl1.1,CL1.1,cl1.2,CL1.2,cl2.0,CL2.0,cl3.0,CL3.0,clc++,CLC++">;
- def cl_denorms_are_zero : Flag<["-"], "cl-denorms-are-zero">, Group<opencl_Group>,
- HelpText<"OpenCL only. Allow denormals to be flushed to zero.">;
- def cl_fp32_correctly_rounded_divide_sqrt : Flag<["-"], "cl-fp32-correctly-rounded-divide-sqrt">, Group<opencl_Group>, Flags<[CC1Option]>,
-diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
-index 16a7084f6b08..5920c27229d8 100644
---- a/clang/include/clang/Sema/Sema.h
-+++ b/clang/include/clang/Sema/Sema.h
-@@ -9930,6 +9930,10 @@ public:
- /// \return true if type is disabled.
- bool checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E);
-
-+ bool checkOpenCLSubgroupExtForCallExpr(CallExpr *Call);
-+
-+ bool isSupportedOpenCLOMemoryOrdering(int64_t Ordering) const;
-+
- //===--------------------------------------------------------------------===//
- // OpenMP directives and clauses.
- //
-@@ -11527,6 +11531,11 @@ public:
- /// that the user intended an assignment used as condition.
- void DiagnoseEqualityWithExtraParens(ParenExpr *ParenE);
-
-+ template <typename DiagLocT, typename DiagInfoT>
-+ void DiagnoseOpenCLRequiresOption(llvm::StringRef OpenCLOptName,
-+ DiagLocT DiagLoc, DiagInfoT DiagInfo,
-+ unsigned Selector, SourceRange SrcRange);
-+
- /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
- ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr = false);
-
-diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
-index bf51d35d9693..a54ea8475d7d 100644
---- a/clang/lib/AST/ASTContext.cpp
-+++ b/clang/lib/AST/ASTContext.cpp
-@@ -1433,7 +1433,8 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target,
- ObjCSuperType = QualType();
-
- // void * type
-- if (LangOpts.OpenCLVersion >= 200) {
-+ if (Target.getSupportedOpenCLOpts().isEnabled(
-+ "__opencl_c_generic_address_space")) {
- auto Q = VoidTy.getQualifiers();
- Q.setAddressSpace(LangAS::opencl_generic);
- VoidPtrTy = getPointerType(getCanonicalType(
-diff --git a/clang/lib/Basic/Builtins.cpp b/clang/lib/Basic/Builtins.cpp
-index 0cd89df41b67..7a3067345098 100644
---- a/clang/lib/Basic/Builtins.cpp
-+++ b/clang/lib/Basic/Builtins.cpp
-@@ -23,6 +23,8 @@ static const Builtin::Info BuiltinInfo[] = {
- { #ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr },
- #define LANGBUILTIN(ID, TYPE, ATTRS, LANGS) \
- { #ID, TYPE, ATTRS, nullptr, LANGS, nullptr },
-+#define OPENCLBUILTIN(ID, TYPE, ATTRS, LANGS, FEATURE) \
-+ {#ID, TYPE, ATTRS, nullptr, LANGS, FEATURE},
- #define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, LANGS) \
- { #ID, TYPE, ATTRS, HEADER, LANGS, nullptr },
- #include "clang/Basic/Builtins.def"
-@@ -69,16 +71,17 @@ bool Builtin::Context::builtinIsSupported(const Builtin::Info &BuiltinInfo,
- bool ObjCUnsupported = !LangOpts.ObjC && BuiltinInfo.Langs == OBJC_LANG;
- bool OclC1Unsupported = (LangOpts.OpenCLVersion / 100) != 1 &&
- (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES ) == OCLC1X_LANG;
-- bool OclC2Unsupported =
-- (LangOpts.OpenCLVersion != 200 && !LangOpts.OpenCLCPlusPlus) &&
-- (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES) == OCLC20_LANG;
-+ bool OclC2PUnsupported =
-+ (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES) == OCLC2P_LANG &&
-+ ((LangOpts.OpenCLVersion < 200 && !LangOpts.OpenCLCPlusPlus) ||
-+ !OclBuiltinIsSupported(BuiltinInfo, LangOpts));
- bool OclCUnsupported = !LangOpts.OpenCL &&
- (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES);
- bool OpenMPUnsupported = !LangOpts.OpenMP && BuiltinInfo.Langs == OMP_LANG;
- bool CPlusPlusUnsupported =
- !LangOpts.CPlusPlus && BuiltinInfo.Langs == CXX_LANG;
- return !BuiltinsUnsupported && !MathBuiltinsUnsupported && !OclCUnsupported &&
-- !OclC1Unsupported && !OclC2Unsupported && !OpenMPUnsupported &&
-+ !OclC1Unsupported && !OclC2PUnsupported && !OpenMPUnsupported &&
- !GnuModeUnsupported && !MSModeUnsupported && !ObjCUnsupported &&
- !CPlusPlusUnsupported;
- }
-@@ -191,3 +194,20 @@ bool Builtin::Context::canBeRedeclared(unsigned ID) const {
- (!hasReferenceArgsOrResult(ID) &&
- !hasCustomTypechecking(ID));
- }
-+
-+bool Builtin::Context::OclBuiltinIsSupported(
-+ const Builtin::Info &BuiltinInfo, const LangOptions &LangOpts) const {
-+ if (!requiresFeatures(BuiltinInfo))
-+ return true;
-+
-+ return llvm::StringSwitch<bool>(BuiltinInfo.Features)
-+ .Case("__opencl_c_device_enqueue", LangOpts.Blocks)
-+ .Case("__opencl_c_generic_address_space", LangOpts.OpenCLGenericKeyword)
-+ .Case("__opencl_c_pipes", LangOpts.OpenCLPipeKeyword)
-+ .Default(false);
-+}
-+
-+bool Builtin::Context::requiresFeatures(
-+ const Builtin::Info &BuiltinInfo) const {
-+ return BuiltinInfo.Features && llvm::StringRef(BuiltinInfo.Features) != "";
-+}
-diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
-index eccdc21d724a..6b4f524d5271 100644
---- a/clang/lib/Basic/TargetInfo.cpp
-+++ b/clang/lib/Basic/TargetInfo.cpp
-@@ -387,6 +387,17 @@ void TargetInfo::adjust(LangOptions &Opts) {
- HalfFormat = &llvm::APFloat::IEEEhalf();
- FloatFormat = &llvm::APFloat::IEEEsingle();
- LongDoubleFormat = &llvm::APFloat::IEEEquad();
-+
-+ auto &SupportedOCLOpts = getTargetOpts().SupportedOpenCLOptions;
-+
-+ SupportedOCLOpts.setOpenCLVersion(Opts);
-+ SupportedOCLOpts.adjustFeatures();
-+
-+ if (!Opts.OpenCLCPlusPlus && Opts.OpenCLVersion >= 200)
-+ Opts.Blocks = SupportedOCLOpts.isSupported("__opencl_c_device_enqueue");
-+ Opts.OpenCLGenericKeyword =
-+ SupportedOCLOpts.isSupported("__opencl_c_generic_address_space");
-+ Opts.OpenCLPipeKeyword = SupportedOCLOpts.isSupported("__opencl_c_pipes");
- }
-
- if (Opts.DoubleSize) {
-diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
-index 965f273892bd..046d7c15f835 100644
---- a/clang/lib/Basic/Targets.cpp
-+++ b/clang/lib/Basic/Targets.cpp
-@@ -40,7 +40,6 @@
- #include "clang/Basic/Diagnostic.h"
- #include "llvm/ADT/StringExtras.h"
- #include "llvm/ADT/Triple.h"
--
- using namespace clang;
-
- namespace clang {
-diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
-index 8ce488f35dd3..ca4cb0fbf018 100644
---- a/clang/lib/CodeGen/CodeGenFunction.cpp
-+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
-@@ -2306,11 +2306,11 @@ void CodeGenFunction::checkTargetFeatures(SourceLocation Loc,
- std::string MissingFeature;
- if (BuiltinID) {
- SmallVector<StringRef, 1> ReqFeatures;
-- const char *FeatureList =
-- CGM.getContext().BuiltinInfo.getRequiredFeatures(BuiltinID);
- // Return if the builtin doesn't have any required features.
-- if (!FeatureList || StringRef(FeatureList) == "")
-+ if (!CGM.getContext().BuiltinInfo.requiresFeatures(BuiltinID))
- return;
-+ const char *FeatureList =
-+ CGM.getContext().BuiltinInfo.getRequiredFeatures(BuiltinID);
- StringRef(FeatureList).split(ReqFeatures, ',');
- if (!hasRequiredFeatures(ReqFeatures, CGM, FD, MissingFeature))
- CGM.getDiags().Report(Loc, diag::err_builtin_needs_feature)
-diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
-index 73114c6d76cb..bc54d231b97a 100644
---- a/clang/lib/Frontend/CompilerInvocation.cpp
-+++ b/clang/lib/Frontend/CompilerInvocation.cpp
-@@ -2344,6 +2344,8 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
- Opts.OpenCLVersion = 120;
- else if (LangStd == LangStandard::lang_opencl20)
- Opts.OpenCLVersion = 200;
-+ else if (LangStd == LangStandard::lang_opencl30)
-+ Opts.OpenCLVersion = 300;
- else if (LangStd == LangStandard::lang_openclcpp)
- Opts.OpenCLCPlusPlusVersion = 100;
-
-@@ -2544,14 +2546,15 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
- // -cl-std only applies for OpenCL language standards.
- // Override the -std option in this case.
- if (const Arg *A = Args.getLastArg(OPT_cl_std_EQ)) {
-- LangStandard::Kind OpenCLLangStd
-- = llvm::StringSwitch<LangStandard::Kind>(A->getValue())
-- .Cases("cl", "CL", LangStandard::lang_opencl10)
-- .Cases("cl1.1", "CL1.1", LangStandard::lang_opencl11)
-- .Cases("cl1.2", "CL1.2", LangStandard::lang_opencl12)
-- .Cases("cl2.0", "CL2.0", LangStandard::lang_opencl20)
-- .Cases("clc++", "CLC++", LangStandard::lang_openclcpp)
-- .Default(LangStandard::lang_unspecified);
-+ LangStandard::Kind OpenCLLangStd =
-+ llvm::StringSwitch<LangStandard::Kind>(A->getValue())
-+ .Cases("cl", "CL", LangStandard::lang_opencl10)
-+ .Cases("cl1.1", "CL1.1", LangStandard::lang_opencl11)
-+ .Cases("cl1.2", "CL1.2", LangStandard::lang_opencl12)
-+ .Cases("cl2.0", "CL2.0", LangStandard::lang_opencl20)
-+ .Cases("cl3.0", "CL3.0", LangStandard::lang_opencl30)
-+ .Cases("clc++", "CLC++", LangStandard::lang_openclcpp)
-+ .Default(LangStandard::lang_unspecified);
-
- if (OpenCLLangStd == LangStandard::lang_unspecified) {
- Diags.Report(diag::err_drv_invalid_value)
-@@ -2852,8 +2855,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
-
- Opts.RTTI = Opts.CPlusPlus && !Args.hasArg(OPT_fno_rtti);
- Opts.RTTIData = Opts.RTTI && !Args.hasArg(OPT_fno_rtti_data);
-- Opts.Blocks = Args.hasArg(OPT_fblocks) || (Opts.OpenCL
-- && Opts.OpenCLVersion == 200);
-+ Opts.Blocks = Args.hasArg(OPT_fblocks);
- Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);
- Opts.Coroutines = Opts.CPlusPlus20 || Args.hasArg(OPT_fcoroutines_ts);
-
-diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
-index 6eef1e2376f6..5bb489c11909 100644
---- a/clang/lib/Frontend/InitPreprocessor.cpp
-+++ b/clang/lib/Frontend/InitPreprocessor.cpp
-@@ -445,6 +445,9 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
- case 200:
- Builder.defineMacro("__OPENCL_C_VERSION__", "200");
- break;
-+ case 300:
-+ Builder.defineMacro("__OPENCL_C_VERSION__", "300");
-+ break;
- default:
- llvm_unreachable("Unsupported OpenCL version");
- }
-@@ -453,6 +456,7 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
- Builder.defineMacro("CL_VERSION_1_1", "110");
- Builder.defineMacro("CL_VERSION_1_2", "120");
- Builder.defineMacro("CL_VERSION_2_0", "200");
-+ Builder.defineMacro("CL_VERSION_3_0", "300");
-
- if (TI.isLittleEndian())
- Builder.defineMacro("__ENDIAN_LITTLE__");
-@@ -1108,7 +1112,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
- // OpenCL definitions.
- if (LangOpts.OpenCL) {
- #define OPENCLEXT(Ext) \
-- if (TI.getSupportedOpenCLOpts().isSupported(#Ext, LangOpts)) \
-+ if (TI.getSupportedOpenCLOpts().isSupported(#Ext)) \
- Builder.defineMacro(#Ext);
- #include "clang/Basic/OpenCLExtensions.def"
-
-diff --git a/clang/lib/Headers/opencl-c-base.h b/clang/lib/Headers/opencl-c-base.h
-index 430e07d36f62..afa900ab24d9 100644
---- a/clang/lib/Headers/opencl-c-base.h
-+++ b/clang/lib/Headers/opencl-c-base.h
-@@ -9,6 +9,59 @@
- #ifndef _OPENCL_BASE_H_
- #define _OPENCL_BASE_H_
-
-+// Add predefined macros to build headers with standalone executable
-+#ifndef CL_VERSION_3_0
-+ #define CL_VERSION_3_0 300
-+#endif
-+
-+// Define features for 2.0 for header backward compatibility
-+#ifndef __opencl_c_int64
-+ #define __opencl_c_int64 1
-+#endif
-+#if __OPENCL_C_VERSION__ != CL_VERSION_3_0
-+ #ifndef __opencl_c_images
-+ #define __opencl_c_images 1
-+ #endif
-+#endif
-+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
-+#ifndef __opencl_c_pipes
-+ #define __opencl_c_pipes 1
-+#endif
-+#ifndef __opencl_c_generic_address_space
-+ #define __opencl_c_generic_address_space 1
-+#endif
-+#ifndef __opencl_c_work_group_collective_functions
-+ #define __opencl_c_work_group_collective_functions 1
-+#endif
-+#ifndef __opencl_c_atomic_order_acq_rel
-+ #define __opencl_c_atomic_order_acq_rel 1
-+#endif
-+#ifndef __opencl_c_atomic_order_seq_cst
-+ #define __opencl_c_atomic_order_seq_cst 1
-+#endif
-+#ifndef __opencl_c_atomic_scope_device
-+ #define __opencl_c_atomic_scope_device 1
-+#endif
-+#ifndef __opencl_c_atomic_scope_all_devices
-+ #define __opencl_c_atomic_scope_all_devices 1
-+#endif
-+#ifndef __opencl_c_subgroups
-+ #define __opencl_c_subgroups 1
-+#endif
-+#ifndef __opencl_c_3d_image_writes
-+ #define __opencl_c_3d_image_writes 1
-+#endif
-+#ifndef __opencl_c_device_enqueue
-+ #define __opencl_c_device_enqueue 1
-+#endif
-+#ifndef __opencl_c_read_write_images
-+ #define __opencl_c_read_write_images 1
-+#endif
-+#ifndef __opencl_c_program_scope_global_variables
-+ #define __opencl_c_program_scope_global_variables 1
-+#endif
-+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
-+
- // built-in scalar data types:
-
- /**
-@@ -115,7 +168,12 @@ typedef half half4 __attribute__((ext_vector_type(4)));
- typedef half half8 __attribute__((ext_vector_type(8)));
- typedef half half16 __attribute__((ext_vector_type(16)));
- #endif
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+
-+#ifndef __opencl_c_fp64
-+ #define __opencl_c_fp64 1
-+#endif
-+
- #if __OPENCL_C_VERSION__ < CL_VERSION_1_2
- #pragma OPENCL EXTENSION cl_khr_fp64 : enable
- #endif
-@@ -281,9 +339,17 @@ typedef uint cl_mem_fence_flags;
- typedef enum memory_scope {
- memory_scope_work_item = __OPENCL_MEMORY_SCOPE_WORK_ITEM,
- memory_scope_work_group = __OPENCL_MEMORY_SCOPE_WORK_GROUP,
-+#ifdef __opencl_c_atomic_scope_device
- memory_scope_device = __OPENCL_MEMORY_SCOPE_DEVICE,
-+#endif
-+#ifdef __opencl_c_atomic_scope_all_devices
-+ #if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+ memory_scope_all_devices = __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES,
-+ #endif //(__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
- memory_scope_all_svm_devices = __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES,
--#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups)
-+#endif // __opencl_c_atomic_scope_all_devices
-+#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups) || \
-+ defined(__opencl_c_subgroups)
- memory_scope_sub_group = __OPENCL_MEMORY_SCOPE_SUB_GROUP
- #endif
- } memory_scope;
-@@ -301,13 +367,14 @@ typedef enum memory_scope {
- #define ATOMIC_FLAG_INIT 0
-
- // enum values aligned with what clang uses in EmitAtomicExpr()
--typedef enum memory_order
--{
-+typedef enum memory_order {
- memory_order_relaxed = __ATOMIC_RELAXED,
- memory_order_acquire = __ATOMIC_ACQUIRE,
- memory_order_release = __ATOMIC_RELEASE,
- memory_order_acq_rel = __ATOMIC_ACQ_REL,
-+#ifdef __opencl_c_atomic_order_seq_cst
- memory_order_seq_cst = __ATOMIC_SEQ_CST
-+#endif //__opencl_c_atomic_order_seq_cst
- } memory_order;
-
- #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
-index 66e18bdd47bb..67d900eb1c3d 100644
---- a/clang/lib/Headers/opencl-c.h
-+++ b/clang/lib/Headers/opencl-c.h
-@@ -35,7 +35,6 @@
- #define __purefn __attribute__((pure))
- #define __cnfn __attribute__((const))
-
--
- // OpenCL v1.1/1.2/2.0 s6.2.3 - Explicit conversions
-
- char __ovld __cnfn convert_char_rte(char);
-@@ -4632,7 +4631,7 @@ float16 __ovld __cnfn convert_float16(float16);
-
- // Conversions with double data type parameters or return value.
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- char __ovld __cnfn convert_char(double);
- char __ovld __cnfn convert_char_rte(double);
- char __ovld __cnfn convert_char_rtn(double);
-@@ -5452,7 +5451,7 @@ double16 __ovld __cnfn convert_double16_rtz(uchar16);
- double16 __ovld __cnfn convert_double16_rtz(uint16);
- double16 __ovld __cnfn convert_double16_rtz(ulong16);
- double16 __ovld __cnfn convert_double16_rtz(ushort16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #ifdef cl_khr_fp16
- // Convert half types to non-double types.
-@@ -6270,7 +6269,7 @@ half16 __ovld __cnfn convert_half16_rtz(float16);
- half16 __ovld __cnfn convert_half16_rtz(half16);
-
- // Convert half types to double types.
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn convert_double(half);
- double __ovld __cnfn convert_double_rte(half);
- double __ovld __cnfn convert_double_rtp(half);
-@@ -6333,7 +6332,7 @@ half16 __ovld __cnfn convert_half16_rte(double16);
- half16 __ovld __cnfn convert_half16_rtp(double16);
- half16 __ovld __cnfn convert_half16_rtn(double16);
- half16 __ovld __cnfn convert_half16_rtz(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #endif // cl_khr_fp16
-
-@@ -6404,14 +6403,14 @@ half16 __ovld __cnfn convert_half16_rtz(double16);
- #define as_float8(x) __builtin_astype((x), float8)
- #define as_float16(x) __builtin_astype((x), float16)
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #define as_double(x) __builtin_astype((x), double)
- #define as_double2(x) __builtin_astype((x), double2)
- #define as_double3(x) __builtin_astype((x), double3)
- #define as_double4(x) __builtin_astype((x), double4)
- #define as_double8(x) __builtin_astype((x), double8)
- #define as_double16(x) __builtin_astype((x), double16)
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #ifdef cl_khr_fp16
- #define as_half(x) __builtin_astype((x), half)
-@@ -6534,14 +6533,14 @@ float3 __ovld __cnfn acos(float3);
- float4 __ovld __cnfn acos(float4);
- float8 __ovld __cnfn acos(float8);
- float16 __ovld __cnfn acos(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn acos(double);
- double2 __ovld __cnfn acos(double2);
- double3 __ovld __cnfn acos(double3);
- double4 __ovld __cnfn acos(double4);
- double8 __ovld __cnfn acos(double8);
- double16 __ovld __cnfn acos(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn acos(half);
- half2 __ovld __cnfn acos(half2);
-@@ -6560,14 +6559,14 @@ float3 __ovld __cnfn acosh(float3);
- float4 __ovld __cnfn acosh(float4);
- float8 __ovld __cnfn acosh(float8);
- float16 __ovld __cnfn acosh(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn acosh(double);
- double2 __ovld __cnfn acosh(double2);
- double3 __ovld __cnfn acosh(double3);
- double4 __ovld __cnfn acosh(double4);
- double8 __ovld __cnfn acosh(double8);
- double16 __ovld __cnfn acosh(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn acosh(half);
- half2 __ovld __cnfn acosh(half2);
-@@ -6586,14 +6585,14 @@ float3 __ovld __cnfn acospi(float3 x);
- float4 __ovld __cnfn acospi(float4 x);
- float8 __ovld __cnfn acospi(float8 x);
- float16 __ovld __cnfn acospi(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn acospi(double x);
- double2 __ovld __cnfn acospi(double2 x);
- double3 __ovld __cnfn acospi(double3 x);
- double4 __ovld __cnfn acospi(double4 x);
- double8 __ovld __cnfn acospi(double8 x);
- double16 __ovld __cnfn acospi(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn acospi(half x);
- half2 __ovld __cnfn acospi(half2 x);
-@@ -6612,14 +6611,14 @@ float3 __ovld __cnfn asin(float3);
- float4 __ovld __cnfn asin(float4);
- float8 __ovld __cnfn asin(float8);
- float16 __ovld __cnfn asin(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn asin(double);
- double2 __ovld __cnfn asin(double2);
- double3 __ovld __cnfn asin(double3);
- double4 __ovld __cnfn asin(double4);
- double8 __ovld __cnfn asin(double8);
- double16 __ovld __cnfn asin(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn asin(half);
- half2 __ovld __cnfn asin(half2);
-@@ -6638,14 +6637,14 @@ float3 __ovld __cnfn asinh(float3);
- float4 __ovld __cnfn asinh(float4);
- float8 __ovld __cnfn asinh(float8);
- float16 __ovld __cnfn asinh(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn asinh(double);
- double2 __ovld __cnfn asinh(double2);
- double3 __ovld __cnfn asinh(double3);
- double4 __ovld __cnfn asinh(double4);
- double8 __ovld __cnfn asinh(double8);
- double16 __ovld __cnfn asinh(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn asinh(half);
- half2 __ovld __cnfn asinh(half2);
-@@ -6664,14 +6663,14 @@ float3 __ovld __cnfn asinpi(float3 x);
- float4 __ovld __cnfn asinpi(float4 x);
- float8 __ovld __cnfn asinpi(float8 x);
- float16 __ovld __cnfn asinpi(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn asinpi(double x);
- double2 __ovld __cnfn asinpi(double2 x);
- double3 __ovld __cnfn asinpi(double3 x);
- double4 __ovld __cnfn asinpi(double4 x);
- double8 __ovld __cnfn asinpi(double8 x);
- double16 __ovld __cnfn asinpi(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn asinpi(half x);
- half2 __ovld __cnfn asinpi(half2 x);
-@@ -6690,14 +6689,14 @@ float3 __ovld __cnfn atan(float3 y_over_x);
- float4 __ovld __cnfn atan(float4 y_over_x);
- float8 __ovld __cnfn atan(float8 y_over_x);
- float16 __ovld __cnfn atan(float16 y_over_x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn atan(double y_over_x);
- double2 __ovld __cnfn atan(double2 y_over_x);
- double3 __ovld __cnfn atan(double3 y_over_x);
- double4 __ovld __cnfn atan(double4 y_over_x);
- double8 __ovld __cnfn atan(double8 y_over_x);
- double16 __ovld __cnfn atan(double16 y_over_x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn atan(half y_over_x);
- half2 __ovld __cnfn atan(half2 y_over_x);
-@@ -6716,14 +6715,14 @@ float3 __ovld __cnfn atan2(float3 y, float3 x);
- float4 __ovld __cnfn atan2(float4 y, float4 x);
- float8 __ovld __cnfn atan2(float8 y, float8 x);
- float16 __ovld __cnfn atan2(float16 y, float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn atan2(double y, double x);
- double2 __ovld __cnfn atan2(double2 y, double2 x);
- double3 __ovld __cnfn atan2(double3 y, double3 x);
- double4 __ovld __cnfn atan2(double4 y, double4 x);
- double8 __ovld __cnfn atan2(double8 y, double8 x);
- double16 __ovld __cnfn atan2(double16 y, double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn atan2(half y, half x);
- half2 __ovld __cnfn atan2(half2 y, half2 x);
-@@ -6742,14 +6741,14 @@ float3 __ovld __cnfn atanh(float3);
- float4 __ovld __cnfn atanh(float4);
- float8 __ovld __cnfn atanh(float8);
- float16 __ovld __cnfn atanh(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn atanh(double);
- double2 __ovld __cnfn atanh(double2);
- double3 __ovld __cnfn atanh(double3);
- double4 __ovld __cnfn atanh(double4);
- double8 __ovld __cnfn atanh(double8);
- double16 __ovld __cnfn atanh(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn atanh(half);
- half2 __ovld __cnfn atanh(half2);
-@@ -6768,14 +6767,14 @@ float3 __ovld __cnfn atanpi(float3 x);
- float4 __ovld __cnfn atanpi(float4 x);
- float8 __ovld __cnfn atanpi(float8 x);
- float16 __ovld __cnfn atanpi(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn atanpi(double x);
- double2 __ovld __cnfn atanpi(double2 x);
- double3 __ovld __cnfn atanpi(double3 x);
- double4 __ovld __cnfn atanpi(double4 x);
- double8 __ovld __cnfn atanpi(double8 x);
- double16 __ovld __cnfn atanpi(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn atanpi(half x);
- half2 __ovld __cnfn atanpi(half2 x);
-@@ -6794,14 +6793,14 @@ float3 __ovld __cnfn atan2pi(float3 y, float3 x);
- float4 __ovld __cnfn atan2pi(float4 y, float4 x);
- float8 __ovld __cnfn atan2pi(float8 y, float8 x);
- float16 __ovld __cnfn atan2pi(float16 y, float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn atan2pi(double y, double x);
- double2 __ovld __cnfn atan2pi(double2 y, double2 x);
- double3 __ovld __cnfn atan2pi(double3 y, double3 x);
- double4 __ovld __cnfn atan2pi(double4 y, double4 x);
- double8 __ovld __cnfn atan2pi(double8 y, double8 x);
- double16 __ovld __cnfn atan2pi(double16 y, double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn atan2pi(half y, half x);
- half2 __ovld __cnfn atan2pi(half2 y, half2 x);
-@@ -6820,14 +6819,14 @@ float3 __ovld __cnfn cbrt(float3);
- float4 __ovld __cnfn cbrt(float4);
- float8 __ovld __cnfn cbrt(float8);
- float16 __ovld __cnfn cbrt(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn cbrt(double);
- double2 __ovld __cnfn cbrt(double2);
- double3 __ovld __cnfn cbrt(double3);
- double4 __ovld __cnfn cbrt(double4);
- double8 __ovld __cnfn cbrt(double8);
- double16 __ovld __cnfn cbrt(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn cbrt(half);
- half2 __ovld __cnfn cbrt(half2);
-@@ -6847,14 +6846,14 @@ float3 __ovld __cnfn ceil(float3);
- float4 __ovld __cnfn ceil(float4);
- float8 __ovld __cnfn ceil(float8);
- float16 __ovld __cnfn ceil(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn ceil(double);
- double2 __ovld __cnfn ceil(double2);
- double3 __ovld __cnfn ceil(double3);
- double4 __ovld __cnfn ceil(double4);
- double8 __ovld __cnfn ceil(double8);
- double16 __ovld __cnfn ceil(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn ceil(half);
- half2 __ovld __cnfn ceil(half2);
-@@ -6873,14 +6872,14 @@ float3 __ovld __cnfn copysign(float3 x, float3 y);
- float4 __ovld __cnfn copysign(float4 x, float4 y);
- float8 __ovld __cnfn copysign(float8 x, float8 y);
- float16 __ovld __cnfn copysign(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn copysign(double x, double y);
- double2 __ovld __cnfn copysign(double2 x, double2 y);
- double3 __ovld __cnfn copysign(double3 x, double3 y);
- double4 __ovld __cnfn copysign(double4 x, double4 y);
- double8 __ovld __cnfn copysign(double8 x, double8 y);
- double16 __ovld __cnfn copysign(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn copysign(half x, half y);
- half2 __ovld __cnfn copysign(half2 x, half2 y);
-@@ -6899,14 +6898,14 @@ float3 __ovld __cnfn cos(float3);
- float4 __ovld __cnfn cos(float4);
- float8 __ovld __cnfn cos(float8);
- float16 __ovld __cnfn cos(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn cos(double);
- double2 __ovld __cnfn cos(double2);
- double3 __ovld __cnfn cos(double3);
- double4 __ovld __cnfn cos(double4);
- double8 __ovld __cnfn cos(double8);
- double16 __ovld __cnfn cos(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn cos(half);
- half2 __ovld __cnfn cos(half2);
-@@ -6925,14 +6924,14 @@ float3 __ovld __cnfn cosh(float3);
- float4 __ovld __cnfn cosh(float4);
- float8 __ovld __cnfn cosh(float8);
- float16 __ovld __cnfn cosh(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn cosh(double);
- double2 __ovld __cnfn cosh(double2);
- double3 __ovld __cnfn cosh(double3);
- double4 __ovld __cnfn cosh(double4);
- double8 __ovld __cnfn cosh(double8);
- double16 __ovld __cnfn cosh(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn cosh(half);
- half2 __ovld __cnfn cosh(half2);
-@@ -6951,14 +6950,14 @@ float3 __ovld __cnfn cospi(float3 x);
- float4 __ovld __cnfn cospi(float4 x);
- float8 __ovld __cnfn cospi(float8 x);
- float16 __ovld __cnfn cospi(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn cospi(double x);
- double2 __ovld __cnfn cospi(double2 x);
- double3 __ovld __cnfn cospi(double3 x);
- double4 __ovld __cnfn cospi(double4 x);
- double8 __ovld __cnfn cospi(double8 x);
- double16 __ovld __cnfn cospi(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn cospi(half x);
- half2 __ovld __cnfn cospi(half2 x);
-@@ -6977,14 +6976,14 @@ float3 __ovld __cnfn erfc(float3);
- float4 __ovld __cnfn erfc(float4);
- float8 __ovld __cnfn erfc(float8);
- float16 __ovld __cnfn erfc(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn erfc(double);
- double2 __ovld __cnfn erfc(double2);
- double3 __ovld __cnfn erfc(double3);
- double4 __ovld __cnfn erfc(double4);
- double8 __ovld __cnfn erfc(double8);
- double16 __ovld __cnfn erfc(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn erfc(half);
- half2 __ovld __cnfn erfc(half2);
-@@ -7004,14 +7003,14 @@ float3 __ovld __cnfn erf(float3);
- float4 __ovld __cnfn erf(float4);
- float8 __ovld __cnfn erf(float8);
- float16 __ovld __cnfn erf(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn erf(double);
- double2 __ovld __cnfn erf(double2);
- double3 __ovld __cnfn erf(double3);
- double4 __ovld __cnfn erf(double4);
- double8 __ovld __cnfn erf(double8);
- double16 __ovld __cnfn erf(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn erf(half);
- half2 __ovld __cnfn erf(half2);
-@@ -7030,14 +7029,14 @@ float3 __ovld __cnfn exp(float3 x);
- float4 __ovld __cnfn exp(float4 x);
- float8 __ovld __cnfn exp(float8 x);
- float16 __ovld __cnfn exp(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn exp(double x);
- double2 __ovld __cnfn exp(double2 x);
- double3 __ovld __cnfn exp(double3 x);
- double4 __ovld __cnfn exp(double4 x);
- double8 __ovld __cnfn exp(double8 x);
- double16 __ovld __cnfn exp(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn exp(half x);
- half2 __ovld __cnfn exp(half2 x);
-@@ -7056,14 +7055,14 @@ float3 __ovld __cnfn exp2(float3);
- float4 __ovld __cnfn exp2(float4);
- float8 __ovld __cnfn exp2(float8);
- float16 __ovld __cnfn exp2(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn exp2(double);
- double2 __ovld __cnfn exp2(double2);
- double3 __ovld __cnfn exp2(double3);
- double4 __ovld __cnfn exp2(double4);
- double8 __ovld __cnfn exp2(double8);
- double16 __ovld __cnfn exp2(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn exp2(half);
- half2 __ovld __cnfn exp2(half2);
-@@ -7082,14 +7081,14 @@ float3 __ovld __cnfn exp10(float3);
- float4 __ovld __cnfn exp10(float4);
- float8 __ovld __cnfn exp10(float8);
- float16 __ovld __cnfn exp10(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn exp10(double);
- double2 __ovld __cnfn exp10(double2);
- double3 __ovld __cnfn exp10(double3);
- double4 __ovld __cnfn exp10(double4);
- double8 __ovld __cnfn exp10(double8);
- double16 __ovld __cnfn exp10(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn exp10(half);
- half2 __ovld __cnfn exp10(half2);
-@@ -7108,14 +7107,14 @@ float3 __ovld __cnfn expm1(float3 x);
- float4 __ovld __cnfn expm1(float4 x);
- float8 __ovld __cnfn expm1(float8 x);
- float16 __ovld __cnfn expm1(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn expm1(double x);
- double2 __ovld __cnfn expm1(double2 x);
- double3 __ovld __cnfn expm1(double3 x);
- double4 __ovld __cnfn expm1(double4 x);
- double8 __ovld __cnfn expm1(double8 x);
- double16 __ovld __cnfn expm1(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn expm1(half x);
- half2 __ovld __cnfn expm1(half2 x);
-@@ -7134,14 +7133,14 @@ float3 __ovld __cnfn fabs(float3);
- float4 __ovld __cnfn fabs(float4);
- float8 __ovld __cnfn fabs(float8);
- float16 __ovld __cnfn fabs(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn fabs(double);
- double2 __ovld __cnfn fabs(double2);
- double3 __ovld __cnfn fabs(double3);
- double4 __ovld __cnfn fabs(double4);
- double8 __ovld __cnfn fabs(double8);
- double16 __ovld __cnfn fabs(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn fabs(half);
- half2 __ovld __cnfn fabs(half2);
-@@ -7160,14 +7159,14 @@ float3 __ovld __cnfn fdim(float3 x, float3 y);
- float4 __ovld __cnfn fdim(float4 x, float4 y);
- float8 __ovld __cnfn fdim(float8 x, float8 y);
- float16 __ovld __cnfn fdim(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn fdim(double x, double y);
- double2 __ovld __cnfn fdim(double2 x, double2 y);
- double3 __ovld __cnfn fdim(double3 x, double3 y);
- double4 __ovld __cnfn fdim(double4 x, double4 y);
- double8 __ovld __cnfn fdim(double8 x, double8 y);
- double16 __ovld __cnfn fdim(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn fdim(half x, half y);
- half2 __ovld __cnfn fdim(half2 x, half2 y);
-@@ -7187,14 +7186,14 @@ float3 __ovld __cnfn floor(float3);
- float4 __ovld __cnfn floor(float4);
- float8 __ovld __cnfn floor(float8);
- float16 __ovld __cnfn floor(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn floor(double);
- double2 __ovld __cnfn floor(double2);
- double3 __ovld __cnfn floor(double3);
- double4 __ovld __cnfn floor(double4);
- double8 __ovld __cnfn floor(double8);
- double16 __ovld __cnfn floor(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn floor(half);
- half2 __ovld __cnfn floor(half2);
-@@ -7217,14 +7216,14 @@ float3 __ovld __cnfn fma(float3 a, float3 b, float3 c);
- float4 __ovld __cnfn fma(float4 a, float4 b, float4 c);
- float8 __ovld __cnfn fma(float8 a, float8 b, float8 c);
- float16 __ovld __cnfn fma(float16 a, float16 b, float16 c);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn fma(double a, double b, double c);
- double2 __ovld __cnfn fma(double2 a, double2 b, double2 c);
- double3 __ovld __cnfn fma(double3 a, double3 b, double3 c);
- double4 __ovld __cnfn fma(double4 a, double4 b, double4 c);
- double8 __ovld __cnfn fma(double8 a, double8 b, double8 c);
- double16 __ovld __cnfn fma(double16 a, double16 b, double16 c);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn fma(half a, half b, half c);
- half2 __ovld __cnfn fma(half2 a, half2 b, half2 c);
-@@ -7251,7 +7250,7 @@ float3 __ovld __cnfn fmax(float3 x, float y);
- float4 __ovld __cnfn fmax(float4 x, float y);
- float8 __ovld __cnfn fmax(float8 x, float y);
- float16 __ovld __cnfn fmax(float16 x, float y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn fmax(double x, double y);
- double2 __ovld __cnfn fmax(double2 x, double2 y);
- double3 __ovld __cnfn fmax(double3 x, double3 y);
-@@ -7263,7 +7262,7 @@ double3 __ovld __cnfn fmax(double3 x, double y);
- double4 __ovld __cnfn fmax(double4 x, double y);
- double8 __ovld __cnfn fmax(double8 x, double y);
- double16 __ovld __cnfn fmax(double16 x, double y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn fmax(half x, half y);
- half2 __ovld __cnfn fmax(half2 x, half2 y);
-@@ -7295,7 +7294,7 @@ float3 __ovld __cnfn fmin(float3 x, float y);
- float4 __ovld __cnfn fmin(float4 x, float y);
- float8 __ovld __cnfn fmin(float8 x, float y);
- float16 __ovld __cnfn fmin(float16 x, float y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn fmin(double x, double y);
- double2 __ovld __cnfn fmin(double2 x, double2 y);
- double3 __ovld __cnfn fmin(double3 x, double3 y);
-@@ -7307,7 +7306,7 @@ double3 __ovld __cnfn fmin(double3 x, double y);
- double4 __ovld __cnfn fmin(double4 x, double y);
- double8 __ovld __cnfn fmin(double8 x, double y);
- double16 __ovld __cnfn fmin(double16 x, double y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn fmin(half x, half y);
- half2 __ovld __cnfn fmin(half2 x, half2 y);
-@@ -7331,14 +7330,14 @@ float3 __ovld __cnfn fmod(float3 x, float3 y);
- float4 __ovld __cnfn fmod(float4 x, float4 y);
- float8 __ovld __cnfn fmod(float8 x, float8 y);
- float16 __ovld __cnfn fmod(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn fmod(double x, double y);
- double2 __ovld __cnfn fmod(double2 x, double2 y);
- double3 __ovld __cnfn fmod(double3 x, double3 y);
- double4 __ovld __cnfn fmod(double4 x, double4 y);
- double8 __ovld __cnfn fmod(double8 x, double8 y);
- double16 __ovld __cnfn fmod(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn fmod(half x, half y);
- half2 __ovld __cnfn fmod(half2 x, half2 y);
-@@ -7352,21 +7351,21 @@ half16 __ovld __cnfn fmod(half16 x, half16 y);
- * Returns fmin(x - floor (x), 0x1.fffffep-1f ).
- * floor(x) is returned in iptr.
- */
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float __ovld fract(float x, float *iptr);
- float2 __ovld fract(float2 x, float2 *iptr);
- float3 __ovld fract(float3 x, float3 *iptr);
- float4 __ovld fract(float4 x, float4 *iptr);
- float8 __ovld fract(float8 x, float8 *iptr);
- float16 __ovld fract(float16 x, float16 *iptr);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld fract(double x, double *iptr);
- double2 __ovld fract(double2 x, double2 *iptr);
- double3 __ovld fract(double3 x, double3 *iptr);
- double4 __ovld fract(double4 x, double4 *iptr);
- double8 __ovld fract(double8 x, double8 *iptr);
- double16 __ovld fract(double16 x, double16 *iptr);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld fract(half x, half *iptr);
- half2 __ovld fract(half2 x, half2 *iptr);
-@@ -7375,7 +7374,9 @@ half4 __ovld fract(half4 x, half4 *iptr);
- half8 __ovld fract(half8 x, half8 *iptr);
- half16 __ovld fract(half16 x, half16 *iptr);
- #endif //cl_khr_fp16
--#else
-+#endif //__opencl_c_generic_address_space
-+
-+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
- float __ovld fract(float x, __global float *iptr);
- float2 __ovld fract(float2 x, __global float2 *iptr);
- float3 __ovld fract(float3 x, __global float3 *iptr);
-@@ -7394,7 +7395,7 @@ float3 __ovld fract(float3 x, __private float3 *iptr);
- float4 __ovld fract(float4 x, __private float4 *iptr);
- float8 __ovld fract(float8 x, __private float8 *iptr);
- float16 __ovld fract(float16 x, __private float16 *iptr);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld fract(double x, __global double *iptr);
- double2 __ovld fract(double2 x, __global double2 *iptr);
- double3 __ovld fract(double3 x, __global double3 *iptr);
-@@ -7413,7 +7414,7 @@ double3 __ovld fract(double3 x, __private double3 *iptr);
- double4 __ovld fract(double4 x, __private double4 *iptr);
- double8 __ovld fract(double8 x, __private double8 *iptr);
- double16 __ovld fract(double16 x, __private double16 *iptr);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld fract(half x, __global half *iptr);
- half2 __ovld fract(half2 x, __global half2 *iptr);
-@@ -7434,29 +7435,29 @@ half4 __ovld fract(half4 x, __private half4 *iptr);
- half8 __ovld fract(half8 x, __private half8 *iptr);
- half16 __ovld fract(half16 x, __private half16 *iptr);
- #endif //cl_khr_fp16
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
--
-+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
-+ //! CL_VERSION_2_0)
- /**
- * Extract mantissa and exponent from x. For each
- * component the mantissa returned is a float with
- * magnitude in the interval [1/2, 1) or 0. Each
- * component of x equals mantissa returned * 2^exp.
- */
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float __ovld frexp(float x, int *exp);
- float2 __ovld frexp(float2 x, int2 *exp);
- float3 __ovld frexp(float3 x, int3 *exp);
- float4 __ovld frexp(float4 x, int4 *exp);
- float8 __ovld frexp(float8 x, int8 *exp);
- float16 __ovld frexp(float16 x, int16 *exp);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld frexp(double x, int *exp);
- double2 __ovld frexp(double2 x, int2 *exp);
- double3 __ovld frexp(double3 x, int3 *exp);
- double4 __ovld frexp(double4 x, int4 *exp);
- double8 __ovld frexp(double8 x, int8 *exp);
- double16 __ovld frexp(double16 x, int16 *exp);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld frexp(half x, int *exp);
- half2 __ovld frexp(half2 x, int2 *exp);
-@@ -7465,7 +7466,9 @@ half4 __ovld frexp(half4 x, int4 *exp);
- half8 __ovld frexp(half8 x, int8 *exp);
- half16 __ovld frexp(half16 x, int16 *exp);
- #endif //cl_khr_fp16
--#else
-+#endif //__opencl_c_generic_address_space
-+
-+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
- float __ovld frexp(float x, __global int *exp);
- float2 __ovld frexp(float2 x, __global int2 *exp);
- float3 __ovld frexp(float3 x, __global int3 *exp);
-@@ -7484,7 +7487,7 @@ float3 __ovld frexp(float3 x, __private int3 *exp);
- float4 __ovld frexp(float4 x, __private int4 *exp);
- float8 __ovld frexp(float8 x, __private int8 *exp);
- float16 __ovld frexp(float16 x, __private int16 *exp);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld frexp(double x, __global int *exp);
- double2 __ovld frexp(double2 x, __global int2 *exp);
- double3 __ovld frexp(double3 x, __global int3 *exp);
-@@ -7503,7 +7506,7 @@ double3 __ovld frexp(double3 x, __private int3 *exp);
- double4 __ovld frexp(double4 x, __private int4 *exp);
- double8 __ovld frexp(double8 x, __private int8 *exp);
- double16 __ovld frexp(double16 x, __private int16 *exp);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld frexp(half x, __global int *exp);
- half2 __ovld frexp(half2 x, __global int2 *exp);
-@@ -7524,7 +7527,8 @@ half4 __ovld frexp(half4 x, __private int4 *exp);
- half8 __ovld frexp(half8 x, __private int8 *exp);
- half16 __ovld frexp(half16 x, __private int16 *exp);
- #endif //cl_khr_fp16
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
-+ //! CL_VERSION_2_0)
-
- /**
- * Compute the value of the square root of x^2 + y^2
-@@ -7536,14 +7540,14 @@ float3 __ovld __cnfn hypot(float3 x, float3 y);
- float4 __ovld __cnfn hypot(float4 x, float4 y);
- float8 __ovld __cnfn hypot(float8 x, float8 y);
- float16 __ovld __cnfn hypot(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn hypot(double x, double y);
- double2 __ovld __cnfn hypot(double2 x, double2 y);
- double3 __ovld __cnfn hypot(double3 x, double3 y);
- double4 __ovld __cnfn hypot(double4 x, double4 y);
- double8 __ovld __cnfn hypot(double8 x, double8 y);
- double16 __ovld __cnfn hypot(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn hypot(half x, half y);
- half2 __ovld __cnfn hypot(half2 x, half2 y);
-@@ -7562,14 +7566,14 @@ int3 __ovld __cnfn ilogb(float3 x);
- int4 __ovld __cnfn ilogb(float4 x);
- int8 __ovld __cnfn ilogb(float8 x);
- int16 __ovld __cnfn ilogb(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn ilogb(double x);
- int2 __ovld __cnfn ilogb(double2 x);
- int3 __ovld __cnfn ilogb(double3 x);
- int4 __ovld __cnfn ilogb(double4 x);
- int8 __ovld __cnfn ilogb(double8 x);
- int16 __ovld __cnfn ilogb(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn ilogb(half x);
- int2 __ovld __cnfn ilogb(half2 x);
-@@ -7593,7 +7597,7 @@ float3 __ovld __cnfn ldexp(float3 x, int n);
- float4 __ovld __cnfn ldexp(float4 x, int n);
- float8 __ovld __cnfn ldexp(float8 x, int n);
- float16 __ovld __cnfn ldexp(float16 x, int n);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn ldexp(double x, int n);
- double2 __ovld __cnfn ldexp(double2 x, int2 n);
- double3 __ovld __cnfn ldexp(double3 x, int3 n);
-@@ -7605,7 +7609,7 @@ double3 __ovld __cnfn ldexp(double3 x, int n);
- double4 __ovld __cnfn ldexp(double4 x, int n);
- double8 __ovld __cnfn ldexp(double8 x, int n);
- double16 __ovld __cnfn ldexp(double16 x, int n);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn ldexp(half x, int n);
- half2 __ovld __cnfn ldexp(half2 x, int2 n);
-@@ -7632,14 +7636,14 @@ float3 __ovld __cnfn lgamma(float3 x);
- float4 __ovld __cnfn lgamma(float4 x);
- float8 __ovld __cnfn lgamma(float8 x);
- float16 __ovld __cnfn lgamma(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn lgamma(double x);
- double2 __ovld __cnfn lgamma(double2 x);
- double3 __ovld __cnfn lgamma(double3 x);
- double4 __ovld __cnfn lgamma(double4 x);
- double8 __ovld __cnfn lgamma(double8 x);
- double16 __ovld __cnfn lgamma(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn lgamma(half x);
- half2 __ovld __cnfn lgamma(half2 x);
-@@ -7649,21 +7653,21 @@ half8 __ovld __cnfn lgamma(half8 x);
- half16 __ovld __cnfn lgamma(half16 x);
- #endif //cl_khr_fp16
-
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float __ovld lgamma_r(float x, int *signp);
- float2 __ovld lgamma_r(float2 x, int2 *signp);
- float3 __ovld lgamma_r(float3 x, int3 *signp);
- float4 __ovld lgamma_r(float4 x, int4 *signp);
- float8 __ovld lgamma_r(float8 x, int8 *signp);
- float16 __ovld lgamma_r(float16 x, int16 *signp);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld lgamma_r(double x, int *signp);
- double2 __ovld lgamma_r(double2 x, int2 *signp);
- double3 __ovld lgamma_r(double3 x, int3 *signp);
- double4 __ovld lgamma_r(double4 x, int4 *signp);
- double8 __ovld lgamma_r(double8 x, int8 *signp);
- double16 __ovld lgamma_r(double16 x, int16 *signp);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld lgamma_r(half x, int *signp);
- half2 __ovld lgamma_r(half2 x, int2 *signp);
-@@ -7672,7 +7676,9 @@ half4 __ovld lgamma_r(half4 x, int4 *signp);
- half8 __ovld lgamma_r(half8 x, int8 *signp);
- half16 __ovld lgamma_r(half16 x, int16 *signp);
- #endif //cl_khr_fp16
--#else
-+#endif //__opencl_c_generic_address_space
-+
-+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
- float __ovld lgamma_r(float x, __global int *signp);
- float2 __ovld lgamma_r(float2 x, __global int2 *signp);
- float3 __ovld lgamma_r(float3 x, __global int3 *signp);
-@@ -7691,7 +7697,7 @@ float3 __ovld lgamma_r(float3 x, __private int3 *signp);
- float4 __ovld lgamma_r(float4 x, __private int4 *signp);
- float8 __ovld lgamma_r(float8 x, __private int8 *signp);
- float16 __ovld lgamma_r(float16 x, __private int16 *signp);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld lgamma_r(double x, __global int *signp);
- double2 __ovld lgamma_r(double2 x, __global int2 *signp);
- double3 __ovld lgamma_r(double3 x, __global int3 *signp);
-@@ -7710,7 +7716,7 @@ double3 __ovld lgamma_r(double3 x, __private int3 *signp);
- double4 __ovld lgamma_r(double4 x, __private int4 *signp);
- double8 __ovld lgamma_r(double8 x, __private int8 *signp);
- double16 __ovld lgamma_r(double16 x, __private int16 *signp);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld lgamma_r(half x, __global int *signp);
- half2 __ovld lgamma_r(half2 x, __global int2 *signp);
-@@ -7731,8 +7737,8 @@ half4 __ovld lgamma_r(half4 x, __private int4 *signp);
- half8 __ovld lgamma_r(half8 x, __private int8 *signp);
- half16 __ovld lgamma_r(half16 x, __private int16 *signp);
- #endif //cl_khr_fp16
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
--
-+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
-+ //! CL_VERSION_2_0)
- /**
- * Compute natural logarithm.
- */
-@@ -7742,14 +7748,14 @@ float3 __ovld __cnfn log(float3);
- float4 __ovld __cnfn log(float4);
- float8 __ovld __cnfn log(float8);
- float16 __ovld __cnfn log(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn log(double);
- double2 __ovld __cnfn log(double2);
- double3 __ovld __cnfn log(double3);
- double4 __ovld __cnfn log(double4);
- double8 __ovld __cnfn log(double8);
- double16 __ovld __cnfn log(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn log(half);
- half2 __ovld __cnfn log(half2);
-@@ -7760,7 +7766,7 @@ half16 __ovld __cnfn log(half16);
- #endif //cl_khr_fp16
-
- /**
-- * Compute a base 2 logarithm.
-+ * Compute a base 2 logarithm
- */
- float __ovld __cnfn log2(float);
- float2 __ovld __cnfn log2(float2);
-@@ -7768,14 +7774,14 @@ float3 __ovld __cnfn log2(float3);
- float4 __ovld __cnfn log2(float4);
- float8 __ovld __cnfn log2(float8);
- float16 __ovld __cnfn log2(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn log2(double);
- double2 __ovld __cnfn log2(double2);
- double3 __ovld __cnfn log2(double3);
- double4 __ovld __cnfn log2(double4);
- double8 __ovld __cnfn log2(double8);
- double16 __ovld __cnfn log2(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn log2(half);
- half2 __ovld __cnfn log2(half2);
-@@ -7794,14 +7800,14 @@ float3 __ovld __cnfn log10(float3);
- float4 __ovld __cnfn log10(float4);
- float8 __ovld __cnfn log10(float8);
- float16 __ovld __cnfn log10(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn log10(double);
- double2 __ovld __cnfn log10(double2);
- double3 __ovld __cnfn log10(double3);
- double4 __ovld __cnfn log10(double4);
- double8 __ovld __cnfn log10(double8);
- double16 __ovld __cnfn log10(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn log10(half);
- half2 __ovld __cnfn log10(half2);
-@@ -7820,14 +7826,14 @@ float3 __ovld __cnfn log1p(float3 x);
- float4 __ovld __cnfn log1p(float4 x);
- float8 __ovld __cnfn log1p(float8 x);
- float16 __ovld __cnfn log1p(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn log1p(double x);
- double2 __ovld __cnfn log1p(double2 x);
- double3 __ovld __cnfn log1p(double3 x);
- double4 __ovld __cnfn log1p(double4 x);
- double8 __ovld __cnfn log1p(double8 x);
- double16 __ovld __cnfn log1p(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn log1p(half x);
- half2 __ovld __cnfn log1p(half2 x);
-@@ -7847,14 +7853,14 @@ float3 __ovld __cnfn logb(float3 x);
- float4 __ovld __cnfn logb(float4 x);
- float8 __ovld __cnfn logb(float8 x);
- float16 __ovld __cnfn logb(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn logb(double x);
- double2 __ovld __cnfn logb(double2 x);
- double3 __ovld __cnfn logb(double3 x);
- double4 __ovld __cnfn logb(double4 x);
- double8 __ovld __cnfn logb(double8 x);
- double16 __ovld __cnfn logb(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn logb(half x);
- half2 __ovld __cnfn logb(half2 x);
-@@ -7877,14 +7883,14 @@ float3 __ovld __cnfn mad(float3 a, float3 b, float3 c);
- float4 __ovld __cnfn mad(float4 a, float4 b, float4 c);
- float8 __ovld __cnfn mad(float8 a, float8 b, float8 c);
- float16 __ovld __cnfn mad(float16 a, float16 b, float16 c);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn mad(double a, double b, double c);
- double2 __ovld __cnfn mad(double2 a, double2 b, double2 c);
- double3 __ovld __cnfn mad(double3 a, double3 b, double3 c);
- double4 __ovld __cnfn mad(double4 a, double4 b, double4 c);
- double8 __ovld __cnfn mad(double8 a, double8 b, double8 c);
- double16 __ovld __cnfn mad(double16 a, double16 b, double16 c);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn mad(half a, half b, half c);
- half2 __ovld __cnfn mad(half2 a, half2 b, half2 c);
-@@ -7904,14 +7910,14 @@ float3 __ovld __cnfn maxmag(float3 x, float3 y);
- float4 __ovld __cnfn maxmag(float4 x, float4 y);
- float8 __ovld __cnfn maxmag(float8 x, float8 y);
- float16 __ovld __cnfn maxmag(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn maxmag(double x, double y);
- double2 __ovld __cnfn maxmag(double2 x, double2 y);
- double3 __ovld __cnfn maxmag(double3 x, double3 y);
- double4 __ovld __cnfn maxmag(double4 x, double4 y);
- double8 __ovld __cnfn maxmag(double8 x, double8 y);
- double16 __ovld __cnfn maxmag(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn maxmag(half x, half y);
- half2 __ovld __cnfn maxmag(half2 x, half2 y);
-@@ -7931,14 +7937,14 @@ float3 __ovld __cnfn minmag(float3 x, float3 y);
- float4 __ovld __cnfn minmag(float4 x, float4 y);
- float8 __ovld __cnfn minmag(float8 x, float8 y);
- float16 __ovld __cnfn minmag(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn minmag(double x, double y);
- double2 __ovld __cnfn minmag(double2 x, double2 y);
- double3 __ovld __cnfn minmag(double3 x, double3 y);
- double4 __ovld __cnfn minmag(double4 x, double4 y);
- double8 __ovld __cnfn minmag(double8 x, double8 y);
- double16 __ovld __cnfn minmag(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn minmag(half x, half y);
- half2 __ovld __cnfn minmag(half2 x, half2 y);
-@@ -7955,21 +7961,21 @@ half16 __ovld __cnfn minmag(half16 x, half16 y);
- * the argument. It stores the integral part in the object
- * pointed to by iptr.
- */
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float __ovld modf(float x, float *iptr);
- float2 __ovld modf(float2 x, float2 *iptr);
- float3 __ovld modf(float3 x, float3 *iptr);
- float4 __ovld modf(float4 x, float4 *iptr);
- float8 __ovld modf(float8 x, float8 *iptr);
- float16 __ovld modf(float16 x, float16 *iptr);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld modf(double x, double *iptr);
- double2 __ovld modf(double2 x, double2 *iptr);
- double3 __ovld modf(double3 x, double3 *iptr);
- double4 __ovld modf(double4 x, double4 *iptr);
- double8 __ovld modf(double8 x, double8 *iptr);
- double16 __ovld modf(double16 x, double16 *iptr);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld modf(half x, half *iptr);
- half2 __ovld modf(half2 x, half2 *iptr);
-@@ -7978,7 +7984,9 @@ half4 __ovld modf(half4 x, half4 *iptr);
- half8 __ovld modf(half8 x, half8 *iptr);
- half16 __ovld modf(half16 x, half16 *iptr);
- #endif //cl_khr_fp16
--#else
-+#endif //__opencl_c_generic_address_space
-+
-+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
- float __ovld modf(float x, __global float *iptr);
- float2 __ovld modf(float2 x, __global float2 *iptr);
- float3 __ovld modf(float3 x, __global float3 *iptr);
-@@ -7997,7 +8005,7 @@ float3 __ovld modf(float3 x, __private float3 *iptr);
- float4 __ovld modf(float4 x, __private float4 *iptr);
- float8 __ovld modf(float8 x, __private float8 *iptr);
- float16 __ovld modf(float16 x, __private float16 *iptr);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld modf(double x, __global double *iptr);
- double2 __ovld modf(double2 x, __global double2 *iptr);
- double3 __ovld modf(double3 x, __global double3 *iptr);
-@@ -8016,7 +8024,7 @@ double3 __ovld modf(double3 x, __private double3 *iptr);
- double4 __ovld modf(double4 x, __private double4 *iptr);
- double8 __ovld modf(double8 x, __private double8 *iptr);
- double16 __ovld modf(double16 x, __private double16 *iptr);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld modf(half x, __global half *iptr);
- half2 __ovld modf(half2 x, __global half2 *iptr);
-@@ -8037,7 +8045,8 @@ half4 __ovld modf(half4 x, __private half4 *iptr);
- half8 __ovld modf(half8 x, __private half8 *iptr);
- half16 __ovld modf(half16 x, __private half16 *iptr);
- #endif //cl_khr_fp16
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
-+ //! CL_VERSION_2_0)
-
- /**
- * Returns a quiet NaN. The nancode may be placed
-@@ -8049,14 +8058,14 @@ float3 __ovld __cnfn nan(uint3 nancode);
- float4 __ovld __cnfn nan(uint4 nancode);
- float8 __ovld __cnfn nan(uint8 nancode);
- float16 __ovld __cnfn nan(uint16 nancode);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn nan(ulong nancode);
- double2 __ovld __cnfn nan(ulong2 nancode);
- double3 __ovld __cnfn nan(ulong3 nancode);
- double4 __ovld __cnfn nan(ulong4 nancode);
- double8 __ovld __cnfn nan(ulong8 nancode);
- double16 __ovld __cnfn nan(ulong16 nancode);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn nan(ushort nancode);
- half2 __ovld __cnfn nan(ushort2 nancode);
-@@ -8079,14 +8088,14 @@ float3 __ovld __cnfn nextafter(float3 x, float3 y);
- float4 __ovld __cnfn nextafter(float4 x, float4 y);
- float8 __ovld __cnfn nextafter(float8 x, float8 y);
- float16 __ovld __cnfn nextafter(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn nextafter(double x, double y);
- double2 __ovld __cnfn nextafter(double2 x, double2 y);
- double3 __ovld __cnfn nextafter(double3 x, double3 y);
- double4 __ovld __cnfn nextafter(double4 x, double4 y);
- double8 __ovld __cnfn nextafter(double8 x, double8 y);
- double16 __ovld __cnfn nextafter(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn nextafter(half x, half y);
- half2 __ovld __cnfn nextafter(half2 x, half2 y);
-@@ -8105,14 +8114,14 @@ float3 __ovld __cnfn pow(float3 x, float3 y);
- float4 __ovld __cnfn pow(float4 x, float4 y);
- float8 __ovld __cnfn pow(float8 x, float8 y);
- float16 __ovld __cnfn pow(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn pow(double x, double y);
- double2 __ovld __cnfn pow(double2 x, double2 y);
- double3 __ovld __cnfn pow(double3 x, double3 y);
- double4 __ovld __cnfn pow(double4 x, double4 y);
- double8 __ovld __cnfn pow(double8 x, double8 y);
- double16 __ovld __cnfn pow(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn pow(half x, half y);
- half2 __ovld __cnfn pow(half2 x, half2 y);
-@@ -8131,14 +8140,14 @@ float3 __ovld __cnfn pown(float3 x, int3 y);
- float4 __ovld __cnfn pown(float4 x, int4 y);
- float8 __ovld __cnfn pown(float8 x, int8 y);
- float16 __ovld __cnfn pown(float16 x, int16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn pown(double x, int y);
- double2 __ovld __cnfn pown(double2 x, int2 y);
- double3 __ovld __cnfn pown(double3 x, int3 y);
- double4 __ovld __cnfn pown(double4 x, int4 y);
- double8 __ovld __cnfn pown(double8 x, int8 y);
- double16 __ovld __cnfn pown(double16 x, int16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn pown(half x, int y);
- half2 __ovld __cnfn pown(half2 x, int2 y);
-@@ -8157,14 +8166,14 @@ float3 __ovld __cnfn powr(float3 x, float3 y);
- float4 __ovld __cnfn powr(float4 x, float4 y);
- float8 __ovld __cnfn powr(float8 x, float8 y);
- float16 __ovld __cnfn powr(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn powr(double x, double y);
- double2 __ovld __cnfn powr(double2 x, double2 y);
- double3 __ovld __cnfn powr(double3 x, double3 y);
- double4 __ovld __cnfn powr(double4 x, double4 y);
- double8 __ovld __cnfn powr(double8 x, double8 y);
- double16 __ovld __cnfn powr(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn powr(half x, half y);
- half2 __ovld __cnfn powr(half2 x, half2 y);
-@@ -8186,14 +8195,14 @@ float3 __ovld __cnfn remainder(float3 x, float3 y);
- float4 __ovld __cnfn remainder(float4 x, float4 y);
- float8 __ovld __cnfn remainder(float8 x, float8 y);
- float16 __ovld __cnfn remainder(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn remainder(double x, double y);
- double2 __ovld __cnfn remainder(double2 x, double2 y);
- double3 __ovld __cnfn remainder(double3 x, double3 y);
- double4 __ovld __cnfn remainder(double4 x, double4 y);
- double8 __ovld __cnfn remainder(double8 x, double8 y);
- double16 __ovld __cnfn remainder(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn remainder(half x, half y);
- half2 __ovld __cnfn remainder(half2 x, half2 y);
-@@ -8215,21 +8224,21 @@ half16 __ovld __cnfn remainder(half16 x, half16 y);
- * sign as x/y. It stores this signed value in the object
- * pointed to by quo.
- */
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float __ovld remquo(float x, float y, int *quo);
- float2 __ovld remquo(float2 x, float2 y, int2 *quo);
- float3 __ovld remquo(float3 x, float3 y, int3 *quo);
- float4 __ovld remquo(float4 x, float4 y, int4 *quo);
- float8 __ovld remquo(float8 x, float8 y, int8 *quo);
- float16 __ovld remquo(float16 x, float16 y, int16 *quo);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld remquo(double x, double y, int *quo);
- double2 __ovld remquo(double2 x, double2 y, int2 *quo);
- double3 __ovld remquo(double3 x, double3 y, int3 *quo);
- double4 __ovld remquo(double4 x, double4 y, int4 *quo);
- double8 __ovld remquo(double8 x, double8 y, int8 *quo);
- double16 __ovld remquo(double16 x, double16 y, int16 *quo);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld remquo(half x, half y, int *quo);
- half2 __ovld remquo(half2 x, half2 y, int2 *quo);
-@@ -8237,9 +8246,10 @@ half3 __ovld remquo(half3 x, half3 y, int3 *quo);
- half4 __ovld remquo(half4 x, half4 y, int4 *quo);
- half8 __ovld remquo(half8 x, half8 y, int8 *quo);
- half16 __ovld remquo(half16 x, half16 y, int16 *quo);
--
- #endif //cl_khr_fp16
--#else
-+#endif //__opencl_c_generic_address_space
-+
-+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
- float __ovld remquo(float x, float y, __global int *quo);
- float2 __ovld remquo(float2 x, float2 y, __global int2 *quo);
- float3 __ovld remquo(float3 x, float3 y, __global int3 *quo);
-@@ -8258,7 +8268,7 @@ float3 __ovld remquo(float3 x, float3 y, __private int3 *quo);
- float4 __ovld remquo(float4 x, float4 y, __private int4 *quo);
- float8 __ovld remquo(float8 x, float8 y, __private int8 *quo);
- float16 __ovld remquo(float16 x, float16 y, __private int16 *quo);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld remquo(double x, double y, __global int *quo);
- double2 __ovld remquo(double2 x, double2 y, __global int2 *quo);
- double3 __ovld remquo(double3 x, double3 y, __global int3 *quo);
-@@ -8277,7 +8287,7 @@ double3 __ovld remquo(double3 x, double3 y, __private int3 *quo);
- double4 __ovld remquo(double4 x, double4 y, __private int4 *quo);
- double8 __ovld remquo(double8 x, double8 y, __private int8 *quo);
- double16 __ovld remquo(double16 x, double16 y, __private int16 *quo);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld remquo(half x, half y, __global int *quo);
- half2 __ovld remquo(half2 x, half2 y, __global int2 *quo);
-@@ -8298,7 +8308,8 @@ half4 __ovld remquo(half4 x, half4 y, __private int4 *quo);
- half8 __ovld remquo(half8 x, half8 y, __private int8 *quo);
- half16 __ovld remquo(half16 x, half16 y, __private int16 *quo);
- #endif //cl_khr_fp16
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
-+ //! CL_VERSION_2_0)
- /**
- * Round to integral value (using round to nearest
- * even rounding mode) in floating-point format.
-@@ -8311,14 +8322,14 @@ float3 __ovld __cnfn rint(float3);
- float4 __ovld __cnfn rint(float4);
- float8 __ovld __cnfn rint(float8);
- float16 __ovld __cnfn rint(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn rint(double);
- double2 __ovld __cnfn rint(double2);
- double3 __ovld __cnfn rint(double3);
- double4 __ovld __cnfn rint(double4);
- double8 __ovld __cnfn rint(double8);
- double16 __ovld __cnfn rint(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn rint(half);
- half2 __ovld __cnfn rint(half2);
-@@ -8337,14 +8348,14 @@ float3 __ovld __cnfn rootn(float3 x, int3 y);
- float4 __ovld __cnfn rootn(float4 x, int4 y);
- float8 __ovld __cnfn rootn(float8 x, int8 y);
- float16 __ovld __cnfn rootn(float16 x, int16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn rootn(double x, int y);
- double2 __ovld __cnfn rootn(double2 x, int2 y);
- double3 __ovld __cnfn rootn(double3 x, int3 y);
- double4 __ovld __cnfn rootn(double4 x, int4 y);
- double8 __ovld __cnfn rootn(double8 x, int8 y);
- double16 __ovld __cnfn rootn(double16 x, int16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn rootn(half x, int y);
- half2 __ovld __cnfn rootn(half2 x, int2 y);
-@@ -8365,14 +8376,14 @@ float3 __ovld __cnfn round(float3 x);
- float4 __ovld __cnfn round(float4 x);
- float8 __ovld __cnfn round(float8 x);
- float16 __ovld __cnfn round(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn round(double x);
- double2 __ovld __cnfn round(double2 x);
- double3 __ovld __cnfn round(double3 x);
- double4 __ovld __cnfn round(double4 x);
- double8 __ovld __cnfn round(double8 x);
- double16 __ovld __cnfn round(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn round(half x);
- half2 __ovld __cnfn round(half2 x);
-@@ -8391,14 +8402,14 @@ float3 __ovld __cnfn rsqrt(float3);
- float4 __ovld __cnfn rsqrt(float4);
- float8 __ovld __cnfn rsqrt(float8);
- float16 __ovld __cnfn rsqrt(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn rsqrt(double);
- double2 __ovld __cnfn rsqrt(double2);
- double3 __ovld __cnfn rsqrt(double3);
- double4 __ovld __cnfn rsqrt(double4);
- double8 __ovld __cnfn rsqrt(double8);
- double16 __ovld __cnfn rsqrt(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn rsqrt(half);
- half2 __ovld __cnfn rsqrt(half2);
-@@ -8417,14 +8428,14 @@ float3 __ovld __cnfn sin(float3);
- float4 __ovld __cnfn sin(float4);
- float8 __ovld __cnfn sin(float8);
- float16 __ovld __cnfn sin(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn sin(double);
- double2 __ovld __cnfn sin(double2);
- double3 __ovld __cnfn sin(double3);
- double4 __ovld __cnfn sin(double4);
- double8 __ovld __cnfn sin(double8);
- double16 __ovld __cnfn sin(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn sin(half);
- half2 __ovld __cnfn sin(half2);
-@@ -8439,21 +8450,21 @@ half16 __ovld __cnfn sin(half16);
- * is the return value and computed cosine is returned
- * in cosval.
- */
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float __ovld sincos(float x, float *cosval);
- float2 __ovld sincos(float2 x, float2 *cosval);
- float3 __ovld sincos(float3 x, float3 *cosval);
- float4 __ovld sincos(float4 x, float4 *cosval);
- float8 __ovld sincos(float8 x, float8 *cosval);
- float16 __ovld sincos(float16 x, float16 *cosval);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld sincos(double x, double *cosval);
- double2 __ovld sincos(double2 x, double2 *cosval);
- double3 __ovld sincos(double3 x, double3 *cosval);
- double4 __ovld sincos(double4 x, double4 *cosval);
- double8 __ovld sincos(double8 x, double8 *cosval);
- double16 __ovld sincos(double16 x, double16 *cosval);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld sincos(half x, half *cosval);
- half2 __ovld sincos(half2 x, half2 *cosval);
-@@ -8462,7 +8473,9 @@ half4 __ovld sincos(half4 x, half4 *cosval);
- half8 __ovld sincos(half8 x, half8 *cosval);
- half16 __ovld sincos(half16 x, half16 *cosval);
- #endif //cl_khr_fp16
--#else
-+#endif //__opencl_c_generic_address_space
-+
-+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
- float __ovld sincos(float x, __global float *cosval);
- float2 __ovld sincos(float2 x, __global float2 *cosval);
- float3 __ovld sincos(float3 x, __global float3 *cosval);
-@@ -8481,7 +8494,7 @@ float3 __ovld sincos(float3 x, __private float3 *cosval);
- float4 __ovld sincos(float4 x, __private float4 *cosval);
- float8 __ovld sincos(float8 x, __private float8 *cosval);
- float16 __ovld sincos(float16 x, __private float16 *cosval);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld sincos(double x, __global double *cosval);
- double2 __ovld sincos(double2 x, __global double2 *cosval);
- double3 __ovld sincos(double3 x, __global double3 *cosval);
-@@ -8500,7 +8513,7 @@ double3 __ovld sincos(double3 x, __private double3 *cosval);
- double4 __ovld sincos(double4 x, __private double4 *cosval);
- double8 __ovld sincos(double8 x, __private double8 *cosval);
- double16 __ovld sincos(double16 x, __private double16 *cosval);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld sincos(half x, __global half *cosval);
- half2 __ovld sincos(half2 x, __global half2 *cosval);
-@@ -8521,8 +8534,8 @@ half4 __ovld sincos(half4 x, __private half4 *cosval);
- half8 __ovld sincos(half8 x, __private half8 *cosval);
- half16 __ovld sincos(half16 x, __private half16 *cosval);
- #endif //cl_khr_fp16
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
--
-+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
-+ //! CL_VERSION_2_0)
- /**
- * Compute hyperbolic sine.
- */
-@@ -8532,14 +8545,14 @@ float3 __ovld __cnfn sinh(float3);
- float4 __ovld __cnfn sinh(float4);
- float8 __ovld __cnfn sinh(float8);
- float16 __ovld __cnfn sinh(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn sinh(double);
- double2 __ovld __cnfn sinh(double2);
- double3 __ovld __cnfn sinh(double3);
- double4 __ovld __cnfn sinh(double4);
- double8 __ovld __cnfn sinh(double8);
- double16 __ovld __cnfn sinh(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn sinh(half);
- half2 __ovld __cnfn sinh(half2);
-@@ -8558,14 +8571,14 @@ float3 __ovld __cnfn sinpi(float3 x);
- float4 __ovld __cnfn sinpi(float4 x);
- float8 __ovld __cnfn sinpi(float8 x);
- float16 __ovld __cnfn sinpi(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn sinpi(double x);
- double2 __ovld __cnfn sinpi(double2 x);
- double3 __ovld __cnfn sinpi(double3 x);
- double4 __ovld __cnfn sinpi(double4 x);
- double8 __ovld __cnfn sinpi(double8 x);
- double16 __ovld __cnfn sinpi(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn sinpi(half x);
- half2 __ovld __cnfn sinpi(half2 x);
-@@ -8584,14 +8597,14 @@ float3 __ovld __cnfn sqrt(float3);
- float4 __ovld __cnfn sqrt(float4);
- float8 __ovld __cnfn sqrt(float8);
- float16 __ovld __cnfn sqrt(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn sqrt(double);
- double2 __ovld __cnfn sqrt(double2);
- double3 __ovld __cnfn sqrt(double3);
- double4 __ovld __cnfn sqrt(double4);
- double8 __ovld __cnfn sqrt(double8);
- double16 __ovld __cnfn sqrt(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn sqrt(half);
- half2 __ovld __cnfn sqrt(half2);
-@@ -8610,14 +8623,14 @@ float3 __ovld __cnfn tan(float3);
- float4 __ovld __cnfn tan(float4);
- float8 __ovld __cnfn tan(float8);
- float16 __ovld __cnfn tan(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn tan(double);
- double2 __ovld __cnfn tan(double2);
- double3 __ovld __cnfn tan(double3);
- double4 __ovld __cnfn tan(double4);
- double8 __ovld __cnfn tan(double8);
- double16 __ovld __cnfn tan(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn tan(half);
- half2 __ovld __cnfn tan(half2);
-@@ -8636,14 +8649,14 @@ float3 __ovld __cnfn tanh(float3);
- float4 __ovld __cnfn tanh(float4);
- float8 __ovld __cnfn tanh(float8);
- float16 __ovld __cnfn tanh(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn tanh(double);
- double2 __ovld __cnfn tanh(double2);
- double3 __ovld __cnfn tanh(double3);
- double4 __ovld __cnfn tanh(double4);
- double8 __ovld __cnfn tanh(double8);
- double16 __ovld __cnfn tanh(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn tanh(half);
- half2 __ovld __cnfn tanh(half2);
-@@ -8662,14 +8675,14 @@ float3 __ovld __cnfn tanpi(float3 x);
- float4 __ovld __cnfn tanpi(float4 x);
- float8 __ovld __cnfn tanpi(float8 x);
- float16 __ovld __cnfn tanpi(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn tanpi(double x);
- double2 __ovld __cnfn tanpi(double2 x);
- double3 __ovld __cnfn tanpi(double3 x);
- double4 __ovld __cnfn tanpi(double4 x);
- double8 __ovld __cnfn tanpi(double8 x);
- double16 __ovld __cnfn tanpi(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn tanpi(half x);
- half2 __ovld __cnfn tanpi(half2 x);
-@@ -8688,14 +8701,14 @@ float3 __ovld __cnfn tgamma(float3);
- float4 __ovld __cnfn tgamma(float4);
- float8 __ovld __cnfn tgamma(float8);
- float16 __ovld __cnfn tgamma(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn tgamma(double);
- double2 __ovld __cnfn tgamma(double2);
- double3 __ovld __cnfn tgamma(double3);
- double4 __ovld __cnfn tgamma(double4);
- double8 __ovld __cnfn tgamma(double8);
- double16 __ovld __cnfn tgamma(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn tgamma(half);
- half2 __ovld __cnfn tgamma(half2);
-@@ -8715,14 +8728,14 @@ float3 __ovld __cnfn trunc(float3);
- float4 __ovld __cnfn trunc(float4);
- float8 __ovld __cnfn trunc(float8);
- float16 __ovld __cnfn trunc(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn trunc(double);
- double2 __ovld __cnfn trunc(double2);
- double3 __ovld __cnfn trunc(double3);
- double4 __ovld __cnfn trunc(double4);
- double8 __ovld __cnfn trunc(double8);
- double16 __ovld __cnfn trunc(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn trunc(half);
- half2 __ovld __cnfn trunc(half2);
-@@ -10108,7 +10121,7 @@ float3 __ovld __cnfn clamp(float3 x, float minval, float maxval);
- float4 __ovld __cnfn clamp(float4 x, float minval, float maxval);
- float8 __ovld __cnfn clamp(float8 x, float minval, float maxval);
- float16 __ovld __cnfn clamp(float16 x, float minval, float maxval);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn clamp(double x, double minval, double maxval);
- double2 __ovld __cnfn clamp(double2 x, double2 minval, double2 maxval);
- double3 __ovld __cnfn clamp(double3 x, double3 minval, double3 maxval);
-@@ -10120,7 +10133,7 @@ double3 __ovld __cnfn clamp(double3 x, double minval, double maxval);
- double4 __ovld __cnfn clamp(double4 x, double minval, double maxval);
- double8 __ovld __cnfn clamp(double8 x, double minval, double maxval);
- double16 __ovld __cnfn clamp(double16 x, double minval, double maxval);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn clamp(half x, half minval, half maxval);
- half2 __ovld __cnfn clamp(half2 x, half2 minval, half2 maxval);
-@@ -10145,14 +10158,14 @@ float3 __ovld __cnfn degrees(float3 radians);
- float4 __ovld __cnfn degrees(float4 radians);
- float8 __ovld __cnfn degrees(float8 radians);
- float16 __ovld __cnfn degrees(float16 radians);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn degrees(double radians);
- double2 __ovld __cnfn degrees(double2 radians);
- double3 __ovld __cnfn degrees(double3 radians);
- double4 __ovld __cnfn degrees(double4 radians);
- double8 __ovld __cnfn degrees(double8 radians);
- double16 __ovld __cnfn degrees(double16 radians);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn degrees(half radians);
- half2 __ovld __cnfn degrees(half2 radians);
-@@ -10177,7 +10190,7 @@ float3 __ovld __cnfn max(float3 x, float y);
- float4 __ovld __cnfn max(float4 x, float y);
- float8 __ovld __cnfn max(float8 x, float y);
- float16 __ovld __cnfn max(float16 x, float y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn max(double x, double y);
- double2 __ovld __cnfn max(double2 x, double2 y);
- double3 __ovld __cnfn max(double3 x, double3 y);
-@@ -10189,7 +10202,7 @@ double3 __ovld __cnfn max(double3 x, double y);
- double4 __ovld __cnfn max(double4 x, double y);
- double8 __ovld __cnfn max(double8 x, double y);
- double16 __ovld __cnfn max(double16 x, double y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn max(half x, half y);
- half2 __ovld __cnfn max(half2 x, half2 y);
-@@ -10219,7 +10232,7 @@ float3 __ovld __cnfn min(float3 x, float y);
- float4 __ovld __cnfn min(float4 x, float y);
- float8 __ovld __cnfn min(float8 x, float y);
- float16 __ovld __cnfn min(float16 x, float y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn min(double x, double y);
- double2 __ovld __cnfn min(double2 x, double2 y);
- double3 __ovld __cnfn min(double3 x, double3 y);
-@@ -10231,7 +10244,7 @@ double3 __ovld __cnfn min(double3 x, double y);
- double4 __ovld __cnfn min(double4 x, double y);
- double8 __ovld __cnfn min(double8 x, double y);
- double16 __ovld __cnfn min(double16 x, double y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn min(half x, half y);
- half2 __ovld __cnfn min(half2 x, half2 y);
-@@ -10264,7 +10277,7 @@ float3 __ovld __cnfn mix(float3 x, float3 y, float a);
- float4 __ovld __cnfn mix(float4 x, float4 y, float a);
- float8 __ovld __cnfn mix(float8 x, float8 y, float a);
- float16 __ovld __cnfn mix(float16 x, float16 y, float a);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn mix(double x, double y, double a);
- double2 __ovld __cnfn mix(double2 x, double2 y, double2 a);
- double3 __ovld __cnfn mix(double3 x, double3 y, double3 a);
-@@ -10276,7 +10289,7 @@ double3 __ovld __cnfn mix(double3 x, double3 y, double a);
- double4 __ovld __cnfn mix(double4 x, double4 y, double a);
- double8 __ovld __cnfn mix(double8 x, double8 y, double a);
- double16 __ovld __cnfn mix(double16 x, double16 y, double a);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn mix(half x, half y, half a);
- half2 __ovld __cnfn mix(half2 x, half2 y, half2 a);
-@@ -10301,14 +10314,14 @@ float3 __ovld __cnfn radians(float3 degrees);
- float4 __ovld __cnfn radians(float4 degrees);
- float8 __ovld __cnfn radians(float8 degrees);
- float16 __ovld __cnfn radians(float16 degrees);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn radians(double degrees);
- double2 __ovld __cnfn radians(double2 degrees);
- double3 __ovld __cnfn radians(double3 degrees);
- double4 __ovld __cnfn radians(double4 degrees);
- double8 __ovld __cnfn radians(double8 degrees);
- double16 __ovld __cnfn radians(double16 degrees);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn radians(half degrees);
- half2 __ovld __cnfn radians(half2 degrees);
-@@ -10332,7 +10345,7 @@ float3 __ovld __cnfn step(float edge, float3 x);
- float4 __ovld __cnfn step(float edge, float4 x);
- float8 __ovld __cnfn step(float edge, float8 x);
- float16 __ovld __cnfn step(float edge, float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn step(double edge, double x);
- double2 __ovld __cnfn step(double2 edge, double2 x);
- double3 __ovld __cnfn step(double3 edge, double3 x);
-@@ -10344,7 +10357,7 @@ double3 __ovld __cnfn step(double edge, double3 x);
- double4 __ovld __cnfn step(double edge, double4 x);
- double8 __ovld __cnfn step(double edge, double8 x);
- double16 __ovld __cnfn step(double edge, double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn step(half edge, half x);
- half2 __ovld __cnfn step(half2 edge, half2 x);
-@@ -10383,7 +10396,7 @@ float3 __ovld __cnfn smoothstep(float edge0, float edge1, float3 x);
- float4 __ovld __cnfn smoothstep(float edge0, float edge1, float4 x);
- float8 __ovld __cnfn smoothstep(float edge0, float edge1, float8 x);
- float16 __ovld __cnfn smoothstep(float edge0, float edge1, float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn smoothstep(double edge0, double edge1, double x);
- double2 __ovld __cnfn smoothstep(double2 edge0, double2 edge1, double2 x);
- double3 __ovld __cnfn smoothstep(double3 edge0, double3 edge1, double3 x);
-@@ -10395,7 +10408,7 @@ double3 __ovld __cnfn smoothstep(double edge0, double edge1, double3 x);
- double4 __ovld __cnfn smoothstep(double edge0, double edge1, double4 x);
- double8 __ovld __cnfn smoothstep(double edge0, double edge1, double8 x);
- double16 __ovld __cnfn smoothstep(double edge0, double edge1, double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn smoothstep(half edge0, half edge1, half x);
- half2 __ovld __cnfn smoothstep(half2 edge0, half2 edge1, half2 x);
-@@ -10420,14 +10433,14 @@ float3 __ovld __cnfn sign(float3 x);
- float4 __ovld __cnfn sign(float4 x);
- float8 __ovld __cnfn sign(float8 x);
- float16 __ovld __cnfn sign(float16 x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn sign(double x);
- double2 __ovld __cnfn sign(double2 x);
- double3 __ovld __cnfn sign(double3 x);
- double4 __ovld __cnfn sign(double4 x);
- double8 __ovld __cnfn sign(double8 x);
- double16 __ovld __cnfn sign(double16 x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn sign(half x);
- half2 __ovld __cnfn sign(half2 x);
-@@ -10445,10 +10458,10 @@ half16 __ovld __cnfn sign(half16 x);
- */
- float4 __ovld __cnfn cross(float4 p0, float4 p1);
- float3 __ovld __cnfn cross(float3 p0, float3 p1);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double4 __ovld __cnfn cross(double4 p0, double4 p1);
- double3 __ovld __cnfn cross(double3 p0, double3 p1);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half4 __ovld __cnfn cross(half4 p0, half4 p1);
- half3 __ovld __cnfn cross(half3 p0, half3 p1);
-@@ -10461,12 +10474,12 @@ float __ovld __cnfn dot(float p0, float p1);
- float __ovld __cnfn dot(float2 p0, float2 p1);
- float __ovld __cnfn dot(float3 p0, float3 p1);
- float __ovld __cnfn dot(float4 p0, float4 p1);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn dot(double p0, double p1);
- double __ovld __cnfn dot(double2 p0, double2 p1);
- double __ovld __cnfn dot(double3 p0, double3 p1);
- double __ovld __cnfn dot(double4 p0, double4 p1);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn dot(half p0, half p1);
- half __ovld __cnfn dot(half2 p0, half2 p1);
-@@ -10482,12 +10495,12 @@ float __ovld __cnfn distance(float p0, float p1);
- float __ovld __cnfn distance(float2 p0, float2 p1);
- float __ovld __cnfn distance(float3 p0, float3 p1);
- float __ovld __cnfn distance(float4 p0, float4 p1);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn distance(double p0, double p1);
- double __ovld __cnfn distance(double2 p0, double2 p1);
- double __ovld __cnfn distance(double3 p0, double3 p1);
- double __ovld __cnfn distance(double4 p0, double4 p1);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn distance(half p0, half p1);
- half __ovld __cnfn distance(half2 p0, half2 p1);
-@@ -10503,12 +10516,12 @@ float __ovld __cnfn length(float p);
- float __ovld __cnfn length(float2 p);
- float __ovld __cnfn length(float3 p);
- float __ovld __cnfn length(float4 p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn length(double p);
- double __ovld __cnfn length(double2 p);
- double __ovld __cnfn length(double3 p);
- double __ovld __cnfn length(double4 p);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn length(half p);
- half __ovld __cnfn length(half2 p);
-@@ -10524,12 +10537,12 @@ float __ovld __cnfn normalize(float p);
- float2 __ovld __cnfn normalize(float2 p);
- float3 __ovld __cnfn normalize(float3 p);
- float4 __ovld __cnfn normalize(float4 p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn normalize(double p);
- double2 __ovld __cnfn normalize(double2 p);
- double3 __ovld __cnfn normalize(double3 p);
- double4 __ovld __cnfn normalize(double4 p);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn normalize(half p);
- half2 __ovld __cnfn normalize(half2 p);
-@@ -10610,14 +10623,14 @@ int3 __ovld __cnfn isequal(float3 x, float3 y);
- int4 __ovld __cnfn isequal(float4 x, float4 y);
- int8 __ovld __cnfn isequal(float8 x, float8 y);
- int16 __ovld __cnfn isequal(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isequal(double x, double y);
- long2 __ovld __cnfn isequal(double2 x, double2 y);
- long3 __ovld __cnfn isequal(double3 x, double3 y);
- long4 __ovld __cnfn isequal(double4 x, double4 y);
- long8 __ovld __cnfn isequal(double8 x, double8 y);
- long16 __ovld __cnfn isequal(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isequal(half x, half y);
- short2 __ovld __cnfn isequal(half2 x, half2 y);
-@@ -10636,14 +10649,14 @@ int3 __ovld __cnfn isnotequal(float3 x, float3 y);
- int4 __ovld __cnfn isnotequal(float4 x, float4 y);
- int8 __ovld __cnfn isnotequal(float8 x, float8 y);
- int16 __ovld __cnfn isnotequal(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isnotequal(double x, double y);
- long2 __ovld __cnfn isnotequal(double2 x, double2 y);
- long3 __ovld __cnfn isnotequal(double3 x, double3 y);
- long4 __ovld __cnfn isnotequal(double4 x, double4 y);
- long8 __ovld __cnfn isnotequal(double8 x, double8 y);
- long16 __ovld __cnfn isnotequal(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isnotequal(half x, half y);
- short2 __ovld __cnfn isnotequal(half2 x, half2 y);
-@@ -10662,14 +10675,14 @@ int3 __ovld __cnfn isgreater(float3 x, float3 y);
- int4 __ovld __cnfn isgreater(float4 x, float4 y);
- int8 __ovld __cnfn isgreater(float8 x, float8 y);
- int16 __ovld __cnfn isgreater(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isgreater(double x, double y);
- long2 __ovld __cnfn isgreater(double2 x, double2 y);
- long3 __ovld __cnfn isgreater(double3 x, double3 y);
- long4 __ovld __cnfn isgreater(double4 x, double4 y);
- long8 __ovld __cnfn isgreater(double8 x, double8 y);
- long16 __ovld __cnfn isgreater(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isgreater(half x, half y);
- short2 __ovld __cnfn isgreater(half2 x, half2 y);
-@@ -10688,14 +10701,14 @@ int3 __ovld __cnfn isgreaterequal(float3 x, float3 y);
- int4 __ovld __cnfn isgreaterequal(float4 x, float4 y);
- int8 __ovld __cnfn isgreaterequal(float8 x, float8 y);
- int16 __ovld __cnfn isgreaterequal(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isgreaterequal(double x, double y);
- long2 __ovld __cnfn isgreaterequal(double2 x, double2 y);
- long3 __ovld __cnfn isgreaterequal(double3 x, double3 y);
- long4 __ovld __cnfn isgreaterequal(double4 x, double4 y);
- long8 __ovld __cnfn isgreaterequal(double8 x, double8 y);
- long16 __ovld __cnfn isgreaterequal(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isgreaterequal(half x, half y);
- short2 __ovld __cnfn isgreaterequal(half2 x, half2 y);
-@@ -10714,14 +10727,14 @@ int3 __ovld __cnfn isless(float3 x, float3 y);
- int4 __ovld __cnfn isless(float4 x, float4 y);
- int8 __ovld __cnfn isless(float8 x, float8 y);
- int16 __ovld __cnfn isless(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isless(double x, double y);
- long2 __ovld __cnfn isless(double2 x, double2 y);
- long3 __ovld __cnfn isless(double3 x, double3 y);
- long4 __ovld __cnfn isless(double4 x, double4 y);
- long8 __ovld __cnfn isless(double8 x, double8 y);
- long16 __ovld __cnfn isless(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isless(half x, half y);
- short2 __ovld __cnfn isless(half2 x, half2 y);
-@@ -10740,14 +10753,14 @@ int3 __ovld __cnfn islessequal(float3 x, float3 y);
- int4 __ovld __cnfn islessequal(float4 x, float4 y);
- int8 __ovld __cnfn islessequal(float8 x, float8 y);
- int16 __ovld __cnfn islessequal(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn islessequal(double x, double y);
- long2 __ovld __cnfn islessequal(double2 x, double2 y);
- long3 __ovld __cnfn islessequal(double3 x, double3 y);
- long4 __ovld __cnfn islessequal(double4 x, double4 y);
- long8 __ovld __cnfn islessequal(double8 x, double8 y);
- long16 __ovld __cnfn islessequal(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn islessequal(half x, half y);
- short2 __ovld __cnfn islessequal(half2 x, half2 y);
-@@ -10767,14 +10780,14 @@ int3 __ovld __cnfn islessgreater(float3 x, float3 y);
- int4 __ovld __cnfn islessgreater(float4 x, float4 y);
- int8 __ovld __cnfn islessgreater(float8 x, float8 y);
- int16 __ovld __cnfn islessgreater(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn islessgreater(double x, double y);
- long2 __ovld __cnfn islessgreater(double2 x, double2 y);
- long3 __ovld __cnfn islessgreater(double3 x, double3 y);
- long4 __ovld __cnfn islessgreater(double4 x, double4 y);
- long8 __ovld __cnfn islessgreater(double8 x, double8 y);
- long16 __ovld __cnfn islessgreater(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn islessgreater(half x, half y);
- short2 __ovld __cnfn islessgreater(half2 x, half2 y);
-@@ -10793,14 +10806,14 @@ int3 __ovld __cnfn isfinite(float3);
- int4 __ovld __cnfn isfinite(float4);
- int8 __ovld __cnfn isfinite(float8);
- int16 __ovld __cnfn isfinite(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isfinite(double);
- long2 __ovld __cnfn isfinite(double2);
- long3 __ovld __cnfn isfinite(double3);
- long4 __ovld __cnfn isfinite(double4);
- long8 __ovld __cnfn isfinite(double8);
- long16 __ovld __cnfn isfinite(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isfinite(half);
- short2 __ovld __cnfn isfinite(half2);
-@@ -10819,14 +10832,14 @@ int3 __ovld __cnfn isinf(float3);
- int4 __ovld __cnfn isinf(float4);
- int8 __ovld __cnfn isinf(float8);
- int16 __ovld __cnfn isinf(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isinf(double);
- long2 __ovld __cnfn isinf(double2);
- long3 __ovld __cnfn isinf(double3);
- long4 __ovld __cnfn isinf(double4);
- long8 __ovld __cnfn isinf(double8);
- long16 __ovld __cnfn isinf(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isinf(half);
- short2 __ovld __cnfn isinf(half2);
-@@ -10845,14 +10858,14 @@ int3 __ovld __cnfn isnan(float3);
- int4 __ovld __cnfn isnan(float4);
- int8 __ovld __cnfn isnan(float8);
- int16 __ovld __cnfn isnan(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isnan(double);
- long2 __ovld __cnfn isnan(double2);
- long3 __ovld __cnfn isnan(double3);
- long4 __ovld __cnfn isnan(double4);
- long8 __ovld __cnfn isnan(double8);
- long16 __ovld __cnfn isnan(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isnan(half);
- short2 __ovld __cnfn isnan(half2);
-@@ -10871,14 +10884,14 @@ int3 __ovld __cnfn isnormal(float3);
- int4 __ovld __cnfn isnormal(float4);
- int8 __ovld __cnfn isnormal(float8);
- int16 __ovld __cnfn isnormal(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isnormal(double);
- long2 __ovld __cnfn isnormal(double2);
- long3 __ovld __cnfn isnormal(double3);
- long4 __ovld __cnfn isnormal(double4);
- long8 __ovld __cnfn isnormal(double8);
- long16 __ovld __cnfn isnormal(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isnormal(half);
- short2 __ovld __cnfn isnormal(half2);
-@@ -10899,14 +10912,14 @@ int3 __ovld __cnfn isordered(float3 x, float3 y);
- int4 __ovld __cnfn isordered(float4 x, float4 y);
- int8 __ovld __cnfn isordered(float8 x, float8 y);
- int16 __ovld __cnfn isordered(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isordered(double x, double y);
- long2 __ovld __cnfn isordered(double2 x, double2 y);
- long3 __ovld __cnfn isordered(double3 x, double3 y);
- long4 __ovld __cnfn isordered(double4 x, double4 y);
- long8 __ovld __cnfn isordered(double8 x, double8 y);
- long16 __ovld __cnfn isordered(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isordered(half x, half y);
- short2 __ovld __cnfn isordered(half2 x, half2 y);
-@@ -10927,14 +10940,14 @@ int3 __ovld __cnfn isunordered(float3 x, float3 y);
- int4 __ovld __cnfn isunordered(float4 x, float4 y);
- int8 __ovld __cnfn isunordered(float8 x, float8 y);
- int16 __ovld __cnfn isunordered(float16 x, float16 y);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn isunordered(double x, double y);
- long2 __ovld __cnfn isunordered(double2 x, double2 y);
- long3 __ovld __cnfn isunordered(double3 x, double3 y);
- long4 __ovld __cnfn isunordered(double4 x, double4 y);
- long8 __ovld __cnfn isunordered(double8 x, double8 y);
- long16 __ovld __cnfn isunordered(double16 x, double16 y);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn isunordered(half x, half y);
- short2 __ovld __cnfn isunordered(half2 x, half2 y);
-@@ -10957,14 +10970,14 @@ int3 __ovld __cnfn signbit(float3);
- int4 __ovld __cnfn signbit(float4);
- int8 __ovld __cnfn signbit(float8);
- int16 __ovld __cnfn signbit(float16);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- int __ovld __cnfn signbit(double);
- long2 __ovld __cnfn signbit(double2);
- long3 __ovld __cnfn signbit(double3);
- long4 __ovld __cnfn signbit(double4);
- long8 __ovld __cnfn signbit(double8);
- long16 __ovld __cnfn signbit(double16);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- int __ovld __cnfn signbit(half);
- short2 __ovld __cnfn signbit(half2);
-@@ -11091,14 +11104,14 @@ float3 __ovld __cnfn bitselect(float3 a, float3 b, float3 c);
- float4 __ovld __cnfn bitselect(float4 a, float4 b, float4 c);
- float8 __ovld __cnfn bitselect(float8 a, float8 b, float8 c);
- float16 __ovld __cnfn bitselect(float16 a, float16 b, float16 c);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn bitselect(double a, double b, double c);
- double2 __ovld __cnfn bitselect(double2 a, double2 b, double2 c);
- double3 __ovld __cnfn bitselect(double3 a, double3 b, double3 c);
- double4 __ovld __cnfn bitselect(double4 a, double4 b, double4 c);
- double8 __ovld __cnfn bitselect(double8 a, double8 b, double8 c);
- double16 __ovld __cnfn bitselect(double16 a, double16 b, double16 c);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn bitselect(half a, half b, half c);
- half2 __ovld __cnfn bitselect(half2 a, half2 b, half2 c);
-@@ -11231,7 +11244,7 @@ ulong8 __ovld __cnfn select(ulong8 a, ulong8 b, ulong8 c);
- long16 __ovld __cnfn select(long16 a, long16 b, ulong16 c);
- ulong16 __ovld __cnfn select(ulong16 a, ulong16 b, ulong16 c);
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __cnfn select(double a, double b, long c);
- double2 __ovld __cnfn select(double2 a, double2 b, long2 c);
- double3 __ovld __cnfn select(double3 a, double3 b, long3 c);
-@@ -11244,7 +11257,7 @@ double3 __ovld __cnfn select(double3 a, double3 b, ulong3 c);
- double4 __ovld __cnfn select(double4 a, double4 b, ulong4 c);
- double8 __ovld __cnfn select(double8 a, double8 b, ulong8 c);
- double16 __ovld __cnfn select(double16 a, double16 b, ulong16 c);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- half __ovld __cnfn select(half a, half b, short c);
- half2 __ovld __cnfn select(half2 a, half2 b, short2 c);
-@@ -11323,13 +11336,13 @@ uint16 __ovld vload16(size_t offset, const __constant uint *p);
- long16 __ovld vload16(size_t offset, const __constant long *p);
- ulong16 __ovld vload16(size_t offset, const __constant ulong *p);
- float16 __ovld vload16(size_t offset, const __constant float *p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double2 __ovld vload2(size_t offset, const __constant double *p);
- double3 __ovld vload3(size_t offset, const __constant double *p);
- double4 __ovld vload4(size_t offset, const __constant double *p);
- double8 __ovld vload8(size_t offset, const __constant double *p);
- double16 __ovld vload16(size_t offset, const __constant double *p);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #ifdef cl_khr_fp16
- half __ovld vload(size_t offset, const __constant half *p);
-@@ -11340,7 +11353,7 @@ half8 __ovld vload8(size_t offset, const __constant half *p);
- half16 __ovld vload16(size_t offset, const __constant half *p);
- #endif //cl_khr_fp16
-
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- char2 __ovld vload2(size_t offset, const char *p);
- uchar2 __ovld vload2(size_t offset, const uchar *p);
- short2 __ovld vload2(size_t offset, const short *p);
-@@ -11387,13 +11400,13 @@ long16 __ovld vload16(size_t offset, const long *p);
- ulong16 __ovld vload16(size_t offset, const ulong *p);
- float16 __ovld vload16(size_t offset, const float *p);
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double2 __ovld vload2(size_t offset, const double *p);
- double3 __ovld vload3(size_t offset, const double *p);
- double4 __ovld vload4(size_t offset, const double *p);
- double8 __ovld vload8(size_t offset, const double *p);
- double16 __ovld vload16(size_t offset, const double *p);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #ifdef cl_khr_fp16
- half __ovld vload(size_t offset, const half *p);
-@@ -11403,7 +11416,7 @@ half4 __ovld vload4(size_t offset, const half *p);
- half8 __ovld vload8(size_t offset, const half *p);
- half16 __ovld vload16(size_t offset, const half *p);
- #endif //cl_khr_fp16
--#else
-+#endif //__opencl_c_generic_address_space
- char2 __ovld vload2(size_t offset, const __global char *p);
- uchar2 __ovld vload2(size_t offset, const __global uchar *p);
- short2 __ovld vload2(size_t offset, const __global short *p);
-@@ -11540,7 +11553,7 @@ long16 __ovld vload16(size_t offset, const __private long *p);
- ulong16 __ovld vload16(size_t offset, const __private ulong *p);
- float16 __ovld vload16(size_t offset, const __private float *p);
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double2 __ovld vload2(size_t offset, const __global double *p);
- double3 __ovld vload3(size_t offset, const __global double *p);
- double4 __ovld vload4(size_t offset, const __global double *p);
-@@ -11556,7 +11569,7 @@ double3 __ovld vload3(size_t offset, const __private double *p);
- double4 __ovld vload4(size_t offset, const __private double *p);
- double8 __ovld vload8(size_t offset, const __private double *p);
- double16 __ovld vload16(size_t offset, const __private double *p);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #ifdef cl_khr_fp16
- half __ovld vload(size_t offset, const __global half *p);
-@@ -11578,9 +11591,8 @@ half4 __ovld vload4(size_t offset, const __private half *p);
- half8 __ovld vload8(size_t offset, const __private half *p);
- half16 __ovld vload16(size_t offset, const __private half *p);
- #endif //cl_khr_fp16
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- void __ovld vstore2(char2 data, size_t offset, char *p);
- void __ovld vstore2(uchar2 data, size_t offset, uchar *p);
- void __ovld vstore2(short2 data, size_t offset, short *p);
-@@ -11626,13 +11638,13 @@ void __ovld vstore16(uint16 data, size_t offset, uint *p);
- void __ovld vstore16(long16 data, size_t offset, long *p);
- void __ovld vstore16(ulong16 data, size_t offset, ulong *p);
- void __ovld vstore16(float16 data, size_t offset, float *p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld vstore2(double2 data, size_t offset, double *p);
- void __ovld vstore3(double3 data, size_t offset, double *p);
- void __ovld vstore4(double4 data, size_t offset, double *p);
- void __ovld vstore8(double8 data, size_t offset, double *p);
- void __ovld vstore16(double16 data, size_t offset, double *p);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- void __ovld vstore(half data, size_t offset, half *p);
- void __ovld vstore2(half2 data, size_t offset, half *p);
-@@ -11641,7 +11653,7 @@ void __ovld vstore4(half4 data, size_t offset, half *p);
- void __ovld vstore8(half8 data, size_t offset, half *p);
- void __ovld vstore16(half16 data, size_t offset, half *p);
- #endif //cl_khr_fp16
--#else
-+#endif //__opencl_c_generic_address_space
- void __ovld vstore2(char2 data, size_t offset, __global char *p);
- void __ovld vstore2(uchar2 data, size_t offset, __global uchar *p);
- void __ovld vstore2(short2 data, size_t offset, __global short *p);
-@@ -11777,7 +11789,7 @@ void __ovld vstore16(uint16 data, size_t offset, __private uint *p);
- void __ovld vstore16(long16 data, size_t offset, __private long *p);
- void __ovld vstore16(ulong16 data, size_t offset, __private ulong *p);
- void __ovld vstore16(float16 data, size_t offset, __private float *p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld vstore2(double2 data, size_t offset, __global double *p);
- void __ovld vstore3(double3 data, size_t offset, __global double *p);
- void __ovld vstore4(double4 data, size_t offset, __global double *p);
-@@ -11793,7 +11805,7 @@ void __ovld vstore3(double3 data, size_t offset, __private double *p);
- void __ovld vstore4(double4 data, size_t offset, __private double *p);
- void __ovld vstore8(double8 data, size_t offset, __private double *p);
- void __ovld vstore16(double16 data, size_t offset, __private double *p);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- void __ovld vstore(half data, size_t offset, __global half *p);
- void __ovld vstore2(half2 data, size_t offset, __global half *p);
-@@ -11814,7 +11826,6 @@ void __ovld vstore4(half4 data, size_t offset, __private half *p);
- void __ovld vstore8(half8 data, size_t offset, __private half *p);
- void __ovld vstore16(half16 data, size_t offset, __private half *p);
- #endif //cl_khr_fp16
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
- * Read sizeof (half) bytes of data from address
-@@ -11825,13 +11836,12 @@ void __ovld vstore16(half16 data, size_t offset, __private half *p);
- * must be 16-bit aligned.
- */
- float __ovld vload_half(size_t offset, const __constant half *p);
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float __ovld vload_half(size_t offset, const half *p);
--#else
-+#endif //__opencl_c_generic_address_space
- float __ovld vload_half(size_t offset, const __global half *p);
- float __ovld vload_half(size_t offset, const __local half *p);
- float __ovld vload_half(size_t offset, const __private half *p);
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
- * Read sizeof (halfn) bytes of data from address
-@@ -11846,13 +11856,13 @@ float3 __ovld vload_half3(size_t offset, const __constant half *p);
- float4 __ovld vload_half4(size_t offset, const __constant half *p);
- float8 __ovld vload_half8(size_t offset, const __constant half *p);
- float16 __ovld vload_half16(size_t offset, const __constant half *p);
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float2 __ovld vload_half2(size_t offset, const half *p);
- float3 __ovld vload_half3(size_t offset, const half *p);
- float4 __ovld vload_half4(size_t offset, const half *p);
- float8 __ovld vload_half8(size_t offset, const half *p);
- float16 __ovld vload_half16(size_t offset, const half *p);
--#else
-+#endif //__opencl_c_generic_address_space
- float2 __ovld vload_half2(size_t offset, const __global half *p);
- float3 __ovld vload_half3(size_t offset, const __global half *p);
- float4 __ovld vload_half4(size_t offset, const __global half *p);
-@@ -11868,7 +11878,6 @@ float3 __ovld vload_half3(size_t offset, const __private half *p);
- float4 __ovld vload_half4(size_t offset, const __private half *p);
- float8 __ovld vload_half8(size_t offset, const __private half *p);
- float16 __ovld vload_half16(size_t offset, const __private half *p);
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
- * The float value given by data is first
-@@ -11881,20 +11890,20 @@ float16 __ovld vload_half16(size_t offset, const __private half *p);
- * The default current rounding mode is round to
- * nearest even.
- */
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- void __ovld vstore_half(float data, size_t offset, half *p);
- void __ovld vstore_half_rte(float data, size_t offset, half *p);
- void __ovld vstore_half_rtz(float data, size_t offset, half *p);
- void __ovld vstore_half_rtp(float data, size_t offset, half *p);
- void __ovld vstore_half_rtn(float data, size_t offset, half *p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld vstore_half(double data, size_t offset, half *p);
- void __ovld vstore_half_rte(double data, size_t offset, half *p);
- void __ovld vstore_half_rtz(double data, size_t offset, half *p);
- void __ovld vstore_half_rtp(double data, size_t offset, half *p);
- void __ovld vstore_half_rtn(double data, size_t offset, half *p);
--#endif //cl_khr_fp64
--#else
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#endif //__opencl_c_generic_address_space
- void __ovld vstore_half(float data, size_t offset, __global half *p);
- void __ovld vstore_half_rte(float data, size_t offset, __global half *p);
- void __ovld vstore_half_rtz(float data, size_t offset, __global half *p);
-@@ -11910,7 +11919,7 @@ void __ovld vstore_half_rte(float data, size_t offset, __private half *p);
- void __ovld vstore_half_rtz(float data, size_t offset, __private half *p);
- void __ovld vstore_half_rtp(float data, size_t offset, __private half *p);
- void __ovld vstore_half_rtn(float data, size_t offset, __private half *p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld vstore_half(double data, size_t offset, __global half *p);
- void __ovld vstore_half_rte(double data, size_t offset, __global half *p);
- void __ovld vstore_half_rtz(double data, size_t offset, __global half *p);
-@@ -11926,8 +11935,7 @@ void __ovld vstore_half_rte(double data, size_t offset, __private half *p);
- void __ovld vstore_half_rtz(double data, size_t offset, __private half *p);
- void __ovld vstore_half_rtp(double data, size_t offset, __private half *p);
- void __ovld vstore_half_rtn(double data, size_t offset, __private half *p);
--#endif //cl_khr_fp64
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- /**
- * The floatn value given by data is converted to
-@@ -11940,7 +11948,7 @@ void __ovld vstore_half_rtn(double data, size_t offset, __private half *p);
- * The default current rounding mode is round to
- * nearest even.
- */
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- void __ovld vstore_half2(float2 data, size_t offset, half *p);
- void __ovld vstore_half3(float3 data, size_t offset, half *p);
- void __ovld vstore_half4(float4 data, size_t offset, half *p);
-@@ -11966,7 +11974,7 @@ void __ovld vstore_half3_rtn(float3 data, size_t offset, half *p);
- void __ovld vstore_half4_rtn(float4 data, size_t offset, half *p);
- void __ovld vstore_half8_rtn(float8 data, size_t offset, half *p);
- void __ovld vstore_half16_rtn(float16 data, size_t offset, half *p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld vstore_half2(double2 data, size_t offset, half *p);
- void __ovld vstore_half3(double3 data, size_t offset, half *p);
- void __ovld vstore_half4(double4 data, size_t offset, half *p);
-@@ -11992,8 +12000,8 @@ void __ovld vstore_half3_rtn(double3 data, size_t offset, half *p);
- void __ovld vstore_half4_rtn(double4 data, size_t offset, half *p);
- void __ovld vstore_half8_rtn(double8 data, size_t offset, half *p);
- void __ovld vstore_half16_rtn(double16 data, size_t offset, half *p);
--#endif //cl_khr_fp64
--#else
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#endif //__opencl_c_generic_address_space
- void __ovld vstore_half2(float2 data, size_t offset, __global half *p);
- void __ovld vstore_half3(float3 data, size_t offset, __global half *p);
- void __ovld vstore_half4(float4 data, size_t offset, __global half *p);
-@@ -12069,7 +12077,7 @@ void __ovld vstore_half3_rtn(float3 data, size_t offset, __private half *p);
- void __ovld vstore_half4_rtn(float4 data, size_t offset, __private half *p);
- void __ovld vstore_half8_rtn(float8 data, size_t offset, __private half *p);
- void __ovld vstore_half16_rtn(float16 data, size_t offset, __private half *p);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld vstore_half2(double2 data, size_t offset, __global half *p);
- void __ovld vstore_half3(double3 data, size_t offset, __global half *p);
- void __ovld vstore_half4(double4 data, size_t offset, __global half *p);
-@@ -12145,8 +12153,7 @@ void __ovld vstore_half3_rtn(double3 data, size_t offset, __private half *p);
- void __ovld vstore_half4_rtn(double4 data, size_t offset, __private half *p);
- void __ovld vstore_half8_rtn(double8 data, size_t offset, __private half *p);
- void __ovld vstore_half16_rtn(double16 data, size_t offset, __private half *p);
--#endif //cl_khr_fp64
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- /**
- * For n = 1, 2, 4, 8 and 16 read sizeof (halfn)
-@@ -12167,14 +12174,14 @@ float3 __ovld vloada_half3(size_t offset, const __constant half *p);
- float4 __ovld vloada_half4(size_t offset, const __constant half *p);
- float8 __ovld vloada_half8(size_t offset, const __constant half *p);
- float16 __ovld vloada_half16(size_t offset, const __constant half *p);
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- float __ovld vloada_half(size_t offset, const half *p);
- float2 __ovld vloada_half2(size_t offset, const half *p);
- float3 __ovld vloada_half3(size_t offset, const half *p);
- float4 __ovld vloada_half4(size_t offset, const half *p);
- float8 __ovld vloada_half8(size_t offset, const half *p);
- float16 __ovld vloada_half16(size_t offset, const half *p);
--#else
-+#endif //__opencl_c_generic_address_space
- float __ovld vloada_half(size_t offset, const __global half *p);
- float2 __ovld vloada_half2(size_t offset, const __global half *p);
- float3 __ovld vloada_half3(size_t offset, const __global half *p);
-@@ -12193,7 +12200,6 @@ float3 __ovld vloada_half3(size_t offset, const __private half *p);
- float4 __ovld vloada_half4(size_t offset, const __private half *p);
- float8 __ovld vloada_half8(size_t offset, const __private half *p);
- float16 __ovld vloada_half16(size_t offset, const __private half *p);
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
- * The floatn value given by data is converted to
-@@ -12211,7 +12217,7 @@ float16 __ovld vloada_half16(size_t offset, const __private half *p);
- * mode. The default current rounding mode is
- * round to nearest even.
- */
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- void __ovld vstorea_half(float data, size_t offset, half *p);
- void __ovld vstorea_half2(float2 data, size_t offset, half *p);
- void __ovld vstorea_half3(float3 data, size_t offset, half *p);
-@@ -12247,7 +12253,7 @@ void __ovld vstorea_half4_rtn(float4 data, size_t offset, half *p);
- void __ovld vstorea_half8_rtn(float8 data, size_t offset, half *p);
- void __ovld vstorea_half16_rtn(float16 data, size_t offset, half *p);
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld vstorea_half(double data, size_t offset, half *p);
- void __ovld vstorea_half2(double2 data, size_t offset, half *p);
- void __ovld vstorea_half3(double3 data, size_t offset, half *p);
-@@ -12282,9 +12288,9 @@ void __ovld vstorea_half3_rtn(double3 data, size_t offset, half *p);
- void __ovld vstorea_half4_rtn(double4 data, size_t offset, half *p);
- void __ovld vstorea_half8_rtn(double8 data, size_t offset, half *p);
- void __ovld vstorea_half16_rtn(double16 data, size_t offset, half *p);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#endif //__opencl_c_generic_address_space
-
--#else
- void __ovld vstorea_half(float data, size_t offset, __global half *p);
- void __ovld vstorea_half2(float2 data, size_t offset, __global half *p);
- void __ovld vstorea_half3(float3 data, size_t offset, __global half *p);
-@@ -12390,7 +12396,7 @@ void __ovld vstorea_half4_rtn(float4 data, size_t offset, __private half *p);
- void __ovld vstorea_half8_rtn(float8 data, size_t offset, __private half *p);
- void __ovld vstorea_half16_rtn(float16 data, size_t offset, __private half *p);
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld vstorea_half(double data, size_t offset, __global half *p);
- void __ovld vstorea_half2(double2 data, size_t offset, __global half *p);
- void __ovld vstorea_half3(double3 data, size_t offset, __global half *p);
-@@ -12495,8 +12501,7 @@ void __ovld vstorea_half3_rtn(double3 data,size_t offset, __private half *p);
- void __ovld vstorea_half4_rtn(double4 data,size_t offset, __private half *p);
- void __ovld vstorea_half8_rtn(double8 data,size_t offset, __private half *p);
- void __ovld vstorea_half16_rtn(double16 data,size_t offset, __private half *p);
--#endif //cl_khr_fp64
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- // OpenCL v1.1 s6.11.8, v1.2 s6.12.8, v2.0 s6.13.8 - Synchronization Functions
-
-@@ -12580,7 +12585,7 @@ void __ovld write_mem_fence(cl_mem_fence_flags flags);
-
- // OpenCL v2.0 s6.13.9 - Address Space Qualifier Functions
-
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_generic_address_space
- cl_mem_fence_flags __ovld get_fence(const void *ptr);
- cl_mem_fence_flags __ovld get_fence(void *ptr);
-
-@@ -12591,7 +12596,7 @@ cl_mem_fence_flags __ovld get_fence(void *ptr);
- * where gentype is builtin type or user defined type.
- */
-
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#endif //__opencl_c_generic_address_space
-
- // OpenCL v1.1 s6.11.10, v1.2 s6.12.10, v2.0 s6.13.10 - Async Copies from Global to Local Memory, Local to Global Memory, and Prefetch
-
-@@ -12730,7 +12735,7 @@ event_t __ovld async_work_group_copy(__global uint16 *dst, const __local uint16
- event_t __ovld async_work_group_copy(__global long16 *dst, const __local long16 *src, size_t num_elements, event_t event);
- event_t __ovld async_work_group_copy(__global ulong16 *dst, const __local ulong16 *src, size_t num_elements, event_t event);
- event_t __ovld async_work_group_copy(__global float16 *dst, const __local float16 *src, size_t num_elements, event_t event);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- event_t __ovld async_work_group_copy(__local double *dst, const __global double *src, size_t num_elements, event_t event);
- event_t __ovld async_work_group_copy(__local double2 *dst, const __global double2 *src, size_t num_elements, event_t event);
- event_t __ovld async_work_group_copy(__local double3 *dst, const __global double3 *src, size_t num_elements, event_t event);
-@@ -12743,7 +12748,7 @@ event_t __ovld async_work_group_copy(__global double3 *dst, const __local double
- event_t __ovld async_work_group_copy(__global double4 *dst, const __local double4 *src, size_t num_elements, event_t event);
- event_t __ovld async_work_group_copy(__global double8 *dst, const __local double8 *src, size_t num_elements, event_t event);
- event_t __ovld async_work_group_copy(__global double16 *dst, const __local double16 *src, size_t num_elements, event_t event);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- event_t __ovld async_work_group_copy(__local half *dst, const __global half *src, size_t num_elements, event_t event);
- event_t __ovld async_work_group_copy(__local half2 *dst, const __global half2 *src, size_t num_elements, event_t event);
-@@ -12893,7 +12898,7 @@ event_t __ovld async_work_group_strided_copy(__global uint16 *dst, const __local
- event_t __ovld async_work_group_strided_copy(__global long16 *dst, const __local long16 *src, size_t num_elements, size_t dst_stride, event_t event);
- event_t __ovld async_work_group_strided_copy(__global ulong16 *dst, const __local ulong16 *src, size_t num_elements, size_t dst_stride, event_t event);
- event_t __ovld async_work_group_strided_copy(__global float16 *dst, const __local float16 *src, size_t num_elements, size_t dst_stride, event_t event);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- event_t __ovld async_work_group_strided_copy(__local double *dst, const __global double *src, size_t num_elements, size_t src_stride, event_t event);
- event_t __ovld async_work_group_strided_copy(__local double2 *dst, const __global double2 *src, size_t num_elements, size_t src_stride, event_t event);
- event_t __ovld async_work_group_strided_copy(__local double3 *dst, const __global double3 *src, size_t num_elements, size_t src_stride, event_t event);
-@@ -12906,7 +12911,7 @@ event_t __ovld async_work_group_strided_copy(__global double3 *dst, const __loca
- event_t __ovld async_work_group_strided_copy(__global double4 *dst, const __local double4 *src, size_t num_elements, size_t dst_stride, event_t event);
- event_t __ovld async_work_group_strided_copy(__global double8 *dst, const __local double8 *src, size_t num_elements, size_t dst_stride, event_t event);
- event_t __ovld async_work_group_strided_copy(__global double16 *dst, const __local double16 *src, size_t num_elements, size_t dst_stride, event_t event);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- event_t __ovld async_work_group_strided_copy(__local half *dst, const __global half *src, size_t num_elements, size_t src_stride, event_t event);
- event_t __ovld async_work_group_strided_copy(__local half2 *dst, const __global half2 *src, size_t num_elements, size_t src_stride, event_t event);
-@@ -12996,14 +13001,14 @@ void __ovld prefetch(const __global uint16 *p, size_t num_elements);
- void __ovld prefetch(const __global long16 *p, size_t num_elements);
- void __ovld prefetch(const __global ulong16 *p, size_t num_elements);
- void __ovld prefetch(const __global float16 *p, size_t num_elements);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld prefetch(const __global double *p, size_t num_elements);
- void __ovld prefetch(const __global double2 *p, size_t num_elements);
- void __ovld prefetch(const __global double3 *p, size_t num_elements);
- void __ovld prefetch(const __global double4 *p, size_t num_elements);
- void __ovld prefetch(const __global double8 *p, size_t num_elements);
- void __ovld prefetch(const __global double16 *p, size_t num_elements);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #ifdef cl_khr_fp16
- void __ovld prefetch(const __global half *p, size_t num_elements);
- void __ovld prefetch(const __global half2 *p, size_t num_elements);
-@@ -13026,9 +13031,11 @@ void __ovld prefetch(const __global half16 *p, size_t num_elements);
- * pointed by p. The function returns old.
- */
- int __ovld atomic_add(volatile __global int *p, int val);
--unsigned int __ovld atomic_add(volatile __global unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_add(volatile __global unsigned int *p,
-+ unsigned int val);
- int __ovld atomic_add(volatile __local int *p, int val);
--unsigned int __ovld atomic_add(volatile __local unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_add(volatile __local unsigned int *p,
-+ unsigned int val);
- #ifdef __OPENCL_CPP_VERSION__
- int __ovld atomic_add(volatile int *p, int val);
- unsigned int __ovld atomic_add(volatile unsigned int *p, unsigned int val);
-@@ -13056,9 +13063,11 @@ unsigned long __ovld atom_add(volatile __local unsigned long *p, unsigned long v
- * returns old.
- */
- int __ovld atomic_sub(volatile __global int *p, int val);
--unsigned int __ovld atomic_sub(volatile __global unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_sub(volatile __global unsigned int *p,
-+ unsigned int val);
- int __ovld atomic_sub(volatile __local int *p, int val);
--unsigned int __ovld atomic_sub(volatile __local unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_sub(volatile __local unsigned int *p,
-+ unsigned int val);
- #ifdef __OPENCL_CPP_VERSION__
- int __ovld atomic_sub(volatile int *p, int val);
- unsigned int __ovld atomic_sub(volatile unsigned int *p, unsigned int val);
-@@ -13086,9 +13095,11 @@ unsigned long __ovld atom_sub(volatile __local unsigned long *p, unsigned long v
- * value.
- */
- int __ovld atomic_xchg(volatile __global int *p, int val);
--unsigned int __ovld atomic_xchg(volatile __global unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_xchg(volatile __global unsigned int *p,
-+ unsigned int val);
- int __ovld atomic_xchg(volatile __local int *p, int val);
--unsigned int __ovld atomic_xchg(volatile __local unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_xchg(volatile __local unsigned int *p,
-+ unsigned int val);
- float __ovld atomic_xchg(volatile __global float *p, float val);
- float __ovld atomic_xchg(volatile __local float *p, float val);
- #ifdef __OPENCL_CPP_VERSION__
-@@ -13183,12 +13194,15 @@ unsigned long __ovld atom_dec(volatile __local unsigned long *p);
- * returns old.
- */
- int __ovld atomic_cmpxchg(volatile __global int *p, int cmp, int val);
--unsigned int __ovld atomic_cmpxchg(volatile __global unsigned int *p, unsigned int cmp, unsigned int val);
-+unsigned int __ovld atomic_cmpxchg(volatile __global unsigned int *p,
-+ unsigned int cmp, unsigned int val);
- int __ovld atomic_cmpxchg(volatile __local int *p, int cmp, int val);
--unsigned int __ovld atomic_cmpxchg(volatile __local unsigned int *p, unsigned int cmp, unsigned int val);
-+unsigned int __ovld atomic_cmpxchg(volatile __local unsigned int *p,
-+ unsigned int cmp, unsigned int val);
- #ifdef __OPENCL_CPP_VERSION__
- int __ovld atomic_cmpxchg(volatile int *p, int cmp, int val);
--unsigned int __ovld atomic_cmpxchg(volatile unsigned int *p, unsigned int cmp, unsigned int val);
-+unsigned int __ovld atomic_cmpxchg(volatile unsigned int *p, unsigned int cmp,
-+ unsigned int val);
- #endif
-
- #if defined(cl_khr_global_int32_base_atomics)
-@@ -13215,9 +13229,11 @@ unsigned long __ovld atom_cmpxchg(volatile __local unsigned long *p, unsigned lo
- * returns old.
- */
- int __ovld atomic_min(volatile __global int *p, int val);
--unsigned int __ovld atomic_min(volatile __global unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_min(volatile __global unsigned int *p,
-+ unsigned int val);
- int __ovld atomic_min(volatile __local int *p, int val);
--unsigned int __ovld atomic_min(volatile __local unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_min(volatile __local unsigned int *p,
-+ unsigned int val);
- #ifdef __OPENCL_CPP_VERSION__
- int __ovld atomic_min(volatile int *p, int val);
- unsigned int __ovld atomic_min(volatile unsigned int *p, unsigned int val);
-@@ -13247,9 +13263,11 @@ unsigned long __ovld atom_min(volatile __local unsigned long *p, unsigned long v
- * returns old.
- */
- int __ovld atomic_max(volatile __global int *p, int val);
--unsigned int __ovld atomic_max(volatile __global unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_max(volatile __global unsigned int *p,
-+ unsigned int val);
- int __ovld atomic_max(volatile __local int *p, int val);
--unsigned int __ovld atomic_max(volatile __local unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_max(volatile __local unsigned int *p,
-+ unsigned int val);
- #ifdef __OPENCL_CPP_VERSION__
- int __ovld atomic_max(volatile int *p, int val);
- unsigned int __ovld atomic_max(volatile unsigned int *p, unsigned int val);
-@@ -13278,9 +13296,11 @@ unsigned long __ovld atom_max(volatile __local unsigned long *p, unsigned long v
- * pointed by p. The function returns old.
- */
- int __ovld atomic_and(volatile __global int *p, int val);
--unsigned int __ovld atomic_and(volatile __global unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_and(volatile __global unsigned int *p,
-+ unsigned int val);
- int __ovld atomic_and(volatile __local int *p, int val);
--unsigned int __ovld atomic_and(volatile __local unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_and(volatile __local unsigned int *p,
-+ unsigned int val);
- #ifdef __OPENCL_CPP_VERSION__
- int __ovld atomic_and(volatile int *p, int val);
- unsigned int __ovld atomic_and(volatile unsigned int *p, unsigned int val);
-@@ -13309,9 +13329,11 @@ unsigned long __ovld atom_and(volatile __local unsigned long *p, unsigned long v
- * pointed by p. The function returns old.
- */
- int __ovld atomic_or(volatile __global int *p, int val);
--unsigned int __ovld atomic_or(volatile __global unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_or(volatile __global unsigned int *p,
-+ unsigned int val);
- int __ovld atomic_or(volatile __local int *p, int val);
--unsigned int __ovld atomic_or(volatile __local unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_or(volatile __local unsigned int *p,
-+ unsigned int val);
- #ifdef __OPENCL_CPP_VERSION__
- int __ovld atomic_or(volatile int *p, int val);
- unsigned int __ovld atomic_or(volatile unsigned int *p, unsigned int val);
-@@ -13340,9 +13362,11 @@ unsigned long __ovld atom_or(volatile __local unsigned long *p, unsigned long va
- * pointed by p. The function returns old.
- */
- int __ovld atomic_xor(volatile __global int *p, int val);
--unsigned int __ovld atomic_xor(volatile __global unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_xor(volatile __global unsigned int *p,
-+ unsigned int val);
- int __ovld atomic_xor(volatile __local int *p, int val);
--unsigned int __ovld atomic_xor(volatile __local unsigned int *p, unsigned int val);
-+unsigned int __ovld atomic_xor(volatile __local unsigned int *p,
-+ unsigned int val);
- #ifdef __OPENCL_CPP_VERSION__
- int __ovld atomic_xor(volatile int *p, int val);
- unsigned int __ovld atomic_xor(volatile unsigned int *p, unsigned int val);
-@@ -13380,108 +13404,78 @@ unsigned long __ovld atom_xor(volatile __local unsigned long *p, unsigned long v
- #endif
-
- // atomic_init()
-+#ifdef __opencl_c_generic_address_space
- void __ovld atomic_init(volatile atomic_int *object, int value);
- void __ovld atomic_init(volatile atomic_uint *object, uint value);
- void __ovld atomic_init(volatile atomic_float *object, float value);
- #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
- void __ovld atomic_init(volatile atomic_long *object, long value);
- void __ovld atomic_init(volatile atomic_ulong *object, ulong value);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld atomic_init(volatile atomic_double *object, double value);
--#endif //cl_khr_fp64
--#endif
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+void __ovld atomic_init(volatile atomic_int __global *object, int value);
-+void __ovld atomic_init(volatile atomic_int __local *object, int value);
-+void __ovld atomic_init(volatile atomic_uint __global *object, uint value);
-+void __ovld atomic_init(volatile atomic_uint __local *object, uint value);
-+void __ovld atomic_init(volatile atomic_float __global *object, float value);
-+void __ovld atomic_init(volatile atomic_float __local *object, float value);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+void __ovld atomic_init(volatile atomic_long __global *object, long value);
-+void __ovld atomic_init(volatile atomic_long __local *object, long value);
-+void __ovld atomic_init(volatile atomic_ulong __global *object, ulong value);
-+void __ovld atomic_init(volatile atomic_ulong __local *object, ulong value);
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+void __ovld atomic_init(volatile atomic_double __global *object, double value);
-+void __ovld atomic_init(volatile atomic_double __local *object, double value);
-+#endif // cl_khr_fp64
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-
- // atomic_work_item_fence()
--void __ovld atomic_work_item_fence(cl_mem_fence_flags flags, memory_order order, memory_scope scope);
-+void __ovld atomic_work_item_fence(cl_mem_fence_flags flags, memory_order order,
-+ memory_scope scope);
-
- // atomic_fetch()
--
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
-+#ifdef __opencl_c_generic_address_space
- int __ovld atomic_fetch_add(volatile atomic_int *object, int operand);
--int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand, memory_order order);
--int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
- uint __ovld atomic_fetch_add(volatile atomic_uint *object, uint operand);
--uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object, uint operand, memory_order order);
--uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
- int __ovld atomic_fetch_sub(volatile atomic_int *object, int operand);
--int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand, memory_order order);
--int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
- uint __ovld atomic_fetch_sub(volatile atomic_uint *object, uint operand);
--uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object, uint operand, memory_order order);
--uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
- int __ovld atomic_fetch_or(volatile atomic_int *object, int operand);
--int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand, memory_order order);
--int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
- uint __ovld atomic_fetch_or(volatile atomic_uint *object, uint operand);
--uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand, memory_order order);
--uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
- int __ovld atomic_fetch_xor(volatile atomic_int *object, int operand);
--int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand, memory_order order);
--int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
- uint __ovld atomic_fetch_xor(volatile atomic_uint *object, uint operand);
--uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object, uint operand, memory_order order);
--uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
- int __ovld atomic_fetch_and(volatile atomic_int *object, int operand);
--int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand, memory_order order);
--int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
- uint __ovld atomic_fetch_and(volatile atomic_uint *object, uint operand);
--uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object, uint operand, memory_order order);
--uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
- int __ovld atomic_fetch_min(volatile atomic_int *object, int operand);
--int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand, memory_order order);
--int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
- uint __ovld atomic_fetch_min(volatile atomic_uint *object, uint operand);
--uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object, uint operand, memory_order order);
--uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
- int __ovld atomic_fetch_max(volatile atomic_int *object, int operand);
--int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand, memory_order order);
--int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
- uint __ovld atomic_fetch_max(volatile atomic_uint *object, uint operand);
--uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object, uint operand, memory_order order);
--uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
-
- #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
- long __ovld atomic_fetch_add(volatile atomic_long *object, long operand);
--long __ovld atomic_fetch_add_explicit(volatile atomic_long *object, long operand, memory_order order);
--long __ovld atomic_fetch_add_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
- ulong __ovld atomic_fetch_add(volatile atomic_ulong *object, ulong operand);
--ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
--ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
- long __ovld atomic_fetch_sub(volatile atomic_long *object, long operand);
--long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object, long operand, memory_order order);
--long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
- ulong __ovld atomic_fetch_sub(volatile atomic_ulong *object, ulong operand);
--ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
--ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
- long __ovld atomic_fetch_or(volatile atomic_long *object, long operand);
--long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand, memory_order order);
--long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
- ulong __ovld atomic_fetch_or(volatile atomic_ulong *object, ulong operand);
--ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
--ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
- long __ovld atomic_fetch_xor(volatile atomic_long *object, long operand);
--long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object, long operand, memory_order order);
--long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
- ulong __ovld atomic_fetch_xor(volatile atomic_ulong *object, ulong operand);
--ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
--ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
- long __ovld atomic_fetch_and(volatile atomic_long *object, long operand);
--long __ovld atomic_fetch_and_explicit(volatile atomic_long *object, long operand, memory_order order);
--long __ovld atomic_fetch_and_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
- ulong __ovld atomic_fetch_and(volatile atomic_ulong *object, ulong operand);
--ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
--ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
- long __ovld atomic_fetch_min(volatile atomic_long *object, long operand);
--long __ovld atomic_fetch_min_explicit(volatile atomic_long *object, long operand, memory_order order);
--long __ovld atomic_fetch_min_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
- ulong __ovld atomic_fetch_min(volatile atomic_ulong *object, ulong operand);
--ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
--ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
- long __ovld atomic_fetch_max(volatile atomic_long *object, long operand);
--long __ovld atomic_fetch_max_explicit(volatile atomic_long *object, long operand, memory_order order);
--long __ovld atomic_fetch_max_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
- ulong __ovld atomic_fetch_max(volatile atomic_ulong *object, ulong operand);
--ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
--ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
- #endif //defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-
- // OpenCL v2.0 s6.13.11.7.5:
-@@ -13489,196 +13483,2239 @@ ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, ulong oper
- // or/xor/and/min/max: atomic type argument can be intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t.
-
- #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
--uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t *object, ptrdiff_t operand);
--uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order);
--uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order, memory_scope scope);
--uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t *object, ptrdiff_t operand);
--uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order);
--uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order, memory_scope scope);
--
--uintptr_t __ovld atomic_fetch_or(volatile atomic_uintptr_t *object, intptr_t operand);
--uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order);
--uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order, memory_scope scope);
--uintptr_t __ovld atomic_fetch_xor(volatile atomic_uintptr_t *object, intptr_t operand);
--uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order);
--uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order, memory_scope scope);
--uintptr_t __ovld atomic_fetch_and(volatile atomic_uintptr_t *object, intptr_t operand);
--uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order);
--uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order, memory_scope scope);
--uintptr_t __ovld atomic_fetch_min(volatile atomic_uintptr_t *object, intptr_t opermax);
--uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder);
--uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder, memory_scope scope);
--uintptr_t __ovld atomic_fetch_max(volatile atomic_uintptr_t *object, intptr_t opermax);
--uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder);
--uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder, memory_scope scope);
--
--intptr_t __ovld atomic_fetch_or(volatile atomic_intptr_t *object, uintptr_t operand);
--intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order);
--intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order, memory_scope scope);
--intptr_t __ovld atomic_fetch_xor(volatile atomic_intptr_t *object, uintptr_t operand);
--intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order);
--intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order, memory_scope scope);
--intptr_t __ovld atomic_fetch_and(volatile atomic_intptr_t *object, uintptr_t operand);
--intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order);
--intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order, memory_scope scope);
--intptr_t __ovld atomic_fetch_min(volatile atomic_intptr_t *object, uintptr_t opermax);
--intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder);
--intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder, memory_scope scope);
--intptr_t __ovld atomic_fetch_max(volatile atomic_intptr_t *object, uintptr_t opermax);
--intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder);
--intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t *object,
-+ ptrdiff_t operand);
-+uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t *object,
-+ ptrdiff_t operand);
-+
-+uintptr_t __ovld atomic_fetch_or(volatile atomic_uintptr_t *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_xor(volatile atomic_uintptr_t *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_and(volatile atomic_uintptr_t *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_min(volatile atomic_uintptr_t *object,
-+ intptr_t opermax);
-+uintptr_t __ovld atomic_fetch_max(volatile atomic_uintptr_t *object,
-+ intptr_t opermax);
-+
-+intptr_t __ovld atomic_fetch_or(volatile atomic_intptr_t *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_xor(volatile atomic_intptr_t *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_and(volatile atomic_intptr_t *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_min(volatile atomic_intptr_t *object,
-+ uintptr_t opermax);
-+intptr_t __ovld atomic_fetch_max(volatile atomic_intptr_t *object,
-+ uintptr_t opermax);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // __opencl_c_generic_address_space
-+
-+#if(__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+int __ovld atomic_fetch_add(volatile atomic_int __global *object, int operand);
-+uint __ovld atomic_fetch_add(volatile atomic_uint __local *object,
-+ uint operand);
-+int __ovld atomic_fetch_sub(volatile atomic_int __global *object, int operand);
-+int __ovld atomic_fetch_sub(volatile atomic_int __local *object, int operand);
-+uint __ovld atomic_fetch_sub(volatile atomic_uint __local *object,
-+ uint operand);
-+uint __ovld atomic_fetch_sub(volatile atomic_uint __global *object,
-+ uint operand);
-+int __ovld atomic_fetch_or(volatile atomic_int __global *object, int operand);
-+uint __ovld atomic_fetch_sub(volatile atomic_uint __local *object,
-+ uint operand);
-+uint __ovld atomic_fetch_or(volatile atomic_uint __global *object,
-+ uint operand);
-+uint __ovld atomic_fetch_or(volatile atomic_uint __local *object, uint operand);
-+int __ovld atomic_fetch_xor(volatile atomic_int __global *object, int operand);
-+int __ovld atomic_fetch_xor(volatile atomic_int __local *object, int operand);
-+uint __ovld atomic_fetch_xor(volatile atomic_uint __global *object,
-+ uint operand);
-+uint __ovld atomic_fetch_xor(volatile atomic_uint __local *object,
-+ uint operand);
-+int __ovld atomic_fetch_and(volatile atomic_int __global *object, int operand);
-+int __ovld atomic_fetch_and(volatile atomic_int __local *object, int operand);
-+uint __ovld atomic_fetch_and(volatile atomic_uint __global *object,
-+ uint operand);
-+uint __ovld atomic_fetch_and(volatile atomic_uint __local *object,
-+ uint operand);
-+int __ovld atomic_fetch_min(volatile atomic_int __global *object, int operand);
-+int __ovld atomic_fetch_min(volatile atomic_int __local *object, int operand);
-+uint __ovld atomic_fetch_min(volatile atomic_uint __global *object,
-+ uint operand);
-+uint __ovld atomic_fetch_min(volatile atomic_uint __local *object,
-+ uint operand);
-+int __ovld atomic_fetch_max(volatile atomic_int __global *object, int operand);
-+int __ovld atomic_fetch_max(volatile atomic_int __local *object, int operand);
-+uint __ovld atomic_fetch_max(volatile atomic_uint __global *object,
-+ uint operand);
-+uint __ovld atomic_fetch_max(volatile atomic_uint __local *object,
-+ uint operand);
-+
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+long __ovld atomic_fetch_add(volatile atomic_long __global *object,
-+ long operand);
-+long __ovld atomic_fetch_add(volatile atomic_long __local *object,
-+ long operand);
-+ulong __ovld atomic_fetch_add(volatile atomic_ulong __global *object,
-+ ulong operand);
-+ulong __ovld atomic_fetch_add(volatile atomic_ulong __local *object,
-+ ulong operand);
-+long __ovld atomic_fetch_sub(volatile atomic_long __global *object,
-+ long operand);
-+long __ovld atomic_fetch_sub(volatile atomic_long __local *object,
-+ long operand);
-+ulong __ovld atomic_fetch_sub(volatile atomic_ulong __global *object,
-+ ulong operand);
-+ulong __ovld atomic_fetch_sub(volatile atomic_ulong __local *object,
-+ ulong operand);
-+long __ovld atomic_fetch_or(volatile atomic_long __global *object,
-+ long operand);
-+long __ovld atomic_fetch_or(volatile atomic_long __local *object, long operand);
-+ulong __ovld atomic_fetch_or(volatile atomic_ulong __global *object,
-+ ulong operand);
-+ulong __ovld atomic_fetch_or(volatile atomic_ulong __local *object,
-+ ulong operand);
-+long __ovld atomic_fetch_xor(volatile atomic_long __global *object,
-+ long operand);
-+long __ovld atomic_fetch_xor(volatile atomic_long __local *object,
-+ long operand);
-+ulong __ovld atomic_fetch_xor(volatile atomic_ulong __global *object,
-+ ulong operand);
-+ulong __ovld atomic_fetch_xor(volatile atomic_ulong __local *object,
-+ ulong operand);
-+long __ovld atomic_fetch_and(volatile atomic_long __global *object,
-+ long operand);
-+long __ovld atomic_fetch_and(volatile atomic_long __local *object,
-+ long operand);
-+ulong __ovld atomic_fetch_and(volatile atomic_ulong __global *object,
-+ ulong operand);
-+ulong __ovld atomic_fetch_and(volatile atomic_ulong __local *object,
-+ ulong operand);
-+long __ovld atomic_fetch_min(volatile atomic_long __global *object,
-+ long operand);
-+long __ovld atomic_fetch_min(volatile atomic_long __local *object,
-+ long operand);
-+ulong __ovld atomic_fetch_min(volatile atomic_ulong __global *object,
-+ ulong operand);
-+ulong __ovld atomic_fetch_min(volatile atomic_ulong __local *object,
-+ ulong operand);
-+long __ovld atomic_fetch_max(volatile atomic_long __global *object,
-+ long operand);
-+long __ovld atomic_fetch_max(volatile atomic_long __local *object,
-+ long operand);
-+ulong __ovld atomic_fetch_max(volatile atomic_ulong __global *object,
-+ ulong operand);
-+ulong __ovld atomic_fetch_max(volatile atomic_ulong __local *object,
-+ ulong operand);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+
-+// OpenCL v2.0 s6.13.11.7.5:
-+// add/sub: atomic type argument can be uintptr_t/intptr_t, value type argument
-+// can be ptrdiff_t. or/xor/and/min/max: atomic type argument can be
-+// intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t.
-+
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t __global *object,
-+ ptrdiff_t operand);
-+uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t __local *object,
-+ ptrdiff_t operand);
-+uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t __global *object,
-+ ptrdiff_t operand);
-+uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t __local *object,
-+ ptrdiff_t operand);
-+
-+uintptr_t __ovld atomic_fetch_or(volatile atomic_uintptr_t __global *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_or(volatile atomic_uintptr_t __local *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_xor(volatile atomic_uintptr_t __global *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_xor(volatile atomic_uintptr_t __local *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_and(volatile atomic_uintptr_t __global *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_and(volatile atomic_uintptr_t __local *object,
-+ intptr_t operand);
-+uintptr_t __ovld atomic_fetch_min(volatile atomic_uintptr_t __global *object,
-+ intptr_t opermax);
-+uintptr_t __ovld atomic_fetch_min(volatile atomic_uintptr_t __local *object,
-+ intptr_t opermax);
-+uintptr_t __ovld atomic_fetch_max(volatile atomic_uintptr_t __global *object,
-+ intptr_t opermax);
-+uintptr_t __ovld atomic_fetch_max(volatile atomic_uintptr_t __local *object,
-+ intptr_t opermax);
-+
-+intptr_t __ovld atomic_fetch_or(volatile atomic_intptr_t __global *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_or(volatile atomic_intptr_t __local *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_xor(volatile atomic_intptr_t __global *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_xor(volatile atomic_intptr_t __local *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_and(volatile atomic_intptr_t __global *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_and(volatile atomic_intptr_t __local *object,
-+ uintptr_t operand);
-+intptr_t __ovld atomic_fetch_min(volatile atomic_intptr_t __global *object,
-+ uintptr_t opermax);
-+intptr_t __ovld atomic_fetch_min(volatile atomic_intptr_t __local *object,
-+ uintptr_t opermax);
-+intptr_t __ovld atomic_fetch_max(volatile atomic_intptr_t __global *object,
-+ uintptr_t opermax);
-+intptr_t __ovld atomic_fetch_max(volatile atomic_intptr_t __local *object,
-+ uintptr_t opermax);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+
-+#ifdef __opencl_c_generic_address_space
-+#ifdef __opencl_c_atomic_scope_device
-+int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand,
-+ memory_order order);
-+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand,
-+ memory_order order);
-+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand,
-+ memory_order order);
-+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand,
-+ memory_order order);
-+int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand,
-+ memory_order order);
-+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand,
-+ memory_order order);
-+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand,
-+ memory_order order);
-+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand,
-+ memory_order order);
-+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand,
-+ memory_order order, memory_scope scope);
-+int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#ifdef __opencl_c_atomic_scope_device
-+long __ovld atomic_fetch_add_explicit(volatile atomic_long *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand,
-+ memory_order order);
-+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_and_explicit(volatile atomic_long *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_min_explicit(volatile atomic_long *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_max_explicit(volatile atomic_long *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+long __ovld atomic_fetch_add_explicit(volatile atomic_long *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand,
-+ memory_order order, memory_scope scope);
-+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_and_explicit(volatile atomic_long *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_min_explicit(volatile atomic_long *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_max_explicit(volatile atomic_long *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+
-+// OpenCL v2.0 s6.13.11.7.5:
-+// add/sub: atomic type argument can be uintptr_t/intptr_t, value type argument
-+// can be ptrdiff_t. or/xor/and/min/max: atomic type argument can be
-+// intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t.
-+
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#ifdef __opencl_c_atomic_scope_device
-+uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object,
-+ ptrdiff_t operand,
-+ memory_order order);
-+uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object,
-+ ptrdiff_t operand,
-+ memory_order order);
-+uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t operand, memory_order order);
-+uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t operand,
-+ memory_order order);
-+uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t operand,
-+ memory_order order);
-+uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t opermax,
-+ memory_order minder);
-+uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t opermax,
-+ memory_order minder);
-+intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t operand, memory_order order);
-+intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t operand,
-+ memory_order order);
-+intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t operand,
-+ memory_order order);
-+intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t opermax,
-+ memory_order minder);
-+intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t opermax,
-+ memory_order minder);
-+#endif // __opencl_c_atomic_scope_device
-+uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object,
-+ ptrdiff_t operand,
-+ memory_order order,
-+ memory_scope scope);
-+uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object,
-+ ptrdiff_t operand,
-+ memory_order order,
-+ memory_scope scope);
-+
-+uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t operand, memory_order order,
-+ memory_scope scope);
-+uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t operand, memory_order order,
-+ memory_scope scope);
-+uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t operand, memory_order order,
-+ memory_scope scope);
-+uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t opermax,
-+ memory_order minder,
-+ memory_scope scope);
-+uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object,
-+ intptr_t opermax,
-+ memory_order minder,
-+ memory_scope scope);
-+
-+intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t operand, memory_order order,
-+ memory_scope scope);
-+intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t operand, memory_order order,
-+ memory_scope scope);
-+intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t operand, memory_order order,
-+ memory_scope scope);
-+intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t opermax,
-+ memory_order minder,
-+ memory_scope scope);
-+intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object,
-+ uintptr_t opermax,
-+ memory_order minder,
-+ memory_scope scope);
- #endif
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#ifdef __opencl_c_atomic_scope_device
-+int __ovld atomic_fetch_add_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order);
-+int __ovld atomic_fetch_add_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order);
-+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order);
-+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_sub_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order);
-+int __ovld atomic_fetch_sub_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order);
-+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order);
-+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_or_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order);
-+int __ovld atomic_fetch_or_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order);
-+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order);
-+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_xor_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order);
-+int __ovld atomic_fetch_xor_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order);
-+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order);
-+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_and_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order);
-+int __ovld atomic_fetch_and_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order);
-+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order);
-+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_min_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order);
-+int __ovld atomic_fetch_min_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order);
-+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order);
-+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order);
-+int __ovld atomic_fetch_max_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order);
-+int __ovld atomic_fetch_max_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order);
-+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order);
-+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+int __ovld atomic_fetch_add_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_add_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_sub_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_sub_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_or_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_or_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_xor_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_xor_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_and_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_and_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_min_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_min_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_max_explicit(volatile atomic_int __global *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_fetch_max_explicit(volatile atomic_int __local *object,
-+ int operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint __global *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint __local *object,
-+ uint operand, memory_order order,
-+ memory_scope scope);
-+
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#ifdef __opencl_c_atomic_scope_device
-+long __ovld atomic_fetch_add_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order);
-+long __ovld atomic_fetch_add_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order);
-+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_sub_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order);
-+long __ovld atomic_fetch_sub_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order);
-+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_or_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order);
-+long __ovld atomic_fetch_or_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order);
-+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_xor_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order);
-+long __ovld atomic_fetch_xor_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order);
-+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_and_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order);
-+long __ovld atomic_fetch_and_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order);
-+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_min_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order);
-+long __ovld atomic_fetch_min_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order);
-+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order);
-+long __ovld atomic_fetch_max_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order);
-+long __ovld atomic_fetch_max_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order);
-+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order);
-+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+long __ovld atomic_fetch_add_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_add_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_sub_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_sub_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_or_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_or_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_xor_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_xor_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_and_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_and_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_min_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_min_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_max_explicit(volatile atomic_long __global *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_fetch_max_explicit(volatile atomic_long __local *object,
-+ long operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong __global *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong __local *object,
-+ ulong operand, memory_order order,
-+ memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+
-+// OpenCL v2.0 s6.13.11.7.5:
-+// add/sub: atomic type argument can be uintptr_t/intptr_t, value type argument
-+// can be ptrdiff_t. or/xor/and/min/max: atomic type argument can be
-+// intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t.
-+
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#ifdef __opencl_c_atomic_scope_device
-+uintptr_t __ovld
-+atomic_fetch_add_explicit(volatile atomic_uintptr_t __global *object,
-+ ptrdiff_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_add_explicit(volatile atomic_uintptr_t __local *object,
-+ ptrdiff_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_sub_explicit(volatile atomic_uintptr_t __global *object,
-+ ptrdiff_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_sub_explicit(volatile atomic_uintptr_t __local *object,
-+ ptrdiff_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_or_explicit(volatile atomic_uintptr_t __global *object,
-+ intptr_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_or_explicit(volatile atomic_uintptr_t __local *object,
-+ intptr_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_xor_explicit(volatile atomic_uintptr_t __global *object,
-+ intptr_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_xor_explicit(volatile atomic_uintptr_t __local *object,
-+ intptr_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_and_explicit(volatile atomic_uintptr_t __global *object,
-+ intptr_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_and_explicit(volatile atomic_uintptr_t __local *object,
-+ intptr_t operand, memory_order order);
-+uintptr_t __ovld
-+atomic_fetch_min_explicit(volatile atomic_uintptr_t __global *object,
-+ intptr_t opermax, memory_order minder);
-+uintptr_t __ovld
-+atomic_fetch_min_explicit(volatile atomic_uintptr_t __local *object,
-+ intptr_t opermax, memory_order minder);
-+uintptr_t __ovld
-+atomic_fetch_max_explicit(volatile atomic_uintptr_t __global *object,
-+ intptr_t opermax, memory_order minder);
-+uintptr_t __ovld
-+atomic_fetch_max_explicit(volatile atomic_uintptr_t __local *object,
-+ intptr_t opermax, memory_order minder);
-+intptr_t __ovld
-+atomic_fetch_or_explicit(volatile atomic_intptr_t __global *object,
-+ uintptr_t operand, memory_order order);
-+intptr_t __ovld
-+atomic_fetch_or_explicit(volatile atomic_intptr_t __local *object,
-+ uintptr_t operand, memory_order order);
-+intptr_t __ovld
-+atomic_fetch_xor_explicit(volatile atomic_intptr_t __global *object,
-+ uintptr_t operand, memory_order order);
-+intptr_t __ovld
-+atomic_fetch_xor_explicit(volatile atomic_intptr_t __local *object,
-+ uintptr_t operand, memory_order order);
-+intptr_t __ovld
-+atomic_fetch_and_explicit(volatile atomic_intptr_t __global *object,
-+ uintptr_t operand, memory_order order);
-+intptr_t __ovld
-+atomic_fetch_and_explicit(volatile atomic_intptr_t __local *object,
-+ uintptr_t operand, memory_order order);
-+intptr_t __ovld
-+atomic_fetch_min_explicit(volatile atomic_intptr_t __global *object,
-+ uintptr_t opermax, memory_order minder);
-+intptr_t __ovld
-+atomic_fetch_min_explicit(volatile atomic_intptr_t __local *object,
-+ uintptr_t opermax, memory_order minder);
-+intptr_t __ovld
-+atomic_fetch_max_explicit(volatile atomic_intptr_t __global *object,
-+ uintptr_t opermax, memory_order minder);
-+intptr_t __ovld
-+atomic_fetch_max_explicit(volatile atomic_intptr_t __local *object,
-+ uintptr_t opermax, memory_order minder);
-+#endif // __opencl_c_atomic_scope_device
-+uintptr_t __ovld atomic_fetch_add_explicit(
-+ volatile atomic_uintptr_t __global *object, ptrdiff_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_add_explicit(
-+ volatile atomic_uintptr_t __local *object, ptrdiff_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_sub_explicit(
-+ volatile atomic_uintptr_t __global *object, ptrdiff_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_sub_explicit(
-+ volatile atomic_uintptr_t __local *object, ptrdiff_t operand,
-+ memory_order order, memory_scope scope);
-+
-+uintptr_t __ovld atomic_fetch_or_explicit(
-+ volatile atomic_uintptr_t __global *object, intptr_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_or_explicit(
-+ volatile atomic_uintptr_t __local *object, intptr_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_xor_explicit(
-+ volatile atomic_uintptr_t __global *object, intptr_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_xor_explicit(
-+ volatile atomic_uintptr_t __local *object, intptr_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_and_explicit(
-+ volatile atomic_uintptr_t __global *object, intptr_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_and_explicit(
-+ volatile atomic_uintptr_t __local *object, intptr_t operand,
-+ memory_order order, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_min_explicit(
-+ volatile atomic_uintptr_t __global *object, intptr_t opermax,
-+ memory_order minder, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_min_explicit(
-+ volatile atomic_uintptr_t __local *object, intptr_t opermax,
-+ memory_order minder, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_max_explicit(
-+ volatile atomic_uintptr_t __global *object, intptr_t opermax,
-+ memory_order minder, memory_scope scope);
-+uintptr_t __ovld atomic_fetch_max_explicit(
-+ volatile atomic_uintptr_t __local *object, intptr_t opermax,
-+ memory_order minder, memory_scope scope);
-+
-+intptr_t __ovld atomic_fetch_or_explicit(
-+ volatile atomic_intptr_t __global *object, uintptr_t operand,
-+ memory_order order, memory_scope scope);
-+intptr_t __ovld atomic_fetch_or_explicit(
-+ volatile atomic_intptr_t __local *object, uintptr_t operand,
-+ memory_order order, memory_scope scope);
-+intptr_t __ovld atomic_fetch_xor_explicit(
-+ volatile atomic_intptr_t __global *object, uintptr_t operand,
-+ memory_order order, memory_scope scope);
-+intptr_t __ovld atomic_fetch_xor_explicit(
-+ volatile atomic_intptr_t __local *object, uintptr_t operand,
-+ memory_order order, memory_scope scope);
-+intptr_t __ovld atomic_fetch_and_explicit(
-+ volatile atomic_intptr_t __global *object, uintptr_t operand,
-+ memory_order order, memory_scope scope);
-+intptr_t __ovld atomic_fetch_and_explicit(
-+ volatile atomic_intptr_t __local *object, uintptr_t operand,
-+ memory_order order, memory_scope scope);
-+intptr_t __ovld atomic_fetch_min_explicit(
-+ volatile atomic_intptr_t __global *object, uintptr_t opermax,
-+ memory_order minder, memory_scope scope);
-+intptr_t __ovld atomic_fetch_min_explicit(
-+ volatile atomic_intptr_t __local *object, uintptr_t opermax,
-+ memory_order minder, memory_scope scope);
-+intptr_t __ovld atomic_fetch_max_explicit(
-+ volatile atomic_intptr_t __global *object, uintptr_t opermax,
-+ memory_order minder, memory_scope scope);
-+intptr_t __ovld atomic_fetch_max_explicit(
-+ volatile atomic_intptr_t __local *object, uintptr_t opermax,
-+ memory_order minder, memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-
- // atomic_store()
-
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
-+
-+#ifdef __opencl_c_generic_address_space
- void __ovld atomic_store(volatile atomic_int *object, int desired);
--void __ovld atomic_store_explicit(volatile atomic_int *object, int desired, memory_order order);
--void __ovld atomic_store_explicit(volatile atomic_int *object, int desired, memory_order order, memory_scope scope);
- void __ovld atomic_store(volatile atomic_uint *object, uint desired);
--void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired, memory_order order);
--void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired, memory_order order, memory_scope scope);
- void __ovld atomic_store(volatile atomic_float *object, float desired);
--void __ovld atomic_store_explicit(volatile atomic_float *object, float desired, memory_order order);
--void __ovld atomic_store_explicit(volatile atomic_float *object, float desired, memory_order order, memory_scope scope);
- #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- void __ovld atomic_store(volatile atomic_double *object, double desired);
--void __ovld atomic_store_explicit(volatile atomic_double *object, double desired, memory_order order);
--void __ovld atomic_store_explicit(volatile atomic_double *object, double desired, memory_order order, memory_scope scope);
--#endif //cl_khr_fp64
-+#endif
- void __ovld atomic_store(volatile atomic_long *object, long desired);
--void __ovld atomic_store_explicit(volatile atomic_long *object, long desired, memory_order order);
--void __ovld atomic_store_explicit(volatile atomic_long *object, long desired, memory_order order, memory_scope scope);
- void __ovld atomic_store(volatile atomic_ulong *object, ulong desired);
--void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired, memory_order order);
--void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired, memory_order order, memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+void __ovld atomic_store(volatile atomic_int __global *object, int desired);
-+void __ovld atomic_store(volatile atomic_int __local *object, int desired);
-+void __ovld atomic_store(volatile atomic_uint __global *object, uint desired);
-+void __ovld atomic_store(volatile atomic_uint __local *object, uint desired);
-+void __ovld atomic_store(volatile atomic_float __global *object, float desired);
-+void __ovld atomic_store(volatile atomic_float __local *object, float desired);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+void __ovld atomic_store(volatile atomic_double __global *object,
-+ double desired);
-+void __ovld atomic_store(volatile atomic_double __local *object,
-+ double desired);
- #endif
-+void __ovld atomic_store(volatile atomic_long __global *object, long desired);
-+void __ovld atomic_store(volatile atomic_long __local *object, long desired);
-+void __ovld atomic_store(volatile atomic_ulong __global *object, ulong desired);
-+void __ovld atomic_store(volatile atomic_ulong __local *object, ulong desired);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+
-+#ifdef __opencl_c_generic_address_space
-+#ifdef __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_int *object, int desired,
-+ memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired,
-+ memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_float *object, float desired,
-+ memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_int *object, int desired,
-+ memory_order order, memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired,
-+ memory_order order, memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_float *object, float desired,
-+ memory_order order, memory_scope scope);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_double *object,
-+ double desired, memory_order order);
-+#endif //__opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_double *object,
-+ double desired, memory_order order,
-+ memory_scope scope);
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_long *object, long desired,
-+ memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired,
-+ memory_order order);
-+#endif //__opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_long *object, long desired,
-+ memory_order order, memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired,
-+ memory_order order, memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#ifdef __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_int __global *object,
-+ int desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_int __local *object,
-+ int desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_uint __global *object,
-+ uint desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_uint __local *object,
-+ uint desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_float __global *object,
-+ float desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_float __local *object,
-+ float desired, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_int __global *object,
-+ int desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_int __local *object,
-+ int desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_uint __global *object,
-+ uint desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_uint __local *object,
-+ uint desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_float __global *object,
-+ float desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_float __local *object,
-+ float desired, memory_order order,
-+ memory_scope scope);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_double __global *object,
-+ double desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_double __local *object,
-+ double desired, memory_order order);
-+#endif //__opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_double __global *object,
-+ double desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_double __local *object,
-+ double desired, memory_order order,
-+ memory_scope scope);
-+#endif // cl_khr_fp64
-+#ifdef __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_long __global *object,
-+ long desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_long __local *object,
-+ long desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_ulong __global *object,
-+ ulong desired, memory_order order);
-+void __ovld atomic_store_explicit(volatile atomic_ulong __local *object,
-+ ulong desired, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+void __ovld atomic_store_explicit(volatile atomic_long __global *object,
-+ long desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_long __local *object,
-+ long desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_ulong __global *object,
-+ ulong desired, memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_store_explicit(volatile atomic_ulong __local *object,
-+ ulong desired, memory_order order,
-+ memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-
- // atomic_load()
--
-+#ifdef __opencl_c_generic_address_space
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
- int __ovld atomic_load(volatile atomic_int *object);
--int __ovld atomic_load_explicit(volatile atomic_int *object, memory_order order);
--int __ovld atomic_load_explicit(volatile atomic_int *object, memory_order order, memory_scope scope);
- uint __ovld atomic_load(volatile atomic_uint *object);
--uint __ovld atomic_load_explicit(volatile atomic_uint *object, memory_order order);
--uint __ovld atomic_load_explicit(volatile atomic_uint *object, memory_order order, memory_scope scope);
- float __ovld atomic_load(volatile atomic_float *object);
--float __ovld atomic_load_explicit(volatile atomic_float *object, memory_order order);
--float __ovld atomic_load_explicit(volatile atomic_float *object, memory_order order, memory_scope scope);
- #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld atomic_load(volatile atomic_double *object);
--double __ovld atomic_load_explicit(volatile atomic_double *object, memory_order order);
--double __ovld atomic_load_explicit(volatile atomic_double *object, memory_order order, memory_scope scope);
--#endif //cl_khr_fp64
-+#endif // cl_khr_fp64
- long __ovld atomic_load(volatile atomic_long *object);
--long __ovld atomic_load_explicit(volatile atomic_long *object, memory_order order);
--long __ovld atomic_load_explicit(volatile atomic_long *object, memory_order order, memory_scope scope);
- ulong __ovld atomic_load(volatile atomic_ulong *object);
--ulong __ovld atomic_load_explicit(volatile atomic_ulong *object, memory_order order);
--ulong __ovld atomic_load_explicit(volatile atomic_ulong *object, memory_order order, memory_scope scope);
--#endif
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+#endif //__opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
-+int __ovld atomic_load(volatile atomic_int __global *object);
-+int __ovld atomic_load(volatile atomic_int __local *object);
-+uint __ovld atomic_load(volatile atomic_uint __global *object);
-+uint __ovld atomic_load(volatile atomic_uint __local *object);
-+float __ovld atomic_load(volatile atomic_float __global *object);
-+float __ovld atomic_load(volatile atomic_float __local *object);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+double __ovld atomic_load(volatile atomic_double __global *object);
-+double __ovld atomic_load(volatile atomic_double __local *object);
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+long __ovld atomic_load(volatile atomic_long __global *object);
-+long __ovld atomic_load(volatile atomic_long __local *object);
-+ulong __ovld atomic_load(volatile atomic_ulong __global *object);
-+ulong __ovld atomic_load(volatile atomic_ulong __local *object);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+
-+#ifdef __opencl_c_generic_address_space
-+#ifdef __opencl_c_atomic_scope_device
-+int __ovld atomic_load_explicit(volatile atomic_int *object,
-+ memory_order order);
-+uint __ovld atomic_load_explicit(volatile atomic_uint *object,
-+ memory_order order);
-+float __ovld atomic_load_explicit(volatile atomic_float *object,
-+ memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+int __ovld atomic_load_explicit(volatile atomic_int *object, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_load_explicit(volatile atomic_uint *object,
-+ memory_order order, memory_scope scope);
-+float __ovld atomic_load_explicit(volatile atomic_float *object,
-+ memory_order order, memory_scope scope);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+double __ovld atomic_load_explicit(volatile atomic_double *object,
-+ memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+double __ovld atomic_load_explicit(volatile atomic_double *object,
-+ memory_order order, memory_scope scope);
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+long __ovld atomic_load_explicit(volatile atomic_long *object,
-+ memory_order order);
-+ulong __ovld atomic_load_explicit(volatile atomic_ulong *object,
-+ memory_order order);
-+#endif //__opencl_c_atomic_scope_device
-+long __ovld atomic_load_explicit(volatile atomic_long *object,
-+ memory_order order, memory_scope scope);
-+ulong __ovld atomic_load_explicit(volatile atomic_ulong *object,
-+ memory_order order, memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#ifdef __opencl_c_atomic_scope_device
-+int __ovld atomic_load_explicit(volatile atomic_int __global *object,
-+ memory_order order);
-+int __ovld atomic_load_explicit(volatile atomic_int __local *object,
-+ memory_order order);
-+uint __ovld atomic_load_explicit(volatile atomic_uint __global *object,
-+ memory_order order);
-+uint __ovld atomic_load_explicit(volatile atomic_uint __local *object,
-+ memory_order order);
-+float __ovld atomic_load_explicit(volatile atomic_float __global *object,
-+ memory_order order);
-+float __ovld atomic_load_explicit(volatile atomic_float __local *object,
-+ memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+int __ovld atomic_load_explicit(volatile atomic_int __global *object,
-+ memory_order order, memory_scope scope);
-+int __ovld atomic_load_explicit(volatile atomic_int __local *object,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_load_explicit(volatile atomic_uint __global *object,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_load_explicit(volatile atomic_uint __local *object,
-+ memory_order order, memory_scope scope);
-+float __ovld atomic_load_explicit(volatile atomic_float __global *object,
-+ memory_order order, memory_scope scope);
-+float __ovld atomic_load_explicit(volatile atomic_float __local *object,
-+ memory_order order, memory_scope scope);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+double __ovld atomic_load_explicit(volatile atomic_double __global *object,
-+ memory_order order);
-+double __ovld atomic_load_explicit(volatile atomic_double __local *object,
-+ memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+double __ovld atomic_load_explicit(volatile atomic_double __global *object,
-+ memory_order order, memory_scope scope);
-+double __ovld atomic_load_explicit(volatile atomic_double __local *object,
-+ memory_order order, memory_scope scope);
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+long __ovld atomic_load_explicit(volatile atomic_long __global *object,
-+ memory_order order);
-+long __ovld atomic_load_explicit(volatile atomic_long __local *object,
-+ memory_order order);
-+ulong __ovld atomic_load_explicit(volatile atomic_ulong __global *object,
-+ memory_order order);
-+ulong __ovld atomic_load_explicit(volatile atomic_ulong __local *object,
-+ memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+long __ovld atomic_load_explicit(volatile atomic_long __global *object,
-+ memory_order order, memory_scope scope);
-+long __ovld atomic_load_explicit(volatile atomic_long __local *object,
-+ memory_order order, memory_scope scope);
-+ulong __ovld atomic_load_explicit(volatile atomic_ulong __global *object,
-+ memory_order order, memory_scope scope);
-+ulong __ovld atomic_load_explicit(volatile atomic_ulong __local *object,
-+ memory_order order, memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-
- // atomic_exchange()
--
-+#ifdef __opencl_c_generic_address_space
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
- int __ovld atomic_exchange(volatile atomic_int *object, int desired);
--int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired, memory_order order);
--int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired, memory_order order, memory_scope scope);
- uint __ovld atomic_exchange(volatile atomic_uint *object, uint desired);
--uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired, memory_order order);
--uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired, memory_order order, memory_scope scope);
- float __ovld atomic_exchange(volatile atomic_float *object, float desired);
--float __ovld atomic_exchange_explicit(volatile atomic_float *object, float desired, memory_order order);
--float __ovld atomic_exchange_explicit(volatile atomic_float *object, float desired, memory_order order, memory_scope scope);
- #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld atomic_exchange(volatile atomic_double *object, double desired);
--double __ovld atomic_exchange_explicit(volatile atomic_double *object, double desired, memory_order order);
--double __ovld atomic_exchange_explicit(volatile atomic_double *object, double desired, memory_order order, memory_scope scope);
--#endif //cl_khr_fp64
-+#endif
- long __ovld atomic_exchange(volatile atomic_long *object, long desired);
--long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired, memory_order order);
--long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired, memory_order order, memory_scope scope);
- ulong __ovld atomic_exchange(volatile atomic_ulong *object, ulong desired);
--ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object, ulong desired, memory_order order);
--ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object, ulong desired, memory_order order, memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
-+int __ovld atomic_exchange(volatile atomic_int __global *object, int desired);
-+int __ovld atomic_exchange(volatile atomic_int __local *object, int desired);
-+uint __ovld atomic_exchange(volatile atomic_uint __global *object,
-+ uint desired);
-+uint __ovld atomic_exchange(volatile atomic_uint __local *object, uint desired);
-+float __ovld atomic_exchange(volatile atomic_float __global *object,
-+ float desired);
-+float __ovld atomic_exchange(volatile atomic_float __local *object,
-+ float desired);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+double __ovld atomic_exchange(volatile atomic_double __global *object,
-+ double desired);
-+double __ovld atomic_exchange(volatile atomic_double __local *object,
-+ double desired);
- #endif
-+long __ovld atomic_exchange(volatile atomic_long __global *object,
-+ long desired);
-+long __ovld atomic_exchange(volatile atomic_long __local *object, long desired);
-+ulong __ovld atomic_exchange(volatile atomic_ulong __global *object,
-+ ulong desired);
-+ulong __ovld atomic_exchange(volatile atomic_ulong __local *object,
-+ ulong desired);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+
-+#ifdef __opencl_c_generic_address_space
-+#ifdef __opencl_c_atomic_scope_device
-+int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired,
-+ memory_order order);
-+uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired,
-+ memory_order order);
-+float __ovld atomic_exchange_explicit(volatile atomic_float *object,
-+ float desired, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired,
-+ memory_order order, memory_scope scope);
-+uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired,
-+ memory_order order, memory_scope scope);
-+float __ovld atomic_exchange_explicit(volatile atomic_float *object,
-+ float desired, memory_order order,
-+ memory_scope scope);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+double __ovld atomic_exchange_explicit(volatile atomic_double *object,
-+ double desired, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+double __ovld atomic_exchange_explicit(volatile atomic_double *object,
-+ double desired, memory_order order,
-+ memory_scope scope);
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired,
-+ memory_order order);
-+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object,
-+ ulong desired, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired,
-+ memory_order order, memory_scope scope);
-+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object,
-+ ulong desired, memory_order order,
-+ memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#ifdef __opencl_c_atomic_scope_device
-+int __ovld atomic_exchange_explicit(volatile atomic_int __global *object,
-+ int desired, memory_order order);
-+int __ovld atomic_exchange_explicit(volatile atomic_int __local *object,
-+ int desired, memory_order order);
-+uint __ovld atomic_exchange_explicit(volatile atomic_uint __global *object,
-+ uint desired, memory_order order);
-+uint __ovld atomic_exchange_explicit(volatile atomic_uint __local *object,
-+ uint desired, memory_order order);
-+float __ovld atomic_exchange_explicit(volatile atomic_float __global *object,
-+ float desired, memory_order order);
-+float __ovld atomic_exchange_explicit(volatile atomic_float __local *object,
-+ float desired, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+int __ovld atomic_exchange_explicit(volatile atomic_int __global *object,
-+ int desired, memory_order order,
-+ memory_scope scope);
-+int __ovld atomic_exchange_explicit(volatile atomic_int __local *object,
-+ int desired, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_exchange_explicit(volatile atomic_uint __global *object,
-+ uint desired, memory_order order,
-+ memory_scope scope);
-+uint __ovld atomic_exchange_explicit(volatile atomic_uint __local *object,
-+ uint desired, memory_order order,
-+ memory_scope scope);
-+float __ovld atomic_exchange_explicit(volatile atomic_float __global *object,
-+ float desired, memory_order order,
-+ memory_scope scope);
-+float __ovld atomic_exchange_explicit(volatile atomic_float __local *object,
-+ float desired, memory_order order,
-+ memory_scope scope);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+double __ovld atomic_exchange_explicit(volatile atomic_double __global *object,
-+ double desired, memory_order order);
-+double __ovld atomic_exchange_explicit(volatile atomic_double __local *object,
-+ double desired, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+double __ovld atomic_exchange_explicit(volatile atomic_double __global *object,
-+ double desired, memory_order order,
-+ memory_scope scope);
-+double __ovld atomic_exchange_explicit(volatile atomic_double __local *object,
-+ double desired, memory_order order,
-+ memory_scope scope);
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+long __ovld atomic_exchange_explicit(volatile atomic_long __global *object,
-+ long desired, memory_order order);
-+long __ovld atomic_exchange_explicit(volatile atomic_long __local *object,
-+ long desired, memory_order order);
-+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong __global *object,
-+ ulong desired, memory_order order);
-+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong __local *object,
-+ ulong desired, memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+long __ovld atomic_exchange_explicit(volatile atomic_long __global *object,
-+ long desired, memory_order order,
-+ memory_scope scope);
-+long __ovld atomic_exchange_explicit(volatile atomic_long __local *object,
-+ long desired, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong __global *object,
-+ ulong desired, memory_order order,
-+ memory_scope scope);
-+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong __local *object,
-+ ulong desired, memory_order order,
-+ memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-
- // atomic_compare_exchange_strong() and atomic_compare_exchange_weak()
--
--bool __ovld atomic_compare_exchange_strong(volatile atomic_int *object, int *expected, int desired);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object, int *expected,
-- int desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object, int *expected,
-- int desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_strong(volatile atomic_uint *object, uint *expected, uint desired);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_uint *object, uint *expected,
-- uint desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_uint *object, uint *expected,
-- uint desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_weak(volatile atomic_int *object, int *expected, int desired);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object, int *expected,
-- int desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object, int *expected,
-- int desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_weak(volatile atomic_uint *object, uint *expected, uint desired);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object, uint *expected,
-- uint desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object, uint *expected,
-- uint desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_strong(volatile atomic_float *object, float *expected, float desired);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_float *object, float *expected,
-- float desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_float *object, float *expected,
-- float desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_weak(volatile atomic_float *object, float *expected, float desired);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_float *object, float *expected,
-- float desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_float *object, float *expected,
-- float desired, memory_order success, memory_order failure, memory_scope scope);
-+#ifdef __opencl_c_generic_address_space
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_int *object,
-+ int *expected, int desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_uint *object,
-+ uint *expected, uint desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_int *object,
-+ int *expected, int desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint *object,
-+ uint *expected, uint desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_float *object,
-+ float *expected, float desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_float *object,
-+ float *expected, float desired);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_double *object,
-+ double *expected, double desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_double *object,
-+ double *expected, double desired);
-+#endif
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_long *object,
-+ long *expected, long desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_long *object,
-+ long *expected, long desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_ulong *object,
-+ ulong *expected, ulong desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong *object,
-+ ulong *expected, ulong desired);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __global *object,
-+ int __global *expected, int desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __local *object,
-+ int __global *expected, int desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __global *object,
-+ int __local *expected, int desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __local *object,
-+ int __local *expected, int desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __global *object,
-+ int __private *expected,
-+ int desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __local *object,
-+ int __private *expected,
-+ int desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_uint __global *object,
-+ uint __global *expected, uint desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_uint __local *object,
-+ uint __global *expected,
-+ uint desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_uint __global *object,
-+ uint __local *expected, uint desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_uint __local *object,
-+ uint __local *expected,
-+ uint desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_uint __global *object,
-+ uint __private *expected, uint desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_uint __local *object,
-+ uint __private *expected,
-+ uint desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __global *object,
-+ int __global *expected, int desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __local *object,
-+ int __global *expected, int desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __global *object,
-+ int __local *expected, int desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __local *object,
-+ int __local *expected, int desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __global *object,
-+ int __private *expected, int desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __local *object,
-+ int __private *expected, int desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __global *object,
-+ uint __global *expected, uint desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __local *object,
-+ uint __global *expected, uint desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __global *object,
-+ uint __local *expected, uint desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __local *object,
-+ uint __local *expected, uint desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __global *object,
-+ uint __private *expected,
-+ uint desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __local *object,
-+ uint __private *expected,
-+ uint desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_float __global *object,
-+ float __global *expected, float desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_float __local *object,
-+ float __global *expected, float desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_float __global *object,
-+ float __local *expected, float desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_float __local *object,
-+ float __local *expected, float desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_float __global *object,
-+ float __private *expected, float desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_float __local *object,
-+ float __private *expected, float desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __global *object,
-+ float __global *expected,
-+ float desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __local *object,
-+ float __global *expected,
-+ float desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __global *object,
-+ float __local *expected,
-+ float desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __local *object,
-+ float __local *expected,
-+ float desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __global *object,
-+ float __private *expected,
-+ float desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __local *object,
-+ float __private *expected,
-+ float desired);
- #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
--#ifdef cl_khr_fp64
--bool __ovld atomic_compare_exchange_strong(volatile atomic_double *object, double *expected, double desired);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_double *object, double *expected,
-- double desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_double *object, double *expected,
-- double desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_weak(volatile atomic_double *object, double *expected, double desired);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_double *object, double *expected,
-- double desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_double *object, double *expected,
-- double desired, memory_order success, memory_order failure, memory_scope scope);
--#endif //cl_khr_fp64
--bool __ovld atomic_compare_exchange_strong(volatile atomic_long *object, long *expected, long desired);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_long *object, long *expected,
-- long desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_long *object, long *expected,
-- long desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_weak(volatile atomic_long *object, long *expected, long desired);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object, long *expected,
-- long desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object, long *expected,
-- long desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_strong(volatile atomic_ulong *object, ulong *expected, ulong desired);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_ulong *object, ulong *expected,
-- ulong desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_ulong *object, ulong *expected,
-- ulong desired, memory_order success, memory_order failure, memory_scope scope);
--bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong *object, ulong *expected, ulong desired);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_ulong *object, ulong *expected,
-- ulong desired, memory_order success, memory_order failure);
--bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_ulong *object, ulong *expected,
-- ulong desired, memory_order success, memory_order failure, memory_scope scope);
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_double __global *object,
-+ double __global *expected, double desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_double __local *object,
-+ double __global *expected, double desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_double __global *object,
-+ double __local *expected, double desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_double __local *object,
-+ double __local *expected, double desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_double __global *object,
-+ double __private *expected, double desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_double __local *object,
-+ double __private *expected, double desired);
-+bool __ovld
-+atomic_compare_exchange_weak(volatile atomic_double __global *object,
-+ double __global *expected, double desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_double __local *object,
-+ double __global *expected,
-+ double desired);
-+bool __ovld
-+atomic_compare_exchange_weak(volatile atomic_double __global *object,
-+ double __local *expected, double desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_double __local *object,
-+ double __local *expected,
-+ double desired);
-+bool __ovld
-+atomic_compare_exchange_weak(volatile atomic_double __global *object,
-+ double __private *expected, double desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_double __local *object,
-+ double __private *expected,
-+ double desired);
- #endif
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_long __global *object,
-+ long __global *expected, long desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_long __local *object,
-+ long __global *expected,
-+ long desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_long __global *object,
-+ long __local *expected, long desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_long __local *object,
-+ long __local *expected,
-+ long desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_long __global *object,
-+ long __private *expected, long desired);
-+bool __ovld atomic_compare_exchange_strong(volatile atomic_long __local *object,
-+ long __private *expected,
-+ long desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __global *object,
-+ long __global *expected, long desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __local *object,
-+ long __global *expected, long desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __global *object,
-+ long __local *expected, long desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __local *object,
-+ long __local *expected, long desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __global *object,
-+ long __private *expected,
-+ long desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __local *object,
-+ long __private *expected,
-+ long desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_ulong __global *object,
-+ ulong __global *expected, ulong desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_ulong __local *object,
-+ ulong __global *expected, ulong desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_ulong __global *object,
-+ ulong __local *expected, ulong desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_ulong __local *object,
-+ ulong __local *expected, ulong desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_ulong __global *object,
-+ ulong __private *expected, ulong desired);
-+bool __ovld
-+atomic_compare_exchange_strong(volatile atomic_ulong __local *object,
-+ ulong __private *expected, ulong desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __global *object,
-+ ulong __global *expected,
-+ ulong desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __local *object,
-+ ulong __global *expected,
-+ ulong desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __global *object,
-+ ulong __local *expected,
-+ ulong desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __local *object,
-+ ulong __local *expected,
-+ ulong desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __global *object,
-+ ulong __private *expected,
-+ ulong desired);
-+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __local *object,
-+ ulong __private *expected,
-+ ulong desired);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+
-+#ifdef __opencl_c_generic_address_space
-+#ifdef __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object,
-+ int *expected, int desired,
-+ memory_order success,
-+ memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint *object, uint *expected, uint desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object,
-+ int *expected, int desired,
-+ memory_order success,
-+ memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object,
-+ uint *expected, uint desired,
-+ memory_order success,
-+ memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float *object, float *expected, float desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_float *object,
-+ float *expected,
-+ float desired,
-+ memory_order success,
-+ memory_order failure);
-+#endif // __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object,
-+ int *expected, int desired,
-+ memory_order success,
-+ memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint *object, uint *expected, uint desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object,
-+ int *expected, int desired,
-+ memory_order success,
-+ memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object,
-+ uint *expected, uint desired,
-+ memory_order success,
-+ memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float *object, float *expected, float desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float *object, float *expected, float desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double *object, double *expected, double desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double *object, double *expected, double desired,
-+ memory_order success, memory_order failure);
-+#endif // __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double *object, double *expected, double desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double *object, double *expected, double desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long *object, long *expected, long desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object,
-+ long *expected, long desired,
-+ memory_order success,
-+ memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong *object, ulong *expected, ulong desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_ulong *object,
-+ ulong *expected,
-+ ulong desired,
-+ memory_order success,
-+ memory_order failure);
-+#endif // __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long *object, long *expected, long desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object,
-+ long *expected, long desired,
-+ memory_order success,
-+ memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong *object, ulong *expected, ulong desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong *object, ulong *expected, ulong desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#ifdef __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __global *object, int __global *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __local *object, int __global *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __global *object, int __local *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __local *object, int __local *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __global *object, int __private *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __local *object, int __private *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __global *object, uint __global *expected,
-+ uint desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __local *object, uint __global *expected, uint desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __global *object, uint __local *expected, uint desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __local *object, uint __local *expected, uint desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __global *object, uint __private *expected,
-+ uint desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __local *object, uint __private *expected,
-+ uint desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __global *object, int __global *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __local *object, int __global *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __global *object, int __local *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __local *object, int __local *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __global *object, int __private *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __local *object, int __private *expected, int desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __global *object, uint __global *expected,
-+ uint desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __local *object, uint __global *expected, uint desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __global *object, uint __local *expected, uint desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __local *object, uint __local *expected, uint desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __global *object, uint __private *expected,
-+ uint desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __local *object, uint __private *expected,
-+ uint desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __global *object, float __global *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __local *object, float __global *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __global *object, float __local *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __local *object, float __local *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __global *object, float __private *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __local *object, float __private *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __global *object, float __global *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __local *object, float __global *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __global *object, float __local *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __local *object, float __local *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __global *object, float __private *expected,
-+ float desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __local *object, float __private *expected,
-+ float desired, memory_order success, memory_order failure);
-+#endif // __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __global *object, int __global *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __local *object, int __global *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __global *object, int __local *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __local *object, int __local *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __global *object, int __private *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_int __local *object, int __private *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __global *object, uint __global *expected,
-+ uint desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __local *object, uint __global *expected, uint desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __global *object, uint __local *expected, uint desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __local *object, uint __local *expected, uint desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __global *object, uint __private *expected,
-+ uint desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_uint __local *object, uint __private *expected,
-+ uint desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __global *object, int __global *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __local *object, int __global *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __global *object, int __local *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __local *object, int __local *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __global *object, int __private *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_int __local *object, int __private *expected, int desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __global *object, uint __global *expected,
-+ uint desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __local *object, uint __global *expected, uint desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __global *object, uint __local *expected, uint desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __local *object, uint __local *expected, uint desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __global *object, uint __private *expected,
-+ uint desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_uint __local *object, uint __private *expected,
-+ uint desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __global *object, float __global *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __local *object, float __global *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __global *object, float __local *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __local *object, float __local *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __global *object, float __private *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_float __local *object, float __private *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __global *object, float __global *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __local *object, float __global *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __global *object, float __local *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __local *object, float __local *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __global *object, float __private *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_float __local *object, float __private *expected,
-+ float desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __global *object, double __global *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __local *object, double __global *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __global *object, double __local *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __local *object, double __local *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __global *object, double __private *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __local *object, double __private *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __global *object, double __global *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __local *object, double __global *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __global *object, double __local *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __local *object, double __local *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __global *object, double __private *expected,
-+ double desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __local *object, double __private *expected,
-+ double desired, memory_order success, memory_order failure);
-+#endif // __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __global *object, double __global *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __local *object, double __global *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __global *object, double __local *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __local *object, double __local *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __global *object, double __private *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_double __local *object, double __private *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __global *object, double __global *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __local *object, double __global *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __global *object, double __local *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __local *object, double __local *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __global *object, double __private *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_double __local *object, double __private *expected,
-+ double desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#ifdef __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __global *object, long __global *expected,
-+ long desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __local *object, long __global *expected, long desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __global *object, long __local *expected, long desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __local *object, long __local *expected, long desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __global *object, long __private *expected,
-+ long desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __local *object, long __private *expected,
-+ long desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __global *object, long __global *expected,
-+ long desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __local *object, long __global *expected, long desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __global *object, long __local *expected, long desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __local *object, long __local *expected, long desired,
-+ memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __global *object, long __private *expected,
-+ long desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __local *object, long __private *expected,
-+ long desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __global *object, ulong __global *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __local *object, ulong __global *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __global *object, ulong __local *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __local *object, ulong __local *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __global *object, ulong __private *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __local *object, ulong __private *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __global *object, ulong __global *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __local *object, ulong __global *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __global *object, ulong __local *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __local *object, ulong __local *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __global *object, ulong __private *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __local *object, ulong __private *expected,
-+ ulong desired, memory_order success, memory_order failure);
-+#endif // __opencl_c_atomic_scope_device
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __global *object, long __global *expected,
-+ long desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __local *object, long __global *expected, long desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __global *object, long __local *expected, long desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __local *object, long __local *expected, long desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __global *object, long __private *expected,
-+ long desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_long __local *object, long __private *expected,
-+ long desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __global *object, long __global *expected,
-+ long desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __local *object, long __global *expected, long desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __global *object, long __local *expected, long desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __local *object, long __local *expected, long desired,
-+ memory_order success, memory_order failure, memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __global *object, long __private *expected,
-+ long desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_long __local *object, long __private *expected,
-+ long desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __global *object, ulong __global *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __local *object, ulong __global *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __global *object, ulong __local *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __local *object, ulong __local *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __global *object, ulong __private *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_strong_explicit(
-+ volatile atomic_ulong __local *object, ulong __private *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __global *object, ulong __global *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __local *object, ulong __global *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __global *object, ulong __local *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __local *object, ulong __local *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __global *object, ulong __private *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+bool __ovld atomic_compare_exchange_weak_explicit(
-+ volatile atomic_ulong __local *object, ulong __private *expected,
-+ ulong desired, memory_order success, memory_order failure,
-+ memory_scope scope);
-+#endif // defined(cl_khr_int64_base_atomics) &&
-+ // defined(cl_khr_int64_extended_atomics)
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-
- // atomic_flag_test_and_set() and atomic_flag_clear()
--
-+#if defined(__opencl_c_atomic_scope_device) && \
-+ defined(__opencl_c_atomic_order_seq_cst)
-+#ifdef __opencl_c_generic_address_space
- bool __ovld atomic_flag_test_and_set(volatile atomic_flag *object);
--bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object, memory_order order);
--bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object, memory_order order, memory_scope scope);
- void __ovld atomic_flag_clear(volatile atomic_flag *object);
--void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object, memory_order order);
--void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object, memory_order order, memory_scope scope);
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+bool __ovld atomic_flag_test_and_set(volatile atomic_flag __global *object);
-+bool __ovld atomic_flag_test_and_set(volatile atomic_flag __local *object);
-+void __ovld atomic_flag_clear(volatile atomic_flag __global *object);
-+void __ovld atomic_flag_clear(volatile atomic_flag __local *object);
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#endif // defined(__opencl_c_atomic_scope_device) &&
-+ // defined(__opencl_c_atomic_order_seq_cst)
-+
-+#ifdef __opencl_c_generic_address_space
-+#ifdef __opencl_c_atomic_scope_device
-+bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object,
-+ memory_order order);
-+void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object,
-+ memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object,
-+ memory_order order,
-+ memory_scope scope);
-+void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object,
-+ memory_order order, memory_scope scope);
-+#endif // __opencl_c_generic_address_space
-+
-+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-+#ifdef __opencl_c_atomic_scope_device
-+bool __ovld atomic_flag_test_and_set_explicit(
-+ volatile atomic_flag __global *object, memory_order order);
-+bool __ovld atomic_flag_test_and_set_explicit(
-+ volatile atomic_flag __local *object, memory_order order);
-+void __ovld atomic_flag_clear_explicit(volatile atomic_flag __global *object,
-+ memory_order order);
-+void __ovld atomic_flag_clear_explicit(volatile atomic_flag __local *object,
-+ memory_order order);
-+#endif // __opencl_c_atomic_scope_device
-+bool __ovld
-+atomic_flag_test_and_set_explicit(volatile atomic_flag __global *object,
-+ memory_order order, memory_scope scope);
-+bool __ovld
-+atomic_flag_test_and_set_explicit(volatile atomic_flag __local *object,
-+ memory_order order, memory_scope scope);
-+void __ovld atomic_flag_clear_explicit(volatile atomic_flag __global *object,
-+ memory_order order, memory_scope scope);
-+void __ovld atomic_flag_clear_explicit(volatile atomic_flag __local *object,
-+ memory_order order, memory_scope scope);
-+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
-
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
-@@ -13906,7 +15943,7 @@ float16 __ovld __cnfn shuffle(float4 x, uint16 mask);
- float16 __ovld __cnfn shuffle(float8 x, uint16 mask);
- float16 __ovld __cnfn shuffle(float16 x, uint16 mask);
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double2 __ovld __cnfn shuffle(double2 x, ulong2 mask);
- double2 __ovld __cnfn shuffle(double4 x, ulong2 mask);
- double2 __ovld __cnfn shuffle(double8 x, ulong2 mask);
-@@ -13926,7 +15963,7 @@ double16 __ovld __cnfn shuffle(double2 x, ulong16 mask);
- double16 __ovld __cnfn shuffle(double4 x, ulong16 mask);
- double16 __ovld __cnfn shuffle(double8 x, ulong16 mask);
- double16 __ovld __cnfn shuffle(double16 x, ulong16 mask);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #ifdef cl_khr_fp16
- half2 __ovld __cnfn shuffle(half2 x, ushort2 mask);
-@@ -14130,7 +16167,7 @@ float16 __ovld __cnfn shuffle2(float4 x, float4 y, uint16 mask);
- float16 __ovld __cnfn shuffle2(float8 x, float8 y, uint16 mask);
- float16 __ovld __cnfn shuffle2(float16 x, float16 y, uint16 mask);
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double2 __ovld __cnfn shuffle2(double2 x, double2 y, ulong2 mask);
- double2 __ovld __cnfn shuffle2(double4 x, double4 y, ulong2 mask);
- double2 __ovld __cnfn shuffle2(double8 x, double8 y, ulong2 mask);
-@@ -14150,7 +16187,7 @@ double16 __ovld __cnfn shuffle2(double2 x, double2 y, ulong16 mask);
- double16 __ovld __cnfn shuffle2(double4 x, double4 y, ulong16 mask);
- double16 __ovld __cnfn shuffle2(double8 x, double8 y, ulong16 mask);
- double16 __ovld __cnfn shuffle2(double16 x, double16 y, ulong16 mask);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #ifdef cl_khr_fp16
- half2 __ovld __cnfn shuffle2(half2 x, half2 y, ushort2 mask);
-@@ -14186,6 +16223,7 @@ int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2)))
- #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable
- #endif //cl_khr_gl_msaa_sharing
-
-+#ifdef __opencl_c_images
- /**
- * Use the coordinate (coord.xy) to do an element lookup in
- * the 2D image object specified by image.
-@@ -14464,6 +16502,7 @@ half4 __purefn __ovld read_imageh(read_only image1d_buffer_t image, int coord);
-
- // Image read functions for read_write images
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- float4 __purefn __ovld read_imagef(read_write image1d_t image, int coord);
- int4 __purefn __ovld read_imagei(read_write image1d_t image, int coord);
- uint4 __purefn __ovld read_imageui(read_write image1d_t image, int coord);
-@@ -14507,6 +16546,7 @@ float __purefn __ovld read_imagef(read_write image2d_array_msaa_depth_t image, i
- #endif //cl_khr_gl_msaa_sharing
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- #ifdef cl_khr_mipmap_image
- float4 __purefn __ovld read_imagef(read_write image1d_t image, sampler_t sampler, float coord, float lod);
- int4 __purefn __ovld read_imagei(read_write image1d_t image, sampler_t sampler, float coord, float lod);
-@@ -14557,6 +16597,7 @@ int4 __purefn __ovld read_imagei(read_write image3d_t image, sampler_t sampler,
- uint4 __purefn __ovld read_imageui(read_write image3d_t image, sampler_t sampler, float4 coord, float4 gradientX, float4 gradientY);
-
- #endif //cl_khr_mipmap_image
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- // Image read functions returning half4 type
-@@ -14568,6 +16609,7 @@ half4 __purefn __ovld read_imageh(read_write image1d_array_t image, int2 coord);
- half4 __purefn __ovld read_imageh(read_write image2d_array_t image, int4 coord);
- half4 __purefn __ovld read_imageh(read_write image1d_buffer_t image, int coord);
- #endif //cl_khr_fp16
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
-@@ -14657,7 +16699,7 @@ void __ovld write_imagef(write_only image1d_array_t image_array, int2 coord, flo
- void __ovld write_imagei(write_only image1d_array_t image_array, int2 coord, int4 color);
- void __ovld write_imageui(write_only image1d_array_t image_array, int2 coord, uint4 color);
-
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- void __ovld write_imagef(write_only image3d_t image, int4 coord, float4 color);
- void __ovld write_imagei(write_only image3d_t image, int4 coord, int4 color);
- void __ovld write_imageui(write_only image3d_t image, int4 coord, uint4 color);
-@@ -14690,7 +16732,7 @@ void __ovld write_imageui(write_only image2d_array_t image_array, int4 coord, in
- void __ovld write_imagef(write_only image2d_depth_t image, int2 coord, int lod, float depth);
- void __ovld write_imagef(write_only image2d_array_depth_t image, int4 coord, int lod, float depth);
-
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- void __ovld write_imagef(write_only image3d_t image, int4 coord, int lod, float4 color);
- void __ovld write_imagei(write_only image3d_t image, int4 coord, int lod, int4 color);
- void __ovld write_imageui(write_only image3d_t image, int4 coord, int lod, uint4 color);
-@@ -14703,7 +16745,7 @@ void __ovld write_imageui(write_only image3d_t image, int4 coord, int lod, uint4
- #ifdef cl_khr_fp16
- void __ovld write_imageh(write_only image1d_t image, int coord, half4 color);
- void __ovld write_imageh(write_only image2d_t image, int2 coord, half4 color);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- void __ovld write_imageh(write_only image3d_t image, int4 coord, half4 color);
- #endif
- void __ovld write_imageh(write_only image1d_array_t image, int2 coord, half4 color);
-@@ -14713,6 +16755,7 @@ void __ovld write_imageh(write_only image1d_buffer_t image, int coord, half4 col
-
- // Image write functions for read_write images
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- void __ovld write_imagef(read_write image2d_t image, int2 coord, float4 color);
- void __ovld write_imagei(read_write image2d_t image, int2 coord, int4 color);
- void __ovld write_imageui(read_write image2d_t image, int2 coord, uint4 color);
-@@ -14733,7 +16776,7 @@ void __ovld write_imagef(read_write image1d_array_t image_array, int2 coord, flo
- void __ovld write_imagei(read_write image1d_array_t image_array, int2 coord, int4 color);
- void __ovld write_imageui(read_write image1d_array_t image_array, int2 coord, uint4 color);
-
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- void __ovld write_imagef(read_write image3d_t image, int4 coord, float4 color);
- void __ovld write_imagei(read_write image3d_t image, int4 coord, int4 color);
- void __ovld write_imageui(read_write image3d_t image, int4 coord, uint4 color);
-@@ -14765,7 +16808,7 @@ void __ovld write_imageui(read_write image2d_array_t image_array, int4 coord, in
- void __ovld write_imagef(read_write image2d_depth_t image, int2 coord, int lod, float color);
- void __ovld write_imagef(read_write image2d_array_depth_t image, int4 coord, int lod, float color);
-
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- void __ovld write_imagef(read_write image3d_t image, int4 coord, int lod, float4 color);
- void __ovld write_imagei(read_write image3d_t image, int4 coord, int lod, int4 color);
- void __ovld write_imageui(read_write image3d_t image, int4 coord, int lod, uint4 color);
-@@ -14778,13 +16821,14 @@ void __ovld write_imageui(read_write image3d_t image, int4 coord, int lod, uint4
- #ifdef cl_khr_fp16
- void __ovld write_imageh(read_write image1d_t image, int coord, half4 color);
- void __ovld write_imageh(read_write image2d_t image, int2 coord, half4 color);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- void __ovld write_imageh(read_write image3d_t image, int4 coord, half4 color);
- #endif
- void __ovld write_imageh(read_write image1d_array_t image, int2 coord, half4 color);
- void __ovld write_imageh(read_write image2d_array_t image, int4 coord, half4 color);
- void __ovld write_imageh(read_write image1d_buffer_t image, int coord, half4 color);
- #endif //cl_khr_fp16
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- // Note: In OpenCL v1.0/1.1/1.2, image argument of image query builtin functions does not have
-@@ -14798,7 +16842,7 @@ void __ovld write_imageh(read_write image1d_buffer_t image, int coord, half4 col
- int __ovld __cnfn get_image_width(read_only image1d_t image);
- int __ovld __cnfn get_image_width(read_only image1d_buffer_t image);
- int __ovld __cnfn get_image_width(read_only image2d_t image);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- int __ovld __cnfn get_image_width(read_only image3d_t image);
- #endif
- int __ovld __cnfn get_image_width(read_only image1d_array_t image);
-@@ -14817,7 +16861,7 @@ int __ovld __cnfn get_image_width(read_only image2d_array_msaa_depth_t image);
- int __ovld __cnfn get_image_width(write_only image1d_t image);
- int __ovld __cnfn get_image_width(write_only image1d_buffer_t image);
- int __ovld __cnfn get_image_width(write_only image2d_t image);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- int __ovld __cnfn get_image_width(write_only image3d_t image);
- #endif
- int __ovld __cnfn get_image_width(write_only image1d_array_t image);
-@@ -14834,6 +16878,7 @@ int __ovld __cnfn get_image_width(write_only image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- int __ovld __cnfn get_image_width(read_write image1d_t image);
- int __ovld __cnfn get_image_width(read_write image1d_buffer_t image);
- int __ovld __cnfn get_image_width(read_write image2d_t image);
-@@ -14850,6 +16895,7 @@ int __ovld __cnfn get_image_width(read_write image2d_msaa_depth_t image);
- int __ovld __cnfn get_image_width(read_write image2d_array_msaa_t image);
- int __ovld __cnfn get_image_width(read_write image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
-@@ -14870,7 +16916,7 @@ int __ovld __cnfn get_image_height(read_only image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-
- int __ovld __cnfn get_image_height(write_only image2d_t image);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- int __ovld __cnfn get_image_height(write_only image3d_t image);
- #endif
- int __ovld __cnfn get_image_height(write_only image2d_array_t image);
-@@ -14886,6 +16932,7 @@ int __ovld __cnfn get_image_height(write_only image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- int __ovld __cnfn get_image_height(read_write image2d_t image);
- int __ovld __cnfn get_image_height(read_write image3d_t image);
- int __ovld __cnfn get_image_height(read_write image2d_array_t image);
-@@ -14899,6 +16946,7 @@ int __ovld __cnfn get_image_height(read_write image2d_msaa_depth_t image);
- int __ovld __cnfn get_image_height(read_write image2d_array_msaa_t image);
- int __ovld __cnfn get_image_height(read_write image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
-@@ -14906,12 +16954,14 @@ int __ovld __cnfn get_image_height(read_write image2d_array_msaa_depth_t image);
- */
- int __ovld __cnfn get_image_depth(read_only image3d_t image);
-
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- int __ovld __cnfn get_image_depth(write_only image3d_t image);
- #endif
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- int __ovld __cnfn get_image_depth(read_write image3d_t image);
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- // OpenCL Extension v2.0 s9.18 - Mipmaps
-@@ -14927,13 +16977,15 @@ int __ovld get_image_num_mip_levels(read_only image3d_t image);
-
- int __ovld get_image_num_mip_levels(write_only image1d_t image);
- int __ovld get_image_num_mip_levels(write_only image2d_t image);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- int __ovld get_image_num_mip_levels(write_only image3d_t image);
- #endif
-
-+#ifdef __opencl_c_read_write_images
- int __ovld get_image_num_mip_levels(read_write image1d_t image);
- int __ovld get_image_num_mip_levels(read_write image2d_t image);
- int __ovld get_image_num_mip_levels(read_write image3d_t image);
-+#endif //__opencl_c_read_write_images
-
- int __ovld get_image_num_mip_levels(read_only image1d_array_t image);
- int __ovld get_image_num_mip_levels(read_only image2d_array_t image);
-@@ -14945,10 +16997,12 @@ int __ovld get_image_num_mip_levels(write_only image2d_array_t image);
- int __ovld get_image_num_mip_levels(write_only image2d_array_depth_t image);
- int __ovld get_image_num_mip_levels(write_only image2d_depth_t image);
-
-+#ifdef __opencl_c_read_write_images
- int __ovld get_image_num_mip_levels(read_write image1d_array_t image);
- int __ovld get_image_num_mip_levels(read_write image2d_array_t image);
- int __ovld get_image_num_mip_levels(read_write image2d_array_depth_t image);
- int __ovld get_image_num_mip_levels(read_write image2d_depth_t image);
-+#endif //__opencl_c_read_write_images
-
- #endif //cl_khr_mipmap_image
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-@@ -14992,7 +17046,7 @@ int __ovld __cnfn get_image_channel_data_type(read_only image2d_array_msaa_depth
- int __ovld __cnfn get_image_channel_data_type(write_only image1d_t image);
- int __ovld __cnfn get_image_channel_data_type(write_only image1d_buffer_t image);
- int __ovld __cnfn get_image_channel_data_type(write_only image2d_t image);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- int __ovld __cnfn get_image_channel_data_type(write_only image3d_t image);
- #endif
- int __ovld __cnfn get_image_channel_data_type(write_only image1d_array_t image);
-@@ -15009,6 +17063,7 @@ int __ovld __cnfn get_image_channel_data_type(write_only image2d_array_msaa_dept
- #endif //cl_khr_gl_msaa_sharing
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- int __ovld __cnfn get_image_channel_data_type(read_write image1d_t image);
- int __ovld __cnfn get_image_channel_data_type(read_write image1d_buffer_t image);
- int __ovld __cnfn get_image_channel_data_type(read_write image2d_t image);
-@@ -15025,6 +17080,7 @@ int __ovld __cnfn get_image_channel_data_type(read_write image2d_msaa_depth_t im
- int __ovld __cnfn get_image_channel_data_type(read_write image2d_array_msaa_t image);
- int __ovld __cnfn get_image_channel_data_type(read_write image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
-@@ -15064,7 +17120,7 @@ int __ovld __cnfn get_image_channel_order(read_only image2d_array_msaa_depth_t i
- int __ovld __cnfn get_image_channel_order(write_only image1d_t image);
- int __ovld __cnfn get_image_channel_order(write_only image1d_buffer_t image);
- int __ovld __cnfn get_image_channel_order(write_only image2d_t image);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- int __ovld __cnfn get_image_channel_order(write_only image3d_t image);
- #endif
- int __ovld __cnfn get_image_channel_order(write_only image1d_array_t image);
-@@ -15081,6 +17137,7 @@ int __ovld __cnfn get_image_channel_order(write_only image2d_array_msaa_depth_t
- #endif //cl_khr_gl_msaa_sharing
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- int __ovld __cnfn get_image_channel_order(read_write image1d_t image);
- int __ovld __cnfn get_image_channel_order(read_write image1d_buffer_t image);
- int __ovld __cnfn get_image_channel_order(read_write image2d_t image);
-@@ -15097,6 +17154,7 @@ int __ovld __cnfn get_image_channel_order(read_write image2d_msaa_depth_t image)
- int __ovld __cnfn get_image_channel_order(read_write image2d_array_msaa_t image);
- int __ovld __cnfn get_image_channel_order(read_write image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
-@@ -15131,6 +17189,7 @@ int2 __ovld __cnfn get_image_dim(write_only image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- int2 __ovld __cnfn get_image_dim(read_write image2d_t image);
- int2 __ovld __cnfn get_image_dim(read_write image2d_array_t image);
- #ifdef cl_khr_depth_images
-@@ -15143,6 +17202,7 @@ int2 __ovld __cnfn get_image_dim(read_write image2d_msaa_depth_t image);
- int2 __ovld __cnfn get_image_dim(read_write image2d_array_msaa_t image);
- int2 __ovld __cnfn get_image_dim(read_write image2d_array_msaa_depth_t image);
- #endif //cl_khr_gl_msaa_sharing
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
-@@ -15152,11 +17212,13 @@ int2 __ovld __cnfn get_image_dim(read_write image2d_array_msaa_depth_t image);
- * component and the w component is 0.
- */
- int4 __ovld __cnfn get_image_dim(read_only image3d_t image);
--#ifdef cl_khr_3d_image_writes
-+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
- int4 __ovld __cnfn get_image_dim(write_only image3d_t image);
- #endif
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- int4 __ovld __cnfn get_image_dim(read_write image3d_t image);
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
-@@ -15184,6 +17246,7 @@ size_t __ovld __cnfn get_image_array_size(write_only image2d_array_msaa_depth_t
- #endif //cl_khr_gl_msaa_sharing
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- size_t __ovld __cnfn get_image_array_size(read_write image1d_array_t image_array);
- size_t __ovld __cnfn get_image_array_size(read_write image2d_array_t image_array);
- #ifdef cl_khr_depth_images
-@@ -15193,6 +17256,7 @@ size_t __ovld __cnfn get_image_array_size(read_write image2d_array_depth_t image
- size_t __ovld __cnfn get_image_array_size(read_write image2d_array_msaa_t image_array);
- size_t __ovld __cnfn get_image_array_size(read_write image2d_array_msaa_depth_t image_array);
- #endif //cl_khr_gl_msaa_sharing
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- /**
-@@ -15210,16 +17274,21 @@ int __ovld get_image_num_samples(write_only image2d_array_msaa_t image);
- int __ovld get_image_num_samples(write_only image2d_array_msaa_depth_t image);
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_read_write_images
- int __ovld get_image_num_samples(read_write image2d_msaa_t image);
- int __ovld get_image_num_samples(read_write image2d_msaa_depth_t image);
- int __ovld get_image_num_samples(read_write image2d_array_msaa_t image);
- int __ovld get_image_num_samples(read_write image2d_array_msaa_depth_t image);
-+#endif //__opencl_c_read_write_images
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
- #endif
-
-+#endif //__opencl_c_images
-+
- // OpenCL v2.0 s6.13.15 - Work-group Functions
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_work_group_collective_functions
- int __ovld __conv work_group_all(int predicate);
- int __ovld __conv work_group_any(int predicate);
-
-@@ -15243,11 +17312,11 @@ ulong __ovld __conv work_group_broadcast(ulong a, size_t x, size_t y, size_t z);
- float __ovld __conv work_group_broadcast(float a, size_t local_id);
- float __ovld __conv work_group_broadcast(float a, size_t x, size_t y);
- float __ovld __conv work_group_broadcast(float a, size_t x, size_t y, size_t z);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __conv work_group_broadcast(double a, size_t local_id);
- double __ovld __conv work_group_broadcast(double a, size_t x, size_t y);
- double __ovld __conv work_group_broadcast(double a, size_t x, size_t y, size_t z);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #ifdef cl_khr_fp16
- half __ovld __conv work_group_reduce_add(half x);
-@@ -15305,7 +17374,7 @@ float __ovld __conv work_group_scan_exclusive_max(float x);
- float __ovld __conv work_group_scan_inclusive_add(float x);
- float __ovld __conv work_group_scan_inclusive_min(float x);
- float __ovld __conv work_group_scan_inclusive_max(float x);
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __conv work_group_reduce_add(double x);
- double __ovld __conv work_group_reduce_min(double x);
- double __ovld __conv work_group_reduce_max(double x);
-@@ -15315,19 +17384,18 @@ double __ovld __conv work_group_scan_exclusive_max(double x);
- double __ovld __conv work_group_scan_inclusive_add(double x);
- double __ovld __conv work_group_scan_inclusive_min(double x);
- double __ovld __conv work_group_scan_inclusive_max(double x);
--#endif //cl_khr_fp64
--
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-+#endif //__opencl_c_work_group_collective_functions
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- // OpenCL v2.0 s6.13.16 - Pipe Functions
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_pipes
- bool __ovld is_valid_reserve_id(reserve_id_t reserve_id);
--#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
--
-+#endif //__opencl_c_pipes
-
- // OpenCL v2.0 s6.13.17 - Enqueue Kernels
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
--
-+#ifdef __opencl_c_device_enqueue
- ndrange_t __ovld ndrange_1D(size_t);
- ndrange_t __ovld ndrange_1D(size_t, size_t);
- ndrange_t __ovld ndrange_1D(size_t, size_t, size_t);
-@@ -15355,11 +17423,13 @@ bool __ovld is_valid_event (clk_event_t event);
- void __ovld capture_event_profiling_info(clk_event_t, clk_profiling_info, __global void* value);
-
- queue_t __ovld get_default_queue(void);
-+#endif //__opencl_c_device_enqueue
- #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- // OpenCL Extension v2.0 s9.17 - Sub-groups
-
--#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups)
-+#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups) || \
-+ defined(__opencl_c_subgroups)
- // Shared Sub Group Functions
- uint __ovld get_sub_group_size(void);
- uint __ovld get_max_sub_group_size(void);
-@@ -15445,7 +17515,7 @@ half __ovld __conv sub_group_scan_inclusive_min(half x);
- half __ovld __conv sub_group_scan_inclusive_max(half x);
- #endif //cl_khr_fp16
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __conv sub_group_broadcast(double x, uint sub_group_local_id);
- double __ovld __conv sub_group_reduce_add(double x);
- double __ovld __conv sub_group_reduce_min(double x);
-@@ -15456,7 +17526,7 @@ double __ovld __conv sub_group_scan_exclusive_max(double x);
- double __ovld __conv sub_group_scan_inclusive_add(double x);
- double __ovld __conv sub_group_scan_inclusive_min(double x);
- double __ovld __conv sub_group_scan_inclusive_max(double x);
--#endif //cl_khr_fp64
-+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
-
- #endif //cl_khr_subgroups cl_intel_subgroups
-
-@@ -16226,16 +18296,22 @@ uint16 __ovld __conv intel_sub_group_shuffle_xor( uint16 x, uint c );
- long __ovld __conv intel_sub_group_shuffle_xor( long x, uint c );
- ulong __ovld __conv intel_sub_group_shuffle_xor( ulong x, uint c );
-
-+#ifdef __opencl_c_images
- uint __ovld __conv intel_sub_group_block_read( read_only image2d_t image, int2 coord );
- uint2 __ovld __conv intel_sub_group_block_read2( read_only image2d_t image, int2 coord );
- uint4 __ovld __conv intel_sub_group_block_read4( read_only image2d_t image, int2 coord );
- uint8 __ovld __conv intel_sub_group_block_read8( read_only image2d_t image, int2 coord );
-+#endif //__opencl_c_images
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_images
-+#ifdef __opencl_c_read_write_images
- uint __ovld __conv intel_sub_group_block_read(read_write image2d_t image, int2 coord);
- uint2 __ovld __conv intel_sub_group_block_read2(read_write image2d_t image, int2 coord);
- uint4 __ovld __conv intel_sub_group_block_read4(read_write image2d_t image, int2 coord);
- uint8 __ovld __conv intel_sub_group_block_read8(read_write image2d_t image, int2 coord);
-+#endif //__opencl_c_read_write_images
-+#endif //__opencl_c_images
- #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- uint __ovld __conv intel_sub_group_block_read( const __global uint* p );
-@@ -16243,16 +18319,22 @@ uint2 __ovld __conv intel_sub_group_block_read2( const __global uint* p );
- uint4 __ovld __conv intel_sub_group_block_read4( const __global uint* p );
- uint8 __ovld __conv intel_sub_group_block_read8( const __global uint* p );
-
-+#ifdef __opencl_c_images
- void __ovld __conv intel_sub_group_block_write(write_only image2d_t image, int2 coord, uint data);
- void __ovld __conv intel_sub_group_block_write2(write_only image2d_t image, int2 coord, uint2 data);
- void __ovld __conv intel_sub_group_block_write4(write_only image2d_t image, int2 coord, uint4 data);
- void __ovld __conv intel_sub_group_block_write8(write_only image2d_t image, int2 coord, uint8 data);
-+#endif //__opencl_c_images
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_images
-+#ifdef __opencl_c_read_write_images
- void __ovld __conv intel_sub_group_block_write(read_write image2d_t image, int2 coord, uint data);
- void __ovld __conv intel_sub_group_block_write2(read_write image2d_t image, int2 coord, uint2 data);
- void __ovld __conv intel_sub_group_block_write4(read_write image2d_t image, int2 coord, uint4 data);
- void __ovld __conv intel_sub_group_block_write8(read_write image2d_t image, int2 coord, uint8 data);
-+#endif // __opencl_c_read_write_images
-+#endif // __opencl_c_images
- #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- void __ovld __conv intel_sub_group_block_write( __global uint* p, uint data );
-@@ -16267,7 +18349,7 @@ half __ovld __conv intel_sub_group_shuffle_up( half prev, half cur, uint c );
- half __ovld __conv intel_sub_group_shuffle_xor( half x, uint c );
- #endif
-
--#if defined(cl_khr_fp64)
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- double __ovld __conv intel_sub_group_shuffle( double x, uint c );
- double __ovld __conv intel_sub_group_shuffle_down( double prev, double cur, uint c );
- double __ovld __conv intel_sub_group_shuffle_up( double prev, double cur, uint c );
-@@ -16366,16 +18448,22 @@ ushort __ovld __conv intel_sub_group_scan_inclusive_min( ushort x );
- short __ovld __conv intel_sub_group_scan_inclusive_max( short x );
- ushort __ovld __conv intel_sub_group_scan_inclusive_max( ushort x );
-
-+#ifdef __opencl_c_images
- uint __ovld __conv intel_sub_group_block_read_ui( read_only image2d_t image, int2 byte_coord );
- uint2 __ovld __conv intel_sub_group_block_read_ui2( read_only image2d_t image, int2 byte_coord );
- uint4 __ovld __conv intel_sub_group_block_read_ui4( read_only image2d_t image, int2 byte_coord );
- uint8 __ovld __conv intel_sub_group_block_read_ui8( read_only image2d_t image, int2 byte_coord );
-+#endif //__opencl_c_images
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_images
-+#ifdef __opencl_c_read_write_images
- uint __ovld __conv intel_sub_group_block_read_ui( read_write image2d_t image, int2 byte_coord );
- uint2 __ovld __conv intel_sub_group_block_read_ui2( read_write image2d_t image, int2 byte_coord );
- uint4 __ovld __conv intel_sub_group_block_read_ui4( read_write image2d_t image, int2 byte_coord );
- uint8 __ovld __conv intel_sub_group_block_read_ui8( read_write image2d_t image, int2 byte_coord );
-+#endif //__opencl_c_read_write_images
-+#endif //__opencl_c_images
- #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- uint __ovld __conv intel_sub_group_block_read_ui( const __global uint* p );
-@@ -16383,16 +18471,22 @@ uint2 __ovld __conv intel_sub_group_block_read_ui2( const __global uint* p
- uint4 __ovld __conv intel_sub_group_block_read_ui4( const __global uint* p );
- uint8 __ovld __conv intel_sub_group_block_read_ui8( const __global uint* p );
-
-+#ifdef __opencl_c_images
- void __ovld __conv intel_sub_group_block_write_ui( read_only image2d_t image, int2 byte_coord, uint data );
- void __ovld __conv intel_sub_group_block_write_ui2( read_only image2d_t image, int2 byte_coord, uint2 data );
- void __ovld __conv intel_sub_group_block_write_ui4( read_only image2d_t image, int2 byte_coord, uint4 data );
- void __ovld __conv intel_sub_group_block_write_ui8( read_only image2d_t image, int2 byte_coord, uint8 data );
-+#endif //__opencl_c_images
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_images
-+#ifdef __opencl_c_read_write_images
- void __ovld __conv intel_sub_group_block_write_ui( read_write image2d_t image, int2 byte_coord, uint data );
- void __ovld __conv intel_sub_group_block_write_ui2( read_write image2d_t image, int2 byte_coord, uint2 data );
- void __ovld __conv intel_sub_group_block_write_ui4( read_write image2d_t image, int2 byte_coord, uint4 data );
- void __ovld __conv intel_sub_group_block_write_ui8( read_write image2d_t image, int2 byte_coord, uint8 data );
-+#endif //__opencl_c_read_write_images
-+#endif //__opencl_c_images
- #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- void __ovld __conv intel_sub_group_block_write_ui( __global uint* p, uint data );
-@@ -16400,16 +18494,22 @@ void __ovld __conv intel_sub_group_block_write_ui2( __global uint* p, uint
- void __ovld __conv intel_sub_group_block_write_ui4( __global uint* p, uint4 data );
- void __ovld __conv intel_sub_group_block_write_ui8( __global uint* p, uint8 data );
-
-+#ifdef __opencl_c_images
- ushort __ovld __conv intel_sub_group_block_read_us( read_only image2d_t image, int2 coord );
- ushort2 __ovld __conv intel_sub_group_block_read_us2( read_only image2d_t image, int2 coord );
- ushort4 __ovld __conv intel_sub_group_block_read_us4( read_only image2d_t image, int2 coord );
- ushort8 __ovld __conv intel_sub_group_block_read_us8( read_only image2d_t image, int2 coord );
-+#endif //__opencl_c_images
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_images
-+#ifdef __opencl_c_read_write_images
- ushort __ovld __conv intel_sub_group_block_read_us(read_write image2d_t image, int2 coord);
- ushort2 __ovld __conv intel_sub_group_block_read_us2(read_write image2d_t image, int2 coord);
- ushort4 __ovld __conv intel_sub_group_block_read_us4(read_write image2d_t image, int2 coord);
- ushort8 __ovld __conv intel_sub_group_block_read_us8(read_write image2d_t image, int2 coord);
-+#endif //__opencl_c_read_write_images
-+#endif //__opencl_c_images
- #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- ushort __ovld __conv intel_sub_group_block_read_us( const __global ushort* p );
-@@ -16417,16 +18517,22 @@ ushort2 __ovld __conv intel_sub_group_block_read_us2( const __global ushort*
- ushort4 __ovld __conv intel_sub_group_block_read_us4( const __global ushort* p );
- ushort8 __ovld __conv intel_sub_group_block_read_us8( const __global ushort* p );
-
-+#ifdef __opencl_c_images
- void __ovld __conv intel_sub_group_block_write_us(write_only image2d_t image, int2 coord, ushort data);
- void __ovld __conv intel_sub_group_block_write_us2(write_only image2d_t image, int2 coord, ushort2 data);
- void __ovld __conv intel_sub_group_block_write_us4(write_only image2d_t image, int2 coord, ushort4 data);
- void __ovld __conv intel_sub_group_block_write_us8(write_only image2d_t image, int2 coord, ushort8 data);
-+#endif //__opencl_c_images
-
- #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#ifdef __opencl_c_images
-+#ifdef __opencl_c_read_write_images
- void __ovld __conv intel_sub_group_block_write_us(read_write image2d_t image, int2 coord, ushort data);
- void __ovld __conv intel_sub_group_block_write_us2(read_write image2d_t image, int2 coord, ushort2 data);
- void __ovld __conv intel_sub_group_block_write_us4(read_write image2d_t image, int2 coord, ushort4 data);
- void __ovld __conv intel_sub_group_block_write_us8(read_write image2d_t image, int2 coord, ushort8 data);
-+#endif //__opencl_c_read_write_images
-+#endif //__opencl_c_images
- #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-
- void __ovld __conv intel_sub_group_block_write_us( __global ushort* p, ushort data );
-@@ -16545,6 +18651,7 @@ short2 __ovld intel_sub_group_avc_ime_adjust_ref_offset(
- short2 ref_offset, ushort2 src_coord, ushort2 ref_window_size,
- ushort2 image_size);
-
-+#ifdef __opencl_c_images
- intel_sub_group_avc_ime_result_t __ovld
- intel_sub_group_avc_ime_evaluate_with_single_reference(
- read_only image2d_t src_image, read_only image2d_t ref_image,
-@@ -16585,6 +18692,7 @@ intel_sub_group_avc_ime_evaluate_with_dual_reference_streaminout(
- read_only image2d_t bwd_ref_image, sampler_t vme_media_sampler,
- intel_sub_group_avc_ime_payload_t payload,
- intel_sub_group_avc_ime_dual_reference_streamin_t streamin_components);
-+#endif //__opencl_c_images
-
- intel_sub_group_avc_ime_single_reference_streamin_t __ovld
- intel_sub_group_avc_ime_get_single_reference_streamin(
-@@ -16649,6 +18757,7 @@ intel_sub_group_avc_ref_payload_t __ovld
- intel_sub_group_avc_ref_set_bilinear_filter_enable(
- intel_sub_group_avc_ref_payload_t payload);
-
-+#ifdef __opencl_c_images
- intel_sub_group_avc_ref_result_t __ovld
- intel_sub_group_avc_ref_evaluate_with_single_reference(
- read_only image2d_t src_image, read_only image2d_t ref_image,
-@@ -16667,6 +18776,7 @@ intel_sub_group_avc_ref_evaluate_with_multi_reference(
- read_only image2d_t src_image, uint packed_reference_ids,
- uchar packed_reference_field_polarities, sampler_t vme_media_sampler,
- intel_sub_group_avc_ref_payload_t payload);
-+#endif //__opencl_c_images
-
- // SIC built-in functions
- intel_sub_group_avc_sic_payload_t __ovld
-@@ -16717,6 +18827,7 @@ intel_sub_group_avc_sic_set_block_based_raw_skip_sad(
- uchar block_based_skip_type,
- intel_sub_group_avc_sic_payload_t payload);
-
-+#ifdef __opencl_c_images
- intel_sub_group_avc_sic_result_t __ovld
- intel_sub_group_avc_sic_evaluate_ipe(
- read_only image2d_t src_image, sampler_t vme_media_sampler,
-@@ -16739,6 +18850,7 @@ intel_sub_group_avc_sic_evaluate_with_multi_reference(
- read_only image2d_t src_image, uint packed_reference_ids,
- uchar packed_reference_field_polarities, sampler_t vme_media_sampler,
- intel_sub_group_avc_sic_payload_t payload);
-+#endif //__opencl_c_images
-
- uchar __ovld intel_sub_group_avc_sic_get_ipe_luma_shape(
- intel_sub_group_avc_sic_result_t result);
-diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
-index c87d240a8206..8c8f03bba0f3 100644
---- a/clang/lib/Parse/ParseDecl.cpp
-+++ b/clang/lib/Parse/ParseDecl.cpp
-@@ -3799,8 +3799,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
- isInvalid = DS.SetTypeAltiVecBool(true, Loc, PrevSpec, DiagID, Policy);
- break;
- case tok::kw_pipe:
-- if (!getLangOpts().OpenCL || (getLangOpts().OpenCLVersion < 200 &&
-- !getLangOpts().OpenCLCPlusPlus)) {
-+ if (!getLangOpts().OpenCLPipeKeyword) {
- // OpenCL 2.0 defined this keyword. OpenCL 1.2 and earlier should
- // support the "pipe" word as identifier.
- Tok.getIdentifierInfo()->revertTokenIDToIdentifier();
-@@ -3922,8 +3921,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
- case tok::kw___generic:
- // generic address space is introduced only in OpenCL v2.0
- // see OpenCL C Spec v2.0 s6.5.5
-- if (Actions.getLangOpts().OpenCLVersion < 200 &&
-- !Actions.getLangOpts().OpenCLCPlusPlus) {
-+ if (!Actions.getLangOpts().OpenCLGenericKeyword) {
- DiagID = diag::err_opencl_unknown_type_specifier;
- PrevSpec = Tok.getIdentifierInfo()->getNameStart();
- isInvalid = true;
-@@ -4973,8 +4971,7 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) {
- default: return false;
-
- case tok::kw_pipe:
-- return (getLangOpts().OpenCL && getLangOpts().OpenCLVersion >= 200) ||
-- getLangOpts().OpenCLCPlusPlus;
-+ return getLangOpts().OpenCLPipeKeyword;
-
- case tok::identifier: // foo::bar
- // Unfortunate hack to support "Class.factoryMethod" notation.
-@@ -5499,8 +5496,7 @@ static bool isPtrOperatorToken(tok::TokenKind Kind, const LangOptions &Lang,
- if (Kind == tok::star || Kind == tok::caret)
- return true;
-
-- if (Kind == tok::kw_pipe &&
-- ((Lang.OpenCL && Lang.OpenCLVersion >= 200) || Lang.OpenCLCPlusPlus))
-+ if (Kind == tok::kw_pipe && Lang.OpenCLPipeKeyword)
- return true;
-
- if (!Lang.CPlusPlus)
-diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp
-index 6402b31d00b2..65f283ad556b 100644
---- a/clang/lib/Parse/ParsePragma.cpp
-+++ b/clang/lib/Parse/ParsePragma.cpp
-@@ -749,12 +749,14 @@ void Parser::HandlePragmaOpenCLExtension() {
- if (Name == "all") {
- if (State == Disable) {
- Opt.disableAll();
-- Opt.enableSupportedCore(getLangOpts());
-+ Opt.enableSupportedCore();
- } else {
- PP.Diag(NameLoc, diag::warn_pragma_expected_predicate) << 1;
- }
-+ } else if (Opt.isFeature(Name)) {
-+ PP.Diag(NameLoc, diag::warn_opencl_pragma_feature_ignore) << Ident;
- } else if (State == Begin) {
-- if (!Opt.isKnown(Name) || !Opt.isSupported(Name, getLangOpts())) {
-+ if (!Opt.isKnown(Name) || !Opt.isSupported(Name)) {
- Opt.support(Name);
- }
- Actions.setCurrentOpenCLExtension(Name);
-@@ -764,9 +766,9 @@ void Parser::HandlePragmaOpenCLExtension() {
- Actions.setCurrentOpenCLExtension("");
- } else if (!Opt.isKnown(Name))
- PP.Diag(NameLoc, diag::warn_pragma_unknown_extension) << Ident;
-- else if (Opt.isSupportedExtension(Name, getLangOpts()))
-+ else if (Opt.isSupportedExtension(Name))
- Opt.enable(Name, State == Enable);
-- else if (Opt.isSupportedCore(Name, getLangOpts()))
-+ else if (Opt.isSupportedCore(Name))
- PP.Diag(NameLoc, diag::warn_pragma_extension_is_core) << Ident;
- else
- PP.Diag(NameLoc, diag::warn_pragma_unsupported_extension) << Ident;
-diff --git a/clang/lib/Sema/OpenCLBuiltins.td b/clang/lib/Sema/OpenCLBuiltins.td
-index 745363a6b43f..6a1fce567090 100644
---- a/clang/lib/Sema/OpenCLBuiltins.td
-+++ b/clang/lib/Sema/OpenCLBuiltins.td
-@@ -22,11 +22,13 @@
- class Version<int _Version> {
- int ID = _Version;
- }
-+
- def CLAll : Version< 0>;
- def CL10 : Version<100>;
- def CL11 : Version<110>;
- def CL12 : Version<120>;
- def CL20 : Version<200>;
-+def CL30 : Version<300>;
-
- // Address spaces
- // Pointer types need to be assigned an address space.
-@@ -72,6 +74,14 @@ def ArmIntegerDotProductAccumulateInt8 : FunctionExtension<"cl_arm_integ
- def ArmIntegerDotProductAccumulateInt16 : FunctionExtension<"cl_arm_integer_dot_product_accumulate_int16">;
- def ArmIntegerDotProductAccumulateSaturateInt8 : FunctionExtension<"cl_arm_integer_dot_product_accumulate_saturate_int8">;
-
-+// Features
-+def FuncExtGenericAddressSpace : FunctionExtension<"__opencl_c_generic_address_space">;
-+def FuncExtWorkGroupCollective : FunctionExtension<"__opencl_c_work_group_collective_functions">;
-+def FuncExtPipes : FunctionExtension<"__opencl_c_pipes">;
-+def FuncExtDeviceSidEenqueue : FunctionExtension<"__opencl_c_device_enqueue">;
-+def FuncNonExplicitAtomicFeatures : FunctionExtension<"__opencl_c_atomic_order_seq_cst __opencl_c_atomic_scope_device">;
-+def FuncNonExplicitAtomicFeaturesAndGenericAS : FunctionExtension<"__opencl_c_atomic_order_seq_cst __opencl_c_atomic_scope_device __opencl_c_generic_address_space">;
-+
- // Qualified Type. These map to ASTContext::QualType.
- class QualType<string _Name, bit _IsAbstract=0> {
- // Name of the field or function in a clang::ASTContext
-@@ -236,13 +246,9 @@ class Builtin<string _Name, list<Type> _Signature, list<bit> _Attributes = Attr.
- bit IsConv = _Attributes[2];
- // OpenCL extensions to which the function belongs.
- FunctionExtension Extension = FuncExtNone;
-- // Version of OpenCL from which the function is available (e.g.: CL10).
-- // MinVersion is inclusive.
-- Version MinVersion = CL10;
-- // Version of OpenCL from which the function is not supported anymore.
-- // MaxVersion is exclusive.
-+ // List of OpenCL version in which this function available.
- // CLAll makes the function available for all versions.
-- Version MaxVersion = CLAll;
-+ list<Version> Versions = [CLAll];
- }
-
- //===----------------------------------------------------------------------===//
-@@ -421,7 +427,7 @@ foreach name = ["get_global_size", "get_global_id", "get_local_size",
- def : Builtin<name, [Size, UInt], Attr.Const>;
- }
-
--let MinVersion = CL20 in {
-+let Versions = [CL20, CL30] in {
- def : Builtin<"get_enqueued_local_size", [Size, UInt]>;
- foreach name = ["get_global_linear_id", "get_local_linear_id"] in {
- def : Builtin<name, [Size]>;
-@@ -494,7 +500,7 @@ foreach name = ["fma", "mad"] in {
- }
-
- // --- Version dependent ---
--let MaxVersion = CL20 in {
-+let Versions = [CL10, CL11, CL12, CL30] in {
- foreach AS = [GlobalAS, LocalAS, PrivateAS] in {
- foreach name = ["fract", "modf", "sincos"] in {
- def : Builtin<name, [FGenTypeN, FGenTypeN, PointerType<FGenTypeN, AS>]>;
-@@ -511,7 +517,9 @@ let MaxVersion = CL20 in {
- }
- }
- }
--let MinVersion = CL20 in {
-+
-+let Versions = [CL20, CL30] in {
-+ let Extension = FuncExtGenericAddressSpace in {
- foreach name = ["fract", "modf", "sincos"] in {
- def : Builtin<name, [FGenTypeN, FGenTypeN, PointerType<FGenTypeN, GenericAS>]>;
- }
-@@ -524,6 +532,7 @@ let MinVersion = CL20 in {
- def : Builtin<name, [Type, Type, Type, PointerType<GenTypeIntVecAndScalar, GenericAS>]>;
- }
- }
-+ }
- }
-
- // --- Table 9 ---
-@@ -554,7 +563,7 @@ foreach name = ["abs"] in {
- foreach name = ["clz", "popcount"] in {
- def : Builtin<name, [AIGenTypeN, AIGenTypeN], Attr.Const>;
- }
--let MinVersion = CL20 in {
-+let Versions = [CL20, CL30] in {
- foreach name = ["ctz"] in {
- def : Builtin<name, [AIGenTypeN, AIGenTypeN]>;
- }
-@@ -728,7 +737,7 @@ foreach name = ["select"] in {
- // --- Table 15 ---
- // Variants for OpenCL versions below 2.0, using pointers to the global, local
- // and private address spaces.
--let MaxVersion = CL20 in {
-+let Versions = [CL10, CL11, CL12, CL30] in {
- foreach AS = [GlobalAS, LocalAS, PrivateAS] in {
- foreach VSize = [2, 3, 4, 8, 16] in {
- foreach name = ["vload" # VSize] in {
-@@ -771,7 +780,8 @@ let MaxVersion = CL20 in {
- }
- // Variants for OpenCL versions above 2.0, using pointers to the generic
- // address space.
--let MinVersion = CL20 in {
-+let Versions = [CL20, CL30] in {
-+ let Extension = FuncExtGenericAddressSpace in {
- foreach VSize = [2, 3, 4, 8, 16] in {
- foreach name = ["vload" # VSize] in {
- def : Builtin<name, [VectorType<Char, VSize>, Size, PointerType<ConstType<Char>, GenericAS>]>;
-@@ -809,6 +819,7 @@ let MinVersion = CL20 in {
- }
- }
- }
-+ }
- }
- // Variants using pointers to the constant address space.
- foreach VSize = [2, 3, 4, 8, 16] in {
-@@ -829,7 +840,7 @@ foreach VSize = [2, 3, 4, 8, 16] in {
- def : Builtin<name, [VectorType<Float, VSize>, Size, PointerType<ConstType<Half>, ConstantAS>]>;
- }
- }
--let MaxVersion = CL20 in {
-+let Versions = [CL10, CL11, CL12, CL30] in {
- foreach AS = [GlobalAS, LocalAS, PrivateAS] in {
- def : Builtin<"vload_half", [Float, Size, PointerType<ConstType<Half>, AS>]>;
- def : Builtin<"vloada_half", [Float, Size, PointerType<ConstType<Half>, AS>]>;
-@@ -852,7 +863,8 @@ let MaxVersion = CL20 in {
- }
- }
- }
--let MinVersion = CL20 in {
-+let Versions = [CL20, CL30] in {
-+ let Extension = FuncExtGenericAddressSpace in {
- foreach AS = [GenericAS] in {
- def : Builtin<"vload_half", [Float, Size, PointerType<ConstType<Half>, AS>]>;
- def : Builtin<"vloada_half", [Float, Size, PointerType<ConstType<Half>, AS>]>;
-@@ -874,6 +886,7 @@ let MinVersion = CL20 in {
- }
- }
- }
-+ }
- }
-
- foreach AS = [ConstantAS] in {
-@@ -899,7 +912,9 @@ foreach name = ["async_work_group_strided_copy"] in {
- def : Builtin<name, [Event, PointerType<AGenTypeN, GlobalAS>, PointerType<ConstType<AGenTypeN>, LocalAS>, Size, Size, Event]>;
- }
- foreach name = ["wait_group_events"] in {
-+ let Extension = FuncExtGenericAddressSpace in {
- def : Builtin<name, [Void, Int, PointerType<Event, GenericAS>]>;
-+ }
- }
- foreach name = ["prefetch"] in {
- def : Builtin<name, [Void, PointerType<ConstType<AGenTypeN>, GlobalAS>, Size]>;
-@@ -1000,13 +1015,25 @@ foreach AS = [GlobalAS, LocalAS] in {
- }
- }
- }
-+
- // OpenCL v2.0 s6.13.11 - Atomic Functions.
--let MinVersion = CL20 in {
-+
-+let Versions = [CL20, CL30] in {
-+ let Extension = FuncExtGenericAddressSpace in {
-+ foreach TypePair = [[AtomicInt, Int], [AtomicUInt, UInt],
-+ [AtomicLong, Long], [AtomicULong, ULong],
-+ [AtomicFloat, Float], [AtomicDouble, Double]] in {
-+ def : Builtin<"atomic_init",
-+ [Void, PointerType<VolatileType<TypePair[0]>, GenericAS>, TypePair[1]]>;
-+ }
-+ }
-+}
-+
-+let Versions = [CL20, CL30] in {
-+ let Extension = FuncNonExplicitAtomicFeaturesAndGenericAS in {
- foreach TypePair = [[AtomicInt, Int], [AtomicUInt, UInt],
- [AtomicLong, Long], [AtomicULong, ULong],
- [AtomicFloat, Float], [AtomicDouble, Double]] in {
-- def : Builtin<"atomic_init",
-- [Void, PointerType<VolatileType<TypePair[0]>, GenericAS>, TypePair[1]]>;
- def : Builtin<"atomic_store",
- [Void, PointerType<VolatileType<TypePair[0]>, GenericAS>, TypePair[1]]>;
- def : Builtin<"atomic_load",
-@@ -1038,6 +1065,59 @@ let MinVersion = CL20 in {
- [TypePair[1], PointerType<VolatileType<TypePair[0]>, GenericAS>, TypePair[2]]>;
- }
- }
-+ }
-+}
-+
-+let Versions = [CL30] in {
-+ foreach AS = [GlobalAS, LocalAS] in {
-+ foreach TypePair = [[AtomicInt, Int], [AtomicUInt, UInt],
-+ [AtomicLong, Long], [AtomicULong, ULong],
-+ [AtomicFloat, Float], [AtomicDouble, Double]] in {
-+ def : Builtin<"atomic_init",
-+ [Void, PointerType<VolatileType<TypePair[0]>, AS>, TypePair[1]]>;
-+ }
-+ }
-+}
-+
-+let Versions = [CL30] in {
-+ let Extension = FuncNonExplicitAtomicFeatures in {
-+ foreach AS = [GlobalAS, LocalAS] in {
-+ foreach TypePair = [[AtomicInt, Int], [AtomicUInt, UInt],
-+ [AtomicLong, Long], [AtomicULong, ULong],
-+ [AtomicFloat, Float], [AtomicDouble, Double]] in {
-+ def : Builtin<"atomic_store",
-+ [Void, PointerType<VolatileType<TypePair[0]>, AS>, TypePair[1]]>;
-+ def : Builtin<"atomic_load",
-+ [TypePair[1], PointerType<VolatileType<TypePair[0]>, AS>]>;
-+ def : Builtin<"atomic_exchange",
-+ [TypePair[1], PointerType<VolatileType<TypePair[0]>, AS>, TypePair[1]]>;
-+ foreach Variant = ["weak", "strong"] in {
-+ def : Builtin<"atomic_compare_exchange_" # Variant,
-+ [Bool, PointerType<VolatileType<TypePair[0]>, AS>,
-+ PointerType<TypePair[1], AS>, TypePair[1]]>;
-+ }
-+ }
-+
-+ foreach TypePair = [[AtomicInt, Int, Int], [AtomicUInt, UInt, UInt],
-+ [AtomicLong, Long, Long], [AtomicULong, ULong, ULong],
-+ [AtomicIntPtr, IntPtr, PtrDiff],
-+ [AtomicUIntPtr, UIntPtr, PtrDiff]] in {
-+ foreach ModOp = ["add", "sub"] in {
-+ def : Builtin<"atomic_fetch_" # ModOp,
-+ [TypePair[1], PointerType<VolatileType<TypePair[0]>, AS>, TypePair[2]]>;
-+ }
-+ }
-+ foreach TypePair = [[AtomicInt, Int, Int], [AtomicUInt, UInt, UInt],
-+ [AtomicLong, Long, Long], [AtomicULong, ULong, ULong],
-+ [AtomicIntPtr, IntPtr, IntPtr],
-+ [AtomicUIntPtr, UIntPtr, UIntPtr]] in {
-+ foreach ModOp = ["or", "xor", "and", "min", "max"] in {
-+ def : Builtin<"atomic_fetch_" # ModOp,
-+ [TypePair[1], PointerType<VolatileType<TypePair[0]>, AS>, TypePair[2]]>;
-+ }
-+ }
-+ }
-+ }
- }
-
- //--------------------------------------------------------------------
-@@ -1217,7 +1297,8 @@ foreach aQual = ["WO", "RW"] in {
- //--------------------------------------------------------------------
- // OpenCL v2.0 s6.13.15 - Work-group Functions
- // --- Table 26 ---
--let MinVersion = CL20 in {
-+let Versions = [CL20, CL30] in {
-+ let Extension = FuncExtWorkGroupCollective in {
- foreach name = ["work_group_all", "work_group_any"] in {
- def : Builtin<name, [Int, Int], Attr.Convergent>;
- }
-@@ -1232,6 +1313,7 @@ let MinVersion = CL20 in {
- def : Builtin<name # op, [IntLongFloatGenType1, IntLongFloatGenType1], Attr.Convergent>;
- }
- }
-+ }
- }
-
-
-@@ -1241,8 +1323,10 @@ let MinVersion = CL20 in {
- // Defined in Builtins.def
-
- // --- Table 28 ---
--// Builtins taking pipe arguments are defined in Builtins.def
--def : Builtin<"is_valid_reserve_id", [Bool, ReserveId]>;
-+let Extension = FuncExtPipes in {
-+ // Builtins taking pipe arguments are defined in Builtins.def
-+ def : Builtin<"is_valid_reserve_id", [Bool, ReserveId]>;
-+}
-
- // --- Table 29 ---
- // Defined in Builtins.def
-@@ -1257,21 +1341,22 @@ def : Builtin<"is_valid_reserve_id", [Bool, ReserveId]>;
- // Defined in Builtins.def
-
- // --- Table 33 ---
--def : Builtin<"enqueue_marker",
-- [Int, Queue, UInt, PointerType<ConstType<ClkEvent>, GenericAS>, PointerType<ClkEvent, GenericAS>]>;
-+let Extension = FuncExtDeviceSidEenqueue in {
-+ def : Builtin<"enqueue_marker",
-+ [Int, Queue, UInt, PointerType<ConstType<ClkEvent>, GenericAS>, PointerType<ClkEvent, GenericAS>]>;
-
--// --- Table 34 ---
--def : Builtin<"retain_event", [Void, ClkEvent]>;
--def : Builtin<"release_event", [Void, ClkEvent]>;
--def : Builtin<"create_user_event", [ClkEvent]>;
--def : Builtin<"is_valid_event", [Bool, ClkEvent]>;
--def : Builtin<"set_user_event_status", [Void, ClkEvent, Int]>;
--// TODO: capture_event_profiling_info
--
--// --- Table 35 ---
--def : Builtin<"get_default_queue", [Queue]>;
--// TODO: ndrange functions
-+ // --- Table 34 ---
-+ def : Builtin<"retain_event", [Void, ClkEvent]>;
-+ def : Builtin<"release_event", [Void, ClkEvent]>;
-+ def : Builtin<"create_user_event", [ClkEvent]>;
-+ def : Builtin<"is_valid_event", [Bool, ClkEvent]>;
-+ def : Builtin<"set_user_event_status", [Void, ClkEvent, Int]>;
-+ // TODO: capture_event_profiling_info
-
-+ // --- Table 35 ---
-+ def : Builtin<"get_default_queue", [Queue]>;
-+ // TODO: ndrange functions
-+}
-
- //--------------------------------------------------------------------
- // End of the builtin functions defined in the OpenCL C specification.
-@@ -1456,7 +1541,7 @@ let Extension = FuncExtKhrSubgroups in {
- "get_sub_group_local_id"] in {
- def : Builtin<name, [UInt]>;
- }
-- let MinVersion = CL20 in {
-+ let Versions = [CL20] in {
- foreach name = ["get_enqueued_num_sub_groups"] in {
- def : Builtin<name, [UInt]>;
- }
-diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
-index 2f2b52106f3d..5092a4691b9b 100644
---- a/clang/lib/Sema/Sema.cpp
-+++ b/clang/lib/Sema/Sema.cpp
-@@ -291,9 +291,10 @@ void Sema::Initialize() {
- // Initialize predefined OpenCL types and supported extensions and (optional)
- // core features.
- if (getLangOpts().OpenCL) {
-+ getOpenCLOptions().setOpenCLVersion(getLangOpts());
- getOpenCLOptions().addSupport(
- Context.getTargetInfo().getSupportedOpenCLOpts());
-- getOpenCLOptions().enableSupportedCore(getLangOpts());
-+ getOpenCLOptions().enableSupportedCore();
- addImplicitTypedef("sampler_t", Context.OCLSamplerTy);
- addImplicitTypedef("event_t", Context.OCLEventTy);
- if (getLangOpts().OpenCLCPlusPlus || getLangOpts().OpenCLVersion >= 200) {
-@@ -349,12 +350,18 @@ void Sema::Initialize() {
- "cl_khr_int64_base_atomics cl_khr_int64_extended_atomics");
-
- setOpenCLExtensionForType(AtomicDoubleT, "cl_khr_fp64");
-+ setOpenCLExtensionForType(Context.OCLReserveIDTy, "__opencl_c_pipes");
-+ setOpenCLExtensionForType(Context.OCLClkEventTy,
-+ "__opencl_c_device_enqueue");
-+ setOpenCLExtensionForType(Context.OCLQueueTy,
-+ "__opencl_c_device_enqueue");
- }
-
- setOpenCLExtensionForType(Context.DoubleTy, "cl_khr_fp64");
-
--#define GENERIC_IMAGE_TYPE_EXT(Type, Id, Ext) \
-- setOpenCLExtensionForType(Context.Id, Ext);
-+#define GENERIC_IMAGE_TYPE_EXT(Type, Id, Ext) \
-+ setOpenCLExtensionForType(Context.Id, Ext); \
-+ setOpenCLExtensionForType(Context.Id, "__opencl_c_images");
- #include "clang/Basic/OpenCLImageTypes.def"
- #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
- addImplicitTypedef(#ExtType, Context.Id##Ty); \
-@@ -2423,6 +2430,27 @@ bool Sema::isOpenCLDisabledDecl(Decl *FD) {
- return false;
- }
-
-+template <typename DiagLocT, typename DiagInfoT>
-+void Sema::DiagnoseOpenCLRequiresOption(llvm::StringRef OpenCLOptName,
-+ DiagLocT DiagLoc, DiagInfoT DiagInfo,
-+ unsigned Selector,
-+ SourceRange SrcRange) {
-+ const auto &LO = getLangOpts();
-+ auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
-+ // For versions higher that 3.0 diagnosing feature
-+ if (CLVer >= 300) {
-+ OpenCLOptName =
-+ llvm::StringSwitch<llvm::StringRef>(OpenCLOptName)
-+ .Case("cl_khr_3d_image_writes", "__opencl_c_3d_image_writes")
-+ .Case("cl_khr_subgroups", "__opencl_c_subgroups")
-+ .Case("cl_khr_fp64", "__opencl_c_fp64")
-+ .Default(OpenCLOptName);
-+ }
-+
-+ Diag(DiagLoc, diag::err_opencl_requires_extension)
-+ << Selector << DiagInfo << OpenCLOptName << SrcRange;
-+}
-+
- template <typename T, typename DiagLocT, typename DiagInfoT, typename MapT>
- bool Sema::checkOpenCLDisabledTypeOrDecl(T D, DiagLocT DiagLoc,
- DiagInfoT DiagInfo, MapT &Map,
-@@ -2434,8 +2462,7 @@ bool Sema::checkOpenCLDisabledTypeOrDecl(T D, DiagLocT DiagLoc,
- bool Disabled = false;
- for (auto &I : Loc->second) {
- if (I != CurrOpenCLExtension && !getOpenCLOptions().isEnabled(I)) {
-- Diag(DiagLoc, diag::err_opencl_requires_extension) << Selector << DiagInfo
-- << I << SrcRange;
-+ DiagnoseOpenCLRequiresOption(I, DiagLoc, DiagInfo, Selector, SrcRange);
- Disabled = true;
- }
- }
-@@ -2471,3 +2498,13 @@ bool Sema::checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E) {
- return checkOpenCLDisabledTypeOrDecl(&D, E.getBeginLoc(), FnName,
- OpenCLDeclExtMap, 1, D.getSourceRange());
- }
-+
-+bool Sema::checkOpenCLSubgroupExtForCallExpr(CallExpr *Call) {
-+ if (!getOpenCLOptions().isEnabled("cl_khr_subgroups")) {
-+ DiagnoseOpenCLRequiresOption("cl_khr_subgroups", Call->getBeginLoc(),
-+ Call->getDirectCallee(), 1,
-+ Call->getSourceRange());
-+ return true;
-+ }
-+ return false;
-+}
-diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
-index 1bf04d9cb4f2..9dd63db0f420 100644
---- a/clang/lib/Sema/SemaChecking.cpp
-+++ b/clang/lib/Sema/SemaChecking.cpp
-@@ -835,20 +835,11 @@ static bool checkOpenCLBlockArgs(Sema &S, Expr *BlockArg) {
- return IllegalParams;
- }
-
--static bool checkOpenCLSubgroupExt(Sema &S, CallExpr *Call) {
-- if (!S.getOpenCLOptions().isEnabled("cl_khr_subgroups")) {
-- S.Diag(Call->getBeginLoc(), diag::err_opencl_requires_extension)
-- << 1 << Call->getDirectCallee() << "cl_khr_subgroups";
-- return true;
-- }
-- return false;
--}
--
- static bool SemaOpenCLBuiltinNDRangeAndBlock(Sema &S, CallExpr *TheCall) {
- if (checkArgCount(S, TheCall, 2))
- return true;
-
-- if (checkOpenCLSubgroupExt(S, TheCall))
-+ if (S.checkOpenCLSubgroupExtForCallExpr(TheCall))
- return true;
-
- // First argument is an ndrange_t type.
-@@ -1883,7 +1874,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
- break;
- case Builtin::BIsub_group_reserve_read_pipe:
- case Builtin::BIsub_group_reserve_write_pipe:
-- if (checkOpenCLSubgroupExt(*this, TheCall) ||
-+ if (checkOpenCLSubgroupExtForCallExpr(TheCall) ||
- SemaBuiltinReserveRWPipe(*this, TheCall))
- return ExprError();
- break;
-@@ -1896,7 +1887,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
- break;
- case Builtin::BIsub_group_commit_read_pipe:
- case Builtin::BIsub_group_commit_write_pipe:
-- if (checkOpenCLSubgroupExt(*this, TheCall) ||
-+ if (checkOpenCLSubgroupExtForCallExpr(TheCall) ||
- SemaBuiltinCommitRWPipe(*this, TheCall))
- return ExprError();
- break;
-@@ -4149,6 +4140,20 @@ DiagnoseCStringFormatDirectiveInCFAPI(Sema &S,
- }
- }
-
-+bool Sema::isSupportedOpenCLOMemoryOrdering(int64_t Ordering) const {
-+ assert(llvm::isValidAtomicOrderingCABI(Ordering));
-+ auto OrderingCABI = (llvm::AtomicOrderingCABI)Ordering;
-+ switch (OrderingCABI) {
-+ case llvm::AtomicOrderingCABI::acquire:
-+ case llvm::AtomicOrderingCABI::release:
-+ case llvm::AtomicOrderingCABI::acq_rel:
-+ return OpenCLFeatures.isEnabled("__opencl_c_atomic_order_acq_rel");
-+
-+ default:
-+ return true;
-+ }
-+}
-+
- /// Determine whether the given type has a non-null nullability annotation.
- static bool isNonNullType(ASTContext &ctx, QualType type) {
- if (auto nullability = type->getNullability(ctx))
-@@ -4920,10 +4925,17 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
- if (SubExprs.size() >= 2 && Form != Init) {
- llvm::APSInt Result(32);
- if (SubExprs[1]->isIntegerConstantExpr(Result, Context) &&
-- !isValidOrderingForOp(Result.getSExtValue(), Op))
-+ !isValidOrderingForOp(Result.getSExtValue(), Op)) {
- Diag(SubExprs[1]->getBeginLoc(),
- diag::warn_atomic_op_has_invalid_memory_order)
- << SubExprs[1]->getSourceRange();
-+ } else if (IsOpenCL &&
-+ !isSupportedOpenCLOMemoryOrdering(Result.getSExtValue())) {
-+ Diag(SubExprs[1]->getBeginLoc(),
-+ diag::err_opencl_memory_ordering_require_feat)
-+ << SubExprs[1]->getSourceRange();
-+ return ExprError();
-+ }
- }
-
- if (auto ScopeModel = AtomicExpr::getScopeModel(Op)) {
-diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
-index 5b0417fa8859..2dee60763d57 100644
---- a/clang/lib/Sema/SemaDecl.cpp
-+++ b/clang/lib/Sema/SemaDecl.cpp
-@@ -6290,7 +6290,9 @@ void Sema::deduceOpenCLAddressSpace(ValueDecl *Decl) {
- if (Type->isSamplerT() || Type->isVoidType())
- return;
- LangAS ImplAS = LangAS::opencl_private;
-- if ((getLangOpts().OpenCLCPlusPlus || getLangOpts().OpenCLVersion >= 200) &&
-+ if ((getLangOpts().OpenCLCPlusPlus ||
-+ getOpenCLOptions().isEnabled(
-+ "__opencl_c_program_scope_global_variables")) &&
- Var->hasGlobalStorage())
- ImplAS = LangAS::opencl_global;
- // If the original type from a decayed type is an array type and that array
-@@ -7849,18 +7851,22 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {
- // OpenCL C v2.0 s6.5.1 - Variables defined at program scope and static
- // variables inside a function can also be declared in the global
- // address space.
-+ // OpenCL C v3.0 s5.5 - For OpenCL C 2.0, or with the
-+ // __opencl_c_program_scope_global_variables feature macro, the
-+ // address space for a variable at program scope or a static variable
-+ // also be __global
- // C++ for OpenCL inherits rule from OpenCL C v2.0.
- // FIXME: Adding local AS in C++ for OpenCL might make sense.
- if (NewVD->isFileVarDecl() || NewVD->isStaticLocal() ||
- NewVD->hasExternalStorage()) {
-- if (!T->isSamplerT() &&
-- !T->isDependentType() &&
-+ if (!T->isSamplerT() && !T->isDependentType() &&
- !(T.getAddressSpace() == LangAS::opencl_constant ||
- (T.getAddressSpace() == LangAS::opencl_global &&
-- (getLangOpts().OpenCLVersion == 200 ||
-- getLangOpts().OpenCLCPlusPlus)))) {
-+ (OpenCLFeatures.isEnabled(
-+ "__opencl_c_program_scope_global_variables"))))) {
- int Scope = NewVD->isStaticLocal() | NewVD->hasExternalStorage() << 1;
-- if (getLangOpts().OpenCLVersion == 200 || getLangOpts().OpenCLCPlusPlus)
-+ if (OpenCLFeatures.isEnabled(
-+ "__opencl_c_program_scope_global_variables"))
- Diag(NewVD->getLocation(), diag::err_opencl_global_invalid_addr_space)
- << Scope << "global or constant";
- else
-diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
-index a9a2a19b4797..73b35eae176a 100644
---- a/clang/lib/Sema/SemaDeclAttr.cpp
-+++ b/clang/lib/Sema/SemaDeclAttr.cpp
-@@ -6488,7 +6488,7 @@ static void handleInternalLinkageAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
- }
-
- static void handleOpenCLNoSVMAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
-- if (S.LangOpts.OpenCLVersion != 200)
-+ if (S.LangOpts.OpenCLVersion < 200)
- S.Diag(AL.getLoc(), diag::err_attribute_requires_opencl_version)
- << AL << "2.0" << 0;
- else
-@@ -6572,6 +6572,13 @@ static void handleOpenCLAccessAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
- << AL << PDecl->getType() << DeclTy->isImageType();
- D->setInvalidDecl(true);
- return;
-+ } else if ((!S.getLangOpts().OpenCLCPlusPlus &&
-+ S.getLangOpts().OpenCLVersion >= 200) &&
-+ !S.getOpenCLOptions().isEnabled(
-+ "__opencl_c_read_write_images")) {
-+ S.Diag(AL.getLoc(), diag::err_opencl_requires_extension)
-+ << 0 << PDecl->getType() << "__opencl_c_read_write_images";
-+ return;
- }
- }
- }
-diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
-index 22bf35dbd0cb..b2081bb6b407 100644
---- a/clang/lib/Sema/SemaDeclCXX.cpp
-+++ b/clang/lib/Sema/SemaDeclCXX.cpp
-@@ -38,9 +38,9 @@
- #include "clang/Sema/ScopeInfo.h"
- #include "clang/Sema/SemaInternal.h"
- #include "clang/Sema/Template.h"
-+#include "llvm/ADT/STLExtras.h"
- #include "llvm/ADT/ScopeExit.h"
- #include "llvm/ADT/SmallString.h"
--#include "llvm/ADT/STLExtras.h"
- #include "llvm/ADT/StringExtras.h"
- #include <map>
- #include <set>
-@@ -15228,6 +15228,11 @@ CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl,
- if (auto *PtrTy = ResultType->getAs<PointerType>()) {
- ResultType = RemoveAddressSpaceFromPtr(SemaRef, PtrTy);
- }
-+ if (CanQual<PointerType> ExpectedPtrTy =
-+ ExpectedResultType->getAs<PointerType>()) {
-+ ExpectedResultType = SemaRef.Context.getCanonicalType(
-+ RemoveAddressSpaceFromPtr(SemaRef, ExpectedPtrTy->getTypePtr()));
-+ }
- }
-
- // Check that the result type is what we expect.
-@@ -15261,6 +15266,11 @@ CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl,
- FnDecl->getParamDecl(0)->getType()->getAs<PointerType>()) {
- FirstParamType = RemoveAddressSpaceFromPtr(SemaRef, PtrTy);
- }
-+ if (CanQual<PointerType> ExpectedPtrTy =
-+ ExpectedFirstParamType->getAs<PointerType>()) {
-+ ExpectedFirstParamType = SemaRef.Context.getCanonicalType(
-+ RemoveAddressSpaceFromPtr(SemaRef, ExpectedPtrTy->getTypePtr()));
-+ }
- }
-
- // Check that the first parameter type is what we expect.
-diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
-index bcbecd545398..40eaebbc9495 100644
---- a/clang/lib/Sema/SemaLookup.cpp
-+++ b/clang/lib/Sema/SemaLookup.cpp
-@@ -775,19 +775,20 @@ static void InsertOCLBuiltinDeclarationsFromTable(Sema &S, LookupResult &LR,
- // as argument. Only meaningful for generic types, otherwise equals 1.
- unsigned GenTypeMaxCnt;
-
-+ ASTContext &Context = S.Context;
-+
-+ // Ignore this BIF if its version does not match the language options.
-+ unsigned OpenCLVersion = Context.getLangOpts().OpenCLVersion;
-+ if (Context.getLangOpts().OpenCLCPlusPlus)
-+ OpenCLVersion = 200;
-+
-+ unsigned short VersionCode = OpenCLOptions::EncodeVersion(OpenCLVersion);
-+
- for (unsigned SignatureIndex = 0; SignatureIndex < Len; SignatureIndex++) {
- const OpenCLBuiltinStruct &OpenCLBuiltin =
- BuiltinTable[FctIndex + SignatureIndex];
-- ASTContext &Context = S.Context;
-
-- // Ignore this BIF if its version does not match the language options.
-- unsigned OpenCLVersion = Context.getLangOpts().OpenCLVersion;
-- if (Context.getLangOpts().OpenCLCPlusPlus)
-- OpenCLVersion = 200;
-- if (OpenCLVersion < OpenCLBuiltin.MinVersion)
-- continue;
-- if ((OpenCLBuiltin.MaxVersion != 0) &&
-- (OpenCLVersion >= OpenCLBuiltin.MaxVersion))
-+ if (!(OpenCLBuiltin.AllVersions & VersionCode))
- continue;
-
- SmallVector<QualType, 1> RetTypes;
-diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
-index cc151a048b98..f380a5656a57 100644
---- a/clang/lib/Sema/SemaType.cpp
-+++ b/clang/lib/Sema/SemaType.cpp
-@@ -2042,7 +2042,7 @@ static QualType deduceOpenCLPointeeAddrSpace(Sema &S, QualType PointeeType) {
- !PointeeType.hasAddressSpace())
- PointeeType = S.getASTContext().getAddrSpaceQualType(
- PointeeType,
-- S.getLangOpts().OpenCLCPlusPlus || S.getLangOpts().OpenCLVersion == 200
-+ S.getOpenCLOptions().isEnabled("__opencl_c_generic_address_space")
- ? LangAS::opencl_generic
- : LangAS::opencl_private);
- return PointeeType;
-@@ -5316,9 +5316,15 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
- }
-
- case DeclaratorChunk::Pipe: {
-- T = S.BuildReadPipeType(T, DeclType.Loc);
-- processTypeAttrs(state, T, TAL_DeclSpec,
-- D.getMutableDeclSpec().getAttributes());
-+ if (S.getOpenCLOptions().isEnabled("__opencl_c_pipes")) {
-+ T = S.BuildReadPipeType(T, DeclType.Loc);
-+ processTypeAttrs(state, T, TAL_DeclSpec,
-+ D.getMutableDeclSpec().getAttributes());
-+ } else {
-+ D.setInvalidType(true);
-+ T = Context.IntTy;
-+ S.Diag(D.getIdentifierLoc(), diag::err_opencl_pipes_require_feat);
-+ }
- break;
- }
- }
-diff --git a/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl b/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
-index e1f3f6fe1419..b43d9df5935c 100644
---- a/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
-+++ b/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
-@@ -2,7 +2,8 @@
- // RUN: %clang_cc1 %s -emit-llvm -o - -O0 -triple amdgcn | FileCheck -enable-var-scope -check-prefixes=ALL,AMDGCN %s
- // RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL2.0 -O0 -triple amdgcn | FileCheck -enable-var-scope -check-prefixes=ALL,AMDGCN,AMDGCN20 %s
- // RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL1.2 -O0 -triple spir-unknown-unknown-unknown | FileCheck -enable-var-scope -check-prefixes=SPIR %s
--
-+// RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL3.0 -O0 -triple spir-unknown-unknown-unknown | FileCheck -enable-var-scope -check-prefixes=SPIR %s
-+// RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL3.0 -cl-ext=__opencl_c_program_scope_global_variables -O0 -triple spir-unknown-unknown-unknown | FileCheck -enable-var-scope -check-prefixes=SPIR %s
- typedef int int2 __attribute__((ext_vector_type(2)));
-
- typedef struct {
-@@ -39,7 +40,7 @@ struct LargeStructTwoMember {
- int2 y[20];
- };
-
--#if __OPENCL_C_VERSION__ >= 200
-+#ifdef __opencl_c_program_scope_global_variables
- struct LargeStructOneMember g_s;
- #endif
-
-@@ -98,7 +99,7 @@ void FuncOneLargeMember(struct LargeStructOneMember u) {
- // AMDGCN20: %[[r0:.*]] = bitcast %struct.LargeStructOneMember addrspace(5)* %[[byval_temp]] to i8 addrspace(5)*
- // AMDGCN20: call void @llvm.memcpy.p5i8.p1i8.i64(i8 addrspace(5)* align 8 %[[r0]], i8 addrspace(1)* align 8 bitcast (%struct.LargeStructOneMember addrspace(1)* @g_s to i8 addrspace(1)*), i64 800, i1 false)
- // AMDGCN20: call void @FuncOneLargeMember(%struct.LargeStructOneMember addrspace(5)* byval(%struct.LargeStructOneMember) align 8 %[[byval_temp]])
--#if __OPENCL_C_VERSION__ >= 200
-+#ifdef __opencl_c_program_scope_global_variables
- void test_indirect_arg_globl(void) {
- FuncOneLargeMember(g_s);
- }
-diff --git a/clang/test/CodeGenOpenCL/address-spaces-conversions.cl b/clang/test/CodeGenOpenCL/address-spaces-conversions.cl
-index 52feccc540bb..9ecffcca5ee9 100644
---- a/clang/test/CodeGenOpenCL/address-spaces-conversions.cl
-+++ b/clang/test/CodeGenOpenCL/address-spaces-conversions.cl
-@@ -1,5 +1,7 @@
- // RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -O0 -ffake-address-space-map -cl-std=CL2.0 -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -O0 -ffake-address-space-map -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space -emit-llvm -o - | FileCheck %s
- // RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -O0 -cl-std=CL2.0 -emit-llvm -o - | FileCheck --check-prefix=CHECK-NOFAKE %s
-+// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -O0 -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space -emit-llvm -o - | FileCheck --check-prefix=CHECK-NOFAKE %s
- // When -ffake-address-space-map is not used, all addr space mapped to 0 for x86_64.
-
- // test that we generate address space casts everywhere we need conversions of
-diff --git a/clang/test/CodeGenOpenCL/address-spaces-mangling.cl b/clang/test/CodeGenOpenCL/address-spaces-mangling.cl
-index 50622f099143..e19ec8451d0d 100644
---- a/clang/test/CodeGenOpenCL/address-spaces-mangling.cl
-+++ b/clang/test/CodeGenOpenCL/address-spaces-mangling.cl
-@@ -6,6 +6,7 @@
- // We check that the address spaces are mangled the same in both version of OpenCL
- // RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL2.0 -emit-llvm -o - | FileCheck -check-prefix=OCL-20 %s
- // RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -emit-llvm -o - | FileCheck -check-prefix=OCL-12 %s
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL3.0 -emit-llvm -o - | FileCheck -check-prefix=OCL-12 %s
-
- // We can't name this f as private is equivalent to default
- // no specifier given address space so we get multiple definition
-@@ -47,7 +48,7 @@ void f(constant int *arg) { }
- // OCL-20-DAG: @_Z1fPU3AS2i
- // OCL-12-DAG: @_Z1fPU3AS2i
-
--#if __OPENCL_C_VERSION__ >= 200
-+#if __OPENCL_C_VERSION__ == 200
- __attribute__((overloadable))
- void f(generic int *arg) { }
- // ASMANG20: @_Z1fPU3AS4i
-diff --git a/clang/test/CodeGenOpenCL/address-spaces.cl b/clang/test/CodeGenOpenCL/address-spaces.cl
-index 144466a690b3..b150e1080b53 100644
---- a/clang/test/CodeGenOpenCL/address-spaces.cl
-+++ b/clang/test/CodeGenOpenCL/address-spaces.cl
-@@ -1,9 +1,13 @@
- // RUN: %clang_cc1 %s -O0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,SPIR
-+// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,SPIR
- // RUN: %clang_cc1 %s -O0 -DCL20 -cl-std=CL2.0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CL20,CL20SPIR
- // RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
-+// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -triple amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
- // RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -DCL20 -cl-std=CL2.0 -emit-llvm -o - | FileCheck %s --check-prefixes=CL20,CL20AMDGCN
- // RUN: %clang_cc1 %s -O0 -triple amdgcn-mesa-mesa3d -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
-+// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -triple amdgcn-mesa-mesa3d -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
- // RUN: %clang_cc1 %s -O0 -triple r600-- -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
-+// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -triple r600-- -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
-
- // SPIR: %struct.S = type { i32, i32, i32* }
- // CL20SPIR: %struct.S = type { i32, i32, i32 addrspace(4)* }
-diff --git a/clang/test/CodeGenOpenCL/amdgcn-automatic-variable.cl b/clang/test/CodeGenOpenCL/amdgcn-automatic-variable.cl
-index 7216cb517495..8d3b30fe8074 100644
---- a/clang/test/CodeGenOpenCL/amdgcn-automatic-variable.cl
-+++ b/clang/test/CodeGenOpenCL/amdgcn-automatic-variable.cl
-@@ -1,4 +1,5 @@
- // RUN: %clang_cc1 -O0 -cl-std=CL1.2 -triple amdgcn---amdgizcl -emit-llvm %s -o - | FileCheck -check-prefixes=CHECK,CL12 %s
-+// RUN: %clang_cc1 -O0 -cl-std=CL3.0 -triple amdgcn---amdgizcl -emit-llvm %s -o - | FileCheck -check-prefixes=CHECK,CL12 %s
- // RUN: %clang_cc1 -O0 -cl-std=CL2.0 -triple amdgcn---amdgizcl -emit-llvm %s -o - | FileCheck -check-prefixes=CHECK,CL20 %s
-
- // CL12-LABEL: define void @func1(i32 addrspace(5)* %x)
-diff --git a/clang/test/CodeGenOpenCL/amdgpu-sizeof-alignof.cl b/clang/test/CodeGenOpenCL/amdgpu-sizeof-alignof.cl
-index a5d438933fa4..8073c7756eb6 100644
---- a/clang/test/CodeGenOpenCL/amdgpu-sizeof-alignof.cl
-+++ b/clang/test/CodeGenOpenCL/amdgpu-sizeof-alignof.cl
-@@ -4,6 +4,17 @@
- // RUN: %clang_cc1 -triple amdgcn---opencl -cl-std=CL2.0 %s -emit-llvm -o - | FileCheck %s
- // RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-std=CL1.2 %s -emit-llvm -o - | FileCheck %s
- // RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-std=CL2.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple r600 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn-mesa-mesa3d -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn---opencl -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn-mesa-mesa3d -cl-ext=__opencl_c_generic_address_space -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn---opencl -cl-ext=__opencl_c_generic_address_space -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-ext=__opencl_c_generic_address_space -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple r600 -cl-ext=__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn-mesa-mesa3d -cl-ext=__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn---opencl -cl-ext=__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-+// RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-ext=__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
-
- #ifdef __AMDGCN__
- #define PTSIZE 8
-@@ -11,7 +22,7 @@
- #define PTSIZE 4
- #endif
-
--#ifdef cl_khr_fp64
-+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
- #pragma OPENCL EXTENSION cl_khr_fp64 : enable
- #endif
- #ifdef cl_khr_fp16
-@@ -59,8 +70,12 @@ void test() {
- check(__alignof__(double) == 8);
- #endif
-
-- check(sizeof(void*) == (__OPENCL_C_VERSION__ >= 200 ? 8 : 4));
-- check(__alignof__(void*) == (__OPENCL_C_VERSION__ >= 200 ? 8 : 4));
-+ check(sizeof(private void*) == 4);
-+ check(__alignof__(private void*) == 4);
-+#ifdef __opencl_c_generic_address_space
-+ check(sizeof(generic void*) == 8);
-+ check(__alignof__(generic void*) == 8);
-+#endif
- check(sizeof(global_ptr_t) == PTSIZE);
- check(__alignof__(global_ptr_t) == PTSIZE);
- check(sizeof(constant_ptr_t) == PTSIZE);
-diff --git a/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl b/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl
-index d1ab6aceac5c..70c5bace023b 100644
---- a/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl
-+++ b/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl
-@@ -1,4 +1,5 @@
- // RUN: %clang_cc1 %s -triple spir-unknown-unknown -finclude-default-header -cl-std=CL1.2 -emit-llvm -o - -O0 | FileCheck %s
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -finclude-default-header -cl-std=CL3.0 -emit-llvm -o - -O0 | FileCheck %s
-
- #pragma OPENCL EXTENSION cl_arm_integer_dot_product_int8 : enable
- void test_int8(uchar4 ua, uchar4 ub, char4 sa, char4 sb) {
-diff --git a/clang/test/CodeGenOpenCL/cl-uniform-wg-size.cl b/clang/test/CodeGenOpenCL/cl-uniform-wg-size.cl
-index 76ace5dca21e..5dc43e222f75 100644
---- a/clang/test/CodeGenOpenCL/cl-uniform-wg-size.cl
-+++ b/clang/test/CodeGenOpenCL/cl-uniform-wg-size.cl
-@@ -1,6 +1,8 @@
- // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL1.2 -o - %s 2>&1 | FileCheck %s -check-prefixes CHECK,CHECK-UNIFORM
- // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s 2>&1 | FileCheck %s -check-prefixes CHECK,CHECK-NONUNIFORM
- // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -cl-uniform-work-group-size -o - %s 2>&1 | FileCheck %s -check-prefixes CHECK,CHECK-UNIFORM
-+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL3.0 -o - %s 2>&1 | FileCheck %s -check-prefixes CHECK,CHECK-NONUNIFORM
-+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL3.0 -cl-uniform-work-group-size -o - %s 2>&1 | FileCheck %s -check-prefixes CHECK,CHECK-UNIFORM
-
- kernel void ker() {};
- // CHECK: define{{.*}}@ker() #0
-diff --git a/clang/test/CodeGenOpenCL/fpmath.cl b/clang/test/CodeGenOpenCL/fpmath.cl
-index 0108d909c94e..b28392739c71 100644
---- a/clang/test/CodeGenOpenCL/fpmath.cl
-+++ b/clang/test/CodeGenOpenCL/fpmath.cl
-@@ -2,6 +2,8 @@
- // RUN: %clang_cc1 %s -emit-llvm -o - -triple spir-unknown-unknown -cl-fp32-correctly-rounded-divide-sqrt | FileCheck --check-prefix=CHECK --check-prefix=DIVOPT %s
- // RUN: %clang_cc1 %s -emit-llvm -o - -DNOFP64 -cl-std=CL1.2 -triple r600-unknown-unknown -target-cpu r600 -pedantic | FileCheck --check-prefix=CHECK-FLT %s
- // RUN: %clang_cc1 %s -emit-llvm -o - -DFP64 -cl-std=CL1.2 -triple spir-unknown-unknown -pedantic | FileCheck --check-prefix=CHECK-DBL %s
-+// RUN: %clang_cc1 %s -emit-llvm -o - -DNOFP64 -cl-std=CL3.0 -triple r600-unknown-unknown -target-cpu r600 -pedantic | FileCheck --check-prefix=CHECK-FLT %s
-+// RUN: %clang_cc1 %s -emit-llvm -o - -DFP64 -cl-std=CL3.0 -cl-ext=__opencl_c_fp64 -triple spir-unknown-unknown -pedantic | FileCheck --check-prefix=CHECK-DBL %s
-
- typedef __attribute__(( ext_vector_type(4) )) float float4;
-
-diff --git a/clang/test/CodeGenOpenCL/generic-address-space-feature.cl b/clang/test/CodeGenOpenCL/generic-address-space-feature.cl
-new file mode 100644
-index 000000000000..890860abe4d9
---- /dev/null
-+++ b/clang/test/CodeGenOpenCL/generic-address-space-feature.cl
-@@ -0,0 +1,28 @@
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -cl-std=CL1.2 -cl-ext=-cl_khr_fp64 -finclude-default-header -emit-llvm -o - | FileCheck %s --check-prefixes=CL12
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -cl-std=CL1.2 -cl-ext=-cl_khr_fp64 -fdeclare-opencl-builtins -emit-llvm -o - | FileCheck %s --check-prefixes=CL12
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -cl-std=CL2.0 -cl-ext=-cl_khr_fp64 -finclude-default-header -emit-llvm -o - | FileCheck %s --check-prefixes=CL20
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -cl-std=CL2.0 -cl-ext=-cl_khr_fp64 -fdeclare-opencl-builtins -emit-llvm -o - | FileCheck %s --check-prefixes=CL20
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -cl-std=CL3.0 -cl-ext=-cl_khr_fp64 -finclude-default-header -emit-llvm -o - | FileCheck %s --check-prefixes=CL30
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -cl-std=CL3.0 -cl-ext=-cl_khr_fp64,__opencl_c_generic_address_space -finclude-default-header -emit-llvm -o - | FileCheck %s --check-prefixes=CL30-GENERIC
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -cl-std=CL3.0 -cl-ext=-cl_khr_fp64 -fdeclare-opencl-builtins -emit-llvm -o - | FileCheck %s --check-prefixes=CL30
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -cl-std=CL3.0 -cl-ext=-cl_khr_fp64,__opencl_c_generic_address_space -fdeclare-opencl-builtins -emit-llvm -o - | FileCheck %s --check-prefixes=CL30-GENERIC
-+
-+void test(global float* src1, local float *src2, private float *src3, float *src4, float tmp) {
-+ // CL20: %{{.+}} = addrspacecast float addrspace(1)* %{{.+}} to float addrspace(4)*
-+ // CL12-NOT: addrspacecast
-+ // CL30-NOT: addrspacecast
-+ // CL30-GENERIC-NOT: addrspacecast
-+ tmp = sincos(tmp, src1);
-+ // CL20: %{{.+}} = addrspacecast float addrspace(3)* %{{.+}} to float addrspace(4)*
-+ // CL12-NOT: addrspacecast
-+ // CL30-NOT: addrspacecast
-+ // CL30-GENERIC-NOT: addrspacecast
-+ tmp = sincos(tmp, src2);
-+
-+ // CL12: %{{.+}} = call {{(spir_func )?}}float [[FUNCNAME:@.*sincos.*]](float %{{.+}}, float* {{.+}})
-+ // CL20: %{{.+}} = call {{(spir_func )?}}float [[FUNCNAME:@.*sincos.*]](float %{{.+}}, float addrspace(4)* {{.+}})
-+ // CL30: %{{.+}} = call {{(spir_func )?}}float [[FUNCNAME:@.*sincos.*]](float %{{.+}}, float* {{.+}})
-+ // CL30-GENERIC: %{{.+}} = call {{(spir_func )?}}float [[FUNCNAME:@.*sincos.*]](float %{{.+}}, float addrspace(4)* {{.+}})
-+ // CHECK: addrspacecast
-+ tmp = sincos(tmp, src4);
-+}
-diff --git a/clang/test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl b/clang/test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl
-index 515f13f6e768..5aa31ac6f345 100644
---- a/clang/test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl
-+++ b/clang/test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl
-@@ -1,4 +1,5 @@
- // RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -cl-ext=+cl_intel_device_side_avc_motion_estimation -emit-llvm -o - -O0 | FileCheck %s
-+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL3.0 -cl-ext=+cl_intel_device_side_avc_motion_estimation -emit-llvm -o - -O0 | FileCheck %s
-
- // CHECK: %opencl.intel_sub_group_avc_mce_payload_t = type opaque
- // CHECK: %opencl.intel_sub_group_avc_ime_payload_t = type opaque
-diff --git a/clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl b/clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl
-index e89237623478..3d6708ac361f 100644
---- a/clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl
-+++ b/clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl
-@@ -1,5 +1,8 @@
- // RUN: %clang_cc1 %s -cl-std=CL1.2 -emit-llvm -triple x86_64-unknown-unknown -o - | FileCheck %s
- // RUN: %clang_cc1 %s -cl-std=CL1.2 -emit-llvm -triple amdgcn-unknown-unknown -o - | FileCheck -check-prefixes=AMDGCN %s
-+// RUN: %clang_cc1 %s -cl-std=CL3.0 -cl-ext=__opencl_c_fp64 -emit-llvm -triple x86_64-unknown-unknown -o - | FileCheck %s
-+// RUN: %clang_cc1 %s -cl-std=CL3.0 -cl-ext=__opencl_c_fp64 -emit-llvm -triple amdgcn-unknown-unknown -o - | FileCheck -check-prefixes=AMDGCN %s
-+
- // Test that the kernels always use the SPIR calling convention
- // to have unambiguous mapping of arguments to feasibly implement
- // clSetKernelArg().
-diff --git a/clang/test/CodeGenOpenCL/logical-ops.cl b/clang/test/CodeGenOpenCL/logical-ops.cl
-index f083a8580ee7..499eab65039b 100644
---- a/clang/test/CodeGenOpenCL/logical-ops.cl
-+++ b/clang/test/CodeGenOpenCL/logical-ops.cl
-@@ -1,4 +1,5 @@
- // RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL1.2 -O1 -triple x86_64-unknown-linux-gnu | FileCheck %s
-+// RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL3.0 -cl-ext=__opencl_c_fp64 -O1 -triple x86_64-unknown-linux-gnu | FileCheck %s
- // RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=clc++ -O1 -triple x86_64-unknown-linux-gnu | FileCheck %s
-
- #pragma OPENCL EXTENSION cl_khr_fp64 : enable
-diff --git a/clang/test/CodeGenOpenCL/no-half.cl b/clang/test/CodeGenOpenCL/no-half.cl
-index aee8f678f01a..46da7fa339e8 100644
---- a/clang/test/CodeGenOpenCL/no-half.cl
-+++ b/clang/test/CodeGenOpenCL/no-half.cl
-@@ -1,6 +1,7 @@
- // RUN: %clang_cc1 %s -cl-std=cl2.0 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
- // RUN: %clang_cc1 %s -cl-std=cl1.2 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
- // RUN: %clang_cc1 %s -cl-std=cl1.1 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
-+// RUN: %clang_cc1 %s -cl-std=cl3.0 -cl-ext=__opencl_c_fp64 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
-
- #pragma OPENCL EXTENSION cl_khr_fp64:enable
-
-diff --git a/clang/test/CodeGenOpenCL/pipe_builtin.cl b/clang/test/CodeGenOpenCL/pipe_builtin.cl
-index 02b9669b7ab1..0bf35c336199 100644
---- a/clang/test/CodeGenOpenCL/pipe_builtin.cl
-+++ b/clang/test/CodeGenOpenCL/pipe_builtin.cl
-@@ -1,4 +1,7 @@
- // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -cl-ext=+cl_khr_subgroups -O0 -cl-std=clc++ -o - %s | FileCheck %s
-+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -cl-ext=+cl_khr_subgroups -O0 -cl-std=cl2.0 -o - %s | FileCheck %s
-+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -cl-ext=+cl_khr_subgroups -O0 -cl-std=cl3.0 -cl-ext=__opencl_c_pipes,__opencl_c_subgroups -o - %s | FileCheck %s
-+
- // FIXME: Add MS ABI manglings of OpenCL things and remove %itanium_abi_triple
- // above to support OpenCL in the MS C++ ABI.
-
-diff --git a/clang/test/CodeGenOpenCL/pipe_types.cl b/clang/test/CodeGenOpenCL/pipe_types.cl
-index ba064c6d7557..b7a523d4f084 100644
---- a/clang/test/CodeGenOpenCL/pipe_types.cl
-+++ b/clang/test/CodeGenOpenCL/pipe_types.cl
-@@ -1,4 +1,5 @@
- // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
-+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -o - %s | FileCheck %s
-
- // CHECK: %opencl.pipe_ro_t = type opaque
- // CHECK: %opencl.pipe_wo_t = type opaque
-diff --git a/clang/test/CodeGenOpenCL/printf.cl b/clang/test/CodeGenOpenCL/printf.cl
-index fc139d776db6..0133c5595d81 100644
---- a/clang/test/CodeGenOpenCL/printf.cl
-+++ b/clang/test/CodeGenOpenCL/printf.cl
-@@ -1,5 +1,7 @@
- // RUN: %clang_cc1 -cl-std=CL1.2 -cl-ext=-+cl_khr_fp64 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=FP64,ALL %s
- // RUN: %clang_cc1 -cl-std=CL1.2 -cl-ext=-cl_khr_fp64 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=NOFP64,ALL %s
-+// RUN: %clang_cc1 -cl-std=CL3.0 -cl-ext=+__opencl_c_fp64 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=FP64,ALL %s
-+// RUN: %clang_cc1 -cl-std=CL3.0 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=NOFP64,ALL %s
-
- typedef __attribute__((ext_vector_type(2))) float float2;
- typedef __attribute__((ext_vector_type(2))) half half2;
-diff --git a/clang/test/CodeGenOpenCL/unroll-hint.cl b/clang/test/CodeGenOpenCL/unroll-hint.cl
-index 0f84450a1ae6..9347c935869b 100644
---- a/clang/test/CodeGenOpenCL/unroll-hint.cl
-+++ b/clang/test/CodeGenOpenCL/unroll-hint.cl
-@@ -1,5 +1,6 @@
- // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
- // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL1.2 -o - %s | FileCheck %s
-+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL3.0 -o - %s | FileCheck %s
-
- /*** for ***/
- void for_count()
-diff --git a/clang/test/Driver/autocomplete.c b/clang/test/Driver/autocomplete.c
-index 18b31320ea80..a6e7be887c8c 100644
---- a/clang/test/Driver/autocomplete.c
-+++ b/clang/test/Driver/autocomplete.c
-@@ -43,6 +43,8 @@
- // CLSTDALL-NEXT: CL1.2
- // CLSTDALL-NEXT: cl2.0
- // CLSTDALL-NEXT: CL2.0
-+// CLSTDALL-NEXT: cl3.0
-+// CLSTDALL-NEXT: CL3.0
- // CLSTDALL-NEXT: clc++
- // CLSTDALL-NEXT: CLC++
- // RUN: %clang --autocomplete=-fno-sanitize-coverage=,f | FileCheck %s -check-prefix=FNOSANICOVER
-diff --git a/clang/test/Driver/opencl.cl b/clang/test/Driver/opencl.cl
-index 05588f2c8b81..cc0a9143ab37 100644
---- a/clang/test/Driver/opencl.cl
-+++ b/clang/test/Driver/opencl.cl
-@@ -2,6 +2,7 @@
- // RUN: %clang -S -### -cl-std=CL1.1 %s 2>&1 | FileCheck --check-prefix=CHECK-CL11 %s
- // RUN: %clang -S -### -cl-std=CL1.2 %s 2>&1 | FileCheck --check-prefix=CHECK-CL12 %s
- // RUN: %clang -S -### -cl-std=CL2.0 %s 2>&1 | FileCheck --check-prefix=CHECK-CL20 %s
-+// RUN: %clang -S -### -cl-std=CL3.0 %s 2>&1 | FileCheck --check-prefix=CHECK-CL30 %s
- // RUN: %clang -S -### -cl-std=clc++ %s 2>&1 | FileCheck --check-prefix=CHECK-CLCPP %s
- // RUN: %clang -S -### -cl-opt-disable %s 2>&1 | FileCheck --check-prefix=CHECK-OPT-DISABLE %s
- // RUN: %clang -S -### -cl-strict-aliasing %s 2>&1 | FileCheck --check-prefix=CHECK-STRICT-ALIASING %s
-@@ -22,6 +23,7 @@
- // CHECK-CL11: "-cc1" {{.*}} "-cl-std=CL1.1"
- // CHECK-CL12: "-cc1" {{.*}} "-cl-std=CL1.2"
- // CHECK-CL20: "-cc1" {{.*}} "-cl-std=CL2.0"
-+// CHECK-CL30: "-cc1" {{.*}} "-cl-std=CL3.0"
- // CHECK-CLCPP: "-cc1" {{.*}} "-cl-std=clc++"
- // CHECK-OPT-DISABLE: "-cc1" {{.*}} "-cl-opt-disable"
- // CHECK-STRICT-ALIASING: "-cc1" {{.*}} "-cl-strict-aliasing"
-diff --git a/clang/test/Driver/unknown-std.cl b/clang/test/Driver/unknown-std.cl
-index 6f371bac13ac..00209fb62556 100644
---- a/clang/test/Driver/unknown-std.cl
-+++ b/clang/test/Driver/unknown-std.cl
-@@ -10,6 +10,7 @@
- // CHECK-NEXT: note: use 'cl1.1' for 'OpenCL 1.1' standard
- // CHECK-NEXT: note: use 'cl1.2' for 'OpenCL 1.2' standard
- // CHECK-NEXT: note: use 'cl2.0' for 'OpenCL 2.0' standard
-+// CHECK-NEXT: note: use 'cl3.0' for 'OpenCL 3.0' standard
- // CHECK-NEXT: note: use 'clc++' for 'C++ for OpenCL' standard
-
- // Make sure that no other output is present.
-diff --git a/clang/test/Frontend/stdlang.c b/clang/test/Frontend/stdlang.c
-index 51484999e37a..eac4632fbdd6 100644
---- a/clang/test/Frontend/stdlang.c
-+++ b/clang/test/Frontend/stdlang.c
-@@ -9,6 +9,7 @@
- // RUN: %clang_cc1 -x cl -cl-std=CL1.1 -DOPENCL %s
- // RUN: %clang_cc1 -x cl -cl-std=CL1.2 -DOPENCL %s
- // RUN: %clang_cc1 -x cl -cl-std=CL2.0 -DOPENCL %s
-+// RUN: %clang_cc1 -x cl -cl-std=CL3.0 -DOPENCL %s
- // RUN: %clang_cc1 -x cl -cl-std=CLC++ -DOPENCL %s
- // RUN: not %clang_cc1 -x cl -std=c99 -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-C99 %s
- // RUN: not %clang_cc1 -x cl -cl-std=invalid -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID %s
-diff --git a/clang/test/Headers/opencl-c-header.cl b/clang/test/Headers/opencl-c-header.cl
-index 1b151ffdd16a..2716076acdcf 100644
---- a/clang/test/Headers/opencl-c-header.cl
-+++ b/clang/test/Headers/opencl-c-header.cl
-@@ -1,6 +1,7 @@
- // RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -verify | FileCheck %s
- // RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -verify -cl-std=CL1.1 | FileCheck %s
- // RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -verify -cl-std=CL1.2 | FileCheck %s
-+// RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -verify -cl-std=CL3.0 | FileCheck %s
- // RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -verify -cl-std=clc++ | FileCheck %s --check-prefix=CHECK20
-
- // Test including the default header as a module.
-@@ -39,9 +40,11 @@
- // RUN: rm -rf %t
- // RUN: mkdir -p %t
- // RUN: %clang_cc1 -triple spir64-unknown-unknown -emit-llvm -o - -cl-std=CL1.2 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-MOD %s
-+// RUN: %clang_cc1 -triple spir64-unknown-unknown -emit-llvm -o - -cl-std=CL3.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-MOD %s
- // RUN: %clang_cc1 -triple amdgcn--amdhsa -O0 -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK20 --check-prefix=CHECK-MOD %s
- // RUN: chmod u-w %t
- // RUN: %clang_cc1 -triple spir64-unknown-unknown -emit-llvm -o - -cl-std=CL1.2 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-MOD %s
-+// RUN: %clang_cc1 -triple spir64-unknown-unknown -emit-llvm -o - -cl-std=CL3.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK --check-prefix=CHECK-MOD %s
- // RUN: %clang_cc1 -triple amdgcn--amdhsa -O0 -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK20 --check-prefix=CHECK-MOD %s
- // RUN: chmod u+w %t
-
-@@ -67,7 +70,7 @@ char f(char x) {
- // from OpenCL 2.0 onwards.
-
- // CHECK20: _Z12write_imagef14ocl_image3d_wo
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
- void test_image3dwo(write_only image3d_t img) {
- write_imagef(img, (0), (0.0f));
- }
-@@ -81,7 +84,7 @@ void test_atomics(__generic volatile unsigned int* a) {
- #endif
-
- // Verify that ATOMIC_VAR_INIT is defined.
--#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
- global atomic_int z = ATOMIC_VAR_INIT(99);
- #endif //__OPENCL_C_VERSION__
-
-diff --git a/clang/test/Index/pipe-size.cl b/clang/test/Index/pipe-size.cl
-index 94a1255f0a48..59b76051eda1 100644
---- a/clang/test/Index/pipe-size.cl
-+++ b/clang/test/Index/pipe-size.cl
-@@ -2,6 +2,13 @@
- // RUN: %clang_cc1 -x cl -O0 -cl-std=CL2.0 -emit-llvm -triple spir-unknown-unknown %s -o - | FileCheck %s --check-prefix=SPIR
- // RUN: %clang_cc1 -x cl -O0 -cl-std=CL2.0 -emit-llvm -triple spir64-unknown-unknown %s -o - | FileCheck %s --check-prefix=SPIR64
- // RUN: %clang_cc1 -x cl -O0 -cl-std=CL2.0 -emit-llvm -triple amdgcn-amd-amdhsa %s -o - | FileCheck %s --check-prefix=AMDGCN
-+// RUN: %clang_cc1 -x cl -O0 -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -emit-llvm -triple x86_64-unknown-linux-gnu %s -o - | FileCheck %s --check-prefix=X86
-+// RUN: %clang_cc1 -x cl -O0 -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -emit-llvm -triple spir-unknown-unknown %s -o - | FileCheck %s --check-prefix=SPIR
-+// RUN: %clang_cc1 -x cl -O0 -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -emit-llvm -triple spir64-unknown-unknown %s -o - | FileCheck %s --check-prefix=SPIR64
-+// RUN: %clang_cc1 -x cl -O0 -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -emit-llvm -triple amdgcn-amd-amdhsa %s -o - | FileCheck %s --check-prefix=AMDGCN
-+
-+
-+
- __kernel void testPipe( pipe int test )
- {
- int s = sizeof(test);
-diff --git a/clang/test/Preprocessor/init-aarch64.c b/clang/test/Preprocessor/init-aarch64.c
-index df2a6128989b..cbb0995b48b0 100644
---- a/clang/test/Preprocessor/init-aarch64.c
-+++ b/clang/test/Preprocessor/init-aarch64.c
-@@ -109,12 +109,12 @@
- // AARCH64-NEXT: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
- // AARCH64_CXX-NEXT: #define __GLIBCXX_BITSIZE_INT_N_0 128
- // AARCH64_CXX-NEXT: #define __GLIBCXX_TYPE_INT_N_0 __int128
--// AARCH64-NEXT: #define __INT16_C_SUFFIX__
-+// AARCH64-NEXT: #define __INT16_C_SUFFIX__
- // AARCH64-NEXT: #define __INT16_FMTd__ "hd"
- // AARCH64-NEXT: #define __INT16_FMTi__ "hi"
- // AARCH64-NEXT: #define __INT16_MAX__ 32767
- // AARCH64-NEXT: #define __INT16_TYPE__ short
--// AARCH64-NEXT: #define __INT32_C_SUFFIX__
-+// AARCH64-NEXT: #define __INT32_C_SUFFIX__
- // AARCH64-NEXT: #define __INT32_FMTd__ "d"
- // AARCH64-NEXT: #define __INT32_FMTi__ "i"
- // AARCH64-NEXT: #define __INT32_MAX__ 2147483647
-@@ -124,7 +124,7 @@
- // AARCH64-NEXT: #define __INT64_FMTi__ "li"
- // AARCH64-NEXT: #define __INT64_MAX__ 9223372036854775807L
- // AARCH64-NEXT: #define __INT64_TYPE__ long int
--// AARCH64-NEXT: #define __INT8_C_SUFFIX__
-+// AARCH64-NEXT: #define __INT8_C_SUFFIX__
- // AARCH64-NEXT: #define __INT8_FMTd__ "hhd"
- // AARCH64-NEXT: #define __INT8_FMTi__ "hhi"
- // AARCH64-NEXT: #define __INT8_MAX__ 127
-@@ -238,7 +238,7 @@
- // AARCH64-NEXT: #define __STDC_UTF_32__ 1
- // AARCH64_C: #define __STDC_VERSION__ 201710L
- // AARCH64-NEXT: #define __STDC__ 1
--// AARCH64-NEXT: #define __UINT16_C_SUFFIX__
-+// AARCH64-NEXT: #define __UINT16_C_SUFFIX__
- // AARCH64-NEXT: #define __UINT16_FMTX__ "hX"
- // AARCH64-NEXT: #define __UINT16_FMTo__ "ho"
- // AARCH64-NEXT: #define __UINT16_FMTu__ "hu"
-@@ -259,7 +259,7 @@
- // AARCH64-NEXT: #define __UINT64_FMTx__ "lx"
- // AARCH64-NEXT: #define __UINT64_MAX__ 18446744073709551615UL
- // AARCH64-NEXT: #define __UINT64_TYPE__ long unsigned int
--// AARCH64-NEXT: #define __UINT8_C_SUFFIX__
-+// AARCH64-NEXT: #define __UINT8_C_SUFFIX__
- // AARCH64-NEXT: #define __UINT8_FMTX__ "hhX"
- // AARCH64-NEXT: #define __UINT8_FMTo__ "hho"
- // AARCH64-NEXT: #define __UINT8_FMTu__ "hhu"
-@@ -329,7 +329,7 @@
- // AARCH64-NEXT: #define __UINT_LEAST8_FMTx__ "hhx"
- // AARCH64-NEXT: #define __UINT_LEAST8_MAX__ 255
- // AARCH64-NEXT: #define __UINT_LEAST8_TYPE__ unsigned char
--// AARCH64-NEXT: #define __USER_LABEL_PREFIX__
-+// AARCH64-NEXT: #define __USER_LABEL_PREFIX__
- // AARCH64-NEXT: #define __VERSION__ "{{.*}}"
- // AARCH64-NEXT: #define __WCHAR_MAX__ 4294967295U
- // AARCH64-NEXT: #define __WCHAR_TYPE__ unsigned int
-diff --git a/clang/test/Preprocessor/predefined-macros.c b/clang/test/Preprocessor/predefined-macros.c
-index 083f0e539d88..6c80517ec4d4 100644
---- a/clang/test/Preprocessor/predefined-macros.c
-+++ b/clang/test/Preprocessor/predefined-macros.c
-@@ -129,6 +129,8 @@
- // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL12
- // RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=CL2.0 \
- // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL20
-+// RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=CL3.0 \
-+// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL30
- // RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-fast-relaxed-math \
- // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-FRM
- // RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=clc++ \
-@@ -137,26 +139,37 @@
- // CHECK-CL10: #define CL_VERSION_1_1 110
- // CHECK-CL10: #define CL_VERSION_1_2 120
- // CHECK-CL10: #define CL_VERSION_2_0 200
-+// CHECK-CL10: #define CL_VERSION_3_0 300
- // CHECK-CL10: #define __OPENCL_C_VERSION__ 100
- // CHECK-CL10-NOT: #define __FAST_RELAXED_MATH__ 1
- // CHECK-CL11: #define CL_VERSION_1_0 100
- // CHECK-CL11: #define CL_VERSION_1_1 110
- // CHECK-CL11: #define CL_VERSION_1_2 120
- // CHECK-CL11: #define CL_VERSION_2_0 200
-+// CHECK-CL11: #define CL_VERSION_3_0 300
- // CHECK-CL11: #define __OPENCL_C_VERSION__ 110
- // CHECK-CL11-NOT: #define __FAST_RELAXED_MATH__ 1
- // CHECK-CL12: #define CL_VERSION_1_0 100
- // CHECK-CL12: #define CL_VERSION_1_1 110
- // CHECK-CL12: #define CL_VERSION_1_2 120
- // CHECK-CL12: #define CL_VERSION_2_0 200
-+// CHECK-CL12: #define CL_VERSION_3_0 300
- // CHECK-CL12: #define __OPENCL_C_VERSION__ 120
- // CHECK-CL12-NOT: #define __FAST_RELAXED_MATH__ 1
- // CHECK-CL20: #define CL_VERSION_1_0 100
- // CHECK-CL20: #define CL_VERSION_1_1 110
- // CHECK-CL20: #define CL_VERSION_1_2 120
- // CHECK-CL20: #define CL_VERSION_2_0 200
-+// CHECK-CL20: #define CL_VERSION_3_0 300
- // CHECK-CL20: #define __OPENCL_C_VERSION__ 200
- // CHECK-CL20-NOT: #define __FAST_RELAXED_MATH__ 1
-+// CHECK-CL30: #define CL_VERSION_1_0 100
-+// CHECK-CL30: #define CL_VERSION_1_1 110
-+// CHECK-CL30: #define CL_VERSION_1_2 120
-+// CHECK-CL30: #define CL_VERSION_2_0 200
-+// CHECK-CL30: #define CL_VERSION_3_0 300
-+// CHECK-CL30: #define __OPENCL_C_VERSION__ 300
-+// CHECK-CL30-NOT: #define __FAST_RELAXED_MATH__ 1
- // CHECK-FRM: #define __FAST_RELAXED_MATH__ 1
- // CHECK-CLCPP10: #define __CL_CPP_VERSION_1_0__ 100
- // CHECK-CLCPP10: #define __OPENCL_CPP_VERSION__ 100
-diff --git a/clang/test/Sema/feature-extensions-simult-support.cl b/clang/test/Sema/feature-extensions-simult-support.cl
-new file mode 100644
-index 000000000000..0789105002b2
---- /dev/null
-+++ b/clang/test/Sema/feature-extensions-simult-support.cl
-@@ -0,0 +1,75 @@
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=-cl_khr_fp64
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=+cl_khr_fp64
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=-cl_khr_3d_image_writes
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=+cl_khr_3d_image_writes
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=-cl_khr_subgroups
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=+cl_khr_subgroups
-+
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=-cl_khr_fp64
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_fp64
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=-cl_khr_3d_image_writes
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_3d_image_writes
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=-cl_khr_subgroups
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_subgroups
-+
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_fp64
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_3d_image_writes
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_subgroups
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_pipes
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_device_enqueue
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_read_write_images
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_fp64,-cl_khr_fp64
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_3d_image_writes,-cl_khr_3d_image_writes
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_subgroups,-cl_khr_subgroups
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+cl_khr_fp64
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+cl_khr_3d_image_writes
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+cl_khr_subgroups
-+
-+// expected-no-diagnostics
-+
-+#ifdef cl_khr_fp64
-+ #ifndef __opencl_c_fp64
-+ #error macros were not properly set up
-+ #endif
-+#endif
-+#ifdef __opencl_c_fp64
-+ #ifndef cl_khr_fp64
-+ #error macros were not properly set up
-+ #endif
-+#endif
-+
-+#ifdef cl_khr_3d_image_writes
-+ #ifndef __opencl_c_3d_image_writes
-+ #error macros were not properly set up
-+ #endif
-+#endif
-+#ifdef __opencl_c_3d_image_writes
-+ #ifndef cl_khr_3d_image_writes
-+ #error macros were not properly set up
-+ #endif
-+#endif
-+
-+#ifdef cl_khr_subgroups
-+ #ifndef __opencl_c_subgroups
-+ #error macros were not properly set up
-+ #endif
-+#endif
-+#ifdef __opencl_c_subgroups
-+ #ifndef cl_khr_subgroups
-+ #error macros were not properly set up
-+ #endif
-+#endif
-+
-+#if defined(__opencl_c_pipes) || defined(__opencl_c_device_enqueue)
-+ #ifndef __opencl_c_generic_address_space
-+ #error macros were not properly set up
-+ #endif
-+#endif
-+
-+#if defined(__opencl_c_3d_image_writes) || defined(__opencl_c_read_write_images)
-+ #ifndef __opencl_c_images
-+ #error macros were not properly set up
-+ #endif
-+#endif
-+
-+kernel void test(){}
-diff --git a/clang/test/Sema/features-ignore-pragma.cl b/clang/test/Sema/features-ignore-pragma.cl
-new file mode 100644
-index 000000000000..046ce5390754
---- /dev/null
-+++ b/clang/test/Sema/features-ignore-pragma.cl
-@@ -0,0 +1,24 @@
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_fp64
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_subgroups
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_3d_image_writes
-+
-+#pragma OPENCL EXTENSION __opencl_c_fp64 : enable
-+// expected-warning@-1 {{OpenCL feature support can't be controlled via pragma, ignoring}}
-+
-+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-+#ifndef __opencl_c_fp64
-+// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_fp64' - ignoring}}
-+#endif
-+
-+#pragma OPENCL EXTENSION cl_khr_subgroups : enable
-+#ifndef __opencl_c_subgroups
-+// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_subgroups' - ignoring}}
-+#endif
-+
-+#pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable
-+#ifndef __opencl_c_3d_image_writes
-+// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_3d_image_writes' - ignoring}}
-+#endif
-+
-+kernel void foo() {}
-diff --git a/clang/test/Sema/opencl-features-pipes.cl b/clang/test/Sema/opencl-features-pipes.cl
-new file mode 100644
-index 000000000000..c0ac778f24a6
---- /dev/null
-+++ b/clang/test/Sema/opencl-features-pipes.cl
-@@ -0,0 +1,18 @@
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.1
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -DHAS
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -DHAS
-+// expected-no-diagnostics
-+
-+#ifdef HAS
-+ #ifndef __opencl_c_pipes
-+ #error Feature should be defined
-+ #endif
-+#else
-+ #ifdef __opencl_c_pipes
-+ #error Feature should not be defined
-+ #endif
-+#endif
-+
-+kernel void foo() {}
-diff --git a/clang/test/Sema/opencl-features.cl b/clang/test/Sema/opencl-features.cl
-new file mode 100644
-index 000000000000..aa432f6b60bf
---- /dev/null
-+++ b/clang/test/Sema/opencl-features.cl
-@@ -0,0 +1,128 @@
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=-__opencl_c_device_enqueue,-__opencl_c_pipes,-__opencl_c_read_write_images
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CLC++
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0
-+// expected-no-diagnostics
-+
-+#ifndef __opencl_c_int64
-+ #error Feature __opencl_c_int64 shouldn't be defined
-+#endif
-+
-+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
-+ #ifndef __opencl_c_3d_image_writes
-+ #error Feature __opencl_c_3d_image_writes should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_atomic_order_acq_rel
-+ #error Feature __opencl_c_atomic_order_acq_rel should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_atomic_order_seq_cst
-+ #error Feature __opencl_c_atomic_order_seq_cst should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_atomic_scope_device
-+ #error Feature __opencl_c_atomic_scope_device should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_atomic_scope_all_devices
-+ #error Feature __opencl_c_atomic_scope_all_devices should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_device_enqueue
-+ #error Feature __opencl_c_device_enqueue should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_generic_address_space
-+ #error Feature __opencl_c_generic_address_space should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_pipes
-+ #error Feature __opencl_c_pipes should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_program_scope_global_variables
-+ #error Feature __opencl_c_program_scope_global_variables should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_read_write_images
-+ #error Feature __opencl_c_read_write_images should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_subgroups
-+ #error Feature __opencl_c_subgroups should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_work_group_collective_functions
-+ #error Feature __opencl_c_work_group_collective_functions should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_fp64
-+ #error Feature __opencl_c_fp64 should be defined
-+ #endif
-+
-+ #ifndef __opencl_c_images
-+ #error Feature __opencl_c_images should be defined
-+ #endif
-+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
-+
-+
-+#if __OPENCL_C_VERSION__ == CL_VERSION_3_0
-+ #ifdef __opencl_c_3d_image_writes
-+ #error Feature __opencl_c_3d_image_writes shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_atomic_order_acq_rel
-+ #error Feature __opencl_c_atomic_order_acq_rel shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_atomic_order_seq_cst
-+ #error Feature __opencl_c_atomic_order_seq_cst shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_atomic_scope_device
-+ #error Feature __opencl_c_atomic_scope_device shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_atomic_scope_all_devices
-+ #error Feature __opencl_c_atomic_scope_all_devices shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_device_enqueue
-+ #error Feature __opencl_c_device_enqueue shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_generic_address_space
-+ #error Feature __opencl_c_generic_address_space shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_pipes
-+ #error Feature __opencl_c_pipes shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_program_scope_global_variables
-+ #error Feature __opencl_c_program_scope_global_variables shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_read_write_images
-+ #error Feature __opencl_c_read_write_images shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_subgroups
-+ #error Feature __opencl_c_subgroups shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_work_group_collective_functions
-+ #error Feature __opencl_c_work_group_collective_functions shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_fp64
-+ #error Feature __opencl_c_fp64 shouldn't be defined
-+ #endif
-+
-+ #ifdef __opencl_c_images
-+ #error Feature __opencl_c_images shouldn't be defined
-+ #endif
-+#endif // __OPENCL_C_VERSION__ == CL_VERSION_3_0
-+
-+kernel void foo() {}
-diff --git a/clang/test/Sema/pipe_builtins_feature.cl b/clang/test/Sema/pipe_builtins_feature.cl
-new file mode 100644
-index 000000000000..56fa94fc7705
---- /dev/null
-+++ b/clang/test/Sema/pipe_builtins_feature.cl
-@@ -0,0 +1,21 @@
-+// RUN: %clang_cc1 -cl-std=CL2.0 -fsyntax-only -verify %s
-+// RUN: %clang_cc1 -cl-std=CL3.0 -fsyntax-only -verify %s
-+// RUN: %clang_cc1 -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -fsyntax-only -verify %s
-+
-+#ifdef __opencl_c_pipes
-+ #ifndef __opencl_c_generic_address_space
-+ #error Generic address space feature must also be defined
-+ #endif
-+// CHECK: expected-no-diagnostics
-+// check that pragma disable all doesn't touch feature support
-+ #pragma OPENCL EXTENSION all : disable
-+#endif
-+
-+void test(read_only pipe int p, global int *ptr) {
-+ reserve_id_t rid;
-+}
-+
-+#ifndef __opencl_c_pipes
-+// expected-error@-5 {{expected parameter declarator}} expected-error@-5 {{expected ')'}} expected-note@-5 {{to match this '('}}
-+// expected-error@-5 {{use of type 'reserve_id_t' requires __opencl_c_pipes extension to be enabled}}
-+#endif
-diff --git a/clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl b/clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
-index a5a838241347..dbdc5cffd073 100644
---- a/clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
-+++ b/clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
-@@ -1,6 +1,9 @@
- // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std=CL2.0
- // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std=CL2.0
- // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std=CL2.0
-+// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space
-+// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space
-+// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space
- // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std=clc++
- // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std=clc++
- // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std=clc++
-diff --git a/clang/test/SemaOpenCL/address-spaces.cl b/clang/test/SemaOpenCL/address-spaces.cl
-index e9825fd1682a..563f1e649a82 100644
---- a/clang/test/SemaOpenCL/address-spaces.cl
-+++ b/clang/test/SemaOpenCL/address-spaces.cl
-@@ -1,5 +1,6 @@
- // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
- // RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only
-+// RUN: %clang_cc1 %s -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space -verify -pedantic -fsyntax-only
- // RUN: %clang_cc1 %s -cl-std=clc++ -verify -pedantic -fsyntax-only
-
- __constant int ci = 1;
-diff --git a/clang/test/SemaOpenCL/cl20-device-side-enqueue.cl b/clang/test/SemaOpenCL/cl20-device-side-enqueue.cl
-index f63e2913c749..727141190a0b 100644
---- a/clang/test/SemaOpenCL/cl20-device-side-enqueue.cl
-+++ b/clang/test/SemaOpenCL/cl20-device-side-enqueue.cl
-@@ -2,6 +2,12 @@
- // RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir-unknown-unknown" -verify -pedantic -fsyntax-only -DB32 -DQUALS="const volatile"
- // RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS=
- // RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS="const volatile"
-+// RUN: %clang_cc1 %s -cl-std=CL3.0 -triple "spir-unknown-unknown" -cl-ext=__opencl_c_device_enqueue,__opencl_c_subgroups -verify -pedantic -fsyntax-only -DB32 -DQUALS=
-+// RUN: %clang_cc1 %s -cl-std=CL3.0 -triple "spir-unknown-unknown" -cl-ext=__opencl_c_device_enqueue,__opencl_c_subgroups -verify -pedantic -fsyntax-only -DB32 -DQUALS="const volatile"
-+// RUN: %clang_cc1 %s -cl-std=CL3.0 -triple "spir64-unknown-unknown" -cl-ext=__opencl_c_device_enqueue,__opencl_c_subgroups -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS=
-+// RUN: %clang_cc1 %s -cl-std=CL3.0 -triple "spir64-unknown-unknown" -cl-ext=__opencl_c_device_enqueue,__opencl_c_subgroups -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS="const volatile"
-+
-+
-
- typedef struct {int a;} ndrange_t;
- // Diagnostic tests for different overloads of enqueue_kernel from Table 6.13.17.1 of OpenCL 2.0 Spec.
-@@ -235,11 +241,17 @@ kernel void bar(global unsigned int *buf)
- kernel void foo1(global unsigned int *buf)
- {
- ndrange_t n;
-- buf[0] = get_kernel_max_sub_group_size_for_ndrange(n, ^(){}); // expected-error {{use of declaration 'get_kernel_max_sub_group_size_for_ndrange' requires cl_khr_subgroups extension to be enabled}}
-+ buf[0] = get_kernel_max_sub_group_size_for_ndrange(n, ^(){});
-+#if __OPENCL_C_VERSION__ < 300
-+// expected-error@-2 {{use of declaration 'get_kernel_max_sub_group_size_for_ndrange' requires cl_khr_subgroups extension to be enabled}}
-+#endif
- }
-
- kernel void bar1(global unsigned int *buf)
- {
- ndrange_t n;
-- buf[0] = get_kernel_sub_group_count_for_ndrange(n, ^(){}); // expected-error {{use of declaration 'get_kernel_sub_group_count_for_ndrange' requires cl_khr_subgroups extension to be enabled}}
-+ buf[0] = get_kernel_sub_group_count_for_ndrange(n, ^(){});
-+#if __OPENCL_C_VERSION__ < 300
-+// expected-error@-2 {{use of declaration 'get_kernel_sub_group_count_for_ndrange' requires cl_khr_subgroups extension to be enabled}}
-+#endif
- }
-diff --git a/clang/test/SemaOpenCL/forget-unsupported-builtins.cl b/clang/test/SemaOpenCL/forget-unsupported-builtins.cl
-new file mode 100644
-index 000000000000..14dd03e2c7db
---- /dev/null
-+++ b/clang/test/SemaOpenCL/forget-unsupported-builtins.cl
-@@ -0,0 +1,22 @@
-+// RUN: %clang_cc1 -cl-std=cl3.0 -fsyntax-only -verify %s -triple spir-unknown-unknown
-+// RUN: %clang_cc1 -cl-std=cl3.0 -fsyntax-only -cl-ext=__opencl_c_pipes,__opencl_c_generic_address_space,__opencl_c_device_enqueue -verify %s -triple spir-unknown-unknown -DFEATURES
-+
-+#ifndef FEATURES
-+ // expected-no-diagnostics
-+#else
-+ // expected-error@+10 {{cannot redeclare builtin function 'get_pipe_max_packets'}}
-+ // expected-note@+9 {{'get_pipe_max_packets' is a builtin with type 'unsigned int ()'}}
-+ // expected-error@+9 {{cannot redeclare builtin function 'to_local'}}
-+ // expected-note@+8 {{'to_local' is a builtin with type 'void *(void *)'}}
-+ // expected-error@+8 {{cannot redeclare builtin function 'to_global'}}
-+ // expected-note@+7 {{'to_global' is a builtin with type 'void *(void *)'}}
-+ // expected-error@+7 {{cannot redeclare builtin function 'get_kernel_work_group_size'}}
-+ // expected-note@+6 {{'get_kernel_work_group_size' is a builtin with type 'unsigned int ()'}}
-+#endif
-+
-+int get_pipe_max_packets(int);
-+int to_local(int);
-+int to_global(int);
-+int get_kernel_work_group_size(int);
-+
-+kernel void test(global int *dst) {}
-diff --git a/clang/test/SemaOpenCL/image-features.cl b/clang/test/SemaOpenCL/image-features.cl
-new file mode 100644
-index 000000000000..ace6913bb31e
---- /dev/null
-+++ b/clang/test/SemaOpenCL/image-features.cl
-@@ -0,0 +1,20 @@
-+// RUN: %clang_cc1 -cl-std=cl2.0 -fsyntax-only -verify %s -triple spir-unknown-unknown
-+// RUN: %clang_cc1 -cl-std=cl3.0 -cl-ext=__opencl_c_images -fsyntax-only -verify %s -triple spir-unknown-unknown
-+// RUN: %clang_cc1 -cl-std=cl3.0 -cl-ext=__opencl_c_3d_image_writes -fsyntax-only -verify %s -triple spir-unknown-unknown
-+// RUN: %clang_cc1 -cl-std=cl3.0 -cl-ext=__opencl_c_read_write_images -fsyntax-only -verify %s -triple spir-unknown-unknown
-+
-+#if defined(__opencl_c_read_write_images) && defined(__opencl_c_3d_image_writes)
-+ // expected-no-diagnostics
-+#endif
-+
-+__kernel void write_3d_image(__write_only image3d_t i) {}
-+
-+#ifndef __opencl_c_3d_image_writes
-+ // expected-error@-3 {{use of type '__write_only image3d_t' requires __opencl_c_3d_image_writes extension to be enabled}}
-+#endif
-+
-+__kernel void read_write_3d_image(__read_write image3d_t i) { }
-+
-+#ifndef __opencl_c_read_write_images
-+ // expected-error@-3 {{use of type '__read_write image3d_t' requires __opencl_c_read_write_images extension to be enabled}}
-+#endif
-diff --git a/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl b/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
-index 36e76621d24a..38b0a04726e3 100644
---- a/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
-+++ b/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
-@@ -1,4 +1,5 @@
- // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_subgroups
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_subgroups,__opencl_c_pipes
-
- #pragma OPENCL EXTENSION cl_khr_subgroups : enable
-
-diff --git a/clang/test/SemaOpenCL/storageclass-cl20.cl b/clang/test/SemaOpenCL/storageclass-cl20.cl
-index 581701d2a6a5..469c526ebc30 100644
---- a/clang/test/SemaOpenCL/storageclass-cl20.cl
-+++ b/clang/test/SemaOpenCL/storageclass-cl20.cl
-@@ -1,4 +1,5 @@
- // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
-+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_program_scope_global_variables,__opencl_c_generic_address_space
-
- int G2 = 0;
- global int G3 = 0;
-diff --git a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
-index 7c63cf51ecfa..785ff93aaf85 100644
---- a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
-+++ b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
-@@ -56,6 +56,7 @@
- //===----------------------------------------------------------------------===//
-
- #include "TableGenBackends.h"
-+#include "clang/Basic/OpenCLOptions.h"
- #include "llvm/ADT/MapVector.h"
- #include "llvm/ADT/STLExtras.h"
- #include "llvm/ADT/SmallString.h"
-@@ -69,6 +70,7 @@
- #include "llvm/TableGen/Record.h"
- #include "llvm/TableGen/StringMatcher.h"
- #include "llvm/TableGen/TableGenBackend.h"
-+#include <numeric>
- #include <set>
-
- using namespace llvm;
-@@ -228,6 +230,10 @@ private:
- // The function "tan", having the same signatures, would be mapped to the
- // same entry (<I1, I2, I3>).
- MapVector<BuiltinIndexListTy *, BuiltinTableEntries> SignatureListMap;
-+
-+ // Encode all versions
-+ unsigned short
-+ EncodeBuiltinVersions(std::vector<Record *> BuiltinVersionsRecords) const;
- };
- } // namespace
-
-@@ -338,12 +344,10 @@ struct OpenCLBuiltinStruct {
- const bool IsConst : 1;
- // Function attribute __attribute__((convergent))
- const bool IsConv : 1;
-+ // All opencl versions encoded
-+ const unsigned char AllVersions : 5;
- // OpenCL extension(s) required for this overload.
- const unsigned short Extension;
-- // First OpenCL version in which this overload was introduced (e.g. CL20).
-- const unsigned short MinVersion;
-- // First OpenCL version in which this overload was removed (e.g. CL20).
-- const unsigned short MaxVersion;
- };
-
- )";
-@@ -510,11 +514,9 @@ void BuiltinNameEmitter::EmitBuiltinTable() {
- << (Overload.first->getValueAsBit("IsPure")) << ", "
- << (Overload.first->getValueAsBit("IsConst")) << ", "
- << (Overload.first->getValueAsBit("IsConv")) << ", "
-- << FunctionExtensionIndex[ExtName] << ", "
-- << Overload.first->getValueAsDef("MinVersion")->getValueAsInt("ID")
-- << ", "
-- << Overload.first->getValueAsDef("MaxVersion")->getValueAsInt("ID")
-- << " },\n";
-+ << EncodeBuiltinVersions(
-+ Overload.first->getValueAsListOfDefs("Versions"))
-+ << ", " << FunctionExtensionIndex[ExtName] << " },\n";
- Index++;
- }
- }
-@@ -535,10 +537,8 @@ bool BuiltinNameEmitter::CanReuseSignature(
- if (Rec->getValueAsBit("IsPure") == Rec2->getValueAsBit("IsPure") &&
- Rec->getValueAsBit("IsConst") == Rec2->getValueAsBit("IsConst") &&
- Rec->getValueAsBit("IsConv") == Rec2->getValueAsBit("IsConv") &&
-- Rec->getValueAsDef("MinVersion")->getValueAsInt("ID") ==
-- Rec2->getValueAsDef("MinVersion")->getValueAsInt("ID") &&
-- Rec->getValueAsDef("MaxVersion")->getValueAsInt("ID") ==
-- Rec2->getValueAsDef("MaxVersion")->getValueAsInt("ID") &&
-+ EncodeBuiltinVersions(Rec->getValueAsListOfDefs("Versions")) ==
-+ EncodeBuiltinVersions(Rec2->getValueAsListOfDefs("Versions")) &&
- Rec->getValueAsDef("Extension")->getName() ==
- Rec2->getValueAsDef("Extension")->getName()) {
- return true;
-@@ -814,6 +814,15 @@ static void OCL2Qual(ASTContext &Context, const OpenCLTypeStruct &Ty,
- OS << "\n} // OCL2Qual\n";
- }
-
-+unsigned short BuiltinNameEmitter::EncodeBuiltinVersions(
-+ std::vector<Record *> BuiltinVersionsRecords) const {
-+ return std::accumulate(
-+ BuiltinVersionsRecords.begin(), BuiltinVersionsRecords.end(),
-+ (unsigned short)0, [](unsigned short C, Record *R) {
-+ return C |= clang::OpenCLOptions::EncodeVersion(R->getValueAsInt("ID"));
-+ });
-+}
-+
- void clang::EmitClangOpenCLBuiltins(RecordKeeper &Records, raw_ostream &OS) {
- BuiltinNameEmitter NameChecker(Records, OS);
- NameChecker.Emit();
---
-2.17.1
-
diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-Remove-repo-name-in-LLVM-IR.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-Remove-repo-name-in-LLVM-IR.patch
deleted file mode 100644
index 09089432..00000000
--- a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-Remove-repo-name-in-LLVM-IR.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From ff0a6da84b94c16c4519c649f1f7bed3cdf89bbb Mon Sep 17 00:00:00 2001
-From: Feng Zou <feng.zou@intel.com>
-Date: Tue, 20 Oct 2020 11:29:04 +0800
-Subject: [PATCH] Remove repo name in LLVM IR
-
-Upstream-Status: Backport [Taken from opencl-clang patches, https://github.com/intel/opencl-clang/blob/ocl-open-110/patches/llvm/0002-Remove-repo-name-in-LLVM-IR.patch]
-Signed-off-by: Feng Zou <feng.zou@intel.com>
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
-
----
- llvm/cmake/modules/VersionFromVCS.cmake | 23 ++++++++++++-----------
- 1 file changed, 12 insertions(+), 11 deletions(-)
-
-diff --git a/llvm/cmake/modules/VersionFromVCS.cmake b/llvm/cmake/modules/VersionFromVCS.cmake
-index 18edbeabe3e..2d965263478 100644
---- a/llvm/cmake/modules/VersionFromVCS.cmake
-+++ b/llvm/cmake/modules/VersionFromVCS.cmake
-@@ -33,17 +33,18 @@ function(get_source_info path revision repository)
- else()
- set(remote "origin")
- endif()
-- execute_process(COMMAND ${GIT_EXECUTABLE} remote get-url ${remote}
-- WORKING_DIRECTORY ${path}
-- RESULT_VARIABLE git_result
-- OUTPUT_VARIABLE git_output
-- ERROR_QUIET)
-- if(git_result EQUAL 0)
-- string(STRIP "${git_output}" git_output)
-- set(${repository} ${git_output} PARENT_SCOPE)
-- else()
-- set(${repository} ${path} PARENT_SCOPE)
-- endif()
-+ # Do not show repo name in IR
-+ # execute_process(COMMAND ${GIT_EXECUTABLE} remote get-url ${remote}
-+ # WORKING_DIRECTORY ${path}
-+ # RESULT_VARIABLE git_result
-+ # OUTPUT_VARIABLE git_output
-+ # ERROR_QUIET)
-+ # if(git_result EQUAL 0)
-+ # string(STRIP "${git_output}" git_output)
-+ # set(${repository} ${git_output} PARENT_SCOPE)
-+ # else()
-+ # set(${repository} ${path} PARENT_SCOPE)
-+ # endif()
- endif()
- else()
- message(WARNING "Git not found. Version cannot be determined.")
---
-2.18.1
-
diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-skip-building-tests.patch b/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-skip-building-tests.patch
deleted file mode 100644
index 011c09ee..00000000
--- a/dynamic-layers/clang-layer/recipes-devtools/clang/files/llvm11-skip-building-tests.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From d362652617c5e840089273df0c6623a9745c92a2 Mon Sep 17 00:00:00 2001
-From: Naveen Saini <naveen.kumar.saini@intel.com>
-Date: Wed, 21 Aug 2019 14:35:31 +0800
-Subject: [PATCH] llvm-spirv: skip building tests
-
-Some of these need clang to be built and since we're building this in-tree,
-that leads to problems when compiling libcxx, compiler-rt which aren't built
-in-tree.
-
-Instead of using SPIRV_SKIP_CLANG_BUILD to skip clang build and adding this to
-all components, disable the building of tests altogether.
-
-Upstream-Status: Inappropriate
-
-Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
----
- CMakeLists.txt | 10 ----------
- 1 file changed, 10 deletions(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index ecebb4cb..578ca602 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -25,13 +25,6 @@ if(LLVM_SPIRV_BUILD_EXTERNAL)
- set(CMAKE_CXX_STANDARD 14)
- set(CMAKE_CXX_STANDARD_REQUIRED ON)
-
-- if(LLVM_SPIRV_INCLUDE_TESTS)
-- set(LLVM_TEST_COMPONENTS
-- llvm-as
-- llvm-dis
-- )
-- endif(LLVM_SPIRV_INCLUDE_TESTS)
--
- find_package(LLVM ${BASE_LLVM_VERSION} REQUIRED
- COMPONENTS
- Analysis
-@@ -62,9 +55,6 @@ set(LLVM_SPIRV_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
-
- add_subdirectory(lib/SPIRV)
- add_subdirectory(tools/llvm-spirv)
--if(LLVM_SPIRV_INCLUDE_TESTS)
-- add_subdirectory(test)
--endif(LLVM_SPIRV_INCLUDE_TESTS)
-
- install(
- FILES
---
-2.26.2
-
diff --git a/dynamic-layers/clang-layer/recipes-devtools/clang/llvm-project-source.bbappend b/dynamic-layers/clang-layer/recipes-devtools/clang/llvm-project-source.bbappend
deleted file mode 100644
index 4e2bc535..00000000
--- a/dynamic-layers/clang-layer/recipes-devtools/clang/llvm-project-source.bbappend
+++ /dev/null
@@ -1,35 +0,0 @@
-FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/files:"
-
-SPIRV_BRANCH = "${@bb.utils.contains('LLVMVERSION', '10.0.1', 'llvm_release_100', 'llvm_release_110', d)}"
-
-SPIRV10_SRCREV = "576abae62cecd171992017a4a786e3831221ab8d"
-SPIRV11_SRCREV = "2a8c1e6c9778deaa720a23e08c293006dc5d56fd"
-
-SPIRV_SRCREV = "${@bb.utils.contains('LLVMVERSION', '10.0.1', '${SPIRV10_SRCREV}', '${SPIRV11_SRCREV}', d)}"
-
-SRC_URI_LLVM10 = " \
- file://llvm10-skip-building-tests.patch;patchdir=llvm/projects/llvm-spirv \
- file://fix-shared-libs.patch;patchdir=llvm/projects/llvm-spirv \
- file://BasicBlockUtils-Add-metadata-fixing-in-SplitBlockPre.patch;patchdir=llvm \
- file://IndVarSimplify-Do-not-use-SCEV-expander-for-IVCount-.patch;patchdir=llvm \
- file://llvm10-OpenCL-3.0-support.patch \
- file://0002-Add-cl_khr_extended_subgroup-extensions.patch \
- file://0001-Memory-leak-fix-for-Managed-Static-Mutex.patch \
- file://llvm10-Remove-repo-name-in-LLVM-IR.patch \
- file://0001-Fix-debug-info-of-work-item-builtin-translation-745.patch;patchdir=llvm/projects/llvm-spirv \
- "
-
-SRC_URI_LLVM11 = " \
- file://llvm11-skip-building-tests.patch;patchdir=llvm/projects/llvm-spirv \
- file://llvm11-OpenCL-3.0-support.patch \
- file://0001-Memory-leak-fix-for-Managed-Static-Mutex.patch \
- file://llvm11-Remove-repo-name-in-LLVM-IR.patch \
- "
-
-SPIRV_LLVM_SRC_URI = "git://github.com/KhronosGroup/SPIRV-LLVM-Translator.git;protocol=https;branch=${SPIRV_BRANCH};destsuffix=git/llvm/projects/llvm-spirv;name=spirv"
-
-SPIRV_LLVM_PATCHES = "${@bb.utils.contains('LLVMVERSION', '10.0.1', '${SRC_URI_LLVM10}', '${SRC_URI_LLVM11}', d)}"
-
-
-SRC_URI_append_intel-x86-common = "${@bb.utils.contains('LLVMVERSION', '12.0.0', '', ' ${SPIRV_LLVM_SRC_URI} ${SPIRV_LLVM_PATCHES} ', d)}"
-SRCREV_spirv = "${@bb.utils.contains('LLVMVERSION', '12.0.0', '', '${SPIRV_SRCREV}', d)}"
diff --git a/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime/allow-to-find-cpp-generation-tool.patch b/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime/allow-to-find-cpp-generation-tool.patch
index 631e0ce6..265fcfa2 100644
--- a/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime/allow-to-find-cpp-generation-tool.patch
+++ b/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime/allow-to-find-cpp-generation-tool.patch
@@ -1,44 +1,51 @@
-From 32851d269ac0c027730168c04d9ce32d0eb50905 Mon Sep 17 00:00:00 2001
-From: Naveen Saini <naveen.kumar.saini@intel.com>
-Date: Wed, 27 May 2020 11:12:09 +0000
-Subject: [PATCH] intel-compute-runtime: allow to find cpp_generation_tool
-
-Build not able to locate cpp_generation_tool.
+From a6361d635e5f3046853883f3ac06fb175116933c Mon Sep 17 00:00:00 2001
+From: Dongwon Kim <dongwon.kim@intel.com>
+Date: Sat, 21 Aug 2021 16:09:39 -0700
+Subject: [PATCH] Build not able to locate cpp_generation_tool.
Upstream-Status: Inappropriate [oe specific]
+
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
+Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
---
- shared/source/built_ins/kernels/CMakeLists.txt | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
+ shared/source/built_ins/kernels/CMakeLists.txt | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/shared/source/built_ins/kernels/CMakeLists.txt b/shared/source/built_ins/kernels/CMakeLists.txt
-index 1b1225077..2e8148c25 100644
+index ed85a37c52..f7c9e79137 100644
--- a/shared/source/built_ins/kernels/CMakeLists.txt
+++ b/shared/source/built_ins/kernels/CMakeLists.txt
-@@ -93,9 +93,9 @@ function(compile_builtin gen_type platform_type builtin bits builtin_options mod
- )
- add_custom_command(
- OUTPUT ${OUTPUT_FILE_CPP}
-- COMMAND $<TARGET_FILE:cpp_generate_tool> --file ${OUTPUTPATH_BASE}.gen --output ${OUTPUT_FILE_CPP} --array ${mode}_${BASENAME} --platform ${family_name_with_type}
-+ COMMAND cpp_generate_tool --file ${OUTPUTPATH_BASE}.gen --output ${OUTPUT_FILE_CPP} --array ${mode}_${BASENAME} --platform ${family_name_with_type}
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-- DEPENDS ${OUTPUTPATH_BASE}.gen $<TARGET_FILE:cpp_generate_tool>
-+ DEPENDS ${OUTPUTPATH_BASE}.gen cpp_generate_tool
- )
- endfunction()
-
-@@ -136,9 +136,9 @@ function(generate_cpp_spirv builtin)
- )
- add_custom_command(
- OUTPUT ${OUTPUT_FILE_CPP}
-- COMMAND $<TARGET_FILE:cpp_generate_tool> --file ${GENERATED_SPV_INPUT} --output ${OUTPUT_FILE_CPP} --array ${BASENAME}
-+ COMMAND cpp_generate_tool --file ${GENERATED_SPV_INPUT} --output ${OUTPUT_FILE_CPP} --array ${BASENAME}
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-- DEPENDS ${GENERATED_SPV_INPUT} $<TARGET_FILE:cpp_generate_tool>
-+ DEPENDS ${GENERATED_SPV_INPUT} cpp_generate_tool
+@@ -107,9 +107,9 @@ function(compile_builtin core_type platform_it builtin bits builtin_options mode
+ )
+ add_custom_command(
+ OUTPUT ${OUTPUT_FILE_CPP}
+- COMMAND $<TARGET_FILE:cpp_generate_tool> --file ${BINARY_OUTPUT}.bin --output ${OUTPUT_FILE_CPP} --array ${mode}_${BASENAME} --device ${RELEASE_FILENAME}
++ COMMAND cpp_generate_tool --file ${BINARY_OUTPUT}.bin --output ${OUTPUT_FILE_CPP} --array ${mode}_${BASENAME} --device ${RELEASE_FILENAME}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+- DEPENDS ${OUTPUT_FILES_BINARIES} $<TARGET_FILE:cpp_generate_tool>
++ DEPENDS ${OUTPUT_FILES_BINARIES} cpp_generate_tool
+ )
+ list(APPEND BUILTINS_COMMANDS "${OUTPUT_FILE_CPP}")
+ else()
+@@ -159,9 +159,9 @@ function(generate_cpp_spirv builtin)
+ )
+ add_custom_command(
+ OUTPUT ${OUTPUT_FILE_CPP}
+- COMMAND $<TARGET_FILE:cpp_generate_tool> --file ${GENERATED_SPV_INPUT} --output ${OUTPUT_FILE_CPP} --array ${BASENAME}
++ COMMAND cpp_generate_tool --file ${GENERATED_SPV_INPUT} --output ${OUTPUT_FILE_CPP} --array ${BASENAME}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+- DEPENDS ${GENERATED_SPV_INPUT} $<TARGET_FILE:cpp_generate_tool>
++ DEPENDS ${GENERATED_SPV_INPUT} cpp_generate_tool
+ )
+ set(OUTPUT_LIST_CPP_FILES ${OUTPUT_LIST_CPP_FILES} ${OUTPUT_FILE_CPP} PARENT_SCOPE)
+ else()
+@@ -277,4 +277,4 @@ if(NOT "${OUTPUT_LIST_CPP_FILES}" STREQUAL "")
)
- endfunction()
+ endif()
+-apply_macro_for_each_core_type("SUPPORTED")
+\ No newline at end of file
++apply_macro_for_each_core_type("SUPPORTED")
--
-2.28.0
+2.43.2
diff --git a/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime/disable-werror.patch b/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime/disable-werror.patch
new file mode 100644
index 00000000..20d9b847
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime/disable-werror.patch
@@ -0,0 +1,16 @@
+Upstream-Status: Inappropriate
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d52e089778..bc0cf35014 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -727,7 +727,7 @@ if(NOT MSVC)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-noexcept-type") # Added for gtest
+ endif()
+ endif()
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Werror=vla")
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=vla")
+
+ if(USE_SANITIZE_UB)
+ check_cxx_compiler_flag(-fsanitize=undefined COMPILER_SUPPORTS_UNDEFINED_BEHAVIOR_SANITIZER)
diff --git a/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime/external-ocloc.patch b/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime/external-ocloc.patch
new file mode 100644
index 00000000..5f93b7b6
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime/external-ocloc.patch
@@ -0,0 +1,40 @@
+From 1f58c22992ddea4167b01b44448528de427f50d5 Mon Sep 17 00:00:00 2001
+From: Dongwon Kim <dongwon.kim@intel.com>
+Date: Wed, 2 Mar 2022 15:52:45 -0800
+Subject: [PATCH] external ocloc
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
+---
+ cmake/ocloc_cmd_prefix.cmake | 14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/cmake/ocloc_cmd_prefix.cmake b/cmake/ocloc_cmd_prefix.cmake
+index 2b44330831..03067c9df0 100644
+--- a/cmake/ocloc_cmd_prefix.cmake
++++ b/cmake/ocloc_cmd_prefix.cmake
+@@ -4,12 +4,14 @@
+ # SPDX-License-Identifier: MIT
+ #
+
+-if(WIN32)
+- set(ocloc_cmd_prefix ocloc)
+-else()
+- if(DEFINED NEO__IGC_LIBRARY_PATH)
+- set(ocloc_cmd_prefix ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${NEO__IGC_LIBRARY_PATH}:$<TARGET_FILE_DIR:ocloc_lib>" $<TARGET_FILE:ocloc>)
++if(NOT DEFINED ocloc_cmd_prefix)
++ if(WIN32)
++ set(ocloc_cmd_prefix ocloc)
+ else()
+- set(ocloc_cmd_prefix ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$<TARGET_FILE_DIR:ocloc_lib>" $<TARGET_FILE:ocloc>)
++ if(DEFINED NEO__IGC_LIBRARY_PATH)
++ set(ocloc_cmd_prefix LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${NEO__IGC_LIBRARY_PATH}:$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
++ else()
++ set(ocloc_cmd_prefix LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
++ endif()
+ endif()
+ endif()
+--
+2.37.3
+
diff --git a/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime_21.04.18912.bb b/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime_21.04.18912.bb
deleted file mode 100644
index d0078f3a..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime_21.04.18912.bb
+++ /dev/null
@@ -1,56 +0,0 @@
-SUMMARY = "The Intel(R) Graphics Compute Runtime for OpenCL(TM)"
-DESCRIPTION = "The Intel(R) Graphics Compute Runtime for OpenCL(TM) \
-is an open source project to converge Intel's development efforts \
-on OpenCL(TM) compute stacks supporting the GEN graphics hardware \
-architecture."
-
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=ae27f47fd6755510247c19e547e4c804 \
- file://third_party/opencl_headers/LICENSE;md5=dcefc90f4c3c689ec0c2489064e7273b"
-
-SRC_URI = "git://github.com/intel/compute-runtime.git;protocol=https \
- "
-SRC_URI_append_class-target = " file://allow-to-find-cpp-generation-tool.patch"
-
-SRCREV = "5a05d7643c4d8cc14e281b686c78101a7a01e8e1"
-
-S = "${WORKDIR}/git"
-
-DEPENDS += " intel-graphics-compiler gmmlib"
-DEPENDS_append_class-target = " intel-compute-runtime-native libva"
-
-RDEPENDS_${PN} += " intel-graphics-compiler gmmlib"
-
-inherit cmake pkgconfig
-
-COMPATIBLE_HOST = '(x86_64).*-linux'
-COMPATIBLE_HOST_libc-musl = "null"
-
-EXTRA_OECMAKE = " \
- -DIGC_DIR=${STAGING_INCDIR}/igc \
- -DBUILD_TYPE=Release \
- -DSKIP_UNIT_TESTS=1 \
- -DCCACHE_ALLOWED=FALSE \
- "
-EXTRA_OECMAKE_append_class-target = " \
- -Dcloc_cmd_prefix=ocloc \
- "
-
-PACKAGECONFIG ??= ""
-PACKAGECONFIG[levelzero] = "-DBUILD_WITH_L0=ON, -DBUILD_WITH_L0=OFF, level-zero"
-
-do_install_append_class-native() {
- install -d ${D}${bindir}
- install ${B}/bin/cpp_generate_tool ${D}${bindir}/
-}
-
-FILES_${PN} += " \
- ${libdir}/intel-opencl/libigdrcl.so \
- ${libdir}/libocloc.so \
- "
-
-FILES_${PN}-dev = "${includedir}"
-
-BBCLASSEXTEND = "native nativesdk"
-
-UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)"
diff --git a/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime_24.13.29138.7.bb b/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime_24.13.29138.7.bb
new file mode 100644
index 00000000..5214d5cf
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime_24.13.29138.7.bb
@@ -0,0 +1,64 @@
+SUMMARY = "The Intel(R) Graphics Compute Runtime for OpenCL(TM)"
+DESCRIPTION = "The Intel(R) Graphics Compute Runtime for OpenCL(TM) \
+is an open source project to converge Intel's development efforts \
+on OpenCL(TM) compute stacks supporting the GEN graphics hardware \
+architecture."
+
+LICENSE = "MIT & Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE.md;md5=eca6ec6997e18db166db7109cdbe611c \
+ file://third_party/opencl_headers/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+SRC_URI = "git://github.com/intel/compute-runtime.git;protocol=https;branch=releases/24.13 \
+ file://disable-werror.patch \
+ file://allow-to-find-cpp-generation-tool.patch \
+ file://external-ocloc.patch \
+ "
+
+SRCREV = "7131387cdbb02d480a225c70daef913a6c024a6e"
+
+S = "${WORKDIR}/git"
+
+DEPENDS += " intel-graphics-compiler gmmlib libva qemu-native"
+
+RDEPENDS:${PN} += " intel-graphics-compiler gmmlib"
+
+inherit cmake pkgconfig qemu
+
+COMPATIBLE_HOST = '(x86_64).*-linux'
+COMPATIBLE_HOST:libc-musl = "null"
+
+EXTRA_OECMAKE = " \
+ -DIGC_DIR=${STAGING_INCDIR}/igc \
+ -DBUILD_TYPE=Release \
+ -DSKIP_UNIT_TESTS=1 \
+ -DCCACHE_ALLOWED=FALSE \
+ -DNEO_DISABLE_LD_LLD=ON \
+ -DNEO_DISABLE_LD_GOLD=ON \
+ "
+
+EXTRA_OECMAKE:append:class-target = " \
+ -Docloc_cmd_prefix=ocloc \
+ -DCMAKE_CROSSCOMPILING_EMULATOR=${WORKDIR}/qemuwrapper \
+ "
+
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[levelzero] = "-DBUILD_WITH_L0=ON, -DBUILD_WITH_L0=OFF, level-zero"
+
+do_configure:prepend:class-target () {
+ # Write out a qemu wrapper that will be used by cmake.
+ qemu_binary="${@qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST'), [d.expand('${B}/bin'),d.expand('${STAGING_DIR_HOST}${libdir}'),d.expand('${STAGING_DIR_HOST}${base_libdir}')])}"
+ cat > ${WORKDIR}/qemuwrapper << EOF
+#!/bin/sh
+$qemu_binary "\$@"
+EOF
+ chmod +x ${WORKDIR}/qemuwrapper
+}
+
+FILES:${PN} += " \
+ ${libdir}/intel-opencl/libigdrcl.so \
+ ${libdir}/libocloc.so \
+ "
+
+FILES:${PN}-dev = "${includedir}"
+
+UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)"
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-BiF-CMakeLists.txt-remove-opt-from-DEPENDS.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-BiF-CMakeLists.txt-remove-opt-from-DEPENDS.patch
new file mode 100644
index 00000000..377081fd
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-BiF-CMakeLists.txt-remove-opt-from-DEPENDS.patch
@@ -0,0 +1,35 @@
+From 3d71670f8ad5b54d434c2f5f71713bb1d5433ae4 Mon Sep 17 00:00:00 2001
+From: Anuj Mittal <anuj.mittal@intel.com>
+Date: Tue, 12 Oct 2021 23:46:42 +0800
+Subject: [PATCH] BiF/CMakeLists.txt: remove opt from DEPENDS
+
+Otherwise it starts failing with:
+
+| ninja: error: 'IGC/VectorCompiler/lib/BiF/opt', needed by 'IGC/VectorCompiler/lib/BiF/VCBiFPrintfOCL32.opt.bc', missing and no known rule to make it
+
+We don't need to explicitly make sure opt is built when
+using prebuilt binaries.
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+---
+ IGC/VectorCompiler/lib/BiF/cmake/Functions.cmake | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/IGC/VectorCompiler/lib/BiF/cmake/Functions.cmake b/IGC/VectorCompiler/lib/BiF/cmake/Functions.cmake
+index d20d7f887..882e09fea 100644
+--- a/IGC/VectorCompiler/lib/BiF/cmake/Functions.cmake
++++ b/IGC/VectorCompiler/lib/BiF/cmake/Functions.cmake
+@@ -109,7 +109,7 @@ function(vc_build_bif TARGET RES_FILE CMCL_SRC_PATH BIF_NAME PTR_BIT_SIZE)
+ COMMENT "vc_build_bif: Translating CMCL builtins: ${BIF_CLANG_BC_NAME_FINAL} -> ${BIF_OPT_BC_NAME}"
+ COMMAND CMCLTranslatorTool -o ${BIF_CMCL_BC_NAME} ${BIF_CLANG_BC_NAME_FINAL}
+ COMMAND ${LLVM_OPT_EXE} ${IGC_LLVM_DEPENDENT_OPT_FLAGS} --O2 -o ${BIF_OPT_BC_NAME} ${BIF_CMCL_BC_NAME}
+- DEPENDS CMCLTranslatorTool ${LLVM_OPT_EXE} ${BIF_CLANG_BC_PATH_FINAL}
++ DEPENDS CMCLTranslatorTool ${BIF_CLANG_BC_PATH_FINAL}
+ BYPRODUCTS ${BIF_OPT_BC_PATH}
+ SOURCES ${CMCL_SRC_PATH})
+ set(${RES_FILE} ${BIF_OPT_BC_NAME} PARENT_SCOPE)
+--
+2.43.2
+
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-Fix-build-with-LLVM-12.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-Fix-build-with-LLVM-12.patch
deleted file mode 100644
index 1d2c5767..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-Fix-build-with-LLVM-12.patch
+++ /dev/null
@@ -1,2433 +0,0 @@
-From 869cdb784aa062bd08bd26465bf0b5651e8f112e Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= <zboszor@pr.hu>
-Date: Thu, 25 Feb 2021 10:39:27 +0100
-Subject: [PATCH 1/3] Fix build with LLVM 12
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Upstream-Status: Pending
-
-Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
----
- .../LegalizeFunctionSignatures.cpp | 2 +-
- IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | 26 +++++++++-----
- IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp | 6 +++-
- IGC/Compiler/CISACodeGen/AdvMemOpt.cpp | 4 +++
- IGC/Compiler/CISACodeGen/CShader.cpp | 14 ++++----
- .../CISACodeGen/ConstantCoalescing.cpp | 14 ++++----
- IGC/Compiler/CISACodeGen/DeSSA.cpp | 3 +-
- IGC/Compiler/CISACodeGen/EmitVISAPass.cpp | 35 +++++++++---------
- IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp | 4 +--
- IGC/Compiler/CISACodeGen/GenIRLowering.cpp | 4 +--
- .../CISACodeGen/GenSimplification.cpp | 5 +--
- .../CISACodeGen/GeometryShaderLowering.cpp | 3 +-
- IGC/Compiler/CISACodeGen/LdShrink.cpp | 10 ++++--
- .../CISACodeGen/LowerGEPForPrivMem.cpp | 8 ++---
- IGC/Compiler/CISACodeGen/MemOpt.cpp | 8 ++---
- IGC/Compiler/CISACodeGen/MemOpt2.cpp | 5 +--
- .../CISACodeGen/OpenCLKernelCodeGen.cpp | 2 +-
- IGC/Compiler/CISACodeGen/PatternMatchPass.cpp | 4 +--
- IGC/Compiler/CISACodeGen/PushAnalysis.cpp | 4 +--
- .../CISACodeGen/RegisterEstimator.cpp | 3 +-
- .../CISACodeGen/RegisterPressureEstimate.hpp | 3 +-
- IGC/Compiler/CISACodeGen/SLMConstProp.cpp | 3 +-
- .../CISACodeGen/ScalarizerCodeGen.cpp | 4 +--
- IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp | 4 +++
- .../CISACodeGen/Simd32Profitability.cpp | 11 ++++--
- IGC/Compiler/CISACodeGen/SimplifyConstant.cpp | 12 +++----
- IGC/Compiler/CISACodeGen/TypeDemote.cpp | 3 +-
- .../CISACodeGen/VariableReuseAnalysis.cpp | 5 +--
- .../CISACodeGen/VariableReuseAnalysis.hpp | 3 +-
- IGC/Compiler/CISACodeGen/VectorPreProcess.cpp | 24 ++++++-------
- IGC/Compiler/CISACodeGen/VectorProcess.cpp | 4 +--
- IGC/Compiler/CISACodeGen/helper.cpp | 10 +++---
- IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp | 15 ++++++--
- IGC/Compiler/CustomSafeOptPass.cpp | 26 +++++++-------
- IGC/Compiler/DebugInfo/ScalarVISAModule.cpp | 3 +-
- IGC/Compiler/GenTTI.cpp | 8 ++++-
- IGC/Compiler/GenUpdateCB.cpp | 3 +-
- IGC/Compiler/HandleFRemInstructions.cpp | 3 +-
- IGC/Compiler/HandleLoadStoreInstructions.cpp | 4 +--
- IGC/Compiler/LegalizationPass.cpp | 28 +++++++--------
- IGC/Compiler/Legalizer/InstPromoter.cpp | 11 ++++--
- IGC/Compiler/Legalizer/InstScalarizer.cpp | 6 ++--
- .../Legalizer/PeepholeTypeLegalizer.cpp | 6 ++--
- IGC/Compiler/Legalizer/TypeLegalizer.cpp | 3 +-
- IGC/Compiler/Legalizer/TypeLegalizer.h | 3 +-
- IGC/Compiler/LowPrecisionOptPass.cpp | 2 +-
- .../AddressSpaceAliasAnalysis.cpp | 9 ++---
- .../AggregateArguments/AggregateArguments.cpp | 3 +-
- .../CorrectlyRoundedDivSqrt.cpp | 3 +-
- .../DeviceEnqueueFuncs/TransformBlocks.cpp | 6 +++-
- .../Optimizer/OpenCLPasses/KernelArgs.cpp | 3 +-
- .../OpenCLPrintf/OpenCLPrintfResolution.cpp | 4 +--
- .../PrivateMemory/PrivateMemoryResolution.cpp | 11 ++++--
- .../ReplaceUnsupportedIntrinsics.cpp | 4 +--
- .../OpenCLPasses/WIFuncs/WIFuncResolution.cpp | 4 +++
- .../Optimizer/PreCompiledFuncImport.cpp | 4 +--
- IGC/Compiler/Optimizer/Scalarizer.cpp | 36 +++++++++----------
- IGC/Compiler/Optimizer/ValueTracker.cpp | 2 +-
- IGC/Compiler/VerificationPass.cpp | 2 +-
- IGC/DebugInfo/DebugInfoUtils.hpp | 4 +++
- IGC/DebugInfo/DwarfDebug.cpp | 8 +++++
- IGC/GenISAIntrinsics/GenIntrinsics.cpp | 6 ++--
- .../BuiltinsFrontendDefinitions.hpp | 2 +-
- .../include/llvmWrapper/Support/TypeSize.h | 8 ++++-
- .../include/llvmWrapper/Transforms/Scalar.h | 4 +--
- IGC/common/igc_resourceDimTypes.h | 5 +++
- 66 files changed, 303 insertions(+), 196 deletions(-)
-
-diff --git a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp
-index 4046b4a6..8ed36089 100644
---- a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp
-+++ b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp
-@@ -156,7 +156,7 @@ inline Type* LegalizedIntVectorType(Module& M, const Type* const oldTy)
- else if (size <= 64) newSize = 64;
- else IGC_ASSERT_MESSAGE(0, "Currently don't support upscaling int sizes > 64 bits");
-
-- return IGCLLVM::FixedVectorType::get(IntegerType::get(M.getContext(), newSize), (unsigned)cast<VectorType>(oldTy)->getNumElements());
-+ return IGCLLVM::FixedVectorType::get(IntegerType::get(M.getContext(), newSize), (unsigned)cast<IGCLLVM::FixedVectorType>(oldTy)->getNumElements());
- }
-
- void LegalizeFunctionSignatures::FixFunctionSignatures()
-diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
-index 41d1f2ea..725a1512 100644
---- a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
-+++ b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
-@@ -1576,7 +1576,11 @@ void SPIRVToLLVMDbgTran::transDbgInfo(SPIRVValue *SV, Value *V) {
- Line->getColumn(), scope, iat);
-
- if(scope && !isa<DIFile>(scope))
-+#if LLVM_VERSION_MAJOR >= 12
-+ I->setDebugLoc(DILocation::get(scope->getContext(), Line->getLine(), Line->getColumn(),
-+#else
- I->setDebugLoc(DebugLoc::get(Line->getLine(), Line->getColumn(),
-+#endif
- scope, iat));
- }
- }
-@@ -1925,7 +1929,11 @@ SPIRVToLLVM::transType(SPIRVType *T) {
- auto name = isSubgroupAvcINTELTypeOpCode(OC) ?
- OCLSubgroupINTELTypeOpCodeMap::rmap(OC) :
- BuiltinOpaqueGenericTypeOpCodeMap::rmap(OC);
-+#if LLVM_VERSION_MAJOR >= 12
-+ auto *pST = llvm::StructType::getTypeByName(M->getContext(), name);
-+#else
- auto *pST = M->getTypeByName(name);
-+#endif
- pST = pST ? pST : StructType::create(*Context, name);
-
- return mapType(T, PointerType::get(pST, getOCLOpaqueTypeAddrSpace(OC)));
-@@ -2403,7 +2411,7 @@ Value *SPIRVToLLVM::promoteBool(Value *pVal, BasicBlock *BB)
-
- auto *PromoType = isa<VectorType>(pVal->getType()) ?
- cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt8Ty(pVal->getContext()),
-- (unsigned)cast<VectorType>(pVal->getType())->getNumElements())) :
-+ (unsigned)cast<IGCLLVM::FixedVectorType>(pVal->getType())->getNumElements())) :
- Type::getInt8Ty(pVal->getContext());
-
- if (auto *C = dyn_cast<Constant>(pVal))
-@@ -2445,7 +2453,7 @@ Value *SPIRVToLLVM::truncBool(Value *pVal, BasicBlock *BB)
-
- auto *TruncType = isa<VectorType>(pVal->getType()) ?
- cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt1Ty(pVal->getContext()),
-- (unsigned)cast<VectorType>(pVal->getType())->getNumElements())) :
-+ (unsigned)cast<IGCLLVM::FixedVectorType>(pVal->getType())->getNumElements())) :
- Type::getInt1Ty(pVal->getContext());
-
- if (auto *C = dyn_cast<Constant>(pVal))
-@@ -2491,7 +2499,7 @@ Type *SPIRVToLLVM::truncBoolType(SPIRVType *SPVType, Type *LLType)
-
- return isa<VectorType>(LLType) ?
- cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt1Ty(LLType->getContext()),
-- (unsigned)cast<VectorType>(LLType)->getNumElements())) :
-+ (unsigned)cast<IGCLLVM::FixedVectorType>(LLType)->getNumElements())) :
- Type::getInt1Ty(LLType->getContext());
- }
-
-@@ -2648,7 +2656,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
- {
- if(CV[i]->getType()->isVectorTy())
- {
-- for(uint32_t j = 0; j < cast<VectorType>(CV[i]->getType())->getNumElements(); j++)
-+ for(uint32_t j = 0; j < cast<IGCLLVM::FixedVectorType>(CV[i]->getType())->getNumElements(); j++)
- {
- Value *v = ExtractElementInst::Create( CV[i],ConstantInt::get( *Context,APInt( 32,j ) ),BCC->getName(),BB );
- elm1 = CreateCompositeConstruct( elm1,v,pos++ );
-@@ -3336,7 +3344,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
- auto Vector = transValue(BI->getOperand(0), F, BB);
- auto Scalar = transValue(BI->getOperand(1), F, BB);
-
-- auto VecType = cast<VectorType>(Vector->getType());
-+ auto VecType = cast<IGCLLVM::FixedVectorType>(Vector->getType());
- auto Undef = UndefValue::get(VecType);
-
- auto ScalarVec = InsertElementInst::Create(Undef, Scalar,
-@@ -3361,7 +3369,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
- a->getType()->getScalarSizeInBits() - 1);
- auto *ShiftOp = isa<VectorType>(a->getType()) ?
- ConstantVector::getSplat(
-- IGCLLVM::getElementCount((unsigned)cast<VectorType>(a->getType())->getNumElements()), ShiftAmt) :
-+ IGCLLVM::getElementCount((unsigned)cast<IGCLLVM::FixedVectorType>(a->getType())->getNumElements()), ShiftAmt) :
- ShiftAmt;
-
- // OCL C:
-@@ -3705,15 +3713,15 @@ SPIRVToLLVM::transSPIRVBuiltinFromInst(SPIRVInstruction *BI, BasicBlock *BB) {
- "",
- BB);
- }
-- else if (cast<VectorType>(coordType)->getNumElements() != 4)
-+ else if (cast<IGCLLVM::FixedVectorType>(coordType)->getNumElements() != 4)
- {
- Value *undef = UndefValue::get(coordType);
-
- SmallVector<Constant*, 4> shuffleIdx;
-- for (unsigned i = 0; i < cast<VectorType>(coordType)->getNumElements(); i++)
-+ for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(coordType)->getNumElements(); i++)
- shuffleIdx.push_back(ConstantInt::get(Type::getInt32Ty(*Context), i));
-
-- for (uint64_t i = (unsigned)cast<VectorType>(coordType)->getNumElements(); i < 4; i++)
-+ for (uint64_t i = (unsigned)cast<IGCLLVM::FixedVectorType>(coordType)->getNumElements(); i < 4; i++)
- shuffleIdx.push_back(ConstantInt::get(Type::getInt32Ty(*Context), 0));
-
- imageCoordinateWiden = new ShuffleVectorInst(
-diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
-index 57821556..91b4623c 100644
---- a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
-+++ b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
-@@ -93,7 +93,11 @@ saveLLVMModule(Module *M, const std::string &OutputFile) {
- PointerType*
- getOrCreateOpaquePtrType(Module *M, const std::string &Name,
- unsigned AddrSpace) {
-+#if LLVM_VERSION_MAJOR >= 12
-+ auto OpaqueType = llvm::StructType::getTypeByName(M->getContext(), Name);
-+#else
- auto OpaqueType = M->getTypeByName(Name);
-+#endif
- if (!OpaqueType)
- OpaqueType = StructType::create(M->getContext(), Name);
- return PointerType::get(OpaqueType, AddrSpace);
-@@ -159,7 +163,7 @@ std::string recursive_mangle(const Type* pType)
- return "i" + utostr(pType->getIntegerBitWidth());
- case IGCLLVM::VectorTyID:
- {
-- unsigned vecLen = (unsigned)cast<VectorType>(pType)->getNumElements();
-+ unsigned vecLen = (unsigned)cast<IGCLLVM::FixedVectorType>(pType)->getNumElements();
- Type* pEltType = cast<VectorType>(pType)->getElementType();
- return "v" + utostr(vecLen) + recursive_mangle(pEltType);
- }
-diff --git a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
-index 81acc6ce..fc45a510 100644
---- a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
-+++ b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
-@@ -134,7 +134,11 @@ bool AdvMemOpt::runOnFunction(Function& F) {
- for (auto I = LI->begin(), E = LI->end(); I != E; ++I)
- for (auto DFI = df_begin(*I), DFE = df_end(*I); DFI != DFE; ++DFI) {
- Loop* L = *DFI;
-+#if LLVM_VERSION_MAJOR >= 12
-+ if (L->isInnermost())
-+#else
- if (L->empty())
-+#endif
- InnermostLoops.push_back(L);
- }
-
-diff --git a/IGC/Compiler/CISACodeGen/CShader.cpp b/IGC/Compiler/CISACodeGen/CShader.cpp
-index e3cb8153..ebc99615 100644
---- a/IGC/Compiler/CISACodeGen/CShader.cpp
-+++ b/IGC/Compiler/CISACodeGen/CShader.cpp
-@@ -430,7 +430,7 @@ void CShader::CreateAliasVars()
- continue;
-
- Type* Ty = V->getType();
-- VectorType* VTy = dyn_cast<VectorType>(Ty);
-+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
- Type* BTy = VTy ? VTy->getElementType() : Ty;
- int nelts = (VTy ? (int)VTy->getNumElements() : 1);
-
-@@ -961,7 +961,7 @@ bool CShader::InsideDivergentCF(llvm::Instruction* inst)
- uint CShader::GetNbVectorElementAndMask(llvm::Value* val, uint32_t& mask)
- {
- llvm::Type* type = val->getType();
-- uint nbElement = int_cast<uint>(cast<VectorType>(type)->getNumElements());
-+ uint nbElement = int_cast<uint>(cast<IGCLLVM::FixedVectorType>(type)->getNumElements());
- mask = 0;
- // we don't process vector bigger than 31 elements as the mask has only 32bits
- // If we want to support longer vectors we need to extend the mask size
-@@ -1166,7 +1166,7 @@ uint32_t CShader::GetExtractMask(llvm::Value* vecVal)
- {
- return it->second;
- }
-- const unsigned int numChannels = vecVal->getType()->isVectorTy() ? (unsigned)cast<VectorType>(vecVal->getType())->getNumElements() : 1;
-+ const unsigned int numChannels = vecVal->getType()->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(vecVal->getType())->getNumElements() : 1;
- IGC_ASSERT_MESSAGE(numChannels <= 32, "Mask has 32 bits maximally!");
- return (1ULL << numChannels) - 1;
- }
-@@ -1174,7 +1174,7 @@ uint32_t CShader::GetExtractMask(llvm::Value* vecVal)
- uint16_t CShader::AdjustExtractIndex(llvm::Value* vecVal, uint16_t index)
- {
- uint16_t result = index;
-- if (cast<VectorType>(vecVal->getType())->getNumElements() < 32)
-+ if (cast<IGCLLVM::FixedVectorType>(vecVal->getType())->getNumElements() < 32)
- {
- uint32_t mask = GetExtractMask(vecVal);
- for (uint i = 0; i < index; ++i)
-@@ -1591,7 +1591,7 @@ auto sizeToSIMDMode = [](uint32_t size)
-
- CVariable* CShader::GetConstant(llvm::Constant* C, CVariable* dstVar)
- {
-- llvm::VectorType* VTy = llvm::dyn_cast<llvm::VectorType>(C->getType());
-+ IGCLLVM::FixedVectorType* VTy = llvm::dyn_cast<IGCLLVM::FixedVectorType>(C->getType());
- if (C && VTy)
- { // Vector constant
- llvm::Type* eTy = VTy->getElementType();
-@@ -1816,7 +1816,7 @@ uint32_t CShader::GetNumElts(llvm::Type* type, bool isUniform)
- {
- IGC_ASSERT(type->getContainedType(0)->isIntegerTy() || type->getContainedType(0)->isFloatingPointTy());
-
-- auto VT = cast<VectorType>(type);
-+ auto VT = cast<IGCLLVM::FixedVectorType>(type);
- numElts *= (uint16_t)VT->getNumElements();
- }
- return numElts;
-@@ -2516,7 +2516,7 @@ CVariable* CShader::GetSymbol(llvm::Value* value, bool fromConstantPool)
- if (isVecType)
- {
- // Map the entire vector value to the CVar
-- unsigned numElements = (unsigned)cast<VectorType>(value->getType())->getNumElements();
-+ unsigned numElements = (unsigned)cast<IGCLLVM::FixedVectorType>(value->getType())->getNumElements();
- var = GetNewVariable(numElements, ISA_TYPE_UQ, (GetContext()->platform.getGRFSize() == 64) ? EALIGN_32WORD : EALIGN_HWORD, true, 1, valName);
- symbolMapping.insert(std::pair<llvm::Value*, CVariable*>(value, var));
-
-diff --git a/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp b/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp
-index 1efe116f..47b7c6c0 100644
---- a/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp
-+++ b/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp
-@@ -224,7 +224,7 @@ static void checkInsertExtractMatch(InsertElementInst* insertInst, Value* base,
-
- static bool canReplaceInsert(InsertElementInst* insertElt)
- {
-- VectorType* VTy = cast<VectorType>(insertElt->getOperand(0)->getType());
-+ IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(insertElt->getOperand(0)->getType());
- ConstantInt* index = dyn_cast<ConstantInt>(insertElt->getOperand(2));
- if (!index || index->getZExtValue() != VTy->getNumElements() - 1)
- {
-@@ -312,7 +312,7 @@ void ConstantCoalescing::VectorizePrep(llvm::BasicBlock* bb)
- {
- if (load->getType()->isVectorTy() && wiAns->isUniform(load))
- {
-- srcNElts = (uint32_t)cast<VectorType>(load->getType())->getNumElements();
-+ srcNElts = (uint32_t)cast<IGCLLVM::FixedVectorType>(load->getType())->getNumElements();
- DenseMap<uint64_t, Instruction*> extractElementMap;
-
- for (auto iter = load->user_begin(); iter != load->user_end(); iter++)
-@@ -396,7 +396,7 @@ bool ConstantCoalescing::isProfitableLoad(
- (isa<LoadInst>(I) && wiAns->isUniform(I)) ?
- 16 : 4;
-
-- if (cast<VectorType>(LoadTy)->getNumElements() > MaxVectorInput)
-+ if (cast<IGCLLVM::FixedVectorType>(LoadTy)->getNumElements() > MaxVectorInput)
- return false;
-
- MaxEltPlus = CheckVectorElementUses(I);
-@@ -1787,7 +1787,7 @@ void ConstantCoalescing::AdjustChunk(BufChunk* cov_chunk, uint start_adj, uint s
- WIAnalysis::WIDependancy loadDep = wiAns->whichDepend(cov_chunk->chunkIO);
- irBuilder->SetInsertPoint(cov_chunk->chunkIO->getNextNode());
- Value* vec = UndefValue::get(originalType);
-- for (unsigned i = 0; i < cast<VectorType>(originalType)->getNumElements(); i++)
-+ for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(originalType)->getNumElements(); i++)
- {
- Value* channel = irBuilder->CreateExtractElement(
- cov_chunk->chunkIO, irBuilder->getInt32(i + start_adj));
-@@ -1851,7 +1851,7 @@ void ConstantCoalescing::MoveExtracts(BufChunk* cov_chunk, Instruction* load, ui
- irBuilder->SetInsertPoint(load->getNextNode());
- Type* vecType = load->getType();
- Value* vec = UndefValue::get(vecType);
-- for (unsigned i = 0; i < cast<VectorType>(vecType)->getNumElements(); i++)
-+ for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(vecType)->getNumElements(); i++)
- {
- Value* channel = irBuilder->CreateExtractElement(
- cov_chunk->chunkIO, irBuilder->getInt32(i + start_adj));
-@@ -1915,7 +1915,7 @@ void ConstantCoalescing::EnlargeChunk(BufChunk* cov_chunk, uint size_adj)
- WIAnalysis::WIDependancy loadDep = wiAns->whichDepend(cov_chunk->chunkIO);
- irBuilder->SetInsertPoint(cov_chunk->chunkIO->getNextNode());
- Value* vec = UndefValue::get(originalType);
-- for (unsigned i = 0; i < cast<VectorType>(originalType)->getNumElements(); i++)
-+ for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(originalType)->getNumElements(); i++)
- {
- Value* channel = irBuilder->CreateExtractElement(
- cov_chunk->chunkIO, irBuilder->getInt32(i));
-@@ -2343,7 +2343,7 @@ void ConstantCoalescing::ReplaceLoadWithSamplerLoad(
- if (dstTy->isVectorTy())
- {
- result = UndefValue::get(dstTy);
-- for (uint i = 0; i < cast<VectorType>(dstTy)->getNumElements(); i++)
-+ for (uint i = 0; i < cast<IGCLLVM::FixedVectorType>(dstTy)->getNumElements(); i++)
- {
- Value* tmpData = ExtractFromSamplerData(cast<VectorType>(dstTy)->getElementType(), i);
- result = irBuilder->CreateInsertElement(result, tmpData, irBuilder->getInt32(i));
-diff --git a/IGC/Compiler/CISACodeGen/DeSSA.cpp b/IGC/Compiler/CISACodeGen/DeSSA.cpp
-index f540dc11..6fab0246 100644
---- a/IGC/Compiler/CISACodeGen/DeSSA.cpp
-+++ b/IGC/Compiler/CISACodeGen/DeSSA.cpp
-@@ -83,6 +83,7 @@ IN THE SOFTWARE.
- #include "Compiler/IGCPassSupport.h"
- #include "common/LLVMWarningsPush.hpp"
- #include <llvm/IR/InstIterator.h>
-+#include <llvmWrapper/IR/DerivedTypes.h>
- #include "common/LLVMWarningsPop.hpp"
- #include <algorithm>
- #include "Probe/Assertion.h"
-@@ -1284,7 +1285,7 @@ int DeSSA::checkInsertElementAlias(
- //
- // If found, return the actual vector size;
- // otherwise, return 0.
-- VectorType* VTy = cast<VectorType>(IEI->getType());
-+ IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(IEI->getType());
- IGC_ASSERT(nullptr != VTy);
- int nelts = (int)VTy->getNumElements();
- AllIEIs.resize(nelts, nullptr);
-diff --git a/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp b/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp
-index 3ab1cc5f..4502ef62 100644
---- a/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp
-+++ b/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp
-@@ -53,6 +53,7 @@ IN THE SOFTWARE.
- #include "Compiler/IGCPassSupport.h"
- #include "common/LLVMWarningsPush.hpp"
- #include "llvmWrapper/IR/Instructions.h"
-+#include "llvmWrapper/IR/DerivedTypes.h"
- #include "llvm/Support/Path.h"
- #include "llvmWrapper/IR/Intrinsics.h"
- #include "common/LLVMWarningsPop.hpp"
-@@ -1165,7 +1166,7 @@ bool EmitPass::canRelocatePhiMov(
- if (dst != src)
- {
- int numElt = 1;
-- if (VectorType * vTy = dyn_cast<VectorType>(PN->getType()))
-+ if (IGCLLVM::FixedVectorType * vTy = dyn_cast<IGCLLVM::FixedVectorType>(PN->getType()))
- {
- numElt = int_cast<int>(vTy->getNumElements());
- }
-@@ -1302,7 +1303,7 @@ void EmitPass::MovPhiSources(llvm::BasicBlock* aBB)
- phiSrcDstList.push_back(phiInfo);
-
- int numElt = 0;
-- if (VectorType * vTy = dyn_cast<VectorType>(PN->getType()))
-+ if (IGCLLVM::FixedVectorType * vTy = dyn_cast<IGCLLVM::FixedVectorType>(PN->getType()))
- {
- numElt = int_cast<int>(vTy->getNumElements());
- }
-@@ -5375,7 +5376,7 @@ void EmitPass::emitLegacySimdBlockWrite(llvm::Instruction* inst, llvm::Value* pt
- bool useA64 = isA64Ptr(ptrType, m_currShader->GetContext());
-
- Type* Ty = dataPtr->getType();
-- VectorType* VTy = dyn_cast<VectorType>(Ty);
-+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
- uint32_t nbElements = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
-
- uint32_t typeSizeInBytes = Ty->getScalarSizeInBits() / 8;
-@@ -5621,7 +5622,7 @@ void EmitPass::emitLegacySimdBlockRead(llvm::Instruction* inst, llvm::Value* ptr
- bool useA64 = isA64Ptr(ptrType, m_currShader->GetContext());
-
- Type* Ty = inst->getType();
-- VectorType* VTy = dyn_cast<VectorType>(Ty);
-+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
- uint32_t nbElements = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
-
- uint32_t typeSizeInBytes = Ty->getScalarSizeInBits() / 8;
-@@ -5913,7 +5914,7 @@ void EmitPass::emitMediaBlockIO(const llvm::GenIntrinsicInst* inst, bool isRead)
- };
-
- uint nElts = isa<VectorType>(pDataType) ?
-- (uint)cast<VectorType>(pDataType)->getNumElements() :
-+ (uint)cast<IGCLLVM::FixedVectorType>(pDataType)->getNumElements() :
- 1;
-
- // Now, do the copies.
-@@ -6003,7 +6004,7 @@ void EmitPass::emitSimdMediaBlockRead(llvm::Instruction* inst)
- uint32_t nbElements = 1;
- if (inst->getType()->isVectorTy())
- {
-- nbElements = (uint32_t)cast<VectorType>(inst->getType())->getNumElements();
-+ nbElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements();
- }
- IGC_ASSERT_MESSAGE(nbElements <= 8, "InValid Vector Size");
-
-@@ -6247,7 +6248,7 @@ void EmitPass::emitSimdMediaBlockWrite(llvm::Instruction* inst)
- uint32_t nbElements = 1;
- if (dataPtr->getType()->isVectorTy())
- {
-- nbElements = (uint32_t)cast<VectorType>(dataPtr->getType())->getNumElements();
-+ nbElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(dataPtr->getType())->getNumElements();
- }
- IGC_ASSERT_MESSAGE(nbElements <= 8, "InValid Vector Size");
-
-@@ -8993,8 +8994,8 @@ void EmitPass::emitBitCast(llvm::BitCastInst* btCst)
- {
- Type* srcType = btCst->getOperand(0)->getType();
- Type* dstType = btCst->getType();
-- unsigned int numSrcElement = srcType->isVectorTy() ? (unsigned)cast<VectorType>(srcType)->getNumElements() : 1;
-- unsigned int numDstElement = dstType->isVectorTy() ? (unsigned)cast<VectorType>(dstType)->getNumElements() : 1;
-+ unsigned int numSrcElement = srcType->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(srcType)->getNumElements() : 1;
-+ unsigned int numDstElement = dstType->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(dstType)->getNumElements() : 1;
-
- if (srcType->isPointerTy())
- {
-@@ -9468,7 +9469,7 @@ void EmitPass::emitLoad3DInner(LdRawIntrinsic* inst, ResourceDescriptor& resourc
- {
- IGC_ASSERT_MESSAGE(predDefSurface != ESURFACE_STATELESS, "scratch cannot be uniform");
- Type* loadType = inst->getType();
-- uint numElement = loadType->isVectorTy() ? (uint)cast<VectorType>(loadType)->getNumElements() : 1;
-+ uint numElement = loadType->isVectorTy() ? (uint)cast<IGCLLVM::FixedVectorType>(loadType)->getNumElements() : 1;
- if (predDefSurface == ESURFACE_SLM)
- {
- IGC_ASSERT(numElement <= 4);
-@@ -10795,7 +10796,7 @@ void EmitPass::emitInsert(llvm::Instruction* inst)
- pVecVar = GetSymbol(pVec);
- if (pVecVar != pInstVar)
- {
-- emitVectorCopy(pInstVar, pVecVar, int_cast<unsigned>(dyn_cast<VectorType>(pVecType)->getNumElements()));
-+ emitVectorCopy(pInstVar, pVecVar, int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(pVecType)->getNumElements()));
- }
- }
- }
-@@ -14596,7 +14597,7 @@ bool EmitPass::isUniformStoreOCL(llvm::StoreInst* SI)
-
- Value* storeVal = SI->getValueOperand();
- Type* Ty = storeVal->getType();
-- VectorType* VTy = dyn_cast<VectorType>(Ty);
-+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
- uint32_t elts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
- Type* eltTy = VTy ? VTy->getElementType() : Ty;
-
-@@ -14626,7 +14627,7 @@ void EmitPass::emitVectorBitCast(llvm::BitCastInst* BCI)
- if (srcTy->isVectorTy())
- {
- srcEltTy = cast<VectorType>(srcTy)->getElementType();
-- srcNElts = (uint32_t)cast<VectorType>(srcTy)->getNumElements();
-+ srcNElts = (uint32_t)cast<IGCLLVM::FixedVectorType>(srcTy)->getNumElements();
- }
- else
- {
-@@ -14636,7 +14637,7 @@ void EmitPass::emitVectorBitCast(llvm::BitCastInst* BCI)
- if (dstTy->isVectorTy())
- {
- dstEltTy = cast<VectorType>(dstTy)->getElementType();
-- dstNElts = (uint32_t)cast<VectorType>(dstTy)->getNumElements();
-+ dstNElts = (uint32_t)cast<IGCLLVM::FixedVectorType>(dstTy)->getNumElements();
- }
- else
- {
-@@ -15215,7 +15216,7 @@ void EmitPass::emitVectorLoad(LoadInst* inst, Value* offset, ConstantInt* immOff
- }
-
- Type* Ty = inst->getType();
-- VectorType* VTy = dyn_cast<VectorType>(Ty);
-+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
- Type* eltTy = VTy ? VTy->getElementType() : Ty;
- uint32_t eltBytes = GetScalarTypeSizeInRegister(eltTy);
- IGC_ASSERT_MESSAGE((eltBytes == 1) || (eltBytes == 2) || (eltBytes == 4) || (eltBytes == 8),
-@@ -15667,7 +15668,7 @@ void EmitPass::emitVectorStore(StoreInst* inst, Value* offset, ConstantInt* immO
-
- Value* storedVal = inst->getValueOperand();
- Type* Ty = storedVal->getType();
-- VectorType* VTy = dyn_cast<VectorType>(Ty);
-+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
- Type* eltTy = VTy ? VTy->getElementType() : Ty;
- uint32_t eltBytes = GetScalarTypeSizeInRegister(eltTy);
-
-@@ -16471,7 +16472,7 @@ void EmitPass::emitCopyAll(CVariable* Dst, CVariable* Src, llvm::Type* Ty)
- }
- else if (Ty->isVectorTy())
- {
-- unsigned NElts = (unsigned)cast<VectorType>(Ty)->getNumElements();
-+ unsigned NElts = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements();
- emitVectorCopy(Dst, Src, NElts);
- }
- else
-diff --git a/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp b/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp
-index 28248f30..767b477a 100644
---- a/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp
-+++ b/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp
-@@ -1961,7 +1961,7 @@ bool InstExpander::visitExtractElement(ExtractElementInst& EEI) {
- // later.
-
- Value* V = EEI.getVectorOperand();
-- unsigned NumElts = (unsigned)cast<VectorType>(V->getType())->getNumElements();
-+ unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(V->getType())->getNumElements();
- V = IRB->CreateBitCast(V, Emu->getV2Int32Ty(NumElts));
- // Re-calculate indices to Lo and Hi parts.
- Value* Idx = EEI.getIndexOperand();
-@@ -1998,7 +1998,7 @@ bool InstExpander::visitInsertElement(InsertElementInst& IEI) {
-
- // Create the emulated vector.
- Value* NewVal = IEI.getOperand(0);
-- unsigned NumElts = (unsigned)cast<VectorType>(NewVal->getType())->getNumElements();
-+ unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(NewVal->getType())->getNumElements();
- NewVal = IRB->CreateBitCast(NewVal, Emu->getV2Int32Ty(NumElts));
- // Re-calculate indices to Lo and Hi parts.
- Value* Idx = IEI.getOperand(2);
-diff --git a/IGC/Compiler/CISACodeGen/GenIRLowering.cpp b/IGC/Compiler/CISACodeGen/GenIRLowering.cpp
-index c74a2ac6..78e8a4aa 100644
---- a/IGC/Compiler/CISACodeGen/GenIRLowering.cpp
-+++ b/IGC/Compiler/CISACodeGen/GenIRLowering.cpp
-@@ -453,7 +453,7 @@ Value* GEPLowering::getSExtOrTrunc(Value* Val, Type* NewTy) const {
-
- IGC_ASSERT_MESSAGE(OldTy->isIntOrIntVectorTy(), "Index should be Integer or vector of Integer!");
-
-- if (auto OldVecTy = dyn_cast<VectorType>(OldTy)) {
-+ if (auto OldVecTy = dyn_cast<IGCLLVM::FixedVectorType>(OldTy)) {
- OldWidth = (unsigned)OldVecTy->getNumElements() * OldVecTy->getElementType()->getIntegerBitWidth();
- NewWidth = (unsigned)OldVecTy->getNumElements() * NewTy->getIntegerBitWidth();
- }
-@@ -805,7 +805,7 @@ bool GEPLowering::lowerGetElementPtrInst(GetElementPtrInst* GEP) const
- }
- else
- {
-- if (auto NewIdxVT = dyn_cast<VectorType>(NewIdx->getType())) {
-+ if (auto NewIdxVT = dyn_cast<IGCLLVM::FixedVectorType>(NewIdx->getType())) {
- Value* result = llvm::UndefValue::get(FixedVectorType::get(PtrMathTy, (unsigned)NewIdxVT->getNumElements()));
- for (uint32_t j = 0; j < (uint32_t)NewIdxVT->getNumElements(); j++) {
- result = Builder->CreateInsertElement(result, PointerValue, Builder->getInt32(j));
-diff --git a/IGC/Compiler/CISACodeGen/GenSimplification.cpp b/IGC/Compiler/CISACodeGen/GenSimplification.cpp
-index 8c38f229..f432061e 100644
---- a/IGC/Compiler/CISACodeGen/GenSimplification.cpp
-+++ b/IGC/Compiler/CISACodeGen/GenSimplification.cpp
-@@ -35,6 +35,7 @@ IN THE SOFTWARE.
- #include <llvm/IR/InstVisitor.h>
- #include <llvm/IR/Instruction.h>
- #include <llvm/Support/raw_ostream.h>
-+#include <llvmWrapper/IR/DerivedTypes.h>
- #include "common/LLVMWarningsPop.hpp"
- #include "Probe/Assertion.h"
-
-@@ -164,7 +165,7 @@ bool GenSimplification::simplifyVectorPHINodeCase2(PHINode& PN) const {
-
- Type* Ty = PN.getType();
- Type* EltTy = Ty->getScalarType();
-- unsigned NumElts = (unsigned)cast<VectorType>(Ty)->getNumElements();
-+ unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements();
-
- SmallVector<Value*, 8> Lanes;
- SmallVector<SmallVector<Value*, 8>, 4> Values;
-@@ -238,7 +239,7 @@ void GenSimplification::visitPHINode(PHINode& PN) {
- void GenSimplification::visitExtractElement(ExtractElementInst& EEI) {
- // Skip non-2-element vector.
- Value* Vec = EEI.getVectorOperand();
-- VectorType* VTy = cast<VectorType>(Vec->getType());
-+ IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(Vec->getType());
- if (VTy->getNumElements() != 2)
- return;
-
-diff --git a/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp b/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp
-index e00e8469..a60b9892 100644
---- a/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp
-+++ b/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp
-@@ -33,6 +33,7 @@ IN THE SOFTWARE.
- #include <llvm/IR/PassManager.h>
- #include <llvm/IR/IRBuilder.h>
- #include <llvm/IR/Verifier.h>
-+#include <llvmWrapper/IR/DerivedTypes.h>
- #include "common/LLVMWarningsPop.hpp"
- #include "Compiler/InitializePasses.h"
- #include "Probe/Assertion.h"
-@@ -507,7 +508,7 @@ void GeometryShaderLowering::AddURBRead(
- {
- Value* vec = UndefValue::get(inst->getType());
- IRBuilder<> builder(inst);
-- for (unsigned int i = 0; i < cast<VectorType>(inst->getType())->getNumElements(); i++)
-+ for (unsigned int i = 0; i < cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements(); i++)
- {
- Value* vecElement = builder.CreateExtractElement(urbRead, builder.getInt32(i));
- vec = builder.CreateInsertElement(vec, vecElement, builder.getInt32(i));
-diff --git a/IGC/Compiler/CISACodeGen/LdShrink.cpp b/IGC/Compiler/CISACodeGen/LdShrink.cpp
-index d89fbd0e..2df06df2 100644
---- a/IGC/Compiler/CISACodeGen/LdShrink.cpp
-+++ b/IGC/Compiler/CISACodeGen/LdShrink.cpp
-@@ -30,6 +30,7 @@ IN THE SOFTWARE.
- #include <llvm/Support/Debug.h>
- #include <llvm/Support/MathExtras.h>
- #include <llvm/Support/raw_ostream.h>
-+#include <llvmWrapper/IR/DerivedTypes.h>
- #include "common/LLVMWarningsPop.hpp"
- #include "Compiler/CISACodeGen/ShaderCodeGen.hpp"
- #include "Compiler/IGCPassSupport.h"
-@@ -79,7 +80,7 @@ IGC_INITIALIZE_PASS_BEGIN(LdShrink, PASS_FLAG, PASS_DESC, PASS_CFG_ONLY, PASS_AN
- IGC_INITIALIZE_PASS_END(LdShrink, PASS_FLAG, PASS_DESC, PASS_CFG_ONLY, PASS_ANALYSIS)
-
- unsigned LdShrink::getExtractIndexMask(LoadInst* LI) const {
-- VectorType* VTy = dyn_cast<VectorType>(LI->getType());
-+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(LI->getType());
- // Skip non-vector loads.
- if (!VTy)
- return 0;
-@@ -91,9 +92,12 @@ unsigned LdShrink::getExtractIndexMask(LoadInst* LI) const {
- Type* Ty = VTy->getScalarType();
- // Skip non-BYTE addressable data types. So far, check integer types
- // only.
-- if (IntegerType * ITy = dyn_cast<IntegerType>(Ty))
-- if (!ITy->isPowerOf2ByteWidth())
-+ if (IntegerType * ITy = dyn_cast<IntegerType>(Ty)) {
-+ // Unroll isPowerOf2ByteWidth, it was removed in LLVM 12.
-+ unsigned BitWidth = ITy->getBitWidth();
-+ if (!((BitWidth > 7) && isPowerOf2_32(BitWidth)))
- return 0;
-+ }
-
- unsigned Mask = 0; // Maxmimally 32 elements.
-
-diff --git a/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp b/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp
-index c12b20d5..5245117d 100644
---- a/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp
-+++ b/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp
-@@ -634,7 +634,7 @@ void TransposeHelper::handleGEPInst(
- }
- else
- {
-- arr_sz = (unsigned)cast<VectorType>(T)->getNumElements();
-+ arr_sz = (unsigned)cast<IGCLLVM::FixedVectorType>(T)->getNumElements();
- }
- T = cast<VectorType>(T)->getElementType();
- }
-@@ -656,7 +656,7 @@ void TransposeHelper::handleGEPInst(
- }
- else if (T->isVectorTy())
- {
-- arr_sz = (unsigned)cast<VectorType>(T)->getNumElements();
-+ arr_sz = (unsigned)cast<IGCLLVM::FixedVectorType>(T)->getNumElements();
- T = cast<VectorType>(T)->getElementType();
- }
- else
-@@ -716,7 +716,7 @@ void TransposeHelperPromote::handleLoadInst(
- IRBuilder<> IRB(pLoad);
- IGC_ASSERT(nullptr != pLoad->getType());
- unsigned N = pLoad->getType()->isVectorTy()
-- ? (unsigned)cast<VectorType>(pLoad->getType())->getNumElements()
-+ ? (unsigned)cast<IGCLLVM::FixedVectorType>(pLoad->getType())->getNumElements()
- : 1;
- Value* Val = loadEltsFromVecAlloca(N, pVecAlloca, pScalarizedIdx, IRB, pLoad->getType()->getScalarType());
- pLoad->replaceAllUsesWith(Val);
-@@ -748,7 +748,7 @@ void TransposeHelperPromote::handleStoreInst(
- // %v1 = extractelement <2 x float> %v, i32 1
- // %w1 = insertelement <32 x float> %w0, float %v1, i32 %idx+1
- // store <32 x float> %w1, <32 x float>* %ptr1
-- for (unsigned i = 0, e = (unsigned)cast<VectorType>(pStoreVal->getType())->getNumElements(); i < e; ++i)
-+ for (unsigned i = 0, e = (unsigned)cast<IGCLLVM::FixedVectorType>(pStoreVal->getType())->getNumElements(); i < e; ++i)
- {
- Value* VectorIdx = ConstantInt::get(pScalarizedIdx->getType(), i);
- auto Val = IRB.CreateExtractElement(pStoreVal, VectorIdx);
-diff --git a/IGC/Compiler/CISACodeGen/MemOpt.cpp b/IGC/Compiler/CISACodeGen/MemOpt.cpp
-index e4279cca..aa788b11 100644
---- a/IGC/Compiler/CISACodeGen/MemOpt.cpp
-+++ b/IGC/Compiler/CISACodeGen/MemOpt.cpp
-@@ -125,7 +125,7 @@ namespace {
- MemRefListTy& MemRefs, TrivialMemRefListTy& ToOpt);
-
- unsigned getNumElements(Type* Ty) const {
-- return Ty->isVectorTy() ? (unsigned)cast<VectorType>(Ty)->getNumElements() : 1;
-+ return Ty->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements() : 1;
- }
-
- MemoryLocation getLocation(Instruction* I) const {
-@@ -797,7 +797,7 @@ bool MemOpt::mergeLoad(LoadInst* LeadingLoad,
- Pos = unsigned((std::get<1>(I) - FirstOffset) / LdScalarSize);
-
- if (Ty->isVectorTy()) {
-- if (Pos + cast<VectorType>(Ty)->getNumElements() > NumElts) {
-+ if (Pos + cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements() > NumElts) {
- // This implies we're trying to extract an element from our new load
- // with an index > the size of the new load. If this happens,
- // we'll generate correct code if it does since we don't remove the
-@@ -805,7 +805,7 @@ bool MemOpt::mergeLoad(LoadInst* LeadingLoad,
- continue;
- }
- Value* Val = UndefValue::get(Ty);
-- for (unsigned i = 0, e = (unsigned)cast<VectorType>(Ty)->getNumElements(); i != e; ++i) {
-+ for (unsigned i = 0, e = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements(); i != e; ++i) {
- Value* Ex = Builder.CreateExtractElement(NewLoad, Builder.getInt32(Pos + i));
- Ex = createBitOrPointerCast(Ex, ScalarTy, Builder);
- Val = Builder.CreateInsertElement(Val, Ex, Builder.getInt32(i));
-@@ -1083,7 +1083,7 @@ bool MemOpt::mergeStore(StoreInst* LeadingStore,
- IGC_ASSERT(hasSameSize(ScalarTy, LeadingStoreScalarType));
-
- if (Ty->isVectorTy()) {
-- for (unsigned i = 0, e = (unsigned)cast<VectorType>(Ty)->getNumElements(); i != e; ++i) {
-+ for (unsigned i = 0, e = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements(); i != e; ++i) {
- Value* Ex = Builder.CreateExtractElement(Val, Builder.getInt32(i));
- Ex = createBitOrPointerCast(Ex, LeadingStoreScalarType, Builder);
- NewStoreVal = Builder.CreateInsertElement(NewStoreVal, Ex,
-diff --git a/IGC/Compiler/CISACodeGen/MemOpt2.cpp b/IGC/Compiler/CISACodeGen/MemOpt2.cpp
-index 4b2628d2..20115c73 100644
---- a/IGC/Compiler/CISACodeGen/MemOpt2.cpp
-+++ b/IGC/Compiler/CISACodeGen/MemOpt2.cpp
-@@ -32,6 +32,7 @@ IN THE SOFTWARE.
- #include <llvm/Support/Debug.h>
- #include <llvm/Support/raw_ostream.h>
- #include <llvm/Transforms/Utils/Local.h>
-+#include <llvmWrapper/IR/DerivedTypes.h>
- #include "common/LLVMWarningsPop.hpp"
- #include "GenISAIntrinsics/GenIntrinsics.h"
-
-@@ -124,7 +125,7 @@ namespace {
- if (!Ty->isSingleValueType())
- return UINT_MAX;
- // Simply return 1 so far for scalar types.
-- VectorType* VecTy = dyn_cast<VectorType>(Ty);
-+ IGCLLVM::FixedVectorType* VecTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
- if (!VecTy)
- return 1;
- // Check how that vector is used.
-@@ -153,7 +154,7 @@ namespace {
- return UINT_MAX;
- unsigned EltByte = (Ty->getScalarSizeInBits() + 7) / 8;
- // Simply return 1 so far for scalar types.
-- VectorType* VecTy = dyn_cast<VectorType>(Ty);
-+ IGCLLVM::FixedVectorType* VecTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
- if (!VecTy)
- return EltByte;
- // Check how that vector is used.
-diff --git a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp
-index 5baff64f..032d127a 100644
---- a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp
-+++ b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp
-@@ -410,7 +410,7 @@ namespace IGC
- unsigned int numElements = 1;
- if (baseType->isVectorTy())
- {
-- numElements = (unsigned)cast<VectorType>(baseType)->getNumElements();
-+ numElements = (unsigned)cast<IGCLLVM::FixedVectorType>(baseType)->getNumElements();
- baseType = cast<VectorType>(baseType)->getElementType();
- }
-
-diff --git a/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp b/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp
-index 356f1141..52396304 100644
---- a/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp
-+++ b/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp
-@@ -2916,8 +2916,8 @@ namespace IGC
- llvm::Type* srcTy = bTInst->getOperand(0)->getType();
- llvm::Type* dstTy = bTInst->getType();
-
-- srcNElts = (srcTy->isVectorTy()) ? (uint32_t)cast<VectorType>(srcTy)->getNumElements() : 1;
-- dstNElts = (dstTy->isVectorTy()) ? (uint32_t)cast<VectorType>(dstTy)->getNumElements() : 1;
-+ srcNElts = (srcTy->isVectorTy()) ? (uint32_t)cast<IGCLLVM::FixedVectorType>(srcTy)->getNumElements() : 1;
-+ dstNElts = (dstTy->isVectorTy()) ? (uint32_t)cast<IGCLLVM::FixedVectorType>(dstTy)->getNumElements() : 1;
-
- if (srcNElts < dstNElts && srcTy->getScalarSizeInBits() < 64)
- {
-diff --git a/IGC/Compiler/CISACodeGen/PushAnalysis.cpp b/IGC/Compiler/CISACodeGen/PushAnalysis.cpp
-index ba8c2770..8da82db0 100644
---- a/IGC/Compiler/CISACodeGen/PushAnalysis.cpp
-+++ b/IGC/Compiler/CISACodeGen/PushAnalysis.cpp
-@@ -899,7 +899,7 @@ namespace IGC
-
- if (pTypeToPush->isVectorTy())
- {
-- num_elms = (unsigned)cast<VectorType>(pTypeToPush)->getNumElements();
-+ num_elms = (unsigned)cast<IGCLLVM::FixedVectorType>(pTypeToPush)->getNumElements();
- pTypeToPush = cast<VectorType>(pTypeToPush)->getElementType();
- llvm::Type* pVecTy = IGCLLVM::FixedVectorType::get(pTypeToPush, num_elms);
- pReplacedInst = llvm::UndefValue::get(pVecTy);
-@@ -1102,7 +1102,7 @@ namespace IGC
- }
-
- unsigned num_elms =
-- inst->getType()->isVectorTy() ? (unsigned)cast<VectorType>(inst->getType())->getNumElements() : 1;
-+ inst->getType()->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements() : 1;
- llvm::Type* pTypeToPush = inst->getType();
- llvm::Value* replaceVector = nullptr;
- unsigned int numberChannelReplaced = 0;
-diff --git a/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp b/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp
-index 95b937e7..1c6544a4 100644
---- a/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp
-+++ b/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp
-@@ -41,6 +41,7 @@ IN THE SOFTWARE.
- #include <llvm/IR/IRBuilder.h>
- #include <llvm/IR/InstIterator.h>
- #include <llvm/Support/MathExtras.h>
-+#include <llvmWrapper/IR/DerivedTypes.h>
- #include "common/LLVMWarningsPop.hpp"
- #include "Probe/Assertion.h"
-
-@@ -146,7 +147,7 @@ RegUse RegisterEstimator::estimateNumOfRegs(Value* V) const
- Type* Ty = V->getType();
- if (!Ty->isVoidTy())
- {
-- VectorType* VTy = dyn_cast<VectorType>(Ty);
-+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
- Type* eltTy = VTy ? VTy->getElementType() : Ty;
- uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
- uint32_t eltBits = (uint32_t)m_DL->getTypeSizeInBits(eltTy);
-diff --git a/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp b/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp
-index beac138d..ceeafa48 100644
---- a/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp
-+++ b/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp
-@@ -42,6 +42,7 @@ See LRCENSE.TXT for details.
- #include "llvm/Pass.h"
- #include <llvm/IR/InstVisitor.h>
- #include "llvm/Analysis/LoopInfo.h"
-+#include <llvmWrapper/IR/DerivedTypes.h>
- #include "common/LLVMWarningsPop.hpp"
- #include "Compiler/IGCPassSupport.h"
- #include "Compiler/CISACodeGen/WIAnalysis.hpp"
-@@ -240,7 +241,7 @@ namespace IGC
- auto Ty = V->getType();
- if (Ty->isVoidTy())
- return 0;
-- auto VTy = llvm::dyn_cast<llvm::VectorType>(Ty);
-+ auto VTy = llvm::dyn_cast<IGCLLVM::FixedVectorType>(Ty);
- auto eltTy = VTy ? VTy->getElementType() : Ty;
- uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
- uint32_t eltBits = (uint32_t)m_DL->getTypeSizeInBits(eltTy);
-diff --git a/IGC/Compiler/CISACodeGen/SLMConstProp.cpp b/IGC/Compiler/CISACodeGen/SLMConstProp.cpp
-index 962083f4..26a7b8be 100644
---- a/IGC/Compiler/CISACodeGen/SLMConstProp.cpp
-+++ b/IGC/Compiler/CISACodeGen/SLMConstProp.cpp
-@@ -39,6 +39,7 @@ IN THE SOFTWARE.
- #include <llvm/IR/InstIterator.h>
- #include <llvm/Support/Debug.h>
- #include <llvm/Support/MathExtras.h>
-+#include "llvmWrapper/IR/DerivedTypes.h"
- #include "common/LLVMWarningsPop.hpp"
- #include <vector>
- #include "Probe/Assertion.h"
-@@ -629,7 +630,7 @@ bool SLMConstProp::isEqual(Constant* C0, Constant* C1)
-
- bool SLMConstProp::isFloatType(Type* Ty)
- {
-- if (VectorType * vTy = dyn_cast<VectorType>(Ty))
-+ if (IGCLLVM::FixedVectorType * vTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty))
- {
- if (vTy->getNumElements() > 1)
- {
-diff --git a/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp b/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp
-index ce816416..32ab79c1 100644
---- a/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp
-+++ b/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp
-@@ -66,7 +66,7 @@ void ScalarizerCodeGen::visitBinaryOperator(llvm::BinaryOperator& I)
- {
- bool isNewTypeVector = false;
-
-- VectorType* instType = cast<VectorType>(I.getType());
-+ IGCLLVM::FixedVectorType* instType = cast<IGCLLVM::FixedVectorType>(I.getType());
- unsigned numElements = int_cast<unsigned>(instType->getNumElements());
- unsigned scalarSize = instType->getScalarSizeInBits();
- unsigned newScalarBits = numElements * scalarSize;
-@@ -111,7 +111,7 @@ void ScalarizerCodeGen::visitBinaryOperator(llvm::BinaryOperator& I)
- }
- else
- {
-- VectorType* newVecType = cast<VectorType>(newType);
-+ IGCLLVM::FixedVectorType* newVecType = cast<IGCLLVM::FixedVectorType>(newType);
- unsigned newVecTypeNumEle = int_cast<unsigned>(newVecType->getNumElements());
- Value* ieLogicOp = UndefValue::get(newType);
- for (unsigned i = 0; i < newVecTypeNumEle; i++)
-diff --git a/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp b/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp
-index d7baf806..e6fbdf23 100644
---- a/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp
-+++ b/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp
-@@ -589,12 +589,14 @@ static void AddLegalizationPasses(CodeGenContext& ctx, IGCPassManager& mpm, PSSi
- {
- mpm.add(createPruneUnusedArgumentsPass());
-
-+#if LLVM_VERSION_MAJOR < 12
- if (IGC_GET_FLAG_VALUE(FunctionControl) == FLAG_FCALL_DEFAULT)
- {
- // Don't run IPConstantProp when debugging function calls, to avoid folding function arg/ret constants
- mpm.add(createIPConstantPropagationPass());
- }
- mpm.add(createConstantPropagationPass());
-+#endif
- mpm.add(createDeadCodeEliminationPass());
- mpm.add(createCFGSimplificationPass());
- }
-@@ -1475,8 +1477,10 @@ void OptimizeIR(CodeGenContext* const pContext)
- // possible which potentially allows late stage code sinking of
- // those calls by the instruction combiner.
- mpm.add(createPostOrderFunctionAttrsLegacyPass());
-+#if LLVM_VERSION_MAJOR < 12
- mpm.add(createConstantPropagationPass());
- mpm.add(createIPConstantPropagationPass());
-+#endif
- }
-
- // enable this only when Pooled EU is not supported
-diff --git a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
-index 87ba2751..c1f4a419 100644
---- a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
-+++ b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
-@@ -30,6 +30,7 @@ IN THE SOFTWARE.
- #include <llvmWrapper/IR/DerivedTypes.h>
- #include <llvm/IR/InstIterator.h>
- #include <llvm/IR/Operator.h>
-+#include <llvmWrapper/IR/DerivedTypes.h>
- #include "common/LLVMWarningsPop.hpp"
- #include "GenISAIntrinsics/GenIntrinsics.h"
- #include "GenISAIntrinsics/GenIntrinsicInst.h"
-@@ -577,7 +578,7 @@ static bool isPayloadHeader(Value* V) {
- Argument* Arg = dyn_cast<Argument>(V);
- if (!Arg || !Arg->hasName())
- return false;
-- VectorType* VTy = dyn_cast<VectorType>(Arg->getType());
-+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Arg->getType());
- if (!VTy || VTy->getNumElements() != 8 ||
- !VTy->getElementType()->isIntegerTy(32))
- return false;
-@@ -588,7 +589,7 @@ static bool isR0(Value* V) {
- Argument* Arg = dyn_cast<Argument>(V);
- if (!Arg || !Arg->hasName())
- return false;
-- VectorType* VTy = dyn_cast<VectorType>(Arg->getType());
-+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Arg->getType());
- if (!VTy || VTy->getNumElements() != 8 ||
- !VTy->getElementType()->isIntegerTy(32))
- return false;
-@@ -599,7 +600,7 @@ static bool isEnqueuedLocalSize(Value* V) {
- Argument* Arg = dyn_cast<Argument>(V);
- if (!Arg || !Arg->hasName())
- return false;
-- VectorType* VTy = dyn_cast<VectorType>(Arg->getType());
-+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Arg->getType());
- if (!VTy || VTy->getNumElements() != 3 ||
- !VTy->getElementType()->isIntegerTy(32))
- return false;
-@@ -994,7 +995,11 @@ static bool hasLongStridedLdStInLoop(Function* F, LoopInfo* LI, WIAnalysis* WI)
- // Collect innermost simple loop.
- for (auto I = LI->begin(), E = LI->end(); I != E; ++I) {
- auto L = *I;
-+#if LLVM_VERSION_MAJOR >= 12
-+ if (!L->isInnermost())
-+#else
- if (!L->empty())
-+#endif
- continue;
- if (L->getNumBlocks() != 2)
- continue;
-diff --git a/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp b/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp
-index 73f472b5..0069c4b1 100644
---- a/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp
-+++ b/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp
-@@ -352,7 +352,7 @@ static unsigned getLegalVectorSize(unsigned N) {
- // Check vector size. We may demote the data type if all values can fit into
- // smaller data type.
- //
--static bool checkSize(GlobalVariable* GV, VectorType*& DataType,
-+static bool checkSize(GlobalVariable* GV, IGCLLVM::FixedVectorType*& DataType,
- bool& IsSigned) {
- Constant* Init = GV->getInitializer();
- IGC_ASSERT(isa<ArrayType>(Init->getType()));
-@@ -360,7 +360,7 @@ static bool checkSize(GlobalVariable* GV, VectorType*& DataType,
- unsigned N = (unsigned)ArrayTy->getArrayNumElements();
- Type* BaseTy = ArrayTy->getArrayElementType();
- unsigned VectorSize = 1;
-- if (auto VT = dyn_cast<VectorType>(BaseTy)) {
-+ if (auto VT = dyn_cast<IGCLLVM::FixedVectorType>(BaseTy)) {
- BaseTy = VT->getElementType();
- VectorSize = int_cast<unsigned>(VT->getNumElements());
- N *= VectorSize;
-@@ -483,7 +483,7 @@ static Constant* getConstantVal(Type* VEltTy, Constant* V, bool IsSigned) {
- return ConstantInt::get(VEltTy, IVal, IsSigned);
- }
-
--static void promote(GlobalVariable* GV, VectorType* AllocaType, bool IsSigned,
-+static void promote(GlobalVariable* GV, IGCLLVM::FixedVectorType* AllocaType, bool IsSigned,
- Function* F) {
- // Build the constant vector from constant array.
- unsigned VS = int_cast<unsigned>(AllocaType->getNumElements());
-@@ -507,7 +507,7 @@ static void promote(GlobalVariable* GV, VectorType* AllocaType, bool IsSigned,
- Constant* const Elt = CA->getAggregateElement(i);
- IGC_ASSERT_MESSAGE(nullptr != Elt, "Null AggregateElement");
- if (auto EltTy = dyn_cast<VectorType>(Elt->getType())) {
-- unsigned VectorSize = (unsigned)cast<VectorType>(EltTy)->getNumElements();
-+ unsigned VectorSize = (unsigned)cast<IGCLLVM::FixedVectorType>(EltTy)->getNumElements();
- for (unsigned j = 0; j < VectorSize; ++j) {
- Constant* V = Elt->getAggregateElement(j);
- Vals[i * VectorSize + j] = getConstantVal(VEltTy, V, IsSigned);
-@@ -549,7 +549,7 @@ static void promote(GlobalVariable* GV, VectorType* AllocaType, bool IsSigned,
- unsigned N = 1;
- Value* Offset = Index;
- if (Ty->isVectorTy()) {
-- N = (unsigned)cast<VectorType>(Ty)->getNumElements();
-+ N = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements();
- Offset = Builder.CreateMul(Offset, ConstantInt::get(Offset->getType(), N));
- }
- Value* Val = extractNElts(N, VectorData, Offset, Builder);
-@@ -684,7 +684,7 @@ bool PromoteConstant::runOnFunction(Function& F) {
-
- // If possible demote the data into smaller type. Uses of value will be
- // promoted back with ZExt or SExt.
-- VectorType* AllocaType = nullptr;
-+ IGCLLVM::FixedVectorType* AllocaType = nullptr;
- bool IsSigned = false;
- if (!checkSize(GV, AllocaType, IsSigned))
- continue;
-diff --git a/IGC/Compiler/CISACodeGen/TypeDemote.cpp b/IGC/Compiler/CISACodeGen/TypeDemote.cpp
-index eb7a7b64..b04a0f6e 100644
---- a/IGC/Compiler/CISACodeGen/TypeDemote.cpp
-+++ b/IGC/Compiler/CISACodeGen/TypeDemote.cpp
-@@ -32,6 +32,7 @@ IN THE SOFTWARE.
- #include <llvm/ADT/PostOrderIterator.h>
- #include <llvm/IR/IRBuilder.h>
- #include <llvm/Pass.h>
-+#include <llvmWrapper/IR/DerivedTypes.h>
- #include "common/LLVMWarningsPop.hpp"
- #include "GenISAIntrinsics/GenIntrinsics.h"
- #include "Probe/Assertion.h"
-@@ -288,7 +289,7 @@ bool TypeDemote::demoteOnBasicBlock(BasicBlock* BB) const {
- CastInst* CI = dyn_cast<CastInst>(Index);
- if (CI && (CI->getOpcode() == Instruction::ZExt ||
- CI->getOpcode() == Instruction::SExt)) {
-- unsigned VS = (unsigned)cast<VectorType>(EEI->getVectorOperandType())->getNumElements();
-+ unsigned VS = (unsigned)cast<IGCLLVM::FixedVectorType>(EEI->getVectorOperandType())->getNumElements();
- unsigned N = (unsigned int)CI->getSrcTy()->getPrimitiveSizeInBits();
- unsigned Bound = (N < 32) ? (1U << N) : UINT32_MAX;
- if (VS <= Bound) {
-diff --git a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp
-index 1cac7b12..12c4734e 100644
---- a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp
-+++ b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp
-@@ -28,6 +28,7 @@ IN THE SOFTWARE.
- #include "Compiler/CodeGenPublic.h"
- #include "common/LLVMWarningsPush.hpp"
- #include <llvm/Support/Debug.h>
-+#include "llvmWrapper/IR/DerivedTypes.h"
- #include "common/LLVMWarningsPop.hpp"
- #include <algorithm>
- #include "Probe/Assertion.h"
-@@ -40,13 +41,13 @@ namespace
- // If V is scalar, return 1.
- // if V is vector, return the number of elements.
- inline int getNumElts(Value* V) {
-- VectorType* VTy = dyn_cast<VectorType>(V->getType());
-+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(V->getType());
- return VTy ? (int)VTy->getNumElements() : 1;
- }
-
- inline int getTypeSizeInBits(Type* Ty) {
- int scalarBits = Ty->getScalarSizeInBits();
-- VectorType* VTy = dyn_cast<VectorType>(Ty);
-+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
- return scalarBits * (VTy ? (int)VTy->getNumElements() : 1);
- }
- }
-diff --git a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp
-index 56dac17e..42081dca 100644
---- a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp
-+++ b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp
-@@ -37,6 +37,7 @@ IN THE SOFTWARE.
- #include <llvm/IR/InstIterator.h>
- #include <llvm/IR/InstVisitor.h>
- #include "llvm/Pass.h"
-+#include "llvmWrapper/IR/DerivedTypes.h"
- #include "llvm/Support/raw_ostream.h"
- #include "common/LLVMWarningsPop.hpp"
- #include "Compiler/CISACodeGen/RegisterEstimator.hpp"
-@@ -79,7 +80,7 @@ namespace IGC {
- SSubVecDesc(llvm::Value* V)
- : Aliaser(V), BaseVector(V), StartElementOffset(0)
- {
-- llvm::VectorType* VTy = llvm::dyn_cast<llvm::VectorType>(V->getType());
-+ IGCLLVM::FixedVectorType* VTy = llvm::dyn_cast<IGCLLVM::FixedVectorType>(V->getType());
- NumElts = VTy ? (short)VTy->getNumElements() : 1;
- }
-
-diff --git a/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp b/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp
-index 4c2b0644..4cd6a2db 100644
---- a/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp
-+++ b/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp
-@@ -500,7 +500,7 @@ void VectorPreProcess::replaceAllVectorUsesWithScalars(Instruction* VI, ValVecto
- I = VI->getParent()->getFirstNonPHI();
- }
- IRBuilder<> Builder(I);
-- VectorType* VTy = cast<VectorType>(VI->getType());
-+ IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(VI->getType());
- Value* newVec = UndefValue::get(VTy);
- for (uint32_t i = 0, e = int_cast<uint32_t>(VTy->getNumElements()); i < e; ++i)
- {
-@@ -619,7 +619,7 @@ bool VectorPreProcess::splitStore(
- {
- Instruction* SI = ASI.getInst();
- Value* StoredVal = ASI.getValueOperand();
-- VectorType* VTy = cast<VectorType>(StoredVal->getType());
-+ IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(StoredVal->getType());
- Type* ETy = VTy->getElementType();
- uint32_t nelts = int_cast<uint32_t>(VTy->getNumElements());
-
-@@ -705,7 +705,7 @@ bool VectorPreProcess::splitStore(
- {
- Type* Ty1 = splitInfo[i].first;
- uint32_t len1 = splitInfo[i].second;
-- VectorType* VTy1 = dyn_cast<VectorType>(Ty1);
-+ IGCLLVM::FixedVectorType* VTy1 = dyn_cast<IGCLLVM::FixedVectorType>(Ty1);
- for (uint32_t j = 0; j < len1; ++j)
- {
- Value* subVec;
-@@ -742,7 +742,7 @@ bool VectorPreProcess::splitStore(
- {
- Type* Ty1 = splitInfo[i].first;
- uint32_t len1 = splitInfo[i].second;
-- VectorType* VTy1 = dyn_cast<VectorType>(Ty1);
-+ IGCLLVM::FixedVectorType* VTy1 = dyn_cast<IGCLLVM::FixedVectorType>(Ty1);
- for (uint32_t j = 0; j < len1; ++j)
- {
- uint32_t vAlign = (uint32_t)MinAlign(Align, (uint32_t)eOffset * EBytes);
-@@ -786,7 +786,7 @@ bool VectorPreProcess::splitLoad(
- {
- Instruction* LI = ALI.getInst();
- bool isLdRaw = isa<LdRawIntrinsic>(LI);
-- VectorType* VTy = cast<VectorType>(LI->getType());
-+ IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(LI->getType());
- Type* ETy = VTy->getElementType();
- uint32_t nelts = int_cast<uint32_t>(VTy->getNumElements());
-
-@@ -848,7 +848,7 @@ bool VectorPreProcess::splitLoad(
- {
- Type* Ty1 = splitInfo[i].first;
- uint32_t len1 = splitInfo[i].second;
-- VectorType* VTy1 = dyn_cast<VectorType>(Ty1);
-+ IGCLLVM::FixedVectorType* VTy1 = dyn_cast<IGCLLVM::FixedVectorType>(Ty1);
- for (uint32_t j = 0; j < len1; ++j)
- {
- uint32_t vAlign = (uint32_t)MinAlign(Align, eOffset * EBytes);
-@@ -916,7 +916,7 @@ bool VectorPreProcess::splitLoadStore(
- Optional<AbstractStoreInst> ASI = AbstractStoreInst::get(Inst);
- IGC_ASSERT_MESSAGE((ALI || ASI), "Inst should be either load or store");
- Type* Ty = ALI ? ALI->getInst()->getType() : ASI->getValueOperand()->getType();
-- VectorType* VTy = dyn_cast<VectorType>(Ty);
-+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
- if (!VTy)
- {
- return false;
-@@ -1147,7 +1147,7 @@ void VectorPreProcess::getOrGenScalarValues(
- {
- availBeforeInst = nullptr;
-
-- VectorType* VTy = cast<VectorType>(VecVal->getType());
-+ IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(VecVal->getType());
- if (!VTy)
- {
- scalars[0] = VecVal;
-@@ -1298,7 +1298,7 @@ Instruction* VectorPreProcess::simplifyLoadStore(Instruction* Inst)
- //
- // TODO: further optimize this load into a message with channel masks
- // for cases in which use indices are sparse like {0, 2}.
-- unsigned N = (unsigned)cast<VectorType>(Inst->getType())->getNumElements();
-+ unsigned N = (unsigned)cast<IGCLLVM::FixedVectorType>(Inst->getType())->getNumElements();
- if (N == MaxIndex + 1)
- return Inst;
-
-@@ -1355,7 +1355,7 @@ Instruction* VectorPreProcess::simplifyLoadStore(Instruction* Inst)
- if (NBits < 32)
- return Inst;
-
-- unsigned N = (unsigned)cast<VectorType>(Val->getType())->getNumElements();
-+ unsigned N = (unsigned)cast<IGCLLVM::FixedVectorType>(Val->getType())->getNumElements();
- if (auto CV = dyn_cast<ConstantVector>(Val))
- {
- unsigned MaxIndex = 0;
-@@ -1524,7 +1524,7 @@ bool VectorPreProcess::runOnFunction(Function& F)
- for (uint32_t j = 0; j < svals.size(); ++j)
- {
- Type* Ty1 = svals[j]->getType();
-- VectorType* VTy1 = dyn_cast<VectorType>(Ty1);
-+ IGCLLVM::FixedVectorType* VTy1 = dyn_cast<IGCLLVM::FixedVectorType>(Ty1);
- if (VTy1) {
- for (uint32_t k = 0; k < VTy1->getNumElements(); ++k)
- {
-@@ -1573,7 +1573,7 @@ bool VectorPreProcess::runOnFunction(Function& F)
- // If this is a 3-element vector load, remove it
- // from m_Vector3List as well.
- if (isAbstractLoadInst(tInst) && tInst->getType()->isVectorTy() &&
-- cast<VectorType>(tInst->getType())->getNumElements() == 3)
-+ cast<IGCLLVM::FixedVectorType>(tInst->getType())->getNumElements() == 3)
- {
- InstWorkVector::iterator
- tI = m_Vector3List.begin(),
-diff --git a/IGC/Compiler/CISACodeGen/VectorProcess.cpp b/IGC/Compiler/CISACodeGen/VectorProcess.cpp
-index 9f39cdc0..cfe45321 100644
---- a/IGC/Compiler/CISACodeGen/VectorProcess.cpp
-+++ b/IGC/Compiler/CISACodeGen/VectorProcess.cpp
-@@ -240,7 +240,7 @@ bool VectorProcess::reLayoutLoadStore(Instruction* Inst)
- IGC_ASSERT(nullptr != Ptr);
- IGC_ASSERT(nullptr != Ty);
-
-- VectorType* const VTy = dyn_cast<VectorType>(Ty);
-+ IGCLLVM::FixedVectorType* const VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
-
- // Treat a scalar as 1-element vector
- uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
-@@ -654,7 +654,7 @@ void VectorMessage::getInfo(Type* Ty, uint32_t Align, bool useA32,
- VectorType* VTy = dyn_cast<VectorType>(Ty);
- Type* eTy = VTy ? cast<VectorType>(VTy)->getElementType() : Ty;
- unsigned eltSize = m_emitter->GetScalarTypeSizeInRegister(eTy);
-- unsigned nElts = VTy ? (unsigned)cast<VectorType>(VTy)->getNumElements() : 1;
-+ unsigned nElts = VTy ? (unsigned)cast<IGCLLVM::FixedVectorType>(VTy)->getNumElements() : 1;
- // total bytes
- const unsigned TBytes = nElts * eltSize;
-
-diff --git a/IGC/Compiler/CISACodeGen/helper.cpp b/IGC/Compiler/CISACodeGen/helper.cpp
-index 784affaa..e5507283 100644
---- a/IGC/Compiler/CISACodeGen/helper.cpp
-+++ b/IGC/Compiler/CISACodeGen/helper.cpp
-@@ -1634,7 +1634,7 @@ namespace IGC
- {
- instList[i] = builder.CreateExtractElement(val, static_cast<uint64_t>(0));
- size_t iOld = i;
-- for (unsigned j = 1; j < cast<VectorType>(val->getType())->getNumElements(); j++)
-+ for (unsigned j = 1; j < cast<IGCLLVM::FixedVectorType>(val->getType())->getNumElements(); j++)
- {
- instList.insert(instList.begin()+ iOld +j, builder.CreateExtractElement(val, j));
- i++;
-@@ -1667,7 +1667,7 @@ namespace IGC
- }
- break;
- case IGCLLVM::VectorTyID:
-- num = (unsigned)cast<VectorType>(type)->getNumElements();
-+ num = (unsigned)cast<IGCLLVM::FixedVectorType>(type)->getNumElements();
- for (unsigned i = 0; i < num; i++)
- {
- ScalarizeAggregateMembers(builder, builder.CreateExtractElement(val, i), instList);
-@@ -1707,7 +1707,7 @@ namespace IGC
- }
- break;
- case IGCLLVM::VectorTyID:
-- num = (unsigned)cast<VectorType>(type)->getNumElements();
-+ num = (unsigned)cast<IGCLLVM::FixedVectorType>(type)->getNumElements();
- for (unsigned i = 0; i < num; i++)
- {
- indices.push_back(builder.getInt32(i));
-@@ -1972,8 +1972,8 @@ namespace IGC
- return false;
- }
-
-- VectorType* dVTy = dyn_cast<VectorType>(dTy);
-- VectorType* sVTy = dyn_cast<VectorType>(sTy);
-+ IGCLLVM::FixedVectorType* dVTy = dyn_cast<IGCLLVM::FixedVectorType>(dTy);
-+ IGCLLVM::FixedVectorType* sVTy = dyn_cast<IGCLLVM::FixedVectorType>(sTy);
- int d_nelts = dVTy ? (int)dVTy->getNumElements() : 1;
- int s_nelts = sVTy ? (int)sVTy->getNumElements() : 1;
- if (d_nelts != s_nelts) {
-diff --git a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
-index cd7fc66e..adf992cb 100644
---- a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
-+++ b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
-@@ -153,15 +153,24 @@ void ConvertMSAAPayloadTo16Bit::visitCallInst(CallInst& I)
- // In OGL there are uses of ldmcs other then ldms, using vec4float type.
- // Fix them to use newly created 16bit ldmcs.
- if (ldmcs->getType()->isVectorTy() &&
-+#if LLVM_VERSION_MAJOR >= 12
-+ ldmcs->getType()->getScalarType()->isFloatTy())
-+#else
- ldmcs->getType()->getVectorElementType()->isFloatTy())
-+#endif
- {
- m_builder->SetInsertPoint(ldmcs);
-
-+#if LLVM_VERSION_MAJOR >= 12
-+ uint ldmcsNumOfElements = cast<IGCLLVM::FixedVectorType>(ldmcs->getType())->getNumElements();
-+ uint new_mcs_callNumOfElements = cast<IGCLLVM::FixedVectorType>(new_mcs_call->getType())->getNumElements();
-+#else
- uint ldmcsNumOfElements = ldmcs->getType()->getVectorNumElements();
- uint new_mcs_callNumOfElements = new_mcs_call->getType()->getVectorNumElements();
-+#endif
-
- // vec of 16bit ints to vec of 32bit ints
-- Type* new_mcs_callVecType = VectorType::get(m_builder->getInt32Ty(), new_mcs_callNumOfElements);
-+ Type* new_mcs_callVecType = IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), new_mcs_callNumOfElements);
- Value* ldmcsExtendedToInt32 = m_builder->CreateSExt(new_mcs_call, new_mcs_callVecType);
-
- // if new ldmcs has fewer elements than ldmcs, extend vector
-@@ -175,7 +184,7 @@ void ConvertMSAAPayloadTo16Bit::visitCallInst(CallInst& I)
- }
- auto* pMask = ConstantDataVector::get(I.getContext(), maskVals);
-
-- newLdmcsSizedVector = m_builder->CreateShuffleVector(ldmcsExtendedToInt32, UndefValue::get(VectorType::get(m_builder->getInt32Ty(), ldmcsNumOfElements)), pMask);
-+ newLdmcsSizedVector = m_builder->CreateShuffleVector(ldmcsExtendedToInt32, UndefValue::get(IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), ldmcsNumOfElements)), pMask);
- }
- else
- {
-@@ -183,7 +192,7 @@ void ConvertMSAAPayloadTo16Bit::visitCallInst(CallInst& I)
- }
- IGC_ASSERT(newLdmcsSizedVector);
-
-- Type* ldmcsFloatVecType = VectorType::get(m_builder->getFloatTy(), ldmcsNumOfElements);
-+ Type* ldmcsFloatVecType = IGCLLVM::FixedVectorType::get(m_builder->getFloatTy(), ldmcsNumOfElements);
- Value* ldmcsBitcastedToFloat = m_builder->CreateBitCast(ldmcsExtendedToInt32, ldmcsFloatVecType);
- ldmcs->replaceAllUsesWith(ldmcsBitcastedToFloat);
- }
-diff --git a/IGC/Compiler/CustomSafeOptPass.cpp b/IGC/Compiler/CustomSafeOptPass.cpp
-index 707bbfbe..72859a91 100644
---- a/IGC/Compiler/CustomSafeOptPass.cpp
-+++ b/IGC/Compiler/CustomSafeOptPass.cpp
-@@ -1372,7 +1372,7 @@ void IGC::CustomSafeOptPass::visitSampleBptr(llvm::SampleIntrinsic* sampleInst)
- bool CustomSafeOptPass::isIdentityMatrix(ExtractElementInst& I)
- {
- bool found = false;
-- auto extractType = cast<VectorType>(I.getVectorOperandType());
-+ auto extractType = cast<IGCLLVM::FixedVectorType>(I.getVectorOperandType());
- auto extractTypeVecSize = (uint32_t)extractType->getNumElements();
- if (extractTypeVecSize == 20 ||
- extractTypeVecSize == 16)
-@@ -1601,7 +1601,7 @@ void CustomSafeOptPass::visitExtractElementInst(ExtractElementInst& I)
- int elOffset = (int)(bitShift / eltSize);
- elOffset = rightShift ? elOffset : -elOffset;
- unsigned int newIndex = (unsigned int)((int)cstIndex->getZExtValue() + elOffset);
-- if (newIndex < cast<VectorType>(vecType)->getNumElements())
-+ if (newIndex < cast<IGCLLVM::FixedVectorType>(vecType)->getNumElements())
- {
- IRBuilder<> builder(&I);
- Value* newBitCast = builder.CreateBitCast(binOp->getOperand(0), vecType);
-@@ -2001,7 +2001,7 @@ void GenSpecificPattern::createBitcastExtractInsertPattern(BinaryOperator& I, Va
- else if (auto IEIInst = dyn_cast<InsertElementInst>(Op))
- {
- auto opType = IEIInst->getType();
-- if (opType->isVectorTy() && cast<VectorType>(opType)->getElementType()->isIntegerTy(32) && cast<VectorType>(opType)->getNumElements() == 2)
-+ if (opType->isVectorTy() && cast<VectorType>(opType)->getElementType()->isIntegerTy(32) && cast<IGCLLVM::FixedVectorType>(opType)->getNumElements() == 2)
- {
- elem = IEIInst->getOperand(1);
- }
-@@ -2064,7 +2064,7 @@ void GenSpecificPattern::visitBinaryOperator(BinaryOperator& I)
- else if (match(&I, pattern2) && AndOp2->getType()->isIntegerTy(64))
- {
- ConstantVector* cVec = dyn_cast<ConstantVector>(VecOp);
-- VectorType* vector_type = dyn_cast<VectorType>(VecOp->getType());
-+ IGCLLVM::FixedVectorType* vector_type = dyn_cast<IGCLLVM::FixedVectorType>(VecOp->getType());
- if (cVec && vector_type &&
- isa<ConstantInt>(cVec->getOperand(0)) &&
- cast<ConstantInt>(cVec->getOperand(0))->isZero() &&
-@@ -2210,7 +2210,7 @@ void GenSpecificPattern::visitBinaryOperator(BinaryOperator& I)
- BitCastInst* opBC = cast<BitCastInst>(op);
-
- auto opType = opBC->getType();
-- if (!(opType->isVectorTy() && cast<VectorType>(opType)->getElementType()->isIntegerTy(32) && cast<VectorType>(opType)->getNumElements() == 2))
-+ if (!(opType->isVectorTy() && cast<VectorType>(opType)->getElementType()->isIntegerTy(32) && cast<IGCLLVM::FixedVectorType>(opType)->getNumElements() == 2))
- return nullptr;
-
- if (opBC->getSrcTy()->isDoubleTy())
-@@ -2630,8 +2630,8 @@ void GenSpecificPattern::visitBitCastInst(BitCastInst& I)
- if (zExtInst->getOperand(0)->getType()->isIntegerTy(32) &&
- isa<InsertElementInst>(bitCastInst->getOperand(0)) &&
- bitCastInst->getOperand(0)->getType()->isVectorTy() &&
-- cast<VectorType>(bitCastInst->getOperand(0)->getType())->getElementType()->isIntegerTy(32) &&
-- cast<VectorType>(bitCastInst->getOperand(0)->getType())->getNumElements() == 2)
-+ cast<IGCLLVM::FixedVectorType>(bitCastInst->getOperand(0)->getType())->getElementType()->isIntegerTy(32) &&
-+ cast<IGCLLVM::FixedVectorType>(bitCastInst->getOperand(0)->getType())->getNumElements() == 2)
- {
- InsertElementInst* insertElementInst = cast<InsertElementInst>(bitCastInst->getOperand(0));
-
-@@ -2731,7 +2731,7 @@ void GenSpecificPattern::visitFNeg(llvm::UnaryOperator& I)
- }
- else
- {
-- uint32_t vectorSize = cast<VectorType>(I.getType())->getNumElements();
-+ uint32_t vectorSize = cast<IGCLLVM::FixedVectorType>(I.getType())->getNumElements();
- fsub = llvm::UndefValue::get(I.getType());
-
- for (uint32_t i = 0; i < vectorSize; ++i)
-@@ -2845,7 +2845,7 @@ Constant* IGCConstProp::replaceShaderConstant(LoadInst* inst)
- if (inst->getType()->isVectorTy())
- {
- Type* srcEltTy = cast<VectorType>(inst->getType())->getElementType();
-- uint32_t srcNElts = (uint32_t)cast<VectorType>(inst->getType())->getNumElements();
-+ uint32_t srcNElts = (uint32_t)cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements();
- uint32_t eltSize_in_bytes = (unsigned int)srcEltTy->getPrimitiveSizeInBits() / 8;
- IRBuilder<> builder(inst);
- Value* vectorValue = UndefValue::get(inst->getType());
-@@ -3122,7 +3122,7 @@ Constant* IGCConstProp::ConstantFoldCmpInst(CmpInst* CI)
- {
- bool AllTrue = true, AllFalse = true;
- auto VecOpnd = cast<Constant>(EEI->getVectorOperand());
-- unsigned N = (unsigned)cast<VectorType>(VecOpnd->getType())->getNumElements();
-+ unsigned N = (unsigned)cast<IGCLLVM::FixedVectorType>(VecOpnd->getType())->getNumElements();
- for (unsigned i = 0; i < N; ++i)
- {
- Constant* const Opnd = VecOpnd->getAggregateElement(i);
-@@ -3918,8 +3918,8 @@ namespace IGC
- BitCastInst* BC = dyn_cast<BitCastInst>(&*BI++);
- if (!BC) continue;
- // Skip non-element-wise bitcast.
-- VectorType* DstVTy = dyn_cast<VectorType>(BC->getType());
-- VectorType* SrcVTy = dyn_cast<VectorType>(BC->getOperand(0)->getType());
-+ IGCLLVM::FixedVectorType* DstVTy = dyn_cast<IGCLLVM::FixedVectorType>(BC->getType());
-+ IGCLLVM::FixedVectorType* SrcVTy = dyn_cast<IGCLLVM::FixedVectorType>(BC->getOperand(0)->getType());
- if (!DstVTy || !SrcVTy || DstVTy->getNumElements() != SrcVTy->getNumElements())
- continue;
- // Skip if it's not used only all extractelement.
-@@ -4689,7 +4689,7 @@ void SplitIndirectEEtoSel::visitExtractElementInst(llvm::ExtractElementInst& I)
- {
- using namespace llvm::PatternMatch;
-
-- VectorType* vecTy = I.getVectorOperandType();
-+ IGCLLVM::FixedVectorType* vecTy = dyn_cast<IGCLLVM::FixedVectorType>(I.getVectorOperandType());
- uint64_t num = vecTy->getNumElements();
- Type* eleType = vecTy->getElementType();
-
-diff --git a/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp b/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp
-index 885ad65a..923f296e 100644
---- a/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp
-+++ b/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp
-@@ -32,6 +32,7 @@ IN THE SOFTWARE.
- #include "DebugInfo/DebugInfoUtils.hpp"
-
- #include "common/LLVMWarningsPush.hpp"
-+#include "llvmWrapper/IR/DerivedTypes.h"
- #include "llvm/IR/Function.h"
- #include "llvm/IR/Module.h"
- #include "common/LLVMWarningsPop.hpp"
-@@ -581,7 +582,7 @@ ScalarVisaModule::GetVariableLocation(const llvm::Instruction* pInst) const
-
- if (pType->isVectorTy())
- {
-- vectorNumElements = (unsigned)cast<VectorType>(pType)->getNumElements();
-+ vectorNumElements = (unsigned)cast<IGCLLVM::FixedVectorType>(pType)->getNumElements();
- }
- else if (!pVar->IsUniform())
- {
-diff --git a/IGC/Compiler/GenTTI.cpp b/IGC/Compiler/GenTTI.cpp
-index 34b21c73..9e4d2f26 100644
---- a/IGC/Compiler/GenTTI.cpp
-+++ b/IGC/Compiler/GenTTI.cpp
-@@ -216,7 +216,13 @@ namespace llvm {
-
- // Skip non-simple loop.
- if (L->getNumBlocks() != 1) {
-- if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) && L->empty()) {
-+ if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) &&
-+#if LLVM_VERSION_MAJOR >= 12
-+ L->isInnermost()
-+#else
-+ L->empty()
-+#endif
-+ ) {
- auto countNonPHI = [](BasicBlock* BB) {
- unsigned Total = BB->size();
- unsigned PHIs = 0;
-diff --git a/IGC/Compiler/GenUpdateCB.cpp b/IGC/Compiler/GenUpdateCB.cpp
-index 89b414b6..9034066c 100644
---- a/IGC/Compiler/GenUpdateCB.cpp
-+++ b/IGC/Compiler/GenUpdateCB.cpp
-@@ -24,6 +24,7 @@ IN THE SOFTWARE.
-
- #include "common/LLVMWarningsPush.hpp"
- #include "llvmWrapper/Bitcode/BitcodeWriter.h"
-+#include "llvmWrapper/IR/DerivedTypes.h"
- #include <llvm/Support/ScaledNumber.h>
- #include <llvm/Bitcode/BitcodeReader.h>
- #include "llvm/IR/DebugInfo.h"
-@@ -384,7 +385,7 @@ bool GenUpdateCB::runOnFunction(Function& F)
- isResInfo(dyn_cast<GenIntrinsicInst>(inst,
- GenISAIntrinsic::GenISA_resinfoptr), texId, lod, isUAV))
- {
-- unsigned nelems = (unsigned)cast<VectorType>(inst->getType())->getNumElements();
-+ unsigned nelems = (unsigned)cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements();
- SmallVector< SmallVector<ExtractElementInst*, 1>, 4> extracts(nelems);
- if (VectorUsedByConstExtractOnly(inst, extracts))
- {
-diff --git a/IGC/Compiler/HandleFRemInstructions.cpp b/IGC/Compiler/HandleFRemInstructions.cpp
-index 94995a56..4523f3f0 100644
---- a/IGC/Compiler/HandleFRemInstructions.cpp
-+++ b/IGC/Compiler/HandleFRemInstructions.cpp
-@@ -28,6 +28,7 @@ IN THE SOFTWARE.
- #include <llvm/IR/Instructions.h>
- #include <llvm/IR/InstIterator.h>
- #include <llvm/Transforms/Utils/BasicBlockUtils.h>
-+#include "llvmWrapper/IR/DerivedTypes.h"
- #include "common/LLVMWarningsPop.hpp"
- #include "Compiler/IGCPassSupport.h"
- #include "Probe/Assertion.h"
-@@ -77,7 +78,7 @@ void HandleFRemInstructions::visitFRem(llvm::BinaryOperator& I)
-
- if (ValType->isVectorTy())
- {
-- auto VecCount = cast<VectorType>(ValType)->getNumElements();
-+ auto VecCount = cast<IGCLLVM::FixedVectorType>(ValType)->getNumElements();
- if (VecCount == 2 || VecCount == 3 || VecCount == 4 || VecCount == 8 || VecCount == 16)
- {
- VecStr = "v" + std::to_string(VecCount);
-diff --git a/IGC/Compiler/HandleLoadStoreInstructions.cpp b/IGC/Compiler/HandleLoadStoreInstructions.cpp
-index d18eec73..c5535701 100644
---- a/IGC/Compiler/HandleLoadStoreInstructions.cpp
-+++ b/IGC/Compiler/HandleLoadStoreInstructions.cpp
-@@ -77,7 +77,7 @@ void HandleLoadStoreInstructions::visitLoadInst(llvm::LoadInst& I)
-
- if (I.getType()->isVectorTy())
- {
-- numVectorElements = (uint32_t)cast<VectorType>(I.getType())->getNumElements();
-+ numVectorElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(I.getType())->getNumElements();
- doubleDstType = IGCLLVM::FixedVectorType::get(builder.getDoubleTy(), numVectorElements);
- }
- uint as = ptrv->getType()->getPointerAddressSpace();
-@@ -163,7 +163,7 @@ void HandleLoadStoreInstructions::visitStoreInst(llvm::StoreInst& I)
-
- if (I.getValueOperand()->getType()->isVectorTy())
- {
-- numVectorElements = (uint32_t)cast<VectorType>(I.getValueOperand()->getType())->getNumElements();
-+ numVectorElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(I.getValueOperand()->getType())->getNumElements();
- }
-
-
-diff --git a/IGC/Compiler/LegalizationPass.cpp b/IGC/Compiler/LegalizationPass.cpp
-index b651350b..9524a495 100644
---- a/IGC/Compiler/LegalizationPass.cpp
-+++ b/IGC/Compiler/LegalizationPass.cpp
-@@ -670,7 +670,7 @@ void Legalization::visitBitCastInst(llvm::BitCastInst& I)
- if (!isa<TruncInst>(pZ->getOperand(0)))
- return;
-
-- auto* pVecTy = cast<VectorType>(pZ->getDestTy());
-+ auto* pVecTy = cast<IGCLLVM::FixedVectorType>(pZ->getDestTy());
- if (pVecTy->getNumElements() != 3)
- return;
-
-@@ -765,7 +765,7 @@ void Legalization::visitSelectInst(SelectInst& I)
- }
- else if (I.getType()->isVectorTy())
- {
-- unsigned int vecSize = (unsigned)cast<VectorType>(I.getType())->getNumElements();
-+ unsigned int vecSize = (unsigned)cast<IGCLLVM::FixedVectorType>(I.getType())->getNumElements();
- Value* newVec = UndefValue::get(I.getType());
- m_builder->SetInsertPoint(&I);
- for (unsigned int i = 0; i < vecSize; i++)
-@@ -1147,7 +1147,7 @@ void Legalization::visitStoreInst(StoreInst& I)
- if (ConstantDataVector * vec = dyn_cast<ConstantDataVector>(I.getOperand(0)))
- {
- Value* newVec = UndefValue::get(vec->getType());
-- unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
-+ unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
- for (unsigned int i = 0; i < nbElement; i++)
- {
- Constant* cst = vec->getElementAsConstant(i);
-@@ -1168,7 +1168,7 @@ void Legalization::visitStoreInst(StoreInst& I)
- else if (ConstantVector * vec = dyn_cast<ConstantVector>(I.getOperand(0)))
- {
- Value* newVec = UndefValue::get(vec->getType());
-- unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
-+ unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
- for (unsigned int i = 0; i < nbElement; i++)
- {
- Constant* cst = vec->getOperand(i);
-@@ -1189,7 +1189,7 @@ void Legalization::visitStoreInst(StoreInst& I)
- else if (ConstantAggregateZero * vec = dyn_cast<ConstantAggregateZero>(I.getOperand(0)))
- {
- Value* newVec = UndefValue::get(vec->getType());
-- unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
-+ unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
- for (unsigned int i = 0; i < nbElement; i++)
- {
- Constant* cst = vec->getElementValue(i);
-@@ -1340,7 +1340,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I)
- if (ConstantDataVector * vec = dyn_cast<ConstantDataVector>(I.getOperand(0)))
- {
- Value* newVec = UndefValue::get(vec->getType());
-- unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
-+ unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
- for (unsigned int i = 0; i < nbElement; i++)
- {
- Constant* cst = vec->getElementAsConstant(i);
-@@ -1360,7 +1360,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I)
- else if (ConstantVector * vec = dyn_cast<ConstantVector>(I.getOperand(0)))
- {
- Value* newVec = UndefValue::get(I.getType());
-- unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
-+ unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
- for (unsigned int i = 0; i < nbElement; i++)
- {
- Constant* cst = vec->getOperand(i);
-@@ -1380,7 +1380,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I)
- else if (ConstantAggregateZero * vec = dyn_cast<ConstantAggregateZero>(I.getOperand(0)))
- {
- Value* newVec = UndefValue::get(I.getType());
-- unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
-+ unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
- for (unsigned int i = 0; i < nbElement; i++)
- {
- Constant* cst = vec->getElementValue(i);
-@@ -1397,7 +1397,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I)
- else if (I.getOperand(1)->getType()->isIntegerTy(1))
- {
- // This promotes i1 insertelement to i32
-- unsigned int nbElement = (unsigned)cast<VectorType>(I.getOperand(0)->getType())->getNumElements();
-+ unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(I.getOperand(0)->getType())->getNumElements();
- Value* newVec = UndefValue::get(IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), nbElement));
- PromoteInsertElement(&I, newVec);
- }
-@@ -1410,7 +1410,7 @@ void Legalization::visitShuffleVectorInst(ShuffleVectorInst& I)
- // If the original vector is a constant, just use the scalar constant,
- // otherwise extract from the original vector.
-
-- VectorType* resType = cast<VectorType>(I.getType());
-+ IGCLLVM::FixedVectorType* resType = cast<IGCLLVM::FixedVectorType>(I.getType());
- Value* newVec = UndefValue::get(resType);
- Value* src0 = I.getOperand(0);
- Value* src1 = I.getOperand(1);
-@@ -1421,7 +1421,7 @@ void Legalization::visitShuffleVectorInst(ShuffleVectorInst& I)
- Constant* mask = I.getShuffleMaskForBitcode();
- #endif
- // The two inputs are guaranteed to be of the same type
-- VectorType* inType = cast<VectorType>(src0->getType());
-+ IGCLLVM::FixedVectorType* inType = cast<IGCLLVM::FixedVectorType>(src0->getType());
- int inCount = int_cast<int>(inType->getNumElements());
- int inBase = 2; // 2 means using undef
- // if inType == resType, use src0/src1 as the input
-@@ -1637,7 +1637,7 @@ Type* Legalization::LegalAllocaType(Type* type) const
- #endif
- legalType = IGCLLVM::FixedVectorType::get(
- LegalAllocaType(cast<VectorType>(type)->getElementType()),
-- (unsigned)cast<VectorType>(type)->getNumElements());
-+ (unsigned)cast<IGCLLVM::FixedVectorType>(type)->getNumElements());
- break;
- case Type::StructTyID:
- return LegalStructAllocaType(type);
-@@ -1937,7 +1937,7 @@ void Legalization::visitIntrinsicInst(llvm::IntrinsicInst& I)
- Value* newValue = nullptr;
- if (srcType->isVectorTy())
- {
-- auto sourceVT = cast<VectorType>(srcType);
-+ auto sourceVT = cast<IGCLLVM::FixedVectorType>(srcType);
- const unsigned int numElements = (uint32_t)sourceVT->getNumElements();
- Value* dstVec = UndefValue::get(srcType);
- for (unsigned int i = 0; i < numElements; ++i)
-@@ -2081,7 +2081,7 @@ void Legalization::visitTruncInst(llvm::TruncInst& I) {
- }
-
- Src = BC->getOperand(0);
-- VectorType* VTy = dyn_cast<VectorType>(Src->getType());
-+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Src->getType());
- // Bail out if it's not bitcasted from <3 x i16>
- if (!VTy || VTy->getNumElements() != 3 || !VTy->getElementType()->isIntegerTy(16))
- return;
-diff --git a/IGC/Compiler/Legalizer/InstPromoter.cpp b/IGC/Compiler/Legalizer/InstPromoter.cpp
-index bba1d96d..8fadf89f 100644
---- a/IGC/Compiler/Legalizer/InstPromoter.cpp
-+++ b/IGC/Compiler/Legalizer/InstPromoter.cpp
-@@ -25,6 +25,7 @@ IN THE SOFTWARE.
- #define DEBUG_TYPE "type-legalizer"
- #include "TypeLegalizer.h"
- #include "InstPromoter.h"
-+#include "llvmWrapper/IR/DerivedTypes.h"
- #include "common/LLVMWarningsPush.hpp"
- #include "llvm/Support/Debug.h"
- #include "llvm/Support/MathExtras.h"
-@@ -394,10 +395,16 @@ bool InstPromoter::visitBitCastInst(BitCastInst& I) {
- unsigned N =
- Val->getType()->getScalarSizeInBits() / DestTy->getScalarSizeInBits();
- Value* BC =
-- IRB->CreateBitCast(Val, VectorType::get(DestTy->getScalarType(), N));
-+ IRB->CreateBitCast(Val, IGCLLVM::FixedVectorType::get(DestTy->getScalarType(), N));
-
- std::vector<Constant*> Vals;
-- for (unsigned i = 0; i < DestTy->getVectorNumElements(); i++)
-+ for (unsigned i = 0;
-+#if LLVM_VERSION_MAJOR >= 12
-+ i < cast<IGCLLVM::FixedVectorType>(DestTy)->getNumElements();
-+#else
-+ i < DestTy->getVectorNumElements();
-+#endif
-+ i++)
- Vals.push_back(IRB->getInt32(i));
-
- Value* Mask = ConstantVector::get(Vals);
-diff --git a/IGC/Compiler/Legalizer/InstScalarizer.cpp b/IGC/Compiler/Legalizer/InstScalarizer.cpp
-index 3902f740..c8e18cc5 100644
---- a/IGC/Compiler/Legalizer/InstScalarizer.cpp
-+++ b/IGC/Compiler/Legalizer/InstScalarizer.cpp
-@@ -130,7 +130,7 @@ bool InstScalarizer::visitLoadInst(LoadInst& I) {
- // otherwise, it's broken.
- IGC_ASSERT(TL->getTypeSizeInBits(EltTy) == TL->getTypeStoreSizeInBits(EltTy));
-
-- unsigned NumElts = (unsigned)cast<VectorType>(OrigTy)->getNumElements();
-+ unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(OrigTy)->getNumElements();
- unsigned Elt = 0;
-
- Type* NewPtrTy = PointerType::get(EltTy, AS);
-@@ -268,7 +268,7 @@ bool InstScalarizer::visitStoreInst(StoreInst& I) {
- // otherwise, it's broken.
- IGC_ASSERT(TL->getTypeSizeInBits(EltTy) == TL->getTypeStoreSizeInBits(EltTy));
-
-- unsigned NumElts = (unsigned)cast<VectorType>(OrigTy)->getNumElements();
-+ unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(OrigTy)->getNumElements();
- unsigned Elt = 0;
-
- Type* NewPtrTy = PointerType::get(EltTy, AS);
-@@ -498,7 +498,7 @@ bool InstScalarizer::visitInsertElementInst(InsertElementInst& I) {
- IGC_ASSERT(EltSeq->size());
- IGC_ASSERT(VecSeqCopy.size() % EltSeq->size() == 0);
-
-- unsigned NumElts = (unsigned)cast<VectorType>(I.getOperand(0)->getType())->getNumElements();
-+ unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(I.getOperand(0)->getType())->getNumElements();
- unsigned i = 0;
- for (unsigned Elt = 0; Elt != NumElts; ++Elt) {
- if (Elt == Idx) {
-diff --git a/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp b/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp
-index 28f8ce84..778132c4 100644
---- a/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp
-+++ b/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp
-@@ -162,7 +162,7 @@ void PeepholeTypeLegalizer::legalizePhiInstruction(Instruction& I)
-
- if (quotient > 1)
- {
-- unsigned numElements = I.getType()->isVectorTy() ? (unsigned)cast<VectorType>(I.getType())->getNumElements() : 1;
-+ unsigned numElements = I.getType()->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(I.getType())->getNumElements() : 1;
- Type* newType = IGCLLVM::FixedVectorType::get(Type::getIntNTy(I.getContext(), promoteToInt), quotient * numElements);
-
- PHINode* newPhi = m_builder->CreatePHI(newType, oldPhi->getNumIncomingValues());
-@@ -223,7 +223,7 @@ void PeepholeTypeLegalizer::legalizeExtractElement(Instruction& I)
- unsigned elementWidth = extract->getType()->getScalarSizeInBits();
- if (!isLegalInteger(elementWidth) && extract->getType()->isIntOrIntVectorTy())
- {
-- unsigned numElements = (unsigned)cast<VectorType>(extract->getOperand(0)->getType())->getNumElements();
-+ unsigned numElements = (unsigned)cast<IGCLLVM::FixedVectorType>(extract->getOperand(0)->getType())->getNumElements();
- unsigned quotient, promoteToInt;
- promoteInt(elementWidth, quotient, promoteToInt, DL->getLargestLegalIntTypeSizeInBits());
-
-@@ -850,7 +850,7 @@ void PeepholeTypeLegalizer::cleanupZExtInst(Instruction& I) {
- }
-
- unsigned ipElmtSize = prevInst->getOperand(0)->getType()->getScalarSizeInBits();
-- unsigned ipVecSize = (unsigned)cast<VectorType>(prevInst->getOperand(0)->getType())->getNumElements();
-+ unsigned ipVecSize = (unsigned)cast<IGCLLVM::FixedVectorType>(prevInst->getOperand(0)->getType())->getNumElements();
- unsigned convFactor = promoteToInt / ipElmtSize;
-
- Value* vecRes = UndefValue::get(IGCLLVM::FixedVectorType::get(llvm::Type::getIntNTy(I.getContext(), promoteToInt), quotient));
-diff --git a/IGC/Compiler/Legalizer/TypeLegalizer.cpp b/IGC/Compiler/Legalizer/TypeLegalizer.cpp
-index f8f71d71..a46f42bd 100644
---- a/IGC/Compiler/Legalizer/TypeLegalizer.cpp
-+++ b/IGC/Compiler/Legalizer/TypeLegalizer.cpp
-@@ -32,6 +32,7 @@ IN THE SOFTWARE.
- #include "InstScalarizer.h"
- #include "InstElementizer.h"
- #include "common/LLVMWarningsPush.hpp"
-+#include "llvmWrapper/IR/DerivedTypes.h"
- #include "llvm/ADT/PostOrderIterator.h"
- #include "llvm/IR/CFG.h"
- #include "llvm/Support/Debug.h"
-@@ -290,7 +291,7 @@ TypeSeq* TypeLegalizer::getScalarizedTypeSeq(Type* Ty) {
- }
-
- Type* EltTy = cast<VectorType>(Ty)->getElementType();
-- for (unsigned i = 0, e = (unsigned)cast<VectorType>(Ty)->getNumElements(); i != e; ++i)
-+ for (unsigned i = 0, e = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements(); i != e; ++i)
- TMI->second.push_back(EltTy);
-
- return &TMI->second;
-diff --git a/IGC/Compiler/Legalizer/TypeLegalizer.h b/IGC/Compiler/Legalizer/TypeLegalizer.h
-index f3ce264c..a6910d08 100644
---- a/IGC/Compiler/Legalizer/TypeLegalizer.h
-+++ b/IGC/Compiler/Legalizer/TypeLegalizer.h
-@@ -28,6 +28,7 @@ IN THE SOFTWARE.
- #include "llvmWrapper/IR/Instructions.h"
- #include "llvmWrapper/Analysis/InlineCost.h"
- #include "llvmWrapper/IR/InstrTypes.h"
-+#include "llvmWrapper/IR/DerivedTypes.h"
- #include "llvmWrapper/Support/Alignment.h"
- #include "llvm/ADT/ArrayRef.h"
- #include "llvm/ADT/DenseMap.h"
-@@ -287,7 +288,7 @@ namespace IGC {
- if (!Ty->isVectorTy())
- return false;
-
-- unsigned NumElts = (unsigned)cast<VectorType>(Ty)->getNumElements();
-+ unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements();
- Type* EltTy = cast<VectorType>(Ty)->getElementType();
- const auto& ProfitLengths = getProfitLoadVectorLength(EltTy);
-
-diff --git a/IGC/Compiler/LowPrecisionOptPass.cpp b/IGC/Compiler/LowPrecisionOptPass.cpp
-index 64912719..1d1db949 100644
---- a/IGC/Compiler/LowPrecisionOptPass.cpp
-+++ b/IGC/Compiler/LowPrecisionOptPass.cpp
-@@ -252,7 +252,7 @@ bool LowPrecisionOpt::propagateSamplerType(llvm::GenIntrinsicInst& I)
- return false;
- }
-
-- VectorType* oldTy = cast<VectorType>(I.getType());
-+ IGCLLVM::FixedVectorType* oldTy = cast<IGCLLVM::FixedVectorType>(I.getType());
- llvm::SmallVector<llvm::Type*, 4> overloadTys;
- auto retTy = IGCLLVM::FixedVectorType::get(newDstType, int_cast<unsigned int>(oldTy->getNumElements()));
- overloadTys.push_back(retTy);
-diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
-index 393b4b0a..e9c07b34 100644
---- a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
-+++ b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
-@@ -23,6 +23,8 @@ IN THE SOFTWARE.
- ============================= end_copyright_notice ===========================*/
-
- #include "llvm/Config/llvm-config.h"
-+#include "llvmWrapper/IR/DerivedTypes.h"
-+#include "llvmWrapper/Analysis/TargetLibraryInfo.h"
- #include "Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.h"
- #include "Compiler/CodeGenPublic.h"
- #include "Compiler/IGCPassSupport.h"
-@@ -178,12 +180,11 @@ namespace {
- bool doInitialization(Module& M) override {
- if(M.size() > 0)
- {
-- Result.reset(new AddressSpaceAAResult(
-- getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(
- #if LLVM_VERSION_MAJOR >= 10
-- *M.begin()
-+ Function &F = *M.begin();
- #endif
-- ),
-+ Result.reset(new AddressSpaceAAResult(
-+ getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(),
- *getAnalysis<CodeGenContextWrapper>().getCodeGenContext()));
- }
- return false;
-diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp
-index 67535cfc..3cdd2975 100644
---- a/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp
-+++ b/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp
-@@ -24,6 +24,7 @@ IN THE SOFTWARE.
-
- #include "Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.hpp"
- #include "Compiler/IGCPassSupport.h"
-+#include "llvmWrapper/IR/DerivedTypes.h"
- #include "common/LLVMWarningsPush.hpp"
- #include "llvm/IR/Function.h"
- #include "common/LLVMWarningsPop.hpp"
-@@ -130,7 +131,7 @@ static uint64_t getNumElements(Type* type)
- {
- return arrayType->getNumElements();
- }
-- if (VectorType * vectorType = dyn_cast<VectorType>(type))
-+ if (IGCLLVM::FixedVectorType * vectorType = dyn_cast<IGCLLVM::FixedVectorType>(type))
- {
- return vectorType->getNumElements();
- }
-diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp
-index 2a9d7499..79ed0948 100644
---- a/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp
-+++ b/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp
-@@ -27,6 +27,7 @@ IN THE SOFTWARE.
- #include "Compiler/IGCPassSupport.h"
- #include "GenISAIntrinsics/GenIntrinsicInst.h"
-
-+#include "llvmWrapper/IR/DerivedTypes.h"
- #include "common/LLVMWarningsPush.hpp"
- #include <llvm/IR/Function.h>
- #include <llvm/IR/Instructions.h>
-@@ -133,7 +134,7 @@ Value* CorrectlyRoundedDivSqrt::emitIEEEDivide(BinaryOperator* I, Value* Op0, Va
- }
- else
- {
-- auto vType = dyn_cast<VectorType>(Ty);
-+ auto vType = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
- unsigned VecLen = (uint32_t)vType->getNumElements();
- Divide = UndefValue::get(Ty);
- for (unsigned i = 0; i < VecLen; i++)
-diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
-index c5ff3ac0..119520ed 100644
---- a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
-+++ b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
-@@ -952,7 +952,11 @@ namespace //Anonymous
- {
- auto ndrangeStructName = "struct.ndrange_t";
- auto module = _deviceExecCall->getModule();
-+#if LLVM_VERSION_MAJOR >= 12
-+ auto ndrangeTy = llvm::StructType::getTypeByName(module->getContext(), ndrangeStructName);
-+#else
- auto ndrangeTy = module->getTypeByName(ndrangeStructName);
-+#endif
- if (ndrangeTy == nullptr)
- {
- //create struct type
-@@ -1697,7 +1701,7 @@ namespace //Anonymous
- // this generates <element_type><num_elements> string. Ie for char2 element_type is char and num_elements is 2
- // that is done by callin BaseTypeName on vector element type, this recursive call has only a depth of one since
- // there are no compound vectors in OpenCL.
-- auto vType = llvm::dyn_cast<VectorType>(type);
-+ auto vType = llvm::dyn_cast<IGCLLVM::FixedVectorType>(type);
- return BaseTypeName(type->getContainedType(0), os) << vType->getNumElements();
- }
- default:
-diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp
-index 6448463d..7df71079 100644
---- a/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp
-+++ b/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp
-@@ -24,6 +24,7 @@ IN THE SOFTWARE.
-
- #include "Compiler/Optimizer/OpenCLPasses/KernelArgs.hpp"
- #include "AdaptorCommon/ImplicitArgs.hpp"
-+#include "llvmWrapper/IR/DerivedTypes.h"
- #include "common/LLVMWarningsPush.hpp"
- #include <llvm/IR/Argument.h>
- #include <llvm/IR/DataLayout.h>
-@@ -388,7 +389,7 @@ unsigned int KernelArg::calcAssociatedArgNo(const ImplicitArg& implicitArg, cons
-
- unsigned int KernelArg::getNumComponents() const
- {
-- if (VectorType * vecType = dyn_cast<VectorType>(m_arg->getType()))
-+ if (IGCLLVM::FixedVectorType * vecType = dyn_cast<IGCLLVM::FixedVectorType>(m_arg->getType()))
- {
- // Vector
- return int_cast<unsigned int>(vecType->getNumElements());
-diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp
-index c7414b8e..74964510 100644
---- a/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp
-+++ b/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp
-@@ -719,7 +719,7 @@ Value* OpenCLPrintfResolution::fixupPrintfArg(CallInst& printfCall, Value* arg,
- }
-
- Type* newType = Type::getFloatTy(arg->getContext());
-- if (auto argVT = dyn_cast<VectorType>(arg->getType()))
-+ if (auto argVT = dyn_cast<IGCLLVM::FixedVectorType>(arg->getType()))
- {
- newType = IGCLLVM::FixedVectorType::get(newType, (unsigned)argVT->getNumElements());
- }
-@@ -749,7 +749,7 @@ void OpenCLPrintfResolution::preprocessPrintfArgs(CallInst& printfCall)
- IGC::SHADER_PRINTF_TYPE argDataType = getPrintfArgDataType(arg);
- arg = fixupPrintfArg(printfCall, arg, argDataType);
- uint vecSize = 0;
-- if (auto argVType = dyn_cast<VectorType>(argType)) {
-+ if (auto argVType = dyn_cast<IGCLLVM::FixedVectorType>(argType)) {
- vecSize = (uint)argVType->getNumElements();
- }
- m_argDescriptors.push_back(SPrintfArgDescriptor(argDataType, arg, vecSize));
-diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
-index 2ed5a2b6..07f85f4c 100644
---- a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
-+++ b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
-@@ -29,6 +29,7 @@ IN THE SOFTWARE.
- #include "Compiler/IGCPassSupport.h"
- #include "Compiler/CISACodeGen/GenCodeGenModule.h"
- #include "Compiler/CISACodeGen/LowerGEPForPrivMem.hpp"
-+#include "llvmWrapper/IR/DerivedTypes.h"
- #include "common/LLVMWarningsPush.hpp"
- #include "llvm/Transforms/Utils/Local.h"
- #include "llvm/IR/DataLayout.h"
-@@ -604,7 +605,7 @@ public:
- Type* scalarptrTy = PointerType::get(scalarType, pLoad->getPointerAddressSpace());
- IGC_ASSERT(scalarType->getPrimitiveSizeInBits() / 8 == elementSize);
- Value* vec = UndefValue::get(pLoad->getType());
-- auto pLoadVT = cast<VectorType>(pLoad->getType());
-+ auto pLoadVT = cast<IGCLLVM::FixedVectorType>(pLoad->getType());
- for (unsigned i = 0, e = (unsigned)pLoadVT->getNumElements(); i < e; ++i)
- {
- Value* ptr = IRB.CreateIntToPtr(address, scalarptrTy);
-@@ -643,7 +644,7 @@ public:
- IGC_ASSERT(scalarType->getPrimitiveSizeInBits() / 8 == elementSize);
- Value* vec = pStore->getValueOperand();
-
-- unsigned vecNumElts = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
-+ unsigned vecNumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
- for (unsigned i = 0; i < vecNumElts; ++i)
- {
- Value* ptr = IRB.CreateIntToPtr(address, scalarptrTy);
-@@ -707,7 +708,7 @@ bool PrivateMemoryResolution::testTransposedMemory(const Type* pTmpType, const T
- }
- else if(pTmpType->isVectorTy())
- {
-- auto pTmpVType = cast<VectorType>(pTmpType);
-+ auto pTmpVType = cast<IGCLLVM::FixedVectorType>(pTmpType);
- tmpAllocaSize *= pTmpVType->getNumElements();
- pTmpType = pTmpType->getContainedType(0);
- ok = (nullptr != pTmpType);
-@@ -815,7 +816,11 @@ bool PrivateMemoryResolution::resolveAllocaInstructions(bool privateOnStack)
- // Construct an empty DebugLoc.
- IF_DEBUG_INFO(DebugLoc entryDebugLoc);
- // Assign with the function location if available.
-+#if LLVM_VERSION_MAJOR >= 12
-+ IF_DEBUG_INFO_IF(DISubprogram *subprogram = m_currFunction->getSubprogram(), entryDebugLoc = DILocation::get(subprogram->getContext(), subprogram->getLine(), 0, subprogram););
-+#else
- IF_DEBUG_INFO_IF(DISubprogram *subprogram = m_currFunction->getSubprogram(), entryDebugLoc = DebugLoc::get(subprogram->getLine(), 0, subprogram););
-+#endif
- IF_DEBUG_INFO(entryBuilder.SetCurrentDebugLocation(entryDebugLoc));
-
- if (privateOnStack)
-diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp
-index c8414efa..68491d48 100644
---- a/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp
-+++ b/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp
-@@ -254,7 +254,7 @@ Instruction* ReplaceUnsupportedIntrinsics::insertLoop(Instruction* Loc, Value* L
- Value* ReplaceUnsupportedIntrinsics::replicateScalar(
- Value* ScalarVal, Type* Ty, Instruction* InsertBefore)
- {
-- VectorType* VTy = dyn_cast<VectorType>(Ty);
-+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
- Type* ETy = VTy ? VTy->getElementType() : Ty;
- uint32_t sBits = (unsigned int)ScalarVal->getType()->getPrimitiveSizeInBits();
- uint32_t nBits = (unsigned int)ETy->getPrimitiveSizeInBits();
-@@ -868,7 +868,7 @@ void ReplaceUnsupportedIntrinsics::replaceFunnelShift(IntrinsicInst* I) {
- }
-
- Value* numBits = Builder.getIntN(sizeInBits, sizeInBits);
-- if (auto IVT = dyn_cast<VectorType>(I->getType())) {
-+ if (auto IVT = dyn_cast<IGCLLVM::FixedVectorType>(I->getType())) {
- numBits = ConstantVector::getSplat(IGCLLVM::getElementCount((uint32_t)IVT->getNumElements()), cast<Constant>(numBits));
- }
- auto shiftModulo = Builder.CreateURem(I->getArgOperand(2), numBits);
-diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
-index 7188cc50..535d6268 100644
---- a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
-+++ b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
-@@ -303,7 +303,11 @@ static Value* BuildLoadInst(CallInst& CI, unsigned int Offset, Type* DataType)
- auto Size = ElemByteSize;
- if (DataType->isVectorTy())
- {
-+#if LLVM_VERSION_MAJOR >= 12
-+ Size *= cast<IGCLLVM::FixedVectorType>(DataType)->getNumElements();
-+#else
- Size *= DataType->getVectorNumElements();
-+#endif
- }
- unsigned int AlignedOffset = (Offset / ElemByteSize) * ElemByteSize;
- unsigned int LoadByteSize = (Offset == AlignedOffset) ? Size : Size * 2;
-diff --git a/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp b/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp
-index 1fda21d5..63a22864 100644
---- a/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp
-+++ b/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp
-@@ -340,7 +340,7 @@ bool PreCompiledFuncImport::preProcessDouble()
- }
- else
- {
-- uint32_t vectorSize = cast<VectorType>(Inst->getType())->getNumElements();
-+ uint32_t vectorSize = cast<IGCLLVM::FixedVectorType>(Inst->getType())->getNumElements();
- fsub = llvm::UndefValue::get(Inst->getType());
-
- for (uint32_t i = 0; i < vectorSize; ++i)
-@@ -936,7 +936,7 @@ void PreCompiledFuncImport::processDivide(BinaryOperator& inst, EmulatedFunction
-
- Type* argumentType = inst.getOperand(0)->getType();
-
-- if (auto argumentVType = dyn_cast<VectorType>(argumentType))
-+ if (auto argumentVType = dyn_cast<IGCLLVM::FixedVectorType>(argumentType))
- {
- numElements = (unsigned)argumentVType->getNumElements();
- }
-diff --git a/IGC/Compiler/Optimizer/Scalarizer.cpp b/IGC/Compiler/Optimizer/Scalarizer.cpp
-index 4f59eaf9..a4e73a6d 100644
---- a/IGC/Compiler/Optimizer/Scalarizer.cpp
-+++ b/IGC/Compiler/Optimizer/Scalarizer.cpp
-@@ -289,7 +289,7 @@ void ScalarizeFunction::scalarizeInstruction(BinaryOperator* BI)
- {
- V_PRINT(scalarizer, "\t\tBinary instruction\n");
- IGC_ASSERT_MESSAGE(BI, "instruction type dynamic cast failed");
-- VectorType* instType = dyn_cast<VectorType>(BI->getType());
-+ IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(BI->getType());
- // Only need handling for vector binary ops
- if (!instType) return;
-
-@@ -349,7 +349,7 @@ void ScalarizeFunction::scalarizeInstruction(CmpInst* CI)
- {
- V_PRINT(scalarizer, "\t\tCompare instruction\n");
- IGC_ASSERT_MESSAGE(CI, "instruction type dynamic cast failed");
-- VectorType* instType = dyn_cast<VectorType>(CI->getType());
-+ IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(CI->getType());
- // Only need handling for vector compares
- if (!instType) return;
-
-@@ -397,13 +397,13 @@ void ScalarizeFunction::scalarizeInstruction(CastInst* CI)
- {
- V_PRINT(scalarizer, "\t\tCast instruction\n");
- IGC_ASSERT_MESSAGE(CI, "instruction type dynamic cast failed");
-- VectorType* instType = dyn_cast<VectorType>(CI->getType());
-+ IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(CI->getType());
-
- // For BitCast - we only scalarize if src and dst types have same vector length
- if (isa<BitCastInst>(CI))
- {
- if (!instType) return recoverNonScalarizableInst(CI);
-- VectorType* srcType = dyn_cast<VectorType>(CI->getOperand(0)->getType());
-+ IGCLLVM::FixedVectorType* srcType = dyn_cast<IGCLLVM::FixedVectorType>(CI->getOperand(0)->getType());
- if (!srcType || (instType->getNumElements() != srcType->getNumElements()))
- {
- return recoverNonScalarizableInst(CI);
-@@ -458,7 +458,7 @@ void ScalarizeFunction::scalarizeInstruction(PHINode* PI)
- {
- V_PRINT(scalarizer, "\t\tPHI instruction\n");
- IGC_ASSERT_MESSAGE(PI, "instruction type dynamic cast failed");
-- VectorType* instType = dyn_cast<VectorType>(PI->getType());
-+ IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(PI->getType());
- // Only need handling for vector PHI
- if (!instType) return;
-
-@@ -569,7 +569,7 @@ void ScalarizeFunction::scalarizeInstruction(SelectInst* SI)
- {
- V_PRINT(scalarizer, "\t\tSelect instruction\n");
- IGC_ASSERT_MESSAGE(SI, "instruction type dynamic cast failed");
-- VectorType* instType = dyn_cast<VectorType>(SI->getType());
-+ IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(SI->getType());
- // Only need handling for vector select
- if (!instType) return;
-
-@@ -651,7 +651,7 @@ void ScalarizeFunction::scalarizeInstruction(ExtractElementInst* EI)
-
- // Connect the "extracted" value to all its consumers
- uint64_t scalarIndex = cast<ConstantInt>(scalarIndexVal)->getZExtValue();
-- auto valueVType = cast<VectorType>(vectorValue->getType());
-+ auto valueVType = cast<IGCLLVM::FixedVectorType>(vectorValue->getType());
- if (static_cast<unsigned int>(scalarIndex) < (unsigned)valueVType->getNumElements())
- {
- IGC_ASSERT_MESSAGE(NULL != operand[static_cast<unsigned int>(scalarIndex)], "SCM error");
-@@ -715,7 +715,7 @@ void ScalarizeFunction::scalarizeInstruction(InsertElementInst* II)
- if (isa<UndefValue>(sourceVectorValue))
- {
- // Scalarize the undef value (generate a scalar undef)
-- VectorType* inputVectorType = dyn_cast<VectorType>(sourceVectorValue->getType());
-+ IGCLLVM::FixedVectorType* inputVectorType = dyn_cast<IGCLLVM::FixedVectorType>(sourceVectorValue->getType());
- IGC_ASSERT_MESSAGE(inputVectorType, "expected vector argument");
-
- UndefValue* undefVal = UndefValue::get(inputVectorType->getElementType());
-@@ -756,7 +756,7 @@ void ScalarizeFunction::scalarizeInstruction(ShuffleVectorInst* SI)
- IGC_ASSERT(nullptr != sourceVector0Value);
- Value* sourceVector1Value = SI->getOperand(1);
- IGC_ASSERT(nullptr != sourceVector1Value);
-- VectorType* const inputType = dyn_cast<VectorType>(sourceVector0Value->getType());
-+ IGCLLVM::FixedVectorType* const inputType = dyn_cast<IGCLLVM::FixedVectorType>(sourceVector0Value->getType());
- IGC_ASSERT_MESSAGE(nullptr != inputType, "vector input error");
- IGC_ASSERT_MESSAGE(inputType == sourceVector1Value->getType(), "vector input error");
- unsigned sourceVectorWidth = int_cast<unsigned>(inputType->getNumElements());
-@@ -778,7 +778,7 @@ void ScalarizeFunction::scalarizeInstruction(ShuffleVectorInst* SI)
-
- // Generate array for shuffled scalar values
- SmallVector<Value*, MAX_INPUT_VECTOR_WIDTH>newVector;
-- unsigned width = int_cast<unsigned>(SI->getType()->getNumElements());
-+ unsigned width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(SI->getType())->getNumElements());
-
- // Generate undef value, which may be needed as some scalar elements
- UndefValue* undef = UndefValue::get(inputType->getElementType());
-@@ -847,7 +847,7 @@ void ScalarizeFunction::scalarizeInstruction(GetElementPtrInst* GI)
-
- if (baseValue->getType()->isVectorTy())
- {
-- width = int_cast<unsigned>(dyn_cast<VectorType>(baseValue->getType())->getNumElements());
-+ width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(baseValue->getType())->getNumElements());
- // Obtain the scalarized operands
- obtainScalarizedValues(operand1, NULL, baseValue, GI);
- ptrTy = dyn_cast<VectorType>(baseValue->getType())->getElementType();
-@@ -858,7 +858,7 @@ void ScalarizeFunction::scalarizeInstruction(GetElementPtrInst* GI)
- }
- if (indexValue->getType()->isVectorTy())
- {
-- width = int_cast<unsigned>(dyn_cast<VectorType>(indexValue->getType())->getNumElements());
-+ width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(indexValue->getType())->getNumElements());
- // Obtain the scalarized operands
- obtainScalarizedValues(operand2, NULL, indexValue, GI);
- }
-@@ -897,7 +897,7 @@ void ScalarizeFunction::scalarizeInstruction(LoadInst* LI)
- V_PRINT(scalarizer, "\t\tLoad instruction\n");
- IGC_ASSERT_MESSAGE(LI, "instruction type dynamic cast failed");
-
-- VectorType* dataType = dyn_cast<VectorType>(LI->getType());
-+ IGCLLVM::FixedVectorType* dataType = dyn_cast<IGCLLVM::FixedVectorType>(LI->getType());
- if (isScalarizableLoadStoreType(dataType) && m_pDL)
- {
- // Prepare empty SCM entry for the instruction
-@@ -969,7 +969,7 @@ void ScalarizeFunction::scalarizeInstruction(StoreInst* SI)
-
- int indexPtr = SI->getPointerOperandIndex();
- int indexData = 1 - indexPtr;
-- VectorType* dataType = dyn_cast<VectorType>(SI->getOperand(indexData)->getType());
-+ IGCLLVM::FixedVectorType* dataType = dyn_cast<IGCLLVM::FixedVectorType>(SI->getOperand(indexData)->getType());
- if (isScalarizableLoadStoreType(dataType) && m_pDL)
- {
- // Get additional info from instruction
-@@ -1040,7 +1040,7 @@ void ScalarizeFunction::obtainScalarizedValues(SmallVectorImpl<Value*>& retValue
- {
- V_PRINT(scalarizer, "\t\t\tObtaining scalar value... " << *origValue << "\n");
-
-- VectorType* origType = dyn_cast<VectorType>(origValue->getType());
-+ IGCLLVM::FixedVectorType* origType = dyn_cast<IGCLLVM::FixedVectorType>(origValue->getType());
- IGC_ASSERT_MESSAGE(origType, "Value must have a vector type!");
- unsigned width = int_cast<unsigned>(origType->getNumElements());
-
-@@ -1202,7 +1202,7 @@ void ScalarizeFunction::obtainVectorValueWhichMightBeScalarizedImpl(Value* vecto
- }
-
- Value* assembledVector = UndefValue::get(vectorVal->getType());
-- unsigned width = int_cast<unsigned>(dyn_cast<VectorType>(vectorVal->getType())->getNumElements());
-+ unsigned width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(vectorVal->getType())->getNumElements());
- for (unsigned i = 0; i < width; i++)
- {
- IGC_ASSERT_MESSAGE(NULL != valueEntry->scalarValues[i], "SCM entry has NULL value");
-@@ -1262,7 +1262,7 @@ void ScalarizeFunction::updateSCMEntryWithValues(ScalarizeFunction::SCMEntry* en
- bool matchDbgLoc)
- {
- IGC_ASSERT_MESSAGE((origValue->getType()->isArrayTy() || origValue->getType()->isVectorTy()), "only Vector values are supported");
-- unsigned width = int_cast<unsigned>(dyn_cast<VectorType>(origValue->getType())->getNumElements());
-+ unsigned width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(origValue->getType())->getNumElements());
-
- entry->isOriginalVectorRemoved = isOrigValueRemoved;
-
-@@ -1326,7 +1326,7 @@ void ScalarizeFunction::resolveDeferredInstructions()
- Instruction* vectorInst = dyn_cast<Instruction>(current.unresolvedInst);
- IGC_ASSERT_MESSAGE(vectorInst, "DRL only handles unresolved instructions");
-
-- VectorType* currType = dyn_cast<VectorType>(vectorInst->getType());
-+ IGCLLVM::FixedVectorType* currType = dyn_cast<IGCLLVM::FixedVectorType>(vectorInst->getType());
- IGC_ASSERT_MESSAGE(currType, "Cannot have DRL of non-vector value");
- unsigned width = int_cast<unsigned>(currType->getNumElements());
-
-diff --git a/IGC/Compiler/Optimizer/ValueTracker.cpp b/IGC/Compiler/Optimizer/ValueTracker.cpp
-index c06f7312..d8f0d385 100644
---- a/IGC/Compiler/Optimizer/ValueTracker.cpp
-+++ b/IGC/Compiler/Optimizer/ValueTracker.cpp
-@@ -178,7 +178,7 @@ Value* ValueTracker::handleExtractElement(ExtractElementInst* E)
- {
- auto mask = I->getShuffleMask();
- uint shuffleidx = int_cast<uint>(mask[(uint)idx]);
-- auto vType = dyn_cast<VectorType>(I->getOperand(0)->getType());
-+ auto vType = dyn_cast<IGCLLVM::FixedVectorType>(I->getOperand(0)->getType());
- baseValue = (shuffleidx < vType->getNumElements()) ?
- I->getOperand(0) : I->getOperand(1);
- }
-diff --git a/IGC/Compiler/VerificationPass.cpp b/IGC/Compiler/VerificationPass.cpp
-index 98437d79..40d50f5a 100644
---- a/IGC/Compiler/VerificationPass.cpp
-+++ b/IGC/Compiler/VerificationPass.cpp
-@@ -302,7 +302,7 @@ bool VerificationPass::verifyType(Type* type, Value* val)
-
- case IGCLLVM::VectorTyID:
- {
-- auto VType = cast<VectorType>(type);
-+ auto VType = cast<IGCLLVM::FixedVectorType>(type);
- unsigned typeSize = (unsigned)VType->getNumElements();
- if (!m_IGC_IR_spec.vectorTypeSizes.count(typeSize))
- {
-diff --git a/IGC/DebugInfo/DebugInfoUtils.hpp b/IGC/DebugInfo/DebugInfoUtils.hpp
-index 7f2e288a..b77a550d 100644
---- a/IGC/DebugInfo/DebugInfoUtils.hpp
-+++ b/IGC/DebugInfo/DebugInfoUtils.hpp
-@@ -108,7 +108,11 @@ namespace IGC
- IGCLLVM::DIBuilder Builder(M);
- llvm::DIGlobalVariable* GV = GVs[j]->getVariable();
- llvm::DIScope* scopeToUse = GV->getScope();
-+#if LLVM_VERSION_MAJOR >= 12
-+ llvm::DILocation* locToUse = llvm::DILocation::get(scopeToUse->getContext(), GV->getLine(), 0, scopeToUse, loc);
-+#else
- llvm::DILocation* locToUse = llvm::DebugLoc::get(GV->getLine(), 0, scopeToUse, loc);
-+#endif
- if (llvm::isa<llvm::DICompileUnit>(GV->getScope()))
- {
- // Function has no DebugLoc so it is either internal
-diff --git a/IGC/DebugInfo/DwarfDebug.cpp b/IGC/DebugInfo/DwarfDebug.cpp
-index 683b83f7..bd9f17b7 100644
---- a/IGC/DebugInfo/DwarfDebug.cpp
-+++ b/IGC/DebugInfo/DwarfDebug.cpp
-@@ -2102,9 +2102,17 @@ static DebugLoc getFnDebugLoc(DebugLoc DL, const LLVMContext& Ctx)
- // Check for number of operands since the compatibility is cheap here.
- if (SP->getNumOperands() > 19)
- {
-+#if LLVM_VERSION_MAJOR >= 12
-+ return DILocation::get(SP->getContext(), SP->getScopeLine(), 0, SP);
-+#else
- return DebugLoc::get(SP->getScopeLine(), 0, SP);
-+#endif
- }
-+#if LLVM_VERSION_MAJOR >= 12
-+ return DILocation::get(SP->getContext(), SP->getLine(), 0, SP);
-+#else
- return DebugLoc::get(SP->getLine(), 0, SP);
-+#endif
- }
-
- return DebugLoc();
-diff --git a/IGC/GenISAIntrinsics/GenIntrinsics.cpp b/IGC/GenISAIntrinsics/GenIntrinsics.cpp
-index 708cfdaa..772155b2 100644
---- a/IGC/GenISAIntrinsics/GenIntrinsics.cpp
-+++ b/IGC/GenISAIntrinsics/GenIntrinsics.cpp
-@@ -204,7 +204,7 @@ static Type *DecodeFixedType(ArrayRef<GenISAIntrinsic::IITDescriptor> &Infos,
- case IITDescriptor::SameVecWidthArgument: {
- Type *EltTy = DecodeFixedType(Infos, Tys, Context);
- Type *Ty = Tys[D.getArgumentNumber()];
-- if (VectorType *VTy = dyn_cast<VectorType>(Ty)) {
-+ if (IGCLLVM::FixedVectorType *VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty)) {
- return IGCLLVM::FixedVectorType::get(EltTy, int_cast<unsigned int>(VTy->getNumElements()));
- }
- IGC_ASSERT_EXIT_MESSAGE(0, "unhandled");
-@@ -215,7 +215,7 @@ static Type *DecodeFixedType(ArrayRef<GenISAIntrinsic::IITDescriptor> &Infos,
- }
- case IITDescriptor::VecOfPtrsToElt: {
- Type *Ty = Tys[D.getArgumentNumber()];
-- VectorType *VTy = dyn_cast<VectorType>(Ty);
-+ IGCLLVM::FixedVectorType *VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
- if (!VTy)
- IGC_ASSERT_EXIT_MESSAGE(0, "Expected an argument of Vector Type");
- Type *EltTy = cast<VectorType>(VTy)->getElementType();
-@@ -434,7 +434,7 @@ static std::string getMangledTypeStr(Type* Ty) {
- Result += "f";
- }
- else if (isa<VectorType>(Ty))
-- Result += "v" + utostr(cast<VectorType>(Ty)->getNumElements()) +
-+ Result += "v" + utostr(cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements()) +
- getMangledTypeStr(cast<VectorType>(Ty)->getElementType());
- else if (Ty)
- Result += EVT::getEVT(Ty).getEVTString();
-diff --git a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp
-index a89d63b9..a1bc5d2c 100644
---- a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp
-+++ b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp
-@@ -4929,7 +4929,7 @@ void LLVM3DBuilder<preserveNames, T, Inserter>::VectorToScalars(
- IGC_ASSERT(nullptr != vector->getType());
- IGC_ASSERT(vector->getType()->isVectorTy());
-
-- const unsigned count = (unsigned)llvm::cast<llvm::VectorType>(vector->getType())->getNumElements();
-+ const unsigned count = (unsigned)llvm::cast<IGCLLVM::FixedVectorType>(vector->getType())->getNumElements();
- IGC_ASSERT(1 < count);
- IGC_ASSERT(count <= 4);
- IGC_ASSERT(count <= maxSize);
-diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
-index 08e5d6cf..30e29720 100644
---- a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
-+++ b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
-@@ -35,10 +35,16 @@ using namespace llvm;
- namespace IGCLLVM {
- #if LLVM_VERSION_MAJOR < 11
- inline unsigned getElementCount(unsigned EC) { return EC; }
--#else
-+#elif LLVM_VERSION_MAJOR == 11
- inline ElementCount getElementCount(unsigned EC) {
- return ElementCount(EC, false);
- }
-+#elif LLVM_VERSION_MAJOR == 12
-+inline ElementCount getElementCount(unsigned EC) {
-+ return ElementCount::get(EC, false);
-+}
-+#else
-+#error "unsupported LLVM version"
- #endif
- } // namespace IGCLLVM
-
-diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h
-index f6e54fb1..5266ee87 100644
---- a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h
-+++ b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h
-@@ -44,7 +44,7 @@ namespace IGCLLVM
- {
- return llvm::createLoopUnrollPass(OptLevel, false, Threshold, Count, AllowPartial, Runtime, UpperBound, AllowPeeling);
- }
--#elif LLVM_VERSION_MAJOR == 9 || LLVM_VERSION_MAJOR == 10 || LLVM_VERSION_MAJOR == 11
-+#elif LLVM_VERSION_MAJOR >= 9 && LLVM_VERSION_MAJOR <= 12
- inline static llvm::Pass * createLoopUnrollPass(
- int OptLevel = 2, int Threshold = -1, int Count = -1,
- int AllowPartial = -1, int Runtime = -1,
-@@ -52,7 +52,7 @@ namespace IGCLLVM
- {
- return llvm::createLoopUnrollPass(OptLevel, false, false, Threshold, Count, AllowPartial, Runtime, UpperBound, AllowPeeling);
- }
--#elif LLVM_VERSION_MAJOR >= 12
-+#else
- //DO NOT assume same function signature for all incoming llvm versions! Double check to upgrade!
- #error Not supported llvm version.
- #endif
-diff --git a/IGC/common/igc_resourceDimTypes.h b/IGC/common/igc_resourceDimTypes.h
-index 6831b06c..d790330f 100644
---- a/IGC/common/igc_resourceDimTypes.h
-+++ b/IGC/common/igc_resourceDimTypes.h
-@@ -66,6 +66,11 @@ namespace IGC
- resourceDimTypeId == DIM_2D_TYPE || resourceDimTypeId == DIM_2D_ARRAY_TYPE ||
- resourceDimTypeId == DIM_3D_TYPE || resourceDimTypeId == DIM_CUBE_TYPE || resourceDimTypeId == DIM_CUBE_ARRAY_TYPE));
-
-+#if LLVM_VERSION_MAJOR >= 12
-+ llvm::LLVMContext& llvmCtx = module.getContext();
-+ return llvm::StructType::getTypeByName(llvmCtx, ResourceDimensionTypeName[resourceDimTypeId]);
-+#else
- return module.getTypeByName(ResourceDimensionTypeName[resourceDimTypeId]);
-+#endif
- }
- }
-\ No newline at end of file
---
-2.17.1
-
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-external-SPIRV-Tools-change-path-to-tools-and-header.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-external-SPIRV-Tools-change-path-to-tools-and-header.patch
new file mode 100644
index 00000000..dca75e22
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-external-SPIRV-Tools-change-path-to-tools-and-header.patch
@@ -0,0 +1,31 @@
+From e69a3181482e5f442756a61c7b683914072884f1 Mon Sep 17 00:00:00 2001
+From: Anuj Mittal <anuj.mittal@intel.com>
+Date: Mon, 9 Jan 2023 11:43:05 +0800
+Subject: [PATCH] external/SPIRV-Tools: change path to tools and headers
+
+We clone the SPIRV headers and tools in a different directory to ensure
+file path substitutions take place.
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+
+---
+ external/SPIRV-Tools/CMakeLists.txt | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/external/SPIRV-Tools/CMakeLists.txt b/external/SPIRV-Tools/CMakeLists.txt
+index 9afa5746c..7ca24d5dc 100644
+--- a/external/SPIRV-Tools/CMakeLists.txt
++++ b/external/SPIRV-Tools/CMakeLists.txt
+@@ -43,8 +43,8 @@ else() #By default use build from sources
+ message(STATUS "[SPIRV-Tools] : Building from source")
+ message(STATUS "[SPIRV-Tools] : Current source dir: ${CMAKE_CURRENT_SOURCE_DIR}")
+
+- set(SPIRV-Headers_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../SPIRV-Headers") # used in subdirectory
+- set(SPIRV-Tools_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../SPIRV-Tools")
++ set(SPIRV-Headers_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../SPIRV-Headers") # used in subdirectory
++ set(SPIRV-Tools_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../SPIRV-Tools")
+
+ set(SPIRV-Tools_OUTPUT_DIR "${IGC_OPTION__OUTPUT_DIR}/external/SPIRV-Tools/build")
+ set(IGC_BUILD__SPIRV-Headers_DIR "${SPIRV-Headers_SOURCE_DIR}")
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-fix-tblgen.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-fix-tblgen.patch
new file mode 100644
index 00000000..39443931
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-fix-tblgen.patch
@@ -0,0 +1,24 @@
+From 5648568e597acd0fed82aac3e6aef0f95a1b78d1 Mon Sep 17 00:00:00 2001
+From: Anuj Mittal <anuj.mittal@intel.com>
+Date: Thu, 19 May 2022 22:50:09 +0800
+Subject: [PATCH] fix tblgen
+
+Upstream-Status: Inappropriate [OE specific]
+
+---
+ IGC/cmake/igc_llvm.cmake | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/IGC/cmake/igc_llvm.cmake b/IGC/cmake/igc_llvm.cmake
+index 10322533c..9020cb3c8 100644
+--- a/IGC/cmake/igc_llvm.cmake
++++ b/IGC/cmake/igc_llvm.cmake
+@@ -52,7 +52,7 @@ else()
+ set(LLVM_OPT_EXE "opt" CACHE STRING "")
+
+ set(LLVM_TABLEGEN_EXE "llvm-tblgen")
+- if(CMAKE_CROSSCOMPILING)
++ if(TRUE)
+ if(DEFINED LLVM_TABLEGEN)
+ set(LLVM_TABLEGEN_EXE ${LLVM_TABLEGEN})
+ else()
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-skip-execution-of-ElfPackager.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-skip-execution-of-ElfPackager.patch
deleted file mode 100644
index 65342d9c..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-skip-execution-of-ElfPackager.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 5501fab763aa2b11437fbdb19e07a11157a7d3e6 Mon Sep 17 00:00:00 2001
-From: Naveen Saini <naveen.kumar.saini@intel.com>
-Date: Thu, 6 Feb 2020 14:56:56 +0800
-Subject: [PATCH] skip execution of ElfPackager
-
-ElfPackager adds the ability to convert llvm bitcode into elf files for
-easier partitioning. Skip for now until we start building a native
-version for this.
-
-Upstream-Status: Inappropriate [configuration specific]
-
-Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
----
- IGC/ElfPackager/CMakeLists.txt | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/IGC/ElfPackager/CMakeLists.txt b/IGC/ElfPackager/CMakeLists.txt
-index 563ac9d6..c6c74ce9 100644
---- a/IGC/ElfPackager/CMakeLists.txt
-+++ b/IGC/ElfPackager/CMakeLists.txt
-@@ -71,12 +71,12 @@ include_directories (
- ${IGC_SOURCE_DIR}/AdaptorOCL/CLElfLib/
- )
-
--if(NOT ANDROID)
-- add_custom_command(TARGET ${IGC_BUILD__PROJ__ElfPackager}
-- POST_BUILD
-- COMMAND $<TARGET_FILE:${IGC_BUILD__PROJ__ElfPackager}> -includeSizet -funcList ${CMAKE_CURRENT_SOURCE_DIR}/function_bin.txt ${IGC_BUILD__BIF_DIR}/OCLBiFImpl.bc ${IGC_BUILD__BIF_DIR}/igdclbif.bin
-- )
--endif()
-+#if(NOT ANDROID)
-+# add_custom_command(TARGET ${IGC_BUILD__PROJ__ElfPackager}
-+# POST_BUILD
-+# COMMAND $<TARGET_FILE:${IGC_BUILD__PROJ__ElfPackager}> -includeSizet -funcList ${CMAKE_CURRENT_SOURCE_DIR}/function_bin.txt ${IGC_BUILD__BIF_DIR}/OCLBiFImpl.bc ${IGC_BUILD__BIF_DIR}/igdclbif.bin
-+# )
-+#endif()
-
-
- add_dependencies("${IGC_BUILD__PROJ__ElfPackager}" "${IGC_BUILD__PROJ__BiFModule_OCL}")
---
-2.17.1
-
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-Review-fixes-for-LLVM-12-phase-1.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-Review-fixes-for-LLVM-12-phase-1.patch
deleted file mode 100644
index 6580df75..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-Review-fixes-for-LLVM-12-phase-1.patch
+++ /dev/null
@@ -1,318 +0,0 @@
-From 60136b453bb3a109bfc88c4040b871af9d522ed5 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= <zboszor@pr.hu>
-Date: Thu, 25 Feb 2021 19:40:21 +0100
-Subject: [PATCH 2/3] Review fixes for LLVM 12 phase 1
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Upstream-Status: Pending
-
-Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
----
- IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | 6 +-----
- IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp | 6 +-----
- IGC/Compiler/CISACodeGen/AdvMemOpt.cpp | 7 ++-----
- IGC/Compiler/CISACodeGen/Simd32Profitability.cpp | 7 ++-----
- IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp | 11 +----------
- IGC/Compiler/GenTTI.cpp | 9 ++-------
- IGC/Compiler/Legalizer/InstPromoter.cpp | 8 +-------
- .../DeviceEnqueueFuncs/TransformBlocks.cpp | 6 +-----
- .../OpenCLPasses/WIFuncs/WIFuncResolution.cpp | 4 ----
- IGC/Compiler/Optimizer/Scalarizer.cpp | 2 +-
- IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h | 10 ++++++++++
- .../include/llvmWrapper/Support/TypeSize.h | 4 +---
- .../include/llvmWrapper/Transforms/Utils/LoopUtils.h | 8 ++++++++
- IGC/common/igc_resourceDimTypes.h | 5 ++---
- 14 files changed, 33 insertions(+), 60 deletions(-)
-
-diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
-index 725a1512..12f42be8 100644
---- a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
-+++ b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
-@@ -1929,11 +1929,7 @@ SPIRVToLLVM::transType(SPIRVType *T) {
- auto name = isSubgroupAvcINTELTypeOpCode(OC) ?
- OCLSubgroupINTELTypeOpCodeMap::rmap(OC) :
- BuiltinOpaqueGenericTypeOpCodeMap::rmap(OC);
--#if LLVM_VERSION_MAJOR >= 12
-- auto *pST = llvm::StructType::getTypeByName(M->getContext(), name);
--#else
-- auto *pST = M->getTypeByName(name);
--#endif
-+ auto *pST = IGCLLVM::getTypeByName(M, name);
- pST = pST ? pST : StructType::create(*Context, name);
-
- return mapType(T, PointerType::get(pST, getOCLOpaqueTypeAddrSpace(OC)));
-diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
-index 91b4623c..f4f0dee5 100644
---- a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
-+++ b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
-@@ -93,11 +93,7 @@ saveLLVMModule(Module *M, const std::string &OutputFile) {
- PointerType*
- getOrCreateOpaquePtrType(Module *M, const std::string &Name,
- unsigned AddrSpace) {
--#if LLVM_VERSION_MAJOR >= 12
-- auto OpaqueType = llvm::StructType::getTypeByName(M->getContext(), Name);
--#else
-- auto OpaqueType = M->getTypeByName(Name);
--#endif
-+ auto OpaqueType = IGCLLVM::getTypeByName(M, Name);
- if (!OpaqueType)
- OpaqueType = StructType::create(M->getContext(), Name);
- return PointerType::get(OpaqueType, AddrSpace);
-diff --git a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
-index fc45a510..a612a473 100644
---- a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
-+++ b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
-@@ -33,6 +33,7 @@ IN THE SOFTWARE.
- #include <llvm/Support/Debug.h>
- #include <llvm/Support/raw_ostream.h>
- #include <llvm/Transforms/Utils/Local.h>
-+#include "llvmWrapper/Transforms/Utils/LoopUtils.h"
- #include "common/LLVMWarningsPop.hpp"
- #include "GenISAIntrinsics/GenIntrinsics.h"
- #include "Compiler/CISACodeGen/ShaderCodeGen.hpp"
-@@ -134,11 +135,7 @@ bool AdvMemOpt::runOnFunction(Function& F) {
- for (auto I = LI->begin(), E = LI->end(); I != E; ++I)
- for (auto DFI = df_begin(*I), DFE = df_end(*I); DFI != DFE; ++DFI) {
- Loop* L = *DFI;
--#if LLVM_VERSION_MAJOR >= 12
-- if (L->isInnermost())
--#else
-- if (L->empty())
--#endif
-+ if (IGCLLVM::isInnermost(L))
- InnermostLoops.push_back(L);
- }
-
-diff --git a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
-index c1f4a419..5393d4e8 100644
---- a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
-+++ b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
-@@ -28,6 +28,7 @@ IN THE SOFTWARE.
- #include "Compiler/CISACodeGen/Platform.hpp"
- #include "common/LLVMWarningsPush.hpp"
- #include <llvmWrapper/IR/DerivedTypes.h>
-+#include <llvmWrapper/Transforms/Utils/LoopUtils.h>
- #include <llvm/IR/InstIterator.h>
- #include <llvm/IR/Operator.h>
- #include <llvmWrapper/IR/DerivedTypes.h>
-@@ -995,11 +996,7 @@ static bool hasLongStridedLdStInLoop(Function* F, LoopInfo* LI, WIAnalysis* WI)
- // Collect innermost simple loop.
- for (auto I = LI->begin(), E = LI->end(); I != E; ++I) {
- auto L = *I;
--#if LLVM_VERSION_MAJOR >= 12
-- if (!L->isInnermost())
--#else
-- if (!L->empty())
--#endif
-+ if (!IGCLLVM::isInnermost(L))
- continue;
- if (L->getNumBlocks() != 2)
- continue;
-diff --git a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
-index adf992cb..33473c23 100644
---- a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
-+++ b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
-@@ -153,21 +153,12 @@ void ConvertMSAAPayloadTo16Bit::visitCallInst(CallInst& I)
- // In OGL there are uses of ldmcs other then ldms, using vec4float type.
- // Fix them to use newly created 16bit ldmcs.
- if (ldmcs->getType()->isVectorTy() &&
--#if LLVM_VERSION_MAJOR >= 12
-- ldmcs->getType()->getScalarType()->isFloatTy())
--#else
-- ldmcs->getType()->getVectorElementType()->isFloatTy())
--#endif
-+ cast<IGCLLVM::FixedVectorType>(ldmcs->getType())->getElementType()->isFloatTy())
- {
- m_builder->SetInsertPoint(ldmcs);
-
--#if LLVM_VERSION_MAJOR >= 12
- uint ldmcsNumOfElements = cast<IGCLLVM::FixedVectorType>(ldmcs->getType())->getNumElements();
- uint new_mcs_callNumOfElements = cast<IGCLLVM::FixedVectorType>(new_mcs_call->getType())->getNumElements();
--#else
-- uint ldmcsNumOfElements = ldmcs->getType()->getVectorNumElements();
-- uint new_mcs_callNumOfElements = new_mcs_call->getType()->getVectorNumElements();
--#endif
-
- // vec of 16bit ints to vec of 32bit ints
- Type* new_mcs_callVecType = IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), new_mcs_callNumOfElements);
-diff --git a/IGC/Compiler/GenTTI.cpp b/IGC/Compiler/GenTTI.cpp
-index 9e4d2f26..53e3ec9e 100644
---- a/IGC/Compiler/GenTTI.cpp
-+++ b/IGC/Compiler/GenTTI.cpp
-@@ -37,6 +37,7 @@ IN THE SOFTWARE.
- #include "llvm/Analysis/LoopInfo.h"
- #include "llvm/Analysis/ScalarEvolution.h"
- #include "llvm/Support/raw_ostream.h"
-+#include "llvmWrapper/Transforms/Utils/LoopUtils.h"
- #include "common/LLVMWarningsPop.hpp"
-
- using namespace llvm;
-@@ -216,13 +217,7 @@ namespace llvm {
-
- // Skip non-simple loop.
- if (L->getNumBlocks() != 1) {
-- if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) &&
--#if LLVM_VERSION_MAJOR >= 12
-- L->isInnermost()
--#else
-- L->empty()
--#endif
-- ) {
-+ if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) && IGCLLVM::isInnermost(L)) {
- auto countNonPHI = [](BasicBlock* BB) {
- unsigned Total = BB->size();
- unsigned PHIs = 0;
-diff --git a/IGC/Compiler/Legalizer/InstPromoter.cpp b/IGC/Compiler/Legalizer/InstPromoter.cpp
-index 8fadf89f..63cbccb5 100644
---- a/IGC/Compiler/Legalizer/InstPromoter.cpp
-+++ b/IGC/Compiler/Legalizer/InstPromoter.cpp
-@@ -398,13 +398,7 @@ bool InstPromoter::visitBitCastInst(BitCastInst& I) {
- IRB->CreateBitCast(Val, IGCLLVM::FixedVectorType::get(DestTy->getScalarType(), N));
-
- std::vector<Constant*> Vals;
-- for (unsigned i = 0;
--#if LLVM_VERSION_MAJOR >= 12
-- i < cast<IGCLLVM::FixedVectorType>(DestTy)->getNumElements();
--#else
-- i < DestTy->getVectorNumElements();
--#endif
-- i++)
-+ for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(DestTy)->getNumElements(); i++)
- Vals.push_back(IRB->getInt32(i));
-
- Value* Mask = ConstantVector::get(Vals);
-diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
-index 119520ed..a3681b79 100644
---- a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
-+++ b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
-@@ -952,11 +952,7 @@ namespace //Anonymous
- {
- auto ndrangeStructName = "struct.ndrange_t";
- auto module = _deviceExecCall->getModule();
--#if LLVM_VERSION_MAJOR >= 12
-- auto ndrangeTy = llvm::StructType::getTypeByName(module->getContext(), ndrangeStructName);
--#else
-- auto ndrangeTy = module->getTypeByName(ndrangeStructName);
--#endif
-+ auto ndrangeTy = IGCLLVM::getTypeByName(module, ndrangeStructName);
- if (ndrangeTy == nullptr)
- {
- //create struct type
-diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
-index 535d6268..c23c661d 100644
---- a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
-+++ b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
-@@ -303,11 +303,7 @@ static Value* BuildLoadInst(CallInst& CI, unsigned int Offset, Type* DataType)
- auto Size = ElemByteSize;
- if (DataType->isVectorTy())
- {
--#if LLVM_VERSION_MAJOR >= 12
- Size *= cast<IGCLLVM::FixedVectorType>(DataType)->getNumElements();
--#else
-- Size *= DataType->getVectorNumElements();
--#endif
- }
- unsigned int AlignedOffset = (Offset / ElemByteSize) * ElemByteSize;
- unsigned int LoadByteSize = (Offset == AlignedOffset) ? Size : Size * 2;
-diff --git a/IGC/Compiler/Optimizer/Scalarizer.cpp b/IGC/Compiler/Optimizer/Scalarizer.cpp
-index a4e73a6d..38627553 100644
---- a/IGC/Compiler/Optimizer/Scalarizer.cpp
-+++ b/IGC/Compiler/Optimizer/Scalarizer.cpp
-@@ -778,7 +778,7 @@ void ScalarizeFunction::scalarizeInstruction(ShuffleVectorInst* SI)
-
- // Generate array for shuffled scalar values
- SmallVector<Value*, MAX_INPUT_VECTOR_WIDTH>newVector;
-- unsigned width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(SI->getType())->getNumElements());
-+ unsigned width = int_cast<unsigned>(cast<IGCLLVM::FixedVectorType>(SI->getType())->getNumElements());
-
- // Generate undef value, which may be needed as some scalar elements
- UndefValue* undef = UndefValue::get(inputType->getElementType());
-diff --git a/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h b/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h
-index a3f5a0b8..6a5407bb 100644
---- a/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h
-+++ b/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h
-@@ -29,6 +29,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- #include "llvm/Config/llvm-config.h"
- #include "llvm/IR/DerivedTypes.h"
-+#include "llvm/IR/Module.h"
-
- namespace IGCLLVM
- {
-@@ -62,6 +63,15 @@ namespace IGCLLVM
- return false;
- #endif
- }
-+
-+ inline llvm::StructType *getTypeByName(llvm::Module *M, llvm::StringRef Name) {
-+#if LLVM_VERSION_MAJOR >= 12
-+ return llvm::StructType::getTypeByName(M->getContext(), Name);
-+#else
-+ return M->getTypeByName(Name);
-+#endif
-+ }
-+
- }
-
- #endif
-diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
-index 30e29720..7021820c 100644
---- a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
-+++ b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
-@@ -39,12 +39,10 @@ inline unsigned getElementCount(unsigned EC) { return EC; }
- inline ElementCount getElementCount(unsigned EC) {
- return ElementCount(EC, false);
- }
--#elif LLVM_VERSION_MAJOR == 12
-+#else
- inline ElementCount getElementCount(unsigned EC) {
- return ElementCount::get(EC, false);
- }
--#else
--#error "unsupported LLVM version"
- #endif
- } // namespace IGCLLVM
-
-diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h
-index db47b00b..bce9cfc1 100644
---- a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h
-+++ b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h
-@@ -41,6 +41,14 @@ namespace IGCLLVM
- return llvm::InsertPreheaderForLoop(L, DT, LI, nullptr, PreserveLCSSA);
- }
- #endif
-+
-+ inline bool isInnermost(llvm::Loop *L) {
-+#if LLVM_VERSION_MAJOR >= 12
-+ return L->isInnermost();
-+#else
-+ return L->empty();
-+#endif
-+ }
- }
-
- #endif
-diff --git a/IGC/common/igc_resourceDimTypes.h b/IGC/common/igc_resourceDimTypes.h
-index d790330f..2d675969 100644
---- a/IGC/common/igc_resourceDimTypes.h
-+++ b/IGC/common/igc_resourceDimTypes.h
-@@ -67,10 +67,9 @@ namespace IGC
- resourceDimTypeId == DIM_3D_TYPE || resourceDimTypeId == DIM_CUBE_TYPE || resourceDimTypeId == DIM_CUBE_ARRAY_TYPE));
-
- #if LLVM_VERSION_MAJOR >= 12
-- llvm::LLVMContext& llvmCtx = module.getContext();
-- return llvm::StructType::getTypeByName(llvmCtx, ResourceDimensionTypeName[resourceDimTypeId]);
-+ return llvm::StructType::getTypeByName(module.getContext(), ResourceDimensionTypeName[resourceDimTypeId]);
- #else
- return module.getTypeByName(ResourceDimensionTypeName[resourceDimTypeId]);
- #endif
- }
--}
-\ No newline at end of file
-+}
---
-2.17.1
-
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/improve_src_package_reproducibility.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0003-Improve-Reproducibility-for-src-package.patch
index c694836f..650130a8 100644
--- a/dynamic-layers/clang-layer/recipes-opencl/igc/files/improve_src_package_reproducibility.patch
+++ b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0003-Improve-Reproducibility-for-src-package.patch
@@ -1,4 +1,4 @@
-From 2fa3f2da1179bd5b2eeac82839d386f0111e611c Mon Sep 17 00:00:00 2001
+From 0559332abd04b6c8bc70171d201f43d2e4735336 Mon Sep 17 00:00:00 2001
From: Lee Chee Yang <chee.yang.lee@intel.com>
Date: Wed, 2 Sep 2020 08:28:35 +0800
Subject: [PATCH] Improve Reproducibility for src package
@@ -9,15 +9,16 @@ this only works on bison 3.7 onward, hence check for bison version
before adding the flags.
Upstream-Status: Inappropriate [applying --file-prefix-map in such way does not work for upstream]
Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
+
---
visa/CMakeLists.txt | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/visa/CMakeLists.txt b/visa/CMakeLists.txt
-index 981c35d2..d5944370 100644
+index 6be467587..930c386a6 100644
--- a/visa/CMakeLists.txt
+++ b/visa/CMakeLists.txt
-@@ -109,8 +109,11 @@ endif()
+@@ -123,8 +123,11 @@ endif()
set(bison_output_file ${CMAKE_CURRENT_BINARY_DIR}/CISA.tab.cpp)
set(flex_output_file ${CMAKE_CURRENT_BINARY_DIR}/lex.CISA.cpp)
@@ -31,6 +32,3 @@ index 981c35d2..d5944370 100644
ADD_FLEX_BISON_DEPENDENCY(CISAScanner CISAParser)
set(CISAScanner_dependencies)
---
-2.28.0
-
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0003-Review-fixes-for-LLVM-12-phase-2.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0003-Review-fixes-for-LLVM-12-phase-2.patch
deleted file mode 100644
index 189c2b3f..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0003-Review-fixes-for-LLVM-12-phase-2.patch
+++ /dev/null
@@ -1,123 +0,0 @@
-From c6d333637537263930acb1b6c5dadb0467d745f6 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= <zboszor@pr.hu>
-Date: Fri, 26 Feb 2021 06:39:35 +0100
-Subject: [PATCH 3/3] Review fixes for LLVM 12 phase 2
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Upstream-Status: Pending
-
-Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
----
- IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | 4 ----
- .../AddressSpaceAliasAnalysis.cpp | 10 +++++-----
- .../PrivateMemory/PrivateMemoryResolution.cpp | 4 ----
- IGC/DebugInfo/DebugInfoUtils.hpp | 4 ----
- IGC/DebugInfo/DwarfDebug.cpp | 8 --------
- 5 files changed, 5 insertions(+), 25 deletions(-)
-
-diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
-index 12f42be8..c4f9d1ea 100644
---- a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
-+++ b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
-@@ -1576,11 +1576,7 @@ void SPIRVToLLVMDbgTran::transDbgInfo(SPIRVValue *SV, Value *V) {
- Line->getColumn(), scope, iat);
-
- if(scope && !isa<DIFile>(scope))
--#if LLVM_VERSION_MAJOR >= 12
- I->setDebugLoc(DILocation::get(scope->getContext(), Line->getLine(), Line->getColumn(),
--#else
-- I->setDebugLoc(DebugLoc::get(Line->getLine(), Line->getColumn(),
--#endif
- scope, iat));
- }
- }
-diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
-index e9c07b34..b6b779da 100644
---- a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
-+++ b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
-@@ -23,8 +23,7 @@ IN THE SOFTWARE.
- ============================= end_copyright_notice ===========================*/
-
- #include "llvm/Config/llvm-config.h"
--#include "llvmWrapper/IR/DerivedTypes.h"
--#include "llvmWrapper/Analysis/TargetLibraryInfo.h"
-+#include <llvm/Analysis/TargetLibraryInfo.h>
- #include "Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.h"
- #include "Compiler/CodeGenPublic.h"
- #include "Compiler/IGCPassSupport.h"
-@@ -180,11 +179,12 @@ namespace {
- bool doInitialization(Module& M) override {
- if(M.size() > 0)
- {
-+ Result.reset(new AddressSpaceAAResult(
-+ getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(
- #if LLVM_VERSION_MAJOR >= 10
-- Function &F = *M.begin();
-+ *M.begin()
- #endif
-- Result.reset(new AddressSpaceAAResult(
-- getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(),
-+ ),
- *getAnalysis<CodeGenContextWrapper>().getCodeGenContext()));
- }
- return false;
-diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
-index 07f85f4c..98ea616f 100644
---- a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
-+++ b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
-@@ -816,11 +816,7 @@ bool PrivateMemoryResolution::resolveAllocaInstructions(bool privateOnStack)
- // Construct an empty DebugLoc.
- IF_DEBUG_INFO(DebugLoc entryDebugLoc);
- // Assign with the function location if available.
--#if LLVM_VERSION_MAJOR >= 12
- IF_DEBUG_INFO_IF(DISubprogram *subprogram = m_currFunction->getSubprogram(), entryDebugLoc = DILocation::get(subprogram->getContext(), subprogram->getLine(), 0, subprogram););
--#else
-- IF_DEBUG_INFO_IF(DISubprogram *subprogram = m_currFunction->getSubprogram(), entryDebugLoc = DebugLoc::get(subprogram->getLine(), 0, subprogram););
--#endif
- IF_DEBUG_INFO(entryBuilder.SetCurrentDebugLocation(entryDebugLoc));
-
- if (privateOnStack)
-diff --git a/IGC/DebugInfo/DebugInfoUtils.hpp b/IGC/DebugInfo/DebugInfoUtils.hpp
-index b77a550d..88b30a75 100644
---- a/IGC/DebugInfo/DebugInfoUtils.hpp
-+++ b/IGC/DebugInfo/DebugInfoUtils.hpp
-@@ -108,11 +108,7 @@ namespace IGC
- IGCLLVM::DIBuilder Builder(M);
- llvm::DIGlobalVariable* GV = GVs[j]->getVariable();
- llvm::DIScope* scopeToUse = GV->getScope();
--#if LLVM_VERSION_MAJOR >= 12
- llvm::DILocation* locToUse = llvm::DILocation::get(scopeToUse->getContext(), GV->getLine(), 0, scopeToUse, loc);
--#else
-- llvm::DILocation* locToUse = llvm::DebugLoc::get(GV->getLine(), 0, scopeToUse, loc);
--#endif
- if (llvm::isa<llvm::DICompileUnit>(GV->getScope()))
- {
- // Function has no DebugLoc so it is either internal
-diff --git a/IGC/DebugInfo/DwarfDebug.cpp b/IGC/DebugInfo/DwarfDebug.cpp
-index bd9f17b7..3d9f0835 100644
---- a/IGC/DebugInfo/DwarfDebug.cpp
-+++ b/IGC/DebugInfo/DwarfDebug.cpp
-@@ -2102,17 +2102,9 @@ static DebugLoc getFnDebugLoc(DebugLoc DL, const LLVMContext& Ctx)
- // Check for number of operands since the compatibility is cheap here.
- if (SP->getNumOperands() > 19)
- {
--#if LLVM_VERSION_MAJOR >= 12
- return DILocation::get(SP->getContext(), SP->getScopeLine(), 0, SP);
--#else
-- return DebugLoc::get(SP->getScopeLine(), 0, SP);
--#endif
- }
--#if LLVM_VERSION_MAJOR >= 12
- return DILocation::get(SP->getContext(), SP->getLine(), 0, SP);
--#else
-- return DebugLoc::get(SP->getLine(), 0, SP);
--#endif
- }
-
- return DebugLoc();
---
-2.17.1
-
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/link-to-LLVMGenXIntrinsics.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/link-to-LLVMGenXIntrinsics.patch
deleted file mode 100644
index aead2d1c..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/igc/files/link-to-LLVMGenXIntrinsics.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From 11b923c99cbe3580885ce40c322277fc823107a0 Mon Sep 17 00:00:00 2001
-From: Naveen Saini <naveen.kumar.saini@intel.com>
-Date: Tue, 2 Feb 2021 13:39:53 +0800
-Subject: [PATCH] IGC/VectorCompiler/CMakeLists.txt: link to external
- LLVMGenXIntrinsics
-
-By default LLVMGenXIntrinsics is to be build In-tree, but we want to
-link externally.
-
-Fix llvm-tblgen path.
-
-Upstream-Status: Inappropriate [configuration specific]
-
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
----
- IGC/VectorCompiler/CMakeLists.txt | 32 ++-----------------------------
- 1 file changed, 2 insertions(+), 30 deletions(-)
-
-diff --git a/IGC/VectorCompiler/CMakeLists.txt b/IGC/VectorCompiler/CMakeLists.txt
-index 86f343ee..b4268160 100644
---- a/IGC/VectorCompiler/CMakeLists.txt
-+++ b/IGC/VectorCompiler/CMakeLists.txt
-@@ -53,10 +53,7 @@ if(IGC_BUILD__USING_SYSTEM_LLVM OR (WIN32 AND LLVM_USE_PREBUILT))
- message(STATUS "[VC] Using system llvm")
-
- # Need to search for llvm-tblgen
-- find_program(LLVM_TABLEGEN_EXE "llvm-tblgen"
-- ${LLVM_TOOLS_BINARY_DIR}
-- NO_DEFAULT_PATH
-- )
-+ find_program(LLVM_TABLEGEN_EXE "llvm-tblgen")
- if(LLVM_TABLEGEN_EXE-NOTFOUND)
- message(FATAL_ERROR "[VC] llvm-tblgen is not found")
- endif()
-@@ -140,32 +137,7 @@ if(LLVM_ON_WIN32)
- add_compile_options(/wd4141)
- endif()
-
--if(DEFINED VC_INTRINSICS_SRC)
-- set(INTRSRC "${VC_INTRINSICS_SRC}/GenXIntrinsics")
--endif()
--
--if(NOT DEFINED INTRSRC)
-- set(INTRSRC "${CMAKE_CURRENT_SOURCE_DIR}/../../../vc-intrinsics/GenXIntrinsics")
--endif()
--
--message(STATUS "[VC] Using vc-intrinsics source from: ${INTRSRC}")
--
--# We are using prebuilt SPIRV and building intrinsics.
--set(INTRBUILD "${CMAKE_CURRENT_BINARY_DIR}/intrbuild")
--add_subdirectory(${INTRSRC} ${INTRBUILD})
--# Make separate target for intrinstics headers.
--# Ideally, this should be inside intrinsics, but
--# this breaks in-tree build of intrinsics with LLVM.
--add_library(VCIntrinsicsHeaders INTERFACE)
--target_include_directories(VCIntrinsicsHeaders
-- INTERFACE
-- ${INTRSRC}/include
-- ${INTRBUILD}/include
-- )
--add_dependencies(VCIntrinsicsHeaders
-- GenXIntrinsics
-- )
--
-+find_package(LLVMGenXIntrinsics REQUIRED)
- include(cmake/spirv.cmake)
- include(${IGC_SOURCE_DIR}/cmake/utils.cmake)
-
---
-2.17.1
-
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.16510.2.bb b/dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.16510.2.bb
new file mode 100644
index 00000000..24eb97bd
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.16510.2.bb
@@ -0,0 +1,75 @@
+SUMMARY = "The Intel(R) Graphics Compiler for OpenCL(TM)"
+DESCRIPTION = "The Intel(R) Graphics Compiler for OpenCL(TM) is an \
+llvm based compiler for OpenCL(TM) targeting Intel Gen graphics \
+hardware architecture."
+
+LICENSE = "MIT & Apache-2.0"
+LIC_FILES_CHKSUM = "file://IGC/BiFModule/Implementation/ExternalLibraries/libclc/LICENSE.TXT;md5=311cfc1a5b54bab8ed34a0b5fba4373e \
+ file://LICENSE.md;md5=488d74376edf2765f6e78d271543dde3 \
+ file://NOTICES.txt;md5=b81a52411c84df3419f20bad4d755880"
+
+SRC_URI = "git://github.com/intel/intel-graphics-compiler.git;protocol=https;name=igc;branch=releases/igc-1.0.16510 \
+ git://github.com/intel/vc-intrinsics.git;protocol=https;destsuffix=git/vc-intrinsics;name=vc;nobranch=1 \
+ git://github.com/KhronosGroup/SPIRV-Tools.git;protocol=https;destsuffix=git/SPIRV-Tools;name=spirv-tools;branch=main \
+ git://github.com/KhronosGroup/SPIRV-Headers.git;protocol=https;destsuffix=git/SPIRV-Headers;name=spirv-headers;branch=main \
+ file://0003-Improve-Reproducibility-for-src-package.patch \
+ file://0001-BiF-CMakeLists.txt-remove-opt-from-DEPENDS.patch \
+ file://0001-external-SPIRV-Tools-change-path-to-tools-and-header.patch \
+ "
+
+SRC_URI:append:class-native = " file://0001-fix-tblgen.patch"
+
+SRCREV_igc = "c2495d45f37fadd963ad22eb0cc1a8235a306775"
+SRCREV_vc = "f9c34404d0ea9abad83875a10bd48d88cea90ebd"
+SRCREV_spirv-tools = "f0cc85efdbbe3a46eae90e0f915dc1509836d0fc"
+SRCREV_spirv-headers = "1c6bb2743599e6eb6f37b2969acc0aef812e32e3"
+
+SRCREV_FORMAT = "igc_vc_spirv-tools_spirv-headers"
+
+# Used to replace with relative path in reproducibility patch
+export B
+
+S = "${WORKDIR}/git"
+
+inherit cmake pkgconfig qemu python3native
+
+CXXFLAGS:append = " -Wno-error=nonnull"
+
+COMPATIBLE_HOST = '(x86_64).*-linux'
+COMPATIBLE_HOST:libc-musl = "null"
+
+DEPENDS += " flex-native bison-native clang clang-cross-x86_64 opencl-clang qemu-native python3-mako-native"
+
+RDEPENDS:${PN} += "opencl-clang"
+
+PACKAGECONFIG ??= "vc"
+PACKAGECONFIG[vc] = "-DIGC_BUILD__VC_ENABLED=ON -DIGC_OPTION__LINK_KHRONOS_SPIRV_TRANSLATOR=ON -DIGC_OPTION__SPIRV_TRANSLATOR_MODE=Prebuilds,-DIGC_BUILD__VC_ENABLED=OFF,"
+
+EXTRA_OECMAKE = " \
+ -DIGC_OPTION__LLVM_PREFERRED_VERSION=${LLVMVERSION} \
+ -DVC_INTRINSICS_SRC="${S}/vc-intrinsics" \
+ -DIGC_OPTION__LLVM_MODE=Prebuilds \
+ -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
+ -DLLVM_LINK_EXE=${STAGING_BINDIR_NATIVE}/llvm-link \
+ -DCLANG_EXE=${STAGING_BINDIR_NATIVE}/clang \
+ -DCMAKE_CROSSCOMPILING_EMULATOR=${WORKDIR}/qemuwrapper \
+ "
+
+do_configure:prepend:class-target () {
+ # Write out a qemu wrapper that will be used by cmake.
+ qemu_binary="${@qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST'), [d.expand('${STAGING_DIR_HOST}${libdir}'),d.expand('${STAGING_DIR_HOST}${base_libdir}')])}"
+ cat > ${WORKDIR}/qemuwrapper << EOF
+#!/bin/sh
+$qemu_binary "\$@"
+EOF
+ chmod +x ${WORKDIR}/qemuwrapper
+}
+
+UPSTREAM_CHECK_GITTAGREGEX = "^igc-(?P<pver>(?!19\..*)\d+(\.\d+)+)$"
+
+FILES:${PN} += " \
+ ${libdir}/igc/NOTICES.txt \
+ "
+
+# libigc.so contains buildpaths
+INSANE_SKIP:${PN} += "buildpaths"
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.6646.bb b/dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.6646.bb
deleted file mode 100644
index 582db553..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.6646.bb
+++ /dev/null
@@ -1,45 +0,0 @@
-SUMMARY = "The Intel(R) Graphics Compiler for OpenCL(TM)"
-DESCRIPTION = "The Intel(R) Graphics Compiler for OpenCL(TM) is an \
-llvm based compiler for OpenCL(TM) targeting Intel Gen graphics \
-hardware architecture."
-
-LICENSE = "MIT & BSD-3-Clause"
-LIC_FILES_CHKSUM = "file://IGC/BiFModule/Implementation/ExternalLibraries/libclc/LICENSE.TXT;md5=311cfc1a5b54bab8ed34a0b5fba4373e \
- file://IGC/Compiler/LegalizationPass.cpp;beginline=1;endline=23;md5=8b19c5999abc484f18232b0905367f9f \
- file://NOTICES.txt;md5=b12e73994de4fbe0f688cf0bc91512a0"
-
-SRC_URI = "git://github.com/intel/intel-graphics-compiler.git;protocol=https; \
- file://0001-skip-execution-of-ElfPackager.patch \
- file://link-to-LLVMGenXIntrinsics.patch \
- file://improve_src_package_reproducibility.patch \
- file://0001-Fix-build-with-LLVM-12.patch \
- file://0002-Review-fixes-for-LLVM-12-phase-1.patch \
- file://0003-Review-fixes-for-LLVM-12-phase-2.patch \
- "
-
-SRCREV = "535aaaef03ce338e05e6162118082e6e007e8c10"
-
-# Used to replace with relative path in reproducibility patch
-export B
-
-S = "${WORKDIR}/git"
-
-inherit cmake
-
-COMPATIBLE_HOST = '(x86_64).*-linux'
-COMPATIBLE_HOST_libc-musl = "null"
-
-DEPENDS += " flex-native bison-native clang opencl-clang vc-intrinsics"
-DEPENDS_append_class-target = " clang-cross-x86_64"
-
-RDEPENDS_${PN} += "opencl-clang"
-
-EXTRA_OECMAKE = "-DIGC_OPTION__LLVM_PREFERRED_VERSION=${LLVMVERSION} -DPYTHON_EXECUTABLE=${HOSTTOOLS_DIR}/python3 -DIGC_BUILD__VC_ENABLED=OFF -DIGC_BUILD__USE_KHRONOS_SPIRV_TRANSLATOR=ON"
-
-BBCLASSEXTEND = "native nativesdk"
-
-UPSTREAM_CHECK_GITTAGREGEX = "^igc-(?P<pver>(?!19\..*)\d+(\.\d+)+)$"
-
-FILES_${PN} += " \
- ${libdir}/igc/NOTICES.txt \
- "
diff --git a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0001-Building-in-tree-with-LLVM-10.0-with-the-LLVM_LINK_L.patch b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0001-Building-in-tree-with-LLVM-10.0-with-the-LLVM_LINK_L.patch
deleted file mode 100644
index 8ffa853b..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0001-Building-in-tree-with-LLVM-10.0-with-the-LLVM_LINK_L.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 7fc05c52dd91902fa324a7aac9b90715cfca4717 Mon Sep 17 00:00:00 2001
-From: Naveen Saini <naveen.kumar.saini@intel.com>
-Date: Wed, 15 Apr 2020 17:55:32 +0800
-Subject: [PATCH] Building in-tree with LLVM 10.0 with the LLVM_LINK_LLVM_DYLIB
-
-Failed to link with the LLVMSPIRVLib library.
-
-Add an explicit dependency to force the correct build order and linking.
-
-Reference:
-https://github.com/KhronosGroup/SPIRV-LLVM-Translator/commit/a6d4ccf082858e63e139ca06c02a071c343d2657
-
-Upstream-Status: Submitted [https://github.com/intel/opencl-clang/pull/118]
-
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
----
- CMakeLists.txt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 51c140d..b8b514e 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -208,7 +208,7 @@ link_directories(
-
- set(OPENCL_CLANG_LINK_LIBS ${CMAKE_DL_LIBS})
-
--if(NOT LLVMSPIRVLib IN_LIST LLVM_AVAILABLE_LIBS)
-+if(NOT LLVMSPIRVLib IN_LIST LLVM_AVAILABLE_LIBS OR (USE_PREBUILT_LLVM AND LLVM_LINK_LLVM_DYLIB))
- # SPIRV-LLVM-Translator is not included into LLVM as a component.
- # So, we need to list it here explicitly as an external library
- list(APPEND OPENCL_CLANG_LINK_LIBS LLVMSPIRVLib)
---
-2.17.1
-
diff --git a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0001-cl_headers-CMakeLists.txt-use-clang-from-native-sysr.patch b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0001-cl_headers-CMakeLists.txt-use-clang-from-native-sysr.patch
new file mode 100644
index 00000000..031a77c7
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0001-cl_headers-CMakeLists.txt-use-clang-from-native-sysr.patch
@@ -0,0 +1,49 @@
+From 5aea653e611b59c70e529a1bd71885a509831557 Mon Sep 17 00:00:00 2001
+From: Anuj Mittal <anuj.mittal@intel.com>
+Date: Tue, 1 Aug 2023 11:15:31 +0800
+Subject: [PATCH] cl_headers/CMakeLists.txt: use clang from native sysroot
+
+Allow clang to be found in target sysroot for target builds and dont try
+to compile cross binaries, we do that ourselves.
+
+Upstream-Status: Inappropriate [oe-specific]
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+---
+ CMakeLists.txt | 8 ++++----
+ cl_headers/CMakeLists.txt | 2 +-
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 5864009..60ba39e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -35,10 +35,10 @@ set(CMAKE_MODULE_PATH
+
+ include(CMakeFunctions)
+
+-if(CMAKE_CROSSCOMPILING AND OPENCL_CLANG_BUILD_EXTERNAL)
+- include(CrossCompile)
+- llvm_create_cross_target(${PROJECT_NAME} NATIVE "" Release)
+-endif()
++#if(CMAKE_CROSSCOMPILING AND OPENCL_CLANG_BUILD_EXTERNAL)
++# include(CrossCompile)
++# llvm_create_cross_target(${PROJECT_NAME} NATIVE "" Release)
++#endif()
+
+ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ set(USE_PREBUILT_LLVM ON)
+diff --git a/cl_headers/CMakeLists.txt b/cl_headers/CMakeLists.txt
+index 16cabb7..4423536 100644
+--- a/cl_headers/CMakeLists.txt
++++ b/cl_headers/CMakeLists.txt
+@@ -1,6 +1,6 @@
+ set(CL_HEADERS_LIB cl_headers)
+ if(USE_PREBUILT_LLVM)
+- find_program(CLANG_COMMAND clang PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
++ find_program(CLANG_COMMAND clang PATHS ${LLVM_TOOLS_BINARY_DIR})
+ else()
+ set(CLANG_COMMAND $<TARGET_FILE:clang>)
+ endif()
+--
+2.37.3
+
diff --git a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0001-don-t-redefine-LLVM_TABLEGEN_EXE.patch b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0001-don-t-redefine-LLVM_TABLEGEN_EXE.patch
deleted file mode 100644
index 8df7e3ab..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0001-don-t-redefine-LLVM_TABLEGEN_EXE.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From f3ef79a6301bab0b3a447f07ceb94c39a95009df Mon Sep 17 00:00:00 2001
-From: Anuj Mittal <anuj.mittal@intel.com>
-Date: Thu, 2 Apr 2020 08:59:20 +0800
-Subject: [PATCH] don't redefine LLVM_TABLEGEN_EXE
-
-Use the value that has been passed by the user.
-
-Upstream-Status: Submitted
-Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
----
- CMakeLists.txt | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 6893e97..941b0ae 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -137,7 +137,10 @@ endif(NOT USE_PREBUILT_LLVM)
- set (COMPILE_OPTIONS_TD opencl_clang_options.td)
- set (COMPILE_OPTIONS_INC opencl_clang_options.inc)
-
--set(LLVM_TABLEGEN_EXE "llvm-tblgen")
-+if(NOT DEFINED LLVM_TABLEGEN_EXE)
-+ set(LLVM_TABLEGEN_EXE "llvm-tblgen")
-+endif()
-+
- set(LLVM_TARGET_DEFINITIONS ${COMPILE_OPTIONS_TD})
- if(USE_PREBUILT_LLVM)
- set(TABLEGEN_ADDITIONAL -I ${LLVM_INCLUDE_DIRS})
---
-2.25.1
-
diff --git a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0002-Request-native-clang-only-when-cross-compiling-464.patch b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0002-Request-native-clang-only-when-cross-compiling-464.patch
new file mode 100644
index 00000000..2f1814f8
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0002-Request-native-clang-only-when-cross-compiling-464.patch
@@ -0,0 +1,60 @@
+From 43c806ef321b1f677a49d28c89fb7ffecf539c2d Mon Sep 17 00:00:00 2001
+From: Tim Creech <timothy.m.creech@intel.com>
+Date: Wed, 28 Jun 2023 03:45:51 -0400
+Subject: [PATCH 2/2] Request native clang only when cross-compiling (#464)
+
+* Request native clang only when cross-compiling
+
+LLVM_USE_HOST_TOOLS may be set if LLVM is configured with
+LLVM_OPTIMIZED_TABLEGEN, which does not necessarily indicate
+cross-compilation or that clang will only execute on the target.
+
+By checking that CMAKE_CROSSCOMPILING is set, we ensure that we only
+build/use clang again if necessary for host execution.
+
+* fixup: CMAKE_CROSSCOMPILING implies LLVM_USE_HOST_TOOLS
+
+Co-authored-by: Wenju He <wenju.he@intel.com>
+
+* fixup: also use CMAKE_CROSSCOMPILING in top-level CMakeLists.txt
+
+---------
+
+Co-authored-by: Wenju He <wenju.he@intel.com>
+
+Upstream-Status: Backport [https://github.com/intel/opencl-clang/commit/53843eee13cfb2357919ee02714a43bef1af0f86]
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+---
+ CMakeLists.txt | 2 +-
+ cl_headers/CMakeLists.txt | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e772de9..5864009 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -35,7 +35,7 @@ set(CMAKE_MODULE_PATH
+
+ include(CMakeFunctions)
+
+-if(LLVM_USE_HOST_TOOLS AND OPENCL_CLANG_BUILD_EXTERNAL)
++if(CMAKE_CROSSCOMPILING AND OPENCL_CLANG_BUILD_EXTERNAL)
+ include(CrossCompile)
+ llvm_create_cross_target(${PROJECT_NAME} NATIVE "" Release)
+ endif()
+diff --git a/cl_headers/CMakeLists.txt b/cl_headers/CMakeLists.txt
+index 18296c2..16cabb7 100644
+--- a/cl_headers/CMakeLists.txt
++++ b/cl_headers/CMakeLists.txt
+@@ -4,7 +4,7 @@ if(USE_PREBUILT_LLVM)
+ else()
+ set(CLANG_COMMAND $<TARGET_FILE:clang>)
+ endif()
+-if(LLVM_USE_HOST_TOOLS AND NOT OPENCL_CLANG_BUILD_EXTERNAL)
++if(CMAKE_CROSSCOMPILING AND NOT OPENCL_CLANG_BUILD_EXTERNAL)
+ build_native_tool(clang CLANG_COMMAND)
+ endif()
+
+--
+2.37.3
+
diff --git a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0002-make-sure-only-static-libraries-linked-for-native-bu.patch b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0002-make-sure-only-static-libraries-linked-for-native-bu.patch
deleted file mode 100644
index 473f4d24..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/0002-make-sure-only-static-libraries-linked-for-native-bu.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From b29e00e6fe428a031cf577dfb703cf13eff837f6 Mon Sep 17 00:00:00 2001
-From: Naveen Saini <naveen.kumar.saini@intel.com>
-Date: Wed, 15 Apr 2020 18:05:14 +0800
-Subject: [PATCH 2/2] make sure only static libraries linked for native build
-
-LINK_COMPONENTS=all isn't working for static libs for out of tree builds. Use
-LLVM_AVAILABLE_LIBS instead. Reported:
-
-https://github.com/intel/opencl-clang/issues/114
-
-Upstream-Status: Pending
-
-Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
----
- CMakeLists.txt | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 8707487..ad2dbda 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -218,7 +218,7 @@ add_subdirectory(cl_headers)
-
- set(LLVM_REQUIRES_EH ON)
-
--if(USE_PREBUILT_LLVM OR CLANG_LINK_CLANG_DYLIB)
-+if(false)
- list(APPEND OPENCL_CLANG_LINK_LIBS clang-cpp)
- else()
- list(APPEND OPENCL_CLANG_LINK_LIBS
-@@ -266,6 +266,7 @@ add_llvm_library(${TARGET_NAME} SHARED
- all
- LINK_LIBS
- ${OPENCL_CLANG_LINK_LIBS}
-+ ${LLVM_AVAILABLE_LIBS}
- )
-
- # Configure resource file on Windows
---
-2.17.1
-
diff --git a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_11.0.0.bb b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang.inc
index 0c5d0508..31a3fb21 100644
--- a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_11.0.0.bb
+++ b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang.inc
@@ -5,31 +5,30 @@ DESCRIPTION = "Common clang has OpenCL-oriented API and is capable \
LICENSE = "NCSA"
LIC_FILES_CHKSUM = "file://LICENSE;md5=e8a15bf1416762a09ece07e44c79118c"
-SRC_URI = "git://github.com/intel/opencl-clang.git;branch=ocl-open-110;protocol=https \
- file://0001-don-t-redefine-LLVM_TABLEGEN_EXE.patch \
+SRC_URI = "git://github.com/intel/opencl-clang.git;branch=${BRANCH};protocol=https \
+ file://0002-Request-native-clang-only-when-cross-compiling-464.patch \
+ file://0001-cl_headers-CMakeLists.txt-use-clang-from-native-sysr.patch \
"
-SRC_URI_append_class-native = " file://0002-make-sure-only-static-libraries-linked-for-native-bu.patch"
-
-SRCREV = "c67648d41df00ea8ee9d701d17299b86f86f0321"
-
S = "${WORKDIR}/git"
inherit cmake
DEPENDS += "clang"
-DEPENDS_append_class-target = " opencl-clang-native"
+DEPENDS:append:class-target = " opencl-clang-native"
COMPATIBLE_HOST = '(x86_64).*-linux'
-COMPATIBLE_HOST_libc-musl = "null"
+COMPATIBLE_HOST:libc-musl = "null"
+
+DEPENDS += " spirv-llvm-translator"
EXTRA_OECMAKE += "\
-DLLVM_TABLEGEN_EXE=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
-DCMAKE_SKIP_RPATH=TRUE \
- -DPREFERRED_LLVM_VERSION="11.1.0" \
+ -DPREFERRED_LLVM_VERSION=${LLVMVERSION} \
"
-do_install_append_class-native() {
+do_install:append:class-native() {
install -d ${D}${bindir}
- install -m 0755 ${B}/linux_linker/linux_resource_linker ${D}${bindir}/
+ install -m 0755 ${B}/bin/linux_resource_linker ${D}${bindir}/
}
BBCLASSEXTEND = "native nativesdk"
diff --git a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_10.0.0.bb b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_10.0.0.bb
deleted file mode 100644
index 4928eb22..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_10.0.0.bb
+++ /dev/null
@@ -1,35 +0,0 @@
-SUMMARY = "Common clang is a thin wrapper library around clang"
-DESCRIPTION = "Common clang has OpenCL-oriented API and is capable \
- to compile OpenCL C kernels to SPIR-V modules."
-
-LICENSE = "NCSA"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=e8a15bf1416762a09ece07e44c79118c"
-
-SRC_URI = "git://github.com/intel/opencl-clang.git;branch=ocl-open-100;protocol=https \
- file://0001-don-t-redefine-LLVM_TABLEGEN_EXE.patch \
- file://0001-Building-in-tree-with-LLVM-10.0-with-the-LLVM_LINK_L.patch \
- "
-SRC_URI_append_class-native = " file://0002-make-sure-only-static-libraries-linked-for-native-bu.patch"
-
-SRCREV = "c8cd72e32b6abc18ce6da71c357ea45ba78b52f0"
-
-S = "${WORKDIR}/git"
-
-inherit cmake
-DEPENDS += "clang"
-DEPENDS_append_class-target = " opencl-clang-native"
-
-COMPATIBLE_HOST = '(x86_64).*-linux'
-COMPATIBLE_HOST_libc-musl = "null"
-
-EXTRA_OECMAKE += "\
- -DLLVM_TABLEGEN_EXE=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
- -DCMAKE_SKIP_RPATH=TRUE \
- "
-
-do_install_append_class-native() {
- install -d ${D}${bindir}
- install -m 0755 ${B}/linux_linker/linux_resource_linker ${D}${bindir}/
-}
-
-BBCLASSEXTEND = "native nativesdk"
diff --git a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_12.0.0.bb b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_12.0.0.bb
deleted file mode 100644
index 6df10912..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_12.0.0.bb
+++ /dev/null
@@ -1,34 +0,0 @@
-SUMMARY = "Common clang is a thin wrapper library around clang"
-DESCRIPTION = "Common clang has OpenCL-oriented API and is capable \
- to compile OpenCL C kernels to SPIR-V modules."
-
-LICENSE = "NCSA"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=e8a15bf1416762a09ece07e44c79118c"
-
-SRC_URI = "git://github.com/intel/opencl-clang.git;branch=ocl-open-120;protocol=https \
- file://0001-don-t-redefine-LLVM_TABLEGEN_EXE.patch \
- "
-
-SRCREV = "cea544b04460a47848e585bfe75cd774c0324b45"
-
-S = "${WORKDIR}/git"
-
-inherit cmake
-DEPENDS += " clang spirv-llvm-translator"
-DEPENDS_append_class-target = " opencl-clang-native"
-
-COMPATIBLE_HOST = '(x86_64).*-linux'
-COMPATIBLE_HOST_libc-musl = "null"
-
-EXTRA_OECMAKE += "\
- -DLLVM_TABLEGEN_EXE=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
- -DCMAKE_SKIP_RPATH=TRUE \
- -DPREFERRED_LLVM_VERSION="12.0.0" \
- "
-
-do_install_append_class-native() {
- install -d ${D}${bindir}
- install -m 0755 ${B}/linux_linker/linux_resource_linker ${D}${bindir}/
-}
-
-BBCLASSEXTEND = "native nativesdk"
diff --git a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_14.0.0.bb b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_14.0.0.bb
new file mode 100644
index 00000000..7e56af75
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_14.0.0.bb
@@ -0,0 +1,5 @@
+require opencl-clang.inc
+
+SRCREV = "980f1691c5babcf824ee10375a04a0d0c5d7d44a"
+
+BRANCH = "ocl-open-140"
diff --git a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_15.0.0.bb b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_15.0.0.bb
new file mode 100644
index 00000000..e946c31c
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_15.0.0.bb
@@ -0,0 +1,5 @@
+require opencl-clang.inc
+
+SRCREV = "60fd799cc58755c16d951f9ebfde6d0f9b8554dd"
+
+BRANCH = "ocl-open-150"
diff --git a/dynamic-layers/clang-layer/recipes-opencl/vc-intrinsics/vc-intrinsics_1.0.bb b/dynamic-layers/clang-layer/recipes-opencl/vc-intrinsics/vc-intrinsics_1.0.bb
deleted file mode 100644
index eca1cb4d..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/vc-intrinsics/vc-intrinsics_1.0.bb
+++ /dev/null
@@ -1,24 +0,0 @@
-SUMMARY = "VC Intrinsics"
-DESCRIPTION = "VC Intrinsics project contains a set of new intrinsics on \
-top of core LLVM IR instructions that represent SIMD semantics of a program \
-targeting GPU"
-
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://License.md;md5=c18ea6bb4786a26bf4eee88a7424a408"
-
-SRC_URI = "git://github.com/intel/vc-intrinsics.git;protocol=https; \
- "
-SRCREV = "77974f5a32e19475125531483bede9ee23935257"
-
-S = "${WORKDIR}/git"
-
-inherit cmake
-
-COMPATIBLE_HOST = '(x86_64).*-linux'
-COMPATIBLE_HOST_libc-musl = "null"
-
-DEPENDS += " clang"
-
-EXTRA_OECMAKE = "-DLLVM_DIR=${STAGING_LIBDIR}"
-
-BBCLASSEXTEND = "native nativesdk"
diff --git a/dynamic-layers/meta-python/recipes-opencv/dldt/openvino-model-optimizer_2021.3.bb b/dynamic-layers/meta-python/recipes-opencv/dldt/openvino-model-optimizer_2024.1.0.bb
index 697c8579..de765d6c 100644
--- a/dynamic-layers/meta-python/recipes-opencv/dldt/openvino-model-optimizer_2021.3.bb
+++ b/dynamic-layers/meta-python/recipes-opencv/dldt/openvino-model-optimizer_2024.1.0.bb
@@ -5,29 +5,29 @@ environment, performs static model analysis, and adjusts deep \
learning models for optimal execution on end-point target devices."
HOMEPAGE = "https://01.org/openvinotoolkit"
-SRC_URI = "git://github.com/openvinotoolkit/openvino.git;protocol=https;branch=releases/2021/3;lfs=0 \
+SRC_URI = "git://github.com/openvinotoolkit/openvino.git;protocol=https;branch=releases/2024/1;lfs=0 \
"
-SRCREV = "c5f7ad383e654dfb4a5ac0805323cf8d43426b3f"
+SRCREV = "f4afc983258bcb2592d999ed6700043fdb58ad78"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327"
CVE_PRODUCT = "intel:openvino"
-
S = "${WORKDIR}/git"
-do_install() {
- mkdir -p ${D}${datadir}/openvino/model-optimizer
- cp -r model-optimizer ${D}${datadir}/openvino/
-}
+inherit setuptools3
-RDEPENDS_${PN} += " \
- python3-numpy \
- python3-protobuf \
+SETUPTOOLS_SETUP_PATH = "${WORKDIR}/git/tools/mo"
+
+RDEPENDS:${PN} += " \
python3-defusedxml \
+ python3-fastjsonschema \
python3-networkx \
- python3-test-generator \
+ python3-numpy \
+ python3-protobuf \
+ python3-requests \
+ python3-urllib3 \
bash \
"
-FILES_${PN} += "${datadir}/openvino"
+UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+\.\d+\.\d+))$"
diff --git a/dynamic-layers/openembedded-layer/recipes-bsp/amt/lms_2109.0.0.0.bb b/dynamic-layers/openembedded-layer/recipes-bsp/amt/lms_2406.0.0.0.bb
index 1272969b..bdf32576 100644
--- a/dynamic-layers/openembedded-layer/recipes-bsp/amt/lms_2109.0.0.0.bb
+++ b/dynamic-layers/openembedded-layer/recipes-bsp/amt/lms_2406.0.0.0.bb
@@ -8,13 +8,11 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=2ee41112a44fe7014dce33e26468ba93"
COMPATIBLE_HOST = '(i.86|x86_64).*-linux'
-COMPATIBLE_HOST_libc-musl = "null"
+COMPATIBLE_HOST:libc-musl = "null"
-inherit cmake systemd features_check
+inherit cmake systemd features_check python3native
-DEPENDS = "metee ace xerces-c libnl libxml2 glib-2.0 glib-2.0-native"
-
-EXTRA_OECMAKE += "-DPYTHON_EXECUTABLE=${HOSTTOOLS_DIR}/python3"
+DEPENDS = "metee ace xerces-c libnl libxml2 glib-2.0 glib-2.0-native pkgconfig-native python3-packaging-native"
# Enable either connman or networkmanager or none but not both.
PACKAGECONFIG ??= "connman"
@@ -23,22 +21,24 @@ PACKAGECONFIG[networkmanager] = "-DNETWORK_NM=ON, -DNETWORK_NM=OFF, networkmanag
REQUIRED_DISTRO_FEATURES= "systemd"
-FILES_${PN} += "${datadir}/dbus-1/system-services/*.service"
+FILES:${PN} += "${datadir}/dbus-1/system-services/*.service"
S = "${WORKDIR}/git"
-SYSTEMD_SERVICE_${PN} = "lms.service"
+SYSTEMD_SERVICE:${PN} = "lms.service"
-SRC_URI = "git://github.com/intel/lms.git \
+SRC_URI = "git://github.com/intel/lms.git;branch=master;protocol=https \
"
-SRCREV = "e0ebda9d1e7884b51293b71c1bcda511a7942e1a"
+SRCREV = "388f115b2aeb3ea11499971c65f828daefd32c47"
-do_install_append() {
+do_install:append() {
+ install -d ${D}${sysconfdir}/lms
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${B}/UNS/lms.service ${D}${systemd_system_unitdir}
+ install -d ${D}${sysconfdir}/udev/rules.d
+ install -m 0644 ${S}/UNS/linux_scripts/70-mei-wdt.rules ${D}${sysconfdir}/udev/rules.d/70-mei-wdt.rules
}
-RDEPENDS_${PN} += "ace"
+RDEPENDS:${PN} += "ace"
-# This CVE is for Lan Management System software and not this lms.
-CVE_CHECK_WHITELIST += "CVE-2018-1000535"
+CVE_STATUS[CVE-2018-1000535] = "cpe-incorrect: This CVE is for a different LMS - Lan Management System."
diff --git a/dynamic-layers/openembedded-layer/recipes-bsp/thermald/files/0001-Makefile-Fix-build-Issue.patch b/dynamic-layers/openembedded-layer/recipes-bsp/thermald/files/0001-Makefile-Fix-build-Issue.patch
new file mode 100644
index 00000000..ea86bc31
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-bsp/thermald/files/0001-Makefile-Fix-build-Issue.patch
@@ -0,0 +1,35 @@
+From 1f6f4e29769adb9d49a3c4831dd2ba61f6ccbdce Mon Sep 17 00:00:00 2001
+From: Yogesh Tyagi <yogesh.tyagi@intel.com>
+Date: Mon, 11 Mar 2024 13:13:32 +0800
+Subject: [PATCH] Makefile: Fix build Issue
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+In case build directory is different from source, make sure make is able to find the correct input files.
+
+Fixes:
+| dbus-binding-tool --prefix=thd_dbus_interface --mode=glib-server --output=thd_dbus_interface.h ../git/src/thd_dbus_interface.xml
+| glib-compile-resources --generate-source thermald-resource.gresource.xml
+| Failed to open file “thermald-resource.gresource.xml”: No such file or directory
+
+Upstream-Status: Submitted
+https://github.com/intel/thermal_daemon/pull/436
+
+Signed-off-by: Yogesh Tyagi <yogesh.tyagi@intel.com>
+---
+ Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index dd2ef10..cb19e17 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -97,6 +97,6 @@ thd_dbus_interface.h: $(top_srcdir)/src/thd_dbus_interface.xml
+ $(AM_V_GEN) dbus-binding-tool --prefix=thd_dbus_interface --mode=glib-server --output=$@ $<
+
+ thermald-resource.c: $(top_srcdir)/thermald-resource.gresource.xml
+- $(AM_V_GEN) glib-compile-resources --generate-source thermald-resource.gresource.xml
++ $(AM_V_GEN) glib-compile-resources --generate-source --sourcedir=${top_srcdir} $<
+
+ CLEANFILES = $(BUILT_SOURCES)
diff --git a/dynamic-layers/openembedded-layer/recipes-bsp/thermald/thermald_2.4.4.bb b/dynamic-layers/openembedded-layer/recipes-bsp/thermald/thermald_2.5.7.bb
index efad2fe3..66765e56 100644
--- a/dynamic-layers/openembedded-layer/recipes-bsp/thermald/thermald_2.4.4.bb
+++ b/dynamic-layers/openembedded-layer/recipes-bsp/thermald/thermald_2.5.7.bb
@@ -7,20 +7,23 @@ compensation using available cooling methods."
HOMEPAGE = "https://github.com/01org/thermal_daemon"
DEPENDS = "dbus dbus-glib dbus-glib-native libxml2 glib-2.0 glib-2.0-native upower libevdev"
-LICENSE = "GPLv2"
+DEPENDS += "autoconf-archive-native"
+
+LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=ea8831610e926e2e469075b52bf08848"
-SRC_URI = "git://github.com/intel/thermal_daemon/ \
+SRC_URI = "git://github.com/intel/thermal_daemon/;branch=master;protocol=https \
+ file://0001-Makefile-Fix-build-Issue.patch \
"
-SRCREV = "d6f89c9e8afdb449a442646da46f3140634175c1"
+SRCREV = "ea8b773f76641a7a49d6584669e17371c22ad03e"
S = "${WORKDIR}/git"
inherit pkgconfig autotools systemd gtk-doc
# gtkdocsize runs before autotools do_configure and it copies gtk-doc.m4 and fails
# to copy becuase there is no m4 dir yet.
-do_configure_prepend () {
+do_configure:prepend () {
mkdir -p ${S}/m4
}
@@ -28,13 +31,13 @@ EXTRA_OECONF = " \
--with-systemdsystemunitdir=${systemd_system_unitdir} \
"
-FILES_${PN} += "${datadir}/dbus-1/system-services/*.service"
+FILES:${PN} += "${datadir}/dbus-1"
-SYSTEMD_SERVICE_${PN} = "thermald.service"
+SYSTEMD_SERVICE:${PN} = "thermald.service"
COMPATIBLE_HOST = '(i.86|x86_64).*-linux'
-CONFFILES_${PN} = " \
+CONFFILES:${PN} = " \
${sysconfdir}/thermald/thermal-conf.xml \
${sysconfdir}/thermald/thermal-cpu-cdev-order.xml \
"
diff --git a/dynamic-layers/openembedded-layer/recipes-core/ispc/ispc/0001-Add-print-function-to-print-test-run-status-in-ptest.patch b/dynamic-layers/openembedded-layer/recipes-core/ispc/ispc/0001-Add-print-function-to-print-test-run-status-in-ptest.patch
new file mode 100644
index 00000000..4d583657
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-core/ispc/ispc/0001-Add-print-function-to-print-test-run-status-in-ptest.patch
@@ -0,0 +1,53 @@
+From deccc0c69c2c8759c52885be8bdda54d3cee481c Mon Sep 17 00:00:00 2001
+From: Yogesh Tyagi <yogesh.tyagi@intel.com>
+Date: Sun, 11 Dec 2022 22:34:15 +0800
+Subject: [PATCH] Add print function to print test run status in ptest format
+
+Upstream-Status: Inappropriate [OE ptest specific]
+
+Signed-off-by: Yogesh Tyagi <yogesh.tyagi@intel.com>
+---
+ run_tests.py | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/run_tests.py b/run_tests.py
+index 1cd796dd..e3ffd1ab 100755
+--- a/run_tests.py
++++ b/run_tests.py
+@@ -327,6 +327,9 @@ def run_test(testname, host, target):
+ else:
+ ispc_exe_rel = add_prefix(host.ispc_cmd, host, target)
+
++ # to reslove the error '.rodata' can not be used when making a PIE object
++ ispc_exe_rel = ispc_exe_rel + " --pic"
++
+ # is this a test to make sure an error is issued?
+ want_error = (filename.find("tests_errors") != -1)
+ if want_error == True:
+@@ -795,6 +798,17 @@ def check_compiler_exists(compiler_exe):
+ return
+ error("missing the required compiler: %s \n" % compiler_exe, 1)
+
++def print_test_run_status(results):
++ for fstatus in results:
++ if (fstatus[1] == Status.Success):
++ print( "%s: %s" % ("PASS", fstatus[0]))
++ elif (fstatus[1] == Status.Compfail):
++ print( "%s: %s" % ("FAIL", fstatus[0]))
++ elif (fstatus[1] == Status.Runfail):
++ print( "%s: %s" % ("FAIL", fstatus[0]))
++ elif (fstatus[1] == Status.Skip):
++ print( "%s: %s" % ("SKIP", fstatus[0]))
++
+ def print_result(status, results, s, run_tests_log, csv):
+ title = StatusStr[status]
+ file_list = [fname for fname, fstatus in results if status == fstatus]
+@@ -938,6 +952,8 @@ def run_tests(options1, args, print_version):
+ pass_rate = -1
+ print_debug("PASSRATE (%d/%d) = %d%% \n\n" % (len(run_succeed_files), total_tests_executed, pass_rate), s, run_tests_log)
+
++ print_test_run_status(results)
++
+ for status in Status:
+ print_result(status, results, s, run_tests_log, options.csv)
+ fails = [status != Status.Compfail and status != Status.Runfail for _, status in results]
diff --git a/dynamic-layers/openembedded-layer/recipes-core/ispc/ispc/0001-Fix-QA-Issues.patch b/dynamic-layers/openembedded-layer/recipes-core/ispc/ispc/0001-Fix-QA-Issues.patch
new file mode 100644
index 00000000..b0a76ff9
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-core/ispc/ispc/0001-Fix-QA-Issues.patch
@@ -0,0 +1,36 @@
+From 7beff95c11071170eb27b6fa7d0cc77588caee8e Mon Sep 17 00:00:00 2001
+From: Yogesh Tyagi <yogesh.tyagi@intel.com>
+Date: Tue, 26 Jul 2022 15:25:10 +0800
+Subject: [PATCH] Fix QA Issues
+
+Stop ispc from inserting host file path in generated headers which leads to reproducibility problems.
+
+Upstream-Status: Inappropriate [OE build specific]
+
+Signed-off-by: Yogesh Tyagi <yogesh.tyagi@intel.com>
+---
+ src/module.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/module.cpp b/src/module.cpp
+index e2084d2e..e2626865 100644
+--- a/src/module.cpp
++++ b/src/module.cpp
+@@ -2555,7 +2555,7 @@ bool Module::writeHeader(const char *fn) {
+ perror("fopen");
+ return false;
+ }
+- fprintf(f, "//\n// %s\n// (Header automatically generated by the ispc compiler.)\n", fn);
++ fprintf(f, "//\n// \n// (Header automatically generated by the ispc compiler.)\n");
+ fprintf(f, "// DO NOT EDIT THIS FILE.\n//\n\n");
+
+ // Create a nice guard string from the filename, turning any
+@@ -2677,7 +2677,7 @@ bool Module::writeDispatchHeader(DispatchHeaderInfo *DHI) {
+ FILE *f = DHI->file;
+
+ if (DHI->EmitFrontMatter) {
+- fprintf(f, "//\n// %s\n// (Header automatically generated by the ispc compiler.)\n", DHI->fn);
++ fprintf(f, "//\n// \n// (Header automatically generated by the ispc compiler.)\n");
+ fprintf(f, "// DO NOT EDIT THIS FILE.\n//\n\n");
+ }
+ // Create a nice guard string from the filename, turning any
diff --git a/dynamic-layers/openembedded-layer/recipes-core/ispc/ispc/0002-cmake-don-t-build-for-32-bit-targets.patch b/dynamic-layers/openembedded-layer/recipes-core/ispc/ispc/0002-cmake-don-t-build-for-32-bit-targets.patch
new file mode 100644
index 00000000..f452dc50
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-core/ispc/ispc/0002-cmake-don-t-build-for-32-bit-targets.patch
@@ -0,0 +1,52 @@
+From 16a2c22339287122d2c25d8bb33a5a51b4e6ee51 Mon Sep 17 00:00:00 2001
+From: Naveen Saini <naveen.kumar.saini@intel.com>
+Date: Thu, 24 Feb 2022 20:01:11 +0530
+Subject: [PATCH] cmake: don't build for 32-bit targets
+
+Error log:
+| tmp/work/corei7-64-poky-linux/ispc/1.16.0-r0/recipe-sysroot/usr/include/bits/long-double.h:23:10: fatal error: 'bits/long-double-32.h' file not found
+| #include <bits/long-double-32.h>
+| ^~~~~~~~~~~~~~~~~~~~~~~
+| 1 error generated.
+
+Remove SYSTEM include search path and set -isysroot dir path
+for root dir for cross compilation.
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
+---
+ cmake/GenerateBuiltins.cmake | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/cmake/GenerateBuiltins.cmake b/cmake/GenerateBuiltins.cmake
+index f84494ed..d90cb1ec 100644
+--- a/cmake/GenerateBuiltins.cmake
++++ b/cmake/GenerateBuiltins.cmake
+@@ -253,7 +253,7 @@ function(builtin_to_cpp bit os_name arch supported_archs supported_oses resultFi
+ # In this case headers will be installed in /usr/arm-linux-gnueabihf/include and will not be picked up
+ # by clang by default. So the following line adds such path explicitly. If this path doesn't exist and
+ # the headers can be found in other locations, this should not be a problem.
+- set(includePath -isystem/usr/${debian_triple}/include)
++ set(includePath -isysroot${SYSROOT_DIR})
+ endif()
+ endif()
+
+@@ -339,7 +339,7 @@ function (generate_target_builtins resultList)
+ set(regular_targets ${ARGN})
+ list(FILTER regular_targets EXCLUDE REGEX wasm)
+ foreach (ispc_target ${regular_targets})
+- foreach (bit 32 64)
++ foreach (bit 64)
+ foreach (os_name ${TARGET_OS_LIST_FOR_LL})
+ target_ll_to_cpp(target-${ispc_target} ${bit} ${os_name} output${os_name}${bit})
+ list(APPEND tmpList ${output${os_name}${bit}})
+@@ -405,7 +405,7 @@ function (generate_common_builtins resultList)
+ endif()
+
+ message (STATUS "ISPC will be built with support of ${supported_oses} for ${supported_archs}")
+- foreach (bit 32 64)
++ foreach (bit 64)
+ foreach (os_name "windows" "linux" "freebsd" "macos" "android" "ios" "ps4" "web")
+ foreach (arch "x86" "arm" "wasm")
+ builtin_to_cpp(${bit} ${os_name} ${arch} "${supported_archs}" "${supported_oses}" res${bit}${os_name}${arch})
diff --git a/dynamic-layers/openembedded-layer/recipes-core/ispc/ispc/run-ptest b/dynamic-layers/openembedded-layer/recipes-core/ispc/ispc/run-ptest
new file mode 100644
index 00000000..77d13bb4
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-core/ispc/ispc/run-ptest
@@ -0,0 +1,2 @@
+#!/bin/sh
+python3 run_tests.py
diff --git a/dynamic-layers/openembedded-layer/recipes-core/ispc/ispc_1.23.0.bb b/dynamic-layers/openembedded-layer/recipes-core/ispc/ispc_1.23.0.bb
new file mode 100644
index 00000000..ed8df859
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-core/ispc/ispc_1.23.0.bb
@@ -0,0 +1,64 @@
+SUMMARY = "Intel(R) Implicit SPMD Program Compiler"
+DESCRIPTION = "ispc is a compiler for a variant of the C programming language, \
+with extensions for single program, multiple data programming."
+HOMEPAGE = "https://github.com/ispc/ispc"
+
+LICENSE = "BSD-3-Clause & Apache-2.0-with-LLVM-exception"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=da5ecffdd210b3cf776b32b41c182e87 \
+ file://third-party-programs.txt;md5=2061218c7be521556719c8b504bf9ddd"
+
+inherit cmake python3native ptest
+
+S = "${WORKDIR}/git"
+
+SRC_URI = "git://github.com/ispc/ispc.git;protocol=https;branch=main \
+ file://0002-cmake-don-t-build-for-32-bit-targets.patch \
+ file://0001-Fix-QA-Issues.patch \
+ file://0001-Add-print-function-to-print-test-run-status-in-ptest.patch \
+ file://run-ptest \
+ "
+
+SRCREV = "bcb2cf896c00f9a802a11cbf291ef6e44b205416"
+
+COMPATIBLE_HOST = '(x86_64).*-linux'
+
+DEPENDS += " clang-native bison-native flex-native"
+DEPENDS:append:class-target = " clang"
+RDEPENDS:${PN}-ptest += " python3-multiprocessing"
+
+PACKAGECONFIG ??= "tbb"
+PACKAGECONFIG[tbb] = "-DISPCRT_BUILD_TASK_MODEL=TBB, -DISPCRT_BUILD_TASK_MODEL=OpenMP, tbb"
+
+YFLAGS='-d -t -v -y --file-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}'
+
+do_configure:prepend() {
+ sed -i -e 's#\${BISON_EXECUTABLE}.*#\${BISON_EXECUTABLE} ${YFLAGS} #g' ${S}/CMakeLists.txt
+ sed -i -e 's#\${FLEX_EXECUTABLE}.*#\${FLEX_EXECUTABLE} \-L #g' ${S}/CMakeLists.txt
+}
+
+do_install_ptest() {
+ cp -rf ${S}/run_tests.py ${D}${PTEST_PATH}
+ cp -rf ${S}/common.py ${D}${PTEST_PATH}
+ cp -rf ${S}/tests ${D}${PTEST_PATH}
+ cp -rf ${S}/test_static.isph ${D}${PTEST_PATH}
+ cp -rf ${S}/fail_db.txt ${D}${PTEST_PATH}
+ cp -rf ${S}/test_static.cpp ${D}${PTEST_PATH}
+}
+
+EXTRA_OECMAKE += " \
+ -DISPC_INCLUDE_TESTS=OFF \
+ -DISPC_INCLUDE_EXAMPLES=OFF \
+ -DARM_ENABLED=OFF \
+ -DISPC_CROSS=ON \
+ -DISPC_ANDROID_TARGET=OFF \
+ -DISPC_FREEBSD_TARGET=OFF \
+ -DISPC_WINDOWS_TARGET=OFF \
+ -DISPC_IOS_TARGET=OFF \
+ -DISPC_PS_TARGET=OFF \
+ -DSYSROOT_DIR=${STAGING_DIR} \
+ -DCLANG_EXECUTABLE=${STAGING_BINDIR_NATIVE}/clang \
+ -DCLANGPP_EXECUTABLE=${STAGING_BINDIR_NATIVE}/clang++ \
+ -DLLVM_AS_EXECUTABLE=${STAGING_BINDIR_NATIVE}/llvm-as \
+ "
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/dynamic-layers/openembedded-layer/recipes-core/levelzero/level-zero_1.2.3.bb b/dynamic-layers/openembedded-layer/recipes-core/levelzero/level-zero_1.15.8.bb
index 9ab0804f..8bade9f4 100644
--- a/dynamic-layers/openembedded-layer/recipes-core/levelzero/level-zero_1.2.3.bb
+++ b/dynamic-layers/openembedded-layer/recipes-core/levelzero/level-zero_1.15.8.bb
@@ -1,10 +1,10 @@
SUMMARY = "oneAPI Level Zero Specification Headers and Loader"
HOMEPAGE = "https://github.com/oneapi-src/level-zero"
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=8956dfdba7f8169c4005d1e9753ffddc"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=97957beb2f7808ffa247e5d93e6442cc"
-SRC_URI = "git://github.com/oneapi-src/level-zero.git;protocol=https"
-SRCREV = "0d30b1fa712253c68bfdfa3863d380df4301b8a4"
+SRC_URI = "git://github.com/oneapi-src/level-zero.git;protocol=https;branch=master"
+SRCREV = "1685d01497428ca4d8b99200972b64685424d5c9"
S = "${WORKDIR}/git"
inherit cmake
@@ -14,7 +14,7 @@ UPSTREAM_CHECK_GITTAGREGEX = "^v(?P<pver>(\d+(\.\d+)+))$"
PACKAGES =+ "${PN}-headers ${PN}-samples ${PN}-loader"
-do_install_append () {
+do_install:append () {
install -d ${D}${bindir} ${D}${libdir}
install -m 755 ${B}/bin/zello* ${D}${bindir}
@@ -22,10 +22,12 @@ do_install_append () {
}
-FILES_${PN}-headers = "${includedir}"
-FILES_${PN}-samples = "${bindir} ${libdir}/libze_null* ${libdir}/libze_validation*"
-FILES_${PN}-loader = "${libdir}"
+FILES:${PN}-headers = "${includedir}"
+FILES:${PN}-samples = "${bindir} ${libdir}/libze_null* ${libdir}/libze_validation*"
+FILES:${PN}-loader = "${libdir}"
# PN-loader (non -dev/-dbg/nativesdk- package) contains symlink .so
-INSANE_SKIP_${PN}-loader = "dev-so"
-INSANE_SKIP_${PN}-samples = "dev-so"
+INSANE_SKIP:${PN}-loader = "dev-so"
+INSANE_SKIP:${PN}-samples = "dev-so"
+ALLOW_EMPTY:${PN} = "1"
+BBCLASSEXTEND = "native nativesdk"
diff --git a/dynamic-layers/openembedded-layer/recipes-oneapi/dpcpp-compiler/intel-oneapi-dpcpp-cpp-runtime_2024.0.0-49819.bb b/dynamic-layers/openembedded-layer/recipes-oneapi/dpcpp-compiler/intel-oneapi-dpcpp-cpp-runtime_2024.0.0-49819.bb
new file mode 100644
index 00000000..cedbae1e
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-oneapi/dpcpp-compiler/intel-oneapi-dpcpp-cpp-runtime_2024.0.0-49819.bb
@@ -0,0 +1,54 @@
+SUMMARY = "Intel® oneAPI DPC++/C++ Compiler runtime files"
+DESCRIPTION = "The Intel® oneAPI DPC++/C++ Compiler provides optimizations \
+that help your applications run faster on Intel® 64 architectures with support \
+for the latest C, C++, and SYCL language standards. This compiler produces \
+optimized code that can run significantly faster by taking advantage of the \
+ever-increasing core count and vector register width in Intel® Xeon® processors \
+and compatible processors."
+
+HOMEPAGE = "https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compiler.html"
+
+LICENSE="EULA"
+
+COMPILERMAINVER = "2024.0"
+
+LIC_FILES_CHKSUM = " \
+ file://opt/intel/oneapi/licensing/${COMPILERMAINVER}/licensing/${COMPILERMAINVER}/license.htm;md5=5ff64c6ff3ef98089ed69360e7a84c39 \
+ "
+COMPILERDOTVER = "2024.0.0-49406"
+DEVUTILITVERSION = "2024.0-2024.0.0-49320"
+SRC_URI = " \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-compiler-dpcpp-cpp-runtime-${COMPILERMAINVER}-${PV}_amd64.deb;subdir=${BPN};name=dpcpp-runtime \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-compiler-dpcpp-cpp-common-${COMPILERMAINVER}-${PV}_all.deb;subdir=${BPN};name=dpcpp-common \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-compiler-shared-runtime-${COMPILERMAINVER}-${PV}_amd64.deb;subdir=${BPN};name=compiler-shared-runtime \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-common-vars-${COMPILERDOTVER}_all.deb;subdir=${BPN};name=common-vars \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-openmp-${COMPILERMAINVER}-${PV}_amd64.deb;subdir=${BPN};name=openmp \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-openmp-common-${COMPILERMAINVER}-${PV}_all.deb;subdir=${BPN};name=openmp-common \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-common-licensing-${COMPILERMAINVER}-${COMPILERDOTVER}_all.deb;subdir=${BPN};name=license \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-dev-utilities-${DEVUTILITVERSION}_amd64.deb;subdir=${BPN};name=dev-utils \
+ "
+
+SRC_URI[dpcpp-runtime.sha256sum] = "e24f0ba69daf3f66ceaf23d5e632f183cdb90bac69f65407fdb4407fc9034f33"
+SRC_URI[dpcpp-common.sha256sum] = "f5a3db6a725598224edf1099260955aee3e36beadcaed2af5b8b453e873a82fa"
+SRC_URI[compiler-shared-runtime.sha256sum] = "bce010cbe076259ddd3feb8e69792869e22fccd5b4e2c9af9e815826f2c1a394"
+SRC_URI[common-vars.sha256sum] = "368553c99db1b52060b8225355336778be0b00e5991d0f769c42f891c6328750"
+SRC_URI[openmp.sha256sum] = "154ff1e81adfdc872ba1d47bd860de70d62188417c7128422435dfd0ceca62fe"
+SRC_URI[openmp-common.sha256sum] = "8217001d78311cbef97dd139e684c6767932b532309c3843ba57d7894d15c07d"
+SRC_URI[license.sha256sum] = "9f9c8a12fc0bc82ab5b71e118e66745eff23f42224eba304068225b366cd74b6"
+SRC_URI[dev-utils.sha256sum] = "c675d960a5abca361cead9217d6e74adee499ee0a095c4e44092bd710b304d50"
+
+S = "${WORKDIR}/${BPN}"
+
+inherit bin_package
+
+RDEPENDS:${PN} += "virtual-opencl-icd zlib tbb level-zero-loader bash tcsh"
+SKIP_FILEDEPS:${PN} = '1'
+
+INHIBIT_PACKAGE_STRIP = "1"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+# doesn't have GNU_HASH (didn't pass LDFLAGS?)
+INSANE_SKIP:${PN} += "textrel dev-so dev-elf ldflags already-stripped staticdev rpaths arch useless-rpaths file-rdeps"
+
+FILES_SOLIBSDEV = ""
+BBCLASSEXTEND = "native nativesdk"
diff --git a/dynamic-layers/openembedded-layer/recipes-oneapi/dpcpp-compiler/intel-oneapi-dpcpp-cpp_2024.0.0-49819.bb b/dynamic-layers/openembedded-layer/recipes-oneapi/dpcpp-compiler/intel-oneapi-dpcpp-cpp_2024.0.0-49819.bb
new file mode 100644
index 00000000..90ada087
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-oneapi/dpcpp-compiler/intel-oneapi-dpcpp-cpp_2024.0.0-49819.bb
@@ -0,0 +1,45 @@
+SUMMARY = "Intel® oneAPI DPC++/C++ Compiler"
+DESCRIPTION = "The Intel® oneAPI DPC++/C++ Compiler provides optimizations \
+that help your applications run faster on Intel® 64 architectures with support \
+for the latest C, C++, and SYCL language standards. This compiler produces \
+optimized code that can run significantly faster by taking advantage of the \
+ever-increasing core count and vector register width in Intel® Xeon® processors \
+and compatible processors."
+
+HOMEPAGE = "https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compiler.html"
+
+LICENSE="EULA"
+
+COMPILERMAINVER = "2024.0"
+
+LIC_FILES_CHKSUM = " \
+ file://opt/intel/oneapi/compiler/${COMPILERMAINVER}/share/doc/compiler/credist.txt;md5=b41f55af9f479b9570fc35b955d5ba1a \
+ "
+
+SRC_URI = " \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-dpcpp-cpp-${COMPILERMAINVER}-${PV}_amd64.deb;subdir=${BPN};name=icx-compiler \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-compiler-shared-${COMPILERMAINVER}-${PV}_amd64.deb;subdir=${BPN};name=compiler-linker \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-compiler-shared-common-${COMPILERMAINVER}-${PV}_all.deb;subdir=${BPN};name=shared-common \
+ "
+
+SRC_URI[icx-compiler.sha256sum] = "0dcbac766d5a1519d4cf393f5a85e71d19024fef65f77638f3f849796b62cd82"
+SRC_URI[compiler-linker.sha256sum] = "e00faea6d797934d62143e4aa70b727ce30f80fdf30769d22122b3051140c236"
+SRC_URI[shared-common.sha256sum] = "cf490a4a790f349da79e618359598d3b32312ca3b2639e5d4c84e1cfa2745558"
+
+S = "${WORKDIR}/${BPN}"
+
+inherit bin_package
+
+RDEPENDS:${PN} += "intel-oneapi-dpcpp-cpp-runtime"
+SKIP_FILEDEPS:${PN} = '1'
+
+INHIBIT_PACKAGE_STRIP = "1"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+# doesn't have GNU_HASH (didn't pass LDFLAGS?)
+INSANE_SKIP:${PN} += "textrel dev-so dev-elf ldflags already-stripped file-rdeps staticdev rpaths arch useless-rpaths"
+
+FILES_SOLIBSDEV = ""
+
+EXCLUDE_FROM_SHLIBS = "1"
+BBCLASSEXTEND = "native nativesdk"
diff --git a/dynamic-layers/openembedded-layer/recipes-oneapi/embree/embree_4.3.1.bb b/dynamic-layers/openembedded-layer/recipes-oneapi/embree/embree_4.3.1.bb
new file mode 100644
index 00000000..fb341b01
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-oneapi/embree/embree_4.3.1.bb
@@ -0,0 +1,30 @@
+SUMMARY = "Collection of high-performance ray tracing kernels"
+DESCRIPTION = "A collection of high-performance ray tracing kernels \
+intended to graphics application engineers that want to improve the \
+performance of their application."
+HOMEPAGE = "https://github.com/embree/embree"
+
+LICENSE = "Apache-2.0 & syrah"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57 \
+ file://third-party-programs.txt;md5=f989f5b74cfff0d45d3ccf0e1366cbdc \
+ file://common/math/transcendental.h;beginline=6;endline=8;md5=73380bb2ab6613b30b8464f114bd0ca8"
+
+inherit pkgconfig cmake
+
+S = "${WORKDIR}/git"
+
+SRC_URI = "git://github.com/embree/embree.git;protocol=https;branch=master"
+SRCREV = "daa8de0e714e18ad5e5c9841b67c1950d9c91c51"
+
+COMPATIBLE_HOST = '(x86_64).*-linux'
+COMPATIBLE_HOST:libc-musl = "null"
+
+DEPENDS = "tbb jpeg libpng glfw ispc-native"
+
+EXTRA_OECMAKE += " \
+ -DEMBREE_IGNORE_CMAKE_CXX_FLAGS=OFF \
+ -DEMBREE_MAX_ISA=DEFAULT \
+ -DEMBREE_TUTORIALS=OFF \
+ -DEMBREE_ISPC_SUPPORT=ON \
+ -DEMBREE_ZIP_MODE=OFF \
+ "
diff --git a/dynamic-layers/openembedded-layer/recipes-oneapi/ipp/intel-oneapi-ipp_2021.10.0-653.bb b/dynamic-layers/openembedded-layer/recipes-oneapi/ipp/intel-oneapi-ipp_2021.10.0-653.bb
new file mode 100644
index 00000000..1841253e
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-oneapi/ipp/intel-oneapi-ipp_2021.10.0-653.bb
@@ -0,0 +1,35 @@
+DESCRIPTION = "Intel® Integrated Performance Primitives are production-ready \
+ building blocks for cross-platform performance. Develop high-performance vision, \
+ signal, security, and storage applications with this multithreaded software library."
+HOMEPAGE = "https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/ipp.html"
+
+LICENSE = "ISSL"
+
+MAXVER = "2021.10"
+
+LIC_FILES_CHKSUM = " \
+ file://opt/intel/oneapi/ipp/${MAXVER}/share/doc/ipp/licensing/license.txt;md5=d7cdc92ed6c4de1263da879599ddc3e2 \
+ file://opt/intel/oneapi/ipp/${MAXVER}/share/doc/ipp/licensing/third-party-programs.txt;md5=22bd13987911dcf790907041b43081f3 \
+ "
+SRC_URI = " \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-ipp-${MAXVER}-${PV}_amd64.deb;subdir=${BPN};name=ipp \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-ipp-common-devel-${MAXVER}-${PV}_all.deb;subdir=${BPN};name=headers \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-ipp-common-${MAXVER}-${PV}_all.deb;subdir=${BPN};name=env \
+ "
+
+SRC_URI[ipp.sha256sum] = "b51e45c6e691aa46c7136b0ab61f5abe346388433e017a30cf53fd23e92bea07"
+SRC_URI[headers.sha256sum] = "342f37ab2f82bc9f4498435f848ee660591c2488b44d988bf6ee96b2a71fd005"
+SRC_URI[env.sha256sum] = "731e8c28a3b8b757730cd874d0941de2eb744856128f24ade59d36c12b415bf6"
+
+S = "${WORKDIR}/${BPN}"
+
+COMPATIBLE_HOST:libc-musl = "null"
+
+inherit bin_package
+
+INHIBIT_PACKAGE_STRIP = "1"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+INHIBIT_DEFAULT_DEPS = ""
+
+RDEPENDS:${PN} += "tbb setup-intel-oneapi-env"
+INSANE_SKIP:${PN} += "ldflags dev-so"
diff --git a/dynamic-layers/openembedded-layer/recipes-oneapi/mkl/intel-oneapi-mkl_2024.0.0-49656.bb b/dynamic-layers/openembedded-layer/recipes-oneapi/mkl/intel-oneapi-mkl_2024.0.0-49656.bb
new file mode 100644
index 00000000..e3e93028
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-oneapi/mkl/intel-oneapi-mkl_2024.0.0-49656.bb
@@ -0,0 +1,74 @@
+SUMMARY = "Intel® oneAPI Math Kernel Library (oneMKL)"
+DESCRIPTION = "The Intel® oneAPI Math Kernel Library (oneMKL) is a computing \
+ math library of highly optimized and extensively parallelized routines \
+ for applications that require maximum performance. oneMKL contains \
+ the high-performance optimizations from the full Intel® Math Kernel Library \
+ for CPU architectures (with C/Fortran programming language interfaces)\
+ and adds to them a set of DPC++ programming language interfaces for \
+ achieving performance on various CPU architectures \
+ and Intel Graphics Technology for certain key functionalities."
+HOMEPAGE = "https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html"
+
+LICENSE = "ISSL"
+
+MKLMAINVER = "2024.0"
+
+LIC_FILES_CHKSUM = " \
+ file://opt/intel/oneapi/mkl/${MKLMAINVER}/share/doc/mkl/licensing/license.txt;md5=8510d21bf355a76e378c3216c3929ccd \
+ file://opt/intel/oneapi/mkl/${MKLMAINVER}/share/doc/mkl/licensing/third-party-programs-benchmarks.txt;md5=cb98e1a1f14c05ea85a979ea8982e7a4 \
+ file://opt/intel/oneapi/mkl/${MKLMAINVER}/share/doc/mkl/licensing/third-party-programs-ipp.txt;md5=a4b2bf15e38f5c1267cdafed18bc0b09 \
+ file://opt/intel/oneapi/mkl/${MKLMAINVER}/share/doc/mkl/licensing/third-party-programs-openmp.txt;md5=6b3c1aa2a11393060074c0346ce21e49 \
+ file://opt/intel/oneapi/mkl/${MKLMAINVER}/share/doc/mkl/licensing/third-party-programs-safestring.txt;md5=c3aeee91c6d35a0f0753aed6c2633b82 \
+ file://opt/intel/oneapi/mkl/${MKLMAINVER}/share/doc/mkl/licensing/third-party-programs.txt;md5=27de873e4084d62530fe828406b33ca9 \
+ "
+
+SRC_URI = " \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-mkl-${MKLMAINVER}-${PV}_amd64.deb;subdir=${BPN};name=runtime \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-mkl-common-devel-${MKLMAINVER}-${PV}_all.deb;subdir=${BPN};name=common-devel \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-mkl-devel-${MKLMAINVER}-${PV}_amd64.deb;subdir=${BPN};name=devel \
+ https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-mkl-common-${MKLMAINVER}-${PV}_all.deb;subdir=${BPN};name=common-vars \
+ "
+
+SRC_URI[runtime.sha256sum] = "10a86e24051d6ef4a80fd839c570e629190638a3c0ac9bcca99ab855f534b959"
+SRC_URI[common-devel.sha256sum] = "adbf0ea946f63946d29b7f9c750c38a42ea7a65d8c81655b268aa2c7bb908192"
+SRC_URI[devel.sha256sum] = "fab2a6f15e18bfd9b4d425f2703e4e98928c57f52c4feebc9ed886f097062e84"
+SRC_URI[common-vars.sha256sum] = "ec2b67813739fa4a2895f63479a41acba2174afe2d0cb8a0c1c9119d1317d8ef"
+
+S = "${WORKDIR}/${BPN}"
+
+inherit bin_package
+
+do_install:append () {
+ install -d ${D}${bindir}
+ (cd ${D}${bindir} ; ln -s ../../opt/intel/oneapi/mkl/${MKLMAINVER}/bin/* .)
+ install -d ${D}${libdir}
+ (cd ${D}${libdir} ; ln -s ../../opt/intel/oneapi/mkl/${MKLMAINVER}/lib/intel64/*.so* .)
+ (cd ${D}${libdir} ; ln -s ../../opt/intel/oneapi/mkl/${MKLMAINVER}/lib/intel64/*.a* .)
+ install -d ${D}${libdir}/pkgconfig
+ (cd ${D}${libdir}/pkgconfig ; ln -s ../../../opt/intel/oneapi/mkl/${MKLMAINVER}/lib/pkgconfig/* .)
+ install -d ${D}${libdir}/cmake
+ (cd ${D}${libdir}/cmake ; ln -s ../../../opt/intel/oneapi/mkl/${MKLMAINVER}/lib/cmake/* .)
+
+ install -d ${D}${includedir}
+ find ${D}/opt/intel/oneapi/mkl/${MKLMAINVER}/include/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read srcdir; do
+ install -d ${D}${includedir}/$srcdir
+ (cd ${D}${includedir} ; ln -s ../../opt/intel/oneapi/mkl/${MKLMAINVER}/include/$srcdir/* ./$srcdir/)
+ done
+
+ find ${D}/opt/intel/oneapi/mkl/${MKLMAINVER}/include/ -mindepth 1 -maxdepth 1 -type f -printf '%f\n' | while read srcfile; do
+ (cd ${D}${includedir} ; ln -s ../../opt/intel/oneapi/mkl/${MKLMAINVER}/include/$srcfile .)
+ done
+}
+
+AUTO_LIBNAME_PKGS = ""
+INHIBIT_PACKAGE_STRIP = "1"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+
+RDEPENDS:${PN} += "bash tbb intel-oneapi-dpcpp-cpp-runtime setup-intel-oneapi-env virtual-opencl-icd"
+INSANE_SKIP:${PN} = "ldflags textrel dev-so staticdev arch already-stripped"
+
+FILES:${PN}-staticdev += "/opt/intel/oneapi/mkl/${MKLMAINVER}/lib/*.a*"
+
+SKIP_FILEDEPS:${PN} = '1'
+
+SYSROOT_DIRS += "/opt"
diff --git a/dynamic-layers/openembedded-layer/recipes-oneapi/oidn/oidn_2.1.0.bb b/dynamic-layers/openembedded-layer/recipes-oneapi/oidn/oidn_2.1.0.bb
new file mode 100644
index 00000000..4ea6ffbe
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-oneapi/oidn/oidn_2.1.0.bb
@@ -0,0 +1,23 @@
+SUMMARY = "Intel® Open Image Denoise"
+DESCRIPTION = "Intel Open Image Denoise is an open source library of \
+high-performance, high-quality denoising filters for images \
+rendered with ray tracing. Intel Open Image Denoise is part \
+of the Intel® oneAPI Rendering Toolkit"
+HOMEPAGE = "https://www.openimagedenoise.org/"
+
+LICENSE = "Apache-2.0 & BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57 \
+ file://external/mkl-dnn/LICENSE;md5=b48e3de3bfd47c27882a0d85b20823f5 \
+ file://external/mkl-dnn/src/cpu/x64/xbyak/COPYRIGHT;md5=3b9bf048d063d54cdb28964db558bcc7 \
+ file://external/mkl-dnn/src/common/ittnotify/LICENSE.BSD;md5=e671ff178b24a95a382ba670503c66fb \
+ file://weights/LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+SRC_URI = "https://github.com/OpenImageDenoise/${BPN}/releases/download/v${PV}/${BP}.src.tar.gz\
+ "
+SRC_URI[sha256sum] = "ce144ba582ff36563d9442ee07fa2a4d249bc85aa93e5b25fc527ff4ee755ed6"
+
+inherit cmake
+
+DEPENDS += "tbb ispc-native"
+
+UPSTREAM_CHECK_URI = "https://github.com/OpenImageDenoise/oidn/releases"
diff --git a/dynamic-layers/openembedded-layer/recipes-oneapi/openvkl/openvkl_2.0.1.bb b/dynamic-layers/openembedded-layer/recipes-oneapi/openvkl/openvkl_2.0.1.bb
new file mode 100644
index 00000000..a2d709a1
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-oneapi/openvkl/openvkl_2.0.1.bb
@@ -0,0 +1,42 @@
+SUMMARY = "Intel(R) Open Volume Kernel Library"
+DESCRIPTION = "Intel(R) Open Volume Kernel Library (Intel(R) Open VKL) is a \
+collection of high-performance volume computation kernels. The target users \
+of Open VKL are graphics application engineers who want to improve the \
+performance of their volume rendering applications by leveraging Open VKL’s \
+performance-optimized kernels, which include volume traversal and sampling \
+functionality for a variety of volumetric data formats. The kernels are optimized \
+for the latest Intel(R) processors with support for SSE, AVX, AVX2, and AVX-512 \
+instructions."
+HOMEPAGE = "https://www.openvkl.org/"
+
+LICENSE = "Apache-2.0 & BSD-3-Clause & MIT & Zlib"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57 \
+ file://third-party-programs.txt;md5=69ec7caf49616c471161b921f53d5ec0 \
+ file://testing/external/half.hpp;beginline=1;endline=17;md5=4b60058493630c3bd0ef145470f04a7b"
+
+inherit pkgconfig cmake
+
+S = "${WORKDIR}/git"
+
+SRC_URI = "git://github.com/openvkl/openvkl.git;protocol=https;branch=master \
+ "
+SRCREV = "8c6ba526813b871a624cb9d73d4cbb689ac7f4ce"
+
+COMPATIBLE_HOST = '(x86_64).*-linux'
+COMPATIBLE_HOST:libc-musl = "null"
+
+DEPENDS = "ispc ispc-native rkcommon embree"
+
+EXTRA_OECMAKE += " \
+ -DISPC_EXECUTABLE=${STAGING_BINDIR_NATIVE}/ispc \
+ "
+EXTRA_OECMAKE:intel-corei7-64 += " \
+ -DOPENVKL_ISA_AVX=OFF \
+ -DOPENVKL_ISA_AVX2=OFF \
+ -DOPENVKL_ISA_AVX512SKX=OFF \
+ "
+
+PACKAGES =+ "${PN}-examples"
+FILES:${PN}-examples = "\
+ ${bindir} \
+ "
diff --git a/dynamic-layers/openembedded-layer/recipes-oneapi/ospray/ospray/0001-Fix-GCC11-Compile-Error-in-benchmark_register.h.patch b/dynamic-layers/openembedded-layer/recipes-oneapi/ospray/ospray/0001-Fix-GCC11-Compile-Error-in-benchmark_register.h.patch
new file mode 100644
index 00000000..c2136321
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-oneapi/ospray/ospray/0001-Fix-GCC11-Compile-Error-in-benchmark_register.h.patch
@@ -0,0 +1,28 @@
+From 09e6b6615d9a16e9555eff9d569356e32bd26aa4 Mon Sep 17 00:00:00 2001
+From: benradel <86351445+benradel@users.noreply.github.com>
+Date: Wed, 23 Jun 2021 11:56:03 +0200
+Subject: [PATCH] Fix GCC11 Compile Error in benchmark_register.h
+
+Fix GCC11 compilation error due to missing header "limits" in benchmark_register.h
+
+Upstream-Status: Submitted [https://github.com/ospray/ospray/pull/484/files]
+Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
+---
+ apps/common/external/benchmark/src/benchmark_register.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/apps/common/external/benchmark/src/benchmark_register.h b/apps/common/external/benchmark/src/benchmark_register.h
+index 61377d742..8f1bb7795 100644
+--- a/apps/common/external/benchmark/src/benchmark_register.h
++++ b/apps/common/external/benchmark/src/benchmark_register.h
+@@ -2,6 +2,7 @@
+ #define BENCHMARK_REGISTER_H
+
+ #include <vector>
++#include <limits>
+
+ #include "check.h"
+
+--
+2.32.0
+
diff --git a/dynamic-layers/openembedded-layer/recipes-oneapi/ospray/ospray_3.1.0.bb b/dynamic-layers/openembedded-layer/recipes-oneapi/ospray/ospray_3.1.0.bb
new file mode 100644
index 00000000..3e03dcc2
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-oneapi/ospray/ospray_3.1.0.bb
@@ -0,0 +1,37 @@
+SUMMARY = "Intel OSPray, Ray Tracing based Rendering Engine"
+DESCRIPTION = "Intel OSPRay is an open source, scalable, and portable ray \
+tracing engine for high-performance, high-fidelity visualization on \
+Intel Architecture CPUs."
+HOMEPAGE = "https://www.ospray.org/"
+
+LICENSE = "Apache-2.0 & BSD-3-Clause & MIT & Zlib"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=1dece7821bf3fd70fe1309eaa37d52a2 \
+ file://third-party-programs.txt;md5=e37b77e3bd997abccc359c710fb1f1db \
+ "
+
+inherit pkgconfig cmake
+
+S = "${WORKDIR}/git"
+
+SRC_URI = "git://github.com/ospray/ospray.git;protocol=https;branch=master \
+ "
+SRCREV = "f2a61c2eb58ccd666e34abfdb0fd7049ea073194"
+
+COMPATIBLE_HOST = '(x86_64).*-linux'
+COMPATIBLE_HOST:libc-musl = "null"
+
+DEPENDS = "rkcommon ispc ispc-native openvkl embree"
+
+EXTRA_OECMAKE += " \
+ -DISPC_EXECUTABLE=${STAGING_BINDIR_NATIVE}/ispc \
+ -DOSPRAY_ENABLE_APPS_BENCHMARK=OFF \
+ -DOSPRAY_ENABLE_APPS_TESTING=OFF \
+ -DOSPRAY_ENABLE_APPS_EXAMPLES=OFF \
+ "
+
+PACKAGES =+ "${PN}-apps"
+FILES:${PN}-apps = "\
+ ${bindir} \
+ "
+
+UPSTREAM_CHECK_GITTAGREGEX = "^v(?P<pver>(\d+(\.\d+)+))$"
diff --git a/dynamic-layers/openembedded-layer/recipes-oneapi/rkcommon/rkcommon_1.13.0.bb b/dynamic-layers/openembedded-layer/recipes-oneapi/rkcommon/rkcommon_1.13.0.bb
new file mode 100644
index 00000000..fe6b23ea
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-oneapi/rkcommon/rkcommon_1.13.0.bb
@@ -0,0 +1,19 @@
+SUMMARY = "rkcommon - C++/CMake infrastructure"
+DESCRIPTION = "A common set of C++ infrastructure and CMake utilities \
+used by various components of Intel® oneAPI Rendering Toolkit."
+HOMEPAGE = "https://github.com/ospray/rkcommon"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+inherit pkgconfig cmake
+
+S = "${WORKDIR}/git"
+
+SRC_URI = "git://github.com/ospray/rkcommon.git;protocol=https;branch=master \
+ "
+SRCREV = "7ebfa0765ea590767202b328e7da38102c2f5a15"
+
+DEPENDS = "tbb"
+
+EXTRA_OECMAKE += " -DBUILD_TESTING=OFF"
diff --git a/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl/0001-CMakeLists-disable-Werror.patch b/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl/0001-CMakeLists-disable-Werror.patch
new file mode 100644
index 00000000..4474aa3c
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl/0001-CMakeLists-disable-Werror.patch
@@ -0,0 +1,38 @@
+From ef56be8e6bf2ea273cbeb960f3131164e7b517b6 Mon Sep 17 00:00:00 2001
+From: Anuj Mittal <anuj.mittal@intel.com>
+Date: Wed, 18 May 2022 12:24:03 +0800
+Subject: [PATCH] CMakeLists: disable Werror
+
+gcc12 highlights minor warnings that cause the build to fail. Ignore
+those until they aren't fixed upstream.
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+---
+ CMakeLists.txt | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 418483f7..c019fea0 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -146,7 +146,7 @@ else()
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -fno-strict-aliasing -D_FORTIFY_SOURCE=2")
+ if(LNX_BUILD)
+ #A few warnings yet to resolve under esx
+- set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Werror")
++ #set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Werror")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Werror")
+ endif()
+ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -ggdb")
+@@ -791,4 +791,4 @@ if(ESX_BUILD)
+ include(CMake/esx.cmake)
+ endif()
+
+-add_subdirectory(src/os/nvm_api_sample)
+\ No newline at end of file
++add_subdirectory(src/os/nvm_api_sample)
+--
+2.35.3
+
diff --git a/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl/0001-Ignore-STATIC_ASSERT-and-NULL-definition-so-we-can-c.patch b/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl/0001-Ignore-STATIC_ASSERTs-and-NULL-define-for-os-and-ut-builds.patch
index 4a3b26c7..11305e83 100644
--- a/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl/0001-Ignore-STATIC_ASSERT-and-NULL-definition-so-we-can-c.patch
+++ b/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl/0001-Ignore-STATIC_ASSERTs-and-NULL-define-for-os-and-ut-builds.patch
@@ -1,56 +1,50 @@
-From cc0e412ad05574d22938586172c56863666eb2a5 Mon Sep 17 00:00:00 2001
-From: Nolan Hergert <nolan.hergert@intel.com>
-Date: Mon, 5 Apr 2021 11:15:09 +0800
-Subject: [PATCH] Ignore STATIC_ASSERT and NULL definition so we can compile in
- OS
-
-Upstream-Status: Backport [from ipmctl patches; https://github.com/intel/ipmctl/blob/development/src/os/patches/0001-Ignore-STATIC_ASSERTs-and-NULL-define-for-os-and-ut-builds.patch]
-
-Signed-off-by: Nolan Hergert <nolan.hergert@intel.com>
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
+Subject: [PATCH] [PATCH]: ignore static asserts and null define for os and ut
+ builds
+Upstream-Status: Backport
+Signed-off-by: Teoh Suh Haw <suh.haw.teoh@intel.com>
---
- MdePkg/Include/Base.h | 13 ++++++++++++-
- 1 file changed, 12 insertions(+), 1 deletion(-)
+ MdePkg/Include/Base.h | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
-index 8e4271f6ea..c39511a064 100644
+index d209e6de28..6e61b8f3d3 100644
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
-@@ -318,7 +318,11 @@ struct _LIST_ENTRY {
- ///
- /// NULL pointer (VOID *)
- ///
+@@ -316,8 +316,12 @@ struct _LIST_ENTRY {
+ #define NULL __null
+ #endif
+ #else
+#ifndef OS_BUILD
+#ifndef UNIT_TEST_UEFI_BUILD
#define NULL ((VOID *) 0)
+ #endif
+#endif
+#endif
-
+
//
// Null character
-@@ -809,7 +813,8 @@ typedef UINTN *BASE_LIST;
- // Verify that ProcessorBind.h produced UEFI Data Types that are compliant with
+@@ -779,6 +783,8 @@ typedef UINTN *BASE_LIST;
// Section 2.3.1 of the UEFI 2.3 Specification.
//
--
+
+#ifndef OS_BUILD
+#ifndef UNIT_TEST_UEFI_BUILD
STATIC_ASSERT (sizeof (BOOLEAN) == 1, "sizeof (BOOLEAN) does not meet UEFI Specification Data Type requirements");
STATIC_ASSERT (sizeof (INT8) == 1, "sizeof (INT8) does not meet UEFI Specification Data Type requirements");
STATIC_ASSERT (sizeof (UINT8) == 1, "sizeof (UINT8) does not meet UEFI Specification Data Type requirements");
-@@ -821,6 +826,8 @@ STATIC_ASSERT (sizeof (INT64) == 8, "sizeof (INT64) does not meet UEFI Specifi
- STATIC_ASSERT (sizeof (UINT64) == 8, "sizeof (UINT64) does not meet UEFI Specification Data Type requirements");
- STATIC_ASSERT (sizeof (CHAR8) == 1, "sizeof (CHAR8) does not meet UEFI Specification Data Type requirements");
+@@ -792,6 +798,8 @@ STATIC_ASSERT (sizeof (CHAR8) == 1, "sizeof (CHAR8) does not meet UEFI Specifi
STATIC_ASSERT (sizeof (CHAR16) == 2, "sizeof (CHAR16) does not meet UEFI Specification Data Type requirements");
+ STATIC_ASSERT (sizeof (L'A') == 2, "sizeof (L'A') does not meet UEFI Specification Data Type requirements");
+ STATIC_ASSERT (sizeof (L"A") == 4, "sizeof (L\"A\") does not meet UEFI Specification Data Type requirements");
+#endif
+#endif
-
+
//
// The following three enum types are used to verify that the compiler
-@@ -841,9 +848,13 @@ typedef enum {
+@@ -812,9 +820,13 @@ typedef enum {
__VerifyUint32EnumValue = 0xffffffff
} __VERIFY_UINT32_ENUM_SIZE;
-
+
+#ifndef OS_BUILD
+#ifndef UNIT_TEST_UEFI_BUILD
STATIC_ASSERT (sizeof (__VERIFY_UINT8_ENUM_SIZE) == 4, "Size of enum does not meet UEFI Specification Data Type requirements");
@@ -58,9 +52,8 @@ index 8e4271f6ea..c39511a064 100644
STATIC_ASSERT (sizeof (__VERIFY_UINT32_ENUM_SIZE) == 4, "Size of enum does not meet UEFI Specification Data Type requirements");
+#endif
+#endif
-
+
/**
Macro that returns a pointer to the data structure that contains a specified field of
---
-2.17.1
-
+--
+2.37.3
diff --git a/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl_03.00.00.0341.bb b/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl_03.00.00.0485.bb
index e84d1058..c4743d1c 100644
--- a/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl_03.00.00.0341.bb
+++ b/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl_03.00.00.0485.bb
@@ -15,25 +15,33 @@ LICENSE = "BSD-3-Clause | BSD-2-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=72b9da60da6219d612ce30b746a0fe71 \
file://edk2/License.txt;md5=6123e5bf044a66db96c4ce88a36b2d08"
-SRC_URI = "git://github.com/intel/ipmctl.git;protocol=https;branch=development;name=ipmctl; \
- git://github.com/tianocore/edk2.git;protocol=https;name=edk2;destsuffix=git/edk2; \
- file://0001-Ignore-STATIC_ASSERT-and-NULL-definition-so-we-can-c.patch;patchdir=edk2 \
+SRC_URI = "git://github.com/intel/ipmctl.git;protocol=https;branch=master;name=ipmctl; \
+ git://github.com/tianocore/edk2.git;protocol=https;name=edk2;destsuffix=git/edk2;branch=master \
+ file://0001-Ignore-STATIC_ASSERTs-and-NULL-define-for-os-and-ut-builds.patch;patchdir=edk2 \
+ file://0001-CMakeLists-disable-Werror.patch \
"
-SRCREV_ipmctl = "c8134c253a577a89f651d82c3f3ecd19a015c057"
-#tag: edk2-stable202102
-SRCREV_edk2 = "ef91b07388e1c0a50c604e5350eeda98428ccea6"
+SRCREV_ipmctl = "c75bd840ea7820c8f93a5488fcff75d08beedd51"
+#tag edk2-stable202302
+SRCREV_edk2 = "f80f052277c88a67c55e107b550f504eeea947d3"
+SRCREV_FORMAT = "ipmctl_edk2"
S = "${WORKDIR}/git"
inherit cmake dos2unix
-DEPENDS = "ndctl"
+DEPENDS = "ndctl pkgconfig-native"
EXTRA_OECMAKE = "-DRELEASE=ON"
-do_configure_prepend() {
+do_configure:prepend() {
for dir in BaseTools MdeModulePkg MdePkg ShellPkg ; do
ln -sf edk2/${dir} ${S}
done
}
+
+do_install:append() {
+ # Remove /var/log/ipmctl as anything created in /var/log will not be
+ # available when tmpfs is mounted at /var/volatile/log.
+ rm -rf ${D}${localstatedir}/log
+}
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-cmake-yocto-specific-tweaks-to-the-build-process.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-cmake-yocto-specific-tweaks-to-the-build-process.patch
new file mode 100644
index 00000000..7f5b46c6
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-cmake-yocto-specific-tweaks-to-the-build-process.patch
@@ -0,0 +1,86 @@
+From e4edbdae9a2dbfec6fd0706bdfff8abdfe3363fc Mon Sep 17 00:00:00 2001
+From: Anuj Mittal <anuj.mittal@intel.com>
+Date: Wed, 29 Nov 2023 12:42:57 +0530
+Subject: [PATCH] cmake: yocto specific tweaks to the build process
+
+* Dont try to detect glibc version as that doesn't work when cross compiling.
+* Dont try to detect CXX11_ABI
+* Install sample binaries as well.
+* Dont try to write triggers for CPack. We package ourselves.
+* Fix the installation path for Python modules when baselib = lib64.
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+---
+ cmake/developer_package/packaging/rpm/rpm.cmake | 2 +-
+ cmake/developer_package/target_flags.cmake | 4 ++--
+ samples/cpp/CMakeLists.txt | 6 +++---
+ src/bindings/python/CMakeLists.txt | 2 +-
+ 4 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/cmake/developer_package/packaging/rpm/rpm.cmake b/cmake/developer_package/packaging/rpm/rpm.cmake
+index 99f11730983..1a1f61fcd3d 100644
+--- a/cmake/developer_package/packaging/rpm/rpm.cmake
++++ b/cmake/developer_package/packaging/rpm/rpm.cmake
+@@ -156,7 +156,7 @@ ov_rpm_specific_settings()
+ # needed to add triggers for packages with libraries
+ set(def_triggers "${OpenVINO_BINARY_DIR}/_CPack_Packages/triggers")
+ set(triggers_content "# /bin/sh -p\n/sbin/ldconfig\n")
+-file(WRITE "${def_triggers}" "${triggers_content}")
++#file(WRITE "${def_triggers}" "${triggers_content}")
+
+ #
+ # Functions helpful for packaging your modules with RPM cpack
+diff --git a/cmake/developer_package/target_flags.cmake b/cmake/developer_package/target_flags.cmake
+index d047a1aebd9..4e8ca68c60f 100644
+--- a/cmake/developer_package/target_flags.cmake
++++ b/cmake/developer_package/target_flags.cmake
+@@ -149,7 +149,7 @@ function(ov_glibc_version)
+ endif()
+ endfunction()
+
+-ov_glibc_version()
++#ov_glibc_version()
+
+ #
+ # Detects default value for _GLIBCXX_USE_CXX11_ABI for current compiler
+@@ -160,4 +160,4 @@ macro(ov_get_glibcxx_use_cxx11_abi)
+ endif()
+ endmacro()
+
+-ov_get_glibcxx_use_cxx11_abi()
++#ov_get_glibcxx_use_cxx11_abi()
+diff --git a/samples/cpp/CMakeLists.txt b/samples/cpp/CMakeLists.txt
+index 4d33bff944e..3e7f1458578 100644
+--- a/samples/cpp/CMakeLists.txt
++++ b/samples/cpp/CMakeLists.txt
+@@ -206,9 +206,9 @@ macro(ov_add_sample)
+ target_link_libraries(${SAMPLE_NAME} PRIVATE ${ov_link_libraries} Threads::Threads ${SAMPLE_DEPENDENCIES})
+
+ install(TARGETS ${SAMPLE_NAME}
+- RUNTIME DESTINATION samples_bin/
+- COMPONENT samples_bin
+- EXCLUDE_FROM_ALL)
++ DESTINATION ${CMAKE_INSTALL_BINDIR}
++ COMPONENT samples_bin)
++
+
+ # create global target with all samples / demo apps
+ if(NOT TARGET ov_samples)
+diff --git a/src/bindings/python/CMakeLists.txt b/src/bindings/python/CMakeLists.txt
+index 6cf43ec3fed..d539b9d003f 100644
+--- a/src/bindings/python/CMakeLists.txt
++++ b/src/bindings/python/CMakeLists.txt
+@@ -320,7 +320,7 @@ if(ENABLE_PYTHON_PACKAGING)
+ # install OpenVINO Python API
+
+ set(python_package_prefix "${CMAKE_CURRENT_BINARY_DIR}/install_${pyversion}")
+- set(install_lib "${python_package_prefix}/lib/${python_versioned_folder}/${ov_site_packages}")
++ set(install_lib "${python_package_prefix}/${CMAKE_INSTALL_LIBDIR}/${python_versioned_folder}/${ov_site_packages}")
+ set(openvino_meta_info_subdir "openvino-${OpenVINO_VERSION}-py${python_xy}.egg-info")
+ set(openvino_meta_info_file "${install_lib}/${openvino_meta_info_subdir}/PKG-INFO")
+
+--
+2.34.1
+
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-dont-install-licenses-and-version-file.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-dont-install-licenses-and-version-file.patch
deleted file mode 100644
index 3130fb88..00000000
--- a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-dont-install-licenses-and-version-file.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From c6fa6f32077ab554839d6e1e5b46d0778c17b8b1 Mon Sep 17 00:00:00 2001
-From: Anuj Mittal <anuj.mittal@intel.com>
-Date: Tue, 9 Jun 2020 11:35:59 +0800
-Subject: [PATCH] don't install licenses and version
-
-Upstream-Status: Inappropriate
-
-Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
----
- ngraph/CMakeLists.txt | 6 ++----
- ngraph/test/runtime/CMakeLists.txt | 2 ++
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/ngraph/CMakeLists.txt b/ngraph/CMakeLists.txt
-index 6163c01e4a..74c479c071 100644
---- a/ngraph/CMakeLists.txt
-+++ b/ngraph/CMakeLists.txt
-@@ -353,7 +353,7 @@ if (NGRAPH_EXPORT_TARGETS_ENABLE)
- install(EXPORT ngraphTargets
- FILE ngraphTargets.cmake
- NAMESPACE ngraph::
-- DESTINATION ${NGRAPH_COMPONENT_PREFIX}cmake
-+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ngraph
- COMPONENT ngraph)
- endif()
-
-@@ -367,7 +367,7 @@ if (NGRAPH_EXPORT_TARGETS_ENABLE)
-
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ngraphConfig.cmake
- ${CMAKE_CURRENT_BINARY_DIR}/ngraphConfigVersion.cmake
-- DESTINATION ${NGRAPH_COMPONENT_PREFIX}cmake
-+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ngraph
- COMPONENT ngraph)
- endif()
-
-@@ -386,5 +386,3 @@ add_subdirectory(test)
- if (NGRAPH_PYTHON_BUILD_ENABLE)
- add_subdirectory(python)
- endif()
--
--install(FILES ${CMAKE_CURRENT_BINARY_DIR}/VERSION DESTINATION "${NGRAPH_COMPONENT_PREFIX}." COMPONENT ngraph)
-diff --git a/ngraph/test/runtime/CMakeLists.txt b/ngraph/test/runtime/CMakeLists.txt
-index 2943722acc..a2ccdd11de 100644
---- a/ngraph/test/runtime/CMakeLists.txt
-+++ b/ngraph/test/runtime/CMakeLists.txt
-@@ -79,3 +79,5 @@ target_include_directories(ngraph_backend PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
-
- add_subdirectory(interpreter)
- add_subdirectory(ie)
-+
-+install(TARGETS ngraph_backend DESTINATION ${NGRAPH_INSTALL_LIB})
---
-2.30.2
-
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-inference-engine-use-system-installed-packages.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-inference-engine-use-system-installed-packages.patch
deleted file mode 100644
index 822ab1cc..00000000
--- a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-inference-engine-use-system-installed-packages.patch
+++ /dev/null
@@ -1,193 +0,0 @@
-From ca4a2b824de61c182b46e28fce875370ce46d4e1 Mon Sep 17 00:00:00 2001
-From: Anuj Mittal <anuj.mittal@intel.com>
-Date: Thu, 8 Apr 2021 14:19:51 +0800
-Subject: [PATCH] inference-engine: use system installed packages
-
-Use installed versions of ade, protobuf and tbb.
-
-Upstream-Status: Pending
-
-Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
----
- cmake/dependencies.cmake | 19 -----------
- inference-engine/CMakeLists.txt | 2 +-
- inference-engine/cmake/dependencies.cmake | 34 -------------------
- inference-engine/cmake/ie_parallel.cmake | 2 +-
- inference-engine/samples/CMakeLists.txt | 2 +-
- .../common_test_utils/CMakeLists.txt | 4 +--
- .../unit_test_utils/CMakeLists.txt | 3 +-
- inference-engine/thirdparty/CMakeLists.txt | 5 ++-
- 8 files changed, 7 insertions(+), 64 deletions(-)
-
-diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake
-index aed7614734..f5baa6f86b 100644
---- a/cmake/dependencies.cmake
-+++ b/cmake/dependencies.cmake
-@@ -7,23 +7,4 @@ set_temp_directory(TEMP "${IE_MAIN_SOURCE_DIR}")
- if(CMAKE_CROSSCOMPILING AND CMAKE_HOST_SYSTEM_NAME MATCHES Linux AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
- set(protoc_version "3.7.1")
-
-- RESOLVE_DEPENDENCY(SYSTEM_PROTOC_ROOT
-- ARCHIVE_LIN "protoc-${protoc_version}-linux-x86_64.tar.gz"
-- TARGET_PATH "${TEMP}/protoc-${protoc_version}-linux-x86_64"
-- SHA256 "a1bedd5c05ca51e49f8f254faa3d7331e05b3a806c151fb111d582f154d0fee8"
-- )
-- debug_message(STATUS "host protoc-${protoc_version} root path = " ${SYSTEM_PROTOC_ROOT})
--
-- reset_deps_cache(SYSTEM_PROTOC)
--
-- find_program(
-- SYSTEM_PROTOC
-- NAMES protoc
-- PATHS "${SYSTEM_PROTOC_ROOT}/bin"
-- NO_DEFAULT_PATH)
-- if(NOT SYSTEM_PROTOC)
-- message(FATAL_ERROR "[ONNX IMPORTER] Missing host protoc binary")
-- endif()
--
-- update_deps_cache(SYSTEM_PROTOC "${SYSTEM_PROTOC}" "Path to host protoc for ONNX Importer")
- endif()
-diff --git a/inference-engine/CMakeLists.txt b/inference-engine/CMakeLists.txt
-index 95c657222e..20cbd5000b 100644
---- a/inference-engine/CMakeLists.txt
-+++ b/inference-engine/CMakeLists.txt
-@@ -20,7 +20,7 @@ function(ie_developer_export_targets)
- endfunction()
-
- function(ie_developer_export)
-- set(all_dev_targets gflags ie_libraries)
-+ set(all_dev_targets ie_libraries)
- foreach(component IN LISTS openvino_export_components)
- export(TARGETS ${${component}} NAMESPACE IE::
- APPEND FILE "${CMAKE_BINARY_DIR}/${component}_dev_targets.cmake")
-diff --git a/inference-engine/cmake/dependencies.cmake b/inference-engine/cmake/dependencies.cmake
-index 6fdfc6f3cd..c07bf0f3c8 100644
---- a/inference-engine/cmake/dependencies.cmake
-+++ b/inference-engine/cmake/dependencies.cmake
-@@ -138,40 +138,6 @@ endif ()
- if (THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
- reset_deps_cache(TBBROOT TBB_DIR)
-
-- if (WIN32 AND X86_64)
-- #TODO: add target_path to be platform specific as well, to avoid following if
-- RESOLVE_DEPENDENCY(TBB
-- ARCHIVE_WIN "tbb2020_20200415_win.zip"
-- TARGET_PATH "${TEMP}/tbb"
-- ENVIRONMENT "TBBROOT"
-- SHA256 "f1c9b9e2861efdaa01552bd25312ccbc5feeb45551e5f91ae61e29221c5c1479")
-- elseif(ANDROID) # Should be before LINUX due LINUX is detected as well
-- RESOLVE_DEPENDENCY(TBB
-- ARCHIVE_ANDROID "tbb2020_20200404_android.tgz"
-- TARGET_PATH "${TEMP}/tbb"
-- ENVIRONMENT "TBBROOT"
-- SHA256 "f42d084224cc2d643314bd483ad180b081774608844000f132859fca3e9bf0ce")
-- elseif(LINUX AND X86_64)
-- RESOLVE_DEPENDENCY(TBB
-- ARCHIVE_LIN "tbb2020_20200415_lin_strip.tgz"
-- TARGET_PATH "${TEMP}/tbb"
-- SHA256 "95b2f3b0b70c7376a0c7de351a355c2c514b42c4966e77e3e34271a599501008")
-- elseif(LINUX AND AARCH64)
-- RESOLVE_DEPENDENCY(TBB
-- ARCHIVE_LIN "keembay/tbb2020_38404_kmb_lic.tgz"
-- TARGET_PATH "${TEMP}/tbb_yocto"
-- ENVIRONMENT "TBBROOT"
-- SHA256 "321261ff2eda6d4568a473cb883262bce77a93dac599f7bd65d2918bdee4d75b")
-- elseif(APPLE AND X86_64)
-- RESOLVE_DEPENDENCY(TBB
-- ARCHIVE_MAC "tbb2020_20200404_mac.tgz"
-- TARGET_PATH "${TEMP}/tbb"
-- ENVIRONMENT "TBBROOT"
-- SHA256 "ad9cf52e657660058aa6c6844914bc0fc66241fec89a392d8b79a7ff69c3c7f6")
-- else()
-- message(FATAL_ERROR "TBB is not available on current platform")
-- endif()
--
- update_deps_cache(TBBROOT "${TBB}" "Path to TBB root folder")
- update_deps_cache(TBB_DIR "${TBB}/cmake" "Path to TBB cmake folder")
-
-diff --git a/inference-engine/cmake/ie_parallel.cmake b/inference-engine/cmake/ie_parallel.cmake
-index f8988aa105..42fedd10c5 100644
---- a/inference-engine/cmake/ie_parallel.cmake
-+++ b/inference-engine/cmake/ie_parallel.cmake
-@@ -6,7 +6,7 @@ function(set_ie_threading_interface_for TARGET_NAME)
- if (THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO" AND NOT TBB_FOUND)
- find_package(TBB COMPONENTS tbb tbbmalloc)
- set("TBB_FOUND" ${TBB_FOUND} PARENT_SCOPE)
-- set("TBB_IMPORTED_TARGETS" ${TBB_IMPORTED_TARGETS} PARENT_SCOPE)
-+ set("TBB_IMPORTED_TARGETS" "tbb;tbbmalloc" PARENT_SCOPE)
- set("TBB_VERSION" ${TBB_VERSION} PARENT_SCOPE)
- if (TBB_FOUND)
- if (TBB_VERSION VERSION_LESS 2020)
-diff --git a/inference-engine/samples/CMakeLists.txt b/inference-engine/samples/CMakeLists.txt
-index dfe9f2303d..6bc44019fe 100644
---- a/inference-engine/samples/CMakeLists.txt
-+++ b/inference-engine/samples/CMakeLists.txt
-@@ -126,7 +126,7 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gflags")
- add_subdirectory(thirdparty/gflags EXCLUDE_FROM_ALL)
- set_target_properties(gflags_nothreads_static PROPERTIES FOLDER thirdparty)
- endfunction()
-- add_gflags()
-+ #add_gflags()
- endif()
-
- if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
-diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/CMakeLists.txt b/inference-engine/tests/ie_test_utils/common_test_utils/CMakeLists.txt
-index 6e09201f1e..2d2e3524a5 100644
---- a/inference-engine/tests/ie_test_utils/common_test_utils/CMakeLists.txt
-+++ b/inference-engine/tests/ie_test_utils/common_test_utils/CMakeLists.txt
-@@ -43,7 +43,7 @@ function(add_gtest_libraries)
- PROPERTIES FOLDER thirdparty)
- endfunction()
-
--add_gtest_libraries()
-+#add_gtest_libraries()
-
- if (MSVC)
- set(PUGI pugixml_mt)
-@@ -52,8 +52,6 @@ else ()
- endif ()
-
- list(APPEND EXPORT_DEPENDENCIES
-- gtest
-- gtest_main
- )
-
- set(TARGET_NAME commonTestUtils)
-diff --git a/inference-engine/tests/ie_test_utils/unit_test_utils/CMakeLists.txt b/inference-engine/tests/ie_test_utils/unit_test_utils/CMakeLists.txt
-index ab956218aa..233eb5ea46 100644
---- a/inference-engine/tests/ie_test_utils/unit_test_utils/CMakeLists.txt
-+++ b/inference-engine/tests/ie_test_utils/unit_test_utils/CMakeLists.txt
-@@ -8,8 +8,7 @@ add_subdirectory(mocks/mock_engine)
-
- list(APPEND EXPORT_DEPENDENCIES
- commonTestUtils_s
-- inference_engine_s
-- gmock)
-+ inference_engine_s)
-
- addIeTarget(
- NAME ${TARGET_NAME}
-diff --git a/inference-engine/thirdparty/CMakeLists.txt b/inference-engine/thirdparty/CMakeLists.txt
-index 9a6a9209f1..eda6a64161 100644
---- a/inference-engine/thirdparty/CMakeLists.txt
-+++ b/inference-engine/thirdparty/CMakeLists.txt
-@@ -62,14 +62,13 @@ else()
- target_include_directories(pugixml INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/pugixml/src>")
- endif()
-
--add_subdirectory(ade EXCLUDE_FROM_ALL)
- add_subdirectory(fluid/modules/gapi)
-
--set_target_properties(ade fluid PROPERTIES FOLDER thirdparty)
-+set_target_properties(fluid PROPERTIES FOLDER thirdparty)
-
- # developer package
-
--openvino_developer_export_targets(COMPONENT openvino_common TARGETS ade fluid)
-+openvino_developer_export_targets(COMPONENT openvino_common TARGETS fluid)
-
- if (NOT USE_SYSTEM_PUGIXML)
- set_target_properties(pugixml PROPERTIES FOLDER thirdparty)
---
-2.29.0
-
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-plugin_api-fix-build-with-gcc-11.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-plugin_api-fix-build-with-gcc-11.patch
deleted file mode 100644
index 4b83a948..00000000
--- a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-plugin_api-fix-build-with-gcc-11.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 0ecaaf9098dc22b5503dfbce5cf629525e1dd237 Mon Sep 17 00:00:00 2001
-From: Anuj Mittal <anuj.mittal@intel.com>
-Date: Fri, 7 May 2021 14:30:03 +0800
-Subject: [PATCH] plugin_api: fix build with gcc 11
-
-Some C++ Standard Library headers have been changed in gcc 11 to no
-longer include other headers that they do need to depend on.
-
-Include exception explicitly to avoid:
-
-| inference-engine/src/plugin_api/ie_system_conf.h:21:31: error: 'exception_ptr' in namespace 'std' does not name a type; did you mean 'exception'?
-| 21 | INFERENCE_ENGINE_API_CPP(std::exception_ptr&) CurrentException();
-| | ^~~~~~~~~~~~~
-
-Upstream-Status: Submitted [https://github.com/openvinotoolkit/openvino/pull/5546]
-
-Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
----
- inference-engine/src/plugin_api/ie_system_conf.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/inference-engine/src/plugin_api/ie_system_conf.h b/inference-engine/src/plugin_api/ie_system_conf.h
-index c0e4cbb8b..56d5fb488 100644
---- a/inference-engine/src/plugin_api/ie_system_conf.h
-+++ b/inference-engine/src/plugin_api/ie_system_conf.h
-@@ -11,6 +11,7 @@
-
- #include "ie_api.h"
- #include <vector>
-+#include <exception>
-
- namespace InferenceEngine {
-
---
-2.30.2
-
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0002-cldNN-disable-Werror.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0002-cldNN-disable-Werror.patch
deleted file mode 100644
index a4e58b8e..00000000
--- a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0002-cldNN-disable-Werror.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 65014a2703a6a3892fdebc86fe1c5a3a589dbf56 Mon Sep 17 00:00:00 2001
-From: Anuj Mittal <anuj.mittal@intel.com>
-Date: Wed, 10 Jun 2020 09:45:48 +0800
-Subject: [PATCH 2/5] cldNN: disable Werror
-
-Don't treat warnings as errors. This just leads to failures every time
-we upgrade the compiler.
-
-Upstream-Status: Inappropriate
-
-Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
----
- inference-engine/thirdparty/clDNN/CMakeLists.txt | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/inference-engine/thirdparty/clDNN/CMakeLists.txt b/inference-engine/thirdparty/clDNN/CMakeLists.txt
-index 4b444eca..8610b9b8 100644
---- a/inference-engine/thirdparty/clDNN/CMakeLists.txt
-+++ b/inference-engine/thirdparty/clDNN/CMakeLists.txt
-@@ -770,7 +770,6 @@ foreach(__CLDNN_CompilerFlagName IN ITEMS "CMAKE_CXX_FLAGS" "CMAKE_C_FLAGS")
- MultiProcessorCompilation
- DeadCodeEliminate
- ExtensionsEnabled
-- TreatWarnAsErrorEnabled
- WarnLevel4
- NoFastMath
- StackProtector
---
-2.25.4
-
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0002-cmake-Fix-overloaded-virtual-error.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0002-cmake-Fix-overloaded-virtual-error.patch
new file mode 100644
index 00000000..8a1464d5
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0002-cmake-Fix-overloaded-virtual-error.patch
@@ -0,0 +1,33 @@
+From 4a909a03b6dd336e7ea76e3f44d7cfb5d7e44798 Mon Sep 17 00:00:00 2001
+From: Anuj Mittal <anuj.mittal@intel.com>
+Date: Wed, 29 Nov 2023 12:49:35 +0530
+Subject: [PATCH 2/3] cmake: Fix overloaded-virtual error
+
+* Remove -Werror for:
+|git/src/plugins/intel_gpu/src/kernel_selector/jitter.h:129:28: error: 'virtual kernel_selector::JitDefinitions kernel_selector::JitConstant::GetDefinitions() const' was hidden [-Werror=overloaded-virtual=]
+| 129 | virtual JitDefinitions GetDefinitions() const = 0;
+| |
+
+Upstream-Status: Pending
+
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+---
+ src/plugins/intel_gpu/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/plugins/intel_gpu/CMakeLists.txt b/src/plugins/intel_gpu/CMakeLists.txt
+index 2f3d9127dde..2fd4f5c1b3c 100644
+--- a/src/plugins/intel_gpu/CMakeLists.txt
++++ b/src/plugins/intel_gpu/CMakeLists.txt
+@@ -47,7 +47,7 @@ add_subdirectory(thirdparty)
+ include(thirdparty/cmake/rapidjson.cmake)
+
+ if(CMAKE_COMPILER_IS_GNUCXX)
+- ov_add_compiler_flags(-Werror)
++ #ov_add_compiler_flags(-Werror)
+ endif()
+
+ add_subdirectory(src/runtime)
+--
+2.34.1
+
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0003-inference-engine-installation-fixes.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0003-inference-engine-installation-fixes.patch
deleted file mode 100644
index 631b1839..00000000
--- a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0003-inference-engine-installation-fixes.patch
+++ /dev/null
@@ -1,261 +0,0 @@
-From 21453439cd6d89058710e868f05727502e556f99 Mon Sep 17 00:00:00 2001
-From: Anuj Mittal <anuj.mittal@intel.com>
-Date: Thu, 11 Jun 2020 14:24:04 +0800
-Subject: [PATCH] cmake installation fixes
-
-Make sure that libraries/samples/binaries are installed correctly.
-
-Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
----
- CMakeLists.txt | 15 ---------------
- cmake/developer_package/IEDevScriptsConfig.cmake | 2 +-
- cmake/developer_package/packaging.cmake | 8 +++++---
- cmake/developer_package/plugins/plugins.cmake | 2 +-
- .../samples/common/opencv_c_wraper/CMakeLists.txt | 2 ++
- inference-engine/samples/CMakeLists.txt | 4 +++-
- .../samples/common/format_reader/CMakeLists.txt | 2 ++
- .../src/inference_engine/CMakeLists.txt | 4 ++--
- inference-engine/src/preprocessing/CMakeLists.txt | 2 +-
- .../src/readers/ir_reader/CMakeLists.txt | 2 +-
- .../src/vpu/myriad_plugin/CMakeLists.txt | 2 +-
- inference-engine/tests/unit/cpu/CMakeLists.txt | 2 ++
- .../tests/unit/inference_engine/CMakeLists.txt | 2 ++
- inference-engine/tests/unit/vpu/CMakeLists.txt | 2 ++
- .../tools/compile_tool/CMakeLists.txt | 2 +-
- 15 files changed, 26 insertions(+), 27 deletions(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index e72f2b61f1..2c22827e2d 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -105,7 +105,6 @@ function(build_ngraph)
- ie_cpack_add_component(ngraph)
-
- set(SDL_cmake_included ON)
-- set(NGRAPH_COMPONENT_PREFIX "deployment_tools/ngraph/")
- add_subdirectory(ngraph)
- set(NGRAPH_LIBRARIES ngraph PARENT_SCOPE)
- set(NGRAPH_REF_LIBRARIES ngraph_reference PARENT_SCOPE)
-@@ -174,12 +173,8 @@ ie_shellcheck_process(DIRECTORY "${OpenVINO_MAIN_SOURCE_DIR}"
-
- # install setupvars
-
--ie_cpack_add_component(setupvars REQUIRED)
-
- if(UNIX)
-- install(PROGRAMS scripts/setupvars/setupvars.sh
-- DESTINATION bin
-- COMPONENT setupvars)
- elseif(WIN32)
- install(PROGRAMS scripts/setupvars/setupvars.bat
- DESTINATION bin
-@@ -189,22 +184,12 @@ endif()
- # install install_dependencies
-
- if(UNIX)
-- ie_cpack_add_component(install_dependencies REQUIRED)
-- install(DIRECTORY scripts/install_dependencies/
-- DESTINATION install_dependencies
-- COMPONENT install_dependencies)
- endif()
-
- # install files for demo
-
--ie_cpack_add_component(demo_scripts REQUIRED DEPENDS core)
-
- if(UNIX)
-- install(DIRECTORY scripts/demo/
-- DESTINATION deployment_tools/demo
-- COMPONENT demo_scripts
-- USE_SOURCE_PERMISSIONS
-- PATTERN *.bat EXCLUDE)
- elseif(WIN32)
- install(DIRECTORY scripts/demo/
- DESTINATION deployment_tools/demo
-diff --git a/cmake/developer_package/IEDevScriptsConfig.cmake b/cmake/developer_package/IEDevScriptsConfig.cmake
-index ed6971fd37..10817d3a75 100644
---- a/cmake/developer_package/IEDevScriptsConfig.cmake
-+++ b/cmake/developer_package/IEDevScriptsConfig.cmake
-@@ -121,7 +121,7 @@ if(NOT DEFINED OUTPUT_ROOT)
- if(NOT DEFINED OpenVINO_MAIN_SOURCE_DIR)
- message(FATAL_ERROR "OpenVINO_MAIN_SOURCE_DIR is not defined")
- endif()
-- set(OUTPUT_ROOT ${OpenVINO_MAIN_SOURCE_DIR})
-+ set(OUTPUT_ROOT ${CMAKE_CURRENT_BINARY_DIR})
- endif()
-
- # Enable postfixes for Debug/Release builds
-diff --git a/cmake/developer_package/packaging.cmake b/cmake/developer_package/packaging.cmake
-index b846bf732d..7a0022968c 100644
---- a/cmake/developer_package/packaging.cmake
-+++ b/cmake/developer_package/packaging.cmake
-@@ -4,7 +4,9 @@
- include(CPackComponent)
- unset(IE_CPACK_COMPONENTS_ALL CACHE)
-
--set(IE_CPACK_IE_DIR deployment_tools/inference_engine)
-+if (NOT DEFINED IE_CPACK_IE_DIR)
-+ set(IE_CPACK_IE_DIR deployment_tools/inference_engine)
-+endif()
-
- #
- # ie_cpack_set_library_dir()
-@@ -17,8 +19,8 @@ function(ie_cpack_set_library_dir)
- set(IE_CPACK_RUNTIME_PATH ${IE_CPACK_IE_DIR}/bin/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} PARENT_SCOPE)
- set(IE_CPACK_ARCHIVE_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} PARENT_SCOPE)
- else()
-- set(IE_CPACK_LIBRARY_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER} PARENT_SCOPE)
-- set(IE_CPACK_RUNTIME_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER} PARENT_SCOPE)
-+ set(IE_CPACK_LIBRARY_PATH ${CMAKE_INSTALL_LIBDIR} PARENT_SCOPE)
-+ set(IE_CPACK_RUNTIME_PATH ${CMAKE_INSTALL_BINDIR} PARENT_SCOPE)
- set(IE_CPACK_ARCHIVE_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER} PARENT_SCOPE)
- endif()
- endfunction()
-diff --git a/cmake/developer_package/plugins/plugins.cmake b/cmake/developer_package/plugins/plugins.cmake
-index a66d2568d9..c3aad14bab 100644
---- a/cmake/developer_package/plugins/plugins.cmake
-+++ b/cmake/developer_package/plugins/plugins.cmake
-@@ -106,7 +106,7 @@ function(ie_add_plugin)
-
- install(TARGETS ${IE_PLUGIN_NAME}
- RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT ${install_component}
-- LIBRARY DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT ${install_component})
-+ LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT ${install_component})
- endif()
- endfunction()
-
-diff --git a/inference-engine/ie_bridges/c/samples/common/opencv_c_wraper/CMakeLists.txt b/inference-engine/ie_bridges/c/samples/common/opencv_c_wraper/CMakeLists.txt
-index aff7229c9f..f45a215f68 100644
---- a/inference-engine/ie_bridges/c/samples/common/opencv_c_wraper/CMakeLists.txt
-+++ b/inference-engine/ie_bridges/c/samples/common/opencv_c_wraper/CMakeLists.txt
-@@ -28,3 +28,5 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER c_samples)
- if(COMMAND add_cpplint_target)
- add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})
- endif()
-+
-+install(TARGETS ${TARGET_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
-diff --git a/inference-engine/samples/CMakeLists.txt b/inference-engine/samples/CMakeLists.txt
-index 6bc44019fe..ca5ab34704 100644
---- a/inference-engine/samples/CMakeLists.txt
-+++ b/inference-engine/samples/CMakeLists.txt
-@@ -33,7 +33,7 @@ endif()
-
- if(IE_MAIN_SOURCE_DIR)
- # in case if samples are built from IE repo
-- set(IE_MAIN_SAMPLES_DIR ${OpenVINO_MAIN_SOURCE_DIR})
-+ set(IE_MAIN_SAMPLES_DIR ${CMAKE_BINARY_DIR})
- # hint for find_package(InferenceEngine in the samples folder)
- set(InferenceEngine_DIR "${CMAKE_BINARY_DIR}")
- # hint for find_package(ngraph in the samples folder)
-@@ -251,6 +251,8 @@ macro(ie_add_sample)
- add_cpplint_target(${IE_SAMPLE_NAME}_cpplint FOR_TARGETS ${IE_SAMPLE_NAME}
- CUSTOM_FILTERS ${custom_filters})
- endif()
-+
-+ install(TARGETS ${IE_SAMPLE_NAME} DESTINATION bin)
- endmacro()
-
- # collect all samples subdirectories
-diff --git a/inference-engine/samples/common/format_reader/CMakeLists.txt b/inference-engine/samples/common/format_reader/CMakeLists.txt
-index c5c5449677..06ecab13b5 100644
---- a/inference-engine/samples/common/format_reader/CMakeLists.txt
-+++ b/inference-engine/samples/common/format_reader/CMakeLists.txt
-@@ -41,3 +41,5 @@ target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}"
-
- set_target_properties(${TARGET_NAME} PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME}
- FOLDER cpp_samples)
-+
-+install(TARGETS ${TARGET_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
-diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt
-index 1ea3227631..aa64718940 100644
---- a/inference-engine/src/inference_engine/CMakeLists.txt
-+++ b/inference-engine/src/inference_engine/CMakeLists.txt
-@@ -254,8 +254,8 @@ install(TARGETS ${TARGET_NAME}
- install(FILES "${OpenVINO_BINARY_DIR}/share/ie_parallel.cmake"
- "${OpenVINO_BINARY_DIR}/share/InferenceEngineConfig.cmake"
- "${OpenVINO_BINARY_DIR}/share/InferenceEngineConfig-version.cmake"
-- DESTINATION ${IE_CPACK_IE_DIR}/share
-+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/InferenceEngine
- COMPONENT core)
- install(FILES $<TARGET_FILE_DIR:${TARGET_NAME}>/plugins.xml
-- DESTINATION ${IE_CPACK_RUNTIME_PATH}
-+ DESTINATION ${CMAKE_INSTALL_LIBDIR}
- COMPONENT core)
-diff --git a/inference-engine/src/preprocessing/CMakeLists.txt b/inference-engine/src/preprocessing/CMakeLists.txt
-index 973fafcbf5..81aea3471a 100644
---- a/inference-engine/src/preprocessing/CMakeLists.txt
-+++ b/inference-engine/src/preprocessing/CMakeLists.txt
-@@ -185,4 +185,4 @@ ie_developer_export_targets(${TARGET_NAME})
- install(TARGETS ${TARGET_NAME}
- RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core
- ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core
-- LIBRARY DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core)
-+ LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core)
-diff --git a/inference-engine/src/readers/ir_reader/CMakeLists.txt b/inference-engine/src/readers/ir_reader/CMakeLists.txt
-index 7721b7df6d..bf6543efa8 100644
---- a/inference-engine/src/readers/ir_reader/CMakeLists.txt
-+++ b/inference-engine/src/readers/ir_reader/CMakeLists.txt
-@@ -49,4 +49,4 @@ add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})
- install(TARGETS ${TARGET_NAME}
- RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core
- ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT core
-- LIBRARY DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core)
-+ LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core)
-diff --git a/inference-engine/src/vpu/myriad_plugin/CMakeLists.txt b/inference-engine/src/vpu/myriad_plugin/CMakeLists.txt
-index d8a5f2ec1d..2db7ddea6f 100644
---- a/inference-engine/src/vpu/myriad_plugin/CMakeLists.txt
-+++ b/inference-engine/src/vpu/myriad_plugin/CMakeLists.txt
-@@ -55,6 +55,6 @@ set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_REL
- # install
- if (LINUX)
- install(FILES ${IE_MAIN_SOURCE_DIR}/thirdparty/movidius/mvnc/src/97-myriad-usbboot.rules
-- DESTINATION ${IE_CPACK_IE_DIR}/external
-+ DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/udev/rules.d
- COMPONENT myriad)
- endif()
-diff --git a/inference-engine/tests/unit/cpu/CMakeLists.txt b/inference-engine/tests/unit/cpu/CMakeLists.txt
-index c9a92b4857..2b4fcc4d01 100644
---- a/inference-engine/tests/unit/cpu/CMakeLists.txt
-+++ b/inference-engine/tests/unit/cpu/CMakeLists.txt
-@@ -25,3 +25,5 @@ addIeTargetTest(
- ie_faster_build(${TARGET_NAME}
- UNITY
- )
-+
-+install(TARGETS ${TARGET_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
-diff --git a/inference-engine/tests/unit/inference_engine/CMakeLists.txt b/inference-engine/tests/unit/inference_engine/CMakeLists.txt
-index 1d9515f540..c81cb2ed79 100644
---- a/inference-engine/tests/unit/inference_engine/CMakeLists.txt
-+++ b/inference-engine/tests/unit/inference_engine/CMakeLists.txt
-@@ -26,3 +26,5 @@ addIeTargetTest(
- LABELS
- IE
- )
-+
-+install(TARGETS ${TARGET_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
-diff --git a/inference-engine/tests/unit/vpu/CMakeLists.txt b/inference-engine/tests/unit/vpu/CMakeLists.txt
-index 5be30a3092..6a01e280ae 100644
---- a/inference-engine/tests/unit/vpu/CMakeLists.txt
-+++ b/inference-engine/tests/unit/vpu/CMakeLists.txt
-@@ -35,3 +35,5 @@ addIeTargetTest(
- VPU
- MYRIAD
- )
-+
-+install(TARGETS ${TARGET_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
-diff --git a/inference-engine/tools/compile_tool/CMakeLists.txt b/inference-engine/tools/compile_tool/CMakeLists.txt
-index 58614d3ced..9dfa068e4d 100644
---- a/inference-engine/tools/compile_tool/CMakeLists.txt
-+++ b/inference-engine/tools/compile_tool/CMakeLists.txt
-@@ -49,7 +49,7 @@ add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})
- # install
-
- install(TARGETS compile_tool
-- RUNTIME DESTINATION deployment_tools/tools/compile_tool
-+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- COMPONENT core)
-
- install(FILES README.md
---
-2.29.0
-
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0003-protobuf-allow-target-protoc-to-be-built.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0003-protobuf-allow-target-protoc-to-be-built.patch
new file mode 100644
index 00000000..bbdeaa2a
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0003-protobuf-allow-target-protoc-to-be-built.patch
@@ -0,0 +1,45 @@
+From 450d94b475460d1af32b207d0ced495794863f0d Mon Sep 17 00:00:00 2001
+From: Anuj Mittal <anuj.mittal@intel.com>
+Date: Wed, 29 Nov 2023 12:55:19 +0530
+Subject: [PATCH 3/3] protobuf: allow target protoc to be built
+
+We can run target binaries using a qemu wrapper so allow these to be
+built and run.
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+---
+ cmake/developer_package/frontends/frontends.cmake | 2 +-
+ thirdparty/protobuf/CMakeLists.txt | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cmake/developer_package/frontends/frontends.cmake b/cmake/developer_package/frontends/frontends.cmake
+index f3b5520d6d2..7579f638c5a 100644
+--- a/cmake/developer_package/frontends/frontends.cmake
++++ b/cmake/developer_package/frontends/frontends.cmake
+@@ -163,7 +163,7 @@ macro(ov_add_frontend)
+ set(OUTPUT_PB_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${relative_path}/${FILE_WE}.pb.h)
+ add_custom_command(
+ OUTPUT "${OUTPUT_PB_SRC}" "${OUTPUT_PB_HEADER}"
+- COMMAND ${PROTOC_EXECUTABLE} ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} -I ${protofiles_root_dir} ${proto_file}
++ COMMAND protoc ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} -I ${protofiles_root_dir} ${proto_file}
+ DEPENDS ${PROTOC_DEPENDENCY} ${proto_file}
+ COMMENT "Running C++ protocol buffer compiler (${PROTOC_EXECUTABLE}) on ${proto_file_relative}"
+ VERBATIM
+diff --git a/thirdparty/protobuf/CMakeLists.txt b/thirdparty/protobuf/CMakeLists.txt
+index 15f32601f23..36853caf7dc 100644
+--- a/thirdparty/protobuf/CMakeLists.txt
++++ b/thirdparty/protobuf/CMakeLists.txt
+@@ -31,7 +31,7 @@ unset(HAVE_ZLIB CACHE)
+ if(CMAKE_CROSSCOMPILING OR
+ (APPLE AND (HOST_X86_64 AND AARCH64)) OR
+ (MSVC AND (HOST_X86_64 AND (AARCH64 OR ARM))))
+- set(protobuf_BUILD_PROTOC_BINARIES OFF CACHE BOOL "Build protoc binaries" FORCE)
++ set(protobuf_BUILD_PROTOC_BINARIES ON CACHE BOOL "Build protoc binaries" FORCE)
+ else()
+ set(protobuf_BUILD_PROTOC_BINARIES ON CACHE BOOL "Build protoc binaries" FORCE)
+ endif()
+--
+2.34.1
+
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo/0001-use-oe-gflags.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo/0001-use-oe-gflags.patch
index f38e0669..816a98a3 100644
--- a/dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo/0001-use-oe-gflags.patch
+++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo/0001-use-oe-gflags.patch
@@ -1,33 +1,27 @@
-From 6a0046c523a67b4d21d856ea73861c00b5a9c9fd Mon Sep 17 00:00:00 2001
-From: Anuj Mittal <anuj.mittal@intel.com>
-Date: Mon, 19 Oct 2020 23:29:23 +0800
+From 804b08023b3f8e72b8e3eb09e464d6775c11d966 Mon Sep 17 00:00:00 2001
+From: Naveen Saini <naveen.kumar.saini@intel.com>
+Date: Fri, 21 Oct 2022 11:38:23 +0800
Subject: [PATCH] demos: use gflags from meta-oe
Upstream-Status: Inappropriate
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
+
---
- demos/CMakeLists.txt | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
+ demos/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/demos/CMakeLists.txt b/demos/CMakeLists.txt
-index c5e3b1ec3..4e78c72a6 100644
+index 51767051c..fb7e3d22f 100644
--- a/demos/CMakeLists.txt
+++ b/demos/CMakeLists.txt
-@@ -62,11 +62,11 @@ set(CMAKE_CXX_STANDARD 11)
- set(CMAKE_CXX_STANDARD_REQUIRED ON)
- ####################################
-
--set(GFLAGS_IS_SUBPROJECT TRUE)
-+set(GFLAGS_IS_SUBPROJECT FALSE)
- set(HAVE_SYS_STAT_H 1)
- set(HAVE_INTTYPES_H 1)
+@@ -141,7 +141,7 @@ endmacro()
+ find_package(OpenCV REQUIRED COMPONENTS core highgui videoio imgproc imgcodecs)
+ find_package(OpenVINO REQUIRED COMPONENTS Runtime)
-add_subdirectory(thirdparty/gflags)
+#add_subdirectory(thirdparty/gflags)
+ add_subdirectory(common/cpp)
- if(CMAKE_CXX_COMPILER_ID MATCHES "^GNU|(Apple)?Clang$")
- set(COMPILER_IS_GCC_LIKE TRUE)
---
-2.29.0
-
+ find_package(OpenCV QUIET COMPONENTS gapi)
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo_2021.3.bb b/dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo_2021.3.bb
deleted file mode 100644
index 700f78c2..00000000
--- a/dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo_2021.3.bb
+++ /dev/null
@@ -1,66 +0,0 @@
-SUMMARY = "OpenVINO(TM) Toolkit - Open Model Zoo repository"
-HOMEPAGE = "https://github.com/opencv/open_model_zoo"
-DESCRIPTION = "This repository includes optimized deep learning \
-models and a set of demos to expedite development of high-performance \
-deep learning inference applications."
-
-SRC_URI = "git://github.com/opencv/open_model_zoo.git;protocol=git;branch=master \
- file://0001-use-oe-gflags.patch \
- "
-
-SRCREV = "9ca5dbeff80464bf5728e8be25daedfe9a9208d7"
-
-LICENSE = "Apache-2.0"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327 \
-"
-
-inherit cmake
-
-S = "${WORKDIR}/git"
-OECMAKE_SOURCEPATH = "${S}/demos"
-
-DEPENDS += "openvino-inference-engine opencv gflags"
-
-RDEPENDS_${PN} += " \
- python3-decorator \
- python3-defusedxml \
- python3-networkx \
- python3-protobuf \
- python3-test-generator \
- python3-requests \
- python3-pyyaml \
- python3-numpy \
- bash \
-"
-
-COMPATIBLE_HOST = '(x86_64).*-linux'
-
-EXTRA_OECMAKE += " \
- -DIE_MAIN_SOURCE_DIR=${B} \
- -DENABLE_SAMPLES=ON \
- -DIE_INCLUDE_DIR=${STAGING_EXECPREFIXDIR} \
- -DIE_RELEASE_LIBRARY=${STAGING_LIBDIR}/libinference_engine.so \
- -DIE_C_API_RELEASE_LIBRARY=${STAGING_LIBDIR}/libinference_engine_c_api.so \
- -DIE_LEGACY_RELEASE_LIBRARY=${STAGING_LIBDIR}/libinference_engine_legacy.so \
- -DIE_NN_BUILDER_RELEASE_LIBRARY=${STAGING_LIBDIR}/libinference_engine_nn_builder.so \
- -DIE_ROOT_DIR=${WORKDIR}/InferenceEngine \
-"
-
-do_configure_prepend(){
- mkdir -p ${WORKDIR}/InferenceEngine/share
- cp ${STAGING_LIBDIR}/cmake/InferenceEngine/* ${WORKDIR}/InferenceEngine/share/
-}
-
-do_install(){
- install -d ${D}${libdir}
- install -d ${D}${bindir}
- install -d ${D}${datadir}/openvino/open-model-zoo/tools
- install -d ${D}${datadir}/openvino/open-model-zoo/demos
- cp -rf ${WORKDIR}/build/intel64/Release/lib/*.a ${D}${libdir}
- cp -rf ${WORKDIR}/build/intel64/Release/*_demo* ${D}${bindir}
- cp -rf ${WORKDIR}/git/models ${D}${datadir}/openvino/open-model-zoo
- cp -rf ${WORKDIR}/git/demos ${D}${datadir}/openvino/open-model-zoo
- cp -rf ${WORKDIR}/git/tools/downloader ${D}${datadir}/openvino/open-model-zoo/tools
-}
-
-FILES_${PN} += "${datadir}/openvino"
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo_2024.1.0.bb b/dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo_2024.1.0.bb
new file mode 100644
index 00000000..a9422e70
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo_2024.1.0.bb
@@ -0,0 +1,54 @@
+SUMMARY = "OpenVINO(TM) Toolkit - Open Model Zoo repository"
+HOMEPAGE = "https://github.com/opencv/open_model_zoo"
+DESCRIPTION = "This repository includes optimized deep learning \
+models and a set of demos to expedite development of high-performance \
+deep learning inference applications."
+
+SRC_URI = "git://github.com/opencv/open_model_zoo.git;protocol=https;branch=master \
+ file://0001-use-oe-gflags.patch \
+ "
+
+SRCREV = "cf5141dad2a4f24e1c5d5b9d43219ed804c48bbf"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327 \
+"
+
+inherit cmake
+
+S = "${WORKDIR}/git"
+OECMAKE_SOURCEPATH = "${S}/demos"
+
+DEPENDS += "openvino-inference-engine opencv gflags"
+
+RDEPENDS:${PN} += " \
+ python3-decorator \
+ python3-defusedxml \
+ python3-networkx \
+ python3-protobuf \
+ python3-requests \
+ python3-pyyaml \
+ python3-numpy \
+ bash \
+"
+
+COMPATIBLE_HOST = '(x86_64).*-linux'
+COMPATIBLE_HOST:libc-musl = "null"
+
+EXTRA_OECMAKE += " \
+ -DENABLE_SAMPLES=ON \
+ "
+
+do_install(){
+ install -d ${D}${libdir}
+ install -d ${D}${bindir}
+ install -d ${D}${datadir}/openvino/open-model-zoo/tools
+ install -d ${D}${datadir}/openvino/open-model-zoo/demos
+ cp -rf ${B}/intel64/Release/*.a ${D}${libdir}
+ cp -rf ${B}/intel64/Release/*_demo* ${D}${bindir}
+ cp -rf ${S}/models ${D}${datadir}/openvino/open-model-zoo
+ cp -rf ${S}/demos ${D}${datadir}/openvino/open-model-zoo
+ cp -rf ${S}/tools/model_tools ${D}${datadir}/openvino/open-model-zoo/tools
+}
+
+FILES:${PN} += "${datadir}/openvino"
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/openvino-inference-engine_2021.3.bb b/dynamic-layers/openembedded-layer/recipes-support/opencv/openvino-inference-engine_2021.3.bb
deleted file mode 100644
index 96e59126..00000000
--- a/dynamic-layers/openembedded-layer/recipes-support/opencv/openvino-inference-engine_2021.3.bb
+++ /dev/null
@@ -1,124 +0,0 @@
-SUMMARY = "OpenVINO(TM) Toolkit - Deep Learning Deployment Toolkit"
-HOMEPAGE = "https://github.com/opencv/dldt"
-DESCRIPTION = "This toolkit allows developers to deploy pre-trained \
-deep learning models through a high-level C++ Inference Engine API \
-integrated with application logic."
-
-SRC_URI = "git://github.com/openvinotoolkit/openvino.git;protocol=git;branch=releases/2021/3;lfs=0 \
- https://download.01.org/opencv/master/openvinotoolkit/thirdparty/unified/VPU/usb-ma2x8x/firmware_usb-ma2x8x_1642.zip;name=usb_ma2x8x \
- https://download.01.org/opencv/master/openvinotoolkit/thirdparty/unified/VPU/pcie-ma2x8x/firmware_pcie-ma2x8x_1642.zip;name=pcie_ma2x8x \
- git://github.com/openvinotoolkit/oneDNN.git;protocol=https;destsuffix=git/inference-engine/thirdparty/mkl-dnn;name=mkl;nobranch=1 \
- git://github.com/herumi/xbyak.git;protocol=https;destsuffix=git/thirdparty/xbyak;name=xbyak \
- file://0001-inference-engine-use-system-installed-packages.patch \
- file://0002-cldNN-disable-Werror.patch \
- file://0003-inference-engine-installation-fixes.patch \
- file://0001-dont-install-licenses-and-version-file.patch \
- file://0001-plugin_api-fix-build-with-gcc-11.patch \
- "
-
-SRCREV = "c5f7ad383e654dfb4a5ac0805323cf8d43426b3f"
-SRCREV_mkl = "d35c3c11f9ff0f5090f9afe16af122cda501134c"
-SRCREV_xbyak = "8d1e41b650890080fb77548372b6236bbd4079f9"
-
-SRC_URI[usb_ma2x8x.sha256sum] = "d0f6aaaf71a595963e6013ef59045e20b07324f1a47deaa3f906419d39b2bd5a"
-SRC_URI[pcie_ma2x8x.sha256sum] = "18d3cd10cf6cc36ff58001812d3d215c0bbb2de09a8832128592401c8f959358"
-
-LICENSE = "Apache-2.0 & ISSL & MIT"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327 \
- file://inference-engine/thirdparty/mkl-dnn/LICENSE;md5=c441291ac5f15bdc6b09b4cc02ece35b \
- file://thirdparty/xbyak/COPYRIGHT;md5=03532861dad9003cc2c17f14fc7a4efa \
- file://inference-engine/thirdparty/clDNN/common/include/OpenCL_CLHPP_License.txt;md5=3b83ef96387f14655fc854ddc3c6bd57 \
-"
-LICENSE_${PN}-vpu-firmware = "ISSL"
-
-inherit cmake python3native
-
-S = "${WORKDIR}/git"
-
-EXTRA_OECMAKE += " \
- -DENABLE_OPENCV=0 \
- -DENABLE_PLUGIN_RPATH=0 \
- -DENABLE_GNA=0 \
- -DPYTHON_EXECUTABLE=${PYTHON} \
- -DCMAKE_BUILD_TYPE=RelWithDebInfo \
- -DTHREADING=TBB -DTBB_DIR=${STAGING_LIBDIR}/cmake/TBB \
- -DENABLE_SAMPLES=1 \
- -DIE_CPACK_IE_DIR=${prefix} \
- -DNGRAPH_UNIT_TEST_ENABLE=FALSE \
- -DNGRAPH_TEST_UTIL_ENABLE=FALSE \
- -DNGRAPH_ONNX_IMPORT_ENABLE=OFF \
- -DNGRAPH_JSON_ENABLE=FALSE \
- -DTREAT_WARNING_AS_ERROR=FALSE \
- -DENABLE_SPEECH_DEMO=FALSE \
- -DENABLE_DATA=FALSE \
- -DUSE_SYSTEM_PUGIXML=TRUE \
- "
-
-DEPENDS += "libusb1 \
- ade \
- opencv \
- pugixml \
- protobuf-native \
- tbb \
- "
-
-COMPATIBLE_HOST = '(x86_64).*-linux'
-COMPATIBLE_HOST_libc-musl = "null"
-
-PACKAGECONFIG ?= "vpu opencl"
-PACKAGECONFIG[opencl] = "-DENABLE_CLDNN=1 -DCLDNN__IOCL_ICD_INCDIRS=${STAGING_INCDIR} -DCLDNN__IOCL_ICD_STLDIRS=${STAGING_LIBDIR} -DCLDNN__IOCL_ICD_SHLDIRS=${STAGING_LIBDIR}, -DENABLE_CLDNN=0, ocl-icd opencl-headers libva, intel-compute-runtime"
-PACKAGECONFIG[python3] = "-DENABLE_PYTHON=ON -DPYTHON_LIBRARY=${PYTHON_LIBRARY} -DPYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIR}, -DENABLE_PYTHON=OFF, python3-cython-native, python3 python3-numpy python3-opencv python3-progress python3-cython"
-PACKAGECONFIG[vpu] = "-DENABLE_VPU=ON -DVPU_FIRMWARE_USB-MA2X8X_FILE=../mvnc/usb-ma2x8x.mvcmd -DVPU_FIRMWARE_PCIE-MA2X8X_FILE=../mvnc/pcie-ma2x8x.mvcmd,-DENABLE_VPU=OFF,,${PN}-vpu-firmware"
-PACKAGECONFIG[verbose] = "-DVERBOSE_BUILD=1,-DVERBOSE_BUILD=0"
-
-do_install_append() {
- if ${@bb.utils.contains('PACKAGECONFIG', 'vpu', 'true', 'false', d)}; then
- install -m0644 ${WORKDIR}/mvnc/usb-ma2x8x.mvcmd ${D}${libdir}/
- install -m0644 ${WORKDIR}/mvnc/pcie-ma2x8x.mvcmd ${D}${libdir}/
- fi
-
- if ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'true', 'false', d)}; then
- install -d ${D}${datadir}/inference_engine
- mv ${D}/usr/samples/python ${D}${datadir}/inference_engine/
-
- install -d ${D}${PYTHON_SITEPACKAGES_DIR}
- mv ${D}${prefix}/python/${PYTHON_DIR}/openvino ${D}${PYTHON_SITEPACKAGES_DIR}/
- mv ${D}${prefix}/deployment_tools/tools/benchmark_tool ${D}${PYTHON_SITEPACKAGES_DIR}/openvino/
- mv ${D}${prefix}/deployment_tools/tools/cross_check_tool ${D}${PYTHON_SITEPACKAGES_DIR}/openvino/
-
- rm -rf ${D}${prefix}/python
- fi
-
- rm -rf ${D}${prefix}/deployment_tools
-
- # Remove the samples source directory. We install the built samples.
- rm -rf ${D}/usr/samples
-}
-
-# Otherwise e.g. ros-openvino-toolkit-dynamic-vino-sample when using dldt-inference-engine uses dldt-inference-engine WORKDIR
-# instead of RSS
-SSTATE_SCAN_FILES_append = " *.cmake"
-
-FILES_${PN}-dev = "${includedir} \
- ${libdir}/cmake \
- "
-
-FILES_${PN} += "${libdir}/lib*${SOLIBSDEV} \
- ${datadir}/openvino \
- ${libdir}/custom_kernels \
- ${libdir}/plugins.xml \
- ${libdir}/cache.json \
- "
-
-# Move inference engine samples into a separate package
-PACKAGES =+ "${PN}-samples ${PN}-vpu-firmware"
-
-FILES_${PN}-samples = "${datadir}/inference_engine \
- ${bindir} \
- "
-FILES_${PN}-vpu-firmware += "${libdir}/*.mvcmd"
-
-# Package for inference engine python API
-PACKAGES =+ "${PN}-${PYTHON_PN}"
-
-FILES_${PN}-${PYTHON_PN} = "${PYTHON_SITEPACKAGES_DIR}/openvino"
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/openvino-inference-engine_2024.1.0.bb b/dynamic-layers/openembedded-layer/recipes-support/opencv/openvino-inference-engine_2024.1.0.bb
new file mode 100644
index 00000000..675d9920
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/openvino-inference-engine_2024.1.0.bb
@@ -0,0 +1,146 @@
+SUMMARY = "OpenVINO(TM) Toolkit - Deep Learning Deployment Toolkit"
+HOMEPAGE = "https://github.com/opencv/dldt"
+DESCRIPTION = "This toolkit allows developers to deploy pre-trained \
+deep learning models through a high-level C++ Inference Engine API \
+integrated with application logic."
+
+SRC_URI = "git://github.com/openvinotoolkit/openvino.git;protocol=https;name=openvino;branch=releases/2024/1;lfs=0 \
+ git://github.com/openvinotoolkit/oneDNN.git;protocol=https;destsuffix=git/src/plugins/intel_cpu/thirdparty/onednn;name=mkl;nobranch=1 \
+ git://github.com/oneapi-src/oneDNN.git;protocol=https;destsuffix=git/src/plugins/intel_gpu/thirdparty/onednn_gpu;name=onednn;nobranch=1 \
+ git://github.com/herumi/xbyak.git;protocol=https;destsuffix=git/thirdparty/xbyak;name=xbyak;branch=master \
+ git://github.com/nlohmann/json.git;protocol=https;destsuffix=git/thirdparty/json/nlohmann_json;name=json;branch=develop \
+ git://github.com/opencv/ade.git;protocol=https;destsuffix=git/thirdparty/ade;name=ade;nobranch=1 \
+ git://github.com/protocolbuffers/protobuf.git;protocol=https;destsuffix=git/thirdparty/protobuf/protobuf;name=protobuf;branch=3.20.x \
+ git://github.com/gflags/gflags.git;protocol=https;destsuffix=git/thirdparty/gflags/gflags;name=gflags;nobranch=1 \
+ git://github.com/madler/zlib.git;protocol=https;destsuffix=git/thirdparty/zlib/zlib;name=zlib;nobranch=1 \
+ git://github.com/openvinotoolkit/mlas.git;protocol=https;destsuffix=git/src/plugins/intel_cpu/thirdparty/mlas;name=mlas;nobranch=1 \
+ git://github.com/nodejs/node-api-headers.git;protocol=https;destsuffix=git/node-api-headers-src;name=node-api-headers;nobranch=1 \
+ git://github.com/nodejs/node-addon-api.git;protocol=https;destsuffix=git/node-addon-api-src;name=node-addon-api;nobranch=1 \
+ git://github.com/openvinotoolkit/telemetry.git;protocol=https;destsuffix=git/thirdparty/telemetry;name=telemetry;nobranch=1;lfs=0 \
+ file://0001-cmake-yocto-specific-tweaks-to-the-build-process.patch \
+ file://0002-cmake-Fix-overloaded-virtual-error.patch \
+ file://0003-protobuf-allow-target-protoc-to-be-built.patch \
+ "
+
+SRCREV_openvino = "f4afc983258bcb2592d999ed6700043fdb58ad78"
+SRCREV_mkl = "26633ae49edd4353a29b7170d9fcef6b2d79f4b3"
+SRCREV_onednn = "4e6ff043c439652fcf6c400ac4e0c81bbac7c71c"
+SRCREV_xbyak = "740dff2e866f3ae1a70dd42d6e8836847ed95cc2"
+SRCREV_json = "9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03"
+SRCREV_ade = "0e8a2ccdd34f29dba55894f5f3c5179809888b9e"
+SRCREV_protobuf = "fe271ab76f2ad2b2b28c10443865d2af21e27e0e"
+SRCREV_gflags = "e171aa2d15ed9eb17054558e0b3a6a413bb01067"
+SRCREV_zlib = "09155eaa2f9270dc4ed1fa13e2b4b2613e6e4851"
+SRCREV_mlas = "d1bc25ec4660cddd87804fcf03b2411b5dfb2e94"
+SRCREV_node-api-headers = "186e04b5e40e54d7fd1655bc67081cc483f12488"
+SRCREV_node-addon-api = "39a25bf27788ff7a7ea5c64978c4dcd1e7b9d80d"
+SRCREV_telemetry = "58e16c257a512ec7f451c9fccf9ff455065b285b"
+SRCREV_FORMAT = "openvino_mkl_onednn_xbyak_json_ade_protobuf_gflags_zlib_node-api-headers_node-addon-api_mlas_telemetry"
+
+LICENSE = "Apache-2.0 & MIT & BSD-3-Clause & Zlib"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327 \
+ file://thirdparty/xbyak/COPYRIGHT;md5=3c98edfaa50a86eeaef4c6109e803f16 \
+ file://thirdparty/cnpy/LICENSE;md5=689f10b06d1ca2d4b1057e67b16cd580 \
+ file://thirdparty/json/nlohmann_json/LICENSE.MIT;md5=f969127d7b7ed0a8a63c2bbeae002588 \
+ file://thirdparty/ade/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
+ file://thirdparty/gflags/gflags/COPYING.txt;md5=c80d1a3b623f72bb85a4c75b556551df \
+ file://thirdparty/zlib/zlib/LICENSE;md5=b51a40671bc46e961c0498897742c0b8 \
+ file://src/plugins/intel_cpu/thirdparty/mlas/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327 \
+ file://src/plugins/intel_cpu/thirdparty/onednn/LICENSE;md5=3b64000f6e7d52516017622a37a94ce9 \
+ file://src/plugins/intel_gpu/thirdparty/onednn_gpu/LICENSE;md5=3b64000f6e7d52516017622a37a94ce9 \
+ file://node-api-headers-src/LICENSE;md5=6adb2909701d4605b4b2ae1a9b25d8bd \
+ file://node-addon-api-src/LICENSE.md;md5=0492ef29a9d558a3e9660e7accc9ca6a \
+ file://thirdparty/telemetry/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327 \
+"
+
+inherit cmake python3native pkgconfig qemu
+
+S = "${WORKDIR}/git"
+EXTRA_OECMAKE += " \
+ -DCMAKE_CROSSCOMPILING_EMULATOR=${WORKDIR}/qemuwrapper \
+ -DENABLE_OPENCV=OFF \
+ -DENABLE_INTEL_GNA=OFF \
+ -DENABLE_SYSTEM_TBB=ON \
+ -DPYTHON_EXECUTABLE=${PYTHON} \
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+ -DTHREADING=TBB -DTBB_DIR="${STAGING_LIBDIR}/cmake/TBB" \
+ -DTREAT_WARNING_AS_ERROR=FALSE \
+ -DENABLE_DATA=FALSE \
+ -DENABLE_SYSTEM_PUGIXML=TRUE \
+ -DENABLE_OV_ONNX_FRONTEND=FALSE \
+ -DUSE_BUILD_TYPE_SUBFOLDER=OFF \
+ -DENABLE_FUZZING=OFF \
+ -DENABLE_TBBBIND_2_5=OFF \
+ -DCPACK_GENERATOR=RPM \
+ -DENABLE_SYSTEM_FLATBUFFERS=ON \
+ -DENABLE_SYSTEM_SNAPPY=ON \
+ -DFETCHCONTENT_BASE_DIR="${S}" \
+ -DENABLE_INTEL_NPU=OFF \
+ "
+
+DEPENDS += "\
+ flatbuffers-native \
+ pugixml \
+ python3-pybind11 \
+ python3-pybind11-native \
+ qemu-native \
+ snappy \
+ tbb \
+ "
+
+COMPATIBLE_HOST = '(x86_64).*-linux'
+COMPATIBLE_HOST:libc-musl = "null"
+
+PACKAGECONFIG ?= "opencl samples"
+PACKAGECONFIG[opencl] = "-DENABLE_INTEL_GPU=TRUE, -DENABLE_INTEL_GPU=FALSE, virtual/opencl-icd opencl-headers opencl-clhpp,"
+PACKAGECONFIG[python3] = "-DENABLE_PYTHON=ON -DPYTHON_LIBRARY=${PYTHON_LIBRARY} -DPYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIR} -DENABLE_PYTHON_PACKAGING=ON, -DENABLE_PYTHON=OFF, patchelf-native, python3 python3-numpy python3-progress"
+PACKAGECONFIG[samples] = "-DENABLE_SAMPLES=ON -DENABLE_COMPILE_TOOL=ON, -DENABLE_SAMPLES=OFF -DENABLE_COMPILE_TOOL=OFF, opencv"
+PACKAGECONFIG[verbose] = "-DVERBOSE_BUILD=1,-DVERBOSE_BUILD=0"
+
+do_configure:prepend() {
+ # Dont set PROJECT_ROOT_DIR
+ sed -i -e 's:\${OpenVINO_SOURCE_DIR}::;' ${S}/src/CMakeLists.txt
+
+ # qemu wrapper that can be used by cmake to run target binaries.
+ qemu_binary="${@qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST'), [d.expand('${STAGING_DIR_HOST}${libdir}'),d.expand('${STAGING_DIR_HOST}${base_libdir}')])}"
+ cat > ${WORKDIR}/qemuwrapper << EOF
+#!/bin/sh
+$qemu_binary "\$@"
+EOF
+ chmod +x ${WORKDIR}/qemuwrapper
+}
+
+do_install:append() {
+ rm -rf ${D}${prefix}/install_dependencies
+ rm -rf ${D}${prefix}/setupvars.sh
+
+ find ${B}/src/plugins/intel_cpu/cross-compiled/ -type f -name *_disp.cpp -exec sed -i -e 's%'"${S}"'%'"${TARGET_DBGSRC_DIR}"'%g' {} +
+}
+
+# Otherwise e.g. ros-openvino-toolkit-dynamic-vino-sample when using dldt-inference-engine uses dldt-inference-engine WORKDIR
+# instead of RSS
+SSTATE_SCAN_FILES:append = " *.cmake"
+
+FILES:${PN} += "\
+ ${libdir}/openvino-${PV}/lib*${SOLIBSDEV} \
+ ${libdir}/openvino-${PV}/plugins.xml \
+ ${libdir}/openvino-${PV}/cache.json \
+ "
+
+# Move inference engine samples into a separate package
+PACKAGES =+ "${PN}-samples"
+
+FILES:${PN}-samples = "${datadir}/openvino \
+ ${bindir} \
+ ${libdir}/libformat_reader.a \
+ ${libdir}/libopencv_c_wrapper.a \
+ "
+
+RDEPENDS:${PN}-samples += "python3-core"
+
+# Package for inference engine python API
+PACKAGES =+ "${PN}-python3"
+
+FILES:${PN}-python3 = "${PYTHON_SITEPACKAGES_DIR}"
+
+UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+\.\d+\.\d+))$"
diff --git a/lib/oeqa/runtime/cases/jhi.py b/lib/oeqa/runtime/cases/jhi.py
deleted file mode 100644
index 7a24b6da..00000000
--- a/lib/oeqa/runtime/cases/jhi.py
+++ /dev/null
@@ -1,41 +0,0 @@
-import os
-from oeqa.runtime.decorator.package import OEHasPackage
-from oeqa.runtime.case import OERuntimeTestCase
-from oeqa.core.decorator.depends import OETestDepends
-
-class JhiTest(OERuntimeTestCase):
-
- @classmethod
- def tearDownClass(cls):
- _, output = cls.tc.target.run('pidof jhid')
- cls.tc.target.run('kill %s' % output)
-
- @OEHasPackage(['openssh-sshd'])
- @OEHasPackage(['jhi'])
- def test_jhi_mei_driver(self):
- command = 'ls /dev/mei*'
- (status, output) = self.target.run(command)
- self.assertEqual(status, 0, msg="Error messages: %s" % output)
-
- @OETestDepends(['jhi.JhiTest.test_jhi_mei_driver'])
- def test_jhi_daemon_version(self):
- command = 'jhid -v'
- (status, output) = self.target.run(command)
- self.assertEqual(status, 0, msg="Error messages: %s" % output)
-
- @OETestDepends(['jhi.JhiTest.test_jhi_mei_driver'])
- def test_jhi_daemon_can_initialized(self):
- command = 'jhid -d'
- (status, output) = self.target.run(command)
- self.assertEqual(status, 0, msg="Error messages: %s" % output)
-
- @OEHasPackage(['jhi-test'])
- @OETestDepends(['jhi.JhiTest.test_jhi_daemon_can_initialized'])
- def test_jhi_bist(self):
- (status, output) = self.target.run('uname -m')
- self.assertEqual(status, 0, msg='status and output: %s and %s' % (status, output))
- if 'x86_64' not in output:
- self.skipTest("Skipped jhi bist test if not x86_64 machine (current machine: %s)." % output)
- command = 'bist'
- (status, output) = self.target.run(command)
- self.assertEqual(status, 0, msg="Error messages: %s" % output)
diff --git a/lib/oeqa/runtime/cases/parselogs-ignores-intel-core2-32.txt b/lib/oeqa/runtime/cases/parselogs-ignores-intel-core2-32.txt
new file mode 100644
index 00000000..84ce8168
--- /dev/null
+++ b/lib/oeqa/runtime/cases/parselogs-ignores-intel-core2-32.txt
@@ -0,0 +1,9 @@
+# These should be reviewed to see if they are still needed
+ACPI: No _BQC method, cannot determine initial brightness
+[Firmware Bug]: ACPI: No _BQC method, cannot determine initial brightness
+(EE) Failed to load module "psb"
+(EE) Failed to load module "psbdrv"
+(EE) open /dev/fb0: No such file or directory
+(EE) AIGLX: reverting to software rendering
+dmi: Firmware registration failed.
+ioremap error for 0x78
diff --git a/lib/oeqa/runtime/cases/parselogs-ignores-intel-corei7-64.txt b/lib/oeqa/runtime/cases/parselogs-ignores-intel-corei7-64.txt
new file mode 100644
index 00000000..5c9b4bc7
--- /dev/null
+++ b/lib/oeqa/runtime/cases/parselogs-ignores-intel-corei7-64.txt
@@ -0,0 +1,14 @@
+# These should be reviewed to see if they are still needed
+can't set Max Payload Size to 256
+intel_punit_ipc: can't request region for resource
+[drm] parse error at position 4 in video mode 'efifb'
+ACPI Error: Could not enable RealTimeClock event
+ACPI Warning: Could not enable fixed event - RealTimeClock
+hci_intel INT33E1:00: Unable to retrieve gpio
+hci_intel: probe of INT33E1:00 failed
+can't derive routing for PCI INT A
+failed to read out thermal zone
+Bluetooth: hci0: Setting Intel event mask failed
+ttyS2 - failed to request DMA
+Bluetooth: hci0: Failed to send firmware data (-38)
+atkbd serio0: Failed to enable keyboard on isa0060/serio0
diff --git a/recipes-bsp/formfactor/formfactor_0.0.bbappend b/recipes-bsp/formfactor/formfactor_0.0.bbappend
index 6dd422ae..d21c3bee 100644
--- a/recipes-bsp/formfactor/formfactor_0.0.bbappend
+++ b/recipes-bsp/formfactor/formfactor_0.0.bbappend
@@ -1 +1 @@
-FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/${PN}:"
+FILESEXTRAPATHS:prepend:intel-x86-common := "${THISDIR}/${PN}:"
diff --git a/recipes-bsp/intel-cmt-cat/intel-cmt-cat_23.11.1.bb b/recipes-bsp/intel-cmt-cat/intel-cmt-cat_23.11.1.bb
new file mode 100644
index 00000000..60d0dfd2
--- /dev/null
+++ b/recipes-bsp/intel-cmt-cat/intel-cmt-cat_23.11.1.bb
@@ -0,0 +1,29 @@
+SUMMARY = "intel-cmt-cat"
+DESCRIPTION = "Software package which provides basic support for Intel(R) \
+Resource Director Technology (Intel(R) RDT)"
+HOMEPAGE = "https://github.com/intel/intel-cmt-cat"
+
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=4b63c65942e1c16fd897f8cd20abebf8"
+
+SRC_URI = "git://github.com/intel/intel-cmt-cat;protocol=https;branch=master"
+SRCREV = "b26b31b0ae6980c5939a421cefe0316cae884626"
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_HOST = '(x86_64).*-linux'
+COMPATIBLE_HOST:libc-musl = "null"
+
+do_install() {
+ oe_runmake install PREFIX=${D}${prefix} NOLDCONFIG=y
+}
+
+FILES:${PN} += "${nonarch_libdir}/libpqos*"
+FILES:${PN}-doc = "/usr/man*"
+
+INSANE_SKIP:${PN} += "ldflags"
+INSANE_SKIP:${PN} += "dev-so"
+INSANE_SKIP:${PN} += "libdir"
+INSANE_SKIP:${PN} += "already-stripped"
+
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
diff --git a/recipes-bsp/metee/metee_3.1.0.bb b/recipes-bsp/metee/metee_3.2.4.bb
index b03d9c23..da8220b9 100644
--- a/recipes-bsp/metee/metee_3.1.0.bb
+++ b/recipes-bsp/metee/metee_3.2.4.bb
@@ -10,8 +10,9 @@ COMPATIBLE_HOST = '(i.86|x86_64).*-linux'
inherit cmake
-SRC_URI = "git://github.com/intel/metee.git"
-SRCREV = "73636d20b51c64182867686d1db9ff05604f42d8"
+SRC_URI = "git://github.com/intel/metee.git;branch=master;protocol=https \
+"
+SRCREV = "db45e37e146fd9c06907a15ade55eba06ad1f951"
S = "${WORKDIR}/git"
diff --git a/recipes-core/images/core-image-minimal-initramfs.bbappend b/recipes-core/images/core-image-minimal-initramfs.bbappend
index 132f15b5..90ac28fd 100644
--- a/recipes-core/images/core-image-minimal-initramfs.bbappend
+++ b/recipes-core/images/core-image-minimal-initramfs.bbappend
@@ -1,2 +1,2 @@
# Add i915 graphics firmware
-PACKAGE_INSTALL_append_intel-x86-common = " linux-firmware-i915"
+PACKAGE_INSTALL:append:intel-x86-common = " linux-firmware-i915"
diff --git a/recipes-core/images/core-image-tiny.bb b/recipes-core/images/core-image-tiny.bb
index 6b09b0c2..f521f668 100644
--- a/recipes-core/images/core-image-tiny.bb
+++ b/recipes-core/images/core-image-tiny.bb
@@ -32,5 +32,5 @@ python() {
d.appendVarFlag('do_image', 'depends', ' %s:do_image_complete' % initrd_i)
}
-WKS_FILE_intel-corei7-64 = "core-image-tiny.wks.in"
-WKS_FILE_intel-core2-32 = "core-image-tiny.wks.in"
+WKS_FILE:intel-corei7-64 = "core-image-tiny.wks.in"
+WKS_FILE:intel-core2-32 = "core-image-tiny.wks.in"
diff --git a/recipes-core/libxcam/libxcam/0001-fake_v4l2_device.h-fix-narrowing-warning.patch b/recipes-core/libxcam/libxcam/0001-fake_v4l2_device.h-fix-narrowing-warning.patch
new file mode 100644
index 00000000..f15d5cc7
--- /dev/null
+++ b/recipes-core/libxcam/libxcam/0001-fake_v4l2_device.h-fix-narrowing-warning.patch
@@ -0,0 +1,94 @@
+From d4c97b50b577ea16b9ff6d9a352ab474a119310e Mon Sep 17 00:00:00 2001
+From: Naveen Saini <naveen.kumar.saini@intel.com>
+Date: Wed, 18 May 2022 15:41:24 +0800
+Subject: [PATCH] fake_v4l2_device.h: fix narrowing warning
+
+Use uint32_t instead of int for IOCTLs commands.
+
+Warning log:
+| ../../../git/xcore/fake_v4l2_device.h: In member function 'virtual int XCam::FakeV4l2Device::io_control(int, void*)':
+| ../../../git/xcore/fake_v4l2_device.h:42:14: error: narrowing conversion of '3225441794' from 'long unsigned int' to 'int' [-Wnarrowing]
+| 42 | case VIDIOC_ENUM_FMT:
+| | ^~~~~~~~~~~~~~~
+| make[4]: *** [Makefile:685: libgstxcamsrc_la-gstxcamsrc.lo] Error 1
+
+Issue: https://github.com/intel/libxcam/issues/801
+Upstream-Status: Submitted [https://github.com/intel/libxcam/pull/802]
+
+Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
+---
+ xcore/base/xcam_common.h | 2 +-
+ xcore/fake_v4l2_device.h | 2 +-
+ xcore/v4l2_device.cpp | 2 +-
+ xcore/v4l2_device.h | 2 +-
+ xcore/xcam_common.cpp | 2 +-
+ 5 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/xcore/base/xcam_common.h b/xcore/base/xcam_common.h
+index 1f16e1e..4aa6cb9 100644
+--- a/xcore/base/xcam_common.h
++++ b/xcore/base/xcam_common.h
+@@ -75,7 +75,7 @@ void xcam_free (void *ptr);
+ * return, 0 successfully
+ * else, check errno
+ */
+-int xcam_device_ioctl (int fd, int cmd, void *arg);
++int xcam_device_ioctl (int fd, uint32_t cmd, void *arg);
+ const char *xcam_fourcc_to_string (uint32_t fourcc);
+
+ void xcam_set_log (const char* file_name);
+diff --git a/xcore/fake_v4l2_device.h b/xcore/fake_v4l2_device.h
+index f679c19..e29787d 100644
+--- a/xcore/fake_v4l2_device.h
++++ b/xcore/fake_v4l2_device.h
+@@ -33,7 +33,7 @@ public:
+ : V4l2Device ("/dev/null")
+ {}
+
+- int io_control (int cmd, void *arg)
++ int io_control (uint32_t cmd, void *arg)
+ {
+ XCAM_UNUSED (arg);
+
+diff --git a/xcore/v4l2_device.cpp b/xcore/v4l2_device.cpp
+index 395461e..66a8ac6 100644
+--- a/xcore/v4l2_device.cpp
++++ b/xcore/v4l2_device.cpp
+@@ -185,7 +185,7 @@ V4l2Device::close ()
+ }
+
+ int
+-V4l2Device::io_control (int cmd, void *arg)
++V4l2Device::io_control (uint32_t cmd, void *arg)
+
+ {
+ if (_fd <= 0)
+diff --git a/xcore/v4l2_device.h b/xcore/v4l2_device.h
+index b4ad7ad..2551a92 100644
+--- a/xcore/v4l2_device.h
++++ b/xcore/v4l2_device.h
+@@ -104,7 +104,7 @@ public:
+ XCamReturn queue_buffer (SmartPtr<V4l2Buffer> &buf);
+
+ // use as less as possible
+- virtual int io_control (int cmd, void *arg);
++ virtual int io_control (uint32_t cmd, void *arg);
+
+ protected:
+
+diff --git a/xcore/xcam_common.cpp b/xcore/xcam_common.cpp
+index 848884d..d4d5093 100644
+--- a/xcore/xcam_common.cpp
++++ b/xcore/xcam_common.cpp
+@@ -53,7 +53,7 @@ void xcam_free(void *ptr)
+ free (ptr);
+ }
+
+-int xcam_device_ioctl (int fd, int cmd, void *arg)
++int xcam_device_ioctl (int fd, uint32_t cmd, void *arg)
+ {
+ int ret = 0;
+ int tried_time = 0;
+--
+2.25.1
+
diff --git a/recipes-core/libxcam/libxcam_1.5.0.bb b/recipes-core/libxcam/libxcam_1.5.0.bb
index fcd14bd4..df459d72 100644
--- a/recipes-core/libxcam/libxcam_1.5.0.bb
+++ b/recipes-core/libxcam/libxcam_1.5.0.bb
@@ -8,10 +8,11 @@ inherit autotools pkgconfig
S = "${WORKDIR}/git"
SRCREV = "231a1d5243cd45c7a6b511b667f1ec52178fdda8"
-SRC_URI = "git://github.com/intel/libxcam.git;branch=1.5.0; \
+SRC_URI = "git://github.com/intel/libxcam.git;branch=1.5.0;protocol=https \
+ file://0001-fake_v4l2_device.h-fix-narrowing-warning.patch \
"
-COMPATIBLE_HOST_libc-musl = "null"
+COMPATIBLE_HOST:libc-musl = "null"
PACKAGECONFIG ??= " gst \
${@bb.utils.contains("DISTRO_FEATURES", "opengl", "gles", "", d)} \
@@ -27,12 +28,12 @@ PACKAGECONFIG[gles] = "--enable-gles, --disable-gles, virtual/mesa"
PACKAGECONFIG[vulkan] = "--enable-vulkan, --disable-vulkan, vulkan-loader virtual/mesa"
PACKAGECONFIG[dnn] = "--enable-dnn, --disable-dnn,"
-do_install_append () {
+do_install:append () {
install -d ${D}${bindir}/libxcam
- cp -r ${WORKDIR}/build/tests/.libs/* ${D}${bindir}/libxcam/
+ cp -r ${B}/tests/.libs/* ${D}${bindir}/libxcam/
}
-FILES_${PN} += "${libdir}/gstreamer-*/*.so"
-FILES_${PN}-test = "${bindir}/libxcam/*"
+FILES:${PN} += "${libdir}/gstreamer-*/*.so"
+FILES:${PN}-test = "${bindir}/libxcam/*"
PACKAGES =+ "${PN}-test"
-RDEPENDS_${PN}-test =+ "bash"
+RDEPENDS:${PN}-test =+ "bash"
diff --git a/recipes-core/meta/icx-environment.inc b/recipes-core/meta/icx-environment.inc
new file mode 100644
index 00000000..65322a91
--- /dev/null
+++ b/recipes-core/meta/icx-environment.inc
@@ -0,0 +1,15 @@
+export ICX_LDFLAGS_OPTION = " -Wl,-dynamic-linker,/lib/ld-linux-x86-64.so.2"
+export ICXSDK_PREFIX_OPTION = "-B ${TARGET_PREFIX}"
+export ICXQSDK_PREFIX_OPTION = "-qgnu-prefix=${TARGET_PREFIX}"
+
+create_sdk_files:append() {
+ script=${SDK_OUTPUT}/${SDKPATH}/environment-setup-${REAL_MULTIMACH_TARGET_SYS}
+ if ${@bb.utils.contains('ICXSDK', '1', 'true', 'false', d)}; then
+ echo 'export ICX="icx ${ICXSDK_PREFIX_OPTION} --target=${TARGET_SYS} ${TARGET_CC_ARCH} --sysroot=$SDKTARGETSYSROOT ${ICX_LDFLAGS_OPTION}"' >> $script
+ echo 'export ICXCXX="icpx ${ICXSDK_PREFIX_OPTION} --target=${TARGET_SYS} ${TARGET_CC_ARCH} --sysroot=$SDKTARGETSYSROOT ${ICX_LDFLAGS_OPTION}"' >> $script
+ echo 'export ICXCPP="icx ${ICXSDK_PREFIX_OPTION} -E --target=${TARGET_SYS} ${TARGET_CC_ARCH} --sysroot=$SDKTARGETSYSROOT ${ICX_LDFLAGS_OPTION}"' >> $script
+ echo 'export ICXLD="xild --sysroot=$SDKTARGETSYSROOT "' >> $script
+ echo 'export ICXCCLD="icx ${ICXSDK_PREFIX_OPTION} --sysroot=$SDKTARGETSYSROOT"' >> $script
+ echo 'export ICXAR="xiar ${ICXQSDK_PREFIX_OPTION}"' >> $script
+ fi
+}
diff --git a/recipes-core/meta/meta-environment-extsdk.bbappend b/recipes-core/meta/meta-environment-extsdk.bbappend
new file mode 100644
index 00000000..2cff6fc4
--- /dev/null
+++ b/recipes-core/meta/meta-environment-extsdk.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+require ${@bb.utils.contains('ICXSDK', '1', 'icx-environment.inc', '', d)}
diff --git a/recipes-core/meta/meta-environment.bbappend b/recipes-core/meta/meta-environment.bbappend
new file mode 100644
index 00000000..2cff6fc4
--- /dev/null
+++ b/recipes-core/meta/meta-environment.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+require ${@bb.utils.contains('ICXSDK', '1', 'icx-environment.inc', '', d)}
diff --git a/recipes-core/microcode/intel-microcode_20210608.bb b/recipes-core/microcode/intel-microcode_20240312.bb
index 8a53421f..00b18231 100644
--- a/recipes-core/microcode/intel-microcode_20210608.bb
+++ b/recipes-core/microcode/intel-microcode_20240312.bb
@@ -16,7 +16,7 @@ LIC_FILES_CHKSUM = "file://license;md5=d8405101ec6e90c1d84b082b0c40c721"
SRC_URI = "git://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files.git;protocol=https;branch=main \
"
-SRCREV = "3f97690f0da8011f52209b232450a1e5c4f2e1f6"
+SRCREV = "41af34500598418150aa298bb04e7edacc547897"
DEPENDS = "iucode-tool-native"
S = "${WORKDIR}/git"
@@ -34,12 +34,6 @@ do_compile() {
${STAGING_DIR_NATIVE}${sbindir_native}/iucode_tool \
${UCODE_FILTER_PARAMETERS} \
--overwrite \
- --write-to=${WORKDIR}/microcode_${PV}.bin \
- ${S}/intel-ucode/* ${S}/intel-ucode-with-caveats/*
-
- ${STAGING_DIR_NATIVE}${sbindir_native}/iucode_tool \
- ${UCODE_FILTER_PARAMETERS} \
- --overwrite \
--write-earlyfw=${WORKDIR}/microcode_${PV}.cpio \
${S}/intel-ucode/* ${S}/intel-ucode-with-caveats/*
}
@@ -47,6 +41,7 @@ do_compile() {
do_install() {
install -d ${D}${nonarch_base_libdir}/firmware/intel-ucode/
${STAGING_DIR_NATIVE}${sbindir_native}/iucode_tool \
+ ${UCODE_FILTER_PARAMETERS} \
--write-firmware=${D}${nonarch_base_libdir}/firmware/intel-ucode \
${S}/intel-ucode/* ${S}/intel-ucode-with-caveats/*
}
@@ -63,6 +58,6 @@ addtask deploy before do_build after do_compile
PACKAGES = "${PN}"
-FILES_${PN} = "${nonarch_base_libdir}"
+FILES:${PN} = "${nonarch_base_libdir}"
UPSTREAM_CHECK_GITTAGREGEX = "^microcode-(?P<pver>(\d+)[a-z]*)$"
diff --git a/recipes-core/microcode/iucode-tool_2.3.1.bb b/recipes-core/microcode/iucode-tool_2.3.1.bb
index df74a8e9..19417b7c 100644
--- a/recipes-core/microcode/iucode-tool_2.3.1.bb
+++ b/recipes-core/microcode/iucode-tool_2.3.1.bb
@@ -12,14 +12,14 @@ DESCRIPTION = "iucode_tool is a program to manipulate Intel i686 and X86-64\
HOMEPAGE = "https://gitlab.com/iucode-tool/"
BUGTRACKER = "https://bugs.debian.org/cgi-bin/pkgreport.cgi?ordering=normal;archive=0;src=iucode-tool;repeatmerged=0"
-LICENSE = "GPLv2+"
+LICENSE = "GPL-2.0-or-later"
LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
file://iucode_tool.c;beginline=1;endline=15;md5=71eeab3190360ff0267101b570874756"
-DEPENDS_append_libc-musl = " argp-standalone"
+DEPENDS:append:libc-musl = " argp-standalone"
SRC_URI = "https://gitlab.com/iucode-tool/releases/raw/master/iucode-tool_${PV}.tar.xz"
-SRC_URI_append_libc-musl = " file://0001-Makefile.am-Add-arg-parse-library-for-MUSL-support.patch"
+SRC_URI:append:libc-musl = " file://0001-Makefile.am-Add-arg-parse-library-for-MUSL-support.patch"
SRC_URI[md5sum] = "63b33cc0ea1f8c73b443412abbf39d6f"
SRC_URI[sha256sum] = "12b88efa4d0d95af08db05a50b3dcb217c0eb2bfc67b483779e33d498ddb2f95"
diff --git a/recipes-core/ovmf/files/0001-ovmf-RefkitTestCA-TEST-UEFI-SecureBoot.patch b/recipes-core/ovmf/files/0001-ovmf-RefkitTestCA-TEST-UEFI-SecureBoot.patch
index c13363d2..7eb3bc69 100644
--- a/recipes-core/ovmf/files/0001-ovmf-RefkitTestCA-TEST-UEFI-SecureBoot.patch
+++ b/recipes-core/ovmf/files/0001-ovmf-RefkitTestCA-TEST-UEFI-SecureBoot.patch
@@ -1,6 +1,6 @@
-From 149b34de80e7f9f5331c285b862776cdd4b02ee3 Mon Sep 17 00:00:00 2001
+From b2099e7184d48a6d05c8713b6fd5dac0e2e70963 Mon Sep 17 00:00:00 2001
From: Mikko Ylinen <mikko.ylinen@linux.intel.com>
-Date: Fri, 7 Apr 2017 12:06:14 +0300
+Date: Wed, 2 Mar 2022 10:55:35 +0800
Subject: [PATCH] ovmf: RefkitTestCA: TEST UEFI SecureBoot
This patch adds refkit-db.cer (via xxd -i) in OVMF's db
@@ -9,25 +9,23 @@ application. It's used for testing purposes only.
Images signed with refkit-db keys are allowed to boot.
-Signed-off-by: Mikko Ylinen <mikko.ylinen@linux.intel.com>
-
-[ Change location of key to AuthData.c ]
-Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+Upstream-Status: Inappropriate
-%% original patch: 0001-ovmf-RefkitTestCA-TEST-UEFI-SecureBoot.patch
+Signed-off-by: Mikko Ylinen <mikko.ylinen@linux.intel.com>
+Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
---
- OvmfPkg/EnrollDefaultKeys/AuthData.c | 68 +++++++++++++++++++
- OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c | 1 +
+ OvmfPkg/EnrollDefaultKeys/AuthData.c | 69 +++++++++++++++++++
+ OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c | 3 +
OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.h | 2 +
- 3 files changed, 71 insertions(+)
+ 3 files changed, 74 insertions(+)
diff --git a/OvmfPkg/EnrollDefaultKeys/AuthData.c b/OvmfPkg/EnrollDefaultKeys/AuthData.c
-index 3b4856a01f..7109766296 100644
+index 53ee7f7003..127131cd05 100644
--- a/OvmfPkg/EnrollDefaultKeys/AuthData.c
+++ b/OvmfPkg/EnrollDefaultKeys/AuthData.c
-@@ -398,6 +398,74 @@ CONST UINT8 mMicrosoftUefiCa[] = {
+@@ -395,6 +395,75 @@ CONST UINT8 mMicrosoftUefiCa[] = {
- CONST UINTN mSizeOfMicrosoftUefiCa = sizeof mMicrosoftUefiCa;
+ CONST UINTN mSizeOfMicrosoftUefiCa = sizeof mMicrosoftUefiCa;
+CONST UINT8 mRefkitTestCA[] = {
+ 0x30, 0x82, 0x02, 0xfb, 0x30, 0x82, 0x01, 0xe3, 0xa0, 0x03, 0x02, 0x01,
@@ -97,32 +95,35 @@ index 3b4856a01f..7109766296 100644
+};
+
+CONST UINTN mSizeOfRefkitTestCA = sizeof mRefkitTestCA;
-
++
//
// The Microsoft.UefiSecureBootLogo.Tests.OutOfBoxConfirmDBXisPresent test case
+ // of the Secure Boot Logo Test in the Microsoft Hardware Certification Kit
diff --git a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
-index f45cb799f7..fb1252e768 100644
+index 094e4c821b..0a7eef54dc 100644
--- a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
+++ b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
-@@ -615,6 +615,7 @@ ShellAppMain (
- &gEfiCertX509Guid,
- mMicrosoftPca, mSizeOfMicrosoftPca, &gMicrosoftVendorGuid,
- mMicrosoftUefiCa, mSizeOfMicrosoftUefiCa, &gMicrosoftVendorGuid,
-+ mRefkitTestCA, mSizeOfRefkitTestCA, &gEfiCallerIdGuid,
- NULL);
+@@ -702,6 +702,9 @@ ShellAppMain (
+ mMicrosoftUefiCa,
+ mSizeOfMicrosoftUefiCa,
+ &gMicrosoftVendorGuid,
++ mRefkitTestCA,
++ mSizeOfRefkitTestCA,
++ &gEfiCallerIdGuid,
+ NULL
+ );
}
- if (EFI_ERROR (Status)) {
diff --git a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.h b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.h
-index 8e61f0a77b..e3fa046f95 100644
+index 56da9c71d6..8de1dfe4e0 100644
--- a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.h
+++ b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.h
-@@ -135,4 +135,6 @@ extern CONST UINTN mSizeOfMicrosoftUefiCa;
- extern CONST UINT8 mSha256OfDevNull[];
- extern CONST UINTN mSizeOfSha256OfDevNull;
+@@ -133,4 +133,6 @@ extern CONST UINTN mSizeOfMicrosoftUefiCa;
+ extern CONST UINT8 mSha256OfDevNull[];
+ extern CONST UINTN mSizeOfSha256OfDevNull;
+extern CONST UINT8 mRefkitTestCA[];
+extern CONST UINTN mSizeOfRefkitTestCA;
#endif /* ENROLL_DEFAULT_KEYS_H_ */
--
-2.21.0
+2.17.1
diff --git a/recipes-core/ovmf/ovmf-shell-image-enrollkeys.bb b/recipes-core/ovmf/ovmf-shell-image-enrollkeys.bb
index b20f6e58..ca3cfc15 100644
--- a/recipes-core/ovmf/ovmf-shell-image-enrollkeys.bb
+++ b/recipes-core/ovmf/ovmf-shell-image-enrollkeys.bb
@@ -1,10 +1,10 @@
require recipes-core/ovmf/ovmf-shell-image.bb
-WKS_SEARCH_PATH_append = ":${COREBASE}/meta/recipes-core/ovmf"
+WKS_SEARCH_PATH:append = ":${COREBASE}/meta/recipes-core/ovmf"
QB_DRIVE_TYPE = "/dev/vd"
-do_image_append() {
+do_image:append() {
cat > ${IMAGE_ROOTFS}/startup.nsh << EOF
EnrollDefaultKeys
reset
diff --git a/recipes-core/ovmf/ovmf_%.bbappend b/recipes-core/ovmf/ovmf_%.bbappend
index bbf5fa32..34a9dd1b 100644
--- a/recipes-core/ovmf/ovmf_%.bbappend
+++ b/recipes-core/ovmf/ovmf_%.bbappend
@@ -1,6 +1,6 @@
-FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/files:"
+FILESEXTRAPATHS:prepend:intel-x86-common := "${THISDIR}/files:"
-SRC_URI_append_intel-x86-common = " \
+SRC_URI:append:intel-x86-common = " \
file://0001-ovmf-RefkitTestCA-TEST-UEFI-SecureBoot.patch \
"
-PACKAGECONFIG_append_intel-x86-common = " secureboot"
+PACKAGECONFIG:append:intel-x86-common = " secureboot"
diff --git a/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend b/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend
new file mode 100644
index 00000000..b5a5fdd4
--- /dev/null
+++ b/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend
@@ -0,0 +1 @@
+RDEPENDS:${PN} += "${@bb.utils.contains('ICXSDK', '1', ' intel-oneapi-dpcpp-cpp intel-oneapi-dpcpp-cpp-dev intel-oneapi-dpcpp-cpp-runtime intel-oneapi-dpcpp-cpp-runtime-dev ', '', d)}"
diff --git a/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bbappend b/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bbappend
new file mode 100644
index 00000000..608ea3d3
--- /dev/null
+++ b/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bbappend
@@ -0,0 +1 @@
+RRECOMMENDS:${PN}:append:intel-x86-common = "${@bb.utils.contains('ICXSDK', '1', ' intel-oneapi-dpcpp-cpp intel-oneapi-dpcpp-cpp-dev intel-oneapi-dpcpp-cpp-runtime intel-oneapi-dpcpp-cpp-runtime-dev ', '', d)}"
diff --git a/recipes-core/zlib/zlib-intel_1.2.11.1.jtkv6.3.bb b/recipes-core/zlib/zlib-intel_1.2.11.1.jtkv6.3.bb
deleted file mode 100644
index 65303bff..00000000
--- a/recipes-core/zlib/zlib-intel_1.2.11.1.jtkv6.3.bb
+++ /dev/null
@@ -1,18 +0,0 @@
-require recipes-core/zlib/zlib_1.2.11.bb
-
-FILESEXTRAPATHS_append = ":${COREBASE}/meta/recipes-core/zlib/zlib"
-
-SUMMARY = "Zlib Compression Library (Intel-tuned)"
-
-PROVIDES = "zlib"
-
-SRC_URI_remove = "${SOURCEFORGE_MIRROR}/libpng/${BPN}/${PV}/${BPN}-${PV}.tar.xz"
-SRC_URI_prepend = "git://github.com/jtkukunas/zlib.git;protocol=git "
-
-SRCREV = "a43a247bfa16ec5368747b5b64f11ea5ca033010"
-S = "${WORKDIR}/git"
-
-RPROVIDES_${PN} += "zlib"
-RPROVIDES_${PN}-ptest += "zlib-ptest"
-
-UPSTREAM_CHECK_GITTAGREGEX = "^v(?P<pver>(\d+(\.\d+)+)_jtkv(\d+(\.\d+)+))$"
diff --git a/recipes-devtools/slimboot/slimboot-tools_git.bb b/recipes-devtools/slimboot/slimboot-tools_git.bb
index 7d8b66be..b65b182d 100644
--- a/recipes-devtools/slimboot/slimboot-tools_git.bb
+++ b/recipes-devtools/slimboot/slimboot-tools_git.bb
@@ -4,11 +4,11 @@ binary file format understood by Slim Bootloader to load and initialize\
Operating Systems or Hypervisors."
HOMEPAGE = "https://slimbootloader.github.io/tools/index.html"
-SRC_URI = "git://github.com/slimbootloader/slimbootloader;protocol=https"
-SRCREV = "9f146afd47e0ca204521826a583d55388850b216"
+SRC_URI = "git://github.com/slimbootloader/slimbootloader;protocol=https;branch=master"
+SRCREV = "df5bd0bc2a522afcb8945a6797592b04838db753"
PV = "0.0.0+git${SRCPV}"
LICENSE = "BSD-2-Clause-Patent"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=d1ed89007e7aa232a4dc1c59b6c9efc4"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=ef7fba7be2819ac13aaf5d0f842ce5d9"
S = "${WORKDIR}/git"
inherit python3native
diff --git a/recipes-graphics/gmmlib/files/0001-Add-new-DG2-device-IDs-194.patch b/recipes-graphics/gmmlib/files/0001-Add-new-DG2-device-IDs-194.patch
new file mode 100644
index 00000000..195b3c58
--- /dev/null
+++ b/recipes-graphics/gmmlib/files/0001-Add-new-DG2-device-IDs-194.patch
@@ -0,0 +1,34 @@
+From 683f3552e7d5089601bb37952641b1c7691cf475 Mon Sep 17 00:00:00 2001
+From: John Machado <john.machado@intel.com>
+Date: Mon, 25 Mar 2024 11:13:27 +0530
+Subject: [PATCH] Add new DG2 device IDs (#194)
+
+Upstream-Status: Backport [https://github.com/intel/gmmlib/commit/dcc4b85ea3728c848b62fbb164c00f43b519b6fb]
+
+Signed-off-by: Hoe, Sheng Yang <sheng.yang.hoe@intel.com>
+---
+ Source/inc/common/igfxfmid.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/Source/inc/common/igfxfmid.h b/Source/inc/common/igfxfmid.h
+index 1264087..e944e1e 100644
+--- a/Source/inc/common/igfxfmid.h
++++ b/Source/inc/common/igfxfmid.h
+@@ -1934,6 +1934,8 @@ typedef enum __NATIVEGTTYPE
+ #define DEV_ID_56BB 0x56BB
+ #define DEV_ID_56BC 0x56BC
+ #define DEV_ID_56BD 0x56BD
++#define DEV_ID_56BE 0x56BE
++#define DEV_ID_56BF 0x56BF
+ #define DEV_ID_56C0 0x56C0
+ #define DEV_ID_56C1 0x56C1
+ #define DEV_ID_56C2 0x56C2
+@@ -2001,6 +2003,8 @@ typedef enum __NATIVEGTTYPE
+ ( d == DEV_ID_5690 ) || \
+ ( d == DEV_ID_5691 ) || \
+ ( d == DEV_ID_5692 ) || \
++ ( d == DEV_ID_56BE ) || \
++ ( d == DEV_ID_56BF ) || \
+ ( d == DEV_ID_56C0 ) || \
+ ( d == DEV_ID_56C2 ) || \
+ ( d == DEV_ID_4F80 ) || \
diff --git a/recipes-graphics/gmmlib/gmmlib_21.1.1.bb b/recipes-graphics/gmmlib/gmmlib_22.3.18.bb
index f5de0ef5..134a6461 100644
--- a/recipes-graphics/gmmlib/gmmlib_21.1.1.bb
+++ b/recipes-graphics/gmmlib/gmmlib_22.3.18.bb
@@ -4,17 +4,18 @@ device specific and buffer management for the Intel(R) Graphics \
Compute Runtime for OpenCL(TM) and the Intel(R) Media Driver for VAAPI."
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://LICENSE.md;md5=d9a6e772cd4c362ee4c8ef87c5aad843"
+LIC_FILES_CHKSUM = "file://LICENSE.md;md5=465fe90caea3edd6a2cecb3f0c28a654"
SRC_URI = " \
- git://github.com/intel/gmmlib.git;protocol=https \
+ git://github.com/intel/gmmlib.git;protocol=https;branch=master \
+ file://0001-Add-new-DG2-device-IDs-194.patch \
"
-SRCREV = "60a77187c43ff23a0888b2f297ae5c93cc50a666"
+SRCREV = "ac964bdffdda7730e8234511f61016071e63783b"
S = "${WORKDIR}/git"
-COMPATIBLE_HOST_x86-x32 = "null"
+COMPATIBLE_HOST:x86-x32 = "null"
UPSTREAM_CHECK_GITTAGREGEX = "^intel-gmmlib-(?P<pver>(\d+(\.\d+)+))$"
diff --git a/recipes-graphics/hdcp/hdcp/0001-main-fix-hdcpd-service-failure.patch b/recipes-graphics/hdcp/hdcp/0001-main-fix-hdcpd-service-failure.patch
index f07d466f..6d32da43 100644
--- a/recipes-graphics/hdcp/hdcp/0001-main-fix-hdcpd-service-failure.patch
+++ b/recipes-graphics/hdcp/hdcp/0001-main-fix-hdcpd-service-failure.patch
@@ -9,7 +9,7 @@ exits, which causing hdcpd service failure.
Added wait function to block parent process
until child process exits.
-Upstream-Status: Submitted[https://github.com/intel/hdcp/pull/17]
+Upstream-Status: Submitted [https://github.com/intel/hdcp/pull/17]
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
---
diff --git a/recipes-graphics/hdcp/hdcp_21.1.0.bb b/recipes-graphics/hdcp/hdcp_21.2.0.bb
index 016e8e0a..8529b5ab 100644
--- a/recipes-graphics/hdcp/hdcp_21.1.0.bb
+++ b/recipes-graphics/hdcp/hdcp_21.2.0.bb
@@ -9,7 +9,7 @@ SECTION = "lib"
inherit pkgconfig cmake useradd systemd features_check
-SRC_URI = "git://github.com/intel/hdcp.git \
+SRC_URI = "git://github.com/intel/hdcp.git;branch=master;protocol=https \
file://0001-main-fix-hdcpd-service-failure.patch \
"
SRCREV = "cacc352159c5bdaf1c21846cecdd1eb7b031e1d3"
@@ -20,7 +20,7 @@ REQUIRED_DISTRO_FEATURES = "systemd"
DEPENDS = "libdrm virtual/mesa systemd"
USERADD_PACKAGES = "${PN}"
-USERADD_PARAM_${PN} = "--system --no-create-home --shell /bin/false --gid nogroup media"
+USERADD_PARAM:${PN} = "--system --no-create-home --shell /bin/false --gid nogroup media"
-SYSTEMD_SERVICE_${PN} = "hdcpd.service"
+SYSTEMD_SERVICE:${PN} = "hdcpd.service"
SYSTEMD_AUTO_ENABLE = "disable"
diff --git a/recipes-graphics/libva/libva-intel-utils_2.11.1.bb b/recipes-graphics/libva/libva-intel-utils_2.21.0.bb
index f9bea364..0407aa18 100644
--- a/recipes-graphics/libva/libva-intel-utils_2.11.1.bb
+++ b/recipes-graphics/libva/libva-intel-utils_2.21.0.bb
@@ -14,8 +14,8 @@ SECTION = "x11"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://COPYING;md5=b148fc8adf19dc9aec17cf9cd29a9a5e"
-SRC_URI = "git://github.com/intel/libva-utils.git;branch=v2.11-branch"
-SRCREV = "959b2f20cf99d4611eab66164af3d7e4a84f674b"
+SRC_URI = "git://github.com/intel/libva-utils.git;branch=v2.21-branch;protocol=https"
+SRCREV = "5a59217d5d288f7671ca18d3764139289d83a93e"
S = "${WORKDIR}/git"
UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+(\.\d+)+))"
@@ -32,4 +32,4 @@ PACKAGECONFIG[x11] = "-Dx11=true, -Dx11=false,virtual/libx11 libxext libxfixes"
PACKAGECONFIG[wayland] = "-Dwayland=true, -Dwayland=false,wayland-native wayland"
PROVIDES = "libva-utils"
-RPROVIDES_${PN} += "libva-utils"
+RPROVIDES:${PN} += "libva-utils"
diff --git a/recipes-graphics/libva/libva-intel_2.11.0.bb b/recipes-graphics/libva/libva-intel_2.21.0.bb
index 406f6f68..83fb3646 100644
--- a/recipes-graphics/libva/libva-intel_2.11.0.bb
+++ b/recipes-graphics/libva/libva-intel_2.21.0.bb
@@ -17,10 +17,12 @@ SECTION = "x11"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://COPYING;md5=2e48940f94acb0af582e5ef03537800f"
-SRC_URI = "https://github.com/intel/libva/releases/download/${PV}/libva-${PV}.tar.bz2"
-SRC_URI[sha256sum] = "6e361117038b571ad4741d38c9280db8c140b17e76e8c01fc7a4d608d3ed7d5d"
+SRC_URI = "git://github.com/intel/libva.git;protocol=https;branch=v2.21-branch \
+ "
-S = "${WORKDIR}/libva-${PV}"
+SRCREV = "0b01aed44ef1a6ad660261284ff266fa812829ef"
+
+S = "${WORKDIR}/git"
UPSTREAM_CHECK_URI = "https://github.com/intel/libva/releases"
@@ -40,15 +42,15 @@ PACKAGECONFIG[wayland] = "-Dwith_wayland=yes,-Dwith_wayland=no,wayland-native wa
PACKAGES =+ "${PN}-x11 ${PN}-glx ${PN}-wayland"
-RDEPENDS_${PN}-x11 =+ "${PN}"
-RDEPENDS_${PN}-glx =+ "${PN}-x11"
+RDEPENDS:${PN}-x11 =+ "${PN}"
+RDEPENDS:${PN}-glx =+ "${PN}-x11"
-FILES_${PN}-x11 =+ "${libdir}/libva-x11*${SOLIBS}"
-FILES_${PN}-glx =+ "${libdir}/libva-glx*${SOLIBS}"
-FILES_${PN}-wayland =+ "${libdir}/libva-wayland*${SOLIBS}"
+FILES:${PN}-x11 =+ "${libdir}/libva-x11*${SOLIBS}"
+FILES:${PN}-glx =+ "${libdir}/libva-glx*${SOLIBS}"
+FILES:${PN}-wayland =+ "${libdir}/libva-wayland*${SOLIBS}"
PROVIDES += "libva"
-RPROVIDES_${PN} += "libva"
-RPROVIDES_${PN}-x11 += "libva-x11"
-RPROVIDES_${PN}-glx += "libva-glx"
-RPROVIDES_${PN}-wayland += "libva-wayland"
+RPROVIDES:${PN} += "libva"
+RPROVIDES:${PN}-x11 += "libva-x11"
+RPROVIDES:${PN}-glx += "libva-glx"
+RPROVIDES:${PN}-wayland += "libva-wayland"
diff --git a/recipes-graphics/metrics-discovery/metrics-discovery/0001-md_internal.h-Replace-string.h-with-string-C-header-.patch b/recipes-graphics/metrics-discovery/metrics-discovery/0001-md_internal.h-Replace-string.h-with-string-C-header-.patch
deleted file mode 100644
index d97c6543..00000000
--- a/recipes-graphics/metrics-discovery/metrics-discovery/0001-md_internal.h-Replace-string.h-with-string-C-header-.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 8c11096a0e5cf980309692ae3e272108da5f2b4e Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 9 Oct 2019 11:36:56 -0700
-Subject: [PATCH] md_internal.h: Replace string.h with <string> C++ header API
-
-This helps in compiling with libc++/Clang
-Fixes
-usr/include/c++/v1/type_traits:1561:38: error: implicit instantiation of undefined template 'std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >'
-: public integral_constant<bool, __is_empty(_Tp)> {};
-^
-
-Upstream-Status: Submitted [https://github.com/intel/metrics-discovery/pull/14]
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- instrumentation/metrics_discovery/common/md_internal.cpp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/instrumentation/metrics_discovery/common/md_internal.cpp b/instrumentation/metrics_discovery/common/md_internal.cpp
-index f9571ac..0767e81 100644
---- a/instrumentation/metrics_discovery/common/md_internal.cpp
-+++ b/instrumentation/metrics_discovery/common/md_internal.cpp
-@@ -27,8 +27,8 @@
- \*****************************************************************************/
- #include "md_internal.h"
-
--#include <string.h>
- #include <stdlib.h>
-+#include <string>
- #include <new>
- #include <unordered_map>
-
---
-2.23.0
-
diff --git a/recipes-graphics/metrics-discovery/metrics-discovery_1.5.108.bb b/recipes-graphics/metrics-discovery/metrics-discovery_1.12.171.bb
index da7cb652..d3f32c25 100644
--- a/recipes-graphics/metrics-discovery/metrics-discovery_1.5.108.bb
+++ b/recipes-graphics/metrics-discovery/metrics-discovery_1.12.171.bb
@@ -8,9 +8,8 @@ SECTION = "lib"
inherit pkgconfig cmake
S = "${WORKDIR}/git"
-SRCREV = "a495db4682b7318bc82b1cccfb17fafdf2e3a2ff"
-SRC_URI = "git://github.com/intel/metrics-discovery.git \
- file://0001-md_internal.h-Replace-string.h-with-string-C-header-.patch \
+SRCREV = "24c4dfd45df1600ca83dfb03217675edc4633ffd"
+SRC_URI = "git://github.com/intel/metrics-discovery.git;branch=master;protocol=https \
"
EXTRA_OECMAKE += "-DMD_PLATFORM=linux"
diff --git a/recipes-graphics/xorg-driver/xf86-video-ast_1.1.5.bb b/recipes-graphics/xorg-driver/xf86-video-ast_1.1.6.bb
index 090efd62..d7e4eab4 100644
--- a/recipes-graphics/xorg-driver/xf86-video-ast_1.1.5.bb
+++ b/recipes-graphics/xorg-driver/xf86-video-ast_1.1.6.bb
@@ -7,6 +7,6 @@ DESCRIPTION = "ast is an Xorg driver for ASpeed Technologies video cards"
LIC_FILES_CHKSUM = "file://COPYING;md5=0b8c242f0218eea5caa949b7910a774b"
DEPENDS += "libpciaccess"
+XORG_DRIVER_COMPRESSOR = ".tar.gz"
-SRC_URI[md5sum] = "4f85febe48d51e53624550a96fc9e9ee"
-SRC_URI[sha256sum] = "1edbbc55d47d3fd71dec99b15c2483e22738c642623a0fb86ef4a81a9067a2de"
+SRC_URI[sha256sum] = "eeff52178ce2916a0e07b531bb23c8b105826b6e6e6c5f7c90e33f757827a7c7"
diff --git a/recipes-kernel/intel-ethernet/ixgbe_5.11.3.bb b/recipes-kernel/intel-ethernet/ixgbe_5.19.6.bb
index 8c7fb09c..7ef38650 100644
--- a/recipes-kernel/intel-ethernet/ixgbe_5.11.3.bb
+++ b/recipes-kernel/intel-ethernet/ixgbe_5.19.6.bb
@@ -4,13 +4,13 @@ PCI Express* 10 Gigabit Network Connections."
HOMEPAGE = "https://sourceforge.net/projects/e1000/"
SECTION = "kernel/network"
-LICENSE = "GPLv2"
+LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://${WORKDIR}/${BP}/COPYING;md5=a216b4192dc6b777b6f0db560e9a8417"
SRC_URI = "https://sourceforge.net/projects/e1000/files/ixgbe%20stable/${PV}/${BP}.tar.gz \
"
-SRC_URI[sha256sum] = "b7e5de734c406d28ea146366a5cc3b58bb3b6be039977863e4e1b217a8185ae2"
+SRC_URI[sha256sum] = "a844f1fea8064e30b276792455c3b286c1d7af26731e8f865d4a4e9ed1dcf4ab"
UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/e1000/files/ixgbe%20stable/"
UPSTREAM_CHECK_REGEX = "ixgbe%20stable/(?P<pver>\d+(\.\d+)+)/"
@@ -19,14 +19,14 @@ CVE_PRODUCT = "linux:linux_kernel_ixgbe"
S = "${WORKDIR}/${BP}/src"
-EXTRA_OEMAKE='KSRC="${STAGING_KERNEL_BUILDDIR}" KVER="${KERNEL_VERSION}" INSTALL_MOD_PATH="${D}"'
+EXTRA_OEMAKE=' KSRC="${STAGING_KERNEL_DIR}" KOBJ="${STAGING_KERNEL_BUILDDIR}" KVER="${KERNEL_VERSION}" INSTALL_MOD_PATH="${D}"'
-KERNEL_MODULE_AUTOLOAD_append_intel-core2-32 = " ixgbe"
-KERNEL_MODULE_AUTOLOAD_append_intel-corei7-64 = " ixgbe"
+KERNEL_MODULE_AUTOLOAD:append:intel-core2-32 = " ixgbe"
+KERNEL_MODULE_AUTOLOAD:append:intel-corei7-64 = " ixgbe"
inherit module
-do_install_append () {
+do_install:append () {
# Install scripts/set_irq_affinity
install -d ${D}${sysconfdir}/network
install -m 0755 ${S}/../scripts/set_irq_affinity ${D}${sysconfdir}/network
@@ -36,9 +36,8 @@ do_install_append () {
PACKAGES += "${PN}-script"
-FILES_${PN}-script += "${sysconfdir}/network/set_irq_affinity"
+FILES:${PN}-script += "${sysconfdir}/network/set_irq_affinity"
EXCLUDE_FROM_WORLD = "1"
-# This was fixed in kernel v4.4
-CVE_CHECK_WHITELIST += "CVE-2015-1142857"
+CVE_STATUS[CVE-2015-1142857] = "fixed-version: Fixed from version 4.4-rc1"
diff --git a/recipes-kernel/intel-ethernet/ixgbevf_4.11.1.bb b/recipes-kernel/intel-ethernet/ixgbevf_4.18.7.bb
index 2867269a..b21796c6 100644
--- a/recipes-kernel/intel-ethernet/ixgbevf_4.11.1.bb
+++ b/recipes-kernel/intel-ethernet/ixgbevf_4.18.7.bb
@@ -7,13 +7,13 @@ The guest OS loading this driver must support MSI-X interrupts."
HOMEPAGE = "https://sourceforge.net/projects/e1000/"
SECTION = "kernel/network"
-LICENSE = "GPLv2"
+LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://${WORKDIR}/${BP}/COPYING;md5=a216b4192dc6b777b6f0db560e9a8417"
SRC_URI = "https://sourceforge.net/projects/e1000/files/ixgbevf%20stable/${PV}/${BP}.tar.gz \
"
-SRC_URI[sha256sum] = "0031d09a54af9ecf1216c185e4641e38527643afa09e78d1bd95752e49fe8985"
+SRC_URI[sha256sum] = "90f6cd614008839b6fc748ae0f4ad3503435f8b788318d4f40cfc83c7029025e"
UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/e1000/files/ixgbevf%20stable/"
UPSTREAM_CHECK_REGEX = "ixgbevf%20stable/(?P<pver>\d+(\.\d+)+)/"
@@ -22,14 +22,14 @@ CVE_PRODUCT = "linux:linux_kernel_ixgbe"
S = "${WORKDIR}/${BP}/src"
-EXTRA_OEMAKE='KSRC="${STAGING_KERNEL_BUILDDIR}" KVER="${KERNEL_VERSION}" INSTALL_MOD_PATH="${D}"'
+EXTRA_OEMAKE='KSRC="${STAGING_KERNEL_DIR}" KOBJ="${STAGING_KERNEL_BUILDDIR}" KVER="${KERNEL_VERSION}" INSTALL_MOD_PATH="${D}"'
-KERNEL_MODULE_AUTOLOAD_append_intel-core2-32 = " ixgbevf"
-KERNEL_MODULE_AUTOLOAD_append_intel-corei7-64 = " ixgbevf"
+KERNEL_MODULE_AUTOLOAD:append:intel-core2-32 = " ixgbevf"
+KERNEL_MODULE_AUTOLOAD:append:intel-corei7-64 = " ixgbevf"
inherit module
-do_install_append () {
+do_install:append () {
# Install scripts/set_irq_affinity
install -d ${D}${sysconfdir}/network
install -m 0755 ${S}/../scripts/set_irq_affinity ${D}${sysconfdir}/network
@@ -39,7 +39,8 @@ do_install_append () {
PACKAGES += "${PN}-script"
-FILES_${PN}-script += "${sysconfdir}/network/set_irq_affinity"
+FILES:${PN}-script += "${sysconfdir}/network/set_irq_affinity"
-# This was fixed in kernel v4.4
-CVE_CHECK_WHITELIST += "CVE-2015-1142857"
+CVE_STATUS[CVE-2015-1142857] = "fixed-version: Fixed from version 4.4-rc1"
+
+EXCLUDE_FROM_WORLD = "1"
diff --git a/recipes-kernel/iwlwifi/backport-iwlwifi_git.bb b/recipes-kernel/iwlwifi/backport-iwlwifi_git.bb
index 9eb0a45d..ea36cfc3 100644
--- a/recipes-kernel/iwlwifi/backport-iwlwifi_git.bb
+++ b/recipes-kernel/iwlwifi/backport-iwlwifi_git.bb
@@ -1,13 +1,13 @@
SUMMARY = "Intel Wireless LinuxCore kernel driver"
DESCRIPTION = "Intel Wireless LinuxCore kernel driver"
SECTION = "kernel"
-LICENSE = "GPL-2.0"
+LICENSE = "GPL-2.0-only"
REQUIRED_DISTRO_FEATURES = "wifi"
-LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
+LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
-inherit module
+inherit module features_check
# For some iwfwifi LinuxCore supported wireless chips, the best/latest
# firmware blobs are found in the iwlwifi's linux-firmware.git fork.
@@ -17,8 +17,8 @@ inherit module
# When updating this recipe, ensure that the proper firmware is included from
# either the linux-firmware or iwlwifi-firmware repos.
-PV = "45"
-SRCREV = "a75c1de6b3fa87885556c67619429cfa87cc048f"
+PV = "79"
+SRCREV = "574631d89d736fd2c76b0e2ea489270c50903e52"
SRC_URI = " \
git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/backport-iwlwifi;branch=release/core${PV} \
@@ -36,16 +36,18 @@ do_configure() {
MODULES_INSTALL_TARGET="install"
-do_install_append() {
+do_install:append() {
## install configs and service scripts
install -d ${D}${sysconfdir}/modprobe.d
install -m 0644 ${WORKDIR}/iwlwifi.conf ${D}${sysconfdir}/modprobe.d
}
-RDEPENDS_${PN} = "linux-firmware-iwlwifi"
+RDEPENDS:${PN} = "linux-firmware-iwlwifi"
-KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " iwlwifi"
-KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " iwlwifi"
+FILES:${PN} += "${sysconfdir}/modprobe.d/iwlwifi.conf"
+
+KERNEL_MODULE_AUTOLOAD:append:core2-32-intel-common = " iwlwifi"
+KERNEL_MODULE_AUTOLOAD:append:corei7-64-intel-common = " iwlwifi"
KERNEL_MODULE_PACKAGE_PREFIX = "backport-iwlwifi"
diff --git a/recipes-kernel/linux/linux-intel-dev.bb b/recipes-kernel/linux/linux-intel-dev.bb
deleted file mode 100644
index 9cabe7b9..00000000
--- a/recipes-kernel/linux/linux-intel-dev.bb
+++ /dev/null
@@ -1,34 +0,0 @@
-require recipes-kernel/linux/linux-yocto.inc
-require recipes-kernel/linux/meta-intel-compat-kernel.inc
-
-FILESEXTRAPATHS_prepend := "${THISDIR}/linux-intel:"
-
-SRC_URI = " \
- git://github.com/intel/mainline-tracking.git;protocol=https;name=machine;nobranch=1; \
- git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=${KMETA_BRANCH};destsuffix=${KMETA} \
- file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch \
- "
-SRC_URI_append_core2-32-intel-common = " file://disable_skylake_sound.cfg"
-
-KMETA = "kernel-meta"
-KCONF_BSP_AUDIT_LEVEL = "2"
-
-KMETA_BRANCH = "master"
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
-
-DEPENDS += "elfutils-native openssl-native util-linux-native"
-
-LINUX_VERSION ?= "5.12.0"
-SRCREV_machine ?= "9f4ad9e425a1d3b6a34617b8ea226d56a119a717"
-SRCREV_meta ?= "99570241ac88d6c7e32b6fccd83afce53816b275"
-
-LINUX_VERSION_EXTENSION ?= "-mainline-tracking-${LINUX_KERNEL_TYPE}"
-PV = "${LINUX_VERSION}+git${SRCPV}"
-
-COMPATIBLE_MACHINE ?= "(intel-corei7-64|intel-core2-32)"
-
-# Functionality flags
-KERNEL_FEATURES_append = " ${KERNEL_EXTRA_FEATURES}"
-KERNEL_FEATURES_append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "" ,d)}"
-KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/security/security.scc"
diff --git a/recipes-kernel/linux/linux-intel-rt_5.10.bb b/recipes-kernel/linux/linux-intel-rt_5.10.bb
deleted file mode 100644
index 361b5dfc..00000000
--- a/recipes-kernel/linux/linux-intel-rt_5.10.bb
+++ /dev/null
@@ -1,35 +0,0 @@
-require linux-intel.inc
-
-# Skip processing of this recipe if it is not explicitly specified as the
-# PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying
-# to build multiple virtual/kernel providers, e.g. as dependency of
-# core-image-rt-sdk, core-image-rt.
-python () {
- if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-intel-rt":
- raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-intel-rt to enable it")
-}
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
-SRC_URI_append = " file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch \
- "
-
-KBRANCH = "5.10/preempt-rt"
-KMETA_BRANCH = "yocto-5.10"
-
-DEPENDS += "elfutils-native openssl-native util-linux-native"
-
-LINUX_VERSION ?= "5.10.30"
-SRCREV_machine ?= "8b07bfbd844f73cbedc1f8eaa63e8b79295745d8"
-SRCREV_meta ?= "cd049697e9b2d3e9118110d476075ff8f87202cc"
-
-LINUX_KERNEL_TYPE = "preempt-rt"
-
-# Following commit is backported from mainline 5.12-rc to linux-intel 5.10 kernel
-# Commit: https://github.com/torvalds/linux/commit/26499e0518a77de29e7db2c53fb0d0e9e15be8fb
-# In which 'CONFIG_DRM_GMA3600' config option is dropped.
-# This causes warning during config audit. So suppress the harmless warning for now.
-KCONF_BSP_AUDIT_LEVEL = "0"
-
-# Disabling CONFIG_SND_SOC_INTEL_SKYLAKE for 32-bit, does not allow to set CONFIG_SND_SOC_INTEL_SST too, which
-# causes config warning too.
-KCONF_AUDIT_LEVEL_core2-32-intel-common = "0"
diff --git a/recipes-kernel/linux/linux-intel-rt_5.4.bb b/recipes-kernel/linux/linux-intel-rt_5.4.bb
deleted file mode 100644
index 2ec2a002..00000000
--- a/recipes-kernel/linux/linux-intel-rt_5.4.bb
+++ /dev/null
@@ -1,30 +0,0 @@
-require linux-intel.inc
-
-# Skip processing of this recipe if it is not explicitly specified as the
-# PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying
-# to build multiple virtual/kernel providers, e.g. as dependency of
-# core-image-rt-sdk, core-image-rt.
-python () {
- if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-intel-rt":
- raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-intel-rt to enable it")
-}
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
-SRC_URI_append = " file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch \
-"
-
-KBRANCH = "5.4/preempt-rt"
-KMETA_BRANCH = "yocto-5.4"
-
-DEPENDS += "elfutils-native openssl-native util-linux-native"
-
-LINUX_VERSION ?= "5.4.115"
-SRCREV_machine ?= "00c7e2e1841e0ed3c1249c0e4bcacbd70435d62e"
-SRCREV_meta ?= "9e2546ab8d63f70ba458eb159d29ce6736ffd3e4"
-
-LINUX_KERNEL_TYPE = "preempt-rt"
-
-# Kernel config 'CONFIG_GPIO_LYNXPOINT' goes by a different name 'CONFIG_PINCTRL_LYNXPOINT' in
-# linux-intel 5.4 specifically. This cause annoying warning during kernel config audit. So suppress the
-# harmless warning for now.
-KCONF_BSP_AUDIT_LEVEL = "0"
diff --git a/recipes-kernel/linux/linux-intel-rt_6.6.bb b/recipes-kernel/linux/linux-intel-rt_6.6.bb
new file mode 100644
index 00000000..342679eb
--- /dev/null
+++ b/recipes-kernel/linux/linux-intel-rt_6.6.bb
@@ -0,0 +1,33 @@
+require linux-intel.inc
+
+SRC_URI:prepend = "git://github.com/intel/linux-intel-lts.git;protocol=https;name=machine;branch=${KBRANCH}; \
+ "
+
+# Skip processing of this recipe if it is not explicitly specified as the
+# PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying
+# to build multiple virtual/kernel providers, e.g. as dependency of
+# core-image-rt-sdk, core-image-rt.
+python () {
+ if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-intel-rt":
+ raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-intel-rt to enable it")
+}
+
+KBRANCH = "6.6/preempt-rt"
+KMETA_BRANCH = "yocto-6.6"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
+
+DEPENDS += "elfutils-native openssl-native util-linux-native"
+
+LINUX_VERSION_EXTENSION ??= "-intel-pk-${LINUX_KERNEL_TYPE}"
+
+LINUX_VERSION ?= "6.6.25"
+SRCREV_machine ?= "f8939454cf9bb7277239bb44e90c99474c599f37"
+SRCREV_meta ?= "c3d1322fb6ff68cdcf4d7a3c1140d81bfdc1320a"
+
+LINUX_KERNEL_TYPE = "preempt-rt"
+
+# Functionality flags
+KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/security/security.scc"
+
+UPSTREAM_CHECK_GITTAGREGEX = "^lts-(?P<pver>v6.6.(\d+)-rt(\d)-preempt-rt-(\d+)T(\d+)Z)$"
diff --git a/recipes-kernel/linux/linux-intel.inc b/recipes-kernel/linux/linux-intel.inc
index c6163973..f78f5205 100644
--- a/recipes-kernel/linux/linux-intel.inc
+++ b/recipes-kernel/linux/linux-intel.inc
@@ -1,26 +1,24 @@
require recipes-kernel/linux/linux-yocto.inc
require recipes-kernel/linux/meta-intel-compat-kernel.inc
-FILESEXTRAPATHS_prepend := "${THISDIR}/linux-intel:"
+FILESEXTRAPATHS:prepend := "${THISDIR}/linux-intel:"
KERNEL_CONFIG_URI ?= "git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=${KMETA_BRANCH};destsuffix=${KMETA}"
SRC_URI = " \
- git://github.com/intel/linux-intel-lts.git;protocol=https;name=machine;branch=${KBRANCH}; \
${KERNEL_CONFIG_URI} \
+ file://0001-vt-conmakehash-improve-reproducibility.patch \
+ file://0001-lib-build_OID_registry-fix-reproducibility-issues.patch \
+ file://fix-perf-reproducibility.patch \
+ file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch \
+ file://0002-mconf-fix-output-of-cflags-and-libraries.patch \
"
-SRC_URI_append = " file://enable_lynxpoint_gpio.cfg"
-SRC_URI_append_core2-32-intel-common = " file://disable_skylake_sound.cfg"
-
-LINUX_VERSION_EXTENSION ??= "-intel-pk-${LINUX_KERNEL_TYPE}"
-
PV = "${LINUX_VERSION}+git${SRCPV}"
KMETA = "kernel-meta"
-KCONF_BSP_AUDIT_LEVEL = "2"
+KCONF_BSP_AUDIT_LEVEL = "0"
-COMPATIBLE_MACHINE ?= "(intel-corei7-64|intel-core2-32)"
+COMPATIBLE_MACHINE ?= "(intel-corei7-64)"
-KERNEL_FEATURES_append = " ${KERNEL_EXTRA_FEATURES}"
-KERNEL_FEATURES_append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "" ,d)}"
+KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}"
diff --git a/recipes-kernel/linux/linux-intel/0001-lib-build_OID_registry-fix-reproducibility-issues.patch b/recipes-kernel/linux/linux-intel/0001-lib-build_OID_registry-fix-reproducibility-issues.patch
new file mode 100644
index 00000000..d41c3f0b
--- /dev/null
+++ b/recipes-kernel/linux/linux-intel/0001-lib-build_OID_registry-fix-reproducibility-issues.patch
@@ -0,0 +1,48 @@
+From 2fca0fd719812ea2ff67630b01355aa80481623e Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@gmail.com>
+Date: Sun, 10 Jul 2022 22:56:53 -0400
+Subject: [PATCH] lib/build_OID_registry: fix reproducibility issues
+
+The script build_OID_registry captures the full path of itself
+in the generated data. This causes reproduciblity issues as the
+path is captured and packaged.
+
+We use the basename of the script instead, and that allows us
+to be reprodicible, with slightly less information captured in
+the output data (but the generating script can still easily
+be found).
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
+Upstream-Status: Inappropriate
+
+Taken from linux-yocto, v5.15/standard/base.
+
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+---
+ lib/build_OID_registry | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/lib/build_OID_registry b/lib/build_OID_registry
+index d7fc32ea8ac2..f6de0a7f7457 100755
+--- a/lib/build_OID_registry
++++ b/lib/build_OID_registry
+@@ -8,6 +8,7 @@
+ #
+
+ use strict;
++use File::Basename;
+
+ my @names = ();
+ my @oids = ();
+@@ -35,7 +36,7 @@ close IN_FILE || die;
+ #
+ open C_FILE, ">$ARGV[1]" or die;
+ print C_FILE "/*\n";
+-print C_FILE " * Automatically generated by ", $0, ". Do not edit\n";
++print C_FILE " * Automatically generated by ", basename $0, ". Do not edit\n";
+ print C_FILE " */\n";
+
+ #
+--
+2.36.1
+
diff --git a/recipes-kernel/linux/linux-intel/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch b/recipes-kernel/linux/linux-intel/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch
index 3dc71ff2..a601e783 100644
--- a/recipes-kernel/linux/linux-intel/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch
+++ b/recipes-kernel/linux/linux-intel/0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch
@@ -1,7 +1,8 @@
-From bebd63730a433ba62549a80114a9851328aa8897 Mon Sep 17 00:00:00 2001
+From 1811da09f42ca5e82282970e8ad014707bc94c82 Mon Sep 17 00:00:00 2001
From: Bruce Ashfield <bruce.ashfield@windriver.com>
Date: Mon, 2 Jul 2018 23:10:28 -0400
-Subject: [PATCH] menuconfig,mconf-cfg: Allow specification of ncurses location
+Subject: [PATCH 1/2] menuconfig,mconf-cfg: Allow specification of ncurses
+ location
In some cross build environments such as the Yocto Project build
environment it provides an ncurses library that is compiled
@@ -16,33 +17,36 @@ check-lxdialog.sh for environments such as the Yocto Project. Adding
a CROSS_CURSES_LIB and CROSS_CURSES_INC solves the issue and allowing
compiling and linking against the right headers and libraries.
+Upstream-Status: Submitted
+
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
cc: Michal Marek <mmarek@suse.cz>
cc: linux-kbuild@vger.kernel.org
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
+Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
---
scripts/kconfig/mconf-cfg.sh | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/scripts/kconfig/mconf-cfg.sh b/scripts/kconfig/mconf-cfg.sh
-index c812872d7f9d..42d20819025c 100755
+index 1e61f50a5905..38cf8304bb31 100755
--- a/scripts/kconfig/mconf-cfg.sh
+++ b/scripts/kconfig/mconf-cfg.sh
-@@ -4,6 +4,14 @@
+@@ -7,6 +7,14 @@ libs=$2
PKG="ncursesw"
PKG2="ncurses"
+if [ "$CROSS_CURSES_LIB" != "" ]; then
-+ echo libs=\'$CROSS_CURSES_LIB\'
-+ if [ x"$CROSS_CURSES_INC" != x ]; then
-+ echo cflags=\'$CROSS_CURSES_INC\'
-+ fi
-+ exit 0
++ echo libs=\'$CROSS_CURSES_LIB\'
++ if [ x"$CROSS_CURSES_INC" != x ]; then
++ echo cflags=\'$CROSS_CURSES_INC\'
++ fi
++ exit 0
+fi
+
- if [ -n "$(command -v pkg-config)" ]; then
- if pkg-config --exists $PKG; then
- echo cflags=\"$(pkg-config --cflags $PKG)\"
+ if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then
+ if ${HOSTPKG_CONFIG} --exists $PKG; then
+ ${HOSTPKG_CONFIG} --cflags ${PKG} > ${cflags}
--
-2.17.1
+2.34.1
diff --git a/recipes-kernel/linux/linux-intel/0001-vt-conmakehash-improve-reproducibility.patch b/recipes-kernel/linux/linux-intel/0001-vt-conmakehash-improve-reproducibility.patch
new file mode 100644
index 00000000..33280063
--- /dev/null
+++ b/recipes-kernel/linux/linux-intel/0001-vt-conmakehash-improve-reproducibility.patch
@@ -0,0 +1,58 @@
+From 0f586f4ee8adacac79b64d1f3d47799a5eb7fbea Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@gmail.com>
+Date: Sun, 10 Jul 2022 21:37:07 -0400
+Subject: [PATCH] vt/conmakehash: improve reproducibility
+
+The file generated by conmakehash capture the application
+path used to generate the file. While that can be informative,
+it varies based on where the kernel was built, as the full
+path is captured.
+
+We tweak the application to use a second input as the "capture
+name", and then modify the Makefile to pass the basename of
+the source, making it reproducible.
+
+This could be improved by using some sort of path mapping,
+or the application manipualing argv[1] itself, but for now
+this solves the reprodicibility issue.
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
+
+Upstream-Status: Inappropriate
+
+Taken from linux-yocto, v5.15/standard/base
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+---
+ drivers/tty/vt/Makefile | 2 +-
+ drivers/tty/vt/conmakehash.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/tty/vt/Makefile b/drivers/tty/vt/Makefile
+index fe30ce512819..cb51c21b58f9 100644
+--- a/drivers/tty/vt/Makefile
++++ b/drivers/tty/vt/Makefile
+@@ -15,7 +15,7 @@ clean-files := consolemap_deftbl.c defkeymap.c
+ hostprogs += conmakehash
+
+ quiet_cmd_conmk = CONMK $@
+- cmd_conmk = $(obj)/conmakehash $< > $@
++ cmd_conmk = $(obj)/conmakehash $< $(shell basename $<) > $@
+
+ $(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE) $(obj)/conmakehash
+ $(call cmd,conmk)
+diff --git a/drivers/tty/vt/conmakehash.c b/drivers/tty/vt/conmakehash.c
+index cddd789fe46e..d62510b280e9 100644
+--- a/drivers/tty/vt/conmakehash.c
++++ b/drivers/tty/vt/conmakehash.c
+@@ -253,7 +253,7 @@ int main(int argc, char *argv[])
+ #include <linux/types.h>\n\
+ \n\
+ u8 dfont_unicount[%d] = \n\
+-{\n\t", argv[1], fontlen);
++{\n\t", argv[2], fontlen);
+
+ for ( i = 0 ; i < fontlen ; i++ )
+ {
+--
+2.36.1
+
diff --git a/recipes-kernel/linux/linux-intel/0002-mconf-fix-output-of-cflags-and-libraries.patch b/recipes-kernel/linux/linux-intel/0002-mconf-fix-output-of-cflags-and-libraries.patch
new file mode 100644
index 00000000..a96b68d9
--- /dev/null
+++ b/recipes-kernel/linux/linux-intel/0002-mconf-fix-output-of-cflags-and-libraries.patch
@@ -0,0 +1,40 @@
+From 1b53d82a8152843afcddd7f16b0c43b6b4f22895 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@gmail.com>
+Date: Mon, 17 Jul 2023 17:17:55 -0400
+Subject: [PATCH 2/2] mconf: fix output of cflags and libraries
+
+commit 3122c84409d578a5df8bcb1 [kconfig: refactor Makefile to reduce
+process forks] changes the way that flags are detected. They are
+no longer just echo'd and captured, they are written to a file and
+later read.
+
+We adjust our CROSS ncurses patch accordingly.
+
+We'll eventually be able to drop this patch, but not quite yet.
+
+Upstream-Status: Inappropriate [OE-Specific]
+Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
+Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
+---
+ scripts/kconfig/mconf-cfg.sh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/scripts/kconfig/mconf-cfg.sh b/scripts/kconfig/mconf-cfg.sh
+index 38cf8304bb31..a5ae56e08b07 100755
+--- a/scripts/kconfig/mconf-cfg.sh
++++ b/scripts/kconfig/mconf-cfg.sh
+@@ -8,9 +8,9 @@ PKG="ncursesw"
+ PKG2="ncurses"
+
+ if [ "$CROSS_CURSES_LIB" != "" ]; then
+- echo libs=\'$CROSS_CURSES_LIB\'
++ echo $CROSS_CURSES_LIB > ${libs}
+ if [ x"$CROSS_CURSES_INC" != x ]; then
+- echo cflags=\'$CROSS_CURSES_INC\'
++ echo $CROSS_CURSES_INC > ${cflags}
+ fi
+ exit 0
+ fi
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-intel/disable_skylake_sound.cfg b/recipes-kernel/linux/linux-intel/disable_skylake_sound.cfg
deleted file mode 100644
index 312bcb1a..00000000
--- a/recipes-kernel/linux/linux-intel/disable_skylake_sound.cfg
+++ /dev/null
@@ -1,7 +0,0 @@
-# CONFIG_SND_SOC_INTEL_SKYLAKE is not set
-# CONFIG_SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH is not set
-# CONFIG_SND_SOC_INTEL_BXT_RT298_MACH is not set
-# CONFIG_SND_SOC_INTEL_KBL_RT5663_MAX98927_MACH is not set
-# CONFIG_SND_SOC_INTEL_SKL_RT286_MACH is not set
-# CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH is not set
-# CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH is not set
diff --git a/recipes-kernel/linux/linux-intel/enable_lynxpoint_gpio.cfg b/recipes-kernel/linux/linux-intel/enable_lynxpoint_gpio.cfg
deleted file mode 100644
index 49e70e67..00000000
--- a/recipes-kernel/linux/linux-intel/enable_lynxpoint_gpio.cfg
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_PINCTRL_LYNXPOINT=m
diff --git a/recipes-kernel/linux/linux-intel/fix-perf-reproducibility.patch b/recipes-kernel/linux/linux-intel/fix-perf-reproducibility.patch
new file mode 100644
index 00000000..1a98b1db
--- /dev/null
+++ b/recipes-kernel/linux/linux-intel/fix-perf-reproducibility.patch
@@ -0,0 +1,39 @@
+From b8cd0e429bf75b673c438a8277d4bc74327df992 Mon Sep 17 00:00:00 2001
+From: Tom Zanussi <tom.zanussi@intel.com>
+Date: Tue, 3 Jul 2012 13:07:23 -0500
+Subject: perf: change --root to --prefix for python install
+
+Otherwise we get the sysroot path appended to the build path, not what
+we want.
+
+Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
+
+Upstream-Status: Inappropriate
+
+Taken from linux-yocto, v5.15/standard/base
+https://git.yoctoproject.org/linux-yocto/commit?id=b8cd0e429bf75b673c438a8277d4bc74327df992&h=v5.15%2Fstandard%2Fbase
+
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+---
+ tools/perf/Makefile.perf | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+(limited to 'tools/perf/Makefile.perf')
+
+diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
+index 8f738e11356d..ee945d8e3996 100644
+--- a/tools/perf/Makefile.perf
++++ b/tools/perf/Makefile.perf
+@@ -1022,7 +1022,7 @@ install-bin: install-tools install-tests install-traceevent-plugins
+ install: install-bin try-install-man
+
+ install-python_ext:
+- $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
++ $(PYTHON_WORD) util/setup.py --quiet install --prefix='$(DESTDIR_SQ)/usr'
+
+ # 'make install-doc' should call 'make -C Documentation install'
+ $(INSTALL_DOC_TARGETS):
+--
+cgit
+
+
diff --git a/recipes-kernel/linux/linux-intel_5.10.bb b/recipes-kernel/linux/linux-intel_5.10.bb
deleted file mode 100644
index c1040001..00000000
--- a/recipes-kernel/linux/linux-intel_5.10.bb
+++ /dev/null
@@ -1,32 +0,0 @@
-require linux-intel.inc
-
-KBRANCH = "5.10/yocto"
-KMETA_BRANCH = "yocto-5.10"
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
-
-SRC_URI_append = " file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch \
- "
-
-DEPENDS += "elfutils-native openssl-native util-linux-native"
-
-LINUX_VERSION ?= "5.10.35"
-SRCREV_machine ?= "0fd9e7f81ac665d77c40d5c4a3815e46d4d07e90"
-SRCREV_meta ?= "cd049697e9b2d3e9118110d476075ff8f87202cc"
-
-# For Crystalforest and Romley
-KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " uio"
-KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " uio"
-
-# Functionality flags
-KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/security/security.scc"
-
-# Following commit is backported from mainline 5.12-rc to linux-intel 5.10 kernel
-# Commit: https://github.com/torvalds/linux/commit/26499e0518a77de29e7db2c53fb0d0e9e15be8fb
-# In which 'CONFIG_DRM_GMA3600' config option is dropped.
-# This causes warning during config audit. So suppress the harmless warning for now.
-KCONF_BSP_AUDIT_LEVEL = "0"
-
-# Disabling CONFIG_SND_SOC_INTEL_SKYLAKE for 32-bit, does not allow to set CONFIG_SND_SOC_INTEL_SST too, which
-# causes config warning too.
-KCONF_AUDIT_LEVEL_core2-32-intel-common = "0"
diff --git a/recipes-kernel/linux/linux-intel_5.4.bb b/recipes-kernel/linux/linux-intel_5.4.bb
deleted file mode 100644
index 910b0cfd..00000000
--- a/recipes-kernel/linux/linux-intel_5.4.bb
+++ /dev/null
@@ -1,26 +0,0 @@
-require linux-intel.inc
-
-KBRANCH = "5.4/yocto"
-KMETA_BRANCH = "yocto-5.4"
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
-
-SRC_URI_append = " file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch"
-
-DEPENDS += "elfutils-native openssl-native util-linux-native"
-
-LINUX_VERSION ?= "5.4.115"
-SRCREV_machine ?= "2521f747baec6ccd170456c0fe697c48844a080d"
-SRCREV_meta ?= "9e2546ab8d63f70ba458eb159d29ce6736ffd3e4"
-
-# For Crystalforest and Romley
-KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " uio"
-KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " uio"
-
-# Functionality flags
-KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/security/security.scc"
-
-# Kernel config 'CONFIG_GPIO_LYNXPOINT' goes by a different name 'CONFIG_PINCTRL_LYNXPOINT' in
-# linux-intel 5.4 specifically. This cause warning during kernel config audit. So suppress the
-# harmless warning for now.
-KCONF_BSP_AUDIT_LEVEL = "0"
diff --git a/recipes-kernel/linux/linux-intel_6.6.bb b/recipes-kernel/linux/linux-intel_6.6.bb
new file mode 100644
index 00000000..3b917bfa
--- /dev/null
+++ b/recipes-kernel/linux/linux-intel_6.6.bb
@@ -0,0 +1,21 @@
+require linux-intel.inc
+
+SRC_URI:prepend = "git://github.com/intel/linux-intel-lts.git;protocol=https;name=machine;branch=${KBRANCH}; \
+ "
+KBRANCH = "6.6/linux"
+KMETA_BRANCH = "yocto-6.6"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
+
+DEPENDS += "elfutils-native openssl-native util-linux-native"
+
+LINUX_VERSION_EXTENSION ??= "-intel-pk-${LINUX_KERNEL_TYPE}"
+
+LINUX_VERSION ?= "6.6.25"
+SRCREV_machine ?= "lts-v6.6.25-linux-240415T215440Z"
+SRCREV_meta ?= "c3d1322fb6ff68cdcf4d7a3c1140d81bfdc1320a"
+
+# Functionality flags
+KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/security/security.scc"
+
+UPSTREAM_CHECK_GITTAGREGEX = "^lts-(?P<pver>v6.6.(\d+)-linux-(\d+)T(\d+)Z)$"
diff --git a/recipes-kernel/linux/linux-intel_6.8.bb b/recipes-kernel/linux/linux-intel_6.8.bb
new file mode 100644
index 00000000..036879db
--- /dev/null
+++ b/recipes-kernel/linux/linux-intel_6.8.bb
@@ -0,0 +1,20 @@
+require linux-intel.inc
+
+SRC_URI:prepend = "git://github.com/intel/mainline-tracking.git;protocol=https;name=machine;nobranch=1; \
+ "
+KMETA_BRANCH = "master"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
+
+DEPENDS += "elfutils-native openssl-native util-linux-native"
+
+LINUX_VERSION_EXTENSION ??= "-mainline-tracking-${LINUX_KERNEL_TYPE}"
+
+LINUX_VERSION ?= "6.8"
+SRCREV_machine ?= "efbae83db36abbbbdb946d4f7bbdfda174107cd2"
+SRCREV_meta ?= "27907f391a4fc508da21358b13419c6e86926c34"
+
+# Functionality flags
+KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/security/security.scc"
+
+UPSTREAM_CHECK_GITTAGREGEX = "^mainline-tracking-v6.7-rc3-linux-(?P<pver>(\d+)T(\d+)Z)$"
diff --git a/recipes-kernel/linux/linux-yocto-dev.bbappend b/recipes-kernel/linux/linux-yocto-dev.bbappend
index 6173148c..deb19940 100644
--- a/recipes-kernel/linux/linux-yocto-dev.bbappend
+++ b/recipes-kernel/linux/linux-yocto-dev.bbappend
@@ -1,21 +1,21 @@
-FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/${PN}:"
+FILESEXTRAPATHS:prepend:intel-x86-common := "${THISDIR}/${PN}:"
-COMPATIBLE_MACHINE_core2-32-intel-common = "${MACHINE}"
-KMACHINE_core2-32-intel-common = "intel-core2-32"
-KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}"
+COMPATIBLE_MACHINE:core2-32-intel-common = "${MACHINE}"
+KMACHINE:core2-32-intel-common = "intel-core2-32"
+KERNEL_FEATURES:append:core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}"
-COMPATIBLE_MACHINE_corei7-64-intel-common = "${MACHINE}"
-KMACHINE_corei7-64-intel-common = "intel-corei7-64"
-KERNEL_FEATURES_append_corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}"
+COMPATIBLE_MACHINE:corei7-64-intel-common = "${MACHINE}"
+KMACHINE:corei7-64-intel-common = "intel-corei7-64"
+KERNEL_FEATURES:append:corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}"
# NOTE: We do not set SRCREVs here as -dev is intended to be built with AUTOREV
# and setting them here breaks the default mechanism to use AUTOREV if the
# default SRCREV is set and linux-yocto-dev is the preferred provider.
# For Crystalforest and Romley
-KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " uio"
-KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " uio"
+KERNEL_MODULE_AUTOLOAD:append:core2-32-intel-common = " uio"
+KERNEL_MODULE_AUTOLOAD:append:corei7-64-intel-common = " uio"
# For FRI2, NUC
-KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " iwlwifi"
-KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " iwlwifi"
+KERNEL_MODULE_AUTOLOAD:append:core2-32-intel-common = " iwlwifi"
+KERNEL_MODULE_AUTOLOAD:append:corei7-64-intel-common = " iwlwifi"
diff --git a/recipes-kernel/linux/linux-yocto-rt_5.%.bbappend b/recipes-kernel/linux/linux-yocto-rt_%.bbappend
index daa7dd6b..daa7dd6b 100644
--- a/recipes-kernel/linux/linux-yocto-rt_5.%.bbappend
+++ b/recipes-kernel/linux/linux-yocto-rt_%.bbappend
diff --git a/recipes-kernel/linux/linux-yocto_%.bbappend b/recipes-kernel/linux/linux-yocto_%.bbappend
index 7c29be14..9f3d43e3 100644
--- a/recipes-kernel/linux/linux-yocto_%.bbappend
+++ b/recipes-kernel/linux/linux-yocto_%.bbappend
@@ -1,4 +1,6 @@
+require meta-intel-compat-kernel.inc
+
# The kernel build is 64-bit regardless, so include both common overrides.
# Without this, the kernel will be missing vars that make it buildable for the
# intel-corei7-64 machine.
-MACHINEOVERRIDES_prepend_corei7-64-x32-intel-common = "corei7-64-intel-common:"
+MACHINEOVERRIDES:prepend:corei7-64-x32-intel-common = "corei7-64-intel-common:"
diff --git a/recipes-kernel/linux/linux-yocto_5.%.bbappend b/recipes-kernel/linux/linux-yocto_5.%.bbappend
deleted file mode 100644
index daa7dd6b..00000000
--- a/recipes-kernel/linux/linux-yocto_5.%.bbappend
+++ /dev/null
@@ -1 +0,0 @@
-require meta-intel-compat-kernel.inc
diff --git a/recipes-kernel/linux/meta-intel-compat-kernel.inc b/recipes-kernel/linux/meta-intel-compat-kernel.inc
index a985925f..0c861e13 100644
--- a/recipes-kernel/linux/meta-intel-compat-kernel.inc
+++ b/recipes-kernel/linux/meta-intel-compat-kernel.inc
@@ -3,12 +3,12 @@
KERNEL_FEATURES_INTEL_COMMON ?= ""
-COMPATIBLE_MACHINE_intel-x86-common = "${MACHINE}"
-KERNEL_FEATURES_intel-x86-common = "${KERNEL_FEATURES_INTEL_COMMON}"
+COMPATIBLE_MACHINE:intel-x86-common = "${MACHINE}"
+KERNEL_FEATURES:intel-x86-common = "${KERNEL_FEATURES_INTEL_COMMON}"
-KMACHINE_corei7-64-intel-common = "intel-corei7-64"
-KMACHINE_core2-32-intel-common = "intel-core2-32"
-KMACHINE_skylake-64-intel-common = "intel-corei7-64"
+KMACHINE:corei7-64-intel-common = "intel-corei7-64"
+KMACHINE:core2-32-intel-common = "intel-core2-32"
+KMACHINE:x86-64-v3-intel-common = "intel-corei7-64"
INTEL_COMMON_AUTOLOAD ?= " uio iwlwifi i915"
-KERNEL_MODULE_AUTOLOAD_intel-x86-common = " ${INTEL_COMMON_AUTOLOAD}"
+KERNEL_MODULE_AUTOLOAD:intel-x86-common = " ${INTEL_COMMON_AUTOLOAD}"
diff --git a/recipes-multimedia/itt/itt_3.18.13.bb b/recipes-multimedia/itt/itt_3.24.7.bb
index d134c014..481fd5be 100644
--- a/recipes-multimedia/itt/itt_3.18.13.bb
+++ b/recipes-multimedia/itt/itt_3.24.7.bb
@@ -3,18 +3,20 @@ DESCRIPTION = "The Instrumentation and Tracing Technology (ITT) API enables \
application to generate and control the collection of trace data during its \
execution across different Intel tools."
-LICENSE = "BSD-3-Clause & GPLv2"
+LICENSE = "BSD-3-Clause & GPL-2.0-only"
LIC_FILES_CHKSUM = "file://LICENSES/BSD-3-Clause.txt;md5=c551872bcf41ce707df54c722edeca7b \
file://LICENSES/GPL-2.0-only.txt;md5=e2d76e7801260c21b90eea3605508ad6 \
"
-SRC_URI = "git://github.com/intel/ittapi.git;protocol=https"
-SRCREV = "a3911fff01a775023a06af8754f9ec1e5977dd97"
+SRC_URI = "git://github.com/intel/ittapi.git;protocol=https;branch=master"
+SRCREV = "e20cd6099cb9c5afee0a285781c5cc1d32412f3e"
S = "${WORKDIR}/git"
PE = "1"
UPSTREAM_CHECK_GITTAGREGEX = "^v(?P<pver>(\d+(\.\d+)+))$"
+COMPATIBLE_HOST = '(i.86|x86_64).*-linux'
+
inherit pkgconfig cmake
EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=Release"
@@ -34,4 +36,4 @@ do_install() {
}
-RDEPENDS_${PN}-dev_remove = "${PN} (= ${EXTENDPKGV})"
+RDEPENDS:${PN}-dev:remove = "${PN} (= ${EXTENDPKGV})"
diff --git a/recipes-multimedia/libva/files/0001-Disable-vp9-padding-on-mtl.patch b/recipes-multimedia/libva/files/0001-Disable-vp9-padding-on-mtl.patch
new file mode 100644
index 00000000..90dff8d1
--- /dev/null
+++ b/recipes-multimedia/libva/files/0001-Disable-vp9-padding-on-mtl.patch
@@ -0,0 +1,35 @@
+From 1b303f417113ad1aa6b63fc024fbe4aa0c943f57 Mon Sep 17 00:00:00 2001
+From: Lim Siew Hoon <siew.hoon.lim@intel.com>
+Date: Tue, 5 Sep 2023 16:13:42 +0800
+Subject: [PATCH 01/12] Disable vp9 padding on mtl.
+
+Upstream-Status: Submitted [https://github.com/intel/media-driver/pull/1720]
+
+Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
+---
+ media_softlet/linux/Xe_M_plus/ddi/media_sku_wa_mtl.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/media_softlet/linux/Xe_M_plus/ddi/media_sku_wa_mtl.cpp b/media_softlet/linux/Xe_M_plus/ddi/media_sku_wa_mtl.cpp
+index 844545a87..72265289c 100644
+--- a/media_softlet/linux/Xe_M_plus/ddi/media_sku_wa_mtl.cpp
++++ b/media_softlet/linux/Xe_M_plus/ddi/media_sku_wa_mtl.cpp
+@@ -284,7 +284,7 @@ static bool InitMtlMediaWaExt(struct GfxDeviceInfo *devInfo,
+
+ MEDIA_WR_WA(waTable, WaDisableSetObjectCapture, 1);
+
+- MEDIA_WR_WA(waTable, Wa_Vp9UnalignedHeight, 1);
++ MEDIA_WR_WA(waTable, Wa_Vp9UnalignedHeight, 0);
+
+ MEDIA_WR_WA(waTable, Wa_15013355402, 1);
+
+@@ -337,4 +337,4 @@ static struct LinuxDeviceInit arlDeviceInit =
+ };
+
+ static bool arlDeviceRegister = DeviceInfoFactory<LinuxDeviceInit>::
+- RegisterDevice((uint32_t)IGFX_ARROWLAKE, &arlDeviceInit);
+\ No newline at end of file
++ RegisterDevice((uint32_t)IGFX_ARROWLAKE, &arlDeviceInit);
+--
+2.40.1
+
diff --git a/recipes-multimedia/libva/files/0001-changed-VPHAL_MAX_SOURCES-set-to-65.patch b/recipes-multimedia/libva/files/0001-changed-VPHAL_MAX_SOURCES-set-to-65.patch
deleted file mode 100644
index 292e1a55..00000000
--- a/recipes-multimedia/libva/files/0001-changed-VPHAL_MAX_SOURCES-set-to-65.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 864bd3a2d9ab106f0317f442b555bde13e28fbc3 Mon Sep 17 00:00:00 2001
-From: Lim Siew Hoon <siew.hoon.lim@intel.com>
-Date: Wed, 14 Apr 2021 13:15:18 +0800
-Subject: [meta-intel][PATCH] changed VPHAL_MAX_SOURCES set to 65
-
-Issue report in:
-https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/issues/303
-
-Platform: TGL-U
-
-Upstream-Status: Submitted [https://github.com/intel/media-driver/pull/1180]
-
-Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
----
- media_driver/agnostic/common/vp/hal/vphal_common.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/media_driver/agnostic/common/vp/hal/vphal_common.h b/media_driver/agnostic/common/vp/hal/vphal_common.h
-index fa92b17b..d3d9e325 100644
---- a/media_driver/agnostic/common/vp/hal/vphal_common.h
-+++ b/media_driver/agnostic/common/vp/hal/vphal_common.h
-@@ -207,7 +207,7 @@ extern "C" {
- #define NLAS_NONLINEARCROP_DEFAULT 0.0F
- #define NLAS_NONLINEARCROP_STEP 0.001F
-
--#define VPHAL_MAX_SOURCES 17 //!< worst case: 16 sub-streams + 1 pri video
-+#define VPHAL_MAX_SOURCES 65 //!< worst case: 64 sub-streams + 1 pri video
- #define VPHAL_MAX_CHANNELS 2
- #define VPHAL_MAX_TARGETS 8 //!< multi output support
- #define VPHAL_MAX_FUTURE_FRAMES 18 //!< maximum future frames supported in VPHAL
---
-2.31.1
-
diff --git a/recipes-multimedia/libva/files/0002-Force-ARGB-surface-to-tile4-for-ACM.patch b/recipes-multimedia/libva/files/0002-Force-ARGB-surface-to-tile4-for-ACM.patch
new file mode 100644
index 00000000..df3d9805
--- /dev/null
+++ b/recipes-multimedia/libva/files/0002-Force-ARGB-surface-to-tile4-for-ACM.patch
@@ -0,0 +1,44 @@
+From 1580f01ec5ad5afdad58c39dded999494275be10 Mon Sep 17 00:00:00 2001
+From: Lim Siew Hoon <siew.hoon.lim@intel.com>
+Date: Wed, 11 Oct 2023 15:36:21 +0800
+Subject: [PATCH 02/12] Force ARGB surface to tile4 for ACM
+
+Upstream-Status: Submitted [https://github.com/intel/media-driver/pull/1728]
+
+Signed-off-by: Soon, Thean Siew <thean.siew.soon@intel.com>
+Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
+---
+ media_driver/linux/common/ddi/media_libva_util.cpp | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/media_driver/linux/common/ddi/media_libva_util.cpp b/media_driver/linux/common/ddi/media_libva_util.cpp
+index 63c173419..73be76366 100755
+--- a/media_driver/linux/common/ddi/media_libva_util.cpp
++++ b/media_driver/linux/common/ddi/media_libva_util.cpp
+@@ -504,6 +504,7 @@ VAStatus DdiMediaUtil_AllocateSurface(
+ gmmCustomParams.Flags.Gpu.UnifiedAuxSurface = 0;
+ }
+ }
++
+ break;
+ case TILING_X:
+ gmmCustomParams.Flags.Info.TiledX = true;
+@@ -685,6 +686,15 @@ VAStatus DdiMediaUtil_AllocateSurface(
+ }
+ }
+ }
++ // There's no VAAPI interface for modifier query yet. As a workaround, always allocate
++ // RGB surface as tile4.
++ if ((format == Media_Format_A8R8G8B8 ||
++ format == Media_Format_B10G10R10A2 |
++ format == Media_Format_A8B8G8R8 ||
++ format == Media_Format_X8R8G8B8) && !MEDIA_IS_SKU(&mediaDrvCtx->SkuTable, FtrTileY))
++ {
++ gmmParams.Flags.Info.Tile4 = true;
++ }
+ break;
+ case TILING_X:
+ gmmParams.Flags.Info.TiledX = true;
+--
+2.40.1
+
diff --git a/recipes-multimedia/libva/files/8aa866dc650e6b0e0b7425bafc7b1039232c377a.patch b/recipes-multimedia/libva/files/8aa866dc650e6b0e0b7425bafc7b1039232c377a.patch
new file mode 100644
index 00000000..17b2d635
--- /dev/null
+++ b/recipes-multimedia/libva/files/8aa866dc650e6b0e0b7425bafc7b1039232c377a.patch
@@ -0,0 +1,154 @@
+From 8aa866dc650e6b0e0b7425bafc7b1039232c377a Mon Sep 17 00:00:00 2001
+From: "Xu, Zhengguo" <zhengguo.xu@intel.com>
+Date: Tue, 16 Apr 2024 09:53:41 +0800
+Subject: [PATCH] [Decode] Correct condition check when dump avc mv buffer
+
+Fixes: #1791
+Signed-off-by: Xu, Zhengguo <zhengguo.xu@intel.com>
+
+Upstream-Status: Backport [https://github.com/intel/media-driver/commit/8aa866dc650e6b0e0b7425bafc7b1039232c377a]
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+---
+ .../common/codec/hal/codechal_decode_avc.cpp | 33 ++++++++-----------
+ .../decode_avc_picture_xe_m_base_packet.cpp | 28 +++++++---------
+ .../avc/packet/decode_avc_picture_packet.cpp | 30 +++++++----------
+ 3 files changed, 37 insertions(+), 54 deletions(-)
+
+diff --git a/media_driver/agnostic/common/codec/hal/codechal_decode_avc.cpp b/media_driver/agnostic/common/codec/hal/codechal_decode_avc.cpp
+index 3adf6994ce..4bac426802 100644
+--- a/media_driver/agnostic/common/codec/hal/codechal_decode_avc.cpp
++++ b/media_driver/agnostic/common/codec/hal/codechal_decode_avc.cpp
+@@ -1619,28 +1619,23 @@ MOS_STATUS CodechalDecodeAvc::InitPicMhwParams(
+ uint8_t picID = picMhwParams->AvcDirectmodeParams.bPicIdRemappingInUse ? i : refList[idx]->ucFrameId;
+ uint8_t mvIdx = refList[idx]->ucDMVIdx[0];
+
+- if (&picMhwParams->AvcDirectmodeParams.presAvcDmvBuffers[i] != nullptr)
+- {
+- // dump Reference mvdata
+- std::string mvBufDumpName = "_DEC_Ref_MV_" + std::to_string(i);
+- CODECHAL_DECODE_CHK_STATUS_RETURN(m_debugInterface->DumpBuffer(
+- &picMhwParams->AvcDirectmodeParams.presAvcDmvBuffers[mvIdx],
+- CodechalDbgAttr::attrMvData,
+- mvBufDumpName.c_str(),
+- m_avcDmvBufferSize));
+- }
++ // dump Reference mvdata
++ std::string mvBufDumpName = "_DEC_Ref_MV_" + std::to_string(i);
++ CODECHAL_DECODE_CHK_STATUS_RETURN(m_debugInterface->DumpBuffer(
++ &picMhwParams->AvcDirectmodeParams.presAvcDmvBuffers[mvIdx],
++ CodechalDbgAttr::attrMvData,
++ mvBufDumpName.c_str(),
++ m_avcDmvBufferSize));
+ }
+ }
+
+- if (&picMhwParams->AvcDirectmodeParams.presAvcDmvBuffers[picMhwParams->AvcDirectmodeParams.ucAvcDmvIdx])
+- {
+- // dump Current mvdata
+- CODECHAL_DECODE_CHK_STATUS_RETURN(m_debugInterface->DumpBuffer(
+- &picMhwParams->AvcDirectmodeParams.presAvcDmvBuffers[picMhwParams->AvcDirectmodeParams.ucAvcDmvIdx],
+- CodechalDbgAttr::attrMvData,
+- "DEC_Cur_MV_",
+- m_avcDmvBufferSize));
+- });
++ // dump Current mvdata
++ CODECHAL_DECODE_CHK_STATUS_RETURN(m_debugInterface->DumpBuffer(
++ &picMhwParams->AvcDirectmodeParams.presAvcDmvBuffers[picMhwParams->AvcDirectmodeParams.ucAvcDmvIdx],
++ CodechalDbgAttr::attrMvData,
++ "DEC_Cur_MV_",
++ m_avcDmvBufferSize));
++ );
+
+ return eStatus;
+ }
+diff --git a/media_driver/media_softlet/agnostic/Xe_M/Xe_M_base/codec/hal/dec/avc/packet/decode_avc_picture_xe_m_base_packet.cpp b/media_driver/media_softlet/agnostic/Xe_M/Xe_M_base/codec/hal/dec/avc/packet/decode_avc_picture_xe_m_base_packet.cpp
+index bd0611f6fa..035a7e6149 100644
+--- a/media_driver/media_softlet/agnostic/Xe_M/Xe_M_base/codec/hal/dec/avc/packet/decode_avc_picture_xe_m_base_packet.cpp
++++ b/media_driver/media_softlet/agnostic/Xe_M/Xe_M_base/codec/hal/dec/avc/packet/decode_avc_picture_xe_m_base_packet.cpp
+@@ -589,26 +589,20 @@ namespace decode{
+ {
+ if (m_avcBasicFeature->m_refFrames.m_avcPicIdx[n].bValid)
+ {
+- if (&avcDirectmodeParams.presAvcDmvBuffers[n+1] != nullptr)
+- {
+- std::string mvBufDumpName = "_DEC_Ref_MV_" + std::to_string(n);
+- DECODE_CHK_STATUS(debugInterface->DumpBuffer(
+- &avcDirectmodeParams.presAvcDmvBuffers[n+1],
+- CodechalDbgAttr::attrMvData,
+- mvBufDumpName.c_str(),
+- mvBufferSize));
+- }
++ std::string mvBufDumpName = "_DEC_Ref_MV_" + std::to_string(n);
++ DECODE_CHK_STATUS(debugInterface->DumpBuffer(
++ &avcDirectmodeParams.presAvcDmvBuffers[n+1],
++ CodechalDbgAttr::attrMvData,
++ mvBufDumpName.c_str(),
++ mvBufferSize));
+ }
+ }
+
+- if (&avcDirectmodeParams.presAvcDmvBuffers[0] != nullptr)
+- {
+- DECODE_CHK_STATUS(debugInterface->DumpBuffer(
+- &avcDirectmodeParams.presAvcDmvBuffers[0],
+- CodechalDbgAttr::attrMvData,
+- "DEC_Cur_MV_",
+- mvBufferSize));
+- }
++ DECODE_CHK_STATUS(debugInterface->DumpBuffer(
++ &avcDirectmodeParams.presAvcDmvBuffers[0],
++ CodechalDbgAttr::attrMvData,
++ "DEC_Cur_MV_",
++ mvBufferSize));
+ return MOS_STATUS_SUCCESS;
+ }
+
+diff --git a/media_softlet/agnostic/common/codec/hal/dec/avc/packet/decode_avc_picture_packet.cpp b/media_softlet/agnostic/common/codec/hal/dec/avc/packet/decode_avc_picture_packet.cpp
+index 88ed0bb832..8cdc05e585 100644
+--- a/media_softlet/agnostic/common/codec/hal/dec/avc/packet/decode_avc_picture_packet.cpp
++++ b/media_softlet/agnostic/common/codec/hal/dec/avc/packet/decode_avc_picture_packet.cpp
+@@ -646,26 +646,20 @@ MOS_STATUS AvcDecodePicPkt::DumpResources(uint32_t mvBufferSize) const
+ CodechalDbgAttr::attrDecodeReferenceSurfaces,
+ refSurfName.c_str()));
+
+- if (&mvParam.presAvcDmvBuffers[n+1] != nullptr)
+- {
+- std::string mvBufDumpName = "_DEC_Ref_MV_" + std::to_string(n);
+- DECODE_CHK_STATUS(debugInterface->DumpBuffer(
+- &mvParam.presAvcDmvBuffers[n+1],
+- CodechalDbgAttr::attrMvData,
+- mvBufDumpName.c_str(),
+- mvBufferSize));
+- }
++ std::string mvBufDumpName = "_DEC_Ref_MV_" + std::to_string(n);
++ DECODE_CHK_STATUS(debugInterface->DumpBuffer(
++ &mvParam.presAvcDmvBuffers[n+1],
++ CodechalDbgAttr::attrMvData,
++ mvBufDumpName.c_str(),
++ mvBufferSize));
+ }
+ }
+
+- if (&mvParam.presAvcDmvBuffers[0] != nullptr)
+- {
+- DECODE_CHK_STATUS(debugInterface->DumpBuffer(
+- &mvParam.presAvcDmvBuffers[0],
+- CodechalDbgAttr::attrMvData,
+- "DEC_Cur_MV_",
+- mvBufferSize));
+- }
++ DECODE_CHK_STATUS(debugInterface->DumpBuffer(
++ &mvParam.presAvcDmvBuffers[0],
++ CodechalDbgAttr::attrMvData,
++ "DEC_Cur_MV_",
++ mvBufferSize));
+
+ return MOS_STATUS_SUCCESS;
+ }
+@@ -699,4 +693,4 @@ MOS_STATUS AvcDecodePicPkt::SetSurfaceMmcState() const
+ return MOS_STATUS_SUCCESS;
+ }
+
+-} // namespace decode
+\ No newline at end of file
++} // namespace decode
diff --git a/recipes-multimedia/libva/intel-media-driver_21.1.3.bb b/recipes-multimedia/libva/intel-media-driver_24.1.5.bb
index 8b7ff5e7..79f9887d 100644
--- a/recipes-multimedia/libva/intel-media-driver_21.1.3.bb
+++ b/recipes-multimedia/libva/intel-media-driver_24.1.5.bb
@@ -19,20 +19,22 @@ REQUIRED_DISTRO_FEATURES = "opengl"
DEPENDS += "libva gmmlib"
SRC_URI = "git://github.com/intel/media-driver.git;protocol=https;nobranch=1 \
- file://0001-changed-VPHAL_MAX_SOURCES-set-to-65.patch \
+ file://0001-Disable-vp9-padding-on-mtl.patch \
+ file://0002-Force-ARGB-surface-to-tile4-for-ACM.patch \
+ file://8aa866dc650e6b0e0b7425bafc7b1039232c377a.patch \
"
-SRCREV = "bec8e1382637589bc3f302edf6c866bec3d754dd"
+SRCREV = "8068c2e119ba16c017e5a5f443fac5a55edbee65"
S = "${WORKDIR}/git"
-COMPATIBLE_HOST_x86-x32 = "null"
+COMPATIBLE_HOST:x86-x32 = "null"
UPSTREAM_CHECK_GITTAGREGEX = "^intel-media-(?P<pver>(?!600\..*)\d+(\.\d+)+)$"
inherit cmake pkgconfig
-MEDIA_DRIVER_ARCH_x86 = "32"
-MEDIA_DRIVER_ARCH_x86-64 = "64"
+MEDIA_DRIVER_ARCH:x86 = "32"
+MEDIA_DRIVER_ARCH:x86-64 = "64"
EXTRA_OECMAKE += " \
-DMEDIA_RUN_TEST_SUITE=OFF \
@@ -40,12 +42,12 @@ EXTRA_OECMAKE += " \
-DMEDIA_BUILD_FATAL_WARNINGS=OFF \
"
-CXXFLAGS_append_x86 = " -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
+CXXFLAGS:append:x86 = " -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
-do_configure_prepend_toolchain-clang() {
+do_configure:prepend:toolchain-clang() {
sed -i -e '/-fno-tree-pre/d' ${S}/media_driver/cmake/linux/media_compile_flags_linux.cmake
}
-FILES_${PN} += " \
+FILES:${PN} += " \
${libdir}/dri/ \
"
diff --git a/recipes-multimedia/libva/intel-vaapi-driver_2.4.1.bb b/recipes-multimedia/libva/intel-vaapi-driver_2.4.1.bb
index ccb9fec1..5038d8d7 100644
--- a/recipes-multimedia/libva/intel-vaapi-driver_2.4.1.bb
+++ b/recipes-multimedia/libva/intel-vaapi-driver_2.4.1.bb
@@ -29,6 +29,6 @@ PACKAGECONFIG ??= "${@bb.utils.contains("DISTRO_FEATURES", "x11", "x11", "", d)}
PACKAGECONFIG[x11] = "-Dwith_x11=yes, -Dwith_x11=no"
PACKAGECONFIG[wayland] = "-Dwith_wayland=yes, -Dwith_wayland=no, wayland wayland-native virtual/egl"
-FILES_${PN} += "${libdir}/dri/*.so"
-FILES_${PN}-dev += "${libdir}/dri/*.la"
-FILES_${PN}-dbg += "${libdir}/dri/.debug"
+FILES:${PN} += "${libdir}/dri/*.so"
+FILES:${PN}-dev += "${libdir}/dri/*.la"
+FILES:${PN}-dbg += "${libdir}/dri/.debug"
diff --git a/recipes-multimedia/libyami/libyami-utils/0001-Fix-build-with-clang.patch b/recipes-multimedia/libyami/libyami-utils/0001-Fix-build-with-clang.patch
deleted file mode 100644
index f7de9d16..00000000
--- a/recipes-multimedia/libyami/libyami-utils/0001-Fix-build-with-clang.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-From f2e6d2ecfea635ab952649156e31ca893d4b1a47 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 12 Aug 2017 08:49:20 -0700
-Subject: [PATCH] Fix build with clang
-
-Fix errors e.g.
-error: comparison of constant -1 with expression of type 'char' is always true [-Werror,-Wtautological-constant-out-of-range-compare]error: comparison of constant -1 with expression of type 'char' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
-
-and
-
-psnr.cpp:225:17: error: bool literal returned from 'main' [-Werror,-Wmain]
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
-
----
- tests/decodehelp.cpp | 2 +-
- tests/encodehelp.h | 2 +-
- tests/vpp.cpp | 2 +-
- tests/yamitranscode.cpp | 2 +-
- testscripts/psnr.cpp | 4 ++--
- 5 files changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/tests/decodehelp.cpp b/tests/decodehelp.cpp
-index b27b977..62cca63 100644
---- a/tests/decodehelp.cpp
-+++ b/tests/decodehelp.cpp
-@@ -81,7 +81,7 @@ bool processCmdLine(int argc, char** argv, DecodeParameter* parameters)
- { NULL, no_argument, NULL, 0 }
- };
-
-- char opt;
-+ int opt;
- while ((opt = getopt_long_only(argc, argv, "h:m:n:i:f:o:w:?", long_opts,&option_index)) != -1){
- switch (opt) {
- case 'h':
-diff --git a/tests/encodehelp.h b/tests/encodehelp.h
-index 63580a4..651ec08 100644
---- a/tests/encodehelp.h
-+++ b/tests/encodehelp.h
-@@ -109,7 +109,7 @@ static VideoRateControl string_to_rc_mode(char *str)
-
- static bool process_cmdline(int argc, char *argv[])
- {
-- char opt;
-+ int opt;
- const struct option long_opts[] = {
- { "help", no_argument, NULL, 'h' },
- { "qp", required_argument, NULL, 0 },
-diff --git a/tests/vpp.cpp b/tests/vpp.cpp
-index 5a60c0a..52da43b 100644
---- a/tests/vpp.cpp
-+++ b/tests/vpp.cpp
-@@ -151,7 +151,7 @@ public:
- private:
- bool processCmdLine(int argc, char* argv[])
- {
-- char opt;
-+ int opt;
- const struct option long_opts[] = {
- { "help", no_argument, NULL, 'h' },
- { "sharpening", required_argument, NULL, 's' },
-diff --git a/tests/yamitranscode.cpp b/tests/yamitranscode.cpp
-index 6207209..00164ce 100755
---- a/tests/yamitranscode.cpp
-+++ b/tests/yamitranscode.cpp
-@@ -100,7 +100,7 @@ static VideoRateControl string_to_rc_mode(char *str)
-
- static bool processCmdLine(int argc, char *argv[], TranscodeParams& para)
- {
-- char opt;
-+ int opt;
- const struct option long_opts[] = {
- { "help", no_argument, NULL, 'h' },
- { "qp", required_argument, NULL, 0 },
-diff --git a/testscripts/psnr.cpp b/testscripts/psnr.cpp
-index 5cc24c9..68bd668 100644
---- a/testscripts/psnr.cpp
-+++ b/testscripts/psnr.cpp
-@@ -215,14 +215,14 @@ int main(int argc, char *argv[])
- const char* psnrresult = "average_psnr.txt";
- int width=0,height=0;
- int standardpsnr = NORMAL_PSNR;
-- char opt;
-+ int opt;
- while ((opt = getopt(argc, argv, "h:W:H:i:o:s:?")) != -1)
- {
- switch (opt) {
- case 'h':
- case '?':
- print_help(argv[0]);
-- return false;
-+ return -1;
- case 'i':
- filename1 = optarg;
- break;
diff --git a/recipes-multimedia/libyami/libyami-utils_1.3.2.bb b/recipes-multimedia/libyami/libyami-utils_1.3.2.bb
deleted file mode 100644
index f9333f3d..00000000
--- a/recipes-multimedia/libyami/libyami-utils_1.3.2.bb
+++ /dev/null
@@ -1,26 +0,0 @@
-SUMMARY = "Applications and Scripts for libyami."
-DESCRIPTION = "Applications and Scripts for libyami."
-
-HOMEPAGE = "https://github.com/intel/libyami-utils"
-BUGTRACKER = "https://github.com/intel/libyami-utils/issues/new"
-
-LICENSE = "Apache-2.0"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
-
-SRC_URI = "git://github.com/intel/libyami-utils.git \
- file://0001-Fix-build-with-clang.patch \
- "
-SRCREV = "c3d25b64b05aeb0c4eecc140aef617cfeced6b8e"
-S = "${WORKDIR}/git"
-
-DEPENDS = "libva libyami"
-
-inherit autotools pkgconfig features_check
-
-REQUIRED_DISTRO_FEATURES = "opengl"
-
-PACKAGECONFIG = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
-
-# --enable-x11 needs libva-x11
-# gles-tests fail to build without x11: see https://github.com/intel/libyami-utils/issues/91
-PACKAGECONFIG[x11] = "--enable-x11 --enable-egl,--disable-x11 --disable-egl, virtual/libx11"
diff --git a/recipes-multimedia/libyami/libyami_1.3.2.bb b/recipes-multimedia/libyami/libyami_1.3.2.bb
deleted file mode 100644
index c8628141..00000000
--- a/recipes-multimedia/libyami/libyami_1.3.2.bb
+++ /dev/null
@@ -1,24 +0,0 @@
-SUMMARY = "Yami is media infrastructure base on libva"
-DESCRIPTION = "Yet Another Media Infrastructure \
-light weight hardware codec library base on VA-API "
-
-HOMEPAGE = "https://github.com/intel/libyami"
-BUGTRACKER = "https://github.com/intel/libyami/issues/new"
-
-LICENSE = "Apache-2.0"
-LIC_FILES_CHKSUM = "file://LICENSE.md;md5=3b83ef96387f14655fc854ddc3c6bd57"
-
-SRC_URI = "git://github.com/intel/libyami.git;branch=apache \
-"
-SRCREV = "08606d0a43e0ef15e5b61cc13563169370ce8715"
-S = "${WORKDIR}/git"
-
-CXXFLAGS_append = " -Wno-error"
-
-PACKAGECONFIG ??= "${@bb.utils.contains("DISTRO_FEATURES", "x11", "x11", "", d)}"
-PACKAGECONFIG[x11] = "--enable-x11,--disable-x11,virtual/libx11 libxrandr libxrender"
-
-DEPENDS = "libva"
-inherit autotools pkgconfig features_check
-
-REQUIRED_DISTRO_FEATURES = "opengl"
diff --git a/recipes-multimedia/mediasdk/files/0001-Don-t-try-to-autheticate-with-render-node.patch b/recipes-multimedia/mediasdk/files/0001-Don-t-try-to-autheticate-with-render-node.patch
deleted file mode 100644
index d424b68d..00000000
--- a/recipes-multimedia/mediasdk/files/0001-Don-t-try-to-autheticate-with-render-node.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 6945cd0ad84855ab4a2dc40016879fb5fc7f2b6a Mon Sep 17 00:00:00 2001
-From: Vincent Cheah Beng Keat <vincent.beng.keat.cheah@intel.com>
-Date: Wed, 7 Apr 2021 05:30:15 +0000
-Subject: [PATCH] Don't try to autheticate with render node
-
-Replicate similar libVA wayland change.
-https://github.com/intel/libva/commit/283f776a9649dcef58b47958c1269499adfa1cd4
-
-Platform: ADL-S, EHL, TGL
-OS: Yocto native wayland weston
-Tested:
- ./sample_decode h265 -i Puppies_3840x2160.265 -rwld -rgb4
-
-Issue: #2592
-
-Upstream-Status: Backport [https://github.com/Intel-Media-SDK/MediaSDK/commit/6945cd0ad84855ab4a2dc40016879fb5fc7f2b6a]
-
-Signed-off-by: Cheah, Vincent Beng Keat <vincent.beng.keat.cheah@intel.com>
----
- samples/sample_misc/wayland/src/class_wayland.cpp | 8 ++++++--
- 1 file changed, 6 insertions(+), 2 deletions(-)
-
-diff --git a/samples/sample_misc/wayland/src/class_wayland.cpp b/samples/sample_misc/wayland/src/class_wayland.cpp
-index 62f326e3..4a0beed3 100644
---- a/samples/sample_misc/wayland/src/class_wayland.cpp
-+++ b/samples/sample_misc/wayland/src/class_wayland.cpp
-@@ -433,8 +433,12 @@ void Wayland::DrmHandleDevice(const char *name)
- m_device_name << "\n";
- return;
- }
-- drmGetMagic(m_fd, &magic);
-- wl_drm_authenticate(m_drm, magic);
-+
-+ int type = drmGetNodeTypeFromFd(m_fd);
-+ if (type != DRM_NODE_RENDER) {
-+ drmGetMagic(m_fd, &magic);
-+ wl_drm_authenticate(m_drm, magic);
-+ }
- }
-
- void Wayland::DrmHandleAuthenticated()
---
-2.24.3
-
diff --git a/recipes-multimedia/mediasdk/files/fix-gcc13.patch b/recipes-multimedia/mediasdk/files/fix-gcc13.patch
new file mode 100644
index 00000000..fb973870
--- /dev/null
+++ b/recipes-multimedia/mediasdk/files/fix-gcc13.patch
@@ -0,0 +1,15 @@
+Upstream-Status: Inactive-Upstream
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+
+diff --git a/api/mfx_dispatch/linux/mfxparser.cpp b/api/mfx_dispatch/linux/mfxparser.cpp
+index 9d3823ec3e..12e46d1881 100644
+--- a/api/mfx_dispatch/linux/mfxparser.cpp
++++ b/api/mfx_dispatch/linux/mfxparser.cpp
+@@ -20,6 +20,7 @@
+
+ #include <ctype.h>
+ #include <stdio.h>
++#include <stdint.h>
+ #include <stdlib.h>
+ #include <string.h>
+
diff --git a/recipes-multimedia/mediasdk/intel-mediasdk_21.1.3.bb b/recipes-multimedia/mediasdk/intel-mediasdk_23.2.2.bb
index b3a30bc4..f00a4404 100644
--- a/recipes-multimedia/mediasdk/intel-mediasdk_21.1.3.bb
+++ b/recipes-multimedia/mediasdk/intel-mediasdk_23.2.2.bb
@@ -12,12 +12,14 @@ CVE_DETAILS = "intel:media_sdk"
# Only for 64 bit until media-driver issues aren't fixed
COMPATIBLE_HOST = '(x86_64).*-linux'
-COMPATIBLE_HOST_x86-x32 = "null"
+COMPATIBLE_HOST:x86-x32 = "null"
inherit features_check
REQUIRED_DISTRO_FEATURES = "opengl"
-DEPENDS += "libdrm libva intel-media-driver"
+DEPENDS += "libva"
+
+RDEPENDS:${PN} += "intel-media-driver"
PACKAGECONFIG ??= "${@bb.utils.contains("DISTRO_FEATURES", "x11", "dri3", "", d)} \
${@bb.utils.contains("DISTRO_FEATURES", "wayland", "wayland", "", d)} \
@@ -27,16 +29,16 @@ PACKAGECONFIG ??= "${@bb.utils.contains("DISTRO_FEATURES", "x11", "dri3", "", d)
PACKAGECONFIG[dri3] = "-DENABLE_X11_DRI3=ON, -DENABLE_X11_DRI3=OFF"
PACKAGECONFIG[itt] = "-DENABLE_ITT=ON, -DENABLE_ITT=OFF, itt"
-PACKAGECONFIG[opencl] = "-DENABLE_OPENCL=ON, -DENABLE_OPENCL=OFF, ocl-icd opencl-clhpp opencl-headers"
+PACKAGECONFIG[opencl] = "-DENABLE_OPENCL=ON, -DENABLE_OPENCL=OFF, virtual/opencl-icd opencl-clhpp opencl-headers"
PACKAGECONFIG[samples] = "-DBUILD_SAMPLES=ON, -DBUILD_SAMPLES=OFF"
PACKAGECONFIG[wayland] = "-DENABLE_WAYLAND=ON, -DENABLE_WAYLAND=OFF, wayland wayland-native"
SRC_URI = "git://github.com/Intel-Media-SDK/MediaSDK.git;protocol=https;nobranch=1;lfs=0 \
file://0001-FindITT.cmake-fix-detection-of-header-library.patch \
- file://0001-Don-t-try-to-autheticate-with-render-node.patch \
+ file://fix-gcc13.patch \
"
-SRCREV = "03164a0b491651c210abd4549ca5275ac974d105"
+SRCREV = "869b60a6c3d7b5e9f7c3b3b914986322dca4bbae"
S = "${WORKDIR}/git"
UPSTREAM_CHECK_GITTAGREGEX = "^intel-mediasdk-(?P<pver>(\d+(\.\d+)+))$"
@@ -45,17 +47,17 @@ inherit cmake pkgconfig
EXTRA_OECMAKE += "-DMFX_INCLUDE=${S}/api/include"
-do_install_append() {
+do_install:append() {
mv ${D}${datadir}/mfx/samples ${D}${libdir}/mfx/samples
}
PACKAGE_BEFORE_PN = " ${PN}-samples"
-FILES_${PN} += " \
+FILES:${PN} += " \
${libdir}/mfx \
${datadir}/mfx/plugins.cfg \
"
-FILES_${PN}-samples = "${libdir}/mfx/samples"
+FILES:${PN}-samples = "${libdir}/mfx/samples"
-INSANE_SKIP_${PN}-samples += "staticdev"
+INSANE_SKIP:${PN}-samples += "staticdev"
diff --git a/recipes-multimedia/onevpl/onevpl-intel-gpu/0001-ADLP-add-new-device-id-list.patch b/recipes-multimedia/onevpl/onevpl-intel-gpu/0001-ADLP-add-new-device-id-list.patch
deleted file mode 100644
index fcc99d55..00000000
--- a/recipes-multimedia/onevpl/onevpl-intel-gpu/0001-ADLP-add-new-device-id-list.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 5dad1ac41e227e75d1a5117c60ffc5331630c827 Mon Sep 17 00:00:00 2001
-From: Dan Ai <dan.ai@intel.com>
-Date: Thu, 6 May 2021 22:22:08 +0800
-Subject: [PATCH] [ADLP] add new device id list
-
-Upstream-Status: Backport [https://github.com/oneapi-src/oneVPL-intel-gpu/commit/5dad1ac41e227e75d1a5117c60ffc5331630c827]
-
-Signed-off-by: Yew, Chang Ching <chang.ching.yew@intel.com>
----
- _studio/shared/include/mfxstructures-int.h | 16 +++++++++++++++-
- 1 file changed, 15 insertions(+), 1 deletion(-)
-
-diff --git a/_studio/shared/include/mfxstructures-int.h b/_studio/shared/include/mfxstructures-int.h
-index c76c8d2358..ad97a78d1d 100755
---- a/_studio/shared/include/mfxstructures-int.h
-+++ b/_studio/shared/include/mfxstructures-int.h
-@@ -434,8 +434,22 @@ typedef struct {
-
- /* ADL-P */
- { 0x46A0, MFX_HW_ADL_P, MFX_GT2 },//ADL-P
-+ { 0x46A1, MFX_HW_ADL_P, MFX_GT2 },//ADL-P
-+ { 0x46A3, MFX_HW_ADL_P, MFX_GT2 },//ADL-P
-+ { 0x46A6, MFX_HW_ADL_P, MFX_GT2 },//ADL-P
-+ { 0x4626, MFX_HW_ADL_P, MFX_GT2 },//ADL-P
-+
-+ { 0x46B0, MFX_HW_ADL_P, MFX_GT2 },//ADL-P
-+ { 0x46B1, MFX_HW_ADL_P, MFX_GT2 },//ADL-P
-+ { 0x46B3, MFX_HW_ADL_P, MFX_GT2 },//ADL-P
-+ { 0x46A8, MFX_HW_ADL_P, MFX_GT2 },//ADL-P
-+ { 0x4628, MFX_HW_ADL_P, MFX_GT2 },//ADL-P
-+
- { 0x46C0, MFX_HW_ADL_P, MFX_GT2 },//ADL-P
-- { 0x46E0, MFX_HW_ADL_P, MFX_GT2 },//ADL-P
-+ { 0x46C1, MFX_HW_ADL_P, MFX_GT2 },//ADL-P
-+ { 0x46C3, MFX_HW_ADL_P, MFX_GT2 },//ADL-P
-+ { 0x46AA, MFX_HW_ADL_P, MFX_GT2 },//ADL-P
-+ { 0x462A, MFX_HW_ADL_P, MFX_GT2 },//ADL-P
-
- };
-
---
-2.32.0
-
diff --git a/recipes-multimedia/onevpl/onevpl-intel-gpu_2021.2.3.bb b/recipes-multimedia/onevpl/onevpl-intel-gpu_2021.2.3.bb
deleted file mode 100644
index 80882427..00000000
--- a/recipes-multimedia/onevpl/onevpl-intel-gpu_2021.2.3.bb
+++ /dev/null
@@ -1,24 +0,0 @@
-SUMMARY = "Intel(R) oneVPL runtime for Intel GPU accelerated media processing"
-DESCRIPTION = "Intel(R) oneVPL runtime provides an runtime to access hardware-accelerated \
-video decode, encode and filtering on Intel® graphics."
-
-HOMEPAGE = "https://github.com/oneapi-src/oneVPL-intel-gpu"
-BUGTRACKER = "https://github.com/oneapi-src/oneVPL-intel-gpu/issues"
-
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=eb8cb45b9b57dbaa9fcc9adc4230202b"
-
-# Only for 64 bit
-COMPATIBLE_HOST = '(x86_64).*-linux'
-COMPATIBLE_HOST_x86-x32 = "null"
-
-DEPENDS += "libdrm libva intel-media-driver onevpl"
-
-SRC_URI = "git://github.com/oneapi-src/oneVPL-intel-gpu.git;protocol=https;branch=main;lfs=0 \
- file://0001-ADLP-add-new-device-id-list.patch \
- "
-
-SRCREV = "d6b0df4f058166cff31a360b77774f7410667be5"
-S = "${WORKDIR}/git"
-
-inherit cmake
diff --git a/recipes-multimedia/onevpl/onevpl/0001-Add-SMT-and-media_sdk_compatibility_headers.patch b/recipes-multimedia/onevpl/onevpl/0001-Add-SMT-and-media_sdk_compatibility_headers.patch
deleted file mode 100644
index fb832380..00000000
--- a/recipes-multimedia/onevpl/onevpl/0001-Add-SMT-and-media_sdk_compatibility_headers.patch
+++ /dev/null
@@ -1,12988 +0,0 @@
-From fffc477d33fb255c83202d68d43b485014f8db4f Mon Sep 17 00:00:00 2001
-From: Jeff McAllister <jeffrey.mcallister@intel.com>
-Date: Wed, 2 Jun 2021 13:20:59 +0800
-Subject: [PATCH] Add SMT and media_sdk_compatibility_headers
-
-Upstream-Status: Submitted
----
- tools/legacy/CMakeLists.txt | 2 +
- .../CMakeLists.txt | 11 +
- .../mfx_multi_vpp.h | 103 +
- .../mfxastructures.h | 169 +
- .../mfxaudio.h | 81 +
- .../mfxdeprecated.h | 167 +
- .../mfxplugin.h | 601 +++
- .../rotate_plugin_api.h | 29 +
- tools/legacy/sample_common/CMakeLists.txt | 4 +-
- .../sample_common/include/plugin_utils.h | 1 +
- .../sample_common/include/sample_utils.h | 5 +-
- .../sample_common/include/sample_utils.h.orig | 1437 +++++
- .../include/vpl_implementation_loader.h | 73 +
- .../legacy/sample_common/src/plugin_utils.cpp | 8 -
- .../src/vpl_implementation_loader.cpp | 220 +
- .../sample_multi_transcode/CMakeLists.txt | 42 +
- .../include/pipeline_transcode.h | 973 ++++
- .../include/sample_multi_transcode.h | 109 +
- .../include/transcode_utils.h | 111 +
- .../src/pipeline_transcode.cpp | 4668 +++++++++++++++++
- .../src/sample_multi_transcode.cpp | 1162 ++++
- .../src/transcode_utils.cpp | 2765 ++++++++++
- 22 files changed, 12730 insertions(+), 11 deletions(-)
- create mode 100644 tools/legacy/media_sdk_compatibility_headers/CMakeLists.txt
- create mode 100644 tools/legacy/media_sdk_compatibility_headers/mfx_multi_vpp.h
- create mode 100644 tools/legacy/media_sdk_compatibility_headers/mfxastructures.h
- create mode 100644 tools/legacy/media_sdk_compatibility_headers/mfxaudio.h
- create mode 100644 tools/legacy/media_sdk_compatibility_headers/mfxdeprecated.h
- create mode 100644 tools/legacy/media_sdk_compatibility_headers/mfxplugin.h
- create mode 100644 tools/legacy/media_sdk_compatibility_headers/rotate_plugin_api.h
- create mode 100644 tools/legacy/sample_common/include/sample_utils.h.orig
- create mode 100644 tools/legacy/sample_common/include/vpl_implementation_loader.h
- create mode 100644 tools/legacy/sample_common/src/vpl_implementation_loader.cpp
- create mode 100644 tools/legacy/sample_multi_transcode/CMakeLists.txt
- create mode 100644 tools/legacy/sample_multi_transcode/include/pipeline_transcode.h
- create mode 100644 tools/legacy/sample_multi_transcode/include/sample_multi_transcode.h
- create mode 100644 tools/legacy/sample_multi_transcode/include/transcode_utils.h
- create mode 100644 tools/legacy/sample_multi_transcode/src/pipeline_transcode.cpp
- create mode 100644 tools/legacy/sample_multi_transcode/src/sample_multi_transcode.cpp
- create mode 100644 tools/legacy/sample_multi_transcode/src/transcode_utils.cpp
-
-diff --git a/tools/legacy/CMakeLists.txt b/tools/legacy/CMakeLists.txt
-index 1d4af73..34ed0ec 100644
---- a/tools/legacy/CMakeLists.txt
-+++ b/tools/legacy/CMakeLists.txt
-@@ -7,8 +7,10 @@
-
- cmake_minimum_required(VERSION 3.10.2)
-
-+add_subdirectory(media_sdk_compatibility_headers)
- add_subdirectory(sample_common)
- add_subdirectory(sample_decode)
- add_subdirectory(sample_vpp)
- add_subdirectory(sample_encode)
- add_subdirectory(sample_misc/wayland)
-+add_subdirectory(sample_multi_transcode)
-diff --git a/tools/legacy/media_sdk_compatibility_headers/CMakeLists.txt b/tools/legacy/media_sdk_compatibility_headers/CMakeLists.txt
-new file mode 100644
-index 0000000..343255a
---- /dev/null
-+++ b/tools/legacy/media_sdk_compatibility_headers/CMakeLists.txt
-@@ -0,0 +1,11 @@
-+# ##############################################################################
-+# Copyright (C) Intel Corporation
-+#
-+# SPDX-License-Identifier: MIT
-+# ##############################################################################
-+cmake_minimum_required(VERSION 3.10.2)
-+
-+set(TARGET media_sdk_compatibility_headers)
-+
-+add_library(${TARGET} INTERFACE)
-+target_include_directories(${TARGET} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
-diff --git a/tools/legacy/media_sdk_compatibility_headers/mfx_multi_vpp.h b/tools/legacy/media_sdk_compatibility_headers/mfx_multi_vpp.h
-new file mode 100644
-index 0000000..d53bbac
---- /dev/null
-+++ b/tools/legacy/media_sdk_compatibility_headers/mfx_multi_vpp.h
-@@ -0,0 +1,103 @@
-+/******************************************************************************\
-+Copyright (c) 2005-2018, Intel Corporation
-+All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-+
-+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-+
-+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-+
-+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+This sample was distributed or derived from the Intel's Media Samples package.
-+The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
-+or https://software.intel.com/en-us/media-client-solutions-support.
-+\**********************************************************************************/
-+
-+#ifndef __MFX_MULTI_VPP_H
-+#define __MFX_MULTI_VPP_H
-+
-+#include "mfxvideo++.h"
-+// An interface for a pipeline consisting of multiple (maximum 3) VPP-like components. Base implementation - for single VPP.
-+// The application should use this interface to be able to seamlessly switch from MFXVideoVPP to MFXVideoVPPPlugin in the pipeline.
-+
-+class MFXVideoMultiVPP : public MFXVideoVPP {
-+public:
-+ MFXVideoMultiVPP(mfxSession session) : MFXVideoVPP(session) {}
-+ virtual ~MFXVideoMultiVPP(void) {
-+ Close();
-+ }
-+
-+ // topology methods
-+ virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) override {
-+ return QueryIOSurfMulti(par, request);
-+ }
-+ virtual mfxStatus QueryIOSurfMulti(mfxVideoParam *par,
-+ mfxFrameAllocRequest request[2],
-+ mfxVideoParam * /*par1*/ = NULL,
-+ mfxVideoParam * /*par2*/ = NULL) {
-+ return MFXVideoVPP_QueryIOSurf(m_session, par, request);
-+ }
-+
-+ virtual mfxStatus Init(mfxVideoParam *par) override {
-+ return InitMulti(par);
-+ }
-+ virtual mfxStatus InitMulti(mfxVideoParam *par,
-+ mfxVideoParam * /*par1*/ = NULL,
-+ mfxVideoParam * /*par2*/ = NULL) {
-+ return MFXVideoVPP_Init(m_session, par);
-+ }
-+
-+ virtual mfxStatus Reset(mfxVideoParam *par) override {
-+ return ResetMulti(par);
-+ }
-+ virtual mfxStatus ResetMulti(mfxVideoParam *par,
-+ mfxVideoParam * /*par1*/ = NULL,
-+ mfxVideoParam * /*par2*/ = NULL) {
-+ return MFXVideoVPP_Reset(m_session, par);
-+ }
-+
-+ virtual mfxStatus RunFrameVPPAsync(mfxFrameSurface1 *in,
-+ mfxFrameSurface1 *out,
-+ mfxExtVppAuxData *aux,
-+ mfxSyncPoint *syncp) override {
-+ return MFXVideoVPP_RunFrameVPPAsync(m_session, in, out, aux, syncp);
-+ }
-+
-+ virtual mfxStatus SyncOperation(mfxSyncPoint syncp, mfxU32 wait) {
-+ return MFXVideoCORE_SyncOperation(m_session, syncp, wait);
-+ }
-+
-+ virtual mfxStatus Close(void) override {
-+ return MFXVideoVPP_Close(m_session);
-+ }
-+
-+ // per-component methods
-+ virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) override {
-+ return QueryMulti(in, out);
-+ }
-+ virtual mfxStatus QueryMulti(mfxVideoParam *in,
-+ mfxVideoParam *out,
-+ mfxU8 /*component_idx*/ = 0) {
-+ return MFXVideoVPP_Query(m_session, in, out);
-+ }
-+
-+ virtual mfxStatus GetVideoParam(mfxVideoParam *par) override {
-+ return GetVideoParamMulti(par);
-+ }
-+ virtual mfxStatus GetVideoParamMulti(mfxVideoParam *par, mfxU8 /*component_idx*/ = 0) {
-+ return MFXVideoVPP_GetVideoParam(m_session, par);
-+ }
-+
-+ virtual mfxStatus GetVPPStat(mfxVPPStat *stat) override {
-+ return GetVPPStatMulti(stat);
-+ }
-+ virtual mfxStatus GetVPPStatMulti(mfxVPPStat *stat, mfxU8 /*component_idx*/ = 0) {
-+ return MFXVideoVPP_GetVPPStat(m_session, stat);
-+ }
-+};
-+
-+#endif //__MFX_MULTI_VPP_H
-diff --git a/tools/legacy/media_sdk_compatibility_headers/mfxastructures.h b/tools/legacy/media_sdk_compatibility_headers/mfxastructures.h
-new file mode 100644
-index 0000000..a66628c
---- /dev/null
-+++ b/tools/legacy/media_sdk_compatibility_headers/mfxastructures.h
-@@ -0,0 +1,169 @@
-+/*******************************************************************************
-+
-+Copyright (C) 2013-2019 Intel Corporation. All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without
-+modification, are permitted provided that the following conditions are met:
-+- Redistributions of source code must retain the above copyright notice,
-+this list of conditions and the following disclaimer.
-+- Redistributions in binary form must reproduce the above copyright notice,
-+this list of conditions and the following disclaimer in the documentation
-+and/or other materials provided with the distribution.
-+- Neither the name of Intel Corporation nor the names of its contributors
-+may be used to endorse or promote products derived from this software
-+without specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
-+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-+IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
-+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+File Name: mfxastructures.h
-+
-+*******************************************************************************/
-+#ifndef __MFXASTRUCTURES_H__
-+#define __MFXASTRUCTURES_H__
-+#include "vpl/mfxcommon.h"
-+
-+#if !defined(__GNUC__)
-+ #pragma warning(disable : 4201)
-+#endif
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif /* __cplusplus */
-+
-+/* CodecId */
-+enum {
-+ MFX_CODEC_AAC = MFX_MAKEFOURCC('A', 'A', 'C', ' '),
-+ MFX_CODEC_MP3 = MFX_MAKEFOURCC('M', 'P', '3', ' ')
-+};
-+
-+enum {
-+ /* AAC Profiles & Levels */
-+ MFX_PROFILE_AAC_LC = 2,
-+ MFX_PROFILE_AAC_LTP = 4,
-+ MFX_PROFILE_AAC_MAIN = 1,
-+ MFX_PROFILE_AAC_SSR = 3,
-+ MFX_PROFILE_AAC_HE = 5,
-+ MFX_PROFILE_AAC_ALS = 0x20,
-+ MFX_PROFILE_AAC_BSAC = 22,
-+ MFX_PROFILE_AAC_PS = 29,
-+
-+ /*MPEG AUDIO*/
-+ MFX_AUDIO_MPEG1_LAYER1 = 0x00000110,
-+ MFX_AUDIO_MPEG1_LAYER2 = 0x00000120,
-+ MFX_AUDIO_MPEG1_LAYER3 = 0x00000140,
-+ MFX_AUDIO_MPEG2_LAYER1 = 0x00000210,
-+ MFX_AUDIO_MPEG2_LAYER2 = 0x00000220,
-+ MFX_AUDIO_MPEG2_LAYER3 = 0x00000240
-+};
-+
-+/*AAC HE decoder down sampling*/
-+enum { MFX_AUDIO_AAC_HE_DWNSMPL_OFF = 0, MFX_AUDIO_AAC_HE_DWNSMPL_ON = 1 };
-+
-+/* AAC decoder support of PS */
-+enum {
-+ MFX_AUDIO_AAC_PS_DISABLE = 0,
-+ MFX_AUDIO_AAC_PS_PARSER = 1,
-+ MFX_AUDIO_AAC_PS_ENABLE_BL = 111,
-+ MFX_AUDIO_AAC_PS_ENABLE_UR = 411
-+};
-+
-+/*AAC decoder SBR support*/
-+enum { MFX_AUDIO_AAC_SBR_DISABLE = 0, MFX_AUDIO_AAC_SBR_ENABLE = 1, MFX_AUDIO_AAC_SBR_UNDEF = 2 };
-+
-+/*AAC header type*/
-+enum {
-+ MFX_AUDIO_AAC_ADTS = 1,
-+ MFX_AUDIO_AAC_ADIF = 2,
-+ MFX_AUDIO_AAC_RAW = 3,
-+};
-+
-+/*AAC encoder stereo mode*/
-+enum {
-+ MFX_AUDIO_AAC_MONO = 0,
-+ MFX_AUDIO_AAC_LR_STEREO = 1,
-+ MFX_AUDIO_AAC_MS_STEREO = 2,
-+ MFX_AUDIO_AAC_JOINT_STEREO = 3
-+};
-+
-+MFX_PACK_BEGIN_USUAL_STRUCT()
-+typedef struct {
-+ mfxU32 CodecId;
-+ mfxU16 CodecProfile;
-+ mfxU16 CodecLevel;
-+
-+ mfxU32 Bitrate;
-+ mfxU32 SampleFrequency;
-+ mfxU16 NumChannel;
-+ mfxU16 BitPerSample;
-+
-+ mfxU16 reserved1[22];
-+
-+ union {
-+ struct { /* AAC Decoding Options */
-+ mfxU16 FlagPSSupportLev;
-+ mfxU16 Layer;
-+ mfxU16 AACHeaderDataSize;
-+ mfxU8 AACHeaderData[64];
-+ };
-+ struct { /* AAC Encoding Options */
-+ mfxU16 OutputFormat;
-+ mfxU16 StereoMode;
-+ mfxU16 reserved2[61];
-+ };
-+ };
-+} mfxAudioInfoMFX;
-+MFX_PACK_END()
-+
-+MFX_PACK_BEGIN_STRUCT_W_PTR()
-+typedef struct {
-+ mfxU16 AsyncDepth;
-+ mfxU16 Protected;
-+ mfxU16 reserved[14];
-+
-+ mfxAudioInfoMFX mfx;
-+ mfxExtBuffer** ExtParam;
-+ mfxU16 NumExtParam;
-+} mfxAudioParam;
-+MFX_PACK_END()
-+
-+MFX_PACK_BEGIN_USUAL_STRUCT()
-+typedef struct {
-+ mfxU32 SuggestedInputSize;
-+ mfxU32 SuggestedOutputSize;
-+ mfxU32 reserved[6];
-+} mfxAudioAllocRequest;
-+MFX_PACK_END()
-+
-+MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
-+typedef struct {
-+ mfxU64 TimeStamp; /* 1/90KHz */
-+ mfxU16 Locked;
-+ mfxU16 NumChannels;
-+ mfxU32 SampleFrequency;
-+ mfxU16 BitPerSample;
-+ mfxU16 reserved1[7];
-+
-+ mfxU8* Data;
-+ mfxU32 reserved2;
-+ mfxU32 DataLength;
-+ mfxU32 MaxLength;
-+
-+ mfxU32 NumExtParam;
-+ mfxExtBuffer** ExtParam;
-+} mfxAudioFrame;
-+MFX_PACK_END()
-+
-+#ifdef __cplusplus
-+}
-+#endif /* __cplusplus */
-+
-+#endif
-diff --git a/tools/legacy/media_sdk_compatibility_headers/mfxaudio.h b/tools/legacy/media_sdk_compatibility_headers/mfxaudio.h
-new file mode 100644
-index 0000000..b252d98
---- /dev/null
-+++ b/tools/legacy/media_sdk_compatibility_headers/mfxaudio.h
-@@ -0,0 +1,81 @@
-+/*******************************************************************************
-+
-+Copyright (C) 2013 Intel Corporation. All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without
-+modification, are permitted provided that the following conditions are met:
-+- Redistributions of source code must retain the above copyright notice,
-+this list of conditions and the following disclaimer.
-+- Redistributions in binary form must reproduce the above copyright notice,
-+this list of conditions and the following disclaimer in the documentation
-+and/or other materials provided with the distribution.
-+- Neither the name of Intel Corporation nor the names of its contributors
-+may be used to endorse or promote products derived from this software
-+without specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
-+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-+IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
-+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+File Name: mfxaudio.h
-+
-+*******************************************************************************/
-+
-+#ifndef __MFXAUDIO_H__
-+#define __MFXAUDIO_H__
-+#include "mfxastructures.h"
-+#include "vpl/mfxsession.h"
-+
-+#define MFX_AUDIO_VERSION_MAJOR 1
-+#define MFX_AUDIO_VERSION_MINOR 15
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+/* AudioCORE */
-+mfxStatus MFX_CDECL MFXAudioCORE_SyncOperation(mfxSession session, mfxSyncPoint syncp, mfxU32 wait);
-+
-+/* AudioENCODE */
-+mfxStatus MFX_CDECL MFXAudioENCODE_Query(mfxSession session, mfxAudioParam *in, mfxAudioParam *out);
-+mfxStatus MFX_CDECL MFXAudioENCODE_QueryIOSize(mfxSession session,
-+ mfxAudioParam *par,
-+ mfxAudioAllocRequest *request);
-+mfxStatus MFX_CDECL MFXAudioENCODE_Init(mfxSession session, mfxAudioParam *par);
-+mfxStatus MFX_CDECL MFXAudioENCODE_Reset(mfxSession session, mfxAudioParam *par);
-+mfxStatus MFX_CDECL MFXAudioENCODE_Close(mfxSession session);
-+mfxStatus MFX_CDECL MFXAudioENCODE_GetAudioParam(mfxSession session, mfxAudioParam *par);
-+mfxStatus MFX_CDECL MFXAudioENCODE_EncodeFrameAsync(mfxSession session,
-+ mfxAudioFrame *frame,
-+ mfxBitstream *bs,
-+ mfxSyncPoint *syncp);
-+
-+/* AudioDECODE */
-+mfxStatus MFX_CDECL MFXAudioDECODE_Query(mfxSession session, mfxAudioParam *in, mfxAudioParam *out);
-+mfxStatus MFX_CDECL MFXAudioDECODE_DecodeHeader(mfxSession session,
-+ mfxBitstream *bs,
-+ mfxAudioParam *par);
-+mfxStatus MFX_CDECL MFXAudioDECODE_Init(mfxSession session, mfxAudioParam *par);
-+mfxStatus MFX_CDECL MFXAudioDECODE_Reset(mfxSession session, mfxAudioParam *par);
-+mfxStatus MFX_CDECL MFXAudioDECODE_Close(mfxSession session);
-+mfxStatus MFX_CDECL MFXAudioDECODE_QueryIOSize(mfxSession session,
-+ mfxAudioParam *par,
-+ mfxAudioAllocRequest *request);
-+mfxStatus MFX_CDECL MFXAudioDECODE_GetAudioParam(mfxSession session, mfxAudioParam *par);
-+mfxStatus MFX_CDECL MFXAudioDECODE_DecodeFrameAsync(mfxSession session,
-+ mfxBitstream *bs,
-+ mfxAudioFrame *frame,
-+ mfxSyncPoint *syncp);
-+
-+#ifdef __cplusplus
-+} // extern "C"
-+#endif
-+
-+#endif
-diff --git a/tools/legacy/media_sdk_compatibility_headers/mfxdeprecated.h b/tools/legacy/media_sdk_compatibility_headers/mfxdeprecated.h
-new file mode 100644
-index 0000000..5f0ca24
---- /dev/null
-+++ b/tools/legacy/media_sdk_compatibility_headers/mfxdeprecated.h
-@@ -0,0 +1,167 @@
-+/*############################################################################
-+ # Copyright (C) 2020 Intel Corporation
-+ #
-+ # SPDX-License-Identifier: MIT
-+ ############################################################################*/
-+
-+#ifndef __MFXDEPRECATED_H__
-+#define __MFXDEPRECATED_H__
-+
-+#include "vpl/mfxcommon.h"
-+#include "vpl/mfxsession.h"
-+#include "vpl/mfxstructures.h"
-+
-+#if defined(MFX_ONEVPL)
-+
-+ #ifdef __cplusplus
-+extern "C" {
-+ #endif /* __cplusplus */
-+
-+enum {
-+ MFX_ERR_INCOMPATIBLE_AUDIO_PARAM = -19, /* incompatible audio parameters */
-+ MFX_ERR_INVALID_AUDIO_PARAM = -20, /* invalid audio parameters */
-+
-+ MFX_WRN_INCOMPATIBLE_AUDIO_PARAM = 11, /* incompatible audio parameters */
-+};
-+
-+mfxStatus MFX_CDECL MFXVideoVPP_RunFrameVPPAsyncEx(mfxSession session,
-+ mfxFrameSurface1 *in,
-+ mfxFrameSurface1 *surface_work,
-+ mfxFrameSurface1 **surface_out,
-+ mfxSyncPoint *syncp);
-+
-+MFX_PACK_BEGIN_STRUCT_W_PTR()
-+typedef struct {
-+ mfxU32 reserved[4];
-+ mfxHDL pthis;
-+ mfxStatus(MFX_CDECL *Alloc)(mfxHDL pthis, mfxU32 nbytes, mfxU16 type, mfxMemId *mid);
-+ mfxStatus(MFX_CDECL *Lock)(mfxHDL pthis, mfxMemId mid, mfxU8 **ptr);
-+ mfxStatus(MFX_CDECL *Unlock)(mfxHDL pthis, mfxMemId mid);
-+ mfxStatus(MFX_CDECL *Free)(mfxHDL pthis, mfxMemId mid);
-+} mfxBufferAllocator;
-+MFX_PACK_END()
-+
-+mfxStatus MFX_CDECL MFXVideoCORE_SetBufferAllocator(mfxSession session,
-+ mfxBufferAllocator *allocator);
-+
-+ #if defined(MFX_ENABLE_OPAQUE_MEMORY)
-+ //Sanity check
-+ #error MFX_ENABLE_OPAQUE_MEMORY should not be defined when 'mfxdeprecated.h' is included
-+ #endif //MFX_ENABLE_OPAQUE_MEMORY
-+
-+/* IOPattern */
-+enum { MFX_IOPATTERN_IN_OPAQUE_MEMORY = 0x04, MFX_IOPATTERN_OUT_OPAQUE_MEMORY = 0x40 };
-+
-+enum { MFX_MEMTYPE_OPAQUE_FRAME = 0x0004 };
-+
-+/* Extended Buffer Ids */
-+enum { MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION = MFX_MAKEFOURCC('O', 'P', 'Q', 'S') };
-+
-+MFX_PACK_BEGIN_STRUCT_W_PTR()
-+typedef struct {
-+ mfxExtBuffer Header;
-+ mfxU32 reserved1[2];
-+ struct {
-+ mfxFrameSurface1 **Surfaces;
-+ mfxU32 reserved2[5];
-+ mfxU16 Type;
-+ mfxU16 NumSurface;
-+ } In, Out;
-+} mfxExtOpaqueSurfaceAlloc;
-+MFX_PACK_END()
-+
-+mfxStatus MFX_CDECL MFXDoWork(mfxSession session);
-+
-+mfxStatus MFX_CDECL MFXVideoENC_Query(mfxSession session, mfxVideoParam *in, mfxVideoParam *out);
-+mfxStatus MFX_CDECL MFXVideoENC_QueryIOSurf(mfxSession session,
-+ mfxVideoParam *par,
-+ mfxFrameAllocRequest *request);
-+mfxStatus MFX_CDECL MFXVideoENC_Init(mfxSession session, mfxVideoParam *par);
-+mfxStatus MFX_CDECL MFXVideoENC_Reset(mfxSession session, mfxVideoParam *par);
-+mfxStatus MFX_CDECL MFXVideoENC_Close(mfxSession session);
-+
-+typedef struct _mfxENCInput {
-+} mfxENCInput;
-+typedef struct _mfxENCOutput {
-+} mfxENCOutput;
-+mfxStatus MFX_CDECL MFXVideoENC_ProcessFrameAsync(mfxSession session,
-+ mfxENCInput *in,
-+ mfxENCOutput *out,
-+ mfxSyncPoint *syncp);
-+
-+mfxStatus MFX_CDECL MFXVideoENC_GetVideoParam(mfxSession session, mfxVideoParam *par);
-+
-+MFX_PACK_BEGIN_STRUCT_W_PTR()
-+typedef struct {
-+} mfxPAKInput;
-+MFX_PACK_END()
-+
-+MFX_PACK_BEGIN_STRUCT_W_PTR()
-+typedef struct {
-+} mfxPAKOutput;
-+MFX_PACK_END()
-+
-+mfxStatus MFX_CDECL MFXVideoPAK_Query(mfxSession session, mfxVideoParam *in, mfxVideoParam *out);
-+mfxStatus MFX_CDECL MFXVideoPAK_QueryIOSurf(mfxSession session,
-+ mfxVideoParam *par,
-+ mfxFrameAllocRequest request[2]);
-+mfxStatus MFX_CDECL MFXVideoPAK_Init(mfxSession session, mfxVideoParam *par);
-+mfxStatus MFX_CDECL MFXVideoPAK_Reset(mfxSession session, mfxVideoParam *par);
-+mfxStatus MFX_CDECL MFXVideoPAK_Close(mfxSession session);
-+
-+mfxStatus MFX_CDECL MFXVideoPAK_ProcessFrameAsync(mfxSession session,
-+ mfxPAKInput *in,
-+ mfxPAKOutput *out,
-+ mfxSyncPoint *syncp);
-+
-+mfxStatus MFX_CDECL MFXVideoPAK_GetVideoParam(mfxSession session, mfxVideoParam *par);
-+
-+enum {
-+ /*!
-+ This extended buffer allow to specify multi-frame submission parameters.
-+ */
-+ MFX_EXTBUFF_MULTI_FRAME_PARAM = MFX_MAKEFOURCC('M', 'F', 'R', 'P'),
-+ /*!
-+ This extended buffer allow to manage multi-frame submission in runtime.
-+ */
-+ MFX_EXTBUFF_MULTI_FRAME_CONTROL = MFX_MAKEFOURCC('M', 'F', 'R', 'C'),
-+};
-+
-+/* Multi-Frame Mode */
-+enum { MFX_MF_DEFAULT = 0, MFX_MF_DISABLED = 1, MFX_MF_AUTO = 2, MFX_MF_MANUAL = 3 };
-+
-+/* Multi-Frame Initialization parameters */
-+MFX_PACK_BEGIN_USUAL_STRUCT()
-+typedef struct {
-+ mfxExtBuffer Header;
-+
-+ mfxU16 MFMode;
-+ mfxU16 MaxNumFrames;
-+
-+ mfxU16 reserved[58];
-+} mfxExtMultiFrameParam;
-+MFX_PACK_END()
-+
-+/* Multi-Frame Run-time controls */
-+MFX_PACK_BEGIN_USUAL_STRUCT()
-+typedef struct {
-+ mfxExtBuffer Header;
-+
-+ mfxU32 Timeout; /* timeout in millisecond */
-+ mfxU16 Flush; /* Flush internal frame buffer, e.g. submit all collected frames. */
-+
-+ mfxU16 reserved[57];
-+} mfxExtMultiFrameControl;
-+MFX_PACK_END()
-+
-+/* RateControlMethod */
-+enum {
-+ MFX_RATECONTROL_LA_EXT = 12,
-+ MFX_RATECONTROL_VME = 15,
-+};
-+ #ifdef __cplusplus
-+}
-+ #endif /* __cplusplus */
-+
-+#endif //MFX_ONEVPL
-+#endif //__MFXDEPRECATED_H__
-diff --git a/tools/legacy/media_sdk_compatibility_headers/mfxplugin.h b/tools/legacy/media_sdk_compatibility_headers/mfxplugin.h
-new file mode 100644
-index 0000000..2c42433
---- /dev/null
-+++ b/tools/legacy/media_sdk_compatibility_headers/mfxplugin.h
-@@ -0,0 +1,601 @@
-+/******************************************************************************* *\
-+
-+Copyright (C) 2007-2019 Intel Corporation. All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without
-+modification, are permitted provided that the following conditions are met:
-+- Redistributions of source code must retain the above copyright notice,
-+this list of conditions and the following disclaimer.
-+- Redistributions in binary form must reproduce the above copyright notice,
-+this list of conditions and the following disclaimer in the documentation
-+and/or other materials provided with the distribution.
-+- Neither the name of Intel Corporation nor the names of its contributors
-+may be used to endorse or promote products derived from this software
-+without specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
-+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-+IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
-+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+File Name: mfxplugin.h
-+
-+*******************************************************************************/
-+#ifndef __MFXPLUGIN_H__
-+#define __MFXPLUGIN_H__
-+#include "mfxaudio.h"
-+#include "mfxdeprecated.h"
-+#include "vpl/mfxvideo.h"
-+#ifdef __cplusplus
-+extern "C" {
-+#endif /* __cplusplus */
-+
-+MFX_PACK_BEGIN_USUAL_STRUCT()
-+typedef struct {
-+ mfxU8 Data[16];
-+} mfxPluginUID;
-+MFX_PACK_END()
-+
-+static const mfxPluginUID MFX_PLUGINID_HEVCD_SW = { { 0x15,
-+ 0xdd,
-+ 0x93,
-+ 0x68,
-+ 0x25,
-+ 0xad,
-+ 0x47,
-+ 0x5e,
-+ 0xa3,
-+ 0x4e,
-+ 0x35,
-+ 0xf3,
-+ 0xf5,
-+ 0x42,
-+ 0x17,
-+ 0xa6 } };
-+static const mfxPluginUID MFX_PLUGINID_HEVCD_HW = { { 0x33,
-+ 0xa6,
-+ 0x1c,
-+ 0x0b,
-+ 0x4c,
-+ 0x27,
-+ 0x45,
-+ 0x4c,
-+ 0xa8,
-+ 0xd8,
-+ 0x5d,
-+ 0xde,
-+ 0x75,
-+ 0x7c,
-+ 0x6f,
-+ 0x8e } };
-+static const mfxPluginUID MFX_PLUGINID_HEVCE_SW = { { 0x2f,
-+ 0xca,
-+ 0x99,
-+ 0x74,
-+ 0x9f,
-+ 0xdb,
-+ 0x49,
-+ 0xae,
-+ 0xb1,
-+ 0x21,
-+ 0xa5,
-+ 0xb6,
-+ 0x3e,
-+ 0xf5,
-+ 0x68,
-+ 0xf7 } };
-+static const mfxPluginUID MFX_PLUGINID_HEVCE_GACC = { { 0xe5,
-+ 0x40,
-+ 0x0a,
-+ 0x06,
-+ 0xc7,
-+ 0x4d,
-+ 0x41,
-+ 0xf5,
-+ 0xb1,
-+ 0x2d,
-+ 0x43,
-+ 0x0b,
-+ 0xba,
-+ 0xa2,
-+ 0x3d,
-+ 0x0b } };
-+static const mfxPluginUID MFX_PLUGINID_HEVCE_DP_GACC = { { 0x2b,
-+ 0xad,
-+ 0x6f,
-+ 0x9d,
-+ 0x77,
-+ 0x54,
-+ 0x41,
-+ 0x2d,
-+ 0xbf,
-+ 0x63,
-+ 0x03,
-+ 0xed,
-+ 0x4b,
-+ 0xb5,
-+ 0x09,
-+ 0x68 } };
-+static const mfxPluginUID MFX_PLUGINID_HEVCE_HW = { { 0x6f,
-+ 0xad,
-+ 0xc7,
-+ 0x91,
-+ 0xa0,
-+ 0xc2,
-+ 0xeb,
-+ 0x47,
-+ 0x9a,
-+ 0xb6,
-+ 0xdc,
-+ 0xd5,
-+ 0xea,
-+ 0x9d,
-+ 0xa3,
-+ 0x47 } };
-+static const mfxPluginUID MFX_PLUGINID_VP8D_HW = { { 0xf6,
-+ 0x22,
-+ 0x39,
-+ 0x4d,
-+ 0x8d,
-+ 0x87,
-+ 0x45,
-+ 0x2f,
-+ 0x87,
-+ 0x8c,
-+ 0x51,
-+ 0xf2,
-+ 0xfc,
-+ 0x9b,
-+ 0x41,
-+ 0x31 } };
-+static const mfxPluginUID MFX_PLUGINID_VP8E_HW = { { 0xbf,
-+ 0xfc,
-+ 0x51,
-+ 0x8c,
-+ 0xde,
-+ 0x13,
-+ 0x4d,
-+ 0xf9,
-+ 0x8a,
-+ 0x96,
-+ 0xf4,
-+ 0xcf,
-+ 0x81,
-+ 0x6c,
-+ 0x0f,
-+ 0xac } };
-+static const mfxPluginUID MFX_PLUGINID_VP9E_HW = { { 0xce,
-+ 0x44,
-+ 0xef,
-+ 0x6f,
-+ 0x1a,
-+ 0x6d,
-+ 0x22,
-+ 0x46,
-+ 0xb4,
-+ 0x12,
-+ 0xbb,
-+ 0x38,
-+ 0xd6,
-+ 0xe4,
-+ 0x51,
-+ 0x82 } };
-+static const mfxPluginUID MFX_PLUGINID_VP9D_HW = { { 0xa9,
-+ 0x22,
-+ 0x39,
-+ 0x4d,
-+ 0x8d,
-+ 0x87,
-+ 0x45,
-+ 0x2f,
-+ 0x87,
-+ 0x8c,
-+ 0x51,
-+ 0xf2,
-+ 0xfc,
-+ 0x9b,
-+ 0x41,
-+ 0x31 } };
-+static const mfxPluginUID MFX_PLUGINID_CAMERA_HW = { { 0x54,
-+ 0x54,
-+ 0x26,
-+ 0x16,
-+ 0x24,
-+ 0x33,
-+ 0x41,
-+ 0xe6,
-+ 0x93,
-+ 0xae,
-+ 0x89,
-+ 0x99,
-+ 0x42,
-+ 0xce,
-+ 0x73,
-+ 0x55 } };
-+static const mfxPluginUID MFX_PLUGINID_CAPTURE_HW = { { 0x22,
-+ 0xd6,
-+ 0x2c,
-+ 0x07,
-+ 0xe6,
-+ 0x72,
-+ 0x40,
-+ 0x8f,
-+ 0xbb,
-+ 0x4c,
-+ 0xc2,
-+ 0x0e,
-+ 0xd7,
-+ 0xa0,
-+ 0x53,
-+ 0xe4 } };
-+static const mfxPluginUID MFX_PLUGINID_ITELECINE_HW = { { 0xe7,
-+ 0x44,
-+ 0x75,
-+ 0x3a,
-+ 0xcd,
-+ 0x74,
-+ 0x40,
-+ 0x2e,
-+ 0x89,
-+ 0xa2,
-+ 0xee,
-+ 0x06,
-+ 0x35,
-+ 0x49,
-+ 0x61,
-+ 0x79 } };
-+static const mfxPluginUID MFX_PLUGINID_H264LA_HW = { { 0x58,
-+ 0x8f,
-+ 0x11,
-+ 0x85,
-+ 0xd4,
-+ 0x7b,
-+ 0x42,
-+ 0x96,
-+ 0x8d,
-+ 0xea,
-+ 0x37,
-+ 0x7b,
-+ 0xb5,
-+ 0xd0,
-+ 0xdc,
-+ 0xb4 } };
-+static const mfxPluginUID MFX_PLUGINID_AACD = { { 0xe9,
-+ 0x34,
-+ 0x67,
-+ 0x25,
-+ 0xac,
-+ 0x2f,
-+ 0x4c,
-+ 0x93,
-+ 0xaa,
-+ 0x58,
-+ 0x5c,
-+ 0x11,
-+ 0xc7,
-+ 0x08,
-+ 0x7c,
-+ 0xf4 } };
-+static const mfxPluginUID MFX_PLUGINID_AACE = { { 0xb2,
-+ 0xa2,
-+ 0xa0,
-+ 0x5a,
-+ 0x4e,
-+ 0xac,
-+ 0x46,
-+ 0xbf,
-+ 0xa9,
-+ 0xde,
-+ 0x7e,
-+ 0x80,
-+ 0xc9,
-+ 0x8d,
-+ 0x2e,
-+ 0x18 } };
-+static const mfxPluginUID MFX_PLUGINID_HEVCE_FEI_HW = { { 0x87,
-+ 0xe0,
-+ 0xe8,
-+ 0x02,
-+ 0x07,
-+ 0x37,
-+ 0x52,
-+ 0x40,
-+ 0x85,
-+ 0x25,
-+ 0x15,
-+ 0xcf,
-+ 0x4a,
-+ 0x5e,
-+ 0xdd,
-+ 0xe6 } };
-+#if (MFX_VERSION >= 1027)
-+static const mfxPluginUID MFX_PLUGINID_HEVC_FEI_ENCODE = { { 0x54,
-+ 0x18,
-+ 0xa7,
-+ 0x06,
-+ 0x66,
-+ 0xf9,
-+ 0x4d,
-+ 0x5c,
-+ 0xb4,
-+ 0xf7,
-+ 0xb1,
-+ 0xca,
-+ 0xee,
-+ 0x86,
-+ 0x33,
-+ 0x9b } };
-+#endif
-+#if !defined(OPEN_SOURCE)
-+static const mfxPluginUID MFX_PLUGINID_AV1D_SW = { { 0x93,
-+ 0x6c,
-+ 0x26,
-+ 0xe8,
-+ 0xf9,
-+ 0xb5,
-+ 0x45,
-+ 0xdc,
-+ 0xad,
-+ 0xac,
-+ 0xe8,
-+ 0xcc,
-+ 0xeb,
-+ 0x8a,
-+ 0x57,
-+ 0xa9 } };
-+static const mfxPluginUID MFX_PLUGINID_AV1D_HW = { { 0x07,
-+ 0x49,
-+ 0xdf,
-+ 0x10,
-+ 0x72,
-+ 0x66,
-+ 0x4f,
-+ 0x1d,
-+ 0x8d,
-+ 0x77,
-+ 0x29,
-+ 0x8e,
-+ 0xb2,
-+ 0x97,
-+ 0x5c,
-+ 0x3c } };
-+static const mfxPluginUID MFX_PLUGINID_AV1E_GACC = { { 0x34,
-+ 0x3d,
-+ 0x68,
-+ 0x96,
-+ 0x65,
-+ 0xba,
-+ 0x45,
-+ 0x48,
-+ 0x82,
-+ 0x99,
-+ 0x42,
-+ 0xa3,
-+ 0x2a,
-+ 0x38,
-+ 0x65,
-+ 0x69 } };
-+#endif
-+
-+typedef enum {
-+ MFX_PLUGINTYPE_VIDEO_GENERAL = 0,
-+ MFX_PLUGINTYPE_VIDEO_DECODE = 1,
-+ MFX_PLUGINTYPE_VIDEO_ENCODE = 2,
-+ MFX_PLUGINTYPE_VIDEO_VPP = 3,
-+ MFX_PLUGINTYPE_VIDEO_ENC = 4,
-+ MFX_PLUGINTYPE_AUDIO_DECODE = 5,
-+ MFX_PLUGINTYPE_AUDIO_ENCODE = 6
-+} mfxPluginType;
-+
-+typedef enum { MFX_THREADPOLICY_SERIAL = 0, MFX_THREADPOLICY_PARALLEL = 1 } mfxThreadPolicy;
-+
-+MFX_PACK_BEGIN_USUAL_STRUCT()
-+typedef struct mfxPluginParam {
-+ mfxU32 reserved[6];
-+ mfxU16 reserved1;
-+ mfxU16 PluginVersion;
-+ mfxVersion APIVersion;
-+ mfxPluginUID PluginUID;
-+ mfxU32 Type;
-+ mfxU32 CodecId;
-+ mfxThreadPolicy ThreadPolicy;
-+ mfxU32 MaxThreadNum;
-+} mfxPluginParam;
-+MFX_PACK_END()
-+
-+MFX_PACK_BEGIN_USUAL_STRUCT()
-+typedef struct mfxCoreParam {
-+ mfxU32 reserved[13];
-+ mfxIMPL Impl;
-+ mfxVersion Version;
-+ mfxU32 NumWorkingThread;
-+} mfxCoreParam;
-+MFX_PACK_END()
-+
-+MFX_PACK_BEGIN_STRUCT_W_PTR()
-+typedef struct mfxCoreInterface {
-+ mfxHDL pthis;
-+
-+ mfxHDL reserved1[2];
-+ mfxFrameAllocator FrameAllocator;
-+ //mfxBufferAllocator reserved3;
-+
-+ mfxStatus(MFX_CDECL *GetCoreParam)(mfxHDL pthis, mfxCoreParam *par);
-+ mfxStatus(MFX_CDECL *GetHandle)(mfxHDL pthis, mfxHandleType type, mfxHDL *handle);
-+ mfxStatus(MFX_CDECL *IncreaseReference)(mfxHDL pthis, mfxFrameData *fd);
-+ mfxStatus(MFX_CDECL *DecreaseReference)(mfxHDL pthis, mfxFrameData *fd);
-+ mfxStatus(MFX_CDECL *CopyFrame)(mfxHDL pthis, mfxFrameSurface1 *dst, mfxFrameSurface1 *src);
-+ mfxStatus(MFX_CDECL *CopyBuffer)(mfxHDL pthis, mfxU8 *dst, mfxU32 size, mfxFrameSurface1 *src);
-+
-+ mfxStatus(MFX_CDECL *MapOpaqueSurface)(mfxHDL pthis,
-+ mfxU32 num,
-+ mfxU32 type,
-+ mfxFrameSurface1 **op_surf);
-+ mfxStatus(MFX_CDECL *UnmapOpaqueSurface)(mfxHDL pthis,
-+ mfxU32 num,
-+ mfxU32 type,
-+ mfxFrameSurface1 **op_surf);
-+
-+ mfxStatus(MFX_CDECL *GetRealSurface)(mfxHDL pthis,
-+ mfxFrameSurface1 *op_surf,
-+ mfxFrameSurface1 **surf);
-+ mfxStatus(MFX_CDECL *GetOpaqueSurface)(mfxHDL pthis,
-+ mfxFrameSurface1 *surf,
-+ mfxFrameSurface1 **op_surf);
-+
-+ mfxStatus(MFX_CDECL *CreateAccelerationDevice)(mfxHDL pthis,
-+ mfxHandleType type,
-+ mfxHDL *handle);
-+ mfxStatus(MFX_CDECL *GetFrameHandle)(mfxHDL pthis, mfxFrameData *fd, mfxHDL *handle);
-+ mfxStatus(MFX_CDECL *QueryPlatform)(mfxHDL pthis, mfxPlatform *platform);
-+
-+ mfxHDL reserved4[1];
-+} mfxCoreInterface;
-+MFX_PACK_END()
-+
-+MFX_PACK_BEGIN_STRUCT_W_PTR()
-+/* video codec plugin extension */
-+typedef struct _mfxENCInput mfxENCInput;
-+typedef struct _mfxENCOutput mfxENCOutput;
-+typedef struct mfxVideoCodecPlugin {
-+ mfxStatus(MFX_CDECL *Query)(mfxHDL pthis, mfxVideoParam *in, mfxVideoParam *out);
-+ mfxStatus(MFX_CDECL *QueryIOSurf)(mfxHDL pthis,
-+ mfxVideoParam *par,
-+ mfxFrameAllocRequest *in,
-+ mfxFrameAllocRequest *out);
-+ mfxStatus(MFX_CDECL *Init)(mfxHDL pthis, mfxVideoParam *par);
-+ mfxStatus(MFX_CDECL *Reset)(mfxHDL pthis, mfxVideoParam *par);
-+ mfxStatus(MFX_CDECL *Close)(mfxHDL pthis);
-+ mfxStatus(MFX_CDECL *GetVideoParam)(mfxHDL pthis, mfxVideoParam *par);
-+
-+ mfxStatus(MFX_CDECL *EncodeFrameSubmit)(mfxHDL pthis,
-+ mfxEncodeCtrl *ctrl,
-+ mfxFrameSurface1 *surface,
-+ mfxBitstream *bs,
-+ mfxThreadTask *task);
-+
-+ mfxStatus(MFX_CDECL *DecodeHeader)(mfxHDL pthis, mfxBitstream *bs, mfxVideoParam *par);
-+ mfxStatus(MFX_CDECL *GetPayload)(mfxHDL pthis, mfxU64 *ts, mfxPayload *payload);
-+ mfxStatus(MFX_CDECL *DecodeFrameSubmit)(mfxHDL pthis,
-+ mfxBitstream *bs,
-+ mfxFrameSurface1 *surface_work,
-+ mfxFrameSurface1 **surface_out,
-+ mfxThreadTask *task);
-+
-+ mfxStatus(MFX_CDECL *VPPFrameSubmit)(mfxHDL pthis,
-+ mfxFrameSurface1 *in,
-+ mfxFrameSurface1 *out,
-+ mfxExtVppAuxData *aux,
-+ mfxThreadTask *task);
-+ mfxStatus(MFX_CDECL *VPPFrameSubmitEx)(mfxHDL pthis,
-+ mfxFrameSurface1 *in,
-+ mfxFrameSurface1 *surface_work,
-+ mfxFrameSurface1 **surface_out,
-+ mfxThreadTask *task);
-+
-+ mfxStatus(MFX_CDECL *ENCFrameSubmit)(mfxHDL pthis,
-+ mfxENCInput *in,
-+ mfxENCOutput *out,
-+ mfxThreadTask *task);
-+
-+ mfxHDL reserved1[3];
-+ mfxU32 reserved2[8];
-+} mfxVideoCodecPlugin;
-+MFX_PACK_END()
-+
-+MFX_PACK_BEGIN_STRUCT_W_PTR()
-+typedef struct mfxAudioCodecPlugin {
-+ mfxStatus(MFX_CDECL *Query)(mfxHDL pthis, mfxAudioParam *in, mfxAudioParam *out);
-+ mfxStatus(MFX_CDECL *QueryIOSize)(mfxHDL pthis,
-+ mfxAudioParam *par,
-+ mfxAudioAllocRequest *request);
-+ mfxStatus(MFX_CDECL *Init)(mfxHDL pthis, mfxAudioParam *par);
-+ mfxStatus(MFX_CDECL *Reset)(mfxHDL pthis, mfxAudioParam *par);
-+ mfxStatus(MFX_CDECL *Close)(mfxHDL pthis);
-+ mfxStatus(MFX_CDECL *GetAudioParam)(mfxHDL pthis, mfxAudioParam *par);
-+
-+ mfxStatus(MFX_CDECL *EncodeFrameSubmit)(mfxHDL pthis,
-+ mfxAudioFrame *aFrame,
-+ mfxBitstream *out,
-+ mfxThreadTask *task);
-+
-+ mfxStatus(MFX_CDECL *DecodeHeader)(mfxHDL pthis, mfxBitstream *bs, mfxAudioParam *par);
-+ // mfxStatus (MFX_CDECL *GetPayload)(mfxHDL pthis, mfxU64 *ts, mfxPayload *payload);
-+ mfxStatus(MFX_CDECL *DecodeFrameSubmit)(mfxHDL pthis,
-+ mfxBitstream *in,
-+ mfxAudioFrame *out,
-+ mfxThreadTask *task);
-+
-+ mfxHDL reserved1[6];
-+ mfxU32 reserved2[8];
-+} mfxAudioCodecPlugin;
-+MFX_PACK_END()
-+
-+MFX_PACK_BEGIN_STRUCT_W_PTR()
-+typedef struct mfxPlugin {
-+ mfxHDL pthis;
-+
-+ mfxStatus(MFX_CDECL *PluginInit)(mfxHDL pthis, mfxCoreInterface *core);
-+ mfxStatus(MFX_CDECL *PluginClose)(mfxHDL pthis);
-+
-+ mfxStatus(MFX_CDECL *GetPluginParam)(mfxHDL pthis, mfxPluginParam *par);
-+
-+ mfxStatus(MFX_CDECL *Submit)(mfxHDL pthis,
-+ const mfxHDL *in,
-+ mfxU32 in_num,
-+ const mfxHDL *out,
-+ mfxU32 out_num,
-+ mfxThreadTask *task);
-+ mfxStatus(MFX_CDECL *Execute)(mfxHDL pthis, mfxThreadTask task, mfxU32 uid_p, mfxU32 uid_a);
-+ mfxStatus(MFX_CDECL *FreeResources)(mfxHDL pthis, mfxThreadTask task, mfxStatus sts);
-+
-+ union {
-+ mfxVideoCodecPlugin *Video;
-+ mfxAudioCodecPlugin *Audio;
-+ };
-+
-+ mfxHDL reserved[8];
-+} mfxPlugin;
-+MFX_PACK_END()
-+
-+mfxStatus MFX_CDECL MFXVideoUSER_Register(mfxSession session, mfxU32 type, const mfxPlugin *par);
-+mfxStatus MFX_CDECL MFXVideoUSER_Unregister(mfxSession session, mfxU32 type);
-+mfxStatus MFX_CDECL MFXVideoUSER_GetPlugin(mfxSession session, mfxU32 type, mfxPlugin *par);
-+mfxStatus MFX_CDECL MFXVideoUSER_ProcessFrameAsync(mfxSession session,
-+ const mfxHDL *in,
-+ mfxU32 in_num,
-+ const mfxHDL *out,
-+ mfxU32 out_num,
-+ mfxSyncPoint *syncp);
-+
-+mfxStatus MFX_CDECL MFXVideoUSER_Load(mfxSession session, const mfxPluginUID *uid, mfxU32 version);
-+mfxStatus MFX_CDECL MFXVideoUSER_LoadByPath(mfxSession session,
-+ const mfxPluginUID *uid,
-+ mfxU32 version,
-+ const mfxChar *path,
-+ mfxU32 len);
-+mfxStatus MFX_CDECL MFXVideoUSER_UnLoad(mfxSession session, const mfxPluginUID *uid);
-+
-+mfxStatus MFX_CDECL MFXAudioUSER_Register(mfxSession session, mfxU32 type, const mfxPlugin *par);
-+mfxStatus MFX_CDECL MFXAudioUSER_Unregister(mfxSession session, mfxU32 type);
-+mfxStatus MFX_CDECL MFXAudioUSER_ProcessFrameAsync(mfxSession session,
-+ const mfxHDL *in,
-+ mfxU32 in_num,
-+ const mfxHDL *out,
-+ mfxU32 out_num,
-+ mfxSyncPoint *syncp);
-+
-+mfxStatus MFX_CDECL MFXAudioUSER_Load(mfxSession session, const mfxPluginUID *uid, mfxU32 version);
-+mfxStatus MFX_CDECL MFXAudioUSER_UnLoad(mfxSession session, const mfxPluginUID *uid);
-+
-+#ifdef __cplusplus
-+} // extern "C"
-+#endif /* __cplusplus */
-+
-+#endif /* __MFXPLUGIN_H__ */
-diff --git a/tools/legacy/media_sdk_compatibility_headers/rotate_plugin_api.h b/tools/legacy/media_sdk_compatibility_headers/rotate_plugin_api.h
-new file mode 100644
-index 0000000..928f6c3
---- /dev/null
-+++ b/tools/legacy/media_sdk_compatibility_headers/rotate_plugin_api.h
-@@ -0,0 +1,29 @@
-+/******************************************************************************\
-+Copyright (c) 2005-2018, Intel Corporation
-+All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-+
-+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-+
-+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-+
-+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+This sample was distributed or derived from the Intel's Media Samples package.
-+The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
-+or https://software.intel.com/en-us/media-client-solutions-support.
-+\**********************************************************************************/
-+
-+#ifndef __MFX_PLUGIN_ROTATE_API_H__
-+#define __MFX_PLUGIN_ROTATE_API_H__
-+
-+#include "mfxdefs.h"
-+
-+struct RotateParam {
-+ mfxU16 Angle; // rotation angle
-+};
-+
-+#endif // __MFX_PLUGIN_ROTATE_API_H__
-diff --git a/tools/legacy/sample_common/CMakeLists.txt b/tools/legacy/sample_common/CMakeLists.txt
-index 4f04226..86b5fd8 100644
---- a/tools/legacy/sample_common/CMakeLists.txt
-+++ b/tools/legacy/sample_common/CMakeLists.txt
-@@ -17,8 +17,10 @@ list(
- src/sysmem_allocator.cpp
- src/general_allocator.cpp
- src/sample_utils.cpp
-+ src/plugin_utils.cpp
- src/preset_manager.cpp
- src/parameters_dumper.cpp
-+ src/vpl_implementation_loader.cpp
- src/vm/atomic.cpp
- src/vm/time.cpp)
-
-@@ -62,7 +64,7 @@ if(POLICY CMP0074)
- endif()
-
- find_package(VPL REQUIRED)
--target_link_libraries(${TARGET} VPL::dispatcher)
-+target_link_libraries(${TARGET} VPL::dispatcher media_sdk_compatibility_headers)
-
- if(UNIX)
- find_package(PkgConfig REQUIRED)
-diff --git a/tools/legacy/sample_common/include/plugin_utils.h b/tools/legacy/sample_common/include/plugin_utils.h
-index 80b7baf..8401c0c 100644
---- a/tools/legacy/sample_common/include/plugin_utils.h
-+++ b/tools/legacy/sample_common/include/plugin_utils.h
-@@ -7,6 +7,7 @@
- #ifndef __PLUGIN_UTILS_H__
- #define __PLUGIN_UTILS_H__
-
-+#include "mfxplugin.h"
- #include "sample_defs.h"
- #include "sample_types.h"
-
-diff --git a/tools/legacy/sample_common/include/sample_utils.h b/tools/legacy/sample_common/include/sample_utils.h
-index db9b3fd..b138692 100644
---- a/tools/legacy/sample_common/include/sample_utils.h
-+++ b/tools/legacy/sample_common/include/sample_utils.h
-@@ -46,6 +46,7 @@
- #include "avc_headers.h"
- #include "avc_nal_spl.h"
- #include "avc_spl.h"
-+#include "vpl_implementation_loader.h"
-
- // A macro to disallow the copy constructor and operator= functions
- // This should be used in the private: declarations for a class
-@@ -653,7 +654,7 @@ public:
- TB* GetExtBuffer(uint32_t fieldId = 0) const {
- return (TB*)FindExtBuffer(mfx_ext_buffer_id<TB>::id, fieldId);
- }
--
-+#if 0
- template <typename TB>
- operator TB*() {
- return (TB*)FindExtBuffer(mfx_ext_buffer_id<TB>::id, 0);
-@@ -663,7 +664,7 @@ public:
- operator TB*() const {
- return (TB*)FindExtBuffer(mfx_ext_buffer_id<TB>::id, 0);
- }
--
-+#endif
- private:
- mfxExtBuffer* AddExtBuffer(mfxU32 id, mfxU32 size, bool isPairedExtBuffer) {
- if (!size || !id)
-diff --git a/tools/legacy/sample_common/include/sample_utils.h.orig b/tools/legacy/sample_common/include/sample_utils.h.orig
-new file mode 100644
-index 0000000..db9b3fd
---- /dev/null
-+++ b/tools/legacy/sample_common/include/sample_utils.h.orig
-@@ -0,0 +1,1437 @@
-+/*############################################################################
-+ # Copyright (C) Intel Corporation
-+ #
-+ # SPDX-License-Identifier: MIT
-+ ############################################################################*/
-+
-+#ifndef __SAMPLE_UTILS_H__
-+#define __SAMPLE_UTILS_H__
-+
-+#include <stdio.h>
-+#include <algorithm>
-+#include <climits>
-+#include <fstream>
-+#include <map>
-+#include <mutex>
-+#include <sstream>
-+#include <stdexcept>
-+#include <string>
-+#include <vector>
-+
-+#include "vpl/mfxbrc.h"
-+#if (MFX_VERSION < 2000)
-+ #include "mfxfei.h"
-+ #include "mfxfeihevc.h"
-+#endif
-+#include "vpl/mfxjpeg.h"
-+#if (MFX_VERSION < 2000)
-+ #include "mfxla.h"
-+ #include "mfxmvc.h"
-+ #include "mfxplugin.h"
-+#endif
-+#include "vpl/mfxstructures.h"
-+#include "vpl/mfxvideo++.h"
-+#include "vpl/mfxvideo.h"
-+
-+#include "vm/atomic_defs.h"
-+#include "vm/file_defs.h"
-+#include "vm/strings_defs.h"
-+#include "vm/thread_defs.h"
-+#include "vm/time_defs.h"
-+
-+#include "sample_types.h"
-+
-+#include "abstract_splitter.h"
-+#include "avc_bitstream.h"
-+#include "avc_headers.h"
-+#include "avc_nal_spl.h"
-+#include "avc_spl.h"
-+
-+// A macro to disallow the copy constructor and operator= functions
-+// This should be used in the private: declarations for a class
-+#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
-+ TypeName(const TypeName&); \
-+ void operator=(const TypeName&)
-+
-+//! Base class for types that should not be assigned.
-+class no_assign {
-+ // Deny assignment
-+ void operator=(const no_assign&);
-+
-+public:
-+#if __GNUC__
-+ //! Explicitly define default construction, because otherwise gcc issues gratuitous warning.
-+ no_assign() {}
-+#endif /* __GNUC__ */
-+};
-+
-+//! Base class for types that should not be copied or assigned.
-+class no_copy : no_assign {
-+ //! Deny copy construction
-+ no_copy(const no_copy&);
-+
-+ // Deny assignment
-+ void operator=(const no_copy&);
-+
-+public:
-+ //! Allow default construction
-+ no_copy() {}
-+};
-+
-+enum {
-+ CODEC_VP8 = MFX_MAKEFOURCC('V', 'P', '8', ' '),
-+ CODEC_MVC = MFX_MAKEFOURCC('M', 'V', 'C', ' '),
-+};
-+
-+#define MFX_CODEC_DUMP MFX_MAKEFOURCC('D', 'U', 'M', 'P')
-+#define MFX_CODEC_RGB4 MFX_FOURCC_RGB4
-+#define MFX_CODEC_NV12 MFX_FOURCC_NV12
-+#define MFX_CODEC_I420 MFX_FOURCC_I420
-+#if (MFX_VERSION < 2000)
-+enum {
-+ MFX_FOURCC_IMC3 = MFX_MAKEFOURCC('I', 'M', 'C', '3'),
-+ MFX_FOURCC_YUV400 = MFX_MAKEFOURCC('4', '0', '0', 'P'),
-+ MFX_FOURCC_YUV411 = MFX_MAKEFOURCC('4', '1', '1', 'P'),
-+ MFX_FOURCC_YUV422H = MFX_MAKEFOURCC('4', '2', '2', 'H'),
-+ MFX_FOURCC_YUV422V = MFX_MAKEFOURCC('4', '2', '2', 'V'),
-+ MFX_FOURCC_YUV444 = MFX_MAKEFOURCC('4', '4', '4', 'P'),
-+ #if (MFX_VERSION <= 1027)
-+ MFX_FOURCC_RGBP = MFX_MAKEFOURCC('R', 'G', 'B', 'P'),
-+ #endif
-+ MFX_FOURCC_I420 = MFX_MAKEFOURCC('I', '4', '2', '0')
-+};
-+#endif
-+enum ExtBRCType { EXTBRC_DEFAULT, EXTBRC_OFF, EXTBRC_ON, EXTBRC_IMPLICIT };
-+
-+namespace QPFile {
-+
-+enum ReaderStatus {
-+ READER_ERR_NONE,
-+ READER_ERR_NOT_INITIALIZED,
-+ READER_ERR_CODEC_UNSUPPORTED,
-+ READER_ERR_FILE_NOT_OPEN,
-+ READER_ERR_INCORRECT_FILE
-+};
-+
-+struct FrameInfo {
-+ mfxU32 displayOrder;
-+ mfxU16 QP;
-+ mfxU16 frameType;
-+};
-+
-+// QPFile::Reader reads QP and frame type per frame in encoding order
-+// from external text file (for encoding in qpfile mode)
-+class Reader {
-+public:
-+ mfxStatus Read(const msdk_string& strFileName, mfxU32 codecid);
-+ void ResetState();
-+
-+ mfxU32 GetCurrentEncodedOrder() const;
-+ mfxU32 GetCurrentDisplayOrder() const;
-+ mfxU16 GetCurrentQP() const;
-+ mfxU16 GetCurrentFrameType() const;
-+ mfxU32 GetFramesNum() const;
-+ void NextFrame();
-+ std::string GetErrorMessage() const;
-+
-+private:
-+ void ResetState(ReaderStatus set_sts);
-+
-+ ReaderStatus m_ReaderSts = READER_ERR_NOT_INITIALIZED;
-+ mfxU32 m_nFrames = UINT_MAX;
-+ mfxU32 m_CurFrameNum = UINT_MAX;
-+ std::vector<FrameInfo> m_FrameVals{};
-+};
-+
-+inline bool get_line(std::ifstream& ifs, std::string& line) {
-+ std::getline(ifs, line, '\n');
-+ if (!line.empty() && line.back() == '\r')
-+ line.pop_back();
-+ return !ifs.fail();
-+}
-+inline size_t find_nth(const std::string& str, size_t pos, const std::string& needle, mfxU32 nth) {
-+ size_t found_pos = str.find(needle, pos);
-+ for (; nth != 0 && std::string::npos != found_pos; --nth)
-+ found_pos = str.find(needle, found_pos + 1);
-+ return found_pos;
-+}
-+inline mfxU16 StringToFrameType(std::string str) {
-+ if ("IDR_REF" == str)
-+ return MFX_FRAMETYPE_I | MFX_FRAMETYPE_IDR | MFX_FRAMETYPE_REF;
-+ else if ("I_REF" == str)
-+ return MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF;
-+ else if ("P_REF" == str)
-+ return MFX_FRAMETYPE_P | MFX_FRAMETYPE_REF;
-+ else if ("P" == str)
-+ return MFX_FRAMETYPE_P;
-+ else if ("B_REF" == str)
-+ return MFX_FRAMETYPE_B | MFX_FRAMETYPE_REF;
-+ else if ("B" == str)
-+ return MFX_FRAMETYPE_B;
-+ else
-+ return MFX_FRAMETYPE_UNKNOWN;
-+}
-+inline std::string ReaderStatusToString(ReaderStatus sts) {
-+ switch (sts) {
-+ case READER_ERR_NOT_INITIALIZED:
-+ return std::string("reader not initialized (qpfile has not yet read the file)\n");
-+ case READER_ERR_FILE_NOT_OPEN:
-+ return std::string(
-+ "failed to open file contains frame parameters (check provided path in -qpfile <path>)\n");
-+ case READER_ERR_INCORRECT_FILE:
-+ return std::string("incorrect file with frame parameters\n");
-+ case READER_ERR_CODEC_UNSUPPORTED:
-+ return std::string("codecs, except h264 and h265, are not supported\n");
-+ default:
-+ return std::string();
-+ }
-+}
-+inline mfxU32 ReadDisplayOrder(const std::string& line) {
-+ return std::stoi(line.substr(0, find_nth(line, 0, ",", 0)));
-+}
-+inline mfxU16 ReadQP(const std::string& line) {
-+ size_t pos = find_nth(line, 0, ",", 0) + 1;
-+ return static_cast<mfxU16>(std::stoi(line.substr(pos, find_nth(line, 0, ",", 1) - pos)));
-+}
-+inline mfxU16 ReadFrameType(const std::string& line) {
-+ size_t pos = find_nth(line, 0, ",", 1) + 1;
-+ return StringToFrameType(line.substr(pos, line.length() - pos));
-+}
-+} // namespace QPFile
-+
-+mfxStatus GetFrameLength(mfxU16 width, mfxU16 height, mfxU32 ColorFormat, mfxU32& length);
-+
-+bool IsDecodeCodecSupported(mfxU32 codecFormat);
-+bool IsEncodeCodecSupported(mfxU32 codecFormat);
-+bool IsPluginCodecSupported(mfxU32 codecFormat);
-+
-+// class is used as custom exception
-+class mfxError : public std::runtime_error {
-+public:
-+ mfxError(mfxStatus status = MFX_ERR_UNKNOWN, std::string msg = "")
-+ : runtime_error(msg),
-+ m_Status(status) {}
-+
-+ mfxStatus GetStatus() const {
-+ return m_Status;
-+ }
-+
-+private:
-+ mfxStatus m_Status;
-+};
-+
-+//declare used extension buffers
-+template <class T>
-+struct mfx_ext_buffer_id {};
-+
-+template <>
-+struct mfx_ext_buffer_id<mfxExtCodingOption> {
-+ enum { id = MFX_EXTBUFF_CODING_OPTION };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtCodingOption2> {
-+ enum { id = MFX_EXTBUFF_CODING_OPTION2 };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtCodingOption3> {
-+ enum { id = MFX_EXTBUFF_CODING_OPTION3 };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtAvcTemporalLayers> {
-+ enum { id = MFX_EXTBUFF_AVC_TEMPORAL_LAYERS };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtAVCRefListCtrl> {
-+ enum { id = MFX_EXTBUFF_AVC_REFLIST_CTRL };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtThreadsParam> {
-+ enum { id = MFX_EXTBUFF_THREADS_PARAM };
-+};
-+#if (MFX_VERSION < 2000)
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiParam> {
-+ enum { id = MFX_EXTBUFF_FEI_PARAM };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiPreEncCtrl> {
-+ enum { id = MFX_EXTBUFF_FEI_PREENC_CTRL };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiPreEncMV> {
-+ enum { id = MFX_EXTBUFF_FEI_PREENC_MV };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiPreEncMBStat> {
-+ enum { id = MFX_EXTBUFF_FEI_PREENC_MB };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiHevcEncFrameCtrl> {
-+ enum { id = MFX_EXTBUFF_HEVCFEI_ENC_CTRL };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiHevcEncMVPredictors> {
-+ enum { id = MFX_EXTBUFF_HEVCFEI_ENC_MV_PRED };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiHevcEncQP> {
-+ enum { id = MFX_EXTBUFF_HEVCFEI_ENC_QP };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiHevcEncCtuCtrl> {
-+ enum { id = MFX_EXTBUFF_HEVCFEI_ENC_CTU_CTRL };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtHEVCRefLists> {
-+ enum { id = MFX_EXTBUFF_HEVC_REFLISTS };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiHevcRepackCtrl> {
-+ enum { id = MFX_EXTBUFF_HEVCFEI_REPACK_CTRL };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiHevcRepackStat> {
-+ enum { id = MFX_EXTBUFF_HEVCFEI_REPACK_STAT };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtBRC> {
-+ enum { id = MFX_EXTBUFF_BRC };
-+};
-+#endif
-+template <>
-+struct mfx_ext_buffer_id<mfxExtHEVCParam> {
-+ enum { id = MFX_EXTBUFF_HEVC_PARAM };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtDecVideoProcessing> {
-+ enum { id = MFX_EXTBUFF_DEC_VIDEO_PROCESSING };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtDecodeErrorReport> {
-+ enum { id = MFX_EXTBUFF_DECODE_ERROR_REPORT };
-+};
-+#if (MFX_VERSION < 2000)
-+template <>
-+struct mfx_ext_buffer_id<mfxExtMVCSeqDesc> {
-+ enum { id = MFX_EXTBUFF_MVC_SEQ_DESC };
-+};
-+#endif
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVPPDoNotUse> {
-+ enum { id = MFX_EXTBUFF_VPP_DONOTUSE };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVPPDoUse> {
-+ enum { id = MFX_EXTBUFF_VPP_DOUSE };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVPPDeinterlacing> {
-+ enum { id = MFX_EXTBUFF_VPP_DEINTERLACING };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtCodingOptionSPSPPS> {
-+ enum { id = MFX_EXTBUFF_CODING_OPTION_SPSPPS };
-+};
-+#if (MFX_VERSION < 2000)
-+template <>
-+struct mfx_ext_buffer_id<mfxExtOpaqueSurfaceAlloc> {
-+ enum { id = MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION };
-+};
-+#endif
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVppMctf> {
-+ enum { id = MFX_EXTBUFF_VPP_MCTF };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVPPComposite> {
-+ enum { id = MFX_EXTBUFF_VPP_COMPOSITE };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVPPFieldProcessing> {
-+ enum { id = MFX_EXTBUFF_VPP_FIELD_PROCESSING };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVPPDetail> {
-+ enum { id = MFX_EXTBUFF_VPP_DETAIL };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVPPFrameRateConversion> {
-+ enum { id = MFX_EXTBUFF_VPP_FRAME_RATE_CONVERSION };
-+};
-+#if (MFX_VERSION < 2000)
-+template <>
-+struct mfx_ext_buffer_id<mfxExtLAControl> {
-+ enum { id = MFX_EXTBUFF_LOOKAHEAD_CTRL };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtMultiFrameControl> {
-+ enum { id = MFX_EXTBUFF_MULTI_FRAME_CONTROL };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtMultiFrameParam> {
-+ enum { id = MFX_EXTBUFF_MULTI_FRAME_PARAM };
-+};
-+#endif
-+template <>
-+struct mfx_ext_buffer_id<mfxExtHEVCTiles> {
-+ enum { id = MFX_EXTBUFF_HEVC_TILES };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVP9Param> {
-+ enum { id = MFX_EXTBUFF_VP9_PARAM };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVideoSignalInfo> {
-+ enum { id = MFX_EXTBUFF_VIDEO_SIGNAL_INFO };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtHEVCRegion> {
-+ enum { id = MFX_EXTBUFF_HEVC_REGION };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtAVCRoundingOffset> {
-+ enum { id = MFX_EXTBUFF_AVC_ROUNDING_OFFSET };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVPPDenoise> {
-+ enum { id = MFX_EXTBUFF_VPP_DENOISE };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVPPProcAmp> {
-+ enum { id = MFX_EXTBUFF_VPP_PROCAMP };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVPPImageStab> {
-+ enum { id = MFX_EXTBUFF_VPP_IMAGE_STABILIZATION };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVPPVideoSignalInfo> {
-+ enum { id = MFX_EXTBUFF_VPP_VIDEO_SIGNAL_INFO };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVPPMirroring> {
-+ enum { id = MFX_EXTBUFF_VPP_MIRRORING };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVPPColorFill> {
-+ enum { id = MFX_EXTBUFF_VPP_COLORFILL };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVPPRotation> {
-+ enum { id = MFX_EXTBUFF_VPP_ROTATION };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtVPPScaling> {
-+ enum { id = MFX_EXTBUFF_VPP_SCALING };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtColorConversion> {
-+ enum { id = MFX_EXTBUFF_VPP_COLOR_CONVERSION };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtPredWeightTable> {
-+ enum { id = MFX_EXTBUFF_PRED_WEIGHT_TABLE };
-+};
-+#if (MFX_VERSION < 2000)
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiDecStreamOut> {
-+ enum { id = MFX_EXTBUFF_FEI_DEC_STREAM_OUT };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiSliceHeader> {
-+ enum { id = MFX_EXTBUFF_FEI_SLICE };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiEncFrameCtrl> {
-+ enum { id = MFX_EXTBUFF_FEI_ENC_CTRL };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiEncMVPredictors> {
-+ enum { id = MFX_EXTBUFF_FEI_ENC_MV_PRED };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiRepackCtrl> {
-+ enum { id = MFX_EXTBUFF_FEI_REPACK_CTRL };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiEncMBCtrl> {
-+ enum { id = MFX_EXTBUFF_FEI_ENC_MB };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiEncQP> {
-+ enum { id = MFX_EXTBUFF_FEI_ENC_QP };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiEncMBStat> {
-+ enum { id = MFX_EXTBUFF_FEI_ENC_MB_STAT };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiEncMV> {
-+ enum { id = MFX_EXTBUFF_FEI_ENC_MV };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiPakMBCtrl> {
-+ enum { id = MFX_EXTBUFF_FEI_PAK_CTRL };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiRepackStat> {
-+ enum { id = MFX_EXTBUFF_FEI_REPACK_STAT };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiSPS> {
-+ enum { id = MFX_EXTBUFF_FEI_SPS };
-+};
-+template <>
-+struct mfx_ext_buffer_id<mfxExtFeiPPS> {
-+ enum { id = MFX_EXTBUFF_FEI_PPS };
-+};
-+#endif
-+constexpr uint16_t max_num_ext_buffers =
-+ 63 * 2; // '*2' is for max estimation if all extBuffer were 'paired'
-+
-+//helper function to initialize mfx ext buffer structure
-+template <class T>
-+void init_ext_buffer(T& ext_buffer) {
-+ memset(&ext_buffer, 0, sizeof(ext_buffer));
-+ reinterpret_cast<mfxExtBuffer*>(&ext_buffer)->BufferId = mfx_ext_buffer_id<T>::id;
-+ reinterpret_cast<mfxExtBuffer*>(&ext_buffer)->BufferSz = sizeof(ext_buffer);
-+}
-+
-+template <typename T>
-+struct IsPairedMfxExtBuffer : std::false_type {};
-+template <>
-+struct IsPairedMfxExtBuffer<mfxExtAVCRefListCtrl> : std::true_type {};
-+template <>
-+struct IsPairedMfxExtBuffer<mfxExtAVCRoundingOffset> : std::true_type {};
-+template <>
-+struct IsPairedMfxExtBuffer<mfxExtPredWeightTable> : std::true_type {};
-+#if (MFX_VERSION < 2000)
-+template <>
-+struct IsPairedMfxExtBuffer<mfxExtFeiSliceHeader> : std::true_type {};
-+template <>
-+struct IsPairedMfxExtBuffer<mfxExtFeiEncFrameCtrl> : std::true_type {};
-+template <>
-+struct IsPairedMfxExtBuffer<mfxExtFeiEncMVPredictors> : std::true_type {};
-+template <>
-+struct IsPairedMfxExtBuffer<mfxExtFeiRepackCtrl> : std::true_type {};
-+template <>
-+struct IsPairedMfxExtBuffer<mfxExtFeiEncMBCtrl> : std::true_type {};
-+template <>
-+struct IsPairedMfxExtBuffer<mfxExtFeiEncQP> : std::true_type {};
-+template <>
-+struct IsPairedMfxExtBuffer<mfxExtFeiEncMBStat> : std::true_type {};
-+template <>
-+struct IsPairedMfxExtBuffer<mfxExtFeiEncMV> : std::true_type {};
-+template <>
-+struct IsPairedMfxExtBuffer<mfxExtFeiPakMBCtrl> : std::true_type {};
-+template <>
-+struct IsPairedMfxExtBuffer<mfxExtFeiRepackStat> : std::true_type {};
-+#endif
-+
-+template <typename R>
-+struct ExtParamAccessor {
-+private:
-+ using mfxExtBufferDoublePtr = mfxExtBuffer**;
-+
-+public:
-+ mfxU16& NumExtParam;
-+ mfxExtBufferDoublePtr& ExtParam;
-+ ExtParamAccessor(const R& r)
-+ : NumExtParam(const_cast<mfxU16&>(r.NumExtParam)),
-+ ExtParam(const_cast<mfxExtBufferDoublePtr&>(r.ExtParam)) {}
-+};
-+
-+template <>
-+struct ExtParamAccessor<mfxFrameSurface1> {
-+private:
-+ using mfxExtBufferDoublePtr = mfxExtBuffer**;
-+
-+public:
-+ mfxU16& NumExtParam;
-+ mfxExtBufferDoublePtr& ExtParam;
-+ ExtParamAccessor(const mfxFrameSurface1& r)
-+ : NumExtParam(const_cast<mfxU16&>(r.Data.NumExtParam)),
-+ ExtParam(const_cast<mfxExtBufferDoublePtr&>(r.Data.ExtParam)) {}
-+};
-+
-+/** ExtBufHolder is an utility class which
-+ * provide interface for mfxExtBuffer objects management in any mfx structure (e.g. mfxVideoParam)
-+ */
-+template <typename T>
-+class ExtBufHolder : public T {
-+public:
-+ ExtBufHolder() : T(), m_ext_buf() {
-+ m_ext_buf.reserve(max_num_ext_buffers);
-+ }
-+
-+ ~ExtBufHolder() // only buffers allocated by wrapper can be released
-+ {
-+ for (auto it = m_ext_buf.begin(); it != m_ext_buf.end(); it++) {
-+ delete[](mfxU8*)(*it);
-+ }
-+ }
-+
-+ ExtBufHolder(const ExtBufHolder& ref) {
-+ m_ext_buf.reserve(max_num_ext_buffers);
-+ *this = ref; // call to operator=
-+ }
-+
-+ ExtBufHolder& operator=(const ExtBufHolder& ref) {
-+ const T* src_base = &ref;
-+ return operator =(*src_base);
-+ }
-+
-+ ExtBufHolder(const T& ref) {
-+ *this = ref; // call to operator=
-+ }
-+
-+ ExtBufHolder& operator=(const T& ref) {
-+ // copy content of main structure type T
-+ T* dst_base = this;
-+ const T* src_base = &ref;
-+ *dst_base = *src_base;
-+
-+ //remove all existing extension buffers
-+ ClearBuffers();
-+
-+ const auto ref_ = ExtParamAccessor<T>(ref);
-+
-+ //reproduce list of extension buffers and copy its content
-+ for (size_t i = 0; i < ref_.NumExtParam; ++i) {
-+ const auto src_buf = ref_.ExtParam[i];
-+ if (!src_buf)
-+ throw mfxError(MFX_ERR_NULL_PTR, "Null pointer attached to source ExtParam");
-+ if (!IsCopyAllowed(src_buf->BufferId)) {
-+ auto msg =
-+ "Deep copy of '" + Fourcc2Str(src_buf->BufferId) + "' extBuffer is not allowed";
-+ throw mfxError(MFX_ERR_UNDEFINED_BEHAVIOR, msg);
-+ }
-+
-+ // 'false' below is because here we just copy extBuffer's one by one
-+ auto dst_buf = AddExtBuffer(src_buf->BufferId, src_buf->BufferSz, false);
-+ // copy buffer content w/o restoring its type
-+ MSDK_MEMCPY((void*)dst_buf, (void*)src_buf, src_buf->BufferSz);
-+ }
-+
-+ return *this;
-+ }
-+
-+ ExtBufHolder(ExtBufHolder&&) = default;
-+ ExtBufHolder& operator=(ExtBufHolder&&) = default;
-+
-+ // Always returns a valid pointer or throws an exception
-+ template <typename TB>
-+ TB* AddExtBuffer() {
-+ mfxExtBuffer* b =
-+ AddExtBuffer(mfx_ext_buffer_id<TB>::id, sizeof(TB), IsPairedMfxExtBuffer<TB>::value);
-+ return (TB*)b;
-+ }
-+
-+ template <typename TB>
-+ void RemoveExtBuffer() {
-+ auto it = std::find_if(m_ext_buf.begin(),
-+ m_ext_buf.end(),
-+ CmpExtBufById(mfx_ext_buffer_id<TB>::id));
-+ if (it != m_ext_buf.end()) {
-+ delete[](mfxU8*)(*it);
-+ it = m_ext_buf.erase(it);
-+
-+ if (IsPairedMfxExtBuffer<TB>::value) {
-+ if (it == m_ext_buf.end() || (*it)->BufferId != mfx_ext_buffer_id<TB>::id)
-+ throw mfxError(MFX_ERR_NULL_PTR,
-+ "RemoveExtBuffer: ExtBuffer's parity has been broken");
-+
-+ delete[](mfxU8*)(*it);
-+ m_ext_buf.erase(it);
-+ }
-+
-+ RefreshBuffers();
-+ }
-+ }
-+
-+ template <typename TB>
-+ TB* GetExtBuffer(uint32_t fieldId = 0) const {
-+ return (TB*)FindExtBuffer(mfx_ext_buffer_id<TB>::id, fieldId);
-+ }
-+
-+ template <typename TB>
-+ operator TB*() {
-+ return (TB*)FindExtBuffer(mfx_ext_buffer_id<TB>::id, 0);
-+ }
-+
-+ template <typename TB>
-+ operator TB*() const {
-+ return (TB*)FindExtBuffer(mfx_ext_buffer_id<TB>::id, 0);
-+ }
-+
-+private:
-+ mfxExtBuffer* AddExtBuffer(mfxU32 id, mfxU32 size, bool isPairedExtBuffer) {
-+ if (!size || !id)
-+ throw mfxError(MFX_ERR_NULL_PTR, "AddExtBuffer: wrong size or id!");
-+
-+ auto it = std::find_if(m_ext_buf.begin(), m_ext_buf.end(), CmpExtBufById(id));
-+ if (it == m_ext_buf.end()) {
-+ auto buf = (mfxExtBuffer*)new mfxU8[size];
-+ memset(buf, 0, size);
-+ m_ext_buf.push_back(buf);
-+
-+ buf->BufferId = id;
-+ buf->BufferSz = size;
-+
-+ if (isPairedExtBuffer) {
-+ // Allocate the other mfxExtBuffer _right_after_ the first one ...
-+ buf = (mfxExtBuffer*)new mfxU8[size];
-+ memset(buf, 0, size);
-+ m_ext_buf.push_back(buf);
-+
-+ buf->BufferId = id;
-+ buf->BufferSz = size;
-+
-+ RefreshBuffers();
-+ return m_ext_buf[m_ext_buf.size() - 2]; // ... and return a pointer to the first one
-+ }
-+
-+ RefreshBuffers();
-+ return m_ext_buf.back();
-+ }
-+
-+ return *it;
-+ }
-+
-+ mfxExtBuffer* FindExtBuffer(mfxU32 id, uint32_t fieldId) const {
-+ auto it = std::find_if(m_ext_buf.begin(), m_ext_buf.end(), CmpExtBufById(id));
-+ if (fieldId && it != m_ext_buf.end()) {
-+ ++it;
-+ return it != m_ext_buf.end() ? *it : nullptr;
-+ }
-+ return it != m_ext_buf.end() ? *it : nullptr;
-+ }
-+
-+ void RefreshBuffers() {
-+ auto this_ = ExtParamAccessor<T>(*this);
-+ this_.NumExtParam = static_cast<mfxU16>(m_ext_buf.size());
-+ this_.ExtParam = this_.NumExtParam ? m_ext_buf.data() : nullptr;
-+ }
-+
-+ void ClearBuffers() {
-+ if (m_ext_buf.size()) {
-+ for (auto it = m_ext_buf.begin(); it != m_ext_buf.end(); it++) {
-+ delete[](mfxU8*)(*it);
-+ }
-+ m_ext_buf.clear();
-+ }
-+ RefreshBuffers();
-+ }
-+
-+ bool IsCopyAllowed(mfxU32 id) {
-+ static const mfxU32 allowed[] = {
-+ MFX_EXTBUFF_CODING_OPTION,
-+ MFX_EXTBUFF_CODING_OPTION2,
-+ MFX_EXTBUFF_CODING_OPTION3,
-+#if (MFX_VERSION < 2000)
-+ MFX_EXTBUFF_FEI_PARAM,
-+ MFX_EXTBUFF_BRC,
-+#endif
-+ MFX_EXTBUFF_HEVC_PARAM,
-+ MFX_EXTBUFF_VP9_PARAM,
-+#if (MFX_VERSION < 2000)
-+ MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION,
-+ MFX_EXTBUFF_FEI_PPS,
-+ MFX_EXTBUFF_FEI_SPS,
-+ MFX_EXTBUFF_LOOKAHEAD_CTRL,
-+ MFX_EXTBUFF_LOOKAHEAD_STAT
-+#endif
-+ };
-+
-+ auto it =
-+ std::find_if(std::begin(allowed), std::end(allowed), [&id](const mfxU32 allowed_id) {
-+ return allowed_id == id;
-+ });
-+ return it != std::end(allowed);
-+ }
-+
-+ struct CmpExtBufById {
-+ mfxU32 id;
-+
-+ CmpExtBufById(mfxU32 _id) : id(_id){};
-+
-+ bool operator()(mfxExtBuffer* b) {
-+ return (b && b->BufferId == id);
-+ };
-+ };
-+
-+ static std::string Fourcc2Str(mfxU32 fourcc) {
-+ std::string s;
-+ for (size_t i = 0; i < 4; i++) {
-+ s.push_back(*(i + (char*)&fourcc));
-+ }
-+ return s;
-+ }
-+
-+ std::vector<mfxExtBuffer*> m_ext_buf;
-+};
-+
-+using MfxVideoParamsWrapper = ExtBufHolder<mfxVideoParam>;
-+using mfxEncodeCtrlWrap = ExtBufHolder<mfxEncodeCtrl>;
-+using mfxInitParamlWrap = ExtBufHolder<mfxInitParam>;
-+using mfxFrameSurfaceWrap = ExtBufHolder<mfxFrameSurface1>;
-+
-+class mfxBitstreamWrapper : public ExtBufHolder<mfxBitstream> {
-+ typedef ExtBufHolder<mfxBitstream> base;
-+
-+public:
-+ mfxBitstreamWrapper() : base(), m_data() {}
-+
-+ mfxBitstreamWrapper(mfxU32 n_bytes) : base() {
-+ Extend(n_bytes);
-+ }
-+
-+ mfxBitstreamWrapper(const mfxBitstreamWrapper& bs_wrapper)
-+ : base(bs_wrapper),
-+ m_data(bs_wrapper.m_data) {
-+ Data = m_data.data();
-+ }
-+
-+ mfxBitstreamWrapper& operator=(mfxBitstreamWrapper const& bs_wrapper) {
-+ mfxBitstreamWrapper tmp(bs_wrapper);
-+
-+ *this = std::move(tmp);
-+
-+ return *this;
-+ }
-+
-+ mfxBitstreamWrapper(mfxBitstreamWrapper&& bs_wrapper) = default;
-+ mfxBitstreamWrapper& operator=(mfxBitstreamWrapper&& bs_wrapper) = default;
-+ ~mfxBitstreamWrapper() = default;
-+
-+ void Extend(mfxU32 n_bytes) {
-+ if (MaxLength >= n_bytes)
-+ return;
-+
-+ m_data.resize(n_bytes);
-+
-+ Data = m_data.data();
-+ MaxLength = n_bytes;
-+ }
-+
-+private:
-+ std::vector<mfxU8> m_data;
-+};
-+
-+class CSmplYUVReader {
-+public:
-+ typedef std::list<msdk_string>::iterator ls_iterator;
-+ CSmplYUVReader();
-+ virtual ~CSmplYUVReader();
-+
-+ virtual void Close();
-+ virtual mfxStatus Init(std::list<msdk_string> inputs,
-+ mfxU32 ColorFormat,
-+ bool shouldShiftP010 = false);
-+ virtual mfxStatus SkipNframesFromBeginning(mfxU16 w, mfxU16 h, mfxU32 viewId, mfxU32 nframes);
-+ virtual mfxStatus LoadNextFrame(mfxFrameSurface1* pSurface);
-+ virtual void Reset();
-+ mfxU32 m_ColorFormat; // color format of input YUV data, YUV420 or NV12
-+
-+protected:
-+ std::vector<FILE*> m_files;
-+
-+ bool shouldShift10BitsHigh;
-+ bool m_bInited;
-+};
-+
-+class CSmplBitstreamWriter {
-+public:
-+ CSmplBitstreamWriter();
-+ virtual ~CSmplBitstreamWriter();
-+
-+ virtual mfxStatus Init(const msdk_char* strFileName);
-+ virtual mfxStatus WriteNextFrame(mfxBitstream* pMfxBitstream, bool isPrint = true);
-+ virtual mfxStatus Reset();
-+ virtual void Close();
-+ mfxU32 m_nProcessedFramesNum;
-+
-+protected:
-+ FILE* m_fSink;
-+ bool m_bInited;
-+ msdk_string m_sFile;
-+};
-+
-+class CSmplYUVWriter {
-+public:
-+ CSmplYUVWriter();
-+ virtual ~CSmplYUVWriter();
-+
-+ virtual void Close();
-+ virtual mfxStatus Init(const msdk_char* strFileName, const mfxU32 numViews);
-+ virtual mfxStatus Reset();
-+ virtual mfxStatus WriteNextFrame(mfxFrameSurface1* pSurface);
-+ virtual mfxStatus WriteNextFrameI420(mfxFrameSurface1* pSurface);
-+
-+ void SetMultiView() {
-+ m_bIsMultiView = true;
-+ }
-+
-+protected:
-+ FILE *m_fDest, **m_fDestMVC;
-+ bool m_bInited, m_bIsMultiView;
-+ mfxU32 m_numCreatedFiles;
-+ msdk_string m_sFile;
-+ mfxU32 m_nViews;
-+};
-+
-+class CSmplBitstreamReader {
-+public:
-+ CSmplBitstreamReader();
-+ virtual ~CSmplBitstreamReader();
-+
-+ //resets position to file begin
-+ virtual void Reset();
-+ virtual void Close();
-+ virtual mfxStatus Init(const msdk_char* strFileName);
-+ virtual mfxStatus ReadNextFrame(mfxBitstream* pBS);
-+
-+protected:
-+ FILE* m_fSource;
-+ bool m_bInited;
-+};
-+
-+class CH264FrameReader : public CSmplBitstreamReader {
-+public:
-+ CH264FrameReader();
-+ virtual ~CH264FrameReader();
-+
-+ /** Free resources.*/
-+ virtual void Close();
-+ virtual mfxStatus Init(const msdk_char* strFileName);
-+ virtual mfxStatus ReadNextFrame(mfxBitstream* pBS);
-+
-+private:
-+ mfxBitstream* m_processedBS;
-+ // input bit stream
-+ mfxBitstreamWrapper m_originalBS;
-+
-+ mfxStatus PrepareNextFrame(mfxBitstream* in, mfxBitstream** out);
-+
-+ // is stream ended
-+ bool m_isEndOfStream;
-+
-+ std::unique_ptr<AbstractSplitter> m_pNALSplitter;
-+ FrameSplitterInfo* m_frame;
-+ mfxU8* m_plainBuffer;
-+ mfxU32 m_plainBufferSize;
-+ mfxBitstream m_outBS;
-+};
-+
-+//provides output bistream with at least 1 frame, reports about error
-+class CJPEGFrameReader : public CSmplBitstreamReader {
-+ enum JPEGMarker { SOI = 0xD8FF, EOI = 0xD9FF };
-+
-+public:
-+ virtual mfxStatus ReadNextFrame(mfxBitstream* pBS);
-+
-+protected:
-+ mfxU32 FindMarker(mfxBitstream* pBS, mfxU32 startOffset, JPEGMarker marker);
-+};
-+
-+//appends output bistream with exactly 1 frame, reports about error
-+class CIVFFrameReader : public CSmplBitstreamReader {
-+public:
-+ CIVFFrameReader();
-+ virtual void Reset();
-+ virtual mfxStatus Init(const msdk_char* strFileName);
-+ virtual mfxStatus ReadNextFrame(mfxBitstream* pBS);
-+
-+protected:
-+ /*bytes 0-3 signature: 'DKIF'
-+ bytes 4-5 version (should be 0)
-+ bytes 6-7 length of header in bytes
-+ bytes 8-11 codec FourCC (e.g., 'VP80')
-+ bytes 12-13 width in pixels
-+ bytes 14-15 height in pixels
-+ bytes 16-19 frame rate
-+ bytes 20-23 time scale
-+ bytes 24-27 number of frames in file
-+ bytes 28-31 unused*/
-+
-+ struct DKIFHrd {
-+ mfxU32 dkif;
-+ mfxU16 version;
-+ mfxU16 header_len;
-+ mfxU32 codec_FourCC;
-+ mfxU16 width;
-+ mfxU16 height;
-+ mfxU32 frame_rate;
-+ mfxU32 time_scale;
-+ mfxU32 num_frames;
-+ mfxU32 unused;
-+ } m_hdr;
-+ mfxStatus ReadHeader();
-+};
-+
-+// writes bitstream to duplicate-file & supports joining
-+// (for ViewOutput encoder mode)
-+class CSmplBitstreamDuplicateWriter : public CSmplBitstreamWriter {
-+public:
-+ CSmplBitstreamDuplicateWriter();
-+
-+ virtual mfxStatus InitDuplicate(const msdk_char* strFileName);
-+ virtual mfxStatus JoinDuplicate(CSmplBitstreamDuplicateWriter* pJoinee);
-+ virtual mfxStatus WriteNextFrame(mfxBitstream* pMfxBitstream, bool isPrint = true);
-+ virtual void Close();
-+
-+protected:
-+ FILE* m_fSinkDuplicate;
-+ bool m_bJoined;
-+};
-+
-+#if (MFX_VERSION >= 2000)
-+class CIVFFrameWriter : public CSmplBitstreamWriter {
-+public:
-+ CIVFFrameWriter();
-+
-+ virtual mfxStatus Reset();
-+ virtual mfxStatus Init(const msdk_char* strFileName,
-+ const mfxU16 w,
-+ const mfxU16 h,
-+ const mfxU32 fr_nom,
-+ const mfxU32 fr_denom);
-+ virtual mfxStatus WriteNextFrame(mfxBitstream* pMfxBitstream, bool isPrint = true);
-+ virtual void Close();
-+
-+protected:
-+ /* 32 bytes for stream header
-+ bytes 0-3 signature: 'DKIF'
-+ bytes 4-5 version (should be 0)
-+ bytes 6-7 length of header in bytes
-+ bytes 8-11 codec FourCC (e.g., 'VP80')
-+ bytes 12-13 width in pixels
-+ bytes 14-15 height in pixels
-+ bytes 16-19 frame rate
-+ bytes 20-23 time scale
-+ bytes 24-27 number of frames in file
-+ bytes 28-31 unused
-+ */
-+ struct streamHeader {
-+ mfxU32 dkif;
-+ mfxU16 version;
-+ mfxU16 header_len;
-+ mfxU32 codec_FourCC;
-+ mfxU16 width;
-+ mfxU16 height;
-+ mfxU32 frame_rate;
-+ mfxU32 time_scale;
-+ mfxU32 num_frames;
-+ mfxU32 unused;
-+ } m_streamHeader;
-+
-+ /* 12 bytes for frame header
-+ bytes 0-3 frame size
-+ bytes 4-11 pts
-+ */
-+ struct frameHeader {
-+ mfxU32 frame_size;
-+ mfxU32 pts_high;
-+ mfxU32 pts_low;
-+ } m_frameHeader;
-+
-+ mfxU64 m_frameNum;
-+ mfxStatus WriteStreamHeader();
-+ mfxStatus WriteFrameHeader();
-+ void UpdateNumberOfFrames();
-+};
-+#endif
-+
-+//timeinterval calculation helper
-+
-+template <int tag = 0>
-+class CTimeInterval : private no_copy {
-+ static double g_Freq;
-+ double& m_start;
-+ double m_own; //reference to this if external counter not required
-+ //since QPC functions are quite slow it makes sense to optionally enable them
-+ bool m_bEnable;
-+ msdk_tick m_StartTick;
-+
-+public:
-+ CTimeInterval(double& dRef, bool bEnable = true)
-+ : m_start(dRef),
-+ m_bEnable(bEnable),
-+ m_StartTick(0) {
-+ if (!m_bEnable)
-+ return;
-+ Initialize();
-+ }
-+ CTimeInterval(bool bEnable = true)
-+ : m_start(m_own),
-+ m_own(),
-+ m_bEnable(bEnable),
-+ m_StartTick(0) {
-+ if (!m_bEnable)
-+ return;
-+ Initialize();
-+ }
-+
-+ //updates external value with current time
-+ double Commit() {
-+ if (!m_bEnable)
-+ return 0.0;
-+
-+ if (0.0 != g_Freq) {
-+ m_start = MSDK_GET_TIME(msdk_time_get_tick(), m_StartTick, g_Freq);
-+ }
-+ return m_start;
-+ }
-+ //last comitted value
-+ double Last() {
-+ return m_start;
-+ }
-+ ~CTimeInterval() {
-+ Commit();
-+ }
-+
-+private:
-+ void Initialize() {
-+ if (0.0 == g_Freq) {
-+ g_Freq = (double)msdk_time_get_frequency();
-+ }
-+ m_StartTick = msdk_time_get_tick();
-+ }
-+};
-+
-+template <int tag>
-+double CTimeInterval<tag>::g_Freq = 0.0f;
-+
-+/** Helper class to measure execution time of some code. Use this class
-+ * if you need manual measurements.
-+ *
-+ * Usage example:
-+ * {
-+ * CTimer timer;
-+ * msdk_tick summary_tick;
-+ *
-+ * timer.Start()
-+ * function_to_measure();
-+ * summary_tick = timer.GetDelta();
-+ * printf("Elapsed time 1: %f\n", timer.GetTime());
-+ * ...
-+ * if (condition) timer.Start();
-+ function_to_measure();
-+ * if (condition) {
-+ * summary_tick += timer.GetDelta();
-+ * printf("Elapsed time 2: %f\n", timer.GetTime();
-+ * }
-+ * printf("Overall time: %f\n", CTimer::ConvertToSeconds(summary_tick);
-+ * }
-+ */
-+class CTimer {
-+public:
-+ CTimer() : start(0) {}
-+ static msdk_tick GetFrequency() {
-+ if (!frequency)
-+ frequency = msdk_time_get_frequency();
-+ return frequency;
-+ }
-+ static mfxF64 ConvertToSeconds(msdk_tick elapsed) {
-+ return MSDK_GET_TIME(elapsed, 0, GetFrequency());
-+ }
-+
-+ inline void Start() {
-+ start = msdk_time_get_tick();
-+ }
-+ inline msdk_tick GetDelta() {
-+ return msdk_time_get_tick() - start;
-+ }
-+ inline mfxF64 GetTime() {
-+ return MSDK_GET_TIME(msdk_time_get_tick(), start, GetFrequency());
-+ }
-+
-+protected:
-+ static msdk_tick frequency;
-+ msdk_tick start;
-+
-+private:
-+ CTimer(const CTimer&);
-+ void operator=(const CTimer&);
-+};
-+
-+/** Helper class to measure overall execution time of some code. Use this
-+ * class if you want to measure execution time of the repeatedly executed
-+ * code.
-+ *
-+ * Usage example 1:
-+ *
-+ * msdk_tick summary_tick = 0;
-+ *
-+ * void function() {
-+ *
-+ * {
-+ * CAutoTimer timer(&summary_tick);
-+ * ...
-+ * }
-+ * ...
-+ * int main() {
-+ * for (;condition;) {
-+ * function();
-+ * }
-+ * printf("Elapsed time: %f\n", CTimer::ConvertToSeconds(summary_tick);
-+ * return 0;
-+ * }
-+ *
-+ * Usage example 2:
-+ * {
-+ * msdk_tick summary_tick = 0;
-+ *
-+ * {
-+ * CAutoTimer timer(&summary_tick);
-+ *
-+ * for (;condition;) {
-+ * ...
-+ * {
-+ * function_to_measure();
-+ * timer.Sync();
-+ * printf("Progress: %f\n", CTimer::ConvertToSeconds(summary_tick);
-+ * }
-+ * ...
-+ * }
-+ * }
-+ * printf("Elapsed time: %f\n", CTimer::ConvertToSeconds(summary_tick);
-+ * }
-+ *
-+ */
-+class CAutoTimer {
-+public:
-+ CAutoTimer(msdk_tick& _elapsed) : elapsed(_elapsed), start(0) {
-+ elapsed = _elapsed;
-+ start = msdk_time_get_tick();
-+ }
-+ ~CAutoTimer() {
-+ elapsed += msdk_time_get_tick() - start;
-+ }
-+ msdk_tick Sync() {
-+ msdk_tick cur = msdk_time_get_tick();
-+ elapsed += cur - start;
-+ start = cur;
-+ return elapsed;
-+ }
-+
-+protected:
-+ msdk_tick& elapsed;
-+ msdk_tick start;
-+
-+private:
-+ CAutoTimer(const CAutoTimer&);
-+ void operator=(const CAutoTimer&);
-+};
-+
-+mfxStatus ConvertFrameRate(mfxF64 dFrameRate, mfxU32* pnFrameRateExtN, mfxU32* pnFrameRateExtD);
-+mfxF64 CalculateFrameRate(mfxU32 nFrameRateExtN, mfxU32 nFrameRateExtD);
-+
-+template <class T>
-+mfxU16 GetFreeSurfaceIndex(T* pSurfacesPool, mfxU16 nPoolSize) {
-+ constexpr mfxU16 MSDK_INVALID_SURF_IDX = 0xffff;
-+
-+ if (pSurfacesPool) {
-+ for (mfxU16 i = 0; i < nPoolSize; i++) {
-+ if (0 == pSurfacesPool[i].Data.Locked) {
-+ return i;
-+ }
-+ }
-+ }
-+ return MSDK_INVALID_SURF_IDX;
-+}
-+
-+mfxU16 GetFreeSurface(mfxFrameSurface1* pSurfacesPool, mfxU16 nPoolSize);
-+void FreeSurfacePool(mfxFrameSurface1* pSurfacesPool, mfxU16 nPoolSize);
-+
-+mfxU16 CalculateDefaultBitrate(mfxU32 nCodecId,
-+ mfxU32 nTargetUsage,
-+ mfxU32 nWidth,
-+ mfxU32 nHeight,
-+ mfxF64 dFrameRate);
-+
-+//serialization fnc set
-+std::basic_string<msdk_char> CodecIdToStr(mfxU32 nFourCC);
-+mfxU16 StrToTargetUsage(msdk_string strInput);
-+const msdk_char* TargetUsageToStr(mfxU16 tu);
-+const msdk_char* ColorFormatToStr(mfxU32 format);
-+const msdk_char* MfxStatusToStr(mfxStatus sts);
-+
-+// sets bitstream->PicStruct parsing first APP0 marker in bitstream
-+mfxStatus MJPEG_AVI_ParsePicStruct(mfxBitstream* bitstream);
-+
-+// For MVC encoding/decoding purposes
-+std::basic_string<msdk_char> FormMVCFileName(const msdk_char* strFileName, const mfxU32 numView);
-+
-+//piecewise linear function for bitrate approximation
-+class PartiallyLinearFNC {
-+ mfxF64* m_pX;
-+ mfxF64* m_pY;
-+ mfxU32 m_nPoints;
-+ mfxU32 m_nAllocated;
-+
-+public:
-+ PartiallyLinearFNC();
-+ ~PartiallyLinearFNC();
-+
-+ void AddPair(mfxF64 x, mfxF64 y);
-+ mfxF64 at(mfxF64);
-+
-+private:
-+ DISALLOW_COPY_AND_ASSIGN(PartiallyLinearFNC);
-+};
-+
-+// function for getting a pointer to a specific external buffer from the array
-+mfxExtBuffer* GetExtBuffer(mfxExtBuffer** ebuffers, mfxU32 nbuffers, mfxU32 BufferId);
-+
-+// returns false if buf length is insufficient, otherwise
-+// skips step bytes in buf with specified length and returns true
-+template <typename Buf_t, typename Length_t>
-+bool skip(const Buf_t*& buf, Length_t& length, Length_t step) {
-+ if (length < step)
-+ return false;
-+
-+ buf += step;
-+ length -= step;
-+
-+ return true;
-+}
-+
-+//do not link MediaSDK dispatched if class not used
-+struct MSDKAdapter {
-+ // returns the number of adapter associated with MSDK session, 0 for SW session
-+ static mfxU32 GetNumber(mfxSession session, mfxIMPL implVia = 0) {
-+ mfxU32 adapterNum = 0; // default
-+ mfxIMPL impl = MFX_IMPL_SOFTWARE; // default in case no HW IMPL is found
-+
-+ // we don't care for error codes in further code; if something goes wrong we fall back to the default adapter
-+ if (session) {
-+ MFXQueryIMPL(session, &impl);
-+ }
-+ else {
-+ // an auxiliary session, internal for this function
-+ mfxSession auxSession;
-+ memset(&auxSession, 0, sizeof(auxSession));
-+
-+ mfxVersion ver = { { 1, 1 } }; // minimum API version which supports multiple devices
-+ MFXInit(MFX_IMPL_HARDWARE_ANY | implVia, &ver, &auxSession);
-+ MFXQueryIMPL(auxSession, &impl);
-+ MFXClose(auxSession);
-+ }
-+
-+ // extract the base implementation type
-+ mfxIMPL baseImpl = MFX_IMPL_BASETYPE(impl);
-+
-+ const struct {
-+ // actual implementation
-+ mfxIMPL impl;
-+ // adapter's number
-+ mfxU32 adapterID;
-+
-+ } implTypes[] = { { MFX_IMPL_HARDWARE, 0 },
-+ { MFX_IMPL_SOFTWARE, 0 },
-+ { MFX_IMPL_HARDWARE2, 1 },
-+ { MFX_IMPL_HARDWARE3, 2 },
-+ { MFX_IMPL_HARDWARE4, 3 } };
-+
-+ // get corresponding adapter number
-+ for (mfxU8 i = 0; i < sizeof(implTypes) / sizeof(*implTypes); i++) {
-+ if (implTypes[i].impl == baseImpl) {
-+ adapterNum = implTypes[i].adapterID;
-+ break;
-+ }
-+ }
-+
-+ return adapterNum;
-+ }
-+};
-+
-+struct APIChangeFeatures {
-+ bool JpegDecode;
-+ bool JpegEncode;
-+ bool MVCDecode;
-+ bool MVCEncode;
-+ bool IntraRefresh;
-+ bool LowLatency;
-+ bool ViewOutput;
-+ bool LookAheadBRC;
-+ bool AudioDecode;
-+ bool SupportCodecPluginAPI;
-+};
-+
-+mfxVersion getMinimalRequiredVersion(const APIChangeFeatures& features);
-+
-+enum msdkAPIFeature {
-+ MSDK_FEATURE_NONE,
-+ MSDK_FEATURE_MVC,
-+ MSDK_FEATURE_JPEG_DECODE,
-+ MSDK_FEATURE_LOW_LATENCY,
-+ MSDK_FEATURE_MVC_VIEWOUTPUT,
-+ MSDK_FEATURE_JPEG_ENCODE,
-+ MSDK_FEATURE_LOOK_AHEAD,
-+ MSDK_FEATURE_PLUGIN_API
-+};
-+
-+/* Returns true if feature is supported in the given API version */
-+bool CheckVersion(mfxVersion* version, msdkAPIFeature feature);
-+
-+void ConfigureAspectRatioConversion(mfxInfoVPP* pVppInfo);
-+
-+void SEICalcSizeType(std::vector<mfxU8>& data, mfxU16 type, mfxU32 size);
-+
-+mfxU8 Char2Hex(msdk_char ch);
-+
-+enum MsdkTraceLevel {
-+ MSDK_TRACE_LEVEL_SILENT = -1,
-+ MSDK_TRACE_LEVEL_CRITICAL = 0,
-+ MSDK_TRACE_LEVEL_ERROR = 1,
-+ MSDK_TRACE_LEVEL_WARNING = 2,
-+ MSDK_TRACE_LEVEL_INFO = 3,
-+ MSDK_TRACE_LEVEL_DEBUG = 4,
-+};
-+
-+msdk_string NoFullPath(const msdk_string&);
-+int msdk_trace_get_level();
-+void msdk_trace_set_level(int);
-+bool msdk_trace_is_printable(int);
-+
-+msdk_ostream& operator<<(msdk_ostream& os, MsdkTraceLevel tt);
-+
-+template <typename T>
-+mfxStatus msdk_opt_read(const msdk_char* string, T& value);
-+
-+template <size_t S>
-+mfxStatus msdk_opt_read(const msdk_char* string, msdk_char (&value)[S]) {
-+ if (!S) {
-+ return MFX_ERR_UNKNOWN;
-+ }
-+ value[0] = 0;
-+#if defined(_WIN32) || defined(_WIN64)
-+ value[S - 1] = 0;
-+ return (0 == _tcsncpy_s(value, string, S - 1)) ? MFX_ERR_NONE : MFX_ERR_UNKNOWN;
-+#else
-+ if (strlen(string) < S) {
-+ strncpy(value, string, S - 1);
-+ value[S - 1] = 0;
-+ return MFX_ERR_NONE;
-+ }
-+ return MFX_ERR_UNKNOWN;
-+#endif
-+}
-+
-+template <typename T>
-+inline mfxStatus msdk_opt_read(const msdk_string& string, T& value) {
-+ return msdk_opt_read(string.c_str(), value);
-+}
-+
-+mfxStatus StrFormatToCodecFormatFourCC(msdk_char* strInput, mfxU32& codecFormat);
-+msdk_string StatusToString(mfxStatus sts);
-+mfxI32 getMonitorType(msdk_char* str);
-+
-+void WaitForDeviceToBecomeFree(MFXVideoSession& session,
-+ mfxSyncPoint& syncPoint,
-+ mfxStatus& currentStatus);
-+
-+mfxU16 FourCCToChroma(mfxU32 fourCC);
-+
-+#endif //__SAMPLE_UTILS_H__
-diff --git a/tools/legacy/sample_common/include/vpl_implementation_loader.h b/tools/legacy/sample_common/include/vpl_implementation_loader.h
-new file mode 100644
-index 0000000..d5f8fe5
---- /dev/null
-+++ b/tools/legacy/sample_common/include/vpl_implementation_loader.h
-@@ -0,0 +1,73 @@
-+/******************************************************************************\
-+Copyright (c) 2021, Intel Corporation
-+All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without modification,
-+are permitted provided that the following conditions are met:
-+
-+1. Redistributions of source code must retain the above copyright notice, this
-+list of conditions and the following disclaimer.
-+
-+2. Redistributions in binary form must reproduce the above copyright notice,
-+this list of conditions and the following disclaimer in the documentation and/or
-+other materials provided with the distribution.
-+
-+3. Neither the name of the copyright holder nor the names of its contributors
-+may be used to endorse or promote products derived from this software without
-+specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
-+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+This sample was distributed or derived from the Intel's Media Samples package.
-+The original version of this sample may be obtained from
-+https://software.intel.com/en-us/intel-media-server-studio or
-+https://software.intel.com/en-us/media-client-solutions-support.
-+\**********************************************************************************/
-+
-+#ifndef __VPL_IMPLEMENTATION_LOADER_H__
-+#define __VPL_IMPLEMENTATION_LOADER_H__
-+
-+#include <vector>
-+#include "vpl/mfxdispatcher.h"
-+#include "vpl/mfxvideo++.h"
-+
-+class VPLImplementationLoader {
-+ mfxLoader m_Loader;
-+ std::vector<mfxConfig> m_Configs;
-+ mfxImplDescription *m_idesc;
-+ mfxU32 m_ImplIndex;
-+
-+public:
-+ VPLImplementationLoader();
-+ ~VPLImplementationLoader();
-+
-+ mfxStatus CreateConfig(mfxU16 data, const char *propertyName);
-+ mfxStatus CreateConfig(mfxU32 data, const char *propertyName);
-+ mfxStatus ConfigureImplementation(mfxIMPL impl);
-+ mfxStatus ConfigureAccelerationMode(mfxAccelerationMode accelerationMode, mfxIMPL impl);
-+ mfxStatus ConfigureVersion(mfxVersion const &version);
-+ mfxStatus EnumImplementations();
-+ mfxStatus EnumImplementations(mfxU16 deviceID, mfxU32 adapterNum);
-+ mfxStatus ConfigureAndEnumImplementations(mfxIMPL impl,
-+ mfxAccelerationMode accelerationMode,
-+ mfxVersion const &version);
-+ mfxLoader GetLoader();
-+ mfxU32 GetImplIndex() const;
-+ mfxStatus GetVersion(mfxVersion *version);
-+};
-+
-+class MainVideoSession : public MFXVideoSession {
-+public:
-+ mfxStatus CreateSession(VPLImplementationLoader *Loader);
-+};
-+
-+#endif //__VPL_IMPLEMENTATION_LOADER_H__
-diff --git a/tools/legacy/sample_common/src/plugin_utils.cpp b/tools/legacy/sample_common/src/plugin_utils.cpp
-index 1db329e..03e3e73 100644
---- a/tools/legacy/sample_common/src/plugin_utils.cpp
-+++ b/tools/legacy/sample_common/src/plugin_utils.cpp
-@@ -8,7 +8,6 @@
-
- #include <map>
- #include <sstream>
--#include "mfxvp8.h"
- #include "plugin_utils.h"
-
- bool AreGuidsEqual(const mfxPluginUID& guid1, const mfxPluginUID& guid2) {
-@@ -31,9 +30,6 @@ mfxStatus ConvertStringToGuid(const msdk_string& strGuid, mfxPluginUID& mfxGuid)
- uid[MSDK_STRING("hevce_gacc")] = MFX_PLUGINID_HEVCE_GACC;
- uid[MSDK_STRING("hevce_hw")] = MFX_PLUGINID_HEVCE_HW;
-
-- uid[MSDK_STRING("vp8d_hw")] = MFX_PLUGINID_VP8D_HW;
-- uid[MSDK_STRING("vp8e_hw")] = MFX_PLUGINID_VP8E_HW;
--
- uid[MSDK_STRING("vp9d_hw")] = MFX_PLUGINID_VP9D_HW;
- uid[MSDK_STRING("vp9e_hw")] = MFX_PLUGINID_VP9E_HW;
-
-@@ -96,10 +92,6 @@ const mfxPluginUID& msdkGetPluginUID(mfxIMPL impl, msdkComponentType type, mfxU3
- else {
- switch (type) {
- case MSDK_VENCODE:
-- switch (uCodecid) {
-- case MFX_CODEC_VP8:
-- return MFX_PLUGINID_VP8E_HW;
-- }
- break;
- #if MFX_VERSION >= 1027
- case (MSDK_VENCODE | MSDK_FEI):
-diff --git a/tools/legacy/sample_common/src/vpl_implementation_loader.cpp b/tools/legacy/sample_common/src/vpl_implementation_loader.cpp
-new file mode 100644
-index 0000000..2edb0d7
---- /dev/null
-+++ b/tools/legacy/sample_common/src/vpl_implementation_loader.cpp
-@@ -0,0 +1,220 @@
-+/******************************************************************************\
-+Copyright (c) 2021, Intel Corporation
-+All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without modification,
-+are permitted provided that the following conditions are met:
-+
-+1. Redistributions of source code must retain the above copyright notice, this
-+list of conditions and the following disclaimer.
-+
-+2. Redistributions in binary form must reproduce the above copyright notice,
-+this list of conditions and the following disclaimer in the documentation and/or
-+other materials provided with the distribution.
-+
-+3. Neither the name of the copyright holder nor the names of its contributors
-+may be used to endorse or promote products derived from this software without
-+specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
-+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+This sample was distributed or derived from the Intel's Media Samples package.
-+The original version of this sample may be obtained from
-+https://software.intel.com/en-us/intel-media-server-studio or
-+https://software.intel.com/en-us/media-client-solutions-support.
-+\**********************************************************************************/
-+
-+#include "vpl_implementation_loader.h"
-+#include "sample_defs.h"
-+#include "vpl/mfxdispatcher.h"
-+
-+VPLImplementationLoader::VPLImplementationLoader() {
-+ m_Loader = MFXLoad();
-+ m_idesc = nullptr;
-+ m_ImplIndex = 0;
-+}
-+
-+VPLImplementationLoader::~VPLImplementationLoader() {
-+ if (m_idesc) {
-+ MFXDispReleaseImplDescription(m_Loader, m_idesc);
-+ }
-+ MFXUnload(m_Loader);
-+}
-+
-+mfxStatus VPLImplementationLoader::CreateConfig(mfxU16 data, const char *propertyName) {
-+ mfxConfig cfg = MFXCreateConfig(m_Loader);
-+ mfxVariant variant;
-+ variant.Type = MFX_VARIANT_TYPE_U16;
-+ variant.Data.U32 = data;
-+ mfxStatus sts = MFXSetConfigFilterProperty(cfg, (mfxU8 *)propertyName, variant);
-+ MSDK_CHECK_STATUS(sts, "MFXSetConfigFilterProperty failed");
-+ m_Configs.push_back(cfg);
-+
-+ return sts;
-+}
-+
-+mfxStatus VPLImplementationLoader::CreateConfig(mfxU32 data, const char *propertyName) {
-+ mfxConfig cfg = MFXCreateConfig(m_Loader);
-+ mfxVariant variant;
-+ variant.Type = MFX_VARIANT_TYPE_U32;
-+ variant.Data.U32 = data;
-+ mfxStatus sts = MFXSetConfigFilterProperty(cfg, (mfxU8 *)propertyName, variant);
-+ MSDK_CHECK_STATUS(sts, "MFXSetConfigFilterProperty failed");
-+ m_Configs.push_back(cfg);
-+
-+ return sts;
-+}
-+
-+mfxStatus VPLImplementationLoader::ConfigureImplementation(mfxIMPL impl) {
-+ mfxConfig cfgImpl = MFXCreateConfig(m_Loader);
-+
-+ mfxVariant ImplVariant;
-+ ImplVariant.Type = MFX_VARIANT_TYPE_U32;
-+
-+ std::vector<mfxU32> hwImpls = { MFX_IMPL_HARDWARE, MFX_IMPL_HARDWARE_ANY, MFX_IMPL_HARDWARE2,
-+ MFX_IMPL_HARDWARE3, MFX_IMPL_HARDWARE4, MFX_IMPL_VIA_D3D9,
-+ MFX_IMPL_VIA_D3D11 };
-+
-+ std::vector<mfxU32>::iterator hwImplsIt =
-+ std::find_if(hwImpls.begin(), hwImpls.end(), [impl](const mfxU32 &val) {
-+ return (val == MFX_IMPL_VIA_MASK(impl) || val == MFX_IMPL_BASETYPE(impl));
-+ });
-+
-+ if (MFX_IMPL_BASETYPE(impl) == MFX_IMPL_SOFTWARE) {
-+ ImplVariant.Data.U32 = MFX_IMPL_TYPE_SOFTWARE;
-+ }
-+ else if (hwImplsIt != hwImpls.end()) {
-+ ImplVariant.Data.U32 = MFX_IMPL_TYPE_HARDWARE;
-+ }
-+ else {
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ mfxStatus sts =
-+ MFXSetConfigFilterProperty(cfgImpl, (mfxU8 *)"mfxImplDescription.Impl", ImplVariant);
-+ MSDK_CHECK_STATUS(sts, "MFXSetConfigFilterProperty failed");
-+ m_Configs.push_back(cfgImpl);
-+ return sts;
-+}
-+
-+mfxStatus VPLImplementationLoader::ConfigureAccelerationMode(mfxAccelerationMode accelerationMode,
-+ mfxIMPL impl) {
-+ mfxStatus sts = MFX_ERR_NONE;
-+ bool isHW = impl == MFX_IMPL_SOFTWARE ? false : true;
-+
-+ // configure accelerationMode, except when required implementation is
-+ // MFX_IMPL_TYPE_HARDWARE, but m_accelerationMode not set
-+ if (accelerationMode != MFX_ACCEL_MODE_NA || !isHW) {
-+ sts = CreateConfig((mfxU32)accelerationMode, "mfxImplDescription.AccelerationMode");
-+ }
-+
-+ return sts;
-+}
-+
-+mfxStatus VPLImplementationLoader::ConfigureVersion(mfxVersion const &version) {
-+ mfxStatus sts = MFX_ERR_NONE;
-+
-+ sts = CreateConfig(version.Version, "mfxImplDescription.ApiVersion.Version");
-+ sts = CreateConfig(version.Major, "mfxImplDescription.ApiVersion.Major");
-+ sts = CreateConfig(version.Minor, "mfxImplDescription.ApiVersion.Minor");
-+
-+ return sts;
-+}
-+
-+mfxStatus VPLImplementationLoader::EnumImplementations() {
-+ // pick the first available implementation, m_desc is checked only for being
-+ // non-equal to NULL potentially may be needed loop by implementations, set
-+ // implIndex corresponding better implementation and add meaningful validation
-+ // for the m_idesc
-+ mfxImplDescription *idesc;
-+ mfxStatus sts =
-+ MFXEnumImplementations(m_Loader, 0, MFX_IMPLCAPS_IMPLDESCSTRUCTURE, (mfxHDL *)&idesc);
-+ MSDK_CHECK_STATUS(sts, "MFXEnumImplementations failed");
-+ MSDK_CHECK_POINTER(idesc, MFX_ERR_NULL_PTR);
-+ m_idesc = idesc;
-+
-+ m_ImplIndex = 0;
-+
-+ return sts;
-+}
-+
-+mfxStatus VPLImplementationLoader::EnumImplementations(mfxU16 deviceID, mfxU32 adapterNum) {
-+ mfxImplDescription *idesc;
-+ mfxStatus sts = MFX_ERR_NONE;
-+ mfxChar devIDAndAdapter[MFX_STRFIELD_LEN] = {};
-+ snprintf(devIDAndAdapter, sizeof(devIDAndAdapter), "%x/%d", deviceID, adapterNum);
-+
-+ int impl = 0;
-+ while (sts == MFX_ERR_NONE) {
-+ sts = MFXEnumImplementations(m_Loader,
-+ impl,
-+ MFX_IMPLCAPS_IMPLDESCSTRUCTURE,
-+ (mfxHDL *)&idesc);
-+ if (!idesc) {
-+ sts = MFX_ERR_NULL_PTR;
-+ break;
-+ }
-+ else if (strncmp(idesc->Dev.DeviceID, devIDAndAdapter, sizeof(devIDAndAdapter)) == 0) {
-+ m_idesc = idesc;
-+ m_ImplIndex = impl;
-+ break;
-+ }
-+ impl++;
-+ }
-+
-+ return sts;
-+}
-+
-+mfxStatus VPLImplementationLoader::ConfigureAndEnumImplementations(
-+ mfxIMPL impl,
-+ mfxAccelerationMode accelerationMode,
-+ mfxVersion const &version) {
-+ mfxStatus sts;
-+
-+ sts = ConfigureImplementation(impl);
-+ MSDK_CHECK_STATUS(sts, "ConfigureImplementation failed");
-+
-+ sts = ConfigureAccelerationMode(accelerationMode, impl);
-+ MSDK_CHECK_STATUS(sts, "ConfigureAccelerationMode failed");
-+
-+ sts = EnumImplementations();
-+ MSDK_CHECK_STATUS(sts, "EnumImplementations failed");
-+
-+ return sts;
-+}
-+
-+mfxLoader VPLImplementationLoader::GetLoader() {
-+ return m_Loader;
-+}
-+
-+mfxU32 VPLImplementationLoader::GetImplIndex() const {
-+ return m_ImplIndex;
-+};
-+
-+mfxStatus VPLImplementationLoader::GetVersion(mfxVersion *version) {
-+ if (!m_idesc) {
-+ EnumImplementations();
-+ }
-+
-+ if (m_idesc) {
-+ version->Major = m_idesc->ApiVersion.Major;
-+ version->Minor = m_idesc->ApiVersion.Minor;
-+ version->Version = m_idesc->ApiVersion.Version;
-+ return MFX_ERR_NONE;
-+ }
-+
-+ return MFX_ERR_UNKNOWN;
-+}
-+
-+mfxStatus MainVideoSession::CreateSession(VPLImplementationLoader *Loader) {
-+ return MFXCreateSession(Loader->GetLoader(), Loader->GetImplIndex(), &m_session);
-+}
-diff --git a/tools/legacy/sample_multi_transcode/CMakeLists.txt b/tools/legacy/sample_multi_transcode/CMakeLists.txt
-new file mode 100644
-index 0000000..2121c57
---- /dev/null
-+++ b/tools/legacy/sample_multi_transcode/CMakeLists.txt
-@@ -0,0 +1,42 @@
-+# ##############################################################################
-+# Copyright (C) 2021 Intel Corporation
-+#
-+# SPDX-License-Identifier: MIT
-+# ##############################################################################
-+cmake_minimum_required(VERSION 3.10.2)
-+
-+set(TARGET sample_multi_transcode)
-+
-+set(SOURCES "")
-+list(APPEND SOURCES src/pipeline_transcode.cpp src/sample_multi_transcode.cpp
-+ src/transcode_utils.cpp)
-+
-+add_executable(${TARGET} ${SOURCES})
-+
-+if(MSVC)
-+ add_definitions(-D_CRT_SECURE_NO_WARNINGS)
-+endif()
-+
-+if(POLICY CMP0074)
-+ # ignore warning of VPL_ROOT in find_package search path
-+ cmake_policy(SET CMP0074 OLD)
-+endif()
-+
-+target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
-+ ${CMAKE_SOURCE_DIR}/api/vpl)
-+find_package(VPL REQUIRED)
-+target_link_libraries(${TARGET} sample_common media_sdk_compatibility_headers)
-+add_definitions(-DMFX_ONEVPL)
-+if(UNIX)
-+ target_link_libraries(${TARGET} ${PKG_LIBVA_LIBRARIES} ${CMAKE_DL_LIBS}
-+ pthread)
-+ add_definitions(-DLIBVA_SUPPORT -DLIBVA_DRM_SUPPORT -DLINUX64)
-+ target_include_directories(${TARGET} PRIVATE ${PKG_LIBVA_INCLUDE_DIRS}
-+ ${PKG_LIBDRM_INCLUDE_DIRS})
-+else()
-+ target_link_libraries(${TARGET} DXGI D3D11 D3D9 DXVA2)
-+ add_definitions(-DMFX_D3D11_SUPPORT)
-+endif()
-+
-+install(TARGETS ${TARGET} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-+ COMPONENT runtime)
-diff --git a/tools/legacy/sample_multi_transcode/include/pipeline_transcode.h b/tools/legacy/sample_multi_transcode/include/pipeline_transcode.h
-new file mode 100644
-index 0000000..457d72c
---- /dev/null
-+++ b/tools/legacy/sample_multi_transcode/include/pipeline_transcode.h
-@@ -0,0 +1,973 @@
-+/******************************************************************************\
-+Copyright (c) 2005-2019, Intel Corporation
-+All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-+
-+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-+
-+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-+
-+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+This sample was distributed or derived from the Intel's Media Samples package.
-+The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
-+or https://software.intel.com/en-us/media-client-solutions-support.
-+\**********************************************************************************/
-+
-+#ifndef __SAMPLE_PIPELINE_TRANSCODE_H__
-+#define __SAMPLE_PIPELINE_TRANSCODE_H__
-+
-+#include <stddef.h>
-+
-+#include <chrono>
-+#include <ctime>
-+#include <future>
-+#include <list>
-+#include <map>
-+#include <memory>
-+#include <mutex>
-+#include <vector>
-+
-+#include "base_allocator.h"
-+#include "mfx_multi_vpp.h"
-+#include "rotate_plugin_api.h"
-+#include "sample_defs.h"
-+#include "sample_utils.h"
-+#include "sysmem_allocator.h"
-+
-+#include "mfxdispatcher.h"
-+#include "mfxjpeg.h"
-+#include "mfxmvc.h"
-+#include "mfxvideo++.h"
-+#include "mfxvideo.h"
-+#if !defined(MFX_ONEVPL)
-+ #include "mfxla.h"
-+#endif
-+#include "mfxvp8.h"
-+
-+#if defined(MFX_ONEVPL)
-+ #include "mfxdeprecated.h"
-+#endif
-+
-+#include "mfxplugin.h"
-+
-+#if !defined(MFX_ONEVPL)
-+ #include "mfxplugin++.h"
-+ #include "plugin_loader.h"
-+#endif
-+
-+#include "hw_device.h"
-+#include "plugin_utils.h"
-+#include "preset_manager.h"
-+#include "sample_defs.h"
-+
-+#if (MFX_VERSION >= 1024)
-+ #include "brc_routines.h"
-+#endif
-+
-+#define TIME_STATS 1 // Enable statistics processing
-+#include "time_statistics.h"
-+
-+#if defined(_WIN32) || defined(_WIN64)
-+ #include "decode_render.h"
-+#endif
-+
-+#if defined(_WIN32) || defined(_WIN64)
-+ #define MSDK_CPU_ROTATE_PLUGIN MSDK_STRING("sample_rotate_plugin.dll")
-+ #define MSDK_OCL_ROTATE_PLUGIN MSDK_STRING("sample_plugin_opencl.dll")
-+#else
-+ #define MSDK_CPU_ROTATE_PLUGIN MSDK_STRING("libsample_rotate_plugin.so")
-+ #define MSDK_OCL_ROTATE_PLUGIN MSDK_STRING("libsample_plugin_opencl.so")
-+#endif
-+
-+#define MAX_PREF_LEN 256
-+
-+#ifndef MFX_VERSION
-+ #error MFX_VERSION not defined
-+#endif
-+
-+#ifdef ENABLE_MCTF
-+const mfxU16 MCTF_MID_FILTER_STRENGTH = 10;
-+const mfxF64 MCTF_LOSSLESS_BPP = 0.0;
-+#endif
-+
-+namespace TranscodingSample {
-+enum PipelineMode {
-+ Native =
-+ 0, // means that pipeline is based depends on the cmd parameters (decode/encode/transcode)
-+ Sink, // means that pipeline makes decode only and put data to shared buffer
-+ Source, // means that pipeline makes vpp + encode and get data from shared buffer
-+ VppComp, // means that pipeline makes vpp composition + encode and get data from shared buffer
-+ VppCompOnly, // means that pipeline makes vpp composition and get data from shared buffer
-+ VppCompOnlyEncode // means that pipeline makes vpp composition + encode and get data from shared buffer
-+};
-+
-+enum VppCompDumpMode { NULL_RENDER_VPP_COMP = 1, DUMP_FILE_VPP_COMP = 2 };
-+
-+enum EFieldCopyMode { FC_NONE = 0, FC_T2T = 1, FC_T2B = 2, FC_B2T = 4, FC_B2B = 8, FC_FR2FR = 16 };
-+
-+struct sVppCompDstRect {
-+ mfxU32 DstX;
-+ mfxU32 DstY;
-+ mfxU32 DstW;
-+ mfxU32 DstH;
-+ mfxU16 TileId;
-+};
-+
-+#ifdef ENABLE_MCTF
-+typedef enum {
-+ VPP_FILTER_DISABLED = 0,
-+ VPP_FILTER_ENABLED_DEFAULT = 1,
-+ VPP_FILTER_ENABLED_CONFIGURED = 7
-+
-+} VPPFilterMode;
-+
-+// this is a structure with mctf-parameteres
-+// that can be changed in run-time;
-+struct sMctfRunTimeParam {
-+ #ifdef ENABLE_MCTF_EXT
-+ #if 0
-+ mfxU32 BitsPerPixelx100k;
-+ mfxU16 Deblock;
-+ #endif
-+ #endif
-+ mfxU16 FilterStrength;
-+};
-+
-+struct sMctfRunTimeParams {
-+ sMctfRunTimeParams() : CurIdx(0) {}
-+
-+ mfxU32 CurIdx;
-+ std::vector<sMctfRunTimeParam> RunTimeParams;
-+ // returns rt-param corresponding to CurIdx or NULL if
-+ // CurIdx is behind available info
-+ const sMctfRunTimeParam *GetCurParam();
-+ // move CurIdx forward
-+ void MoveForward();
-+ // set CurIdx to the begining; restart indexing;
-+ void Restart();
-+ // reset vector & index
-+ void Reset();
-+ // test for emptiness
-+ bool Empty() {
-+ return RunTimeParams.empty();
-+ };
-+};
-+
-+struct sMCTFParam {
-+ sMctfRunTimeParams rtParams;
-+ mfxExtVppMctf params;
-+ VPPFilterMode mode;
-+};
-+#endif
-+
-+enum ExtBRCType { EXTBRC_DEFAULT, EXTBRC_OFF, EXTBRC_ON, EXTBRC_IMPLICIT };
-+
-+enum MemoryModel {
-+ UNKNOWN_ALLOC = 0, // GENERAL_ALLOC will be used by default
-+ GENERAL_ALLOC = 1,
-+ VISIBLE_INT_ALLOC = 2,
-+ HIDDEN_INT_ALLOC = 3
-+};
-+
-+struct __sInputParams {
-+ // session parameters
-+ bool bIsJoin;
-+ mfxPriority priority;
-+ // common parameters
-+ mfxIMPL libType; // Type of used mediaSDK library
-+#if defined(LINUX32) || defined(LINUX64)
-+ std::string strDevicePath;
-+#endif
-+#if (defined(_WIN32) || defined(_WIN64)) && (MFX_VERSION >= 1031)
-+ //Adapter type
-+ bool bPrefferiGfx;
-+ bool bPrefferdGfx;
-+#endif
-+ bool bIsPerf; // special performance mode. Use pre-allocated bitstreams, output
-+ mfxU16 nThreadsNum; // number of internal session threads number
-+ bool bRobustFlag; // Robust transcoding mode. Allows auto-recovery after hardware errors
-+ bool bSoftRobustFlag;
-+
-+ mfxU32 EncodeId; // type of output coded video
-+ mfxU32 DecodeId; // type of input coded video
-+
-+ msdk_char strSrcFile[MSDK_MAX_FILENAME_LEN]; // source bitstream file
-+ msdk_char strDstFile[MSDK_MAX_FILENAME_LEN]; // destination bitstream file
-+ msdk_char strDumpVppCompFile[MSDK_MAX_FILENAME_LEN]; // VPP composition output dump file
-+ msdk_char strMfxParamsDumpFile[MSDK_MAX_FILENAME_LEN];
-+
-+ // specific encode parameters
-+ mfxU16 nTargetUsage;
-+ mfxF64 dDecoderFrameRateOverride;
-+ mfxF64 dEncoderFrameRateOverride;
-+ mfxU16 EncoderPicstructOverride;
-+ mfxF64 dVPPOutFramerate;
-+ mfxU16 nBitRate;
-+ mfxU16 nBitRateMultiplier;
-+ mfxU16 nQuality; // quality parameter for JPEG encoder
-+ mfxU16 nDstWidth; // destination picture width, specified if resizing required
-+ mfxU16 nDstHeight; // destination picture height, specified if resizing required
-+
-+ mfxU16 nEncTileRows; // number of rows for encoding tiling
-+ mfxU16 nEncTileCols; // number of columns for encoding tiling
-+
-+ bool bEnableDeinterlacing;
-+ mfxU16 DeinterlacingMode;
-+ int DenoiseLevel;
-+ int DetailLevel;
-+ mfxU16 FRCAlgorithm;
-+ EFieldCopyMode fieldProcessingMode;
-+ mfxU16 ScalingMode;
-+
-+ mfxU16 nAsyncDepth; // asyncronous queue
-+
-+ PipelineMode eMode;
-+ PipelineMode eModeExt;
-+
-+ mfxU32 FrameNumberPreference; // how many surfaces user wants
-+ mfxU32 MaxFrameNumber; // maximum frames for transcoding
-+ mfxU32 numSurf4Comp;
-+ mfxU16 numTiles4Comp;
-+
-+ mfxU16 nSlices; // number of slices for encoder initialization
-+ mfxU16 nMaxSliceSize; //maximum size of slice
-+
-+ mfxU16 WinBRCMaxAvgKbps;
-+ mfxU16 WinBRCSize;
-+ mfxU16 BufferSizeInKB;
-+ mfxU16 GopPicSize;
-+ mfxU16 GopRefDist;
-+ mfxU16 NumRefFrame;
-+ mfxU16 nBRefType;
-+ mfxU16 RepartitionCheckMode;
-+ mfxU16 GPB;
-+ mfxU16 nTransformSkip;
-+
-+ mfxU16 CodecLevel;
-+ mfxU16 CodecProfile;
-+ mfxU16 MaxKbps;
-+ mfxU16 InitialDelayInKB;
-+ mfxU16 GopOptFlag;
-+ mfxU16 AdaptiveI;
-+ mfxU16 AdaptiveB;
-+
-+ mfxU16 WeightedPred;
-+ mfxU16 WeightedBiPred;
-+ mfxU16 ExtBrcAdaptiveLTR;
-+
-+ bool bExtMBQP;
-+
-+ // MVC Specific Options
-+ bool bIsMVC; // true if Multi-View-Codec is in use
-+ mfxU32 numViews; // number of views for Multi-View-Codec
-+
-+ mfxU16 nRotationAngle; // if specified, enables rotation plugin in mfx pipeline
-+ msdk_char strVPPPluginDLLPath[MSDK_MAX_FILENAME_LEN]; // plugin dll path and name
-+
-+ sPluginParams decoderPluginParams;
-+ sPluginParams encoderPluginParams;
-+
-+ mfxU32 nTimeout; // how long transcoding works in seconds
-+ mfxU32 nFPS; // limit transcoding to the number of frames per second
-+
-+ mfxU32 statisticsWindowSize;
-+ FILE *statisticsLogFile;
-+
-+ bool bLABRC; // use look ahead bitrate control algorithm
-+ mfxU16 nLADepth; // depth of the look ahead bitrate control algorithm
-+ bool bEnableExtLA;
-+ bool bEnableBPyramid;
-+ mfxU16 nRateControlMethod;
-+ mfxU16 nQPI;
-+ mfxU16 nQPP;
-+ mfxU16 nQPB;
-+ bool bDisableQPOffset;
-+
-+ mfxU16 nAvcTemp;
-+ mfxU16 nBaseLayerPID;
-+ mfxU16 nAvcTemporalLayers[8];
-+ mfxU16 nSPSId;
-+ mfxU16 nPPSId;
-+ mfxU16 nPicTimingSEI;
-+ mfxU16 nNalHrdConformance;
-+ mfxU16 nVuiNalHrdParameters;
-+
-+ bool bOpenCL;
-+ mfxU16 reserved[4];
-+
-+ mfxU16 nVppCompDstX;
-+ mfxU16 nVppCompDstY;
-+ mfxU16 nVppCompDstW;
-+ mfxU16 nVppCompDstH;
-+ mfxU16 nVppCompSrcW;
-+ mfxU16 nVppCompSrcH;
-+ mfxU16 nVppCompTileId;
-+
-+ mfxU32 DecoderFourCC;
-+ mfxU32 EncoderFourCC;
-+
-+ sVppCompDstRect *pVppCompDstRects;
-+
-+ bool bForceSysMem;
-+ mfxU16 DecOutPattern;
-+ mfxU16 VppOutPattern;
-+ mfxU16 nGpuCopyMode;
-+
-+ mfxU16 nRenderColorForamt; /*0 NV12 - default, 1 is ARGB*/
-+
-+ mfxI32 monitorType;
-+ bool shouldUseGreedyFormula;
-+ bool enableQSVFF;
-+ bool bSingleTexture;
-+
-+ ExtBRCType nExtBRC;
-+
-+ mfxU16 nAdaptiveMaxFrameSize;
-+ mfxU16 LowDelayBRC;
-+
-+ mfxU16 IntRefType;
-+ mfxU16 IntRefCycleSize;
-+ mfxU16 IntRefQPDelta;
-+ mfxU16 IntRefCycleDist;
-+
-+ mfxU32 nMaxFrameSize;
-+
-+ mfxU16 BitrateLimit;
-+
-+#if (MFX_VERSION >= 1025)
-+ mfxU16 numMFEFrames;
-+ mfxU16 MFMode;
-+ mfxU32 mfeTimeout;
-+#endif
-+
-+#if (MFX_VERSION >= 1027)
-+ mfxU16 TargetBitDepthLuma;
-+ mfxU16 TargetBitDepthChroma;
-+#endif
-+
-+#if defined(LIBVA_WAYLAND_SUPPORT)
-+ mfxU16 nRenderWinX;
-+ mfxU16 nRenderWinY;
-+ bool bPerfMode;
-+#endif
-+
-+#if defined(LIBVA_SUPPORT)
-+ mfxI32 libvaBackend;
-+#endif // defined(MFX_LIBVA_SUPPORT)
-+
-+ CHWDevice *m_hwdev;
-+
-+ EPresetModes PresetMode;
-+ bool shouldPrintPresets;
-+
-+ bool rawInput;
-+
-+ mfxU16 nMemoryModel;
-+};
-+
-+struct sInputParams : public __sInputParams {
-+ sInputParams();
-+ msdk_string DumpLogFileName;
-+#if MFX_VERSION >= 1022
-+ std::vector<mfxExtEncoderROI> m_ROIData;
-+
-+ bool bDecoderPostProcessing;
-+ bool bROIasQPMAP;
-+#endif //MFX_VERSION >= 1022
-+#ifdef ENABLE_MCTF
-+ sMCTFParam mctfParam;
-+#endif
-+};
-+
-+struct PreEncAuxBuffer {
-+ mfxEncodeCtrl encCtrl;
-+ mfxU16 Locked;
-+ mfxENCInput encInput;
-+ mfxENCOutput encOutput;
-+};
-+
-+struct ExtendedSurface {
-+ mfxFrameSurface1 *pSurface;
-+ PreEncAuxBuffer *pAuxCtrl;
-+ mfxEncodeCtrl *pEncCtrl;
-+ mfxSyncPoint Syncp;
-+};
-+
-+struct ExtendedBS {
-+ bool IsFree = true;
-+ mfxBitstreamWrapper Bitstream;
-+ mfxSyncPoint Syncp = nullptr;
-+ PreEncAuxBuffer *pCtrl = nullptr;
-+};
-+
-+class CIOStat : public CTimeStatistics {
-+public:
-+ CIOStat() : CTimeStatistics(), ofile(stdout) {
-+ MSDK_ZERO_MEMORY(bufDir);
-+ DumpLogFileName.clear();
-+ }
-+
-+ CIOStat(const msdk_char *dir) : CTimeStatistics(), ofile(stdout) {
-+ msdk_strncopy_s(bufDir, MAX_PREF_LEN, dir, MAX_PREF_LEN - 1);
-+ bufDir[MAX_PREF_LEN - 1] = 0;
-+ }
-+
-+ ~CIOStat() {}
-+
-+ inline void SetOutputFile(FILE *file) {
-+ ofile = file;
-+ }
-+
-+ inline void SetDumpName(const msdk_char *name) {
-+ DumpLogFileName = name;
-+ if (!DumpLogFileName.empty()) {
-+ TurnOnDumping();
-+ }
-+ else {
-+ TurnOffDumping();
-+ }
-+ }
-+
-+ inline void SetDirection(const msdk_char *dir) {
-+ if (dir) {
-+ msdk_strncopy_s(bufDir, MAX_PREF_LEN, dir, MAX_PREF_LEN - 1);
-+ bufDir[MAX_PREF_LEN - 1] = 0;
-+ }
-+ }
-+
-+ inline void PrintStatistics(mfxU32 numPipelineid,
-+ mfxF64 target_framerate = -1 /*default stands for infinite*/) {
-+ // print timings in ms
-+ msdk_fprintf(
-+ ofile,
-+ MSDK_STRING(
-+ "stat[%u.%llu]: %s=%d;Framerate=%.3f;Total=%.3lf;Samples=%lld;StdDev=%.3lf;Min=%.3lf;Max=%.3lf;Avg=%.3lf\n"),
-+ msdk_get_current_pid(),
-+ rdtsc(),
-+ bufDir,
-+ numPipelineid,
-+ target_framerate,
-+ GetTotalTime(false),
-+ GetNumMeasurements(),
-+ GetTimeStdDev(false),
-+ GetMinTime(false),
-+ GetMaxTime(false),
-+ GetAvgTime(false));
-+ fflush(ofile);
-+
-+ if (!DumpLogFileName.empty()) {
-+ msdk_char buf[MSDK_MAX_FILENAME_LEN];
-+ msdk_sprintf(buf, MSDK_STRING("%s_ID_%d.log"), DumpLogFileName.c_str(), numPipelineid);
-+ DumpDeltas(buf);
-+ }
-+ }
-+
-+ inline void DumpDeltas(msdk_char *file_name) {
-+ if (m_time_deltas.empty())
-+ return;
-+
-+ FILE *dump_file = NULL;
-+ if (!MSDK_FOPEN(dump_file, file_name, MSDK_STRING("a"))) {
-+ for (std::vector<mfxF64>::const_iterator it = m_time_deltas.begin();
-+ it != m_time_deltas.end();
-+ ++it) {
-+ fprintf(dump_file, "%.3f, ", (*it));
-+ }
-+ fclose(dump_file);
-+ }
-+ else {
-+ perror("DumpDeltas: file cannot be open");
-+ }
-+ }
-+
-+protected:
-+ msdk_tstring DumpLogFileName;
-+ FILE *ofile;
-+ msdk_char bufDir[MAX_PREF_LEN];
-+};
-+
-+class ExtendedBSStore {
-+public:
-+ explicit ExtendedBSStore(mfxU32 size) {
-+ m_pExtBS.resize(size);
-+ }
-+ virtual ~ExtendedBSStore() {
-+ m_pExtBS.clear();
-+ }
-+ ExtendedBS *GetNext() {
-+ for (mfxU32 i = 0; i < m_pExtBS.size(); i++) {
-+ if (m_pExtBS[i].IsFree) {
-+ m_pExtBS[i].IsFree = false;
-+ return &m_pExtBS[i];
-+ }
-+ }
-+ return NULL;
-+ }
-+ void Release(ExtendedBS *pBS) {
-+ for (mfxU32 i = 0; i < m_pExtBS.size(); i++) {
-+ if (&m_pExtBS[i] == pBS) {
-+ m_pExtBS[i].IsFree = true;
-+ return;
-+ }
-+ }
-+ return;
-+ }
-+ void ReleaseAll() {
-+ for (mfxU32 i = 0; i < m_pExtBS.size(); i++) {
-+ m_pExtBS[i].IsFree = true;
-+ }
-+ return;
-+ }
-+ void FlushAll() {
-+ for (mfxU32 i = 0; i < m_pExtBS.size(); i++) {
-+ m_pExtBS[i].Bitstream.DataLength = 0;
-+ m_pExtBS[i].Bitstream.DataOffset = 0;
-+ }
-+ return;
-+ }
-+
-+protected:
-+ std::vector<ExtendedBS> m_pExtBS;
-+
-+private:
-+ DISALLOW_COPY_AND_ASSIGN(ExtendedBSStore);
-+};
-+
-+class CTranscodingPipeline;
-+// thread safety buffer heterogeneous pipeline
-+// only for join sessions
-+class SafetySurfaceBuffer {
-+public:
-+ struct SurfaceDescriptor {
-+ ExtendedSurface ExtSurface;
-+ mfxU32 Locked;
-+ };
-+
-+ SafetySurfaceBuffer(SafetySurfaceBuffer *pNext);
-+ virtual ~SafetySurfaceBuffer();
-+
-+ mfxU32 GetLength();
-+ mfxStatus WaitForSurfaceRelease(mfxU32 msec);
-+ mfxStatus WaitForSurfaceInsertion(mfxU32 msec);
-+ void AddSurface(ExtendedSurface Surf);
-+ mfxStatus GetSurface(ExtendedSurface &Surf);
-+ mfxStatus ReleaseSurface(mfxFrameSurface1 *pSurf);
-+ mfxStatus ReleaseSurfaceAll();
-+ void CancelBuffering();
-+
-+ SafetySurfaceBuffer *m_pNext;
-+
-+protected:
-+ std::mutex m_mutex;
-+ std::list<SurfaceDescriptor> m_SList;
-+ bool m_IsBufferingAllowed;
-+ MSDKEvent *pRelEvent;
-+ MSDKEvent *pInsEvent;
-+
-+private:
-+ DISALLOW_COPY_AND_ASSIGN(SafetySurfaceBuffer);
-+};
-+
-+class FileBitstreamProcessor {
-+public:
-+ FileBitstreamProcessor();
-+ virtual ~FileBitstreamProcessor();
-+ virtual mfxStatus SetReader(std::unique_ptr<CSmplBitstreamReader> &reader);
-+ virtual mfxStatus SetReader(std::unique_ptr<CSmplYUVReader> &reader);
-+ virtual mfxStatus SetWriter(std::unique_ptr<CSmplBitstreamWriter> &writer);
-+ virtual mfxStatus GetInputBitstream(mfxBitstreamWrapper **pBitstream);
-+ virtual mfxStatus GetInputFrame(mfxFrameSurface1 *pSurface);
-+ virtual mfxStatus ProcessOutputBitstream(mfxBitstreamWrapper *pBitstream);
-+ virtual mfxStatus ResetInput();
-+ virtual mfxStatus ResetOutput();
-+
-+protected:
-+ std::unique_ptr<CSmplBitstreamReader> m_pFileReader;
-+ std::unique_ptr<CSmplYUVReader> m_pYUVFileReader;
-+ // for performance options can be zero
-+ std::unique_ptr<CSmplBitstreamWriter> m_pFileWriter;
-+ mfxBitstreamWrapper m_Bitstream;
-+
-+private:
-+ DISALLOW_COPY_AND_ASSIGN(FileBitstreamProcessor);
-+};
-+
-+// Bitstream is external via BitstreamProcessor
-+class CTranscodingPipeline {
-+public:
-+ CTranscodingPipeline();
-+ virtual ~CTranscodingPipeline();
-+
-+ virtual mfxStatus Init(sInputParams *pParams,
-+ MFXFrameAllocator *pMFXAllocator,
-+ void *hdl,
-+ CTranscodingPipeline *pParentPipeline,
-+ SafetySurfaceBuffer *pBuffer,
-+ FileBitstreamProcessor *pBSProc,
-+ VPLImplementationLoader *mfxLoader);
-+
-+ // frames allocation is suspended for heterogeneous pipeline
-+ virtual mfxStatus CompleteInit();
-+ virtual void Close();
-+ virtual mfxStatus Reset(VPLImplementationLoader *mfxLoader);
-+ virtual mfxStatus Join(MFXVideoSession *pChildSession);
-+ virtual mfxStatus Run();
-+ virtual mfxStatus FlushLastFrames() {
-+ return MFX_ERR_NONE;
-+ }
-+
-+ mfxU32 GetProcessFrames() {
-+ return m_nProcessedFramesNum;
-+ }
-+
-+ bool GetJoiningFlag() {
-+ return m_bIsJoinSession;
-+ }
-+
-+ mfxStatus QueryMFXVersion(mfxVersion *version) {
-+ MSDK_CHECK_POINTER(m_pmfxSession.get(), MFX_ERR_NULL_PTR);
-+ return m_pmfxSession->QueryVersion(version);
-+ };
-+ inline mfxU32 GetPipelineID() {
-+ return m_nID;
-+ }
-+ inline void SetPipelineID(mfxU32 id) {
-+ m_nID = id;
-+ }
-+ void StopSession();
-+ bool IsOverlayUsed();
-+ size_t GetRobustFlag();
-+
-+ msdk_string GetSessionText() {
-+ msdk_stringstream ss;
-+ ss << m_pmfxSession->operator mfxSession();
-+
-+ return ss.str();
-+ }
-+#if (defined(_WIN32) || defined(_WIN64)) && (MFX_VERSION >= 1031)
-+ //Adapter type
-+ void SetPrefferiGfx(bool prefferiGfx) {
-+ bPrefferiGfx = prefferiGfx;
-+ };
-+ void SetPrefferdGfx(bool prefferdGfx) {
-+ bPrefferdGfx = prefferdGfx;
-+ };
-+ bool IsPrefferiGfx() {
-+ return bPrefferiGfx;
-+ };
-+ bool IsPrefferdGfx() {
-+ return bPrefferdGfx;
-+ };
-+#endif
-+protected:
-+ virtual mfxStatus CheckRequiredAPIVersion(mfxVersion &version, sInputParams *pParams);
-+
-+ virtual mfxStatus Decode();
-+ virtual mfxStatus Encode();
-+ virtual mfxStatus Transcode();
-+ virtual mfxStatus DecodeOneFrame(ExtendedSurface *pExtSurface);
-+ virtual mfxStatus DecodeLastFrame(ExtendedSurface *pExtSurface);
-+ virtual mfxStatus VPPOneFrame(ExtendedSurface *pSurfaceIn, ExtendedSurface *pExtSurface);
-+ virtual mfxStatus EncodeOneFrame(ExtendedSurface *pExtSurface, mfxBitstreamWrapper *pBS);
-+#if !defined(MFX_ONEVPL)
-+ virtual mfxStatus PreEncOneFrame(ExtendedSurface *pInSurface, ExtendedSurface *pOutSurface);
-+#endif
-+ virtual mfxStatus DecodePreInit(sInputParams *pParams);
-+ virtual mfxStatus VPPPreInit(sInputParams *pParams);
-+ virtual mfxStatus EncodePreInit(sInputParams *pParams);
-+#if !defined(MFX_ONEVPL)
-+ virtual mfxStatus PreEncPreInit(sInputParams *pParams);
-+#endif
-+ mfxVideoParam GetDecodeParam();
-+
-+#if !defined(MFX_ONEVPL)
-+ mfxExtMVCSeqDesc GetDecMVCSeqDesc() {
-+ mfxExtMVCSeqDesc *mvc = m_mfxDecParams;
-+ return mvc ? *mvc : mfxExtMVCSeqDesc();
-+ }
-+#endif
-+ static void ModifyParamsUsingPresets(sInputParams &params,
-+ mfxF64 fps,
-+ mfxU32 width,
-+ mfxU32 height);
-+
-+ // alloc frames for all component
-+ mfxStatus AllocFrames(mfxFrameAllocRequest *pRequest, bool isDecAlloc);
-+ mfxStatus AllocFrames();
-+
-+#if !defined(MFX_ONEVPL)
-+ mfxStatus CorrectPreEncAuxPool(mfxU32 num_frames_in_pool);
-+ mfxStatus AllocPreEncAuxPool();
-+ void FreePreEncAuxPool();
-+#endif //!MFX_ONEVPL
-+
-+ // need for heterogeneous pipeline
-+ mfxStatus CalculateNumberOfReqFrames(mfxFrameAllocRequest &pRequestDecOut,
-+ mfxFrameAllocRequest &pRequestVPPOut);
-+ void CorrectNumberOfAllocatedFrames(mfxFrameAllocRequest *pNewReq);
-+ void FreeFrames();
-+
-+ mfxStatus LoadStaticSurface();
-+
-+ mfxFrameSurface1 *GetFreeSurface(bool isDec, mfxU64 timeout);
-+ mfxU32 GetFreeSurfacesCount(bool isDec);
-+ PreEncAuxBuffer *GetFreePreEncAuxBuffer();
-+ void SetEncCtrlRT(ExtendedSurface &extSurface, bool bInsertIDR);
-+
-+ // parameters configuration functions
-+ mfxStatus InitDecMfxParams(sInputParams *pInParams);
-+ mfxStatus InitVppMfxParams(sInputParams *pInParams);
-+ virtual mfxStatus InitEncMfxParams(sInputParams *pInParams);
-+ mfxStatus InitPluginMfxParams(sInputParams *pInParams);
-+#if !defined(MFX_ONEVPL)
-+ mfxStatus InitPreEncMfxParams(sInputParams *pInParams);
-+#endif
-+ virtual mfxU32 FileFourCC2EncFourCC(mfxU32 fcc);
-+ void FillFrameInfoForEncoding(mfxFrameInfo &info, sInputParams *pInParams);
-+
-+ mfxStatus AllocAndInitVppDoNotUse(sInputParams *pInParams);
-+ mfxStatus AllocMVCSeqDesc();
-+
-+ void FreeVppDoNotUse();
-+ void FreeMVCSeqDesc();
-+
-+ mfxStatus AllocateSufficientBuffer(mfxBitstreamWrapper *pBS);
-+ mfxStatus PutBS();
-+
-+ mfxStatus DumpSurface2File(mfxFrameSurface1 *pSurface);
-+ mfxStatus Surface2BS(ExtendedSurface *pSurf, mfxBitstreamWrapper *pBS, mfxU32 fourCC);
-+ mfxStatus NV12toBS(mfxFrameSurface1 *pSurface, mfxBitstreamWrapper *pBS);
-+ mfxStatus NV12asI420toBS(mfxFrameSurface1 *pSurface, mfxBitstreamWrapper *pBS);
-+ mfxStatus RGB4toBS(mfxFrameSurface1 *pSurface, mfxBitstreamWrapper *pBS);
-+ mfxStatus YUY2toBS(mfxFrameSurface1 *pSurface, mfxBitstreamWrapper *pBS);
-+
-+ void NoMoreFramesSignal();
-+ mfxStatus AddLaStreams(mfxU16 width, mfxU16 height);
-+
-+ void LockPreEncAuxBuffer(PreEncAuxBuffer *pBuff);
-+ void UnPreEncAuxBuffer(PreEncAuxBuffer *pBuff);
-+
-+ mfxU32 GetNumFramesForReset();
-+ void SetNumFramesForReset(mfxU32 nFrames);
-+
-+ void HandlePossibleGpuHang(mfxStatus &sts);
-+
-+ mfxStatus SetAllocatorAndHandleIfRequired();
-+ mfxStatus LoadGenericPlugin();
-+
-+ mfxBitstreamWrapper *m_pmfxBS; // contains encoded input data
-+
-+ mfxVersion m_Version; // real API version with which library is initialized
-+
-+ mfxLoader m_mfxLoader;
-+
-+ std::unique_ptr<MainVideoSession> m_pmfxSession;
-+ std::unique_ptr<MFXVideoDECODE> m_pmfxDEC;
-+ std::unique_ptr<MFXVideoENCODE> m_pmfxENC;
-+ std::unique_ptr<MFXVideoMultiVPP>
-+ m_pmfxVPP; // either VPP or VPPPlugin which wraps [VPP]-Plugin-[VPP] pipeline
-+#if !defined(MFX_ONEVPL)
-+ std::unique_ptr<MFXVideoENC> m_pmfxPreENC;
-+ std::unique_ptr<MFXVideoUSER> m_pUserDecoderModule;
-+ std::unique_ptr<MFXVideoUSER> m_pUserEncoderModule;
-+ std::unique_ptr<MFXVideoUSER> m_pUserEncModule;
-+ std::unique_ptr<MFXPlugin> m_pUserDecoderPlugin;
-+ std::unique_ptr<MFXPlugin> m_pUserEncoderPlugin;
-+ std::unique_ptr<MFXPlugin> m_pUserEncPlugin;
-+#endif //!MFX_ONEVPL
-+ mfxFrameAllocResponse m_mfxDecResponse; // memory allocation response for decoder
-+ mfxFrameAllocResponse m_mfxEncResponse; // memory allocation response for encoder
-+
-+ MFXFrameAllocator *m_pMFXAllocator;
-+ void *m_hdl; // Diret3D device manager
-+ bool m_bIsInterOrJoined;
-+
-+ mfxU32 m_numEncoders;
-+ mfxU32 m_encoderFourCC;
-+
-+ CSmplYUVWriter m_dumpVppCompFileWriter;
-+ mfxU32 m_vppCompDumpRenderMode;
-+
-+#if defined(_WIN32) || defined(_WIN64)
-+ CDecodeD3DRender *m_hwdev4Rendering;
-+#else
-+ CHWDevice *m_hwdev4Rendering;
-+#endif
-+
-+ typedef std::vector<mfxFrameSurface1 *> SurfPointersArray;
-+ SurfPointersArray m_pSurfaceDecPool;
-+ SurfPointersArray m_pSurfaceEncPool;
-+ mfxU16 m_EncSurfaceType; // actual type of encoder surface pool
-+ mfxU16 m_DecSurfaceType; // actual type of decoder surface pool
-+
-+ typedef std::vector<PreEncAuxBuffer> PreEncAuxArray;
-+ PreEncAuxArray m_pPreEncAuxPool;
-+
-+ // transcoding pipeline specific
-+ typedef std::list<ExtendedBS *> BSList;
-+ BSList m_BSPool;
-+
-+ mfxInitParamlWrap m_initPar;
-+
-+ volatile bool m_bForceStop;
-+
-+ sPluginParams m_decoderPluginParams;
-+ sPluginParams m_encoderPluginParams;
-+
-+ MfxVideoParamsWrapper m_mfxDecParams;
-+ MfxVideoParamsWrapper m_mfxEncParams;
-+ MfxVideoParamsWrapper m_mfxVppParams;
-+ MfxVideoParamsWrapper m_mfxPluginParams;
-+ bool m_bIsVpp; // true if there's VPP in the pipeline
-+ bool m_bIsFieldWeaving;
-+ bool m_bIsFieldSplitting;
-+ bool m_bIsPlugin; //true if there's Plugin in the pipeline
-+ RotateParam m_RotateParam;
-+ MfxVideoParamsWrapper m_mfxPreEncParams;
-+ mfxU32 m_nTimeout;
-+ bool m_bUseOverlay;
-+
-+ bool m_bROIasQPMAP;
-+ bool m_bExtMBQP;
-+ // various external buffers
-+ bool
-+ m_bOwnMVCSeqDescMemory; // true if the pipeline owns memory allocated for MVCSeqDesc structure fields
-+
-+ // to enable to-do list
-+ // number of video enhancement filters (denoise, procamp, detail, video_analysis, multi_view, ste, istab, tcc, ace, svc)
-+ constexpr static uint32_t ENH_FILTERS_COUNT = 20;
-+ mfxU32 m_tabDoUseAlg[ENH_FILTERS_COUNT];
-+
-+ mfxU32 m_nID;
-+ mfxU16 m_AsyncDepth;
-+ mfxU32 m_nProcessedFramesNum;
-+
-+ bool m_bIsJoinSession;
-+
-+ bool m_bDecodeEnable;
-+ bool m_bEncodeEnable;
-+ mfxU32 m_nVPPCompEnable;
-+ mfxI32 m_libvaBackend;
-+
-+ mfxU16 m_MemoryModel;
-+
-+ mfxSyncPoint m_LastDecSyncPoint;
-+
-+ SafetySurfaceBuffer *m_pBuffer;
-+ CTranscodingPipeline *m_pParentPipeline;
-+
-+ mfxFrameAllocRequest m_Request;
-+ bool m_bIsInit;
-+
-+ mfxU32 m_NumFramesForReset;
-+ std::mutex m_mReset;
-+ std::mutex m_mStopSession;
-+ bool m_bRobustFlag;
-+ bool m_bSoftGpuHangRecovery;
-+
-+ bool isHEVCSW;
-+
-+ bool m_bInsertIDR;
-+
-+ bool m_rawInput;
-+
-+ std::unique_ptr<ExtendedBSStore> m_pBSStore;
-+
-+ mfxU32 m_FrameNumberPreference;
-+ mfxU32 m_MaxFramesForTranscode;
-+
-+ // pointer to already extended bs processor
-+ FileBitstreamProcessor *m_pBSProcessor;
-+
-+ msdk_tick m_nReqFrameTime; // time required to transcode one frame
-+
-+ mfxU32 statisticsWindowSize; // Sliding window size for Statistics
-+ mfxU32 m_nOutputFramesNum;
-+
-+ CIOStat inputStatistics;
-+ CIOStat outputStatistics;
-+
-+ bool shouldUseGreedyFormula;
-+
-+#if MFX_VERSION >= 1022
-+ // ROI data
-+ std::vector<mfxExtEncoderROI> m_ROIData;
-+ mfxU32 m_nSubmittedFramesNum;
-+
-+ // ROI with MBQP map data
-+ bool m_bUseQPMap;
-+
-+ std::map<void *, mfxExtMBQP> m_bufExtMBQP;
-+ std::map<void *, std::vector<mfxU8>> m_qpMapStorage;
-+ std::map<void *, std::vector<mfxExtBuffer *>> m_extBuffPtrStorage;
-+ std::map<void *, mfxEncodeCtrl> encControlStorage;
-+
-+ mfxU32 m_QPmapWidth;
-+ mfxU32 m_QPmapHeight;
-+ mfxU32 m_GOPSize;
-+ mfxU32 m_QPforI;
-+ mfxU32 m_QPforP;
-+
-+ msdk_string m_sGenericPluginPath;
-+ mfxU16 m_nRotationAngle;
-+
-+ msdk_string m_strMfxParamsDumpFile;
-+
-+ void FillMBQPBuffer(mfxExtMBQP &qpMap, mfxU16 pictStruct);
-+#endif //MFX_VERSION >= 1022
-+
-+#ifdef ENABLE_MCTF
-+ sMctfRunTimeParams m_MctfRTParams;
-+#endif
-+#if (defined(_WIN32) || defined(_WIN64)) && (MFX_VERSION >= 1031)
-+ //Adapter type
-+ bool bPrefferiGfx;
-+ bool bPrefferdGfx;
-+#endif
-+private:
-+ DISALLOW_COPY_AND_ASSIGN(CTranscodingPipeline);
-+};
-+
-+struct ThreadTranscodeContext {
-+ // Pointer to the session's pipeline
-+ std::unique_ptr<CTranscodingPipeline> pPipeline;
-+ // Pointer to bitstream handling object
-+ FileBitstreamProcessor *pBSProcessor = nullptr;
-+ // Session implementation type
-+ mfxIMPL implType = MFX_IMPL_AUTO;
-+
-+ // Session's starting status
-+ mfxStatus startStatus = MFX_ERR_NONE;
-+ // Session's working time
-+ mfxF64 working_time = 0;
-+
-+ // Number of processed frames
-+ mfxU32 numTransFrames = 0;
-+ // Status of the finished session
-+ mfxStatus transcodingSts = MFX_ERR_NONE;
-+
-+ // Thread handle
-+ std::future<void> handle;
-+
-+ void TranscodeRoutine() {
-+ using namespace std::chrono;
-+ MSDK_CHECK_POINTER_NO_RET(pPipeline);
-+ transcodingSts = MFX_ERR_NONE;
-+
-+ auto start_time = system_clock::now();
-+ while (MFX_ERR_NONE == transcodingSts) {
-+ transcodingSts = pPipeline->Run();
-+ }
-+ working_time = duration_cast<duration<mfxF64>>(system_clock::now() - start_time).count();
-+
-+ MSDK_IGNORE_MFX_STS(transcodingSts, MFX_WRN_VALUE_NOT_CHANGED);
-+ numTransFrames = pPipeline->GetProcessFrames();
-+ }
-+};
-+} // namespace TranscodingSample
-+
-+#endif
-diff --git a/tools/legacy/sample_multi_transcode/include/sample_multi_transcode.h b/tools/legacy/sample_multi_transcode/include/sample_multi_transcode.h
-new file mode 100644
-index 0000000..7bba85a
---- /dev/null
-+++ b/tools/legacy/sample_multi_transcode/include/sample_multi_transcode.h
-@@ -0,0 +1,109 @@
-+/******************************************************************************\
-+Copyright (c) 2005-2019, Intel Corporation
-+All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-+
-+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-+
-+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-+
-+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+This sample was distributed or derived from the Intel's Media Samples package.
-+The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
-+or https://software.intel.com/en-us/media-client-solutions-support.
-+\**********************************************************************************/
-+
-+#ifndef __SAMPLE_MULTI_TRANSCODE_H__
-+#define __SAMPLE_MULTI_TRANSCODE_H__
-+
-+#include "mfxdefs.h"
-+#if (defined(_WIN32) || defined(_WIN64)) && (MFX_VERSION >= 1031)
-+ #include "mfxadapter.h"
-+#endif
-+
-+#include "pipeline_transcode.h"
-+#include "sample_utils.h"
-+#include "transcode_utils.h"
-+#include "vpl_implementation_loader.h"
-+
-+#include "d3d11_allocator.h"
-+#include "d3d11_device.h"
-+#include "d3d_allocator.h"
-+#include "d3d_device.h"
-+#include "general_allocator.h"
-+#include "hw_device.h"
-+
-+#ifdef LIBVA_SUPPORT
-+ #include "vaapi_allocator.h"
-+ #include "vaapi_device.h"
-+ #include "vaapi_utils.h"
-+#endif
-+
-+#ifndef MFX_VERSION
-+ #error MFX_VERSION not defined
-+#endif
-+
-+namespace TranscodingSample {
-+class Launcher {
-+public:
-+ Launcher();
-+ virtual ~Launcher();
-+
-+ virtual mfxStatus Init(int argc, msdk_char *argv[]);
-+ virtual void Run();
-+ virtual mfxStatus ProcessResult();
-+
-+protected:
-+#if (defined(_WIN32) || defined(_WIN64)) && (MFX_VERSION >= 1031)
-+ mfxStatus QueryAdapters();
-+ void ForceImplForSession(mfxU32 idxSession);
-+ mfxStatus CheckAndFixAdapterDependency(mfxU32 idxSession,
-+ CTranscodingPipeline *pParentPipeline);
-+#endif
-+ virtual mfxStatus VerifyCrossSessionsOptions();
-+ virtual mfxStatus CreateSafetyBuffers();
-+ virtual void DoTranscoding();
-+ virtual void DoRobustTranscoding();
-+
-+ virtual void Close();
-+
-+ // command line parser
-+ CmdProcessor m_parser;
-+ // threads contexts to process playlist
-+ std::vector<std::unique_ptr<ThreadTranscodeContext>> m_pThreadContextArray;
-+ // allocator for each session
-+ std::vector<std::unique_ptr<GeneralAllocator>> m_pAllocArray;
-+ // input parameters for each session
-+ std::vector<sInputParams> m_InputParamsArray;
-+ // safety buffers
-+ // needed for heterogeneous pipeline
-+ std::vector<std::unique_ptr<SafetySurfaceBuffer>> m_pBufferArray;
-+
-+ std::vector<std::unique_ptr<FileBitstreamProcessor>> m_pExtBSProcArray;
-+ std::vector<std::shared_ptr<mfxAllocatorParams>> m_pAllocParams;
-+ std::vector<std::unique_ptr<CHWDevice>> m_hwdevs;
-+ msdk_tick m_StartTime;
-+ // need to work with HW pipeline
-+ mfxHandleType m_eDevType;
-+ mfxAccelerationMode m_accelerationMode;
-+ mfxU32 m_adapterNum;
-+ mfxU16 m_deviceID;
-+ std::unique_ptr<VPLImplementationLoader> m_pLoader;
-+
-+ std::vector<sVppCompDstRect> m_VppDstRects;
-+
-+private:
-+ DISALLOW_COPY_AND_ASSIGN(Launcher);
-+
-+#if (defined(_WIN32) || defined(_WIN64)) && (MFX_VERSION >= 1031)
-+ std::vector<mfxAdapterInfo> m_DisplaysData;
-+ mfxAdaptersInfo m_Adapters;
-+#endif
-+};
-+} // namespace TranscodingSample
-+
-+#endif
-diff --git a/tools/legacy/sample_multi_transcode/include/transcode_utils.h b/tools/legacy/sample_multi_transcode/include/transcode_utils.h
-new file mode 100644
-index 0000000..f69aebe
---- /dev/null
-+++ b/tools/legacy/sample_multi_transcode/include/transcode_utils.h
-@@ -0,0 +1,111 @@
-+/******************************************************************************\
-+Copyright (c) 2005-2019, Intel Corporation
-+All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-+
-+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-+
-+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-+
-+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+This sample was distributed or derived from the Intel's Media Samples package.
-+The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
-+or https://software.intel.com/en-us/media-client-solutions-support.
-+\**********************************************************************************/
-+
-+#ifndef __TRANSCODE_UTILS_H__
-+#define __TRANSCODE_UTILS_H__
-+
-+#if defined(_WIN32) || defined(_WIN64)
-+ #include <process.h>
-+ #pragma warning(disable : 4201)
-+ #include <d3d9.h>
-+ #include <dxva2api.h>
-+#endif
-+
-+#include <map>
-+#include <vector>
-+#include "pipeline_transcode.h"
-+
-+struct D3DAllocatorParams;
-+
-+#ifdef _MSC_VER
-+ #pragma warning(disable : 4127) // constant expression
-+#endif
-+
-+// Extensions for internal use, normally these macros are blank
-+#ifdef MOD_SMT
-+ #include "extension_macros.h"
-+#else
-+ #define MOD_SMT_CREATE_PIPELINE
-+ #define MOD_SMT_PRINT_HELP
-+ #define MOD_SMT_PARSE_INPUT
-+#endif
-+
-+#ifndef MFX_VERSION
-+ #error MFX_VERSION not defined
-+#endif
-+
-+namespace TranscodingSample {
-+struct sInputParams;
-+
-+msdk_tick GetTick();
-+mfxF64 GetTime(msdk_tick start);
-+
-+void PrintHelp();
-+void PrintError(const msdk_char *strErrorMessage, ...);
-+void PrintInfo(mfxU32 session_number, sInputParams *pParams, mfxVersion *pVer);
-+
-+bool PrintDllInfo(msdk_char *buf, mfxU32 buf_size, sInputParams *pParams);
-+
-+class CmdProcessor {
-+public:
-+ CmdProcessor();
-+ virtual ~CmdProcessor();
-+ mfxStatus ParseCmdLine(int argc, msdk_char *argv[]);
-+ bool GetNextSessionParams(TranscodingSample::sInputParams &InputParams);
-+ FILE *GetPerformanceFile() {
-+ return m_PerfFILE;
-+ };
-+ void PrintParFileName();
-+ msdk_string GetLine(mfxU32 n);
-+
-+protected:
-+ mfxStatus ParseParFile(FILE *file);
-+ mfxStatus TokenizeLine(msdk_char *pLine, mfxU32 length);
-+ mfxU32 GetStringLength(msdk_char *pTempLine, mfxU32 length);
-+
-+#if MFX_VERSION >= 1022
-+ static bool isspace(char a);
-+ static bool is_not_allowed_char(char a);
-+ bool ParseROIFile(msdk_char const *roi_file_name, std::vector<mfxExtEncoderROI> &m_ROIData);
-+#endif //MFX_VERSION >= 1022
-+
-+ mfxStatus ParseParamsForOneSession(mfxU32 argc, msdk_char *argv[]);
-+ mfxStatus ParseOption__set(msdk_char *strCodecType, msdk_char *strPluginPath);
-+ mfxStatus VerifyAndCorrectInputParams(TranscodingSample::sInputParams &InputParams);
-+ mfxU32 m_SessionParamId;
-+ std::vector<TranscodingSample::sInputParams> m_SessionArray;
-+ std::map<mfxU32, sPluginParams> m_decoderPlugins;
-+ std::map<mfxU32, sPluginParams> m_encoderPlugins;
-+ FILE *m_PerfFILE;
-+ msdk_char *m_parName;
-+ mfxU32 statisticsWindowSize;
-+ FILE *statisticsLogFile;
-+ //store a name of a Logfile
-+ msdk_tstring DumpLogFileName;
-+ mfxU32 m_nTimeout;
-+ bool bRobustFlag;
-+ bool bSoftRobustFlag;
-+ bool shouldUseGreedyFormula;
-+ std::vector<msdk_string> m_lines;
-+
-+private:
-+ DISALLOW_COPY_AND_ASSIGN(CmdProcessor);
-+};
-+} // namespace TranscodingSample
-+#endif //__TRANSCODE_UTILS_H__
-diff --git a/tools/legacy/sample_multi_transcode/src/pipeline_transcode.cpp b/tools/legacy/sample_multi_transcode/src/pipeline_transcode.cpp
-new file mode 100644
-index 0000000..5815df1
---- /dev/null
-+++ b/tools/legacy/sample_multi_transcode/src/pipeline_transcode.cpp
-@@ -0,0 +1,4668 @@
-+/******************************************************************************\
-+Copyright (c) 2005-2020, Intel Corporation
-+All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-+
-+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-+
-+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-+
-+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+This sample was distributed or derived from the Intel's Media Samples package.
-+The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
-+or https://software.intel.com/en-us/media-client-solutions-support.
-+\**********************************************************************************/
-+
-+#include "mfx_samples_config.h"
-+
-+#if defined(_WIN32) || defined(_WIN64)
-+ #include <windows.h>
-+#endif
-+
-+#include "mfxdispatcher.h"
-+#include "pipeline_transcode.h"
-+#include "sample_utils.h"
-+#include "transcode_utils.h"
-+#if !defined(MFX_ONEVPL)
-+ #include "mfx_vpp_plugin.h"
-+#endif
-+#include <assert.h>
-+#include <algorithm>
-+#include <cstring>
-+#include "mfx_itt_trace.h"
-+
-+#include "parameters_dumper.h"
-+
-+#include "sample_utils.h"
-+
-+// let's use std::max and std::min instead
-+#undef max
-+#undef min
-+
-+#ifndef MFX_VERSION
-+ #error MFX_VERSION not defined
-+#endif
-+
-+using namespace TranscodingSample;
-+
-+#ifdef ENABLE_MCTF
-+namespace TranscodingSample {
-+const sMctfRunTimeParam *sMctfRunTimeParams::GetCurParam() {
-+ if (CurIdx >= RunTimeParams.size())
-+ return NULL;
-+ else
-+ return &(RunTimeParams[CurIdx]);
-+}
-+
-+void sMctfRunTimeParams::MoveForward() {
-+ if (CurIdx < RunTimeParams.size())
-+ ++CurIdx;
-+}
-+
-+void sMctfRunTimeParams::Restart() {
-+ CurIdx = 0;
-+}
-+
-+void sMctfRunTimeParams::Reset() {
-+ CurIdx = 0;
-+ RunTimeParams.clear();
-+}
-+} // namespace TranscodingSample
-+#endif
-+
-+mfxFrameInfo GetFrameInfo(const MfxVideoParamsWrapper &param) {
-+ mfxFrameInfo frameInfo = param.mfx.FrameInfo;
-+ auto decPostProc = param.GetExtBuffer<mfxExtDecVideoProcessing>();
-+ if (decPostProc) {
-+ frameInfo.Width = decPostProc->Out.Width;
-+ frameInfo.Height = decPostProc->Out.Height;
-+ frameInfo.CropW = decPostProc->Out.CropW;
-+ frameInfo.CropH = decPostProc->Out.CropH;
-+ }
-+
-+ return frameInfo;
-+}
-+
-+// set structure to define values
-+sInputParams::sInputParams() : __sInputParams() {
-+#ifdef ENABLE_MCTF
-+ mctfParam.mode = VPP_FILTER_DISABLED;
-+ mctfParam.params.FilterStrength = 0;
-+ mctfParam.rtParams.Reset();
-+ #ifdef ENABLE_MCTF_EXT
-+ mctfParam.params.BitsPerPixelx100k = 0;
-+ mctfParam.params.Deblocking = MFX_CODINGOPTION_OFF;
-+ mctfParam.params.Overlap = MFX_CODINGOPTION_OFF;
-+ mctfParam.params.TemporalMode = MFX_MCTF_TEMPORAL_MODE_2REF;
-+ mctfParam.params.MVPrecision = MFX_MVPRECISION_INTEGER;
-+ #endif
-+#endif
-+ priority = MFX_PRIORITY_NORMAL;
-+ libType = MFX_IMPL_SOFTWARE;
-+#if (defined(_WIN32) || defined(_WIN64)) && (MFX_VERSION >= 1031)
-+ //Adapter type
-+ bPrefferiGfx = false;
-+ bPrefferdGfx = false;
-+#endif
-+ MaxFrameNumber = MFX_INFINITE;
-+ pVppCompDstRects = NULL;
-+ m_hwdev = NULL;
-+ DenoiseLevel = -1;
-+ DetailLevel = -1;
-+
-+#if (MFX_VERSION >= 1025)
-+ MFMode = MFX_MF_DEFAULT;
-+ numMFEFrames = 0;
-+ mfeTimeout = 0;
-+#endif
-+
-+#if MFX_VERSION >= 1022
-+ bDecoderPostProcessing = false;
-+ bROIasQPMAP = false;
-+#endif
-+}
-+
-+CTranscodingPipeline::CTranscodingPipeline()
-+ : m_pmfxBS(NULL),
-+ m_pMFXAllocator(NULL),
-+ m_hdl(NULL),
-+ m_encoderFourCC(0),
-+ m_vppCompDumpRenderMode(0),
-+ m_hwdev4Rendering(NULL),
-+ m_EncSurfaceType(0),
-+ m_DecSurfaceType(0),
-+ m_bIsVpp(false),
-+ m_bIsPlugin(false),
-+ m_nTimeout(0),
-+ m_bOwnMVCSeqDescMemory(true),
-+ m_nID(0),
-+ m_AsyncDepth(0),
-+ m_nProcessedFramesNum(0),
-+ m_bIsJoinSession(false),
-+ m_bDecodeEnable(true),
-+ m_bEncodeEnable(true),
-+ m_nVPPCompEnable(0),
-+ m_MemoryModel(UNKNOWN_ALLOC),
-+ m_LastDecSyncPoint(0),
-+ m_pBuffer(NULL),
-+ m_pParentPipeline(NULL),
-+ m_bIsInit(false),
-+ m_NumFramesForReset(0),
-+ isHEVCSW(false),
-+ m_bInsertIDR(false),
-+ m_rawInput(false),
-+ m_FrameNumberPreference(0xFFFFFFFF),
-+ m_MaxFramesForTranscode(0xFFFFFFFF),
-+ m_pBSProcessor(NULL),
-+ m_nReqFrameTime(0),
-+ m_nOutputFramesNum(0),
-+ shouldUseGreedyFormula(false),
-+ m_nRotationAngle(0) {
-+ MSDK_ZERO_MEMORY(m_RotateParam);
-+ MSDK_ZERO_MEMORY(m_mfxDecResponse);
-+ MSDK_ZERO_MEMORY(m_mfxEncResponse);
-+ MSDK_ZERO_MEMORY(m_Request);
-+
-+#if MFX_VERSION >= 1022
-+ m_bUseQPMap = 0;
-+ m_QPmapWidth = 0;
-+ m_QPmapHeight = 0;
-+ m_GOPSize = 0;
-+ m_QPforI = 0;
-+ m_QPforP = 0;
-+ m_nSubmittedFramesNum = 0;
-+#endif //MFX_VERSION >= 1022
-+
-+ inputStatistics.SetDirection(MSDK_STRING("Input"));
-+ outputStatistics.SetDirection(MSDK_STRING("Output"));
-+
-+ m_numEncoders = 0;
-+ m_encoderFourCC = 0;
-+ m_libvaBackend = 0;
-+ statisticsWindowSize = 0;
-+ m_bIsFieldWeaving = false;
-+ m_bIsFieldSplitting = false;
-+ m_bUseOverlay = false;
-+ m_bForceStop = false;
-+ m_bIsInterOrJoined = false;
-+ m_bRobustFlag = false;
-+ m_bSoftGpuHangRecovery = false;
-+ m_nRotationAngle = 0;
-+ m_bROIasQPMAP = false;
-+ m_bExtMBQP = false;
-+} //CTranscodingPipeline::CTranscodingPipeline()
-+
-+CTranscodingPipeline::~CTranscodingPipeline() {
-+ Close();
-+} //CTranscodingPipeline::CTranscodingPipeline()
-+
-+mfxStatus CTranscodingPipeline::CheckRequiredAPIVersion(mfxVersion &version,
-+ sInputParams *pParams) {
-+ MSDK_CHECK_POINTER(pParams, MFX_ERR_NULL_PTR);
-+
-+ if (pParams->bIsMVC && !CheckVersion(&version, MSDK_FEATURE_MVC)) {
-+ msdk_printf(MSDK_STRING("error: MVC is not supported in the %d.%d API version\n"),
-+ version.Major,
-+ version.Minor);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ if ((pParams->DecodeId == MFX_CODEC_JPEG) &&
-+ !CheckVersion(&version, MSDK_FEATURE_JPEG_DECODE)) {
-+ msdk_printf(MSDK_STRING("error: Jpeg decoder is not supported in the %d.%d API version\n"),
-+ version.Major,
-+ version.Minor);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ if ((pParams->EncodeId == MFX_CODEC_JPEG) &&
-+ !CheckVersion(&version, MSDK_FEATURE_JPEG_ENCODE)) {
-+ msdk_printf(MSDK_STRING("error: Jpeg encoder is not supported in the %d.%d API version\n"),
-+ version.Major,
-+ version.Minor);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ if ((pParams->bLABRC || pParams->nLADepth) &&
-+ !CheckVersion(&version, MSDK_FEATURE_LOOK_AHEAD)) {
-+ msdk_printf(MSDK_STRING("error: Look Ahead is not supported in the %d.%d API version\n"),
-+ version.Major,
-+ version.Minor);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ return MFX_ERR_NONE;
-+}
-+
-+// initialize decode part
-+mfxStatus CTranscodingPipeline::DecodePreInit(sInputParams *pParams) {
-+ // initialize decode pert
-+ mfxStatus sts = MFX_ERR_NONE;
-+
-+ if (m_bDecodeEnable) {
-+#if !defined(MFX_ONEVPL)
-+ if (CheckVersion(&m_Version, MSDK_FEATURE_PLUGIN_API)) {
-+ /* Here we actually define the following codec initialization scheme:
-+ * 1. If plugin path or guid is specified: we load user-defined plugin (example: VP9 sample decoder plugin)
-+ * 2. If plugin path not specified:
-+ * 2.a) we check if codec is distributed as a mediasdk plugin and load it if yes
-+ * 2.b) if codec is not in the list of mediasdk plugins, we assume, that it is supported inside mediasdk library
-+ */
-+ if (pParams->decoderPluginParams.type == MFX_PLUGINLOAD_TYPE_FILE &&
-+ msdk_strnlen(pParams->decoderPluginParams.strPluginPath,
-+ sizeof(pParams->decoderPluginParams.strPluginPath))) {
-+ m_pUserDecoderModule.reset(new MFXVideoUSER(*m_pmfxSession.get()));
-+ m_pUserDecoderPlugin.reset(LoadPlugin(
-+ MFX_PLUGINTYPE_VIDEO_DECODE,
-+ *m_pmfxSession.get(),
-+ pParams->decoderPluginParams.pluginGuid,
-+ 1,
-+ pParams->decoderPluginParams.strPluginPath,
-+ (mfxU32)msdk_strnlen(pParams->decoderPluginParams.strPluginPath,
-+ sizeof(pParams->decoderPluginParams.strPluginPath))));
-+ if (m_pUserDecoderPlugin.get() == NULL)
-+ sts = MFX_ERR_UNSUPPORTED;
-+ }
-+ else {
-+ bool isDefaultPlugin = false;
-+ if (AreGuidsEqual(pParams->decoderPluginParams.pluginGuid, MSDK_PLUGINGUID_NULL)) {
-+ pParams->decoderPluginParams.pluginGuid =
-+ msdkGetPluginUID(pParams->libType, MSDK_VDECODE, pParams->DecodeId);
-+ isDefaultPlugin = true;
-+ }
-+ if (!AreGuidsEqual(pParams->decoderPluginParams.pluginGuid, MSDK_PLUGINGUID_NULL)) {
-+ m_pUserDecoderPlugin.reset(LoadPlugin(MFX_PLUGINTYPE_VIDEO_DECODE,
-+ *m_pmfxSession.get(),
-+ pParams->decoderPluginParams.pluginGuid,
-+ 1));
-+ if (m_pUserDecoderPlugin.get() == NULL)
-+ sts = MFX_ERR_UNSUPPORTED;
-+ }
-+ if (sts == MFX_ERR_UNSUPPORTED) {
-+ msdk_printf(
-+ isDefaultPlugin
-+ ? MSDK_STRING(
-+ "Default plugin cannot be loaded (possibly you have to define plugin explicitly)\n")
-+ : MSDK_STRING("Explicitly specified plugin cannot be loaded.\n"));
-+ }
-+ }
-+ MSDK_CHECK_STATUS(sts, "LoadPlugin failed");
-+ }
-+#endif //!MFX_ONEVPL
-+
-+ // create decoder
-+ if (!m_bUseOverlay) {
-+ m_pmfxDEC.reset(new MFXVideoDECODE(*m_pmfxSession.get()));
-+ }
-+
-+ // set video type in parameters
-+ m_mfxDecParams.mfx.CodecId = pParams->DecodeId;
-+
-+ // configure specific decoder parameters
-+ sts = InitDecMfxParams(pParams);
-+ if (MFX_ERR_MORE_DATA == sts) {
-+ m_pmfxDEC.reset(NULL);
-+ return sts;
-+ }
-+ else {
-+ MSDK_CHECK_STATUS(sts, "InitDecMfxParams failed");
-+ }
-+ }
-+#if !defined(MFX_ONEVPL)
-+ else {
-+ m_mfxDecParams = m_pParentPipeline->GetDecodeParam();
-+ auto mvc = m_mfxDecParams.AddExtBuffer<mfxExtMVCSeqDesc>();
-+ *mvc = m_pParentPipeline->GetDecMVCSeqDesc();
-+ m_bOwnMVCSeqDescMemory = false;
-+ }
-+#endif
-+
-+ if (pParams->nFPS) {
-+ this->m_nReqFrameTime = 1000000 / pParams->nFPS;
-+ }
-+
-+ return sts;
-+
-+} //mfxStatus CTranscodingPipeline::Init(sInputParams *pParams)
-+
-+mfxStatus CTranscodingPipeline::VPPPreInit(sInputParams *pParams) {
-+ mfxStatus sts = MFX_ERR_NONE;
-+ bool bVppCompInitRequire = false;
-+ m_bIsFieldWeaving = false;
-+ m_bIsFieldSplitting = false;
-+
-+ if (((pParams->eModeExt == VppComp) || (pParams->eModeExt == VppCompOnly)) &&
-+ (pParams->eMode == Source))
-+ bVppCompInitRequire = true;
-+
-+ // Obtaining decoder output FourCC - in case of inter-session, just take it from params, in intra-session case, take it from parent session
-+ // In inter-session case, we'll enable chroma-changing VPP only in encoding session, and only if decoderFourCC!=encoderFourCC
-+ mfxU32 decoderFourCC = m_bDecodeEnable
-+ ? m_mfxDecParams.mfx.FrameInfo.FourCC
-+ : m_pParentPipeline->GetDecodeParam().mfx.FrameInfo.FourCC;
-+
-+ if (m_bEncodeEnable || m_bDecodeEnable) {
-+ if (m_mfxDecParams.mfx.FrameInfo.PicStruct == MFX_PICSTRUCT_FIELD_SINGLE &&
-+ pParams->EncodeId != MFX_CODEC_HEVC && !pParams->bEnableDeinterlacing) {
-+ m_bIsFieldWeaving = true;
-+ m_bIsVpp = true;
-+ }
-+
-+ if ((m_mfxDecParams.mfx.FrameInfo.PicStruct & MFX_PICSTRUCT_FIELD_TFF ||
-+ m_mfxDecParams.mfx.FrameInfo.PicStruct & MFX_PICSTRUCT_FIELD_BFF ||
-+ m_mfxDecParams.mfx.FrameInfo.PicStruct == MFX_PICSTRUCT_UNKNOWN) &&
-+ pParams->EncodeId == MFX_CODEC_HEVC && pParams->DecodeId != MFX_CODEC_HEVC &&
-+ !pParams->bEnableDeinterlacing) {
-+ m_bIsFieldSplitting = true;
-+ m_bIsVpp = true;
-+ m_mfxVppParams.vpp.In.PicStruct = MFX_PICSTRUCT_UNKNOWN;
-+ }
-+
-+ if ((GetFrameInfo(m_mfxDecParams).CropW != pParams->nDstWidth && pParams->nDstWidth) ||
-+ (GetFrameInfo(m_mfxDecParams).CropH != pParams->nDstHeight && pParams->nDstHeight) ||
-+ (pParams->bEnableDeinterlacing) || (pParams->DenoiseLevel != -1) ||
-+ (pParams->DetailLevel != -1) || (pParams->FRCAlgorithm) || (bVppCompInitRequire) ||
-+ (pParams->fieldProcessingMode) ||
-+#ifdef ENABLE_MCTF
-+ (VPP_FILTER_DISABLED != pParams->mctfParam.mode) ||
-+#endif
-+ (pParams->EncoderFourCC && decoderFourCC && pParams->EncoderFourCC != decoderFourCC &&
-+ m_bEncodeEnable)) {
-+ if (m_bIsFieldWeaving || m_bIsFieldSplitting) {
-+ msdk_printf(MSDK_STRING(
-+ "ERROR: Field weaving or Field Splitting is enabled according to streams parameters. Other VPP filters cannot be used in this mode, please remove corresponding options.\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ m_bIsVpp = true;
-+ }
-+
-+ if (m_bIsVpp) {
-+ sts = InitVppMfxParams(pParams);
-+ MSDK_CHECK_STATUS(sts, "InitVppMfxParams failed");
-+ }
-+
-+#if !defined(MFX_ONEVPL)
-+ if (pParams->nRotationAngle) // plugin was requested
-+ {
-+ m_bIsPlugin = true;
-+ sts = InitPluginMfxParams(pParams);
-+ MSDK_CHECK_STATUS(sts, "InitPluginMfxParams failed");
-+ sts = LoadGenericPlugin();
-+ MSDK_CHECK_STATUS(sts, "LoadGenericPlugin failed");
-+ }
-+#endif //!MFX_ONEVPL
-+
-+ if (!m_bIsPlugin && m_bIsVpp) // only VPP was requested
-+ {
-+ m_pmfxVPP.reset(new MFXVideoMultiVPP(*m_pmfxSession.get()));
-+ }
-+ }
-+
-+ return sts;
-+
-+} //mfxStatus CTranscodingPipeline::VPPInit(sInputParams *pParams)
-+
-+mfxStatus CTranscodingPipeline::EncodePreInit(sInputParams *pParams) {
-+ mfxStatus sts = MFX_ERR_NONE;
-+
-+ if (m_bEncodeEnable) {
-+ if (pParams->EncodeId != MFX_CODEC_DUMP) {
-+#if !defined(MFX_ONEVPL)
-+ if (CheckVersion(&m_Version, MSDK_FEATURE_PLUGIN_API) &&
-+ (m_pUserEncPlugin.get() == NULL)) {
-+ /* Here we actually define the following codec initialization scheme:
-+ * 1. If plugin path or guid is specified: we load user-defined plugin (example: HEVC encoder plugin)
-+ * 2. If plugin path not specified:
-+ * 2.a) we check if codec is distributed as a mediasdk plugin and load it if yes
-+ * 2.b) if codec is not in the list of mediasdk plugins, we assume, that it is supported inside mediasdk library
-+ */
-+ if (pParams->encoderPluginParams.type == MFX_PLUGINLOAD_TYPE_FILE &&
-+ msdk_strnlen(pParams->encoderPluginParams.strPluginPath,
-+ sizeof(pParams->encoderPluginParams.strPluginPath))) {
-+ m_pUserEncoderModule.reset(new MFXVideoUSER(*m_pmfxSession.get()));
-+ m_pUserEncoderPlugin.reset(LoadPlugin(
-+ MFX_PLUGINTYPE_VIDEO_ENCODE,
-+ *m_pmfxSession.get(),
-+ pParams->encoderPluginParams.pluginGuid,
-+ 1,
-+ pParams->encoderPluginParams.strPluginPath,
-+ (mfxU32)msdk_strnlen(pParams->encoderPluginParams.strPluginPath,
-+ sizeof(pParams->encoderPluginParams.strPluginPath))));
-+ if (m_pUserEncoderPlugin.get() == NULL)
-+ sts = MFX_ERR_UNSUPPORTED;
-+ }
-+ else {
-+ bool isDefaultPlugin = false;
-+ if (AreGuidsEqual(pParams->encoderPluginParams.pluginGuid,
-+ MSDK_PLUGINGUID_NULL)) {
-+ pParams->encoderPluginParams.pluginGuid =
-+ msdkGetPluginUID(pParams->libType, MSDK_VENCODE, pParams->EncodeId);
-+ isDefaultPlugin = true;
-+ }
-+ if (!AreGuidsEqual(pParams->encoderPluginParams.pluginGuid,
-+ MSDK_PLUGINGUID_NULL)) {
-+ m_pUserEncoderPlugin.reset(
-+ LoadPlugin(MFX_PLUGINTYPE_VIDEO_ENCODE,
-+ *m_pmfxSession.get(),
-+ pParams->encoderPluginParams.pluginGuid,
-+ 1));
-+ if (m_pUserEncoderPlugin.get() == NULL)
-+ sts = MFX_ERR_UNSUPPORTED;
-+ }
-+ if (sts == MFX_ERR_UNSUPPORTED) {
-+ msdk_printf(
-+ MSDK_STRING("%s"),
-+ isDefaultPlugin
-+ ? MSDK_STRING(
-+ "Default plugin cannot be loaded (possibly you have to define plugin explicitly)\n")
-+ : MSDK_STRING("Explicitly specified plugin cannot be loaded.\n"));
-+ }
-+ }
-+ MSDK_CHECK_STATUS(sts, "LoadPlugin failed");
-+ }
-+#endif //!MFX_ONEVPL
-+
-+ // create encoder
-+ m_pmfxENC.reset(new MFXVideoENCODE(*m_pmfxSession.get()));
-+
-+ if (m_nVPPCompEnable == VppCompOnlyEncode) {
-+ pParams->EncoderFourCC = MFX_FOURCC_NV12;
-+ }
-+
-+ sts = InitEncMfxParams(pParams);
-+ MSDK_CHECK_STATUS(sts, "InitEncMfxParams failed");
-+
-+ // Querying parameters
-+ mfxU16 ioPattern = m_mfxEncParams.IOPattern;
-+ mfxU16 initialTargetKbps = m_mfxEncParams.mfx.TargetKbps;
-+ auto co2 = m_mfxEncParams.GetExtBuffer<mfxExtCodingOption2>();
-+
-+ msdk_stringstream str1, str2;
-+ CParametersDumper().SerializeVideoParamStruct(str1, MSDK_STRING(""), m_mfxEncParams);
-+
-+ sts = m_pmfxENC->Query(&m_mfxEncParams, &m_mfxEncParams);
-+
-+ CParametersDumper().SerializeVideoParamStruct(str2, MSDK_STRING(""), m_mfxEncParams);
-+
-+ m_mfxEncParams.IOPattern =
-+ ioPattern; // Workaround for a problem: Query changes IOPattern incorrectly
-+
-+ if (sts == MFX_WRN_INCOMPATIBLE_VIDEO_PARAM) {
-+ if (co2 && co2->BitrateLimit != MFX_CODINGOPTION_OFF &&
-+ initialTargetKbps != m_mfxEncParams.mfx.TargetKbps) {
-+ msdk_printf(
-+ MSDK_STRING("[WARNING] -BitrateLimit:on, target bitrate was changed\n"));
-+ }
-+
-+ msdk_printf(MSDK_STRING("[WARNING] Configuration changed on the Query() call\n"));
-+
-+ CParametersDumper().ShowConfigurationDiff(str1, str2);
-+ MSDK_IGNORE_MFX_STS(sts, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM);
-+ }
-+
-+ MSDK_CHECK_STATUS(sts, "m_pmfxENC->Query failed");
-+ }
-+ else {
-+ //--- This one is required for YUV output
-+ m_mfxEncParams.mfx.CodecId = pParams->EncodeId;
-+ }
-+ }
-+ return sts;
-+
-+} // mfxStatus CTranscodingPipeline::EncodeInit(sInputParams *pParams)
-+
-+#if !defined(MFX_ONEVPL)
-+mfxStatus CTranscodingPipeline::PreEncPreInit(sInputParams *pParams) {
-+ mfxStatus sts = MFX_ERR_NONE;
-+ // PreInit is allowed in decoder session only
-+ if (pParams->bEnableExtLA && m_bDecodeEnable) {
-+ /* Here we actually define the following codec initialization scheme:
-+ * a) we check if codec is distributed as a user plugin and load it if yes
-+ * b) we check if codec is distributed as a mediasdk plugin and load it if yes
-+ * c) if codec is not in the list of user plugins or mediasdk plugins, we assume, that it is supported inside mediasdk library
-+ */
-+
-+ m_pUserEncPlugin.reset(LoadPlugin(MFX_PLUGINTYPE_VIDEO_ENCODE,
-+ *m_pmfxSession.get(),
-+ MFX_PLUGINID_H264LA_HW,
-+ 1));
-+ if (m_pUserEncPlugin.get() == NULL)
-+ sts = MFX_ERR_UNSUPPORTED;
-+
-+ // create encoder
-+ m_pmfxPreENC.reset(new MFXVideoENC(*m_pmfxSession.get()));
-+
-+ sts = InitPreEncMfxParams(pParams);
-+ MSDK_CHECK_STATUS(sts, "InitPreEncMfxParams failed");
-+ }
-+
-+ return sts;
-+}
-+#endif //!MFX_ONEVPL
-+
-+mfxVideoParam CTranscodingPipeline::GetDecodeParam() {
-+ if (m_bIsVpp) {
-+ mfxVideoParam tmp = m_mfxDecParams;
-+ tmp.mfx.FrameInfo = m_mfxVppParams.vpp.Out;
-+ return tmp;
-+ }
-+ else if (m_bIsPlugin) {
-+ mfxVideoParam tmp = m_mfxDecParams;
-+ tmp.mfx.FrameInfo = m_mfxPluginParams.mfx.FrameInfo;
-+ return tmp;
-+ }
-+
-+ return m_mfxDecParams;
-+};
-+// 1 ms provides better result in range [0..5] ms
-+enum { TIME_TO_SLEEP = 1 };
-+
-+mfxStatus CTranscodingPipeline::DecodeOneFrame(ExtendedSurface *pExtSurface) {
-+ MFX_ITT_TASK("DecodeOneFrame");
-+ MSDK_CHECK_POINTER(pExtSurface, MFX_ERR_NULL_PTR);
-+
-+ mfxStatus sts = MFX_ERR_MORE_SURFACE;
-+ mfxFrameSurface1 *pmfxSurface = NULL;
-+ pExtSurface->pSurface = NULL;
-+
-+ //--- Time measurements
-+ if (statisticsWindowSize) {
-+ inputStatistics.StopTimeMeasurementWithCheck();
-+ inputStatistics.StartTimeMeasurement();
-+ }
-+
-+ CTimer DevBusyTimer;
-+ DevBusyTimer.Start();
-+ while (MFX_ERR_MORE_DATA == sts || MFX_ERR_MORE_SURFACE == sts || MFX_ERR_NONE < sts) {
-+ if (m_rawInput) {
-+ pExtSurface->pSurface = GetFreeSurface(false, MSDK_SURFACE_WAIT_INTERVAL);
-+ sts = m_pBSProcessor->GetInputFrame(pExtSurface->pSurface);
-+ if (sts != MFX_ERR_NONE)
-+ return sts;
-+ }
-+ else if (MFX_WRN_DEVICE_BUSY == sts) {
-+ WaitForDeviceToBecomeFree(*m_pmfxSession, m_LastDecSyncPoint, sts);
-+ }
-+ else if (MFX_ERR_MORE_DATA == sts) {
-+ sts =
-+ m_pBSProcessor->GetInputBitstream(&m_pmfxBS); // read more data to input bit stream
-+ MSDK_BREAK_ON_ERROR(sts);
-+ }
-+
-+ if (m_MemoryModel == GENERAL_ALLOC) {
-+ // Find new working surface
-+ pmfxSurface = GetFreeSurface(true, MSDK_SURFACE_WAIT_INTERVAL);
-+ {
-+ std::unique_lock<std::mutex> lock(m_mStopSession);
-+ if (m_bForceStop) {
-+ lock.unlock();
-+ m_nTimeout = 0;
-+ // add surfaces in queue for all sinks
-+ NoMoreFramesSignal();
-+ return MFX_WRN_VALUE_NOT_CHANGED;
-+ }
-+ }
-+ MSDK_CHECK_POINTER_SAFE(
-+ pmfxSurface,
-+ MFX_ERR_MEMORY_ALLOC,
-+ msdk_printf(MSDK_STRING(
-+ "ERROR: No free surfaces in decoder pool (during long period)\n"))); // return an error if a free surface wasn't found
-+ }
-+#if defined(MFX_ONEVPL)
-+ else if (m_MemoryModel == VISIBLE_INT_ALLOC) {
-+ sts = m_pmfxDEC->GetSurface(&pmfxSurface);
-+ MSDK_BREAK_ON_ERROR(sts);
-+ }
-+#endif //MFX_ONEVPL
-+
-+ if (!m_rawInput) {
-+ sts = m_pmfxDEC->DecodeFrameAsync(m_pmfxBS,
-+ pmfxSurface,
-+ &pExtSurface->pSurface,
-+ &pExtSurface->Syncp);
-+#if defined(MFX_ONEVPL)
-+ if (m_MemoryModel == VISIBLE_INT_ALLOC) {
-+ mfxStatus sts_release = pmfxSurface->FrameInterface->Release(pmfxSurface);
-+ MSDK_CHECK_STATUS(sts_release, "FrameInterface->Release failed");
-+ }
-+#endif //MFX_ONEVPL
-+ }
-+
-+ if ((MFX_WRN_DEVICE_BUSY == sts) && (DevBusyTimer.GetTime() > MSDK_WAIT_INTERVAL / 1000)) {
-+ msdk_printf(MSDK_STRING("ERROR: Decoder device busy (during long period)\n"));
-+ return MFX_ERR_DEVICE_FAILED;
-+ }
-+
-+ if (sts == MFX_ERR_NONE) {
-+ m_LastDecSyncPoint = pExtSurface->Syncp;
-+ }
-+ // ignore warnings if output is available,
-+ if (MFX_ERR_NONE < sts && pExtSurface->Syncp) {
-+ sts = MFX_ERR_NONE;
-+ }
-+
-+ } //while processing
-+
-+ // HEVC SW requires additional synchronization
-+ if (MFX_ERR_NONE == sts && isHEVCSW) {
-+ sts = m_pmfxSession->SyncOperation(pExtSurface->Syncp, MSDK_WAIT_INTERVAL);
-+ HandlePossibleGpuHang(sts);
-+ MSDK_CHECK_ERR_NONE_STATUS(sts, MFX_ERR_ABORTED, "Decode: SyncOperation failed");
-+ }
-+ return sts;
-+
-+} // mfxStatus CTranscodingPipeline::DecodeOneFrame(ExtendedSurface *pExtSurface)
-+mfxStatus CTranscodingPipeline::DecodeLastFrame(ExtendedSurface *pExtSurface) {
-+ MFX_ITT_TASK("DecodeLastFrame");
-+ mfxFrameSurface1 *pmfxSurface = NULL;
-+ mfxStatus sts = MFX_ERR_MORE_SURFACE;
-+
-+ //--- Time measurements
-+ if (statisticsWindowSize) {
-+ inputStatistics.StopTimeMeasurementWithCheck();
-+ inputStatistics.StartTimeMeasurement();
-+ }
-+
-+ CTimer DevBusyTimer;
-+ DevBusyTimer.Start();
-+ // retrieve the buffered decoded frames
-+ while (MFX_ERR_MORE_SURFACE == sts || MFX_WRN_DEVICE_BUSY == sts) {
-+ if (m_rawInput) {
-+ pExtSurface->pSurface = GetFreeSurface(false, MSDK_SURFACE_WAIT_INTERVAL);
-+ sts = m_pBSProcessor->GetInputFrame(pExtSurface->pSurface);
-+ }
-+ else if (MFX_WRN_DEVICE_BUSY == sts) {
-+ WaitForDeviceToBecomeFree(*m_pmfxSession, m_LastDecSyncPoint, sts);
-+ }
-+
-+ if (!m_rawInput) {
-+ if (m_MemoryModel == GENERAL_ALLOC) {
-+ // find new working surface
-+ pmfxSurface = GetFreeSurface(true, MSDK_SURFACE_WAIT_INTERVAL);
-+ MSDK_CHECK_POINTER_SAFE(
-+ pmfxSurface,
-+ MFX_ERR_MEMORY_ALLOC,
-+ msdk_printf(MSDK_STRING(
-+ "ERROR: No free surfaces in decoder pool (during long period)\n"))); // return an error if a free surface wasn't found
-+
-+ sts = m_pmfxDEC->DecodeFrameAsync(nullptr,
-+ pmfxSurface,
-+ &pExtSurface->pSurface,
-+ &pExtSurface->Syncp);
-+ }
-+#if defined(MFX_ONEVPL)
-+ else if (m_MemoryModel == VISIBLE_INT_ALLOC) {
-+ sts = m_pmfxDEC->GetSurface(&pmfxSurface);
-+ MSDK_BREAK_ON_ERROR(sts);
-+
-+ sts = m_pmfxDEC->DecodeFrameAsync(nullptr,
-+ pmfxSurface,
-+ &pExtSurface->pSurface,
-+ &pExtSurface->Syncp);
-+
-+ mfxStatus sts_release = pmfxSurface->FrameInterface->Release(pmfxSurface);
-+ MSDK_CHECK_STATUS(sts_release, "FrameInterface->Release failed");
-+ }
-+#endif //MFX_ONEVPL
-+ else {
-+ sts = m_pmfxDEC->DecodeFrameAsync(nullptr,
-+ pmfxSurface,
-+ &pExtSurface->pSurface,
-+ &pExtSurface->Syncp);
-+ }
-+ }
-+
-+ if ((MFX_WRN_DEVICE_BUSY == sts) && (DevBusyTimer.GetTime() > MSDK_WAIT_INTERVAL / 1000)) {
-+ msdk_printf(MSDK_STRING("ERROR: Decoder device busy (during long period)\n"));
-+ return MFX_ERR_DEVICE_FAILED;
-+ }
-+ }
-+
-+ // HEVC SW requires additional synchronization
-+ if (MFX_ERR_NONE == sts && isHEVCSW) {
-+ sts = m_pmfxSession->SyncOperation(pExtSurface->Syncp, MSDK_WAIT_INTERVAL);
-+ HandlePossibleGpuHang(sts);
-+ MSDK_CHECK_ERR_NONE_STATUS(sts, MFX_ERR_ABORTED, "Decode: SyncOperation failed");
-+ }
-+
-+ return sts;
-+}
-+
-+mfxStatus CTranscodingPipeline::VPPOneFrame(ExtendedSurface *pSurfaceIn,
-+ ExtendedSurface *pExtSurface) {
-+ MFX_ITT_TASK("VPPOneFrame");
-+ MSDK_CHECK_POINTER(pExtSurface, MFX_ERR_NULL_PTR);
-+ mfxFrameSurface1 *out_surface = NULL;
-+ mfxStatus sts = MFX_ERR_NONE;
-+
-+ if (m_MemoryModel == GENERAL_ALLOC || m_MemoryModel == VISIBLE_INT_ALLOC) {
-+ if (m_MemoryModel == GENERAL_ALLOC) {
-+ // find/wait for a free working surface
-+ out_surface = GetFreeSurface(false, MSDK_SURFACE_WAIT_INTERVAL);
-+ MSDK_CHECK_POINTER_SAFE(
-+ out_surface,
-+ MFX_ERR_MEMORY_ALLOC,
-+ msdk_printf(MSDK_STRING(
-+ "ERROR: No free surfaces for VPP in encoder pool (during long period)\n"))); // return an error if a free surface wasn't found
-+ }
-+#if defined(MFX_ONEVPL)
-+ else if (m_MemoryModel == VISIBLE_INT_ALLOC) {
-+ sts = m_pmfxVPP->GetSurfaceOut(&out_surface);
-+ MFX_CHECK_STS(sts);
-+ }
-+#endif //MFX_ONEVPL
-+
-+ // make sure picture structure has the initial value
-+ // surfaces are reused and VPP may change this parameter in certain configurations
-+ out_surface->Info.PicStruct =
-+ m_mfxVppParams.vpp.Out.PicStruct
-+ ? m_mfxVppParams.vpp.Out.PicStruct
-+ : (m_bEncodeEnable ? m_mfxEncParams : m_mfxDecParams).mfx.FrameInfo.PicStruct;
-+ pExtSurface->pSurface = out_surface;
-+ }
-+
-+#ifdef ENABLE_MCTF
-+ const auto MCTFCurParam = m_MctfRTParams.GetCurParam();
-+ bool applyMCTF = !!MCTFCurParam;
-+
-+ if (applyMCTF && pSurfaceIn->pSurface) {
-+ auto surface = static_cast<mfxFrameSurfaceWrap *>(pSurfaceIn->pSurface);
-+
-+ auto mctf = surface->AddExtBuffer<mfxExtVppMctf>();
-+ mctf->FilterStrength = MCTFCurParam->FilterStrength;
-+ #if defined ENABLE_MCTF_EXT
-+ mctf->BitsPerPixelx100k = mfxU32(MCTF_LOSSLESS_BPP * MCTF_BITRATE_MULTIPLIER);
-+ mctf->Deblocking = MFX_CODINGOPTION_OFF;
-+ #endif
-+ m_MctfRTParams.MoveForward();
-+ }
-+#endif
-+
-+ for (;;) {
-+ if (m_MemoryModel == GENERAL_ALLOC || m_MemoryModel == VISIBLE_INT_ALLOC) {
-+ sts = m_pmfxVPP->RunFrameVPPAsync(pSurfaceIn->pSurface,
-+ out_surface,
-+ NULL,
-+ &pExtSurface->Syncp);
-+ }
-+#if defined(MFX_ONEVPL)
-+ else {
-+ sts = m_pmfxVPP->ProcessFrameAsync(pSurfaceIn->pSurface, &pExtSurface->pSurface);
-+ }
-+#endif
-+
-+ if (MFX_ERR_NONE < sts) {
-+ if ((m_MemoryModel != HIDDEN_INT_ALLOC && !pExtSurface->Syncp) ||
-+ (m_MemoryModel == HIDDEN_INT_ALLOC &&
-+ !out_surface)) // repeat the call if warning and no output
-+ {
-+ if (MFX_WRN_DEVICE_BUSY == sts)
-+ MSDK_SLEEP(1); // wait if device is busy
-+ }
-+ else {
-+ sts = MFX_ERR_NONE; // ignore warnings if output is available
-+ break;
-+ }
-+ }
-+ else {
-+ break;
-+ }
-+ }
-+
-+ return sts;
-+
-+} // mfxStatus CTranscodingPipeline::DecodeOneFrame(ExtendedSurface *pExtSurface)
-+
-+mfxStatus CTranscodingPipeline::EncodeOneFrame(ExtendedSurface *pExtSurface,
-+ mfxBitstreamWrapper *pBS) {
-+ mfxStatus sts = MFX_ERR_NONE;
-+
-+ if (!pBS->Data) {
-+ sts = AllocateSufficientBuffer(pBS);
-+ MSDK_CHECK_STATUS(sts, "AllocateSufficientBuffer failed");
-+ }
-+
-+ for (;;) {
-+ // at this point surface for encoder contains either a frame from file or a frame processed by vpp
-+ sts = m_pmfxENC->EncodeFrameAsync(pExtSurface->pEncCtrl,
-+ pExtSurface->pSurface,
-+ pBS,
-+ &pExtSurface->Syncp);
-+
-+ if (MFX_ERR_NONE < sts && !pExtSurface->Syncp) // repeat the call if warning and no output
-+ {
-+ if (MFX_WRN_DEVICE_BUSY == sts)
-+ MSDK_SLEEP(TIME_TO_SLEEP); // wait if device is busy
-+ }
-+ else if (MFX_ERR_NONE < sts && pExtSurface->Syncp) {
-+ sts = MFX_ERR_NONE; // ignore warnings if output is available
-+ break;
-+ }
-+ else if (MFX_ERR_NOT_ENOUGH_BUFFER == sts) {
-+ sts = AllocateSufficientBuffer(pBS);
-+ MSDK_CHECK_STATUS(sts, "AllocateSufficientBuffer failed");
-+ }
-+ else {
-+ break;
-+ }
-+ }
-+
-+ return sts;
-+
-+} //CTranscodingPipeline::EncodeOneFrame(ExtendedSurface *pExtSurface)
-+
-+#if !defined(MFX_ONEVPL)
-+mfxStatus CTranscodingPipeline::PreEncOneFrame(ExtendedSurface *pInSurface,
-+ ExtendedSurface *pOutSurface) {
-+ mfxStatus sts = MFX_ERR_NONE;
-+ PreEncAuxBuffer *pAux = NULL;
-+
-+ for (mfxU32 i = 0; i < MSDK_WAIT_INTERVAL; i += TIME_TO_SLEEP) {
-+ pAux = GetFreePreEncAuxBuffer();
-+ if (pAux) {
-+ break;
-+ }
-+ else {
-+ MSDK_SLEEP(TIME_TO_SLEEP);
-+ }
-+ }
-+ MSDK_CHECK_POINTER(pAux, MFX_ERR_MEMORY_ALLOC);
-+ for (;;) {
-+ pAux->encInput.InSurface = pInSurface->pSurface;
-+ // at this point surface for encoder contains either a frame from file or a frame processed by vpp
-+ sts =
-+ m_pmfxPreENC->ProcessFrameAsync(&pAux->encInput, &pAux->encOutput, &pOutSurface->Syncp);
-+
-+ if (MFX_ERR_NONE < sts && !pOutSurface->Syncp) // repeat the call if warning and no output
-+ {
-+ if (MFX_WRN_DEVICE_BUSY == sts)
-+ MSDK_SLEEP(TIME_TO_SLEEP); // wait if device is busy
-+ }
-+ else if (MFX_ERR_NONE <= sts && pOutSurface->Syncp) {
-+ LockPreEncAuxBuffer(pAux);
-+ pOutSurface->pAuxCtrl = pAux;
-+ MSDK_CHECK_POINTER(pAux->encOutput.ExtParam, MFX_ERR_NULL_PTR);
-+ MSDK_CHECK_NOT_EQUAL(pAux->encOutput.NumExtParam, 1, MFX_ERR_UNSUPPORTED);
-+ pOutSurface->pSurface =
-+ ((mfxExtLAFrameStatistics *)pAux->encOutput.ExtParam[0])->OutSurface;
-+ sts = MFX_ERR_NONE; // ignore warnings if output is available
-+ break;
-+ }
-+ else {
-+ break;
-+ }
-+ }
-+ return sts;
-+}
-+#endif //!MFX_ONEVPL
-+
-+// signal that there are no more frames
-+void CTranscodingPipeline::NoMoreFramesSignal() {
-+ SafetySurfaceBuffer *pNextBuffer = m_pBuffer;
-+
-+ // For transcoding pipelines (PipelineMode::Native) this pointer is null
-+ if (!pNextBuffer)
-+ return;
-+
-+ ExtendedSurface surf = {};
-+ pNextBuffer->AddSurface(surf);
-+
-+ /*if 1_to_N mode */
-+ if (0 == m_nVPPCompEnable) {
-+ while (pNextBuffer->m_pNext) {
-+ pNextBuffer = pNextBuffer->m_pNext;
-+ pNextBuffer->AddSurface(surf);
-+ }
-+ }
-+}
-+
-+void CTranscodingPipeline::StopSession() {
-+ std::lock_guard<std::mutex> guard(m_mStopSession);
-+ m_bForceStop = true;
-+
-+ msdk_stringstream ss;
-+ ss << MSDK_STRING("session [") << GetSessionText() << MSDK_STRING("] m_bForceStop is set")
-+ << std::endl;
-+ msdk_printf(MSDK_STRING("%s"), ss.str().c_str());
-+}
-+
-+bool CTranscodingPipeline::IsOverlayUsed() {
-+ return m_bUseOverlay;
-+}
-+
-+mfxStatus CTranscodingPipeline::Decode() {
-+ mfxStatus sts = MFX_ERR_NONE;
-+
-+ ExtendedSurface DecExtSurface = { 0 };
-+ ExtendedSurface VppExtSurface = { 0 };
-+ ExtendedSurface PreEncExtSurface = { 0 };
-+ bool shouldReadNextFrame = true;
-+
-+ SafetySurfaceBuffer *pNextBuffer = m_pBuffer;
-+ bool bEndOfFile = false;
-+ bool bLastCycle = false;
-+ time_t start = time(0);
-+
-+ {
-+ std::unique_lock<std::mutex> lock(m_mStopSession);
-+ if (m_bForceStop) {
-+ lock.unlock();
-+ // add surfaces in queue for all sinks
-+ NoMoreFramesSignal();
-+ return MFX_WRN_VALUE_NOT_CHANGED;
-+ }
-+ }
-+
-+ if (m_bUseOverlay) {
-+ PreEncExtSurface.pSurface = m_pSurfaceDecPool[0];
-+
-+ if (pNextBuffer->GetLength() == 0) {
-+ // add surfaces in queue for all sinks
-+ pNextBuffer->AddSurface(PreEncExtSurface);
-+ m_nProcessedFramesNum++;
-+ }
-+ return MFX_ERR_NONE;
-+ }
-+
-+ while (MFX_ERR_NONE == sts) {
-+ pNextBuffer = m_pBuffer;
-+
-+ if (time(0) - start >= m_nTimeout)
-+ bLastCycle = true;
-+
-+ if (bLastCycle)
-+ SetNumFramesForReset(0);
-+
-+ msdk_tick nBeginTime = msdk_time_get_tick(); // microseconds.
-+
-+ if (shouldReadNextFrame) {
-+ if (!bEndOfFile) {
-+ if (!m_bUseOverlay) {
-+ sts = DecodeOneFrame(&DecExtSurface);
-+ if (MFX_ERR_MORE_DATA == sts) {
-+ sts = bLastCycle ? DecodeLastFrame(&DecExtSurface) : MFX_ERR_MORE_DATA;
-+ bEndOfFile = bLastCycle ? true : false;
-+ }
-+ }
-+ else {
-+ // Use preloaded overlay frame
-+ DecExtSurface.pSurface = m_pSurfaceDecPool[0];
-+ sts = MFX_ERR_NONE;
-+ }
-+ }
-+ else {
-+ sts = DecodeLastFrame(&DecExtSurface);
-+ }
-+
-+ if (sts == MFX_ERR_NONE) {
-+ // print statistics if m_nProcessedFramesNum is multiple of
-+ // statisticsWindowSize OR we at the end of file AND
-+ // statisticsWindowSize is not zero
-+ if (statisticsWindowSize && m_nProcessedFramesNum &&
-+ ((0 == m_nProcessedFramesNum % statisticsWindowSize) || bEndOfFile)) {
-+ inputStatistics.PrintStatistics(GetPipelineID());
-+ inputStatistics.ResetStatistics();
-+ }
-+ }
-+ if (sts == MFX_ERR_MORE_DATA && (m_pmfxVPP.get()
-+#if !defined(MFX_ONEVPL)
-+ || m_pmfxPreENC.get()
-+#endif
-+ )) {
-+ DecExtSurface.pSurface = NULL; // to get buffered VPP or ENC frames
-+ sts = MFX_ERR_NONE;
-+ }
-+ if (!bLastCycle && (DecExtSurface.pSurface == NULL)) {
-+ m_pBSProcessor->ResetInput();
-+
-+ if (!GetNumFramesForReset())
-+ SetNumFramesForReset(m_nProcessedFramesNum);
-+ sts = MFX_ERR_NONE;
-+ continue;
-+ }
-+ MSDK_BREAK_ON_ERROR(sts);
-+ }
-+
-+ if (m_pmfxVPP.get() && !m_rawInput) {
-+ if (m_bIsFieldWeaving) {
-+ // We might have 2 cases: decoder gives us pairs (TF BF)... or (BF)(TF). In first case we should set TFF for output, in second - BFF.
-+ // So, if even input surface is BF, we set TFF for output and vise versa. For odd input surface - no matter what we set.
-+ if (!(m_nProcessedFramesNum % 2)) {
-+ if (DecExtSurface.pSurface) {
-+ if ((DecExtSurface.pSurface->Info.PicStruct & MFX_PICSTRUCT_FIELD_TFF)) {
-+ m_mfxVppParams.vpp.Out.PicStruct = MFX_PICSTRUCT_FIELD_BFF;
-+ }
-+ if (DecExtSurface.pSurface->Info.PicStruct & MFX_PICSTRUCT_FIELD_BFF) {
-+ m_mfxVppParams.vpp.Out.PicStruct = MFX_PICSTRUCT_FIELD_TFF;
-+ }
-+ }
-+ }
-+ sts = VPPOneFrame(&DecExtSurface, &VppExtSurface);
-+ }
-+ else {
-+ if (m_bIsFieldSplitting) {
-+ if (DecExtSurface.pSurface) {
-+ if (DecExtSurface.pSurface->Info.PicStruct & MFX_PICSTRUCT_FIELD_TFF ||
-+ DecExtSurface.pSurface->Info.PicStruct & MFX_PICSTRUCT_FIELD_BFF) {
-+ m_mfxVppParams.vpp.Out.PicStruct = MFX_PICSTRUCT_FIELD_SINGLE;
-+ sts = VPPOneFrame(&DecExtSurface, &VppExtSurface);
-+ }
-+ else {
-+ VppExtSurface.pSurface = DecExtSurface.pSurface;
-+ VppExtSurface.pAuxCtrl = DecExtSurface.pAuxCtrl;
-+ VppExtSurface.Syncp = DecExtSurface.Syncp;
-+ }
-+ }
-+ else {
-+ sts = VPPOneFrame(&DecExtSurface, &VppExtSurface);
-+ }
-+ }
-+ else {
-+ sts = VPPOneFrame(&DecExtSurface, &VppExtSurface);
-+ }
-+ }
-+ // check for interlaced stream
-+
-+#if defined(MFX_ONEVPL)
-+ if (m_MemoryModel != GENERAL_ALLOC && DecExtSurface.pSurface) {
-+ mfxStatus sts_release =
-+ DecExtSurface.pSurface->FrameInterface->Release(DecExtSurface.pSurface);
-+ MSDK_CHECK_STATUS(sts_release, "FrameInterface->Release failed");
-+ }
-+#endif //MFX_ONEVPL
-+ }
-+ else // no VPP - just copy pointers
-+ {
-+ VppExtSurface.pSurface = DecExtSurface.pSurface;
-+ VppExtSurface.Syncp = DecExtSurface.Syncp;
-+ }
-+
-+ //--- Sometimes VPP may return 2 surfaces on output, for the first one it'll return status MFX_ERR_MORE_SURFACE - we have to call VPPOneFrame again in this case
-+ if (MFX_ERR_MORE_SURFACE == sts) {
-+ shouldReadNextFrame = false;
-+ sts = MFX_ERR_NONE;
-+ }
-+ else {
-+ shouldReadNextFrame = true;
-+ }
-+
-+ if (sts == MFX_ERR_MORE_DATA || !VppExtSurface.pSurface) {
-+ if (!bEndOfFile) {
-+ sts = MFX_ERR_NONE;
-+ continue; // go get next frame from Decode
-+ }
-+ }
-+#if !defined(MFX_ONEVPL)
-+ if (sts == MFX_ERR_MORE_DATA && m_pmfxPreENC.get()) {
-+ VppExtSurface.pSurface = NULL; // to get buffered VPP or ENC frames
-+ sts = MFX_ERR_NONE;
-+ }
-+#endif //!MFX_ONEVPL
-+
-+ MSDK_BREAK_ON_ERROR(sts);
-+
-+#if !defined(MFX_ONEVPL)
-+ if (m_pmfxPreENC.get()) {
-+ sts = PreEncOneFrame(&VppExtSurface, &PreEncExtSurface);
-+ }
-+ else // no VPP - just copy pointers
-+#endif //!MFX_ONEVPL
-+ {
-+ PreEncExtSurface.pSurface = VppExtSurface.pSurface;
-+ PreEncExtSurface.Syncp = VppExtSurface.Syncp;
-+ }
-+
-+ if (sts == MFX_ERR_MORE_DATA || !PreEncExtSurface.pSurface) {
-+ if (!bEndOfFile) {
-+ sts = MFX_ERR_NONE;
-+ continue; // go get next frame from Decode
-+ }
-+ }
-+ if (!bLastCycle) {
-+ sts = MFX_ERR_NONE;
-+ }
-+ MSDK_BREAK_ON_ERROR(sts);
-+
-+ // If session is not joined and it is not parent - synchronize.
-+ // If there was PreENC plugin in the pipeline - synchronize, because
-+ // plugin will output data to the extended buffers and mediasdk can't
-+ // track such dependency on its own.
-+ if ((!m_bIsJoinSession && m_pParentPipeline)
-+#if !defined(MFX_ONEVPL)
-+ || m_pmfxPreENC.get()
-+#endif
-+ ) {
-+ MFX_ITT_TASK("SyncOperation");
-+ sts = m_pmfxSession->SyncOperation(PreEncExtSurface.Syncp, MSDK_WAIT_INTERVAL);
-+ HandlePossibleGpuHang(sts);
-+ PreEncExtSurface.Syncp = NULL;
-+ MSDK_CHECK_ERR_NONE_STATUS(sts, MFX_ERR_ABORTED, "PreEnc: SyncOperation failed");
-+ }
-+
-+ // add surfaces in queue for all sinks
-+ pNextBuffer->AddSurface(PreEncExtSurface);
-+ /* one of key parts for N_to_1 mode:
-+ * decoded frame should be in one buffer only as we have only 1 (one!) sink
-+ * */
-+ if (0 == m_nVPPCompEnable) {
-+ while (pNextBuffer->m_pNext) {
-+ pNextBuffer = pNextBuffer->m_pNext;
-+ pNextBuffer->AddSurface(PreEncExtSurface);
-+ }
-+ }
-+
-+#if defined(MFX_ONEVPL)
-+ if (m_MemoryModel != GENERAL_ALLOC && PreEncExtSurface.pSurface) {
-+ mfxStatus sts_release =
-+ PreEncExtSurface.pSurface->FrameInterface->Release(PreEncExtSurface.pSurface);
-+ MSDK_CHECK_STATUS(sts_release, "FrameInterface->Release failed");
-+ }
-+#endif //MFX_ONEVPL
-+
-+ // We need to synchronize oldest stored surface if we've already stored enough surfaces in buffer (buffer length >= AsyncDepth)
-+ // Because we have to wait for decoder to finish processing and free some internally used surfaces
-+ //mfxU32 len = pNextBuffer->GetLength();
-+ if (pNextBuffer->GetLength() >= m_AsyncDepth) {
-+ ExtendedSurface frontSurface;
-+ pNextBuffer->GetSurface(frontSurface);
-+
-+ if (frontSurface.Syncp) {
-+ sts = m_pmfxSession->SyncOperation(frontSurface.Syncp, MSDK_WAIT_INTERVAL);
-+ HandlePossibleGpuHang(sts);
-+ MSDK_CHECK_ERR_NONE_STATUS(sts, MFX_ERR_ABORTED, "SyncOperation failed");
-+ frontSurface.Syncp = NULL;
-+ }
-+ }
-+
-+ if (!statisticsWindowSize && 0 == (m_nProcessedFramesNum - 1) % 100) {
-+ msdk_printf(MSDK_STRING("."));
-+ }
-+
-+ if (bEndOfFile && m_nTimeout) {
-+ break;
-+ }
-+
-+ msdk_tick nFrameTime = msdk_time_get_tick() - nBeginTime;
-+ if (nFrameTime < m_nReqFrameTime) {
-+ MSDK_USLEEP((mfxU32)(m_nReqFrameTime - nFrameTime));
-+ }
-+ if (++m_nProcessedFramesNum >= m_MaxFramesForTranscode) {
-+ break;
-+ }
-+ }
-+
-+ MSDK_IGNORE_MFX_STS(sts, MFX_ERR_MORE_DATA);
-+
-+ NoMoreFramesSignal();
-+
-+ if (MFX_ERR_NONE == sts)
-+ sts = MFX_WRN_VALUE_NOT_CHANGED;
-+
-+ return sts;
-+} // mfxStatus CTranscodingPipeline::Decode()
-+
-+mfxStatus CTranscodingPipeline::Encode() {
-+ mfxStatus sts = MFX_ERR_NONE;
-+ ExtendedSurface DecExtSurface = {};
-+ ExtendedSurface VppExtSurface = {};
-+ ExtendedBS *pBS = NULL;
-+ bool isQuit = false;
-+ bool bPollFlag = false;
-+ int nFramesAlreadyPut = 0;
-+ SafetySurfaceBuffer *curBuffer = m_pBuffer;
-+
-+ bool shouldReadNextFrame = true;
-+ while (MFX_ERR_NONE == sts || MFX_ERR_MORE_DATA == sts) {
-+ msdk_tick nBeginTime = msdk_time_get_tick(); // microseconds
-+ if (shouldReadNextFrame) {
-+ if (isQuit) {
-+ // We're here because one of decoders has reported that there're no any more frames ready.
-+ //So, let's pass null surface to extract data from the VPP and encoder caches.
-+
-+ MSDK_ZERO_MEMORY(DecExtSurface);
-+ }
-+ else {
-+ // Getting next frame
-+ while (MFX_ERR_MORE_SURFACE == curBuffer->GetSurface(DecExtSurface)) {
-+ if (MFX_ERR_NONE !=
-+ curBuffer->WaitForSurfaceInsertion(MSDK_SURFACE_WAIT_INTERVAL)) {
-+ msdk_printf(MSDK_STRING(
-+ "ERROR: timed out waiting surface from upstream component\n"));
-+ return MFX_ERR_NOT_FOUND;
-+ }
-+ }
-+ }
-+
-+ // if session is not joined and it is not parent - synchronize
-+ if (!m_bIsJoinSession && m_pParentPipeline) {
-+ // if it is not already synchronized
-+ if (DecExtSurface.Syncp) {
-+ MFX_ITT_TASK("SyncOperation");
-+ sts = m_pParentPipeline->m_pmfxSession->SyncOperation(DecExtSurface.Syncp,
-+ MSDK_WAIT_INTERVAL);
-+ HandlePossibleGpuHang(sts);
-+ MSDK_CHECK_ERR_NONE_STATUS(sts,
-+ MFX_ERR_ABORTED,
-+ "Encode: SyncOperation failed");
-+ }
-+ }
-+
-+ mfxU32 NumFramesForReset =
-+ m_pParentPipeline ? m_pParentPipeline->GetNumFramesForReset() : 0;
-+ if (NumFramesForReset && !(nFramesAlreadyPut % NumFramesForReset)) {
-+ m_bInsertIDR = true;
-+ }
-+
-+ if (NULL == DecExtSurface.pSurface) {
-+ isQuit = true;
-+ }
-+ }
-+
-+ if (m_pmfxVPP.get()) {
-+ sts = VPPOneFrame(&DecExtSurface, &VppExtSurface);
-+ VppExtSurface.pAuxCtrl = DecExtSurface.pAuxCtrl;
-+ }
-+ else // no VPP - just copy pointers
-+ {
-+ VppExtSurface.pSurface = DecExtSurface.pSurface;
-+ VppExtSurface.pAuxCtrl = DecExtSurface.pAuxCtrl;
-+ VppExtSurface.Syncp = DecExtSurface.Syncp;
-+ }
-+
-+ if (MFX_ERR_MORE_SURFACE == sts) {
-+ shouldReadNextFrame = false;
-+ sts = MFX_ERR_NONE;
-+ }
-+ else {
-+ shouldReadNextFrame = true;
-+ }
-+
-+ if (MFX_ERR_MORE_DATA == sts) {
-+ if (isQuit) {
-+ // to get buffered VPP or ENC frames
-+ VppExtSurface.pSurface = NULL;
-+ sts = MFX_ERR_NONE;
-+ }
-+ else {
-+ curBuffer->ReleaseSurface(DecExtSurface.pSurface);
-+
-+ //--- We should switch to another buffer ONLY in case of Composition
-+ if (curBuffer->m_pNext != NULL && m_nVPPCompEnable > 0) {
-+ curBuffer = curBuffer->m_pNext;
-+ continue;
-+ }
-+ else {
-+ curBuffer = m_pBuffer;
-+ continue; /* No more buffer from decoders */
-+ }
-+ }
-+ }
-+
-+ MSDK_CHECK_STATUS(sts, "Unexpected error!!");
-+
-+ if (m_nVPPCompEnable > 0)
-+ curBuffer->ReleaseSurface(DecExtSurface.pSurface);
-+
-+ // Do RenderFrame before Encode to improves on-screen performance
-+ // Presentation packet would now precedes "ENC" packet within the EU
-+ if ((m_nVPPCompEnable == VppCompOnly) || (m_nVPPCompEnable == VppCompOnlyEncode)) {
-+ if (VppExtSurface.pSurface) {
-+ // Sync to ensure VPP is completed to avoid flicker
-+ sts = m_pmfxSession->SyncOperation(VppExtSurface.Syncp, MSDK_WAIT_INTERVAL);
-+ HandlePossibleGpuHang(sts);
-+ MSDK_CHECK_ERR_NONE_STATUS(sts, MFX_ERR_ABORTED, "VPP: SyncOperation failed");
-+
-+ /* in case if enabled dumping into file for after VPP composition */
-+ if (DUMP_FILE_VPP_COMP == m_vppCompDumpRenderMode) {
-+ sts = DumpSurface2File(VppExtSurface.pSurface);
-+ MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
-+ }
-+ /* Rendering may be explicitly disabled for performance measurements */
-+ if (NULL_RENDER_VPP_COMP != m_vppCompDumpRenderMode) {
-+#if defined(_WIN32) || defined(_WIN64)
-+ sts = m_hwdev4Rendering->RenderFrame(VppExtSurface.pSurface, m_pMFXAllocator);
-+#else
-+ sts = m_hwdev4Rendering->RenderFrame(VppExtSurface.pSurface, NULL);
-+#endif
-+ MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
-+ } // if (NULL_RENDER_VPP_COMP != m_vppCompDumpRenderMode)
-+ }
-+ }
-+
-+ curBuffer = m_pBuffer;
-+
-+ pBS = m_pBSStore->GetNext();
-+ if (!pBS)
-+ return MFX_ERR_NOT_FOUND;
-+
-+ m_BSPool.push_back(pBS);
-+
-+ mfxU32 NumFramesForReset =
-+ m_pParentPipeline ? m_pParentPipeline->GetNumFramesForReset() : 0;
-+ if (NumFramesForReset && !(m_nProcessedFramesNum % NumFramesForReset)) {
-+ m_pBSProcessor->ResetOutput();
-+ }
-+
-+ SetEncCtrlRT(VppExtSurface, m_bInsertIDR);
-+ m_bInsertIDR = false;
-+
-+ if ((m_nVPPCompEnable != VppCompOnly) || (m_nVPPCompEnable == VppCompOnlyEncode)) {
-+ if (m_mfxEncParams.mfx.CodecId != MFX_CODEC_DUMP) {
-+ if (bPollFlag) {
-+ VppExtSurface.pSurface = 0;
-+ }
-+ sts = EncodeOneFrame(&VppExtSurface, &m_BSPool.back()->Bitstream);
-+
-+ // Count only real surfaces
-+ if (VppExtSurface.pSurface) {
-+ m_nProcessedFramesNum++;
-+ }
-+
-+ if (m_nProcessedFramesNum >= m_MaxFramesForTranscode) {
-+ bPollFlag = true;
-+ }
-+
-+ if (!sts)
-+ nFramesAlreadyPut++;
-+ }
-+ else {
-+ sts = Surface2BS(&VppExtSurface, &m_BSPool.back()->Bitstream, m_encoderFourCC);
-+ }
-+
-+#if defined(MFX_ONEVPL)
-+ if (m_MemoryModel != GENERAL_ALLOC && VppExtSurface.pSurface && m_pmfxVPP) {
-+ mfxStatus sts_release =
-+ VppExtSurface.pSurface->FrameInterface->Release(VppExtSurface.pSurface);
-+ MSDK_CHECK_STATUS(sts_release, "FrameInterface->Release failed");
-+ }
-+#endif //MFX_ONEVPL
-+ }
-+
-+ if (shouldReadNextFrame) // Release current decoded surface only if we're going to read next one during next iteration
-+ {
-+ m_pBuffer->ReleaseSurface(DecExtSurface.pSurface);
-+ }
-+
-+ // check if we need one more frame from decode
-+ if (MFX_ERR_MORE_DATA == sts) {
-+ // the task in not in Encode queue
-+ m_BSPool.pop_back();
-+ m_pBSStore->Release(pBS);
-+
-+ if (NULL == VppExtSurface.pSurface) // there are no more buffered frames in encoder
-+ {
-+ break;
-+ }
-+ else {
-+ // get next frame from Decode
-+ sts = MFX_ERR_NONE;
-+ continue;
-+ }
-+ }
-+
-+ // check encoding result
-+ MSDK_CHECK_STATUS(sts, "<EncodeOneFrame|Surface2BS> failed");
-+
-+ // output statistics if several conditions are true OR we've approached
-+ // the end, and statisticsWindowSize is not 0, but number of frames is
-+ // not multiple of statisticsWindowSize; should use m_nProcessedFramesNum
-+ // as it simplifies conditions
-+ if ((statisticsWindowSize && m_nOutputFramesNum &&
-+ 0 == m_nProcessedFramesNum % statisticsWindowSize) ||
-+ (statisticsWindowSize && (m_nProcessedFramesNum >= m_MaxFramesForTranscode))) {
-+ outputStatistics.PrintStatistics(GetPipelineID());
-+ outputStatistics.ResetStatistics();
-+ }
-+
-+ m_BSPool.back()->Syncp = VppExtSurface.Syncp;
-+ m_BSPool.back()->pCtrl = VppExtSurface.pAuxCtrl;
-+
-+ /* Actually rendering... if enabled
-+ * SYNC have not done by driver !!! */
-+ if ((m_nVPPCompEnable == VppCompOnly) || (m_nVPPCompEnable == VppCompOnlyEncode)) {
-+ if (m_BSPool.size()) {
-+ ExtendedBS *pBitstreamEx_temp = m_BSPool.front();
-+
-+ // get result coded stream
-+ ////Note! Better to do rendering before encode
-+ // if(VppExtSurface.pSurface)
-+ // {
-+ // if(m_nVPPCompEnable != VppCompOnlyEncode)
-+ // {
-+ // sts = m_pmfxSession->SyncOperation(VppExtSurface.Syncp, MSDK_WAIT_INTERVAL);
-+ // MSDK_CHECK_ERR_NONE_STATUS(sts, MFX_ERR_ABORTED, "VPP: SyncOperation failed");
-+ // }
-+ //#if defined(_WIN32) || defined(_WIN64)
-+ // sts = m_hwdev4Rendering->RenderFrame(VppExtSurface.pSurface, m_pMFXAllocator);
-+ //#else
-+ // sts = m_hwdev4Rendering->RenderFrame(VppExtSurface.pSurface, NULL);
-+ //#endif
-+ // MSDK_CHECK_STATUS(sts, "m_hwdev4Rendering->RenderFrame failed");
-+ // }
-+
-+ UnPreEncAuxBuffer(pBitstreamEx_temp->pCtrl);
-+
-+ if (m_nVPPCompEnable != VppCompOnlyEncode) {
-+ pBitstreamEx_temp->Bitstream.DataLength = 0;
-+ pBitstreamEx_temp->Bitstream.DataOffset = 0;
-+
-+ m_BSPool.pop_front();
-+ m_pBSStore->Release(pBitstreamEx_temp);
-+ }
-+ }
-+
-+ //--- If there's no data coming out from VPP and there's no data coming from decoders (isQuit==true),
-+ // then we should quit, otherwise we may stuck here forever (cause there's no new data coming)
-+ if (!VppExtSurface.pSurface && isQuit) {
-+ break;
-+ }
-+ }
-+
-+ if ((m_nVPPCompEnable != VppCompOnly) || (m_nVPPCompEnable == VppCompOnlyEncode)) {
-+ if (m_BSPool.size() == m_AsyncDepth) {
-+ sts = PutBS();
-+ MSDK_CHECK_STATUS(sts, "PutBS failed");
-+ }
-+ else {
-+ continue;
-+ }
-+ } // if (m_nVPPCompEnable != VppCompOnly)
-+
-+ msdk_tick nFrameTime = msdk_time_get_tick() - nBeginTime;
-+ if (nFrameTime < m_nReqFrameTime) {
-+ MSDK_USLEEP((mfxU32)(m_nReqFrameTime - nFrameTime));
-+ }
-+ }
-+ MSDK_IGNORE_MFX_STS(sts, MFX_ERR_MORE_DATA);
-+
-+ if (m_nVPPCompEnable != VppCompOnly || (m_nVPPCompEnable == VppCompOnlyEncode)) {
-+ // need to get buffered bitstream
-+ if (MFX_ERR_NONE == sts) {
-+ while (m_BSPool.size()) {
-+ sts = PutBS();
-+ MSDK_CHECK_STATUS(sts, "PutBS failed");
-+ }
-+ }
-+ }
-+
-+ // Clean up decoder buffers to avoid locking them (if some decoder still have some data to decode, but does not have enough surfaces)
-+ if (m_nVPPCompEnable != 0) {
-+ // Composition case - we have to clean up all buffers (all of them have data from decoders)
-+ for (SafetySurfaceBuffer *buf = m_pBuffer; buf != NULL; buf = buf->m_pNext) {
-+ while (buf->GetSurface(DecExtSurface) != MFX_ERR_MORE_SURFACE) {
-+ buf->ReleaseSurface(DecExtSurface.pSurface);
-+ buf->CancelBuffering();
-+ }
-+ }
-+ }
-+ else {
-+ // Clean up only current buffer
-+ m_pBuffer->CancelBuffering();
-+ while (m_pBuffer->GetSurface(DecExtSurface) != MFX_ERR_MORE_SURFACE) {
-+ m_pBuffer->ReleaseSurface(DecExtSurface.pSurface);
-+ }
-+ }
-+
-+ // Close encoder and decoder and clean up buffers
-+ if (m_pmfxENC.get())
-+ m_pmfxENC->Close();
-+
-+ if (m_pmfxVPP.get())
-+ m_pmfxVPP->Close();
-+
-+ if (MFX_ERR_NONE == sts)
-+ sts = MFX_WRN_VALUE_NOT_CHANGED;
-+ return sts;
-+
-+} // mfxStatus CTranscodingPipeline::Encode()
-+
-+#if MFX_VERSION >= 1022
-+void CTranscodingPipeline::FillMBQPBuffer(mfxExtMBQP &qpMap, mfxU16 pictStruct) {
-+ // External MBQP case
-+ if (m_bExtMBQP) {
-+ // Use simplistic approach to fill in QP buffer
-+ for (size_t i = 0; i < qpMap.NumQPAlloc; i++) {
-+ qpMap.QP[i] = i % 52;
-+ }
-+ return;
-+ }
-+
-+ // External MBQP with ROI case
-+ if (pictStruct == MFX_PICSTRUCT_PROGRESSIVE) {
-+ mfxI8 fQP = (m_nSubmittedFramesNum % m_GOPSize) ? (mfxI8)m_QPforP : (mfxI8)m_QPforI;
-+ std::memset(qpMap.QP, fQP, qpMap.NumQPAlloc);
-+
-+ // printf("QP expectation: %d, map PTR %lld\n",fQP,(long long int)qpMap.QP);
-+
-+ if (m_ROIData.size() > m_nSubmittedFramesNum) {
-+ mfxExtEncoderROI &roi = m_ROIData[m_nSubmittedFramesNum];
-+ for (mfxI32 i = roi.NumROI - 1; i >= 0; i--) {
-+ mfxU32 l = (roi.ROI[i].Left) >> 4, t = (roi.ROI[i].Top) >> 4,
-+ r = (roi.ROI[i].Right + 15) >> 4, b = (roi.ROI[i].Bottom + 15) >> 4;
-+
-+ //Additional 32x32 block alignment for HEVC VDEnc, using caps could be better
-+ if (m_mfxEncParams.mfx.CodecId == MFX_CODEC_HEVC &&
-+ m_mfxEncParams.mfx.LowPower == MFX_CODINGOPTION_ON) {
-+ l = ((roi.ROI[i].Left) >> 5) << 1;
-+ t = ((roi.ROI[i].Top) >> 5) << 1;
-+ r = ((roi.ROI[i].Right + 31) >> 5) << 1;
-+ b = ((roi.ROI[i].Bottom + 31) >> 5) << 1;
-+ }
-+
-+ if (l > m_QPmapWidth)
-+ l = m_QPmapWidth;
-+ if (r > m_QPmapWidth)
-+ r = m_QPmapWidth;
-+ if (t > m_QPmapHeight)
-+ t = m_QPmapHeight;
-+ if (b > m_QPmapHeight)
-+ b = m_QPmapHeight;
-+
-+ mfxI8 qp_value = (mfxI8)std::min(std::max(fQP + (mfxI8)roi.ROI[i].DeltaQP, 0), 51);
-+
-+ for (mfxU32 k = t; k < b; k++)
-+ std::memset(qpMap.QP + k * m_QPmapWidth + l, qp_value, r - l);
-+ }
-+ }
-+ }
-+ else if (pictStruct == MFX_PICSTRUCT_FIELD_TFF || pictStruct == MFX_PICSTRUCT_FIELD_BFF) {
-+ mfxU32 fQP[2] = { (m_nSubmittedFramesNum % m_GOPSize) ? m_QPforP : m_QPforI,
-+ (m_GOPSize > 1) ? m_QPforP : m_QPforI };
-+ mfxU32 fIdx[2] = { 2 * m_nSubmittedFramesNum, 2 * m_nSubmittedFramesNum + 1 };
-+ mfxU32 fOff[2] = { 0, 0 };
-+
-+ fOff[(pictStruct == MFX_PICSTRUCT_FIELD_BFF) ? 0 : 1] = qpMap.NumQPAlloc / 2;
-+
-+ for (int fld = 0; fld <= 1; fld++) {
-+ std::memset(qpMap.QP + fOff[fld], fQP[fld], qpMap.NumQPAlloc / 2);
-+ if (m_ROIData.size() > fIdx[fld]) {
-+ mfxExtEncoderROI &roi = m_ROIData[fIdx[fld]];
-+ for (mfxI32 i = roi.NumROI - 1; i >= 0; i--) {
-+ mfxU32 l = (roi.ROI[i].Left) >> 4, t = (roi.ROI[i].Top) >> 5,
-+ r = (roi.ROI[i].Right + 15) >> 4, b = (roi.ROI[i].Bottom + 31) >> 5;
-+ mfxI8 qp_delta = (mfxI8)roi.ROI[i].DeltaQP;
-+ mfxU8 roi_qp = (mfxU8)std::min(std::max(mfxI8(fQP[fld]) + qp_delta, 0), 51);
-+
-+ if (l > m_QPmapWidth)
-+ l = m_QPmapWidth;
-+ if (r > m_QPmapWidth)
-+ r = m_QPmapWidth;
-+ if (t > m_QPmapHeight / 2)
-+ t = m_QPmapHeight / 2;
-+ if (b > m_QPmapHeight / 2)
-+ b = m_QPmapHeight / 2;
-+
-+ for (mfxU32 k = t; k < b; k++)
-+ std::memset(qpMap.QP + fOff[fld] + k * m_QPmapWidth + l, roi_qp, r - l);
-+ }
-+ }
-+ }
-+ }
-+ else {
-+ mfxI8 fQP = (m_nSubmittedFramesNum % m_GOPSize) ? (mfxI8)m_QPforP : (mfxI8)m_QPforI;
-+ std::memset(qpMap.QP, fQP, qpMap.NumQPAlloc);
-+ }
-+}
-+#endif //MFX_VERSION >= 1022
-+
-+void CTranscodingPipeline::SetEncCtrlRT(ExtendedSurface &extSurface, bool bInsertIDR) {
-+ extSurface.pEncCtrl = NULL;
-+ if (extSurface.pAuxCtrl) {
-+ extSurface.pEncCtrl = &extSurface.pAuxCtrl->encCtrl;
-+ }
-+
-+#if MFX_VERSION >= 1022
-+
-+ if (extSurface.pSurface) {
-+ void *keyId = (void *)extSurface.pSurface;
-+
-+ // Use encoded surface pointer to find placeholders for run-time structures in maps
-+ if (m_bUseQPMap && m_bufExtMBQP.find(keyId) == m_bufExtMBQP.end()) {
-+ m_extBuffPtrStorage[keyId] = std::vector<mfxExtBuffer *>();
-+
-+ m_qpMapStorage[keyId] = std::vector<mfxU8>();
-+ m_qpMapStorage[keyId].resize(m_QPmapWidth * m_QPmapHeight);
-+
-+ m_bufExtMBQP[keyId] = mfxExtMBQP();
-+ m_bufExtMBQP[keyId].Header.BufferId = MFX_EXTBUFF_MBQP;
-+ m_bufExtMBQP[keyId].Header.BufferSz = sizeof(mfxExtMBQP);
-+ m_bufExtMBQP[keyId].NumQPAlloc = m_QPmapWidth * m_QPmapHeight;
-+ m_bufExtMBQP[keyId].QP =
-+ m_QPmapWidth && m_QPmapHeight ? &(m_qpMapStorage[keyId][0]) : NULL;
-+ }
-+
-+ // Initialize *pCtrl optionally copying content of the pExtSurface.pAuxCtrl.encCtrl
-+ mfxEncodeCtrl &ctrl = encControlStorage[keyId];
-+ MSDK_ZERO_MEMORY(ctrl);
-+
-+ if (extSurface.pEncCtrl) {
-+ ctrl = *extSurface.pEncCtrl;
-+ }
-+
-+ // Copy all extended buffer pointers from pExtSurface.pAuxCtrl.encCtrl
-+ m_extBuffPtrStorage[keyId].clear();
-+ if (extSurface.pAuxCtrl) {
-+ for (unsigned int i = 0; i < ctrl.NumExtParam; i++) {
-+ m_extBuffPtrStorage[keyId].push_back(extSurface.pAuxCtrl->encCtrl.ExtParam[i]);
-+ }
-+ }
-+
-+ // Attach additional buffer with either MBQP or ROI information
-+ if (m_bUseQPMap) {
-+ #if (MFX_VERSION >= 1022)
-+ FillMBQPBuffer(m_bufExtMBQP[keyId], extSurface.pSurface->Info.PicStruct);
-+ m_extBuffPtrStorage[keyId].push_back((mfxExtBuffer *)&m_bufExtMBQP[keyId]);
-+ #endif
-+ }
-+ else {
-+ if (m_ROIData.size() > m_nSubmittedFramesNum)
-+ m_extBuffPtrStorage[keyId].push_back(
-+ (mfxExtBuffer *)&m_ROIData[m_nSubmittedFramesNum]);
-+ }
-+
-+ // Replace the buffers pointer to pre-allocated storage
-+ ctrl.NumExtParam = (mfxU16)m_extBuffPtrStorage[keyId].size();
-+ if (ctrl.NumExtParam) {
-+ ctrl.ExtParam = &(m_extBuffPtrStorage[keyId][0]);
-+ }
-+
-+ extSurface.pEncCtrl = &ctrl;
-+ m_nSubmittedFramesNum++;
-+ }
-+#endif //MFX_VERSION >= 1022
-+
-+ if (bInsertIDR && extSurface.pSurface) {
-+ if (extSurface.pEncCtrl == NULL) {
-+ mfxEncodeCtrl &ctrl = encControlStorage[(void *)extSurface.pSurface];
-+ MSDK_ZERO_MEMORY(ctrl);
-+ extSurface.pEncCtrl = &ctrl;
-+ }
-+ extSurface.pEncCtrl->FrameType = MFX_FRAMETYPE_I | MFX_FRAMETYPE_IDR | MFX_FRAMETYPE_REF;
-+ }
-+ else {
-+ if (extSurface.pEncCtrl) {
-+ extSurface.pEncCtrl->FrameType = 0;
-+ }
-+ }
-+}
-+
-+mfxStatus CTranscodingPipeline::Transcode() {
-+ mfxStatus sts = MFX_ERR_NONE;
-+ ExtendedSurface DecExtSurface = { 0 };
-+ ExtendedSurface VppExtSurface = { 0 };
-+ ExtendedBS *pBS = NULL;
-+ bool bNeedDecodedFrames = true; // indicates if we need to decode frames
-+ bool bEndOfFile = false;
-+ bool bLastCycle = false;
-+ bool shouldReadNextFrame = true;
-+
-+ time_t start = time(0);
-+ while (MFX_ERR_NONE == sts) {
-+ msdk_tick nBeginTime = msdk_time_get_tick(); // microseconds.
-+
-+ if (time(0) - start >= m_nTimeout)
-+ bLastCycle = true;
-+ if (m_MaxFramesForTranscode == m_nProcessedFramesNum) {
-+ DecExtSurface.pSurface = NULL; // to get buffered VPP or ENC frames
-+ bNeedDecodedFrames = false; // no more decoded frames needed
-+ }
-+
-+ // if need more decoded frames
-+ // decode a frame
-+ if (bNeedDecodedFrames && shouldReadNextFrame) {
-+ if (!bEndOfFile) {
-+ sts = DecodeOneFrame(&DecExtSurface);
-+ if (MFX_ERR_MORE_DATA == sts) {
-+ if (!bLastCycle) {
-+ m_bInsertIDR = true;
-+
-+ m_pBSProcessor->ResetInput();
-+ m_pBSProcessor->ResetOutput();
-+ bNeedDecodedFrames = true;
-+
-+ bEndOfFile = false;
-+ sts = MFX_ERR_NONE;
-+ continue;
-+ }
-+ else {
-+ bEndOfFile = true;
-+ }
-+ }
-+ }
-+
-+ if (bEndOfFile) {
-+ sts = DecodeLastFrame(&DecExtSurface);
-+ }
-+
-+ if (sts == MFX_ERR_MORE_DATA) {
-+ DecExtSurface.pSurface = NULL; // to get buffered VPP or ENC frames
-+ sts = MFX_ERR_NONE;
-+ }
-+ MSDK_CHECK_STATUS(sts, "Decode<One|Last>Frame failed");
-+ }
-+ if (m_bIsFieldWeaving && DecExtSurface.pSurface != NULL) {
-+ m_mfxDecParams.mfx.FrameInfo.PicStruct = DecExtSurface.pSurface->Info.PicStruct;
-+ }
-+ if (m_bIsFieldSplitting && DecExtSurface.pSurface != NULL) {
-+ m_mfxDecParams.mfx.FrameInfo.PicStruct = DecExtSurface.pSurface->Info.PicStruct;
-+ }
-+ // pre-process a frame
-+ if (m_pmfxVPP.get() && bNeedDecodedFrames && !m_rawInput) {
-+ if (m_bIsFieldWeaving) {
-+ // In case of field weaving output surface's parameters for ODD calls to VPPOneFrame will be ignored (because VPP will return ERR_MORE_DATA).
-+ // So, we need to set output surface picstruct properly for EVEN calls (no matter what will be set for ODD calls).
-+ // We might have 2 cases: decoder gives us pairs (TF BF)... or (BF)(TF). In first case we should set TFF for output, in second - BFF.
-+ // So, if even input surface is BF, we set TFF for output and vise versa. For odd input surface - no matter what we set.
-+ if (DecExtSurface.pSurface) {
-+ if ((DecExtSurface.pSurface->Info.PicStruct &
-+ MFX_PICSTRUCT_FIELD_TFF)) // Incoming Top Field in a single surface
-+ {
-+ m_mfxVppParams.vpp.Out.PicStruct = MFX_PICSTRUCT_FIELD_BFF;
-+ }
-+ if (DecExtSurface.pSurface->Info.PicStruct &
-+ MFX_PICSTRUCT_FIELD_BFF) // Incoming Bottom Field in a single surface
-+ {
-+ m_mfxVppParams.vpp.Out.PicStruct = MFX_PICSTRUCT_FIELD_TFF;
-+ }
-+ }
-+ sts = VPPOneFrame(&DecExtSurface, &VppExtSurface);
-+ }
-+ else {
-+ if (m_bIsFieldSplitting) {
-+ if (DecExtSurface.pSurface) {
-+ if (DecExtSurface.pSurface->Info.PicStruct & MFX_PICSTRUCT_FIELD_TFF ||
-+ DecExtSurface.pSurface->Info.PicStruct & MFX_PICSTRUCT_FIELD_BFF) {
-+ m_mfxVppParams.vpp.Out.PicStruct = MFX_PICSTRUCT_FIELD_SINGLE;
-+ sts = VPPOneFrame(&DecExtSurface, &VppExtSurface);
-+ }
-+ else {
-+ VppExtSurface.pSurface = DecExtSurface.pSurface;
-+ VppExtSurface.pAuxCtrl = DecExtSurface.pAuxCtrl;
-+ VppExtSurface.Syncp = DecExtSurface.Syncp;
-+ }
-+ }
-+ else {
-+ sts = VPPOneFrame(&DecExtSurface, &VppExtSurface);
-+ }
-+ }
-+ else {
-+ sts = VPPOneFrame(&DecExtSurface, &VppExtSurface);
-+ }
-+ }
-+ // check for interlaced stream
-+
-+#if defined(MFX_ONEVPL)
-+ if (m_MemoryModel != GENERAL_ALLOC && DecExtSurface.pSurface) {
-+ mfxStatus sts_release =
-+ DecExtSurface.pSurface->FrameInterface->Release(DecExtSurface.pSurface);
-+ MSDK_CHECK_STATUS(sts_release, "FrameInterface->Release failed");
-+ }
-+#endif //MFX_ONEVPL
-+ }
-+ else // no VPP - just copy pointers
-+ {
-+ VppExtSurface.pSurface = DecExtSurface.pSurface;
-+ VppExtSurface.pAuxCtrl = DecExtSurface.pAuxCtrl;
-+ VppExtSurface.Syncp = DecExtSurface.Syncp;
-+ }
-+
-+ if (MFX_ERR_MORE_SURFACE == sts) {
-+ shouldReadNextFrame = false;
-+ sts = MFX_ERR_NONE;
-+ }
-+ else {
-+ shouldReadNextFrame = true;
-+ }
-+
-+ if (sts == MFX_ERR_MORE_DATA) {
-+ sts = MFX_ERR_NONE;
-+ if (NULL == DecExtSurface.pSurface) // there are no more buffered frames in VPP
-+ {
-+ VppExtSurface.pSurface = NULL; // to get buffered ENC frames
-+ }
-+ else {
-+ continue; // go get next frame from Decode
-+ }
-+ }
-+
-+ MSDK_CHECK_STATUS(sts, "Unexpected error!!");
-+
-+ // encode frame
-+ pBS = m_pBSStore->GetNext();
-+ if (!pBS)
-+ return MFX_ERR_NOT_FOUND;
-+
-+ m_BSPool.push_back(pBS);
-+
-+ // Set Encoding control if it is required.
-+
-+ SetEncCtrlRT(VppExtSurface, m_bInsertIDR);
-+ m_bInsertIDR = false;
-+
-+ if (DecExtSurface.pSurface)
-+ m_nProcessedFramesNum++;
-+
-+ if (m_mfxEncParams.mfx.CodecId != MFX_CODEC_DUMP) {
-+ sts = EncodeOneFrame(&VppExtSurface, &m_BSPool.back()->Bitstream);
-+ }
-+ else {
-+ sts = Surface2BS(&VppExtSurface, &m_BSPool.back()->Bitstream, m_encoderFourCC);
-+ }
-+
-+#if defined(MFX_ONEVPL)
-+ if (m_MemoryModel != GENERAL_ALLOC && VppExtSurface.pSurface) {
-+ mfxStatus sts_release =
-+ VppExtSurface.pSurface->FrameInterface->Release(VppExtSurface.pSurface);
-+ MSDK_CHECK_STATUS(sts_release, "FrameInterface->Release failed");
-+ }
-+#endif //MFX_ONEVPL
-+
-+ // check if we need one more frame from decode
-+ if (MFX_ERR_MORE_DATA == sts) {
-+ // the task in not in Encode queue
-+ m_BSPool.pop_back();
-+ m_pBSStore->Release(pBS);
-+
-+ if (NULL == VppExtSurface.pSurface) // there are no more buffered frames in encoder
-+ {
-+ break;
-+ }
-+ sts = MFX_ERR_NONE;
-+ continue;
-+ }
-+
-+ // check encoding result
-+ MSDK_CHECK_STATUS(sts, "<EncodeOneFrame|Surface2BS> failed");
-+
-+ if (statisticsWindowSize) {
-+ if ((statisticsWindowSize && m_nOutputFramesNum &&
-+ 0 == m_nProcessedFramesNum % statisticsWindowSize) ||
-+ (statisticsWindowSize && (m_nProcessedFramesNum >= m_MaxFramesForTranscode))) {
-+ inputStatistics.PrintStatistics(GetPipelineID());
-+ outputStatistics.PrintStatistics(
-+ GetPipelineID(),
-+ (m_mfxEncParams.mfx.FrameInfo.FrameRateExtD)
-+ ? (mfxF64)m_mfxEncParams.mfx.FrameInfo.FrameRateExtN /
-+ (mfxF64)m_mfxEncParams.mfx.FrameInfo.FrameRateExtD
-+ : -1);
-+ inputStatistics.ResetStatistics();
-+ outputStatistics.ResetStatistics();
-+ }
-+ }
-+ else if (0 == (m_nProcessedFramesNum - 1) % 100) {
-+ msdk_printf(MSDK_STRING("."));
-+ }
-+
-+ m_BSPool.back()->Syncp = VppExtSurface.Syncp;
-+
-+ if (m_BSPool.size() == m_AsyncDepth) {
-+ sts = PutBS();
-+ MSDK_CHECK_STATUS(sts, "PutBS failed");
-+ }
-+
-+ msdk_tick nFrameTime = msdk_time_get_tick() - nBeginTime;
-+ if (nFrameTime < m_nReqFrameTime) {
-+ MSDK_USLEEP((mfxU32)(m_nReqFrameTime - nFrameTime));
-+ }
-+ }
-+ MSDK_IGNORE_MFX_STS(sts, MFX_ERR_MORE_DATA);
-+
-+ // need to get buffered bitstream
-+ if (MFX_ERR_NONE == sts) {
-+ while (m_BSPool.size()) {
-+ sts = PutBS();
-+ MSDK_CHECK_STATUS(sts, "PutBS failed");
-+ }
-+ }
-+
-+ if (MFX_ERR_NONE == sts)
-+ sts = MFX_WRN_VALUE_NOT_CHANGED;
-+
-+ return sts;
-+} // mfxStatus CTranscodingPipeline::Transcode()
-+
-+mfxStatus CTranscodingPipeline::PutBS() {
-+ mfxStatus sts = MFX_ERR_NONE;
-+ ExtendedBS *pBitstreamEx = m_BSPool.front();
-+ MSDK_CHECK_POINTER(pBitstreamEx, MFX_ERR_NULL_PTR);
-+
-+ // get result coded stream, synchronize only if we still have sync point
-+ if (pBitstreamEx->Syncp) {
-+ sts = m_pmfxSession->SyncOperation(pBitstreamEx->Syncp, MSDK_WAIT_INTERVAL);
-+ HandlePossibleGpuHang(sts);
-+ MSDK_CHECK_ERR_NONE_STATUS(sts, MFX_ERR_ABORTED, "Encode: SyncOperation failed");
-+ }
-+
-+ m_nOutputFramesNum++;
-+
-+ //--- Time measurements
-+ if (statisticsWindowSize) {
-+ outputStatistics.StopTimeMeasurementWithCheck();
-+ outputStatistics.StartTimeMeasurement();
-+ }
-+
-+ sts = m_pBSProcessor->ProcessOutputBitstream(&pBitstreamEx->Bitstream);
-+ MSDK_CHECK_STATUS(sts, "m_pBSProcessor->ProcessOutputBitstream failed");
-+
-+ UnPreEncAuxBuffer(pBitstreamEx->pCtrl);
-+
-+ pBitstreamEx->Bitstream.DataLength = 0;
-+ pBitstreamEx->Bitstream.DataOffset = 0;
-+
-+ if (m_BSPool.size())
-+ m_BSPool.pop_front();
-+ m_pBSStore->Release(pBitstreamEx);
-+
-+ return sts;
-+} //mfxStatus CTranscodingPipeline::PutBS()
-+
-+mfxStatus CTranscodingPipeline::DumpSurface2File(mfxFrameSurface1 *pSurf) {
-+ mfxStatus sts = MFX_ERR_NONE;
-+
-+ if (m_MemoryModel == GENERAL_ALLOC) {
-+ sts = m_pMFXAllocator->Lock(m_pMFXAllocator->pthis, pSurf->Data.MemId, &pSurf->Data);
-+ MSDK_CHECK_STATUS(sts, "m_pMFXAllocator->Lock failed");
-+ }
-+#if defined(MFX_ONEVPL)
-+ else {
-+ sts = pSurf->FrameInterface->Map(pSurf, MFX_MAP_READ);
-+ MSDK_CHECK_STATUS(sts, "FrameInterface->Map failed");
-+ }
-+#endif //MFX_ONEVPL
-+
-+ sts = m_dumpVppCompFileWriter.WriteNextFrame(pSurf);
-+ MSDK_CHECK_STATUS(sts, "m_dumpVppCompFileWriter.WriteNextFrame failed");
-+
-+ if (m_MemoryModel == GENERAL_ALLOC) {
-+ sts = m_pMFXAllocator->Unlock(m_pMFXAllocator->pthis, pSurf->Data.MemId, &pSurf->Data);
-+ MSDK_CHECK_STATUS(sts, "m_pMFXAllocator->Unlock failed");
-+ }
-+#if defined(MFX_ONEVPL)
-+ else {
-+ sts = pSurf->FrameInterface->Unmap(pSurf);
-+ MSDK_CHECK_STATUS(sts, "FrameInterface->Unmap failed");
-+ }
-+#endif //MFX_ONEVPL
-+
-+ return sts;
-+} // mfxStatus CTranscodingPipeline::DumpSurface2File(ExtendedSurface* pSurf)
-+
-+mfxStatus CTranscodingPipeline::Surface2BS(ExtendedSurface *pSurf,
-+ mfxBitstreamWrapper *pBS,
-+ mfxU32 fourCC) {
-+ mfxStatus sts = MFX_ERR_MORE_DATA;
-+ // get result coded stream
-+ if (!pSurf->pSurface) {
-+ return MFX_ERR_MORE_DATA;
-+ }
-+
-+ if (pSurf->Syncp) {
-+ sts = m_pmfxSession->SyncOperation(pSurf->Syncp, MSDK_WAIT_INTERVAL);
-+ HandlePossibleGpuHang(sts);
-+ MSDK_CHECK_ERR_NONE_STATUS(sts, MFX_ERR_ABORTED, "SyncOperation failed");
-+ pSurf->Syncp = 0;
-+
-+ //--- Copying data from surface to bitstream
-+ if (m_MemoryModel == GENERAL_ALLOC) {
-+ sts = m_pMFXAllocator->Lock(m_pMFXAllocator->pthis,
-+ pSurf->pSurface->Data.MemId,
-+ &pSurf->pSurface->Data);
-+ MSDK_CHECK_STATUS(sts, "m_pMFXAllocator->Lock failed");
-+ }
-+#if defined(MFX_ONEVPL)
-+ else {
-+ sts = pSurf->pSurface->FrameInterface->Map(pSurf->pSurface, MFX_MAP_READ);
-+ MSDK_CHECK_STATUS(sts, "FrameInterface->Map failed");
-+ }
-+#endif //MFX_ONEVPL
-+
-+ switch (fourCC) {
-+ case 0: // Default value is MFX_FOURCC_I420
-+ case MFX_FOURCC_I420:
-+ sts = NV12asI420toBS(pSurf->pSurface, pBS);
-+ break;
-+ case MFX_FOURCC_NV12:
-+ sts = NV12toBS(pSurf->pSurface, pBS);
-+ break;
-+ case MFX_FOURCC_RGB4:
-+ sts = RGB4toBS(pSurf->pSurface, pBS);
-+ break;
-+ case MFX_FOURCC_YUY2:
-+ sts = YUY2toBS(pSurf->pSurface, pBS);
-+ break;
-+ }
-+ MSDK_CHECK_STATUS(sts, "<FourCC>toBS failed");
-+
-+ if (m_MemoryModel == GENERAL_ALLOC) {
-+ sts = m_pMFXAllocator->Unlock(m_pMFXAllocator->pthis,
-+ pSurf->pSurface->Data.MemId,
-+ &pSurf->pSurface->Data);
-+ MSDK_CHECK_STATUS(sts, "m_pMFXAllocator->Unlock failed");
-+ }
-+#if defined(MFX_ONEVPL)
-+ else {
-+ sts = pSurf->pSurface->FrameInterface->Unmap(pSurf->pSurface);
-+ MSDK_CHECK_STATUS(sts, "FrameInterface->Unmap failed");
-+ }
-+#endif //MFX_ONEVPL
-+ }
-+
-+ return sts;
-+}
-+
-+mfxStatus CTranscodingPipeline::NV12asI420toBS(mfxFrameSurface1 *pSurface,
-+ mfxBitstreamWrapper *pBS) {
-+ mfxFrameInfo &info = pSurface->Info;
-+ mfxFrameData &data = pSurface->Data;
-+ if ((int)pBS->MaxLength - (int)pBS->DataLength < (int)(info.CropH * info.CropW * 3 / 2)) {
-+ pBS->Extend(pBS->DataLength + (int)(info.CropH * info.CropW * 3 / 2));
-+ }
-+
-+ for (mfxU16 i = 0; i < info.CropH; i++) {
-+ MSDK_MEMCPY(pBS->Data + pBS->DataLength,
-+ data.Y + (info.CropY * data.Pitch + info.CropX) + i * data.Pitch,
-+ info.CropW);
-+ pBS->DataLength += info.CropW;
-+ }
-+
-+ mfxU16 h = info.CropH / 2;
-+ mfxU16 w = info.CropW;
-+
-+ for (mfxU16 offset = 0; offset < 2; offset++) {
-+ for (mfxU16 i = 0; i < h; i++) {
-+ for (mfxU16 j = offset; j < w; j += 2) {
-+ pBS->Data[pBS->DataLength] =
-+ *(data.UV + (info.CropY * data.Pitch / 2 + info.CropX) + i * data.Pitch + j);
-+ pBS->DataLength++;
-+ }
-+ }
-+ }
-+
-+ return MFX_ERR_NONE;
-+}
-+
-+mfxStatus CTranscodingPipeline::NV12toBS(mfxFrameSurface1 *pSurface, mfxBitstreamWrapper *pBS) {
-+ mfxFrameInfo &info = pSurface->Info;
-+ mfxFrameData &data = pSurface->Data;
-+ if ((int)pBS->MaxLength - (int)pBS->DataLength < (int)(info.CropH * info.CropW * 3 / 2)) {
-+ pBS->Extend(pBS->DataLength + (int)(info.CropH * info.CropW * 3 / 2));
-+ }
-+
-+ for (mfxU16 i = 0; i < info.CropH; i++) {
-+ MSDK_MEMCPY(pBS->Data + pBS->DataLength,
-+ data.Y + (info.CropY * data.Pitch + info.CropX) + i * data.Pitch,
-+ info.CropW);
-+ pBS->DataLength += info.CropW;
-+ }
-+
-+ for (mfxU16 i = 0; i < info.CropH / 2; i++) {
-+ MSDK_MEMCPY(pBS->Data + pBS->DataLength,
-+ data.UV + (info.CropY * data.Pitch + info.CropX) + i * data.Pitch,
-+ info.CropW);
-+ pBS->DataLength += info.CropW;
-+ }
-+
-+ return MFX_ERR_NONE;
-+}
-+
-+mfxStatus CTranscodingPipeline::RGB4toBS(mfxFrameSurface1 *pSurface, mfxBitstreamWrapper *pBS) {
-+ mfxFrameInfo &info = pSurface->Info;
-+ mfxFrameData &data = pSurface->Data;
-+ if ((int)pBS->MaxLength - (int)pBS->DataLength < (int)(info.CropH * info.CropW * 4)) {
-+ pBS->Extend(pBS->DataLength + (int)(info.CropH * info.CropW * 4));
-+ }
-+
-+ for (mfxU16 i = 0; i < info.CropH; i++) {
-+ MSDK_MEMCPY(pBS->Data + pBS->DataLength,
-+ data.B + (info.CropY * data.Pitch + info.CropX * 4) + i * data.Pitch,
-+ info.CropW * 4);
-+ pBS->DataLength += info.CropW * 4;
-+ }
-+
-+ return MFX_ERR_NONE;
-+}
-+
-+mfxStatus CTranscodingPipeline::YUY2toBS(mfxFrameSurface1 *pSurface, mfxBitstreamWrapper *pBS) {
-+ mfxFrameInfo &info = pSurface->Info;
-+ mfxFrameData &data = pSurface->Data;
-+ if ((int)pBS->MaxLength - (int)pBS->DataLength < (int)(info.CropH * info.CropW * 4)) {
-+ pBS->Extend(pBS->DataLength + (int)(info.CropH * info.CropW * 4));
-+ }
-+
-+ for (mfxU16 i = 0; i < info.CropH; i++) {
-+ MSDK_MEMCPY(pBS->Data + pBS->DataLength,
-+ data.Y + (info.CropY * data.Pitch + info.CropX / 2 * 4) + i * data.Pitch,
-+ info.CropW * 2);
-+ pBS->DataLength += info.CropW * 2;
-+ }
-+
-+ return MFX_ERR_NONE;
-+}
-+
-+#if !defined(MFX_ONEVPL)
-+mfxStatus CTranscodingPipeline::AllocMVCSeqDesc() {
-+ auto mvc = m_mfxDecParams.AddExtBuffer<mfxExtMVCSeqDesc>();
-+ mvc->View = new mfxMVCViewDependency[mvc->NumView];
-+ mvc->NumViewAlloc = mvc->NumView;
-+
-+ mvc->ViewId = new mfxU16[mvc->NumViewId];
-+ mvc->NumViewIdAlloc = mvc->NumViewId;
-+
-+ mvc->OP = new mfxMVCOperationPoint[mvc->NumOP];
-+ mvc->NumOPAlloc = mvc->NumOP;
-+
-+ return MFX_ERR_NONE;
-+}
-+
-+void CTranscodingPipeline::FreeMVCSeqDesc() {
-+ mfxExtMVCSeqDesc *mvc = m_mfxDecParams;
-+ if (m_bOwnMVCSeqDescMemory && mvc) {
-+ MSDK_SAFE_DELETE_ARRAY(mvc->View);
-+ MSDK_SAFE_DELETE_ARRAY(mvc->ViewId);
-+ MSDK_SAFE_DELETE_ARRAY(mvc->OP);
-+ }
-+}
-+#endif
-+mfxStatus CTranscodingPipeline::InitDecMfxParams(sInputParams *pInParams) {
-+ mfxStatus sts = MFX_ERR_NONE;
-+ MSDK_CHECK_POINTER(pInParams, MFX_ERR_NULL_PTR);
-+
-+ m_mfxDecParams.AsyncDepth = m_AsyncDepth;
-+
-+#if !defined(MFX_ONEVPL)
-+ if (pInParams->bIsMVC)
-+ m_mfxDecParams.AddExtBuffer<mfxExtMVCSeqDesc>();
-+#endif
-+ if (!m_bUseOverlay) {
-+ // read a portion of data for DecodeHeader function
-+ sts = m_pBSProcessor->GetInputBitstream(&m_pmfxBS);
-+ if (MFX_ERR_MORE_DATA == sts)
-+ return sts;
-+ else
-+ MSDK_CHECK_STATUS(sts, "m_pBSProcessor->GetInputBitstream failed");
-+
-+ // try to find a sequence header in the stream
-+ // if header is not found this function exits with error (e.g. if device was lost and there's no header in the remaining stream)
-+ for (;;) {
-+ // trying to find PicStruct information in AVI headers
-+ if (pInParams->DecodeId == MFX_CODEC_JPEG)
-+ MJPEG_AVI_ParsePicStruct(m_pmfxBS);
-+
-+ // parse bit stream and fill mfx params
-+ sts = m_pmfxDEC->DecodeHeader(m_pmfxBS, &m_mfxDecParams);
-+
-+ if (MFX_ERR_MORE_DATA == sts) {
-+ if (m_pmfxBS->MaxLength == m_pmfxBS->DataLength) {
-+ m_pmfxBS->Extend(m_pmfxBS->MaxLength * 2);
-+ }
-+
-+ // read a portion of data for DecodeHeader function
-+ sts = m_pBSProcessor->GetInputBitstream(&m_pmfxBS);
-+ if (MFX_ERR_MORE_DATA == sts)
-+ return sts;
-+ else
-+ MSDK_CHECK_STATUS(sts, "m_pBSProcessor->GetInputBitstream failed");
-+
-+ continue;
-+ }
-+#if !defined(MFX_ONEVPL)
-+ else if (MFX_ERR_NOT_ENOUGH_BUFFER == sts && pInParams->bIsMVC) {
-+ sts = AllocMVCSeqDesc();
-+ MSDK_CHECK_STATUS(sts, "m_pmfxDEC->DecodeHeader failed");
-+
-+ continue;
-+ }
-+#endif
-+ else
-+ break;
-+ }
-+
-+ // to enable decorative flags, has effect with 1.3 API libraries only
-+ // (in case of JPEG decoder - it is not valid to use this field)
-+ if (m_mfxDecParams.mfx.CodecId != MFX_CODEC_JPEG)
-+ m_mfxDecParams.mfx.ExtendedPicStruct = 1;
-+
-+ // check DecodeHeader status
-+ if (MFX_WRN_PARTIAL_ACCELERATION == sts) {
-+ msdk_printf(MSDK_STRING("WARNING: partial acceleration\n"));
-+ MSDK_IGNORE_MFX_STS(sts, MFX_WRN_PARTIAL_ACCELERATION);
-+ }
-+ MSDK_CHECK_STATUS(sts, "m_pmfxDEC->DecodeHeader failed");
-+
-+ // if input is interlaced JPEG stream
-+ if (((pInParams->DecodeId == MFX_CODEC_JPEG) &&
-+ (m_pmfxBS->PicStruct == MFX_PICSTRUCT_FIELD_TFF)) ||
-+ (m_pmfxBS->PicStruct == MFX_PICSTRUCT_FIELD_BFF)) {
-+ m_mfxDecParams.mfx.FrameInfo.CropH *= 2;
-+ m_mfxDecParams.mfx.FrameInfo.Height = MSDK_ALIGN16(m_mfxDecParams.mfx.FrameInfo.CropH);
-+ m_mfxDecParams.mfx.FrameInfo.PicStruct = m_pmfxBS->PicStruct;
-+ }
-+ }
-+ else {
-+ m_mfxDecParams.mfx.FrameInfo.Width = MSDK_ALIGN32(pInParams->nVppCompSrcW);
-+ m_mfxDecParams.mfx.FrameInfo.Height = MSDK_ALIGN32(pInParams->nVppCompSrcH);
-+ m_mfxDecParams.mfx.FrameInfo.CropW = pInParams->nVppCompSrcW;
-+ m_mfxDecParams.mfx.FrameInfo.CropH = pInParams->nVppCompSrcH;
-+
-+ m_mfxDecParams.mfx.FrameInfo.AspectRatioW = m_mfxDecParams.mfx.FrameInfo.AspectRatioH = 1;
-+ m_mfxDecParams.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
-+ m_mfxDecParams.mfx.FrameInfo.FourCC = MFX_FOURCC_RGB4;
-+ }
-+
-+ // set memory pattern
-+ if (pInParams->bForceSysMem || (MFX_IMPL_SOFTWARE == pInParams->libType) ||
-+ (pInParams->DecOutPattern == MFX_IOPATTERN_OUT_SYSTEM_MEMORY))
-+ m_mfxDecParams.IOPattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
-+ else
-+ m_mfxDecParams.IOPattern = MFX_IOPATTERN_OUT_VIDEO_MEMORY;
-+
-+ // if frame rate specified by user set it for decoder output
-+ if (pInParams->dDecoderFrameRateOverride) {
-+ ConvertFrameRate(pInParams->dDecoderFrameRateOverride,
-+ &m_mfxDecParams.mfx.FrameInfo.FrameRateExtN,
-+ &m_mfxDecParams.mfx.FrameInfo.FrameRateExtD);
-+ }
-+ // if frame rate not specified and input stream header doesn't contain valid values use default (30.0)
-+ else if (0 == (m_mfxDecParams.mfx.FrameInfo.FrameRateExtN *
-+ m_mfxDecParams.mfx.FrameInfo.FrameRateExtD)) {
-+ m_mfxDecParams.mfx.FrameInfo.FrameRateExtN = 30;
-+ m_mfxDecParams.mfx.FrameInfo.FrameRateExtD = 1;
-+ }
-+ else {
-+ // use the value from input stream header
-+ }
-+
-+ //--- Force setting fourcc type if required
-+ if (pInParams->DecoderFourCC) {
-+ m_mfxDecParams.mfx.FrameInfo.FourCC = pInParams->DecoderFourCC;
-+ m_mfxDecParams.mfx.FrameInfo.ChromaFormat = FourCCToChroma(pInParams->DecoderFourCC);
-+ }
-+
-+#if MFX_VERSION >= 1022
-+ /* SFC usage if enabled */
-+ if (pInParams->bDecoderPostProcessing) {
-+ auto decPostProc = m_mfxDecParams.AddExtBuffer<mfxExtDecVideoProcessing>();
-+ decPostProc->In.CropX = 0;
-+ decPostProc->In.CropY = 0;
-+ decPostProc->In.CropW = m_mfxDecParams.mfx.FrameInfo.CropW;
-+ decPostProc->In.CropH = m_mfxDecParams.mfx.FrameInfo.CropH;
-+
-+ decPostProc->Out.FourCC = m_mfxDecParams.mfx.FrameInfo.FourCC;
-+ decPostProc->Out.ChromaFormat = m_mfxDecParams.mfx.FrameInfo.ChromaFormat;
-+ decPostProc->Out.CropX = 0;
-+ decPostProc->Out.CropY = 0;
-+ decPostProc->Out.CropW =
-+ pInParams->eModeExt == VppComp ? pInParams->nVppCompDstW : pInParams->nDstWidth;
-+ decPostProc->Out.CropH =
-+ pInParams->eModeExt == VppComp ? pInParams->nVppCompDstH : pInParams->nDstHeight;
-+ decPostProc->Out.Width = MSDK_ALIGN16(decPostProc->Out.CropW);
-+ decPostProc->Out.Height = MSDK_ALIGN16(decPostProc->Out.CropH);
-+ }
-+#endif
-+
-+ return MFX_ERR_NONE;
-+} // mfxStatus CTranscodingPipeline::InitDecMfxParams()
-+
-+void CTranscodingPipeline::FillFrameInfoForEncoding(mfxFrameInfo &info, sInputParams *pInParams) {
-+ // Getting parameters from previous blocks
-+ if (m_bIsVpp) {
-+ MSDK_MEMCPY_VAR(info, &m_mfxVppParams.vpp.Out, sizeof(mfxFrameInfo));
-+ }
-+ else if (m_bIsPlugin) {
-+ info = m_mfxPluginParams.vpp.Out;
-+ }
-+ else {
-+ info = GetFrameInfo(m_mfxDecParams);
-+ }
-+
-+ if (pInParams->dEncoderFrameRateOverride) {
-+ ConvertFrameRate(pInParams->dEncoderFrameRateOverride,
-+ &info.FrameRateExtN,
-+ &info.FrameRateExtD);
-+ }
-+ else if (pInParams->dVPPOutFramerate) {
-+ ConvertFrameRate(pInParams->dVPPOutFramerate, &info.FrameRateExtN, &info.FrameRateExtD);
-+ }
-+}
-+
-+mfxStatus CTranscodingPipeline::InitEncMfxParams(sInputParams *pInParams) {
-+ MSDK_CHECK_POINTER(pInParams, MFX_ERR_NULL_PTR);
-+
-+ FillFrameInfoForEncoding(m_mfxEncParams.mfx.FrameInfo, pInParams);
-+
-+ MSDK_CHECK_ERROR(
-+ m_mfxEncParams.mfx.FrameInfo.FrameRateExtN * m_mfxEncParams.mfx.FrameInfo.FrameRateExtD,
-+ 0,
-+ MFX_ERR_INVALID_VIDEO_PARAM);
-+
-+ m_mfxEncParams.mfx.CodecId = pInParams->EncodeId;
-+ m_mfxEncParams.mfx.TargetUsage = pInParams->nTargetUsage; // trade-off between quality and speed
-+ m_mfxEncParams.AsyncDepth = m_AsyncDepth;
-+
-+#if !defined(MFX_ONEVPL)
-+ #if (MFX_VERSION >= 1025)
-+ if (pInParams->numMFEFrames || pInParams->MFMode) {
-+ auto mfePar = m_mfxEncParams.AddExtBuffer<mfxExtMultiFrameParam>();
-+ mfePar->MaxNumFrames = pInParams->numMFEFrames;
-+ mfePar->MFMode = pInParams->MFMode;
-+ }
-+
-+ if (pInParams->mfeTimeout) {
-+ auto mfeCtrl = m_mfxEncParams.AddExtBuffer<mfxExtMultiFrameControl>();
-+ mfeCtrl->Timeout = pInParams->mfeTimeout;
-+ }
-+ #endif
-+#endif //!MFX_ONEVPL
-+
-+#if !defined(MFX_ONEVPL)
-+ if (m_pParentPipeline && m_pParentPipeline->m_pmfxPreENC.get()) {
-+ m_mfxEncParams.mfx.RateControlMethod = MFX_RATECONTROL_LA_EXT;
-+ m_mfxEncParams.mfx.EncodedOrder =
-+ 1; // binary flag, 0 signals encoder to take frames in display order
-+ m_mfxEncParams.AsyncDepth = m_mfxEncParams.AsyncDepth == 0 ? 2 : m_mfxEncParams.AsyncDepth;
-+ }
-+ else
-+#endif //!MFX_ONEVPL
-+ {
-+ m_mfxEncParams.mfx.RateControlMethod = pInParams->nRateControlMethod;
-+ }
-+ m_mfxEncParams.mfx.NumSlice = pInParams->nSlices;
-+
-+ if (pInParams->nRateControlMethod == MFX_RATECONTROL_CQP) {
-+ m_mfxEncParams.mfx.QPI = pInParams->nQPI;
-+ m_mfxEncParams.mfx.QPP = pInParams->nQPP;
-+ m_mfxEncParams.mfx.QPB = pInParams->nQPB;
-+ }
-+
-+ if (pInParams->enableQSVFF) {
-+ m_mfxEncParams.mfx.LowPower = MFX_CODINGOPTION_ON;
-+ }
-+
-+ // leave PAR unset to avoid MPEG2 encoder rejecting streams with unsupported DAR
-+ m_mfxEncParams.mfx.FrameInfo.AspectRatioW = m_mfxEncParams.mfx.FrameInfo.AspectRatioH = 0;
-+
-+ // calculate default bitrate based on resolution and framerate
-+ if (pInParams->EncoderPicstructOverride) {
-+ m_mfxEncParams.mfx.FrameInfo.PicStruct = pInParams->EncoderPicstructOverride;
-+ }
-+
-+ MSDK_CHECK_ERROR(
-+ m_mfxEncParams.mfx.FrameInfo.FrameRateExtN * m_mfxEncParams.mfx.FrameInfo.FrameRateExtD,
-+ 0,
-+ MFX_ERR_INVALID_VIDEO_PARAM);
-+
-+ if (pInParams->nRateControlMethod != MFX_RATECONTROL_CQP) {
-+ if (pInParams->nBitRate == 0) {
-+ pInParams->nBitRate =
-+ CalculateDefaultBitrate(pInParams->EncodeId,
-+ pInParams->nTargetUsage,
-+ m_mfxEncParams.mfx.FrameInfo.Width,
-+ m_mfxEncParams.mfx.FrameInfo.Height,
-+ 1.0 * m_mfxEncParams.mfx.FrameInfo.FrameRateExtN /
-+ m_mfxEncParams.mfx.FrameInfo.FrameRateExtD);
-+ }
-+ m_mfxEncParams.mfx.TargetKbps = pInParams->nBitRate; // in Kbps
-+ m_mfxEncParams.mfx.BRCParamMultiplier = pInParams->nBitRateMultiplier;
-+ }
-+
-+ // In case of HEVC when height and/or width divided with 8 but not divided with 16
-+ // add extended parameter to increase performance
-+ if ((!((m_mfxEncParams.mfx.FrameInfo.CropW & 15) ^ 8) ||
-+ !((m_mfxEncParams.mfx.FrameInfo.CropH & 15) ^ 8)) &&
-+ (m_mfxEncParams.mfx.CodecId == MFX_CODEC_HEVC)) {
-+ auto hevcPar = m_mfxEncParams.AddExtBuffer<mfxExtHEVCParam>();
-+ hevcPar->PicWidthInLumaSamples = m_mfxEncParams.mfx.FrameInfo.CropW;
-+ hevcPar->PicHeightInLumaSamples = m_mfxEncParams.mfx.FrameInfo.CropH;
-+ }
-+
-+#if !defined(MFX_ONEVPL)
-+ #if (MFX_VERSION >= 1024)
-+ // This is for explicit extbrc only. In case of implicit (built-into-library) version - we don't need this extended buffer
-+ if (pInParams->nExtBRC == EXTBRC_ON &&
-+ (pInParams->EncodeId == MFX_CODEC_HEVC || pInParams->EncodeId == MFX_CODEC_AVC)) {
-+ auto extbrc = m_mfxEncParams.AddExtBuffer<mfxExtBRC>();
-+ HEVCExtBRC::Create(*extbrc);
-+ }
-+ #endif
-+#endif
-+
-+ m_mfxEncParams.mfx.FrameInfo.CropX = 0;
-+ m_mfxEncParams.mfx.FrameInfo.CropY = 0;
-+
-+ mfxU16 InPatternFromParent =
-+ (mfxU16)((MFX_IOPATTERN_OUT_VIDEO_MEMORY == m_mfxDecParams.IOPattern)
-+ ? MFX_IOPATTERN_IN_VIDEO_MEMORY
-+ : MFX_IOPATTERN_IN_SYSTEM_MEMORY);
-+
-+ // set memory pattern
-+ m_mfxEncParams.IOPattern = InPatternFromParent;
-+
-+ if (pInParams->nEncTileRows && pInParams->nEncTileCols) {
-+ if (m_mfxEncParams.mfx.CodecId == MFX_CODEC_HEVC) {
-+ auto tiles = m_mfxEncParams.AddExtBuffer<mfxExtHEVCTiles>();
-+ tiles->NumTileRows = pInParams->nEncTileRows;
-+ tiles->NumTileColumns = pInParams->nEncTileCols;
-+ }
-+#if MFX_VERSION >= 1029
-+ else if (m_mfxEncParams.mfx.CodecId == MFX_CODEC_VP9) {
-+ auto vp9par = m_mfxEncParams.AddExtBuffer<mfxExtVP9Param>();
-+ vp9par->NumTileRows = pInParams->nEncTileRows;
-+ vp9par->NumTileColumns = pInParams->nEncTileCols;
-+ }
-+#endif
-+ }
-+
-+ if (pInParams->nAvcTemp) {
-+ if (pInParams->EncodeId == MFX_CODEC_HEVC) {
-+ auto tl = m_mfxEncParams.AddExtBuffer<mfxExtAvcTemporalLayers>();
-+ tl->BaseLayerPID = pInParams->nBaseLayerPID;
-+ for (int i = 0; i < 8; i++) {
-+ tl->Layer[i].Scale = pInParams->nAvcTemporalLayers[i];
-+ }
-+ }
-+ }
-+
-+ if (pInParams->nSPSId || pInParams->nPPSId) {
-+ if (pInParams->EncodeId == MFX_CODEC_HEVC) {
-+ auto spspps = m_mfxEncParams.AddExtBuffer<mfxExtCodingOptionSPSPPS>();
-+ spspps->SPSId = pInParams->nSPSId;
-+ spspps->PPSId = pInParams->nPPSId;
-+ }
-+ }
-+
-+ if (pInParams->nPicTimingSEI || pInParams->nNalHrdConformance ||
-+ pInParams->nVuiNalHrdParameters) {
-+ auto co = m_mfxEncParams.AddExtBuffer<mfxExtCodingOption>();
-+ co->PicTimingSEI = pInParams->nPicTimingSEI;
-+ co->NalHrdConformance = pInParams->nNalHrdConformance;
-+ co->VuiNalHrdParameters = pInParams->nVuiNalHrdParameters;
-+ }
-+
-+#if !defined(MFX_ONEVPL)
-+ // we don't specify profile and level and let the encoder choose those basing on parameters
-+ // we must specify profile only for MVC codec
-+ if (pInParams->bIsMVC) {
-+ m_mfxEncParams.mfx.CodecProfile = m_mfxDecParams.mfx.CodecProfile;
-+ }
-+#endif
-+
-+ // JPEG encoder settings overlap nasc other encoders settings in mfxInfoMFX structure
-+ if (MFX_CODEC_JPEG == pInParams->EncodeId) {
-+ m_mfxEncParams.mfx.Interleaved = 1;
-+ m_mfxEncParams.mfx.Quality = pInParams->nQuality;
-+ m_mfxEncParams.mfx.RestartInterval = 0;
-+ MSDK_ZERO_MEMORY(m_mfxEncParams.mfx.reserved5);
-+ }
-+
-+ // configure and attach external parameters
-+ if (pInParams->bLABRC || pInParams->nMaxSliceSize || pInParams->nBRefType ||
-+ (pInParams->BitrateLimit && pInParams->EncodeId == MFX_CODEC_AVC) ||
-+ (pInParams->nExtBRC &&
-+ (pInParams->EncodeId == MFX_CODEC_HEVC || pInParams->EncodeId == MFX_CODEC_AVC)) ||
-+ pInParams->IntRefType || pInParams->IntRefCycleSize || pInParams->IntRefQPDelta ||
-+ pInParams->nMaxFrameSize || pInParams->AdaptiveI || pInParams->AdaptiveB) {
-+ auto co2 = m_mfxEncParams.AddExtBuffer<mfxExtCodingOption2>();
-+ co2->LookAheadDepth = pInParams->nLADepth;
-+ co2->MaxSliceSize = pInParams->nMaxSliceSize;
-+ co2->MaxFrameSize = pInParams->nMaxFrameSize;
-+ co2->BRefType = pInParams->nBRefType;
-+ co2->BitrateLimit = pInParams->BitrateLimit;
-+
-+ co2->IntRefType = pInParams->IntRefType;
-+ co2->IntRefCycleSize = pInParams->IntRefCycleSize;
-+ co2->IntRefQPDelta = pInParams->IntRefQPDelta;
-+ co2->AdaptiveI = pInParams->AdaptiveI;
-+ co2->AdaptiveB = pInParams->AdaptiveB;
-+
-+ if (pInParams->nExtBRC != EXTBRC_DEFAULT &&
-+ (pInParams->EncodeId == MFX_CODEC_HEVC || pInParams->EncodeId == MFX_CODEC_AVC)) {
-+ co2->ExtBRC = (mfxU16)(pInParams->nExtBRC == EXTBRC_OFF ? MFX_CODINGOPTION_OFF
-+ : MFX_CODINGOPTION_ON);
-+ }
-+ else {
-+ co2->ExtBRC = MFX_CODINGOPTION_UNKNOWN;
-+ }
-+ }
-+
-+ if (pInParams->WinBRCMaxAvgKbps || pInParams->WinBRCSize) {
-+ auto co3 = m_mfxEncParams.AddExtBuffer<mfxExtCodingOption3>();
-+ co3->WinBRCMaxAvgKbps = pInParams->WinBRCMaxAvgKbps;
-+ co3->WinBRCSize = pInParams->WinBRCSize;
-+ }
-+#if MFX_VERSION >= 1022
-+ if (pInParams->bROIasQPMAP || pInParams->bExtMBQP) {
-+ auto co3 = m_mfxEncParams.AddExtBuffer<mfxExtCodingOption3>();
-+ // QP map defines QP value for every 16x16 sub-block of a frame
-+ m_QPmapWidth = (m_mfxEncParams.mfx.FrameInfo.Width + 15) >> 4;
-+ m_QPmapHeight = (m_mfxEncParams.mfx.FrameInfo.Height + 15) >> 4;
-+ co3->EnableMBQP = MFX_CODINGOPTION_ON;
-+ }
-+#endif
-+
-+ if (pInParams->WeightedPred || pInParams->WeightedBiPred || pInParams->IntRefCycleDist ||
-+ pInParams->nAdaptiveMaxFrameSize || pInParams->LowDelayBRC) {
-+ auto co3 = m_mfxEncParams.AddExtBuffer<mfxExtCodingOption3>();
-+ co3->WeightedPred = pInParams->WeightedPred;
-+ co3->WeightedBiPred = pInParams->WeightedBiPred;
-+ co3->LowDelayBRC = pInParams->LowDelayBRC;
-+ co3->IntRefCycleDist = pInParams->IntRefCycleDist;
-+ co3->AdaptiveMaxFrameSize = pInParams->nAdaptiveMaxFrameSize;
-+ }
-+#if (MFX_VERSION >= 1026)
-+ if (pInParams->ExtBrcAdaptiveLTR) {
-+ auto co3 = m_mfxEncParams.AddExtBuffer<mfxExtCodingOption3>();
-+ co3->ExtBrcAdaptiveLTR = pInParams->ExtBrcAdaptiveLTR;
-+ }
-+#endif
-+#if MFX_VERSION >= 1023
-+ if (pInParams->RepartitionCheckMode) {
-+ auto co3 = m_mfxEncParams.AddExtBuffer<mfxExtCodingOption3>();
-+ co3->RepartitionCheckEnable = pInParams->RepartitionCheckMode;
-+ }
-+#endif
-+
-+ if (pInParams->GPB) {
-+ auto co3 = m_mfxEncParams.AddExtBuffer<mfxExtCodingOption3>();
-+ co3->GPB = pInParams->GPB;
-+ }
-+#if (MFX_VERSION >= 1026)
-+ if (pInParams->nTransformSkip) {
-+ auto co3 = m_mfxEncParams.AddExtBuffer<mfxExtCodingOption3>();
-+ co3->TransformSkip = pInParams->nTransformSkip;
-+ }
-+#endif
-+ if (pInParams->bDisableQPOffset) {
-+ auto co3 = m_mfxEncParams.AddExtBuffer<mfxExtCodingOption3>();
-+ co3->EnableQPOffset = MFX_CODINGOPTION_OFF;
-+ }
-+
-+#if !defined(MFX_ONEVPL)
-+ if (pInParams->bIsMVC)
-+ m_mfxEncParams.AddExtBuffer<mfxExtMVCSeqDesc>();
-+#endif
-+
-+#if (MFX_VERSION >= 1027)
-+ if (pInParams->TargetBitDepthLuma) {
-+ auto co3 = m_mfxEncParams.AddExtBuffer<mfxExtCodingOption3>();
-+ co3->TargetBitDepthLuma = pInParams->TargetBitDepthLuma;
-+ }
-+ if (pInParams->TargetBitDepthChroma) {
-+ auto co3 = m_mfxEncParams.AddExtBuffer<mfxExtCodingOption3>();
-+ co3->TargetBitDepthChroma = pInParams->TargetBitDepthChroma;
-+ }
-+#endif
-+
-+#if !defined(MFX_ONEVPL)
-+ if (m_pParentPipeline) {
-+ m_pParentPipeline->AddLaStreams(m_mfxEncParams.mfx.FrameInfo.Width,
-+ m_mfxEncParams.mfx.FrameInfo.Height);
-+ }
-+#endif //!MFX_ONEVPL
-+
-+ //--- Settings HRD buffer size
-+ if (pInParams->BufferSizeInKB) {
-+ m_mfxEncParams.mfx.BufferSizeInKB = pInParams->BufferSizeInKB;
-+ }
-+
-+ //--- Force setting fourcc type if required
-+ if (pInParams->EncoderFourCC) {
-+ m_mfxEncParams.mfx.FrameInfo.FourCC = pInParams->EncoderFourCC;
-+ m_mfxEncParams.mfx.FrameInfo.ChromaFormat = FourCCToChroma(pInParams->EncoderFourCC);
-+ }
-+
-+ // GopPicSize and GopRefDist values are always set using presets manager, but do not set them for JPEG
-+ if (MFX_CODEC_JPEG != pInParams->EncodeId) {
-+ m_mfxEncParams.mfx.GopPicSize = pInParams->GopPicSize;
-+ m_mfxEncParams.mfx.GopRefDist = pInParams->GopRefDist;
-+ }
-+
-+ if (pInParams->NumRefFrame) {
-+ m_mfxEncParams.mfx.NumRefFrame = pInParams->NumRefFrame;
-+ }
-+
-+ if (pInParams->CodecLevel) {
-+ m_mfxEncParams.mfx.CodecLevel = pInParams->CodecLevel;
-+ }
-+
-+ if (pInParams->CodecProfile) {
-+ m_mfxEncParams.mfx.CodecProfile = pInParams->CodecProfile;
-+ }
-+
-+ if (pInParams->GopOptFlag) {
-+ m_mfxEncParams.mfx.GopOptFlag = pInParams->GopOptFlag;
-+ }
-+
-+ if (pInParams->MaxKbps) {
-+ m_mfxEncParams.mfx.MaxKbps = pInParams->MaxKbps;
-+ }
-+
-+ if (pInParams->InitialDelayInKB) {
-+ m_mfxEncParams.mfx.InitialDelayInKB = pInParams->InitialDelayInKB;
-+ }
-+
-+ return MFX_ERR_NONE;
-+} // mfxStatus CTranscodingPipeline::InitEncMfxParams(sInputParams *pInParams)
-+
-+#if !defined(MFX_ONEVPL)
-+mfxStatus CTranscodingPipeline::CorrectPreEncAuxPool(mfxU32 num_frames_in_pool) {
-+ if (!m_pmfxPreENC)
-+ return MFX_ERR_NONE;
-+
-+ if (m_pPreEncAuxPool.size() < num_frames_in_pool) {
-+ m_pPreEncAuxPool.resize(num_frames_in_pool);
-+ }
-+ return MFX_ERR_NONE;
-+}
-+
-+mfxStatus CTranscodingPipeline::AllocPreEncAuxPool() {
-+ if (!m_pmfxPreENC)
-+ return MFX_ERR_NONE;
-+
-+ auto laCtrl = m_mfxPreEncParams.AddExtBuffer<mfxExtLAControl>();
-+ mfxU16 num_resolutions = laCtrl->NumOutStream;
-+ int buff_size = sizeof(mfxExtLAFrameStatistics) +
-+ sizeof(mfxLAFrameInfo) * num_resolutions * laCtrl->LookAheadDepth;
-+
-+ for (size_t i = 0; i < m_pPreEncAuxPool.size(); i++) {
-+ memset(&m_pPreEncAuxPool[i], 0, sizeof(m_pPreEncAuxPool[i]));
-+
-+ m_pPreEncAuxPool[i].encCtrl.NumExtParam = 1;
-+ m_pPreEncAuxPool[i].encCtrl.ExtParam = new mfxExtBuffer *[1];
-+
-+ char *pBuff = new char[buff_size];
-+ memset(pBuff, 0, buff_size);
-+
-+ m_pPreEncAuxPool[i].encCtrl.ExtParam[0] = (mfxExtBuffer *)pBuff;
-+ mfxExtLAFrameStatistics *pExtBuffer = (mfxExtLAFrameStatistics *)pBuff;
-+
-+ pExtBuffer = (mfxExtLAFrameStatistics *)pBuff;
-+ pExtBuffer->Header.BufferId = MFX_EXTBUFF_LOOKAHEAD_STAT;
-+ pExtBuffer->Header.BufferSz = buff_size;
-+ pExtBuffer->NumAlloc = num_resolutions * laCtrl->LookAheadDepth;
-+ pExtBuffer->FrameStat = (mfxLAFrameInfo *)(pBuff + sizeof(mfxExtLAFrameStatistics));
-+
-+ m_pPreEncAuxPool[i].encOutput.NumExtParam = 1;
-+ m_pPreEncAuxPool[i].encOutput.ExtParam = m_pPreEncAuxPool[i].encCtrl.ExtParam;
-+ }
-+ return MFX_ERR_NONE;
-+}
-+
-+void CTranscodingPipeline::FreePreEncAuxPool() {
-+ for (size_t i = 0; i < m_pPreEncAuxPool.size(); i++) {
-+ if (m_pPreEncAuxPool[i].encCtrl.ExtParam) {
-+ delete[] m_pPreEncAuxPool[i].encCtrl.ExtParam[0];
-+ delete[] m_pPreEncAuxPool[i].encCtrl.ExtParam;
-+ }
-+ }
-+ m_pPreEncAuxPool.resize(0);
-+}
-+#endif //!MFX_ONEVPL
-+
-+mfxStatus TranscodingSample::CTranscodingPipeline::LoadStaticSurface() {
-+ if (m_bUseOverlay) {
-+ mfxFrameSurface1 *pSurf = m_pSurfaceDecPool[0];
-+ mfxStatus sts = m_pMFXAllocator->LockFrame(pSurf->Data.MemId, &pSurf->Data);
-+ MSDK_CHECK_STATUS(sts, "m_pMFXAllocator->LockFrame failed");
-+ sts = m_pBSProcessor->GetInputFrame(pSurf);
-+ MSDK_CHECK_STATUS(sts, "m_YUVReader->LoadNextFrame failed");
-+ sts = m_pMFXAllocator->UnlockFrame(pSurf->Data.MemId, &pSurf->Data);
-+ MSDK_CHECK_STATUS(sts, "m_pMFXAllocator->UnlockFrame failed");
-+ }
-+ return MFX_ERR_NONE;
-+}
-+
-+#if !defined(MFX_ONEVPL)
-+mfxStatus CTranscodingPipeline::InitPreEncMfxParams(sInputParams *pInParams) {
-+ MSDK_CHECK_ERROR(pInParams->bEnableExtLA, false, MFX_ERR_INVALID_VIDEO_PARAM);
-+ MSDK_CHECK_POINTER(pInParams, MFX_ERR_NULL_PTR);
-+
-+ mfxVideoParam &param = m_mfxPreEncParams;
-+
-+ param.AsyncDepth = m_AsyncDepth;
-+
-+ MSDK_ZERO_MEMORY(param.mfx);
-+ param.mfx.CodecId = MFX_CODEC_AVC;
-+ param.mfx.TargetUsage = pInParams->nTargetUsage;
-+
-+ if (m_bIsVpp) {
-+ MSDK_MEMCPY_VAR(param.mfx.FrameInfo, &m_mfxVppParams.vpp.Out, sizeof(mfxFrameInfo));
-+ }
-+ else if (m_bIsPlugin) {
-+ MSDK_MEMCPY_VAR(param.mfx.FrameInfo, &m_mfxPluginParams.vpp.Out, sizeof(mfxFrameInfo));
-+ }
-+ else {
-+ param.mfx.FrameInfo = GetFrameInfo(m_mfxDecParams);
-+ }
-+
-+ mfxU16 InPatternFromParent =
-+ (mfxU16)((MFX_IOPATTERN_OUT_VIDEO_MEMORY == m_mfxDecParams.IOPattern)
-+ ? MFX_IOPATTERN_IN_VIDEO_MEMORY
-+ : MFX_IOPATTERN_IN_SYSTEM_MEMORY);
-+
-+ // set memory pattern
-+ param.IOPattern = InPatternFromParent;
-+
-+ auto laCtrl = m_mfxPreEncParams.AddExtBuffer<mfxExtLAControl>();
-+ laCtrl->LookAheadDepth = pInParams->nLADepth ? pInParams->nLADepth : 40;
-+ laCtrl->NumOutStream = 0;
-+ laCtrl->BPyramid =
-+ (mfxU16)(pInParams->bEnableBPyramid ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF);
-+
-+ m_mfxPreEncParams.mfx.GopPicSize = pInParams->GopPicSize ? pInParams->GopPicSize : 1500;
-+
-+ if (pInParams->GopRefDist) {
-+ m_mfxPreEncParams.mfx.GopRefDist = pInParams->GopRefDist;
-+ }
-+
-+ if (pInParams->nTargetUsage) {
-+ m_mfxPreEncParams.mfx.TargetUsage = pInParams->nTargetUsage;
-+ }
-+
-+ return MFX_ERR_NONE;
-+}
-+
-+mfxStatus CTranscodingPipeline::AddLaStreams(mfxU16 width, mfxU16 height) {
-+ if (m_pmfxPreENC.get() != NULL) {
-+ auto laCtrl = m_mfxPreEncParams.AddExtBuffer<mfxExtLAControl>();
-+ mfxU32 num = laCtrl->NumOutStream;
-+ m_numEncoders++;
-+ for (mfxU32 i = 0; i < num; i++) {
-+ if (laCtrl->OutStream[i].Width == width && laCtrl->OutStream[i].Height == height)
-+ return MFX_ERR_NONE;
-+ }
-+ if ((sizeof(laCtrl->OutStream) / sizeof(laCtrl->OutStream[0])) < (num + 1))
-+ return MFX_ERR_UNSUPPORTED;
-+
-+ laCtrl->OutStream[num].Width = width;
-+ laCtrl->OutStream[num].Height = height;
-+ laCtrl->NumOutStream = (mfxU16)num + 1;
-+ }
-+ return MFX_ERR_NONE;
-+}
-+#endif //!MFX_ONEVPL
-+
-+mfxU32 CTranscodingPipeline::FileFourCC2EncFourCC(mfxU32 fcc) {
-+ if (fcc == MFX_FOURCC_I420)
-+ return MFX_FOURCC_NV12;
-+ else
-+ return fcc;
-+}
-+
-+mfxStatus CTranscodingPipeline::InitVppMfxParams(sInputParams *pInParams) {
-+ MSDK_CHECK_POINTER(pInParams, MFX_ERR_NULL_PTR);
-+ m_mfxVppParams.AsyncDepth = m_AsyncDepth;
-+
-+ mfxU16 InPatternFromParent =
-+ (mfxU16)((MFX_IOPATTERN_OUT_VIDEO_MEMORY == m_mfxDecParams.IOPattern)
-+ ? MFX_IOPATTERN_IN_VIDEO_MEMORY
-+ : MFX_IOPATTERN_IN_SYSTEM_MEMORY);
-+
-+ // set memory pattern
-+ if (pInParams->VppOutPattern) {
-+ m_mfxVppParams.IOPattern = (mfxU16)(InPatternFromParent | pInParams->VppOutPattern);
-+ }
-+ else if (pInParams->bForceSysMem || (MFX_IMPL_SOFTWARE == pInParams->libType)) {
-+ m_mfxVppParams.IOPattern = (mfxU16)(InPatternFromParent | MFX_IOPATTERN_OUT_SYSTEM_MEMORY);
-+ }
-+ else {
-+ m_mfxVppParams.IOPattern = (mfxU16)(InPatternFromParent | MFX_IOPATTERN_OUT_VIDEO_MEMORY);
-+ }
-+
-+ // input frame info
-+ m_mfxVppParams.vpp.In = GetFrameInfo(m_mfxDecParams);
-+
-+ if (m_mfxVppParams.vpp.In.Width * m_mfxVppParams.vpp.In.Height == 0) {
-+ m_mfxVppParams.vpp.In.Width = MSDK_ALIGN32(pInParams->nDstWidth);
-+ m_mfxVppParams.vpp.In.Height = MSDK_ALIGN32(pInParams->nDstHeight);
-+ }
-+
-+ if (m_mfxVppParams.vpp.In.CropW * m_mfxVppParams.vpp.In.CropH == 0) {
-+ m_mfxVppParams.vpp.In.CropW = pInParams->nDstWidth;
-+ m_mfxVppParams.vpp.In.CropH = pInParams->nDstHeight;
-+ }
-+
-+ if (m_mfxVppParams.vpp.In.FrameRateExtN * m_mfxVppParams.vpp.In.FrameRateExtD == 0) {
-+ m_mfxVppParams.vpp.In.FrameRateExtN = 30;
-+ m_mfxVppParams.vpp.In.FrameRateExtD = 1;
-+ }
-+
-+ if (m_mfxVppParams.vpp.In.FourCC == 0) {
-+ m_mfxVppParams.vpp.In.FourCC = FileFourCC2EncFourCC(pInParams->DecodeId);
-+ m_mfxVppParams.mfx.FrameInfo.ChromaFormat = FourCCToChroma(pInParams->DecoderFourCC);
-+ }
-+
-+ if (m_rawInput) {
-+ m_mfxVppParams.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
-+ }
-+
-+ // fill output frame info
-+ MSDK_MEMCPY_VAR(m_mfxVppParams.vpp.Out, &m_mfxVppParams.vpp.In, sizeof(mfxFrameInfo));
-+
-+ if (m_bIsFieldWeaving) {
-+ m_mfxVppParams.vpp.Out.PicStruct = MFX_PICSTRUCT_UNKNOWN;
-+ m_mfxVppParams.vpp.Out.Height = m_mfxVppParams.vpp.In.Height << 1;
-+ m_mfxVppParams.vpp.Out.CropH = m_mfxVppParams.vpp.In.CropH << 1;
-+ }
-+
-+ if (m_bIsFieldSplitting) {
-+ m_mfxVppParams.vpp.Out.PicStruct = MFX_PICSTRUCT_FIELD_SINGLE;
-+ m_mfxVppParams.vpp.Out.Height = m_mfxVppParams.vpp.In.Height >> 1;
-+ m_mfxVppParams.vpp.Out.CropH = m_mfxVppParams.vpp.In.CropH >> 1;
-+ }
-+ if (pInParams->bEnableDeinterlacing)
-+ m_mfxVppParams.vpp.Out.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
-+
-+ // Resizing
-+ if (pInParams->nDstWidth) {
-+ m_mfxVppParams.vpp.Out.CropW = pInParams->nDstWidth;
-+ m_mfxVppParams.vpp.Out.Width = MSDK_ALIGN16(pInParams->nDstWidth);
-+ }
-+
-+ // Framerate conversion
-+ if (pInParams->dVPPOutFramerate) {
-+ ConvertFrameRate(pInParams->dVPPOutFramerate,
-+ &m_mfxVppParams.vpp.Out.FrameRateExtN,
-+ &m_mfxVppParams.vpp.Out.FrameRateExtD);
-+ }
-+
-+ if (pInParams->nDstHeight) {
-+ m_mfxVppParams.vpp.Out.CropH = pInParams->nDstHeight;
-+ m_mfxVppParams.vpp.Out.Height =
-+ (MFX_PICSTRUCT_PROGRESSIVE == m_mfxVppParams.vpp.Out.PicStruct)
-+ ? MSDK_ALIGN16(pInParams->nDstHeight)
-+ : MSDK_ALIGN32(pInParams->nDstHeight);
-+ }
-+
-+ if (pInParams->bEnableDeinterlacing) {
-+ // If stream were interlaced before then 32 bit alignment were applied.
-+ // Discard 32 bit alignment as progressive doesn't require it.
-+ m_mfxVppParams.vpp.Out.Height = MSDK_ALIGN16(m_mfxVppParams.vpp.Out.CropH);
-+ m_mfxVppParams.vpp.Out.Width = MSDK_ALIGN16(m_mfxVppParams.vpp.Out.CropW);
-+ }
-+
-+ // configure and attach external parameters
-+ mfxStatus sts = AllocAndInitVppDoNotUse(pInParams);
-+ MSDK_CHECK_STATUS(sts, "AllocAndInitVppDoNotUse failed");
-+
-+ //--- Setting output FourCC type (input type is taken from m_mfxDecParams)
-+ if (pInParams->EncoderFourCC) {
-+ m_mfxVppParams.vpp.Out.FourCC = pInParams->EncoderFourCC;
-+ m_mfxVppParams.vpp.Out.ChromaFormat = FourCCToChroma(pInParams->EncoderFourCC);
-+
-+ // set bit depth according to FourCC, it must be not inherited from m_mfxVppParams.vpp.In
-+ switch (m_mfxVppParams.vpp.Out.FourCC) {
-+ case MFX_FOURCC_RGB4:
-+ case MFX_FOURCC_YUY2:
-+ case MFX_FOURCC_NV12:
-+ case MFX_FOURCC_NV16:
-+ m_mfxVppParams.vpp.Out.BitDepthLuma = m_mfxVppParams.vpp.Out.BitDepthChroma = 8;
-+ break;
-+ case MFX_FOURCC_P010:
-+ case MFX_FOURCC_P210:
-+#if (MFX_VERSION >= 1027)
-+ case MFX_FOURCC_Y210:
-+ case MFX_FOURCC_Y410:
-+#endif
-+ m_mfxVppParams.vpp.Out.BitDepthLuma = m_mfxVppParams.vpp.Out.BitDepthChroma = 10;
-+ break;
-+ default:
-+ assert(0);
-+ MSDK_CHECK_STATUS(MFX_ERR_UNSUPPORTED, "Unexpected encoder FourCC");
-+ }
-+ }
-+
-+ /* VPP Comp Init */
-+ if (((pInParams->eModeExt == VppComp) || (pInParams->eModeExt == VppCompOnly)) &&
-+ (pInParams->numSurf4Comp != 0)) {
-+ if (m_nVPPCompEnable != VppCompOnlyEncode)
-+ m_nVPPCompEnable = pInParams->eModeExt;
-+
-+ auto vppCompPar = m_mfxVppParams.AddExtBuffer<mfxExtVPPComposite>();
-+ vppCompPar->NumInputStream = (mfxU16)pInParams->numSurf4Comp;
-+ vppCompPar->InputStream = (mfxVPPCompInputStream *)malloc(sizeof(mfxVPPCompInputStream) *
-+ vppCompPar->NumInputStream);
-+ MSDK_CHECK_POINTER(vppCompPar->InputStream, MFX_ERR_NULL_PTR);
-+
-+ // stream params
-+ /* if input streams in NV12 format background color should be in YUV format too
-+ * The same for RGB4 input, background color should be in ARGB format
-+ * */
-+
-+ switch (pInParams->EncoderFourCC) {
-+ case MFX_FOURCC_RGB4:
-+ /* back color in RGB */
-+ vppCompPar->R = 0x00;
-+ vppCompPar->G = 0x00;
-+ vppCompPar->B = 0x00;
-+ break;
-+ case MFX_FOURCC_NV12:
-+ case MFX_FOURCC_P010:
-+ case MFX_FOURCC_NV16:
-+ case MFX_FOURCC_P210:
-+ case MFX_FOURCC_YUY2:
-+ default:
-+ /* back color in YUV */
-+ vppCompPar->Y = 0x10;
-+ vppCompPar->U = 0x80;
-+ vppCompPar->V = 0x80;
-+ break;
-+ }
-+
-+#if MFX_VERSION >= 1024
-+ vppCompPar->NumTiles = pInParams->numTiles4Comp;
-+#endif
-+
-+ MSDK_CHECK_POINTER(pInParams->pVppCompDstRects, MFX_ERR_NULL_PTR);
-+ for (mfxU32 i = 0; i < pInParams->numSurf4Comp; i++) {
-+ vppCompPar->InputStream[i].DstX = pInParams->pVppCompDstRects[i].DstX;
-+ vppCompPar->InputStream[i].DstY = pInParams->pVppCompDstRects[i].DstY;
-+ vppCompPar->InputStream[i].DstW = pInParams->pVppCompDstRects[i].DstW;
-+ vppCompPar->InputStream[i].DstH = pInParams->pVppCompDstRects[i].DstH;
-+#if MFX_VERSION >= 1024
-+ vppCompPar->InputStream[i].TileId = pInParams->pVppCompDstRects[i].TileId;
-+#endif
-+ vppCompPar->InputStream[i].GlobalAlpha = 0;
-+ vppCompPar->InputStream[i].GlobalAlphaEnable = 0;
-+ vppCompPar->InputStream[i].PixelAlphaEnable = 0;
-+
-+ vppCompPar->InputStream[i].LumaKeyEnable = 0;
-+ vppCompPar->InputStream[i].LumaKeyMin = 0;
-+ vppCompPar->InputStream[i].LumaKeyMax = 0;
-+ }
-+ }
-+
-+#if !defined(MFX_ONEVPL)
-+ if (pInParams->bIsMVC)
-+ m_mfxVppParams.AddExtBuffer<mfxExtMVCSeqDesc>();
-+#endif
-+
-+ mfxU32 enhFilterCount = 0;
-+
-+#ifdef ENABLE_MCTF
-+ if (VPP_FILTER_ENABLED_CONFIGURED == pInParams->mctfParam.mode) {
-+ auto mctf = m_mfxVppParams.AddExtBuffer<mfxExtVppMctf>();
-+ mctf->FilterStrength = pInParams->mctfParam.params.FilterStrength;
-+ // If an external file is given & at least 1 value is given, use it
-+ if (!pInParams->mctfParam.rtParams.Empty() && pInParams->mctfParam.rtParams.GetCurParam()) {
-+ mctf->FilterStrength = pInParams->mctfParam.rtParams.GetCurParam()->FilterStrength;
-+ }
-+ #if defined ENABLE_MCTF_EXT
-+ mctf->Overlap = pInParams->mctfParam.pInParams.Overlap;
-+ mctf->TemporalMode = pInParams->mctfParam.params.TemporalMode;
-+ mctf->MVPrecision = pInParams->mctfParam.params.MVPrecision;
-+ mctf->BitsPerPixelx100k = pInParams->mctfParam.params.BitsPerPixelx100k;
-+ mctf->Deblocking = pInParams->mctfParam.params.Deblocking;
-+ #endif
-+ }
-+ else if (VPP_FILTER_ENABLED_DEFAULT == pInParams->mctfParam.mode) {
-+ // MCTF enabling through do-use list:
-+ m_tabDoUseAlg[enhFilterCount++] = MFX_EXTBUFF_VPP_MCTF;
-+ }
-+#endif //ENABLE_MCTF
-+
-+ if (pInParams->DenoiseLevel != -1) {
-+ auto denoise = m_mfxVppParams.AddExtBuffer<mfxExtVPPDenoise>();
-+ denoise->DenoiseFactor = (mfxU16)pInParams->DenoiseLevel;
-+ }
-+
-+ if (pInParams->DetailLevel != -1) {
-+ auto detail = m_mfxVppParams.AddExtBuffer<mfxExtVPPDetail>();
-+ detail->DetailFactor = (mfxU16)pInParams->DetailLevel;
-+ }
-+
-+ if (pInParams->FRCAlgorithm) {
-+ auto frc = m_mfxVppParams.AddExtBuffer<mfxExtVPPFrameRateConversion>();
-+ frc->Algorithm = pInParams->FRCAlgorithm;
-+ }
-+
-+ if (pInParams->bEnableDeinterlacing && pInParams->DeinterlacingMode) {
-+ auto di = m_mfxVppParams.AddExtBuffer<mfxExtVPPDeinterlacing>();
-+ di->Mode = pInParams->DeinterlacingMode;
-+ }
-+
-+ //--- Field Copy Mode
-+ if (pInParams->fieldProcessingMode) {
-+ auto fieldProc = m_mfxVppParams.AddExtBuffer<mfxExtVPPFieldProcessing>();
-+
-+ //--- To check first is we do copy frame of field
-+ fieldProc->Mode = (mfxU16)(pInParams->fieldProcessingMode == FC_FR2FR ? MFX_VPP_COPY_FRAME
-+ : MFX_VPP_COPY_FIELD);
-+
-+ fieldProc->InField = (mfxU16)(
-+ (pInParams->fieldProcessingMode == FC_T2T || pInParams->fieldProcessingMode == FC_T2B)
-+ ? MFX_PICSTRUCT_FIELD_TFF
-+ : MFX_PICSTRUCT_FIELD_BFF);
-+
-+ fieldProc->OutField = (mfxU16)(
-+ (pInParams->fieldProcessingMode == FC_T2T || pInParams->fieldProcessingMode == FC_B2T)
-+ ? MFX_PICSTRUCT_FIELD_TFF
-+ : MFX_PICSTRUCT_FIELD_BFF);
-+ }
-+
-+ if (pInParams->ScalingMode) {
-+ auto par = m_mfxVppParams.AddExtBuffer<mfxExtVPPScaling>();
-+ par->ScalingMode = pInParams->ScalingMode;
-+ }
-+
-+ if (enhFilterCount) {
-+ auto doUse = m_mfxVppParams.AddExtBuffer<mfxExtVPPDoUse>();
-+ doUse->NumAlg = enhFilterCount;
-+ doUse->AlgList = m_tabDoUseAlg;
-+ }
-+
-+#ifdef ENABLE_MCTF
-+ // would it be more efficienct to get a pointer?
-+ m_MctfRTParams = pInParams->mctfParam.rtParams;
-+ m_MctfRTParams.Restart();
-+#endif
-+
-+ return MFX_ERR_NONE;
-+
-+} //mfxStatus CTranscodingPipeline::InitMfxVppParams(sInputParams *pInParams)
-+
-+mfxStatus CTranscodingPipeline::InitPluginMfxParams(sInputParams *pInParams) {
-+ MSDK_CHECK_POINTER(pInParams, MFX_ERR_NULL_PTR);
-+
-+ mfxU16 parentPattern = m_bIsVpp ? m_mfxVppParams.IOPattern : m_mfxDecParams.IOPattern;
-+ mfxU16 InPatternFromParent =
-+ (mfxU16)((MFX_IOPATTERN_OUT_VIDEO_MEMORY & parentPattern) ? MFX_IOPATTERN_IN_VIDEO_MEMORY
-+ : MFX_IOPATTERN_IN_SYSTEM_MEMORY);
-+
-+ // set memory pattern
-+ if (pInParams->bForceSysMem || (MFX_IMPL_SOFTWARE == pInParams->libType))
-+ m_mfxPluginParams.IOPattern =
-+ (mfxU16)(InPatternFromParent | MFX_IOPATTERN_OUT_SYSTEM_MEMORY);
-+ else
-+ m_mfxPluginParams.IOPattern =
-+ (mfxU16)(InPatternFromParent | MFX_IOPATTERN_OUT_VIDEO_MEMORY);
-+
-+ m_mfxPluginParams.AsyncDepth = m_AsyncDepth;
-+
-+ // input frame info
-+ if (m_bIsVpp) {
-+ MSDK_MEMCPY_VAR(m_mfxPluginParams.vpp.In, &m_mfxVppParams.vpp.Out, sizeof(mfxFrameInfo));
-+ }
-+ else {
-+ m_mfxPluginParams.vpp.In = GetFrameInfo(m_mfxDecParams);
-+ }
-+
-+ // fill output frame info
-+ // in case of rotation plugin sample output frameinfo is same as input
-+ MSDK_MEMCPY_VAR(m_mfxPluginParams.vpp.Out, &m_mfxPluginParams.vpp.In, sizeof(mfxFrameInfo));
-+
-+ return MFX_ERR_NONE;
-+
-+} //mfxStatus CTranscodingPipeline::InitMfxVppParams(sInputParams *pInParams)
-+
-+mfxStatus CTranscodingPipeline::AllocFrames(mfxFrameAllocRequest *pRequest, bool isDecAlloc) {
-+ mfxStatus sts = MFX_ERR_NONE;
-+
-+ mfxU16 nSurfNum = 0; // number of surfaces
-+ mfxU16 i;
-+
-+ nSurfNum = pRequest->NumFrameMin = pRequest->NumFrameSuggested;
-+ msdk_printf(MSDK_STRING("Pipeline surfaces number (%s): %d\n"),
-+ isDecAlloc ? MSDK_STRING("DecPool") : MSDK_STRING("EncPool"),
-+ nSurfNum);
-+
-+ mfxFrameAllocResponse *pResponse = isDecAlloc ? &m_mfxDecResponse : &m_mfxEncResponse;
-+
-+ sts = m_pMFXAllocator->Alloc(m_pMFXAllocator->pthis, pRequest, pResponse);
-+ MSDK_CHECK_STATUS(sts, "m_pMFXAllocator->Alloc failed");
-+
-+ for (i = 0; i < nSurfNum; i++) {
-+ auto surface = std::unique_ptr<mfxFrameSurfaceWrap>(new mfxFrameSurfaceWrap());
-+ surface->Info = pRequest->Info;
-+
-+ if (m_rawInput) {
-+ sts =
-+ m_pMFXAllocator->Lock(m_pMFXAllocator->pthis, pResponse->mids[i], &(surface->Data));
-+ MSDK_CHECK_STATUS(sts, "m_pMFXAllocator->Lock failed");
-+ }
-+ else {
-+ surface->Data.MemId = pResponse->mids[i];
-+ }
-+
-+ (isDecAlloc) ? m_pSurfaceDecPool.push_back(surface.get())
-+ : m_pSurfaceEncPool.push_back(surface.get());
-+
-+ std::ignore = surface.release();
-+ }
-+
-+ (isDecAlloc) ? m_DecSurfaceType = pRequest->Type : m_EncSurfaceType = pRequest->Type;
-+
-+ return MFX_ERR_NONE;
-+
-+} // mfxStatus CTranscodingPipeline::AllocFrames(Component* pComp, mfxFrameAllocResponse* pMfxResponse, mfxVideoParam* pMfxVideoParam)
-+
-+//return true if correct
-+static bool CheckAsyncDepth(mfxFrameAllocRequest &curReq, mfxU16 asyncDepth) {
-+ return (curReq.NumFrameSuggested >= asyncDepth);
-+}
-+
-+static mfxStatus CorrectAsyncDepth(mfxFrameAllocRequest &curReq, mfxU16 asyncDepth) {
-+ mfxStatus sts = MFX_ERR_NONE;
-+ if (!CheckAsyncDepth(curReq, asyncDepth)) {
-+ sts = MFX_ERR_MEMORY_ALLOC;
-+ }
-+ else {
-+ // The request holds summary of required surfaces numbers from 2 components and
-+ // asyncDepth is included twice. Here we patch surfaces number removing
-+ // one asyncDepth.
-+ curReq.NumFrameSuggested = curReq.NumFrameSuggested - asyncDepth;
-+ curReq.NumFrameMin = curReq.NumFrameSuggested;
-+ }
-+
-+ return sts;
-+}
-+
-+static void SumAllocRequest(mfxFrameAllocRequest &curReq, mfxFrameAllocRequest &newReq) {
-+ curReq.NumFrameSuggested = curReq.NumFrameSuggested + newReq.NumFrameSuggested;
-+ curReq.NumFrameMin = curReq.NumFrameSuggested;
-+ curReq.Type = curReq.Type | newReq.Type;
-+
-+ if ((curReq.Type & MFX_MEMTYPE_SYSTEM_MEMORY) &&
-+ ((curReq.Type & 0xf0) != MFX_MEMTYPE_SYSTEM_MEMORY))
-+ curReq.Type = (mfxU16)(curReq.Type & (~MFX_MEMTYPE_SYSTEM_MEMORY));
-+ if ((curReq.Type & MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET) &&
-+ ((curReq.Type & 0xf0) != MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET))
-+ curReq.Type = (mfxU16)(curReq.Type & (~MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET));
-+
-+ if (curReq.Info.Width == 0) {
-+ curReq.Info = newReq.Info;
-+ }
-+ else {
-+ curReq.Info.Width =
-+ curReq.Info.Width < newReq.Info.Width ? newReq.Info.Width : curReq.Info.Width;
-+ curReq.Info.Height =
-+ curReq.Info.Height < newReq.Info.Height ? newReq.Info.Height : curReq.Info.Height;
-+ }
-+}
-+
-+mfxStatus CTranscodingPipeline::AllocFrames() {
-+ mfxStatus sts = MFX_ERR_NONE;
-+ bool bAddFrames = true; // correct shared pool between session
-+
-+ mfxFrameAllocRequest DecOut;
-+ mfxFrameAllocRequest VPPOut;
-+
-+ MSDK_ZERO_MEMORY(DecOut);
-+ MSDK_ZERO_MEMORY(VPPOut);
-+
-+ sts = CalculateNumberOfReqFrames(DecOut, VPPOut);
-+ MSDK_CHECK_STATUS(sts, "CalculateNumberOfReqFrames failed");
-+
-+ if (VPPOut.NumFrameSuggested) {
-+ if (bAddFrames) {
-+ SumAllocRequest(VPPOut, m_Request);
-+ bAddFrames = false;
-+ }
-+
-+ // Do not correct anything if we're using raw output - we'll need those surfaces for storing data for writer
-+ if (m_mfxEncParams.mfx.CodecId != MFX_CODEC_DUMP) {
-+ // In case of rendering enabled we need to add 1 additional surface for renderer
-+ if ((m_nVPPCompEnable == VppCompOnly) || (m_nVPPCompEnable == VppCompOnlyEncode)) {
-+ VPPOut.NumFrameSuggested++;
-+ VPPOut.NumFrameMin++;
-+ }
-+ sts = CorrectAsyncDepth(VPPOut, m_AsyncDepth);
-+ MSDK_CHECK_STATUS(sts, "CorrectAsyncDepth failed");
-+ /* WA for rendering: VPP should have at least 2 frames on output (for front & back buffer accordinally) */
-+ if ((VPPOut.NumFrameSuggested <= 1) || (VPPOut.NumFrameMin <= 1)) {
-+ VPPOut.NumFrameSuggested = 2;
-+ VPPOut.NumFrameMin = 2;
-+ }
-+ }
-+
-+#ifdef LIBVA_SUPPORT
-+ if (((m_nVPPCompEnable == VppCompOnly) || (m_nVPPCompEnable == VppCompOnlyEncode)) &&
-+ ((m_libvaBackend == MFX_LIBVA_DRM_MODESET) ||
-+ #if defined(X11_DRI3_SUPPORT)
-+ (m_libvaBackend == MFX_LIBVA_X11) ||
-+ #endif // X11_DRI3_SUPPORT
-+ (m_libvaBackend == MFX_LIBVA_WAYLAND))) {
-+ VPPOut.Type |= MFX_MEMTYPE_EXPORT_FRAME;
-+ }
-+#endif
-+ sts = AllocFrames(&VPPOut, false);
-+ MSDK_CHECK_STATUS(sts, "AllocFrames failed");
-+ }
-+
-+ if (DecOut.NumFrameSuggested) {
-+ if (bAddFrames) {
-+ SumAllocRequest(DecOut, m_Request);
-+ bAddFrames = false;
-+ }
-+
-+ if (m_bDecodeEnable) {
-+ if (0 == m_nVPPCompEnable && m_mfxEncParams.mfx.CodecId != MFX_CODEC_DUMP) {
-+ //--- Make correction to number of surfaces only if composition is not enabled. In case of composition we need all the surfaces QueryIOSurf has requested to pass them to another session's VPP
-+ // In other inter-session cases, other sessions request additional surfaces using additional calls to AllocFrames
-+ sts = CorrectAsyncDepth(DecOut, m_AsyncDepth);
-+ MSDK_CHECK_STATUS(sts, "CorrectAsyncDepth failed");
-+ }
-+
-+ // AllocId just opaque handle which allow separate decoder requests in case of VPP Composition with external allocator
-+ static mfxU32 mark_alloc = 0;
-+ m_mfxDecParams.AllocId = mark_alloc;
-+ DecOut.AllocId = mark_alloc;
-+ if (m_nVPPCompEnable) // WORKAROUND: Remove this if clause after problem with AllocID is fixed in library (mark_alloc++ should be left here)
-+ {
-+ mark_alloc++;
-+ }
-+
-+ if ((DecOut.NumFrameSuggested <= 1) || (DecOut.NumFrameMin <= 1)) {
-+ DecOut.NumFrameSuggested = 2;
-+ DecOut.NumFrameMin = 2;
-+ }
-+
-+ sts = AllocFrames(&DecOut, true);
-+ MSDK_CHECK_STATUS(sts, "AllocFrames failed");
-+#if !defined(MFX_ONEVPL)
-+ sts = CorrectPreEncAuxPool(
-+ (VPPOut.NumFrameSuggested ? VPPOut.NumFrameSuggested : DecOut.NumFrameSuggested) +
-+ m_AsyncDepth);
-+ MSDK_CHECK_STATUS(sts, "CorrectPreEncAuxPool failed");
-+ sts = AllocPreEncAuxPool();
-+ MSDK_CHECK_STATUS(sts, "AllocPreEncAuxPool failed");
-+#endif //!MFX_ONEVPL
-+ }
-+ else {
-+ if ((m_pParentPipeline) && (0 == m_nVPPCompEnable) /* case if 1_to_N */) {
-+ m_pParentPipeline->CorrectNumberOfAllocatedFrames(&DecOut);
-+#if !defined(MFX_ONEVPL)
-+ sts = m_pParentPipeline->CorrectPreEncAuxPool(
-+ VPPOut.NumFrameSuggested + DecOut.NumFrameSuggested + m_AsyncDepth);
-+ MSDK_CHECK_STATUS(sts, "m_pParentPipeline->CorrectPreEncAuxPool failed");
-+#endif //!MFX_ONEVPL
-+ }
-+ }
-+ }
-+
-+ return MFX_ERR_NONE;
-+}
-+
-+mfxStatus CTranscodingPipeline::CalculateNumberOfReqFrames(mfxFrameAllocRequest &pDecOut,
-+ mfxFrameAllocRequest &pVPPOut) {
-+ mfxStatus sts = MFX_ERR_NONE;
-+ mfxFrameAllocRequest *pSumRequest = &pDecOut;
-+
-+ memset(&pDecOut, 0, sizeof(pDecOut));
-+ memset(&pVPPOut, 0, sizeof(pVPPOut));
-+
-+ mfxFrameAllocRequest DecRequest;
-+ MSDK_ZERO_MEMORY(DecRequest);
-+
-+ if (m_pmfxDEC.get()) {
-+ sts = m_pmfxDEC.get()->QueryIOSurf(&m_mfxDecParams, &DecRequest);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxDEC.get failed");
-+
-+ if (!CheckAsyncDepth(DecRequest, m_mfxDecParams.AsyncDepth))
-+ return MFX_ERR_MEMORY_ALLOC;
-+ SumAllocRequest(*pSumRequest, DecRequest);
-+ }
-+ else if (m_bUseOverlay) {
-+ // It takes 1 surface for overlay
-+ DecRequest.NumFrameMin = DecRequest.NumFrameSuggested = 1;
-+ DecRequest.Type = MFX_MEMTYPE_FROM_DECODE | MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET |
-+ MFX_MEMTYPE_EXTERNAL_FRAME;
-+ DecRequest.Info = GetFrameInfo(m_mfxDecParams);
-+ SumAllocRequest(*pSumRequest, DecRequest);
-+ }
-+
-+ if (m_pmfxVPP.get()) {
-+ mfxFrameAllocRequest VppRequest[2];
-+
-+ MSDK_ZERO_MEMORY(VppRequest);
-+ if (m_bIsPlugin && m_bIsVpp) {
-+ sts = m_pmfxVPP.get()->QueryIOSurfMulti(&m_mfxPluginParams,
-+ &(VppRequest[0]),
-+ &m_mfxVppParams);
-+ if (!CheckAsyncDepth(VppRequest[0], m_mfxPluginParams.AsyncDepth) ||
-+ !CheckAsyncDepth(VppRequest[1], m_mfxPluginParams.AsyncDepth) ||
-+ !CheckAsyncDepth(VppRequest[0], m_mfxVppParams.AsyncDepth) ||
-+ !CheckAsyncDepth(VppRequest[1], m_mfxVppParams.AsyncDepth))
-+ return MFX_ERR_MEMORY_ALLOC;
-+ }
-+ else if (m_bIsPlugin) {
-+ sts = m_pmfxVPP.get()->QueryIOSurf(&m_mfxPluginParams, &(VppRequest[0]));
-+ if (!CheckAsyncDepth(VppRequest[0], m_mfxPluginParams.AsyncDepth) ||
-+ !CheckAsyncDepth(VppRequest[1], m_mfxPluginParams.AsyncDepth))
-+ return MFX_ERR_MEMORY_ALLOC;
-+ }
-+ else {
-+ sts = m_pmfxVPP.get()->QueryIOSurf(&m_mfxVppParams, &(VppRequest[0]));
-+ if (!CheckAsyncDepth(VppRequest[0], m_mfxVppParams.AsyncDepth) ||
-+ !CheckAsyncDepth(VppRequest[1], m_mfxVppParams.AsyncDepth))
-+ return MFX_ERR_MEMORY_ALLOC;
-+ }
-+
-+ MSDK_CHECK_STATUS(sts, "m_pmfxVPP.get()->QueryIOSurf failed");
-+
-+ SumAllocRequest(*pSumRequest, VppRequest[0]);
-+ pSumRequest = &pVPPOut;
-+ SumAllocRequest(*pSumRequest, VppRequest[1]);
-+ }
-+
-+#if !defined(MFX_ONEVPL)
-+ if (m_pmfxPreENC.get()) {
-+ mfxFrameAllocRequest PreEncRequest;
-+
-+ MSDK_ZERO_MEMORY(PreEncRequest);
-+ sts = m_pmfxPreENC.get()->QueryIOSurf(&m_mfxPreEncParams, &PreEncRequest);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxPreENC.get()->QueryIOSurf failed");
-+
-+ if (!CheckAsyncDepth(PreEncRequest, m_mfxPreEncParams.AsyncDepth))
-+ return MFX_ERR_MEMORY_ALLOC;
-+ SumAllocRequest(*pSumRequest, PreEncRequest);
-+ }
-+#endif //!MFX_ONEVPL
-+
-+ if (m_pmfxENC.get()) {
-+ mfxFrameAllocRequest EncRequest;
-+
-+ MSDK_ZERO_MEMORY(EncRequest);
-+
-+ sts = m_pmfxENC.get()->QueryIOSurf(&m_mfxEncParams, &EncRequest);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxENC.get()->QueryIOSurf failed");
-+
-+ if (!CheckAsyncDepth(EncRequest, m_mfxEncParams.AsyncDepth))
-+ return MFX_ERR_MEMORY_ALLOC;
-+ SumAllocRequest(*pSumRequest, EncRequest);
-+ }
-+
-+ if (!pSumRequest->Type && m_pmfxDEC.get()) {
-+ //--- If noone has set type to VPP request type yet, set it now basing on decoder request type
-+ pSumRequest->Type = MFX_MEMTYPE_BASE(DecRequest.Type) | MFX_MEMTYPE_FROM_VPPOUT;
-+ }
-+
-+ return MFX_ERR_NONE;
-+}
-+void CTranscodingPipeline::CorrectNumberOfAllocatedFrames(mfxFrameAllocRequest *pNewReq) {
-+ if (shouldUseGreedyFormula) {
-+ m_Request.NumFrameSuggested += pNewReq->NumFrameSuggested;
-+ }
-+ else {
-+ m_Request.NumFrameSuggested =
-+ std::max(m_Request.NumFrameSuggested, pNewReq->NumFrameSuggested);
-+ }
-+
-+ m_Request.NumFrameMin = m_Request.NumFrameSuggested;
-+ m_Request.Type = m_Request.Type | pNewReq->Type;
-+
-+ if ((m_Request.Type & MFX_MEMTYPE_SYSTEM_MEMORY) &&
-+ ((m_Request.Type & 0xf0) != MFX_MEMTYPE_SYSTEM_MEMORY))
-+ m_Request.Type = (mfxU16)(m_Request.Type & (~MFX_MEMTYPE_SYSTEM_MEMORY));
-+ if ((m_Request.Type & MFX_MEMTYPE_DXVA2_PROCESSOR_TARGET) &&
-+ ((m_Request.Type & 0xf0) != MFX_MEMTYPE_DXVA2_PROCESSOR_TARGET))
-+ m_Request.Type = (mfxU16)(m_Request.Type & (~MFX_MEMTYPE_DXVA2_PROCESSOR_TARGET));
-+
-+ if (m_Request.Info.Width == 0) {
-+ m_Request.Info = pNewReq->Info;
-+ }
-+ else {
-+ m_Request.Info.Width =
-+ m_Request.Info.Width < pNewReq->Info.Width ? pNewReq->Info.Width : m_Request.Info.Width;
-+ m_Request.Info.Height = m_Request.Info.Height < pNewReq->Info.Height
-+ ? pNewReq->Info.Height
-+ : m_Request.Info.Height;
-+ }
-+}
-+
-+void CTranscodingPipeline::FreeFrames() {
-+ std::for_each(m_pSurfaceDecPool.begin(), m_pSurfaceDecPool.end(), [](mfxFrameSurface1 *s) {
-+ auto surface = static_cast<mfxFrameSurfaceWrap *>(s);
-+ delete surface;
-+ });
-+ m_pSurfaceDecPool.clear();
-+
-+ std::for_each(m_pSurfaceEncPool.begin(), m_pSurfaceEncPool.end(), [](mfxFrameSurface1 *s) {
-+ auto surface = static_cast<mfxFrameSurfaceWrap *>(s);
-+ delete surface;
-+ });
-+ m_pSurfaceEncPool.clear();
-+
-+ if (m_pMFXAllocator) {
-+ m_pMFXAllocator->Free(m_pMFXAllocator->pthis, &m_mfxEncResponse);
-+ m_pMFXAllocator->Free(m_pMFXAllocator->pthis, &m_mfxDecResponse);
-+ }
-+} // CTranscodingPipeline::FreeFrames()
-+
-+mfxStatus CTranscodingPipeline::Init(sInputParams *pParams,
-+ MFXFrameAllocator *pMFXAllocator,
-+ void *hdl,
-+ CTranscodingPipeline *pParentPipeline,
-+ SafetySurfaceBuffer *pBuffer,
-+ FileBitstreamProcessor *pBSProc,
-+ VPLImplementationLoader *mfxLoader) {
-+ MSDK_CHECK_POINTER(pParams, MFX_ERR_NULL_PTR);
-+ MSDK_CHECK_POINTER(pMFXAllocator, MFX_ERR_NULL_PTR);
-+ MSDK_CHECK_POINTER(pBSProc, MFX_ERR_NULL_PTR);
-+ mfxStatus sts = MFX_ERR_NONE;
-+ m_MaxFramesForTranscode = pParams->MaxFrameNumber;
-+ // if no number of frames for a particular session is undefined, default
-+ // value is 0xFFFFFFFF. Thus, use it as a marker to assign parent
-+ // MaxFramesForTranscode to m_MaxFramesForTranscode
-+ if (pParentPipeline && (0xFFFFFFFF == m_MaxFramesForTranscode) &&
-+ pParentPipeline->m_MaxFramesForTranscode)
-+ m_MaxFramesForTranscode = pParentPipeline->m_MaxFramesForTranscode;
-+
-+ // use external allocator
-+ m_pMFXAllocator = pMFXAllocator;
-+ m_pBSProcessor = pBSProc;
-+ m_hdl = hdl;
-+
-+ m_pParentPipeline = pParentPipeline;
-+ shouldUseGreedyFormula = pParams->shouldUseGreedyFormula;
-+
-+ m_nTimeout = pParams->nTimeout;
-+
-+ m_AsyncDepth = (0 == pParams->nAsyncDepth) ? 1 : pParams->nAsyncDepth;
-+ m_FrameNumberPreference = pParams->FrameNumberPreference;
-+ m_numEncoders = 0;
-+ m_bUseOverlay = pParams->DecodeId == MFX_CODEC_RGB4 ? true : false;
-+ m_bRobustFlag = pParams->bRobustFlag;
-+ m_bSoftGpuHangRecovery = pParams->bSoftRobustFlag;
-+ m_nRotationAngle = pParams->nRotationAngle;
-+ m_sGenericPluginPath = pParams->strVPPPluginDLLPath;
-+ m_decoderPluginParams = pParams->decoderPluginParams;
-+ m_encoderPluginParams = pParams->encoderPluginParams;
-+
-+ m_encoderFourCC = pParams->EncoderFourCC;
-+
-+ m_rawInput = pParams->rawInput;
-+
-+ m_bExtMBQP = pParams->bExtMBQP;
-+ m_bROIasQPMAP = pParams->bROIasQPMAP;
-+
-+ m_MemoryModel =
-+ (UNKNOWN_ALLOC == pParams->nMemoryModel) ? GENERAL_ALLOC : pParams->nMemoryModel;
-+
-+#if MFX_VERSION >= 1022
-+ m_ROIData = pParams->m_ROIData;
-+#endif //MFX_VERSION >= 1022
-+
-+ statisticsWindowSize = pParams->statisticsWindowSize;
-+ if (statisticsWindowSize > m_MaxFramesForTranscode)
-+ statisticsWindowSize = m_MaxFramesForTranscode;
-+
-+ m_strMfxParamsDumpFile.assign(pParams->strMfxParamsDumpFile);
-+
-+ if (pParams->statisticsLogFile) {
-+ //same log file for intput/output
-+ inputStatistics.SetOutputFile(pParams->statisticsLogFile);
-+ outputStatistics.SetOutputFile(pParams->statisticsLogFile);
-+ }
-+
-+ if (!pParams->DumpLogFileName.empty()) {
-+ inputStatistics.SetDumpName((pParams->DumpLogFileName + MSDK_STRING("_input")).c_str());
-+ outputStatistics.SetDumpName((pParams->DumpLogFileName + MSDK_STRING("_output")).c_str());
-+ }
-+
-+ // if no statistic-window is passed but overall stat-log exist:
-+ // is requested, set statisticsWindowSize to m_MaxFramesForTranscode
-+ if ((pParams->statisticsLogFile || !pParams->DumpLogFileName.empty()) &&
-+ 0 == statisticsWindowSize)
-+ statisticsWindowSize = m_MaxFramesForTranscode;
-+
-+ if (m_bEncodeEnable) {
-+ m_pBSStore.reset(new ExtendedBSStore(m_AsyncDepth));
-+ }
-+
-+ // Determine processing mode
-+ switch (pParams->eMode) {
-+ case Native:
-+ break;
-+ case Sink:
-+ if ((VppComp == pParams->eModeExt) || (VppCompOnly == pParams->eModeExt)) {
-+ if ((NULL != pParentPipeline) && (NULL != pParentPipeline->m_pMFXAllocator))
-+ m_pMFXAllocator = pParentPipeline->m_pMFXAllocator;
-+ }
-+
-+ m_bEncodeEnable = false; // decode only
-+ break;
-+ case Source:
-+ // for heterogeneous pipeline use parent allocator
-+ MSDK_CHECK_POINTER(pParentPipeline, MFX_ERR_NULL_PTR);
-+ m_pMFXAllocator = pParentPipeline->m_pMFXAllocator;
-+ m_bDecodeEnable = false; // encode only
-+ /**/
-+ if ((pParams->m_hwdev != NULL) && (VppCompOnly == pParams->eModeExt)) {
-+#if defined(_WIN32) || defined(_WIN64)
-+ m_hwdev4Rendering = new CDecodeD3DRender;
-+ m_hwdev4Rendering->SetHWDevice(pParams->m_hwdev);
-+
-+ sWindowParams RenderParam;
-+
-+ memset(&RenderParam, 0, sizeof(sWindowParams));
-+
-+ RenderParam.lpWindowName = MSDK_STRING("sample_multi_transcode");
-+ RenderParam.nx = 0;
-+ RenderParam.ny = 0;
-+ RenderParam.nWidth = pParams->nDstWidth;
-+ RenderParam.nHeight = pParams->nDstHeight;
-+ RenderParam.ncell = 0;
-+ RenderParam.nAdapter = 0;
-+
-+ RenderParam.lpClassName = MSDK_STRING("Render Window Class");
-+ RenderParam.dwStyle = WS_OVERLAPPEDWINDOW;
-+ RenderParam.hWndParent = NULL;
-+ RenderParam.hMenu = NULL;
-+ RenderParam.hInstance = GetModuleHandle(NULL);
-+ RenderParam.lpParam = NULL;
-+ RenderParam.bFullScreen = TRUE;
-+
-+ m_hwdev4Rendering->Init(RenderParam);
-+#else
-+ if (pParams->EncodeId) {
-+ m_nVPPCompEnable = VppCompOnlyEncode;
-+ }
-+ m_hwdev4Rendering = pParams->m_hwdev;
-+#endif
-+ }
-+ break;
-+ default:
-+ // unknown mode
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ if ((VppComp == pParams->eModeExt) || (VppCompOnly == pParams->eModeExt)) {
-+ if (m_nVPPCompEnable != VppCompOnlyEncode)
-+ m_nVPPCompEnable = pParams->eModeExt;
-+ }
-+
-+#ifdef LIBVA_SUPPORT
-+ m_libvaBackend = pParams->libvaBackend;
-+#endif
-+
-+ m_pBuffer = pBuffer;
-+
-+#if defined(MFX_ONEVPL)
-+ m_initPar.Version.Major = 2;
-+ m_initPar.Version.Minor = 2;
-+#else
-+ // we set version to 1.0 and later we will query actual version of the library which will got leaded
-+ m_initPar.Version.Major = 1;
-+ m_initPar.Version.Minor = 0;
-+#endif
-+ m_initPar.Implementation = pParams->libType;
-+
-+ if (pParams->nThreadsNum) {
-+ auto threadsPar = m_initPar.AddExtBuffer<mfxExtThreadsParam>();
-+ threadsPar->NumThread = pParams->nThreadsNum;
-+ }
-+
-+ //--- GPU Copy settings
-+ m_initPar.GPUCopy = pParams->nGpuCopyMode;
-+
-+ // init session
-+ m_pmfxSession.reset(new MainVideoSession);
-+
-+ sts = m_pmfxSession->CreateSession(mfxLoader);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxSession->CreateSession failed");
-+
-+ // check the API version of actually loaded library
-+ sts = m_pmfxSession->QueryVersion(&m_Version);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxSession->QueryVersion failed");
-+ // check the implementation version of actually loaded library
-+ sts = m_pmfxSession->QueryIMPL(&pParams->libType);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxSession->QueryIMPL failed");
-+
-+#if defined(_WIN32) || defined(_WIN64)
-+ if (MFX_CODEC_AV1 == pParams->DecodeId &&
-+ MFX_IMPL_VIA_MASK(pParams->libType) == MFX_IMPL_VIA_D3D9) {
-+ sts = MFX_ERR_UNSUPPORTED;
-+ MSDK_CHECK_STATUS(sts, "AV1d have no DX9 support \n");
-+ }
-+#endif
-+
-+ sts = CheckRequiredAPIVersion(m_Version, pParams);
-+ MSDK_CHECK_STATUS(sts, "CheckRequiredAPIVersion failed");
-+
-+ // common session settings
-+ if (MFX_VERSION >= 1001)
-+ sts = m_pmfxSession->SetPriority(pParams->priority);
-+
-+ m_bIsInterOrJoined = pParams->eMode == Sink || pParams->eMode == Source || pParams->bIsJoin;
-+
-+ sts = SetAllocatorAndHandleIfRequired();
-+ MSDK_CHECK_STATUS(sts, "SetAllocatorAndHandleIfRequired failed");
-+
-+ // Joining sessions if required
-+ if (pParams->bIsJoin && pParentPipeline) {
-+ sts = pParentPipeline->Join(m_pmfxSession.get());
-+ MSDK_CHECK_STATUS(sts, "pParentPipeline->Join failed");
-+ m_bIsJoinSession = true;
-+ }
-+
-+ // Initialize pipeline components following downstream direction
-+ // Pre-init methods fill parameters and create components
-+
-+ if (!m_rawInput) {
-+ // Decode component initialization
-+ sts = DecodePreInit(pParams);
-+ if (MFX_ERR_MORE_DATA == sts)
-+ return sts;
-+ else
-+ MSDK_CHECK_STATUS(sts, "DecodePreInit failed");
-+ }
-+ else {
-+ m_mfxDecParams.mfx.FrameInfo.PicStruct = MFX_PICSTRUCT_PROGRESSIVE;
-+ }
-+
-+ // VPP component initialization
-+ sts = VPPPreInit(pParams);
-+ MSDK_CHECK_STATUS(sts, "VPPPreInit failed");
-+
-+ // Adjusting encoding settings according to selected preset
-+ if (Sink != pParams->eMode) {
-+ mfxFrameInfo eInfo;
-+ FillFrameInfoForEncoding(eInfo, pParams);
-+ ModifyParamsUsingPresets(*pParams,
-+ ((double)eInfo.FrameRateExtN) / eInfo.FrameRateExtD,
-+ eInfo.Width,
-+ eInfo.Height);
-+ }
-+
-+#if !defined(MFX_ONEVPL)
-+ // LA component initialization
-+ sts = PreEncPreInit(pParams);
-+ MSDK_CHECK_STATUS(sts, "PreEncPreInit failed");
-+#endif //MFX_ONEVPL
-+
-+ // Encode component initialization
-+ if ((m_nVPPCompEnable != VppCompOnly) || (m_nVPPCompEnable == VppCompOnlyEncode)) {
-+ sts = EncodePreInit(pParams);
-+ MSDK_CHECK_STATUS(sts, "EncodePreInit failed");
-+ }
-+
-+ if ((pParams->eMode == Source) &&
-+ ((m_nVPPCompEnable == VppCompOnly) || (m_nVPPCompEnable == VppCompOnlyEncode) ||
-+ (m_nVPPCompEnable == VppComp))) {
-+ if ((0 == msdk_strncmp(MSDK_STRING("null_render"),
-+ pParams->strDumpVppCompFile,
-+ msdk_strlen(MSDK_STRING("null_render")))))
-+ m_vppCompDumpRenderMode = NULL_RENDER_VPP_COMP; // null_render case
-+ else if (0 != msdk_strlen(pParams->strDumpVppCompFile)) {
-+ sts = m_dumpVppCompFileWriter.Init(pParams->strDumpVppCompFile, 0);
-+ MSDK_CHECK_STATUS(sts, "VPP COMP DUMP File Init failed");
-+ m_vppCompDumpRenderMode = DUMP_FILE_VPP_COMP;
-+ }
-+ }
-+
-+ if (m_MemoryModel == GENERAL_ALLOC) {
-+ // Frames allocation for all component
-+ if (Native == pParams->eMode) {
-+ sts = AllocFrames();
-+ MSDK_CHECK_STATUS(sts, "AllocFrames failed");
-+ }
-+ else if (Source ==
-+ pParams->eMode) // need allocate frames only for VPP and Encode if VPP exist
-+ {
-+ if (!m_bDecodeEnable) {
-+ sts = AllocFrames();
-+ MSDK_CHECK_STATUS(sts, "AllocFrames failed");
-+ }
-+ }
-+ }
-+
-+ isHEVCSW = AreGuidsEqual(pParams->decoderPluginParams.pluginGuid, MFX_PLUGINID_HEVCD_SW);
-+
-+ // if sink - suspended allocation
-+
-+ // common session settings
-+ if (m_Version.Major >= 1 && m_Version.Minor >= 1)
-+ sts = m_pmfxSession->SetPriority(pParams->priority);
-+
-+ // if sink - suspended allocation
-+ if (Native != pParams->eMode)
-+ return sts;
-+
-+ // Init decode
-+ if (m_pmfxDEC.get()) {
-+ sts = m_pmfxDEC->Init(&m_mfxDecParams);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxDEC->Init failed");
-+ }
-+
-+ // Init VPP
-+ if (m_pmfxVPP.get()) {
-+ if (m_bIsPlugin && m_bIsVpp)
-+ sts = m_pmfxVPP->InitMulti(&m_mfxPluginParams, &m_mfxVppParams);
-+ else if (m_bIsPlugin)
-+ sts = m_pmfxVPP->Init(&m_mfxPluginParams);
-+ else
-+ sts = m_pmfxVPP->Init(&m_mfxVppParams);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxVPP->Init failed");
-+
-+ if (MFX_WRN_PARTIAL_ACCELERATION == sts) {
-+ msdk_printf(MSDK_STRING("WARNING: partial acceleration\n"));
-+ MSDK_IGNORE_MFX_STS(sts, MFX_WRN_PARTIAL_ACCELERATION);
-+ }
-+ MSDK_CHECK_STATUS(sts, "m_pmfxVPP->Init failed");
-+ }
-+#if !defined(MFX_ONEVPL)
-+ // LA initialization
-+ if (m_pmfxPreENC.get()) {
-+ sts = m_pmfxPreENC->Init(&m_mfxPreEncParams);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxPreENC->Init failed");
-+ }
-+#endif //!MFX_ONEVPL
-+
-+ // Init encode
-+ if (m_pmfxENC.get()) {
-+ sts = m_pmfxENC->Init(&m_mfxEncParams);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxENC->Init failed");
-+
-+#if MFX_VERSION >= 1022
-+ if (pParams->bExtMBQP) {
-+ m_bUseQPMap = true;
-+ }
-+
-+ if (pParams->bROIasQPMAP) {
-+ mfxVideoParam enc_par;
-+ MSDK_ZERO_MEMORY(enc_par);
-+ mfxStatus sts1 = m_pmfxENC->GetVideoParam(&enc_par);
-+ MSDK_CHECK_STATUS(sts1, "m_pmfxENC->GetVideoParam failed");
-+
-+ if (enc_par.mfx.GopRefDist != 1) {
-+ printf(
-+ "INFO: Sample implementation of ROI through MBQP map require B-frames to be disabled.\n");
-+ m_bUseQPMap = false;
-+ }
-+ else if (enc_par.mfx.RateControlMethod != MFX_RATECONTROL_CQP) {
-+ printf("INFO: MBQP map require ConstQP mode to operate.\n");
-+ m_bUseQPMap = false;
-+ }
-+ else {
-+ m_GOPSize = (enc_par.mfx.GopPicSize) ? enc_par.mfx.GopPicSize : 1;
-+ m_QPforI = enc_par.mfx.QPI;
-+ m_QPforP = enc_par.mfx.QPP;
-+ m_bUseQPMap = true;
-+ }
-+ }
-+#endif //MFX_VERSION >= 1022
-+ }
-+
-+ // Dumping components configuration if required
-+ if (m_strMfxParamsDumpFile.size()) {
-+ CParametersDumper::DumpLibraryConfiguration(m_strMfxParamsDumpFile,
-+ m_pmfxDEC.get(),
-+ m_pmfxVPP.get(),
-+ m_pmfxENC.get(),
-+ &m_mfxDecParams,
-+ &m_mfxVppParams,
-+ &m_mfxEncParams);
-+ }
-+
-+ m_bIsInit = true;
-+
-+ return sts;
-+} //mfxStatus CTranscodingPipeline::Init(sInputParams *pParams)
-+
-+mfxStatus CTranscodingPipeline::CompleteInit() {
-+ mfxStatus sts = MFX_ERR_NONE;
-+
-+ if (m_bIsInit)
-+ return MFX_ERR_NONE;
-+
-+ if (m_MemoryModel == GENERAL_ALLOC) {
-+ // need to allocate remaining frames
-+ if (m_bDecodeEnable) {
-+ sts = AllocFrames();
-+ MSDK_CHECK_STATUS(sts, "AllocFrames failed");
-+ LoadStaticSurface();
-+ MSDK_CHECK_STATUS(sts, "LoadStaticSurface failed");
-+ }
-+ }
-+
-+ // Init decode
-+ if (m_pmfxDEC.get()) {
-+ sts = m_pmfxDEC->Init(&m_mfxDecParams);
-+ if (MFX_WRN_PARTIAL_ACCELERATION == sts) {
-+ msdk_printf(MSDK_STRING("WARNING: partial acceleration\n"));
-+ MSDK_IGNORE_MFX_STS(sts, MFX_WRN_PARTIAL_ACCELERATION);
-+ }
-+ MSDK_CHECK_STATUS(sts, "m_pmfxDEC->Init failed");
-+ }
-+
-+ // Init vpp
-+ if (m_pmfxVPP.get()) {
-+ if (m_bIsPlugin && m_bIsVpp)
-+ sts = m_pmfxVPP->InitMulti(&m_mfxPluginParams, &m_mfxVppParams);
-+ else if (m_bIsPlugin)
-+ sts = m_pmfxVPP->Init(&m_mfxPluginParams);
-+ else
-+ sts = m_pmfxVPP->Init(&m_mfxVppParams);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxVPP->Init failed");
-+ }
-+
-+#if !defined(MFX_ONEVPL)
-+ // Pre init encode
-+ if (m_pmfxPreENC.get()) {
-+ sts = m_pmfxPreENC->Init(&m_mfxPreEncParams);
-+ if (MFX_WRN_PARTIAL_ACCELERATION == sts) {
-+ msdk_printf(MSDK_STRING("WARNING: partial acceleration\n"));
-+ MSDK_IGNORE_MFX_STS(sts, MFX_WRN_PARTIAL_ACCELERATION);
-+ }
-+ MSDK_CHECK_STATUS(sts, "m_pmfxPreENC->Init failed");
-+ }
-+#endif //!MFX_ONEVPL
-+
-+ // Init encode
-+ if (m_pmfxENC.get()) {
-+ sts = m_pmfxENC->Init(&m_mfxEncParams);
-+ if (MFX_WRN_PARTIAL_ACCELERATION == sts) {
-+ msdk_printf(MSDK_STRING("WARNING: partial acceleration\n"));
-+ MSDK_IGNORE_MFX_STS(sts, MFX_WRN_PARTIAL_ACCELERATION);
-+ }
-+ MSDK_CHECK_STATUS(sts, "m_pmfxENC->Init failed");
-+ }
-+
-+ m_bIsInit = true;
-+
-+ return sts;
-+} // mfxStatus CTranscodingPipeline::CompleteInit()
-+mfxFrameSurface1 *CTranscodingPipeline::GetFreeSurface(bool isDec, mfxU64 timeout) {
-+ mfxFrameSurface1 *pSurf = NULL;
-+
-+ CTimer t;
-+ t.Start();
-+ do {
-+ {
-+ std::lock_guard<std::mutex> lock(m_mStopSession);
-+ if (m_bForceStop) {
-+ msdk_printf(MSDK_STRING(
-+ "WARNING: m_bForceStop is set, returning NULL ptr from GetFreeSurface\n"));
-+ break;
-+ }
-+ }
-+
-+ SurfPointersArray &workArray = isDec ? m_pSurfaceDecPool : m_pSurfaceEncPool;
-+
-+ for (mfxU32 i = 0; i < workArray.size(); i++) {
-+ if (!workArray[i]->Data.Locked) {
-+ pSurf = workArray[i];
-+ break;
-+ }
-+ }
-+ if (pSurf) {
-+ break;
-+ }
-+ else {
-+ MSDK_SLEEP(TIME_TO_SLEEP);
-+ }
-+ } while (t.GetTime() < timeout / 1000);
-+
-+ return pSurf;
-+} // mfxFrameSurface1* CTranscodingPipeline::GetFreeSurface(bool isDec)
-+
-+mfxU32 CTranscodingPipeline::GetFreeSurfacesCount(bool isDec) {
-+ SurfPointersArray &workArray = isDec ? m_pSurfaceDecPool : m_pSurfaceEncPool;
-+ mfxU32 count = 0;
-+ for (mfxU32 i = 0; i < workArray.size(); i++) {
-+ if (!workArray[i]->Data.Locked) {
-+ count++;
-+ }
-+ }
-+ return count;
-+}
-+
-+PreEncAuxBuffer *CTranscodingPipeline::GetFreePreEncAuxBuffer() {
-+ for (mfxU32 i = 0; i < m_pPreEncAuxPool.size(); i++) {
-+ if (!m_pPreEncAuxPool[i].Locked)
-+ return &(m_pPreEncAuxPool[i]);
-+ }
-+ return NULL;
-+}
-+
-+void CTranscodingPipeline::LockPreEncAuxBuffer(PreEncAuxBuffer *pBuff) {
-+ if (!pBuff)
-+ return;
-+ for (mfxU32 i = 0; i < m_numEncoders; i++) {
-+ msdk_atomic_inc16(&pBuff->Locked);
-+ }
-+}
-+
-+void CTranscodingPipeline::UnPreEncAuxBuffer(PreEncAuxBuffer *pBuff) {
-+ if (!pBuff)
-+ return;
-+ msdk_atomic_dec16(&pBuff->Locked);
-+}
-+
-+mfxU32 CTranscodingPipeline::GetNumFramesForReset() {
-+ std::lock_guard<std::mutex> guard(m_mReset);
-+ return m_NumFramesForReset;
-+}
-+
-+void CTranscodingPipeline::SetNumFramesForReset(mfxU32 nFrames) {
-+ std::lock_guard<std::mutex> guard(m_mReset);
-+ m_NumFramesForReset = nFrames;
-+}
-+
-+void CTranscodingPipeline::HandlePossibleGpuHang(mfxStatus &sts) {
-+ if (sts == MFX_ERR_GPU_HANG && m_bSoftGpuHangRecovery) {
-+ msdk_printf(MSDK_STRING(
-+ "[WARNING] GPU hang happened. Inserting an IDR and continuing transcoding.\n"));
-+ m_bInsertIDR = true;
-+ for (BSList::iterator it = m_BSPool.begin(); it != m_BSPool.end(); it++) {
-+ (*it)->IsFree = true;
-+ (*it)->Bitstream.DataOffset = 0;
-+ (*it)->Bitstream.DataLength = 0;
-+ }
-+ m_BSPool.clear();
-+ sts = MFX_ERR_NONE;
-+ }
-+}
-+
-+mfxStatus CTranscodingPipeline::SetAllocatorAndHandleIfRequired() {
-+ mfxStatus sts = MFX_ERR_NONE;
-+ mfxIMPL impl = 0;
-+ m_pmfxSession->QueryIMPL(&impl);
-+
-+ bool bIsMustSetExternalHandle = false;
-+ mfxHandleType handleType = (mfxHandleType)0;
-+
-+ if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(impl)) {
-+ handleType = MFX_HANDLE_D3D11_DEVICE;
-+ bIsMustSetExternalHandle = false;
-+ }
-+ else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(impl)) {
-+ handleType = MFX_HANDLE_D3D9_DEVICE_MANAGER;
-+ bIsMustSetExternalHandle = false;
-+ }
-+#ifdef LIBVA_SUPPORT
-+ else if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(impl)) {
-+ handleType = MFX_HANDLE_VA_DISPLAY;
-+ bIsMustSetExternalHandle = true;
-+ }
-+#endif
-+
-+ bool ext_allocator_exists = m_MemoryModel == GENERAL_ALLOC;
-+ if (m_hdl && (bIsMustSetExternalHandle || (m_bIsInterOrJoined || ext_allocator_exists))) {
-+ sts = m_pmfxSession->SetHandle(handleType, m_hdl);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxSession->SetHandle failed");
-+ }
-+
-+ if (ext_allocator_exists) {
-+ sts = m_pmfxSession->SetFrameAllocator(m_pMFXAllocator);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxSession->SetFrameAllocator failed");
-+ }
-+
-+ return sts;
-+}
-+
-+#if !defined(MFX_ONEVPL)
-+mfxStatus CTranscodingPipeline::LoadGenericPlugin() {
-+ mfxStatus sts = MFX_ERR_NONE;
-+
-+ std::unique_ptr<MFXVideoVPPPlugin> pVPPPlugin(new MFXVideoVPPPlugin(*m_pmfxSession.get()));
-+ MSDK_CHECK_POINTER(pVPPPlugin.get(), MFX_ERR_NULL_PTR);
-+
-+ sts = pVPPPlugin->LoadDLL((msdk_char *)m_sGenericPluginPath.c_str());
-+ MSDK_CHECK_STATUS(sts, "pVPPPlugin->LoadDLL failed");
-+
-+ m_RotateParam.Angle = m_nRotationAngle;
-+ sts = pVPPPlugin->SetAuxParam(&m_RotateParam, sizeof(m_RotateParam));
-+ MSDK_CHECK_STATUS(sts, "pVPPPlugin->SetAuxParam failed");
-+
-+ sts = pVPPPlugin->SetFrameAllocator(m_pMFXAllocator);
-+ MSDK_CHECK_STATUS(sts, "pVPPPlugin->SetFrameAllocator failed");
-+
-+ m_pmfxVPP.reset(pVPPPlugin.release());
-+ return MFX_ERR_NONE;
-+}
-+#endif //!MFX_ONEVPL
-+
-+size_t CTranscodingPipeline::GetRobustFlag() {
-+ return m_bRobustFlag;
-+}
-+
-+void CTranscodingPipeline::Close() {
-+ m_pmfxDEC.reset();
-+
-+ m_pmfxENC.reset();
-+
-+ m_pmfxVPP.reset();
-+
-+ m_pmfxSession.reset();
-+
-+#if !defined(MFX_ONEVPL)
-+ if (m_pUserDecoderPlugin.get())
-+ m_pUserDecoderPlugin.reset();
-+
-+ if (m_pUserEncoderPlugin.get())
-+ m_pUserEncoderPlugin.reset();
-+
-+ if (m_pUserEncPlugin.get())
-+ m_pUserEncPlugin.reset();
-+#endif //!MFX_ONEVPL
-+
-+ FreeVppDoNotUse();
-+#if !defined(MFX_ONEVPL)
-+ FreeMVCSeqDesc();
-+ FreePreEncAuxPool();
-+
-+ mfxExtVPPComposite *vppCompPar = m_mfxVppParams;
-+ if (vppCompPar && vppCompPar->InputStream)
-+ free(vppCompPar->InputStream);
-+#endif
-+
-+ if (m_bIsJoinSession) {
-+ //m_pmfxSession->DisjoinSession();
-+ m_bIsJoinSession = false;
-+ }
-+
-+ //Destroy renderer
-+#if defined(_WIN32) || defined(_WIN64)
-+ if (m_hwdev4Rendering) {
-+ delete m_hwdev4Rendering;
-+ m_hwdev4Rendering = NULL;
-+ }
-+#endif
-+
-+ // free allocated surfaces AFTER closing components
-+ FreeFrames();
-+
-+ m_bIsInit = false;
-+
-+} // void CTranscodingPipeline::Close()
-+
-+mfxStatus CTranscodingPipeline::Reset(VPLImplementationLoader *mfxLoader) {
-+ mfxStatus sts = MFX_ERR_NONE;
-+ bool isDec = m_pmfxDEC.get() ? true : false, isEnc = m_pmfxENC.get() ? true : false,
-+ isVPP = m_pmfxVPP.get() ? true : false, isGenericPLugin = m_nRotationAngle ? true : false
-+#if !defined(MFX_ONEVPL)
-+ ,
-+ isPreEnc = m_pmfxPreENC.get() ? true : false,
-+ isDecoderPlugin = m_pUserDecoderPlugin.get() ? true : false,
-+ isEncoderPlugin = m_pUserEncoderPlugin.get() ? true : false,
-+ isPreEncPlugin = m_pUserEncPlugin.get() ? true : false
-+#endif //!MFX_ONEVPL
-+ ;
-+
-+ // Close components being used
-+ if (isDec) {
-+ m_pmfxDEC->Close();
-+ m_pmfxDEC.reset();
-+ }
-+
-+ if (isVPP) {
-+ m_pmfxVPP->Close();
-+ m_pmfxVPP.reset();
-+ }
-+
-+ if (isEnc) {
-+ m_pmfxENC->Close();
-+ m_pmfxENC.reset();
-+ }
-+
-+#if !defined(MFX_ONEVPL)
-+ if (isPreEnc) {
-+ m_pmfxPreENC->Close();
-+ m_pmfxPreENC.reset();
-+ }
-+
-+ if (isDecoderPlugin) {
-+ m_pUserDecoderPlugin.reset();
-+ m_pUserDecoderModule.reset();
-+ }
-+
-+ if (isEncoderPlugin) {
-+ m_pUserEncoderPlugin.reset();
-+ m_pUserEncoderModule.reset();
-+ }
-+#endif //!MFX_ONEVPL
-+
-+ m_pmfxSession->Close();
-+
-+ m_pmfxSession.reset(new MainVideoSession());
-+
-+ sts = m_pmfxSession->CreateSession(mfxLoader);
-+ MSDK_CHECK_STATUS(sts, "CreateSession failed");
-+
-+ // Release dec and enc surface pools
-+ for (size_t i = 0; i < m_pSurfaceDecPool.size(); i++) {
-+ m_pSurfaceDecPool[i]->Data.Locked = 0;
-+ }
-+ for (size_t i = 0; i < m_pSurfaceEncPool.size(); i++) {
-+ m_pSurfaceEncPool[i]->Data.Locked = 0;
-+ }
-+
-+ // Release all safety buffers
-+ SafetySurfaceBuffer *sptr = m_pBuffer;
-+ while (sptr) {
-+ sptr->ReleaseSurfaceAll();
-+ sptr = sptr->m_pNext;
-+ }
-+
-+ // Release output bitstram pools
-+ m_BSPool.clear();
-+ m_pBSStore->ReleaseAll();
-+ m_pBSStore->FlushAll();
-+
-+#if !defined(MFX_ONEVPL)
-+ // Load external decoder plugin
-+ if (isDecoderPlugin) {
-+ if (m_decoderPluginParams.type == MFX_PLUGINLOAD_TYPE_FILE &&
-+ msdk_strnlen(m_decoderPluginParams.strPluginPath,
-+ sizeof(m_decoderPluginParams.strPluginPath))) {
-+ m_pUserDecoderModule.reset(new MFXVideoUSER(*m_pmfxSession.get()));
-+ m_pUserDecoderPlugin.reset(
-+ LoadPlugin(MFX_PLUGINTYPE_VIDEO_DECODE,
-+ *m_pmfxSession.get(),
-+ m_decoderPluginParams.pluginGuid,
-+ 1,
-+ m_decoderPluginParams.strPluginPath,
-+ (mfxU32)msdk_strnlen(m_decoderPluginParams.strPluginPath,
-+ sizeof(m_decoderPluginParams.strPluginPath))));
-+ if (m_pUserDecoderPlugin.get() == NULL)
-+ sts = MFX_ERR_UNSUPPORTED;
-+ }
-+ else {
-+ if (AreGuidsEqual(m_decoderPluginParams.pluginGuid, MSDK_PLUGINGUID_NULL)) {
-+ m_decoderPluginParams.pluginGuid = msdkGetPluginUID(m_initPar.Implementation,
-+ MSDK_VDECODE,
-+ m_mfxDecParams.mfx.CodecId);
-+ }
-+ if (!AreGuidsEqual(m_decoderPluginParams.pluginGuid, MSDK_PLUGINGUID_NULL)) {
-+ m_pUserDecoderPlugin.reset(LoadPlugin(MFX_PLUGINTYPE_VIDEO_DECODE,
-+ *m_pmfxSession.get(),
-+ m_decoderPluginParams.pluginGuid,
-+ 1));
-+ if (m_pUserDecoderPlugin.get() == NULL)
-+ sts = MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ MSDK_CHECK_STATUS(sts, "LoadPlugin failed");
-+ }
-+
-+ // Load external encoder plugin
-+ if (isEncoderPlugin) {
-+ if (m_encoderPluginParams.type == MFX_PLUGINLOAD_TYPE_FILE &&
-+ msdk_strnlen(m_encoderPluginParams.strPluginPath,
-+ sizeof(m_encoderPluginParams.strPluginPath))) {
-+ m_pUserEncoderModule.reset(new MFXVideoUSER(*m_pmfxSession.get()));
-+ m_pUserEncoderPlugin.reset(
-+ LoadPlugin(MFX_PLUGINTYPE_VIDEO_ENCODE,
-+ *m_pmfxSession.get(),
-+ m_encoderPluginParams.pluginGuid,
-+ 1,
-+ m_encoderPluginParams.strPluginPath,
-+ (mfxU32)msdk_strnlen(m_encoderPluginParams.strPluginPath,
-+ sizeof(m_encoderPluginParams.strPluginPath))));
-+ if (m_pUserEncoderPlugin.get() == NULL)
-+ sts = MFX_ERR_UNSUPPORTED;
-+ }
-+ else {
-+ if (AreGuidsEqual(m_encoderPluginParams.pluginGuid, MSDK_PLUGINGUID_NULL)) {
-+ m_decoderPluginParams.pluginGuid = msdkGetPluginUID(m_initPar.Implementation,
-+ MSDK_VENCODE,
-+ m_mfxEncParams.mfx.CodecId);
-+ }
-+ if (!AreGuidsEqual(m_encoderPluginParams.pluginGuid, MSDK_PLUGINGUID_NULL)) {
-+ m_pUserEncoderPlugin.reset(LoadPlugin(MFX_PLUGINTYPE_VIDEO_ENCODE,
-+ *m_pmfxSession.get(),
-+ m_encoderPluginParams.pluginGuid,
-+ 1));
-+ if (m_pUserEncoderPlugin.get() == NULL)
-+ sts = MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ MSDK_CHECK_STATUS(sts, "LoadPlugin failed");
-+ }
-+
-+ // Load external pre-enc plugin
-+ if (isPreEncPlugin) {
-+ m_pUserEncPlugin.reset(LoadPlugin(MFX_PLUGINTYPE_VIDEO_ENCODE,
-+ *m_pmfxSession.get(),
-+ MFX_PLUGINID_H264LA_HW,
-+ 1));
-+ if (m_pUserEncPlugin.get() == NULL)
-+ sts = MFX_ERR_UNSUPPORTED;
-+ MSDK_CHECK_STATUS(sts, "LoadPlugin failed");
-+ }
-+#endif //!MFX_ONEVPL
-+
-+ sts = SetAllocatorAndHandleIfRequired();
-+ MSDK_CHECK_STATUS(sts, "SetAllocatorAndHandleIfRequired failed");
-+
-+ if (isDec)
-+ m_pmfxDEC.reset(new MFXVideoDECODE((mfxSession)*m_pmfxSession));
-+ if (isVPP)
-+ m_pmfxVPP.reset(new MFXVideoMultiVPP((mfxSession)*m_pmfxSession));
-+#if !defined(MFX_ONEVPL)
-+ if (isPreEnc)
-+ m_pmfxPreENC.reset(new MFXVideoENC((mfxSession)*m_pmfxSession));
-+#endif //!MFX_ONEVPL
-+
-+ if (isEnc)
-+ m_pmfxENC.reset(new MFXVideoENCODE((mfxSession)*m_pmfxSession));
-+
-+ if (isDec) {
-+ sts = m_pmfxDEC->Init(&m_mfxDecParams);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxDEC->Init failed");
-+ }
-+
-+#if !defined(MFX_ONEVPL)
-+ if (isGenericPLugin) {
-+ sts = LoadGenericPlugin();
-+ MSDK_CHECK_STATUS(sts, "LoadGenericPlugin failed");
-+ }
-+#endif //!MFX_ONEVPL
-+
-+ if (isVPP) {
-+ if (m_bIsPlugin && m_bIsVpp) {
-+ mfxFrameAllocRequest request[2] = {};
-+ sts = m_pmfxVPP->QueryIOSurfMulti(&m_mfxPluginParams, request, &m_mfxVppParams);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxVPP->QueryIOSurf failed");
-+
-+ sts = m_pmfxVPP->InitMulti(&m_mfxPluginParams, &m_mfxVppParams);
-+ }
-+ else if (m_bIsPlugin)
-+ sts = m_pmfxVPP->Init(&m_mfxPluginParams);
-+ else
-+ sts = m_pmfxVPP->Init(&m_mfxVppParams);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxVPP->Init failed");
-+ }
-+
-+#if !defined(MFX_ONEVPL)
-+ if (isPreEnc) {
-+ sts = m_pmfxPreENC->Init(&m_mfxPreEncParams);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxPreENC->Init failed");
-+ }
-+#endif //!MFX_ONEVPL
-+
-+ if (isEnc) {
-+ sts = m_pmfxENC->Init(&m_mfxEncParams);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxENC->Init failed");
-+ }
-+
-+ // Joining sessions if required
-+ if (m_bIsJoinSession && m_pParentPipeline) {
-+ sts = m_pParentPipeline->Join(m_pmfxSession.get());
-+ MSDK_CHECK_STATUS(sts, "m_pParentPipeline->Join failed");
-+ m_bIsJoinSession = true;
-+ }
-+ return sts;
-+}
-+
-+mfxStatus CTranscodingPipeline::AllocAndInitVppDoNotUse(sInputParams *pInParams) {
-+ std::vector<mfxU32> filtersDisabled;
-+ if (pInParams->DenoiseLevel == -1) {
-+ filtersDisabled.push_back(MFX_EXTBUFF_VPP_DENOISE); // turn off denoising (on by default)
-+ }
-+ filtersDisabled.push_back(
-+ MFX_EXTBUFF_VPP_SCENE_ANALYSIS); // turn off scene analysis (on by default)
-+
-+ if (filtersDisabled.size()) {
-+ auto doNotUse = m_mfxVppParams.AddExtBuffer<mfxExtVPPDoNotUse>();
-+ delete[] doNotUse->AlgList;
-+
-+ doNotUse->NumAlg = (mfxU32)filtersDisabled.size();
-+ doNotUse->AlgList = new mfxU32[doNotUse->NumAlg];
-+ MSDK_MEMCPY(doNotUse->AlgList,
-+ filtersDisabled.data(),
-+ sizeof(mfxU32) * filtersDisabled.size());
-+ }
-+
-+ return MFX_ERR_NONE;
-+} // CTranscodingPipeline::AllocAndInitVppDoNotUse()
-+
-+void CTranscodingPipeline::FreeVppDoNotUse() {
-+#if 0
-+ mfxExtVPPDoNotUse* doNotUse = m_mfxVppParams;
-+ if (doNotUse)
-+ MSDK_SAFE_DELETE_ARRAY(doNotUse->AlgList);
-+#endif
-+}
-+
-+mfxStatus CTranscodingPipeline::AllocateSufficientBuffer(mfxBitstreamWrapper *pBS) {
-+ MSDK_CHECK_POINTER(pBS, MFX_ERR_NULL_PTR);
-+
-+ mfxVideoParam par;
-+ MSDK_ZERO_MEMORY(par);
-+
-+ // find out the required buffer size
-+ mfxStatus sts = m_pmfxENC->GetVideoParam(&par);
-+ MSDK_CHECK_STATUS(sts, "m_pmfxENC->GetVideoParam failed");
-+
-+ mfxU32 new_size = 0;
-+
-+ // if encoder provided us information about buffer size
-+ if (0 != par.mfx.BufferSizeInKB) {
-+ //--- If value calculated basing on par.mfx.BufferSizeInKB is too low, just double the buffer size
-+ new_size = par.mfx.BufferSizeInKB * 1000u > pBS->MaxLength ? par.mfx.BufferSizeInKB * 1000u
-+ : pBS->MaxLength * 2;
-+ }
-+ else {
-+ // trying to guess the size (e.g. for JPEG encoder)
-+ new_size = (0 == pBS->MaxLength)
-+ // some heuristic init value
-+ ? 4 + (par.mfx.FrameInfo.Width * par.mfx.FrameInfo.Height * 3 + 1023)
-+ // double existing size
-+ : 2 * pBS->MaxLength;
-+ }
-+
-+ pBS->Extend(new_size);
-+
-+ return MFX_ERR_NONE;
-+} // CTranscodingPipeline::AllocateSufficientBuffer(mfxBitstreamWrapper* pBS)
-+
-+mfxStatus CTranscodingPipeline::Join(MFXVideoSession *pChildSession) {
-+ mfxStatus sts = MFX_ERR_NONE;
-+ MSDK_CHECK_POINTER(pChildSession, MFX_ERR_NULL_PTR);
-+ sts = m_pmfxSession->JoinSession(*pChildSession);
-+ m_bIsJoinSession = (MFX_ERR_NONE == sts);
-+ return sts;
-+} // CTranscodingPipeline::Join(MFXVideoSession *pChildSession)
-+
-+mfxStatus CTranscodingPipeline::Run() {
-+ mfxStatus sts = MFX_ERR_NONE;
-+
-+ msdk_stringstream ss;
-+ if (m_bDecodeEnable && m_bEncodeEnable) {
-+ sts = Transcode();
-+ ss << MSDK_STRING("CTranscodingPipeline::Run::Transcode() [") << GetSessionText()
-+ << MSDK_STRING("] failed");
-+ MSDK_CHECK_STATUS(sts, ss.str());
-+ }
-+ else if (m_bDecodeEnable) {
-+ sts = Decode();
-+ ss << MSDK_STRING("CTranscodingPipeline::Run::Decode() [") << GetSessionText()
-+ << MSDK_STRING("] failed");
-+ MSDK_CHECK_STATUS(sts, ss.str());
-+ }
-+ else if (m_bEncodeEnable) {
-+ sts = Encode();
-+ ss << MSDK_STRING("CTranscodingPipeline::Run::Encode() [") << GetSessionText()
-+ << MSDK_STRING("] failed");
-+ MSDK_CHECK_STATUS(sts, ss.str());
-+ }
-+ else
-+ return MFX_ERR_UNSUPPORTED;
-+
-+ return sts;
-+}
-+
-+void IncreaseReference(mfxFrameSurface1 &surf) {
-+ msdk_atomic_inc16((volatile mfxU16 *)(&surf.Data.Locked));
-+#if defined(MFX_ONEVPL)
-+ if (surf.FrameInterface) {
-+ std::ignore = surf.FrameInterface->AddRef(&surf);
-+ }
-+#endif
-+}
-+
-+void DecreaseReference(mfxFrameSurface1 &surf) {
-+ msdk_atomic_dec16((volatile mfxU16 *)&surf.Data.Locked);
-+#if defined(MFX_ONEVPL)
-+ if (surf.FrameInterface) {
-+ std::ignore = surf.FrameInterface->Release(&surf);
-+ }
-+#endif
-+}
-+
-+SafetySurfaceBuffer::SafetySurfaceBuffer(SafetySurfaceBuffer *pNext)
-+ : m_pNext(pNext),
-+ m_IsBufferingAllowed(true),
-+ pInsEvent(nullptr) {
-+ mfxStatus sts = MFX_ERR_NONE;
-+ pRelEvent = new MSDKEvent(sts, false, false);
-+ MSDK_CHECK_POINTER_NO_RET(pRelEvent);
-+
-+ pInsEvent = new MSDKEvent(sts, false, false);
-+ MSDK_CHECK_POINTER_NO_RET(pInsEvent);
-+
-+} // SafetySurfaceBuffer::SafetySurfaceBuffer
-+
-+SafetySurfaceBuffer::~SafetySurfaceBuffer() {
-+ delete pRelEvent;
-+ delete pInsEvent;
-+} //SafetySurfaceBuffer::~SafetySurfaceBuffer()
-+
-+mfxU32 SafetySurfaceBuffer::GetLength() {
-+ std::lock_guard<std::mutex> guard(m_mutex);
-+ return (mfxU32)m_SList.size();
-+}
-+
-+mfxStatus SafetySurfaceBuffer::WaitForSurfaceRelease(mfxU32 msec) {
-+ return pRelEvent->TimedWait(msec);
-+}
-+
-+mfxStatus SafetySurfaceBuffer::WaitForSurfaceInsertion(mfxU32 msec) {
-+ return pInsEvent->TimedWait(msec);
-+}
-+
-+void SafetySurfaceBuffer::AddSurface(ExtendedSurface Surf) {
-+ bool isBufferingAllowed = false;
-+
-+ {
-+ std::lock_guard<std::mutex> guard(m_mutex);
-+
-+ isBufferingAllowed = m_IsBufferingAllowed;
-+ if (isBufferingAllowed) {
-+ SurfaceDescriptor sDescriptor;
-+ // Locked is used to signal when we can free surface
-+ sDescriptor.Locked = 1;
-+ sDescriptor.ExtSurface = Surf;
-+
-+ if (Surf.pSurface) {
-+ IncreaseReference(*Surf.pSurface);
-+ }
-+
-+ m_SList.push_back(sDescriptor);
-+ }
-+ }
-+
-+ if (isBufferingAllowed) {
-+ pInsEvent->Signal();
-+ }
-+
-+} // SafetySurfaceBuffer::AddSurface(mfxFrameSurface1 *pSurf)
-+
-+mfxStatus SafetySurfaceBuffer::GetSurface(ExtendedSurface &Surf) {
-+ std::lock_guard<std::mutex> guard(m_mutex);
-+
-+ // no ready surfaces
-+ if (0 == m_SList.size()) {
-+ MSDK_ZERO_MEMORY(Surf)
-+ return MFX_ERR_MORE_SURFACE;
-+ }
-+
-+ SurfaceDescriptor sDescriptor = m_SList.front();
-+
-+ Surf = sDescriptor.ExtSurface;
-+
-+ return MFX_ERR_NONE;
-+
-+} // SafetySurfaceBuffer::GetSurface()
-+
-+mfxStatus SafetySurfaceBuffer::ReleaseSurface(mfxFrameSurface1 *pSurf) {
-+ std::unique_lock<std::mutex> lock(m_mutex);
-+
-+ std::list<SurfaceDescriptor>::iterator it;
-+ for (it = m_SList.begin(); it != m_SList.end(); it++) {
-+ if (pSurf == it->ExtSurface.pSurface) {
-+ it->Locked--;
-+ if (it->ExtSurface.pSurface)
-+ DecreaseReference(*it->ExtSurface.pSurface);
-+ if (0 == it->Locked) {
-+ m_SList.erase(it);
-+ lock.unlock();
-+
-+ // event operation should be out of synced context
-+ pRelEvent->Signal();
-+ }
-+
-+ return MFX_ERR_NONE;
-+ }
-+ }
-+
-+ return MFX_ERR_UNKNOWN;
-+} // mfxStatus SafetySurfaceBuffer::ReleaseSurface(mfxFrameSurface1* pSurf)
-+
-+mfxStatus SafetySurfaceBuffer::ReleaseSurfaceAll() {
-+ std::lock_guard<std::mutex> guard(m_mutex);
-+
-+ m_SList.clear();
-+ m_IsBufferingAllowed = true;
-+ return MFX_ERR_NONE;
-+
-+} // mfxStatus SafetySurfaceBuffer::ReleaseSurface(mfxFrameSurface1* pSurf)
-+
-+void SafetySurfaceBuffer::CancelBuffering() {
-+ std::lock_guard<std::mutex> guard(m_mutex);
-+ m_IsBufferingAllowed = false;
-+}
-+
-+FileBitstreamProcessor::FileBitstreamProcessor() {
-+ m_Bitstream.TimeStamp = (mfxU64)-1;
-+}
-+
-+FileBitstreamProcessor::~FileBitstreamProcessor() {
-+ if (m_pFileReader.get())
-+ m_pFileReader->Close();
-+ if (m_pFileWriter.get())
-+ m_pFileWriter->Close();
-+}
-+
-+mfxStatus FileBitstreamProcessor::SetReader(std::unique_ptr<CSmplYUVReader> &reader) {
-+ m_pYUVFileReader = std::move(reader);
-+
-+ return MFX_ERR_NONE;
-+}
-+
-+mfxStatus FileBitstreamProcessor::SetReader(std::unique_ptr<CSmplBitstreamReader> &reader) {
-+ m_pFileReader = std::move(reader);
-+ m_Bitstream.Extend(1024 * 1024);
-+
-+ return MFX_ERR_NONE;
-+}
-+
-+mfxStatus FileBitstreamProcessor::SetWriter(std::unique_ptr<CSmplBitstreamWriter> &writer) {
-+ m_pFileWriter = std::move(writer);
-+
-+ return MFX_ERR_NONE;
-+}
-+
-+mfxStatus FileBitstreamProcessor::GetInputBitstream(mfxBitstreamWrapper **pBitstream) {
-+ if (!m_pFileReader.get()) {
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ mfxStatus sts = m_pFileReader->ReadNextFrame(&m_Bitstream);
-+ if (MFX_ERR_NONE == sts) {
-+ *pBitstream = &m_Bitstream;
-+ return sts;
-+ }
-+ return sts;
-+}
-+
-+mfxStatus FileBitstreamProcessor::GetInputFrame(mfxFrameSurface1 *pSurface) {
-+ //MSDK_CHECK_POINTER(pSurface);
-+ if (!m_pYUVFileReader.get()) {
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ return m_pYUVFileReader->LoadNextFrame(pSurface);
-+}
-+
-+mfxStatus FileBitstreamProcessor::ProcessOutputBitstream(mfxBitstreamWrapper *pBitstream) {
-+ if (m_pFileWriter.get())
-+ return m_pFileWriter->WriteNextFrame(pBitstream, false);
-+
-+ return MFX_ERR_NONE;
-+}
-+
-+mfxStatus FileBitstreamProcessor::ResetInput() {
-+ if (m_pFileReader.get()) {
-+ m_pFileReader->Reset();
-+
-+ // Reset input bitstream state
-+ m_Bitstream.DataFlag = 0;
-+ }
-+ if (m_pYUVFileReader.get()) {
-+ m_pYUVFileReader->Reset();
-+ }
-+ return MFX_ERR_NONE;
-+}
-+
-+mfxStatus FileBitstreamProcessor::ResetOutput() {
-+ if (m_pFileWriter.get()) {
-+ m_pFileWriter->Reset();
-+ }
-+ return MFX_ERR_NONE;
-+}
-+
-+void CTranscodingPipeline::ModifyParamsUsingPresets(sInputParams &params,
-+ mfxF64 fps,
-+ mfxU32 width,
-+ mfxU32 height) {
-+ COutputPresetParameters presetParams =
-+ CPresetManager::Inst.GetPreset(params.PresetMode,
-+ params.EncodeId,
-+ fps,
-+ width,
-+ height,
-+ params.libType != MFX_IMPL_SOFTWARE);
-+
-+ if (params.shouldPrintPresets) {
-+ msdk_printf(MSDK_STRING("Preset-controlled parameters (%s):\n"),
-+ presetParams.PresetName.c_str());
-+ }
-+
-+ if (!params.nRateControlMethod) {
-+ MODIFY_AND_PRINT_PARAM_EXT(params.nExtBRC,
-+ ExtBRCUsage,
-+ (ExtBRCType)presetParams.ExtBRCUsage,
-+ params.shouldPrintPresets);
-+ }
-+ if (presetParams.RateControlMethod == MFX_RATECONTROL_LA_EXT) {
-+ // Use external LA
-+ params.bEnableExtLA = true;
-+ params.nRateControlMethod = 0;
-+ if (params.shouldPrintPresets) {
-+ msdk_printf(MSDK_STRING("RateControlMethod: ExtLA\n"));
-+ }
-+ }
-+ else {
-+ MODIFY_AND_PRINT_PARAM(params.nRateControlMethod,
-+ RateControlMethod,
-+ params.shouldPrintPresets);
-+ }
-+
-+ MODIFY_AND_PRINT_PARAM(params.nAdaptiveMaxFrameSize,
-+ AdaptiveMaxFrameSize,
-+ params.shouldPrintPresets);
-+ MODIFY_AND_PRINT_PARAM(params.nAsyncDepth, AsyncDepth, params.shouldPrintPresets);
-+ MODIFY_AND_PRINT_PARAM(params.nBRefType, BRefType, params.shouldPrintPresets);
-+ MODIFY_AND_PRINT_PARAM(params.bEnableBPyramid, EnableBPyramid, params.shouldPrintPresets);
-+ // MODIFY_AND_PRINT_PARAM(params., EnablePPyramid, params.shouldPrintPresets);
-+ MODIFY_AND_PRINT_PARAM(params.GopRefDist, GopRefDist, params.shouldPrintPresets);
-+ MODIFY_AND_PRINT_PARAM(params.IntRefCycleDist, IntRefCycleDist, params.shouldPrintPresets);
-+ MODIFY_AND_PRINT_PARAM(params.IntRefCycleSize, IntRefCycleSize, params.shouldPrintPresets);
-+ MODIFY_AND_PRINT_PARAM(params.IntRefQPDelta, IntRefQPDelta, params.shouldPrintPresets);
-+ MODIFY_AND_PRINT_PARAM(params.IntRefType, IntRefType, params.shouldPrintPresets);
-+ MODIFY_AND_PRINT_PARAM(params.LowDelayBRC, LowDelayBRC, params.shouldPrintPresets);
-+ MODIFY_AND_PRINT_PARAM(params.nTargetUsage, TargetUsage, params.shouldPrintPresets);
-+ MODIFY_AND_PRINT_PARAM(params.WeightedBiPred, WeightedBiPred, params.shouldPrintPresets);
-+ MODIFY_AND_PRINT_PARAM(params.WeightedPred, WeightedPred, params.shouldPrintPresets);
-+
-+ MODIFY_AND_PRINT_PARAM(params.GopPicSize, GopPicSize, params.shouldPrintPresets);
-+
-+ if (params.nRateControlMethod != MFX_RATECONTROL_CQP) {
-+ MODIFY_AND_PRINT_PARAM(params.MaxKbps, MaxKbps, params.shouldPrintPresets);
-+ MODIFY_AND_PRINT_PARAM(params.nBitRate, TargetKbps, params.shouldPrintPresets);
-+ presetParams.BufferSizeInKB =
-+ params
-+ .nBitRate; // Update bitrate to reflect manually set bitrate. BufferSize should be enough for 1 second of video
-+ MODIFY_AND_PRINT_PARAM(params.BufferSizeInKB, BufferSizeInKB, params.shouldPrintPresets);
-+ }
-+
-+ MODIFY_AND_PRINT_PARAM(params.nMaxFrameSize, MaxFrameSize, params.shouldPrintPresets);
-+ MODIFY_AND_PRINT_PARAM(params.nLADepth, LookAheadDepth, params.shouldPrintPresets);
-+ if (params.shouldPrintPresets) {
-+ msdk_printf(MSDK_STRING("\n"));
-+ }
-+}
-diff --git a/tools/legacy/sample_multi_transcode/src/sample_multi_transcode.cpp b/tools/legacy/sample_multi_transcode/src/sample_multi_transcode.cpp
-new file mode 100644
-index 0000000..81ccb73
---- /dev/null
-+++ b/tools/legacy/sample_multi_transcode/src/sample_multi_transcode.cpp
-@@ -0,0 +1,1162 @@
-+/******************************************************************************\
-+Copyright (c) 2005-2020, Intel Corporation
-+All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-+
-+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-+
-+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-+
-+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+This sample was distributed or derived from the Intel's Media Samples package.
-+The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
-+or https://software.intel.com/en-us/media-client-solutions-support.
-+\**********************************************************************************/
-+
-+#include "mfx_samples_config.h"
-+#if defined(_WIN32) || defined(_WIN64)
-+ #include <windows.h>
-+#endif
-+
-+#include "sample_multi_transcode.h"
-+
-+#if defined(LIBVA_WAYLAND_SUPPORT)
-+ #include "class_wayland.h"
-+#endif
-+
-+#ifndef MFX_VERSION
-+ #error MFX_VERSION not defined
-+#endif
-+
-+#include <future>
-+#include <iomanip>
-+using namespace std;
-+using namespace TranscodingSample;
-+
-+#if (defined(_WIN32) || defined(_WIN64)) && (MFX_VERSION >= 1031)
-+mfxU32 GetPreferredAdapterNum(const mfxAdaptersInfo& adapters, const sInputParams& params) {
-+ if (adapters.NumActual == 0 || !adapters.Adapters)
-+ return 0;
-+
-+ if (params.bPrefferdGfx) {
-+ // Find dGfx adapter in list and return it's index
-+
-+ auto idx = std::find_if(adapters.Adapters,
-+ adapters.Adapters + adapters.NumActual,
-+ [](const mfxAdapterInfo info) {
-+ return info.Platform.MediaAdapterType ==
-+ mfxMediaAdapterType::MFX_MEDIA_DISCRETE;
-+ });
-+
-+ // No dGfx in list
-+ if (idx == adapters.Adapters + adapters.NumActual) {
-+ msdk_printf(
-+ MSDK_STRING("Warning: No dGfx detected on machine. Will pick another adapter\n"));
-+ return 0;
-+ }
-+
-+ return static_cast<mfxU32>(std::distance(adapters.Adapters, idx));
-+ }
-+
-+ if (params.bPrefferiGfx) {
-+ // Find iGfx adapter in list and return it's index
-+
-+ auto idx = std::find_if(adapters.Adapters,
-+ adapters.Adapters + adapters.NumActual,
-+ [](const mfxAdapterInfo info) {
-+ return info.Platform.MediaAdapterType ==
-+ mfxMediaAdapterType::MFX_MEDIA_INTEGRATED;
-+ });
-+
-+ // No iGfx in list
-+ if (idx == adapters.Adapters + adapters.NumActual) {
-+ msdk_printf(
-+ MSDK_STRING("Warning: No iGfx detected on machine. Will pick another adapter\n"));
-+ return 0;
-+ }
-+
-+ return static_cast<mfxU32>(std::distance(adapters.Adapters, idx));
-+ }
-+
-+ // Other ways return 0, i.e. best suitable detected by dispatcher
-+ return 0;
-+}
-+#endif
-+
-+Launcher::Launcher()
-+ : m_StartTime(0),
-+ m_eDevType(static_cast<mfxHandleType>(0)),
-+ m_accelerationMode(MFX_ACCEL_MODE_NA) {} // Launcher::Launcher()
-+
-+Launcher::~Launcher() {
-+ Close();
-+} // Launcher::~Launcher()
-+
-+CTranscodingPipeline* CreatePipeline() {
-+ MOD_SMT_CREATE_PIPELINE;
-+
-+ return new CTranscodingPipeline;
-+}
-+
-+mfxStatus Launcher::Init(int argc, msdk_char* argv[]) {
-+ mfxStatus sts;
-+ mfxU32 i = 0;
-+ SafetySurfaceBuffer* pBuffer = NULL;
-+ mfxU32 BufCounter = 0;
-+ mfxHDL hdl = NULL;
-+ std::vector<mfxHDL> hdls;
-+ sInputParams InputParams;
-+ bool bNeedToCreateDevice = true;
-+
-+ //parent transcode pipeline
-+ CTranscodingPipeline* pParentPipeline = NULL;
-+ // source transcode pipeline use instead parent in heterogeneous pipeline
-+ CTranscodingPipeline* pSinkPipeline = NULL;
-+
-+ // parse input par file
-+ sts = m_parser.ParseCmdLine(argc, argv);
-+ MSDK_CHECK_PARSE_RESULT(sts, MFX_ERR_NONE, sts);
-+ if (sts == MFX_WRN_OUT_OF_RANGE) {
-+ // There's no error in parameters parsing, but we should not continue further. For instance, in case of -? option
-+ return sts;
-+ }
-+
-+ // get parameters for each session from parser
-+ while (m_parser.GetNextSessionParams(InputParams)) {
-+ m_InputParamsArray.push_back(InputParams);
-+ }
-+
-+ // check correctness of input parameters
-+ sts = VerifyCrossSessionsOptions();
-+ MSDK_CHECK_STATUS(sts, "VerifyCrossSessionsOptions failed");
-+
-+ mfxVersion ver = { { MFX_VERSION_MINOR, MFX_VERSION_MAJOR } };
-+
-+ m_pLoader.reset(new VPLImplementationLoader);
-+ sts = m_pLoader->ConfigureAndEnumImplementations(m_InputParamsArray[0].libType,
-+ m_accelerationMode,
-+ ver);
-+ MSDK_CHECK_STATUS(sts, "pLoader->ConfigureAndEnumImplementations failed");
-+
-+#if (defined(_WIN32) || defined(_WIN64)) && (MFX_VERSION >= 1031)
-+ // check available adapters
-+ sts = QueryAdapters();
-+ MSDK_CHECK_STATUS(sts, "QueryAdapters failed");
-+
-+ if (m_eDevType && m_DisplaysData.empty()) {
-+ msdk_printf(MSDK_STRING("No adapters found. HW-accelerated transcoding is impossible.\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+#endif
-+
-+ for (i = 0; i < m_InputParamsArray.size(); i++) {
-+ /* In the case of joined sessions, need to create device only for a zero session
-+ * In the case of a shared buffer, need to create device only for decode */
-+ if ((m_InputParamsArray[i].bIsJoin && i != 0) || m_InputParamsArray[i].eMode == Source)
-+ bNeedToCreateDevice = false;
-+
-+#if defined(_WIN32) || defined(_WIN64)
-+ ForceImplForSession(i);
-+ sts = m_pLoader->EnumImplementations(m_deviceID, m_adapterNum);
-+ MSDK_CHECK_STATUS(sts, "EnumImplementations(m_deviceID, m_adapterNum) failed");
-+
-+ if (m_eDevType == MFX_HANDLE_D3D9_DEVICE_MANAGER) {
-+ if (bNeedToCreateDevice) {
-+ mfxAllocatorParams* pAllocParam(new D3DAllocatorParams());
-+ D3DAllocatorParams* pD3DParams = dynamic_cast<D3DAllocatorParams*>(pAllocParam);
-+ std::unique_ptr<CHWDevice> hwdev(new CD3D9Device());
-+
-+ /* The last param set in vector always describe VPP+ENCODE or Only VPP
-+ * So, if we want to do rendering we need to do pass HWDev to CTranscodingPipeline */
-+ if (m_InputParamsArray[m_InputParamsArray.size() - 1].eModeExt == VppCompOnly) {
-+ /* Rendering case */
-+ //sts = hwdev->Init(NULL, 1, MSDKAdapter::GetNumber(0, m_pLoader.get()));
-+ sts = hwdev->Init(NULL, 1, 0);
-+ m_InputParamsArray[m_InputParamsArray.size() - 1].m_hwdev = hwdev.get();
-+ }
-+ else /* NO RENDERING */
-+ {
-+ //sts = hwdev->Init(NULL, 0, MSDKAdapter::GetNumber(0, m_pLoader.get()));
-+ sts = hwdev->Init(NULL, 0, 0);
-+ }
-+ MSDK_CHECK_STATUS(sts, "hwdev->Init failed");
-+ sts = hwdev->GetHandle(MFX_HANDLE_D3D9_DEVICE_MANAGER, (mfxHDL*)&hdl);
-+ MSDK_CHECK_STATUS(sts, "hwdev->GetHandle failed");
-+ // set Device Manager to external dx9 allocator
-+ pD3DParams->pManager = (IDirect3DDeviceManager9*)hdl;
-+
-+ m_pAllocParams.push_back(std::shared_ptr<mfxAllocatorParams>(pAllocParam));
-+ m_hwdevs.push_back(std::move(hwdev));
-+ hdls.push_back(hdl);
-+ }
-+ else {
-+ if (!m_pAllocParams.empty() && !hdls.empty()) {
-+ m_pAllocParams.push_back(m_pAllocParams.back());
-+ hdls.push_back(hdls.back());
-+ }
-+ else {
-+ msdk_printf(MSDK_STRING("error: failed to initialize alloc parameters\n"));
-+ return MFX_ERR_MEMORY_ALLOC;
-+ }
-+ }
-+ }
-+ #if MFX_D3D11_SUPPORT
-+ else if (m_eDevType == MFX_HANDLE_D3D11_DEVICE) {
-+ if (bNeedToCreateDevice) {
-+ mfxAllocatorParams* pAllocParam(new D3D11AllocatorParams());
-+ D3D11AllocatorParams* pD3D11Params =
-+ dynamic_cast<D3D11AllocatorParams*>(pAllocParam);
-+ std::unique_ptr<CHWDevice> hwdev(new CD3D11Device());
-+
-+ /* The last param set in vector always describe VPP+ENCODE or Only VPP
-+ * So, if we want to do rendering we need to do pass HWDev to CTranscodingPipeline */
-+ if (m_InputParamsArray[m_InputParamsArray.size() - 1].eModeExt == VppCompOnly) {
-+ /* Rendering case */
-+ //sts = hwdev->Init(NULL, 1, MSDKAdapter::GetNumber(0, m_pLoader.get()));
-+ sts = hwdev->Init(NULL, 1, 0);
-+ m_InputParamsArray[m_InputParamsArray.size() - 1].m_hwdev = hwdev.get();
-+ }
-+ else /* NO RENDERING */
-+ {
-+ //sts = hwdev->Init(NULL, 0, MSDKAdapter::GetNumber(0, m_pLoader.get()));
-+ sts = hwdev->Init(NULL, 0, 0);
-+ }
-+ MSDK_CHECK_STATUS(sts, "hwdev->Init failed");
-+ sts = hwdev->GetHandle(MFX_HANDLE_D3D11_DEVICE, (mfxHDL*)&hdl);
-+ MSDK_CHECK_STATUS(sts, "hwdev->GetHandle failed");
-+
-+ pD3D11Params->bUseSingleTexture = m_InputParamsArray[i].bSingleTexture;
-+ // set Device to external dx11 allocator
-+ pD3D11Params->pDevice = (ID3D11Device*)hdl;
-+
-+ m_pAllocParams.push_back(std::shared_ptr<mfxAllocatorParams>(pAllocParam));
-+ m_hwdevs.push_back(std::move(hwdev));
-+ hdls.push_back(hdl);
-+ }
-+ else {
-+ if (!m_pAllocParams.empty() && !hdls.empty()) {
-+ m_pAllocParams.push_back(m_pAllocParams.back());
-+ hdls.push_back(hdls.back());
-+ }
-+ else {
-+ msdk_printf(MSDK_STRING("error: failed to initialize alloc parameters\n"));
-+ return MFX_ERR_MEMORY_ALLOC;
-+ }
-+ }
-+ }
-+ #endif
-+#elif defined(LIBVA_X11_SUPPORT) || defined(LIBVA_DRM_SUPPORT) || defined(ANDROID)
-+ if (m_eDevType == MFX_HANDLE_VA_DISPLAY) {
-+ if (bNeedToCreateDevice) {
-+ mfxI32 libvaBackend = 0;
-+ mfxAllocatorParams* pAllocParam(new vaapiAllocatorParams);
-+ std::unique_ptr<CHWDevice> hwdev;
-+
-+ vaapiAllocatorParams* pVAAPIParams =
-+ dynamic_cast<vaapiAllocatorParams*>(pAllocParam);
-+ /* The last param set in vector always describe VPP+ENCODE or Only VPP
-+ * So, if we want to do rendering we need to do pass HWDev to CTranscodingPipeline */
-+ if (m_InputParamsArray[m_InputParamsArray.size() - 1].eModeExt == VppCompOnly) {
-+ sInputParams& params = m_InputParamsArray[m_InputParamsArray.size() - 1];
-+ libvaBackend = params.libvaBackend;
-+
-+ /* Rendering case */
-+ hwdev.reset(CreateVAAPIDevice(InputParams.strDevicePath, params.libvaBackend));
-+ if (!hwdev.get()) {
-+ msdk_printf(MSDK_STRING("error: failed to initialize VAAPI device\n"));
-+ return MFX_ERR_DEVICE_FAILED;
-+ }
-+ //sts = hwdev->Init(&params.monitorType, 1, MSDKAdapter::GetNumber(0, m_pLoader.get()));
-+ sts = hwdev->Init(&params.monitorType, 1, 0);
-+ #if defined(LIBVA_X11_SUPPORT) || defined(LIBVA_DRM_SUPPORT)
-+ if (params.libvaBackend == MFX_LIBVA_DRM_MODESET) {
-+ CVAAPIDeviceDRM* drmdev = dynamic_cast<CVAAPIDeviceDRM*>(hwdev.get());
-+ pVAAPIParams->m_export_mode = vaapiAllocatorParams::CUSTOM_FLINK;
-+ pVAAPIParams->m_exporter =
-+ dynamic_cast<vaapiAllocatorParams::Exporter*>(drmdev->getRenderer());
-+ }
-+ else if (params.libvaBackend == MFX_LIBVA_X11) {
-+ pVAAPIParams->m_export_mode = vaapiAllocatorParams::PRIME;
-+ }
-+ #endif
-+ #if defined(LIBVA_WAYLAND_SUPPORT)
-+ else if (params.libvaBackend == MFX_LIBVA_WAYLAND) {
-+ VADisplay va_dpy = NULL;
-+ sts = hwdev->GetHandle(MFX_HANDLE_VA_DISPLAY, (mfxHDL*)&va_dpy);
-+ MSDK_CHECK_STATUS(sts, "hwdev->GetHandle failed");
-+ hdl = pVAAPIParams->m_dpy = (VADisplay)va_dpy;
-+
-+ CVAAPIDeviceWayland* w_dev =
-+ dynamic_cast<CVAAPIDeviceWayland*>(hwdev.get());
-+ if (!w_dev) {
-+ MSDK_CHECK_STATUS(MFX_ERR_DEVICE_FAILED,
-+ "Failed to reach Wayland VAAPI device");
-+ }
-+ Wayland* wld = w_dev->GetWaylandHandle();
-+ if (!wld) {
-+ MSDK_CHECK_STATUS(MFX_ERR_DEVICE_FAILED,
-+ "Failed to reach Wayland VAAPI device");
-+ }
-+
-+ wld->SetRenderWinPos(params.nRenderWinX, params.nRenderWinY);
-+ wld->SetPerfMode(params.bPerfMode);
-+
-+ pVAAPIParams->m_export_mode = vaapiAllocatorParams::PRIME;
-+ }
-+ #endif // LIBVA_WAYLAND_SUPPORT
-+ params.m_hwdev = hwdev.get();
-+ }
-+ else /* NO RENDERING*/
-+ {
-+ hwdev.reset(CreateVAAPIDevice(InputParams.strDevicePath));
-+
-+ if (!hwdev.get()) {
-+ msdk_printf(MSDK_STRING("error: failed to initialize VAAPI device\n"));
-+ return MFX_ERR_DEVICE_FAILED;
-+ }
-+ //sts = hwdev->Init(NULL, 0, MSDKAdapter::GetNumber(0, m_pLoader.get()));
-+ sts = hwdev->Init(NULL, 0, 0);
-+ }
-+ if (libvaBackend != MFX_LIBVA_WAYLAND) {
-+ MSDK_CHECK_STATUS(sts, "hwdev->Init failed");
-+ sts = hwdev->GetHandle(MFX_HANDLE_VA_DISPLAY, (mfxHDL*)&hdl);
-+ MSDK_CHECK_STATUS(sts, "hwdev->GetHandle failed");
-+ // set Device to external vaapi allocator
-+ pVAAPIParams->m_dpy = (VADisplay)hdl;
-+ }
-+
-+ m_pAllocParams.push_back(std::shared_ptr<mfxAllocatorParams>(pAllocParam));
-+ m_hwdevs.push_back(std::move(hwdev));
-+ hdls.push_back(hdl);
-+ }
-+ else {
-+ if (!m_pAllocParams.empty() && !hdls.empty()) {
-+ m_pAllocParams.push_back(m_pAllocParams.back());
-+ hdls.push_back(hdls.back());
-+ }
-+ else {
-+ msdk_printf(MSDK_STRING("error: failed to initialize alloc parameters\n"));
-+ return MFX_ERR_MEMORY_ALLOC;
-+ }
-+ }
-+ }
-+#endif
-+ }
-+ if (m_pAllocParams.empty()) {
-+ m_pAllocParams.push_back(std::shared_ptr<mfxAllocatorParams>(new SysMemAllocatorParams));
-+ hdls.push_back(NULL);
-+
-+ for (i = 1; i < m_InputParamsArray.size(); i++) {
-+ m_pAllocParams.push_back(m_pAllocParams.back());
-+ hdls.push_back(NULL);
-+ }
-+ }
-+
-+ // each pair of source and sink has own safety buffer
-+ sts = CreateSafetyBuffers();
-+ MSDK_CHECK_STATUS(sts, "CreateSafetyBuffers failed");
-+
-+ /* One more hint. Example you have 3 dec + 1 enc sessions
-+ * (enc means vpp_comp call invoked. m_InputParamsArray.size() is 4.
-+ * You don't need take vpp comp params from last one session as it is enc session.
-+ * But you need process {0, 1, 2} sessions - totally 3.
-+ * So, you need start from 0 and end at 2.
-+ * */
-+ for (mfxI32 jj = 0; jj < (mfxI32)m_InputParamsArray.size() - 1; jj++) {
-+ /* Save params for VPP composition */
-+ sVppCompDstRect tempDstRect;
-+ tempDstRect.DstX = m_InputParamsArray[jj].nVppCompDstX;
-+ tempDstRect.DstY = m_InputParamsArray[jj].nVppCompDstY;
-+ tempDstRect.DstW = m_InputParamsArray[jj].nVppCompDstW;
-+ tempDstRect.DstH = m_InputParamsArray[jj].nVppCompDstH;
-+ tempDstRect.TileId = m_InputParamsArray[jj].nVppCompTileId;
-+ m_VppDstRects.push_back(tempDstRect);
-+ }
-+
-+ // create sessions, allocators
-+ for (i = 0; i < m_InputParamsArray.size(); i++) {
-+ msdk_printf(MSDK_STRING("Session %d:\n"), i);
-+ std::unique_ptr<GeneralAllocator> pAllocator(new GeneralAllocator);
-+ sts = pAllocator->Init(m_pAllocParams[i].get());
-+ MSDK_CHECK_STATUS(sts, "pAllocator->Init failed");
-+
-+ m_pAllocArray.push_back(std::move(pAllocator));
-+
-+ std::unique_ptr<ThreadTranscodeContext> pThreadPipeline(new ThreadTranscodeContext);
-+ // extend BS processing init
-+ m_pExtBSProcArray.push_back(
-+ std::unique_ptr<FileBitstreamProcessor>(new FileBitstreamProcessor));
-+
-+ pThreadPipeline->pPipeline.reset(CreatePipeline());
-+
-+#if (defined(_WIN32) || defined(_WIN64)) && (MFX_VERSION >= 1031)
-+ pThreadPipeline->pPipeline->SetPrefferiGfx(m_InputParamsArray[i].bPrefferiGfx);
-+ pThreadPipeline->pPipeline->SetPrefferdGfx(m_InputParamsArray[i].bPrefferdGfx);
-+#endif
-+
-+ pThreadPipeline->pBSProcessor = m_pExtBSProcArray.back().get();
-+
-+ std::unique_ptr<CSmplBitstreamReader> reader;
-+ std::unique_ptr<CSmplYUVReader> yuvreader;
-+ if (m_InputParamsArray[i].DecodeId == MFX_CODEC_VP9 ||
-+ m_InputParamsArray[i].DecodeId == MFX_CODEC_VP8 ||
-+ m_InputParamsArray[i].DecodeId == MFX_CODEC_AV1) {
-+ reader.reset(new CIVFFrameReader());
-+ }
-+ else if (m_InputParamsArray[i].DecodeId == MFX_CODEC_RGB4 ||
-+ m_InputParamsArray[i].DecodeId == MFX_CODEC_I420 ||
-+ m_InputParamsArray[i].DecodeId == MFX_CODEC_NV12) {
-+ // YUV reader for RGB4 overlay and raw input
-+ yuvreader.reset(new CSmplYUVReader());
-+ }
-+ else {
-+ reader.reset(new CSmplBitstreamReader());
-+ }
-+
-+ if (reader.get()) {
-+ sts = reader->Init(m_InputParamsArray[i].strSrcFile);
-+ MSDK_CHECK_STATUS(sts, "reader->Init failed");
-+ sts = m_pExtBSProcArray.back()->SetReader(reader);
-+ MSDK_CHECK_STATUS(sts, "m_pExtBSProcArray.back()->SetReader failed");
-+ }
-+ else if (yuvreader.get()) {
-+ std::list<msdk_string> input;
-+ input.push_back(m_InputParamsArray[i].strSrcFile);
-+ sts = yuvreader->Init(input, m_InputParamsArray[i].DecodeId);
-+ MSDK_CHECK_STATUS(sts, "m_YUVReader->Init failed");
-+ sts = m_pExtBSProcArray.back()->SetReader(yuvreader);
-+ MSDK_CHECK_STATUS(sts, "m_pExtBSProcArray.back()->SetReader failed");
-+ }
-+
-+ std::unique_ptr<CSmplBitstreamWriter> writer(new CSmplBitstreamWriter());
-+ sts = writer->Init(m_InputParamsArray[i].strDstFile);
-+
-+ sts = m_pExtBSProcArray.back()->SetWriter(writer);
-+ MSDK_CHECK_STATUS(sts, "m_pExtBSProcArray.back()->SetWriter failed");
-+
-+ if (Sink == m_InputParamsArray[i].eMode) {
-+ /* N_to_1 mode */
-+ if ((VppComp == m_InputParamsArray[i].eModeExt) ||
-+ (VppCompOnly == m_InputParamsArray[i].eModeExt)) {
-+ // Taking buffers from tail because they are stored in m_pBufferArray in reverse order
-+ // So, by doing this we'll fill buffers properly according to order from par file
-+ pBuffer = m_pBufferArray[m_pBufferArray.size() - 1 - BufCounter].get();
-+ BufCounter++;
-+ }
-+ else /* 1_to_N mode*/
-+ {
-+ pBuffer = m_pBufferArray[m_pBufferArray.size() - 1].get();
-+ }
-+ pSinkPipeline = pThreadPipeline->pPipeline.get();
-+ }
-+ else if (Source == m_InputParamsArray[i].eMode) {
-+ /* N_to_1 mode */
-+ if ((VppComp == m_InputParamsArray[i].eModeExt) ||
-+ (VppCompOnly == m_InputParamsArray[i].eModeExt)) {
-+ pBuffer = m_pBufferArray[m_pBufferArray.size() - 1].get();
-+ }
-+ else /* 1_to_N mode*/
-+ {
-+ pBuffer = m_pBufferArray[BufCounter].get();
-+ BufCounter++;
-+ }
-+ }
-+ else {
-+ pBuffer = NULL;
-+ }
-+
-+ /**/
-+ /* Vector stored linearly in the memory !*/
-+ m_InputParamsArray[i].pVppCompDstRects = m_VppDstRects.empty() ? NULL : &m_VppDstRects[0];
-+
-+ // if session has VPP plus ENCODE only (-i::source option)
-+ // use decode source session as input
-+ sts = MFX_ERR_MORE_DATA;
-+ if (Source == m_InputParamsArray[i].eMode) {
-+#if (defined(_WIN32) || defined(_WIN64)) && (MFX_VERSION >= 1031)
-+ sts = CheckAndFixAdapterDependency(i, pSinkPipeline);
-+ MSDK_CHECK_STATUS(sts, "CheckAndFixAdapterDependency failed");
-+ // force implementation type based on iGfx/dGfx parameters
-+ if (m_InputParamsArray[i].libType != MFX_IMPL_SOFTWARE) {
-+ ForceImplForSession(i);
-+ sts = m_pLoader->EnumImplementations(m_deviceID, m_adapterNum);
-+ MSDK_CHECK_STATUS(sts, "EnumImplementations(m_deviceID, m_adapterNum) failed");
-+ }
-+#endif
-+ sts = pThreadPipeline->pPipeline->Init(&m_InputParamsArray[i],
-+ m_pAllocArray[i].get(),
-+ hdls[i],
-+ pSinkPipeline,
-+ pBuffer,
-+ m_pExtBSProcArray.back().get(),
-+ m_pLoader.get());
-+ }
-+ else {
-+#if (defined(_WIN32) || defined(_WIN64)) && (MFX_VERSION >= 1031)
-+ sts = CheckAndFixAdapterDependency(i, pParentPipeline);
-+ MSDK_CHECK_STATUS(sts, "CheckAndFixAdapterDependency failed");
-+ // force implementation type based on iGfx/dGfx parameters
-+ if (m_InputParamsArray[i].libType != MFX_IMPL_SOFTWARE) {
-+ ForceImplForSession(i);
-+ sts = m_pLoader->EnumImplementations(m_deviceID, m_adapterNum);
-+ MSDK_CHECK_STATUS(sts, "EnumImplementations(m_deviceID, m_adapterNum) failed");
-+ }
-+#endif
-+ sts = pThreadPipeline->pPipeline->Init(&m_InputParamsArray[i],
-+ m_pAllocArray[i].get(),
-+ hdls[i],
-+ pParentPipeline,
-+ pBuffer,
-+ m_pExtBSProcArray.back().get(),
-+ m_pLoader.get());
-+ }
-+
-+ MSDK_CHECK_STATUS(sts, "pThreadPipeline->pPipeline->Init failed");
-+
-+ if (!pParentPipeline && m_InputParamsArray[i].bIsJoin)
-+ pParentPipeline = pThreadPipeline->pPipeline.get();
-+
-+ // set the session's start status (like it is waiting)
-+ pThreadPipeline->startStatus = MFX_WRN_DEVICE_BUSY;
-+ // set other session's parameters
-+ pThreadPipeline->implType = m_InputParamsArray[i].libType;
-+ m_pThreadContextArray.push_back(std::move(pThreadPipeline));
-+
-+ mfxVersion ver = { { 0, 0 } };
-+ sts = m_pThreadContextArray[i]->pPipeline->QueryMFXVersion(&ver);
-+ MSDK_CHECK_STATUS(sts, "m_pThreadContextArray[i]->pPipeline->QueryMFXVersion failed");
-+
-+ PrintInfo(i, &m_InputParamsArray[i], &ver);
-+ }
-+
-+ for (i = 0; i < m_InputParamsArray.size(); i++) {
-+ sts = m_pThreadContextArray[i]->pPipeline->CompleteInit();
-+ MSDK_CHECK_STATUS(sts, "m_pThreadContextArray[i]->pPipeline->CompleteInit failed");
-+
-+ if (m_pThreadContextArray[i]->pPipeline->GetJoiningFlag())
-+ msdk_printf(MSDK_STRING("Session %d was joined with other sessions\n"), i);
-+ else
-+ msdk_printf(MSDK_STRING("Session %d was NOT joined with other sessions\n"), i);
-+
-+ m_pThreadContextArray[i]->pPipeline->SetPipelineID(i);
-+ }
-+
-+ msdk_printf(MSDK_STRING("\n"));
-+
-+ return sts;
-+
-+} // mfxStatus Launcher::Init()
-+
-+void Launcher::Run() {
-+ msdk_printf(MSDK_STRING("Transcoding started\n"));
-+
-+ // mark start time
-+ m_StartTime = GetTick();
-+
-+ // Robust flag is applied to every seession if enabled in one
-+ if (m_pThreadContextArray[0]->pPipeline->GetRobustFlag()) {
-+ DoRobustTranscoding();
-+ }
-+ else {
-+ DoTranscoding();
-+ }
-+
-+ msdk_printf(MSDK_STRING("\nTranscoding finished\n"));
-+
-+} // mfxStatus Launcher::Init()
-+
-+void Launcher::DoTranscoding() {
-+ auto RunTranscodeRoutine = [](ThreadTranscodeContext* context) {
-+ context->handle = std::async(std::launch::async, [context]() {
-+ context->TranscodeRoutine();
-+ });
-+ };
-+
-+ bool isOverlayUsed = false;
-+ for (const auto& context : m_pThreadContextArray) {
-+ MSDK_CHECK_POINTER_NO_RET(context);
-+ RunTranscodeRoutine(context.get());
-+
-+ MSDK_CHECK_POINTER_NO_RET(context->pPipeline);
-+ isOverlayUsed = isOverlayUsed || context->pPipeline->IsOverlayUsed();
-+ }
-+
-+ // Transcoding threads waiting cycle
-+ bool aliveNonOverlaySessions = true;
-+ while (aliveNonOverlaySessions) {
-+ aliveNonOverlaySessions = false;
-+
-+ for (size_t i = 0; i < m_pThreadContextArray.size(); ++i) {
-+ if (!m_pThreadContextArray[i]->handle.valid())
-+ continue;
-+
-+ //Payslip interval to check the state of working threads:
-+ //such interval is usually a realtime, i.e. for 30 fps this would be 33ms,
-+ //66ms typically mean either 1/fps or 2/fps payslip checks.
-+ auto waitSts = m_pThreadContextArray[i]->handle.wait_for(std::chrono::milliseconds(66));
-+ if (waitSts == std::future_status::ready) {
-+ // Invoke get() of the handle just to reset the valid state.
-+ // This allows to skip already processed sessions
-+ m_pThreadContextArray[i]->handle.get();
-+
-+ // Session is completed, let's check for its status
-+ if (m_pThreadContextArray[i]->transcodingSts < MFX_ERR_NONE) {
-+ // Stop all the sessions if an error happened in one
-+ // But do not stop in robust mode when gpu hang's happened
-+ if (m_pThreadContextArray[i]->transcodingSts != MFX_ERR_GPU_HANG ||
-+ !m_pThreadContextArray[i]->pPipeline->GetRobustFlag()) {
-+ msdk_stringstream ss;
-+ ss << MSDK_STRING("\n\n session ") << i << MSDK_STRING(" [")
-+ << m_pThreadContextArray[i]->pPipeline->GetSessionText()
-+ << MSDK_STRING("] failed with status ")
-+ << StatusToString(m_pThreadContextArray[i]->transcodingSts)
-+ << MSDK_STRING(" shutting down the application...") << std::endl
-+ << std::endl;
-+ msdk_printf(MSDK_STRING("%s"), ss.str().c_str());
-+
-+ for (const auto& context : m_pThreadContextArray) {
-+ context->pPipeline->StopSession();
-+ }
-+ }
-+ }
-+ else if (m_pThreadContextArray[i]->transcodingSts > MFX_ERR_NONE) {
-+ msdk_stringstream ss;
-+ ss << MSDK_STRING("\n\n session ") << i << MSDK_STRING(" [")
-+ << m_pThreadContextArray[i]->pPipeline->GetSessionText()
-+ << MSDK_STRING("] returned warning status ")
-+ << StatusToString(m_pThreadContextArray[i]->transcodingSts) << std::endl
-+ << std::endl;
-+ msdk_printf(MSDK_STRING("%s"), ss.str().c_str());
-+ }
-+ }
-+ else {
-+ aliveNonOverlaySessions = aliveNonOverlaySessions ||
-+ !m_pThreadContextArray[i]->pPipeline->IsOverlayUsed();
-+ }
-+ }
-+
-+ // Stop overlay sessions
-+ // Note: Overlay sessions never stop themselves so they should be forcibly stopped
-+ // after stopping of all non-overlay sessions
-+ if (!aliveNonOverlaySessions && isOverlayUsed) {
-+ // Sending stop message
-+ for (const auto& context : m_pThreadContextArray) {
-+ if (context->pPipeline->IsOverlayUsed()) {
-+ context->pPipeline->StopSession();
-+ }
-+ }
-+
-+ // Waiting for them to be stopped
-+ for (const auto& context : m_pThreadContextArray) {
-+ if (!context->handle.valid())
-+ continue;
-+
-+ context->handle.wait();
-+ }
-+ }
-+ }
-+}
-+
-+void Launcher::DoRobustTranscoding() {
-+ mfxStatus sts = MFX_ERR_NONE;
-+
-+ // Cycle for handling MFX_ERR_GPU_HANG during transcoding
-+ // If it's returned, reset all the pipelines and start over from the last point
-+ bool bGPUHang = false;
-+ for (;;) {
-+ if (bGPUHang) {
-+ for (size_t i = 0; i < m_pThreadContextArray.size(); i++) {
-+ sts = m_pThreadContextArray[i]->pPipeline->Reset(m_pLoader.get());
-+ if (sts) {
-+ msdk_printf(
-+ MSDK_STRING("\n[WARNING] GPU Hang recovery wasn't succeed. Exiting...\n"));
-+ return;
-+ }
-+ }
-+ bGPUHang = false;
-+ msdk_printf(MSDK_STRING("\n[WARNING] Successfully recovered. Continue transcoding.\n"));
-+ }
-+
-+ DoTranscoding();
-+
-+ for (size_t i = 0; i < m_pThreadContextArray.size(); i++) {
-+ if (m_pThreadContextArray[i]->transcodingSts == MFX_ERR_GPU_HANG) {
-+ bGPUHang = true;
-+ }
-+ }
-+ if (!bGPUHang)
-+ break;
-+ msdk_printf(MSDK_STRING("\n[WARNING] GPU Hang has happened. Trying to recover...\n"));
-+ }
-+}
-+
-+mfxStatus Launcher::ProcessResult() {
-+ FILE* pPerfFile = m_parser.GetPerformanceFile();
-+
-+ msdk_stringstream ssTranscodingTime;
-+ ssTranscodingTime << std::endl
-+ << MSDK_STRING("Common transcoding time is ") << GetTime(m_StartTime)
-+ << MSDK_STRING(" sec") << std::endl;
-+
-+ m_parser.PrintParFileName();
-+
-+ msdk_printf(MSDK_STRING("%s"), ssTranscodingTime.str().c_str());
-+ if (pPerfFile) {
-+ msdk_fprintf(pPerfFile, MSDK_STRING("%s"), ssTranscodingTime.str().c_str());
-+ }
-+
-+ mfxStatus FinalSts = MFX_ERR_NONE;
-+ msdk_printf(MSDK_STRING(
-+ "-------------------------------------------------------------------------------\n"));
-+
-+ for (mfxU32 i = 0; i < m_pThreadContextArray.size(); i++) {
-+ mfxStatus transcodingSts = m_pThreadContextArray[i]->transcodingSts;
-+ mfxF64 workTime = m_pThreadContextArray[i]->working_time;
-+ mfxU32 framesNum = m_pThreadContextArray[i]->numTransFrames;
-+
-+ if (!FinalSts)
-+ FinalSts = transcodingSts;
-+
-+ msdk_string SessionStsStr = transcodingSts ? msdk_string(MSDK_STRING("FAILED"))
-+ : msdk_string((MSDK_STRING("PASSED")));
-+
-+ msdk_stringstream ss;
-+ ss << MSDK_STRING("*** session ") << i << MSDK_STRING(" [")
-+ << m_pThreadContextArray[i]->pPipeline->GetSessionText() << MSDK_STRING("] ")
-+ << SessionStsStr << MSDK_STRING(" (") << StatusToString(transcodingSts)
-+ << MSDK_STRING(") ") << workTime << MSDK_STRING(" sec, ") << framesNum
-+ << MSDK_STRING(" frames, ") << std::fixed << std::setprecision(3) << framesNum / workTime
-+ << MSDK_STRING(" fps") << std::endl
-+ << m_parser.GetLine(i) << std::endl
-+ << std::endl;
-+
-+ msdk_printf(MSDK_STRING("%s"), ss.str().c_str());
-+ if (pPerfFile) {
-+ msdk_fprintf(pPerfFile, MSDK_STRING("%s"), ss.str().c_str());
-+ }
-+ }
-+ msdk_printf(MSDK_STRING(
-+ "-------------------------------------------------------------------------------\n"));
-+
-+ msdk_stringstream ssTest;
-+ ssTest << std::endl
-+ << MSDK_STRING("The test ")
-+ << (FinalSts ? msdk_string(MSDK_STRING("FAILED")) : msdk_string(MSDK_STRING("PASSED")))
-+ << std::endl;
-+
-+ msdk_printf(MSDK_STRING("%s"), ssTest.str().c_str());
-+ if (pPerfFile) {
-+ msdk_fprintf(pPerfFile, MSDK_STRING("%s"), ssTest.str().c_str());
-+ }
-+ return FinalSts;
-+} // mfxStatus Launcher::ProcessResult()
-+
-+#if (defined(_WIN32) || defined(_WIN64)) && (MFX_VERSION >= 1031)
-+mfxStatus Launcher::QueryAdapters() {
-+ mfxU32 num_adapters_available;
-+
-+ mfxStatus sts = MFXQueryAdaptersNumber(&num_adapters_available);
-+ MFX_CHECK_STS(sts);
-+
-+ // no adapters on the machine, able to use software implementation
-+ if (!num_adapters_available) {
-+ return MFX_ERR_NONE;
-+ }
-+
-+ m_DisplaysData.resize(num_adapters_available);
-+ m_Adapters = { m_DisplaysData.data(), mfxU32(m_DisplaysData.size()), 0u };
-+
-+ sts = MFXQueryAdapters(nullptr, &m_Adapters);
-+ MFX_CHECK_STS(sts);
-+
-+ return MFX_ERR_NONE;
-+}
-+
-+void Launcher::ForceImplForSession(mfxU32 idxSession) {
-+ if (m_InputParamsArray[idxSession].libType == MFX_IMPL_SOFTWARE)
-+ return;
-+
-+ //change only 8 bit of the implementation. Don't touch type of frames
-+ mfxIMPL impl = m_InputParamsArray[idxSession].libType & mfxI32(~0xFF);
-+
-+ mfxU32 idx = GetPreferredAdapterNum(m_Adapters, m_InputParamsArray[idxSession]);
-+ switch (m_Adapters.Adapters[idx].Number) {
-+ case 0:
-+ impl |= MFX_IMPL_HARDWARE;
-+ break;
-+ case 1:
-+ impl |= MFX_IMPL_HARDWARE2;
-+ break;
-+ case 2:
-+ impl |= MFX_IMPL_HARDWARE3;
-+ break;
-+ case 3:
-+ impl |= MFX_IMPL_HARDWARE4;
-+ break;
-+
-+ default:
-+ // try searching on all display adapters
-+ impl |= MFX_IMPL_HARDWARE_ANY;
-+ break;
-+ }
-+
-+ m_InputParamsArray[idxSession].libType = impl;
-+ m_adapterNum = m_Adapters.Adapters[idx].Number;
-+ m_deviceID = m_Adapters.Adapters[idx].Platform.DeviceId;
-+}
-+
-+mfxStatus Launcher::CheckAndFixAdapterDependency(mfxU32 idxSession,
-+ CTranscodingPipeline* pParentPipeline) {
-+ if (!pParentPipeline)
-+ return MFX_ERR_NONE;
-+
-+ // Inherited sessions must have the same adapter as parent
-+ if ((pParentPipeline->IsPrefferiGfx() || pParentPipeline->IsPrefferdGfx()) &&
-+ !m_InputParamsArray[idxSession].bPrefferiGfx &&
-+ !m_InputParamsArray[idxSession].bPrefferdGfx) {
-+ m_InputParamsArray[idxSession].bPrefferiGfx = pParentPipeline->IsPrefferiGfx();
-+ m_InputParamsArray[idxSession].bPrefferdGfx = pParentPipeline->IsPrefferdGfx();
-+ msdk_stringstream ss;
-+ ss << MSDK_STRING("\n\n session with index: ") << idxSession
-+ << MSDK_STRING(" adapter type was forced to ")
-+ << (pParentPipeline->IsPrefferiGfx() ? MSDK_STRING("integrated")
-+ : MSDK_STRING("discrete"))
-+ << std::endl
-+ << std::endl;
-+ msdk_printf(MSDK_STRING("%s"), ss.str().c_str());
-+
-+ return MFX_ERR_NONE;
-+ }
-+
-+ // App can't change initialization of the previous session (parent session)
-+ if (!pParentPipeline->IsPrefferiGfx() && !pParentPipeline->IsPrefferdGfx() &&
-+ (m_InputParamsArray[idxSession].bPrefferiGfx ||
-+ m_InputParamsArray[idxSession].bPrefferdGfx)) {
-+ msdk_stringstream ss;
-+ ss << MSDK_STRING("\n\n session with index: ") << idxSession
-+ << MSDK_STRING(" failed because parent session [") << pParentPipeline->GetSessionText()
-+ << MSDK_STRING("] doesn't have explicit adapter setting") << std::endl
-+ << std::endl;
-+ msdk_printf(MSDK_STRING("%s"), ss.str().c_str());
-+
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ // Inherited sessions must have the same adapter as parent
-+ if (pParentPipeline->IsPrefferiGfx() && !m_InputParamsArray[idxSession].bPrefferiGfx) {
-+ msdk_stringstream ss;
-+ ss << MSDK_STRING("\n\n session with index: ") << idxSession
-+ << MSDK_STRING(" failed because it has different adapter type with parent session [")
-+ << pParentPipeline->GetSessionText() << MSDK_STRING("]") << std::endl
-+ << std::endl;
-+ msdk_printf(MSDK_STRING("%s"), ss.str().c_str());
-+
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ // Inherited sessions must have the same adapter as parent
-+ if (pParentPipeline->IsPrefferdGfx() && !m_InputParamsArray[idxSession].bPrefferdGfx) {
-+ msdk_stringstream ss;
-+ ss << MSDK_STRING("\n\n session with index: ") << idxSession
-+ << MSDK_STRING(" failed because it has different adapter type with parent session [")
-+ << pParentPipeline->GetSessionText() << MSDK_STRING("]") << std::endl
-+ << std::endl;
-+ msdk_printf(MSDK_STRING("%s"), ss.str().c_str());
-+
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ return MFX_ERR_NONE;
-+}
-+#endif //(_WIN32 || _WIN64) && (MFX_VERSION >= 1031)
-+
-+mfxStatus Launcher::VerifyCrossSessionsOptions() {
-+ bool IsSinkPresence = false;
-+ bool IsSourcePresence = false;
-+ bool IsHeterSessionJoin = false;
-+ bool IsFirstInTopology = true;
-+
-+ mfxU16 minAsyncDepth = 0;
-+ bool bUseExternalAllocator = false;
-+ bool bSingleTexture = false;
-+
-+#if (MFX_VERSION >= 1025)
-+ bool allMFEModesEqual = true;
-+ bool allMFEFramesEqual = true;
-+ bool allMFESessionsJoined = true;
-+
-+ mfxU16 usedMFEMaxFrames = 0;
-+ mfxU16 usedMFEMode = 0;
-+
-+ for (mfxU32 i = 0; i < m_InputParamsArray.size(); i++) {
-+ // loop over all sessions and check mfe-specific params
-+ // for mfe is required to have sessions joined, HW impl
-+ if (m_InputParamsArray[i].numMFEFrames > 1) {
-+ usedMFEMaxFrames = m_InputParamsArray[i].numMFEFrames;
-+ for (mfxU32 j = 0; j < m_InputParamsArray.size(); j++) {
-+ if (m_InputParamsArray[j].numMFEFrames &&
-+ m_InputParamsArray[j].numMFEFrames != usedMFEMaxFrames) {
-+ m_InputParamsArray[j].numMFEFrames = usedMFEMaxFrames;
-+ allMFEFramesEqual = false;
-+ m_InputParamsArray[j].MFMode = m_InputParamsArray[j].MFMode < MFX_MF_AUTO
-+ ? MFX_MF_AUTO
-+ : m_InputParamsArray[j].MFMode;
-+ }
-+ if (m_InputParamsArray[j].bIsJoin == false) {
-+ allMFESessionsJoined = false;
-+ m_InputParamsArray[j].bIsJoin = true;
-+ }
-+ }
-+ }
-+ if (m_InputParamsArray[i].MFMode >= MFX_MF_AUTO) {
-+ usedMFEMode = m_InputParamsArray[i].MFMode;
-+ for (mfxU32 j = 0; j < m_InputParamsArray.size(); j++) {
-+ if (m_InputParamsArray[j].MFMode && m_InputParamsArray[j].MFMode != usedMFEMode) {
-+ m_InputParamsArray[j].MFMode = usedMFEMode;
-+ allMFEModesEqual = false;
-+ }
-+ if (m_InputParamsArray[j].bIsJoin == false) {
-+ allMFESessionsJoined = false;
-+ m_InputParamsArray[j].bIsJoin = true;
-+ }
-+ }
-+ }
-+ }
-+ if (!allMFEFramesEqual)
-+ msdk_printf(
-+ MSDK_STRING(
-+ "WARNING: All sessions for MFE should have the same number of MFE frames!\n used ammount of frame for MFE: %d\n"),
-+ (int)usedMFEMaxFrames);
-+ if (!allMFEModesEqual)
-+ msdk_printf(
-+ MSDK_STRING(
-+ "WARNING: All sessions for MFE should have the same mode!\n, used mode: %d\n"),
-+ (int)usedMFEMode);
-+ if (!allMFESessionsJoined)
-+ msdk_printf(MSDK_STRING(
-+ "WARNING: Sessions for MFE should be joined! All sessions forced to be joined\n"));
-+#endif
-+
-+ for (mfxU32 i = 0; i < m_InputParamsArray.size(); i++) {
-+ // Any plugin or static frame alpha blending
-+ // CPU rotate plugin works with opaq frames in native mode
-+ if ((m_InputParamsArray[i].nRotationAngle && m_InputParamsArray[i].eMode != Native) ||
-+ m_InputParamsArray[i].bOpenCL || m_InputParamsArray[i].EncoderFourCC ||
-+ m_InputParamsArray[i].DecoderFourCC || m_InputParamsArray[i].nVppCompSrcH ||
-+ m_InputParamsArray[i].nVppCompSrcW) {
-+ bUseExternalAllocator = true;
-+ }
-+
-+ if (m_InputParamsArray[i].bSingleTexture) {
-+ bSingleTexture = true;
-+ }
-+
-+ // All sessions have to know about timeout
-+ if (m_InputParamsArray[i].nTimeout && (m_InputParamsArray[i].eMode == Sink)) {
-+ for (mfxU32 j = 0; j < m_InputParamsArray.size(); j++) {
-+ if (m_InputParamsArray[j].MaxFrameNumber != MFX_INFINITE) {
-+ msdk_printf(MSDK_STRING(
-+ "\"-timeout\" option isn't compatible with \"-n\". \"-n\" will be ignored.\n"));
-+ for (mfxU32 k = 0; k < m_InputParamsArray.size(); k++) {
-+ m_InputParamsArray[k].MaxFrameNumber = MFX_INFINITE;
-+ }
-+ break;
-+ }
-+ }
-+ msdk_printf(MSDK_STRING("Timeout %d seconds has been set to all sessions\n"),
-+ m_InputParamsArray[i].nTimeout);
-+ for (mfxU32 j = 0; j < m_InputParamsArray.size(); j++) {
-+ m_InputParamsArray[j].nTimeout = m_InputParamsArray[i].nTimeout;
-+ }
-+ }
-+
-+ // All sessions have to know if robust mode enabled
-+ if (m_InputParamsArray[i].bRobustFlag) {
-+ for (mfxU32 j = 0; j < m_InputParamsArray.size(); j++) {
-+ m_InputParamsArray[j].bRobustFlag = m_InputParamsArray[i].bRobustFlag;
-+ }
-+ }
-+
-+ if (Source == m_InputParamsArray[i].eMode) {
-+ if (m_InputParamsArray[i].nAsyncDepth < minAsyncDepth) {
-+ minAsyncDepth = m_InputParamsArray[i].nAsyncDepth;
-+ }
-+ // topology definition
-+ if (!IsSinkPresence) {
-+ PrintError(MSDK_STRING(
-+ "Error in par file. Decode source session must be declared BEFORE encode sinks \n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ IsSourcePresence = true;
-+
-+ if (IsFirstInTopology) {
-+ if (m_InputParamsArray[i].bIsJoin)
-+ IsHeterSessionJoin = true;
-+ else
-+ IsHeterSessionJoin = false;
-+ }
-+ else {
-+ if (m_InputParamsArray[i].bIsJoin && !IsHeterSessionJoin) {
-+ PrintError(MSDK_STRING(
-+ "Error in par file. All heterogeneous sessions must be joined \n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ if (!m_InputParamsArray[i].bIsJoin && IsHeterSessionJoin) {
-+ PrintError(MSDK_STRING(
-+ "Error in par file. All heterogeneous sessions must be NOT joined \n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+
-+ if (IsFirstInTopology)
-+ IsFirstInTopology = false;
-+ }
-+ else if (Sink == m_InputParamsArray[i].eMode) {
-+ minAsyncDepth = m_InputParamsArray[i].nAsyncDepth;
-+ IsSinkPresence = true;
-+
-+ if (IsFirstInTopology) {
-+ if (m_InputParamsArray[i].bIsJoin)
-+ IsHeterSessionJoin = true;
-+ else
-+ IsHeterSessionJoin = false;
-+ }
-+ else {
-+ if (m_InputParamsArray[i].bIsJoin && !IsHeterSessionJoin) {
-+ PrintError(MSDK_STRING(
-+ "Error in par file. All heterogeneous sessions must be joined \n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ if (!m_InputParamsArray[i].bIsJoin && IsHeterSessionJoin) {
-+ PrintError(MSDK_STRING(
-+ "Error in par file. All heterogeneous sessions must be NOT joined \n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+
-+ if (IsFirstInTopology)
-+ IsFirstInTopology = false;
-+ }
-+ if (MFX_IMPL_SOFTWARE != m_InputParamsArray[i].libType) {
-+ // TODO: can we avoid ifdef and use MFX_IMPL_VIA_VAAPI?
-+#if defined(_WIN32) || defined(_WIN64)
-+ if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(m_InputParamsArray[i].libType)) {
-+ m_eDevType = MFX_HANDLE_D3D11_DEVICE;
-+ m_accelerationMode = MFX_ACCEL_MODE_VIA_D3D11;
-+ }
-+ else {
-+ m_eDevType = MFX_HANDLE_D3D9_DEVICE_MANAGER;
-+ m_accelerationMode = MFX_ACCEL_MODE_VIA_D3D9;
-+ }
-+#elif defined(LIBVA_SUPPORT)
-+ m_eDevType = MFX_HANDLE_VA_DISPLAY;
-+ m_accelerationMode = MFX_ACCEL_MODE_VIA_VAAPI;
-+#endif
-+ }
-+ }
-+
-+ // Async depth between inter-sessions should be equal to the minimum async depth of all these sessions.
-+ for (mfxU32 i = 0; i < m_InputParamsArray.size(); i++) {
-+ if ((m_InputParamsArray[i].eMode == Source) || (m_InputParamsArray[i].eMode == Sink)) {
-+ m_InputParamsArray[i].nAsyncDepth = minAsyncDepth;
-+ }
-+ }
-+
-+ if (IsSinkPresence && !IsSourcePresence) {
-+ PrintError(MSDK_STRING("Error: Sink must be defined"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ if (bSingleTexture) {
-+ bool showWarning = false;
-+ for (mfxU32 j = 0; j < m_InputParamsArray.size(); j++) {
-+ if (!m_InputParamsArray[j].bSingleTexture) {
-+ showWarning = true;
-+ }
-+ m_InputParamsArray[j].bSingleTexture = true;
-+ }
-+ if (showWarning) {
-+ msdk_printf(MSDK_STRING(
-+ "WARNING: At least one session has -single_texture_d3d11 option, all other sessions are modified to have this setting enabled al well.\n"));
-+ }
-+ }
-+
-+ return MFX_ERR_NONE;
-+
-+} // mfxStatus Launcher::VerifyCrossSessionsOptions()
-+
-+mfxStatus Launcher::CreateSafetyBuffers() {
-+ SafetySurfaceBuffer* pBuffer = NULL;
-+
-+ for (mfxU32 i = 0; i < m_InputParamsArray.size(); i++) {
-+ /* this is for 1 to N case*/
-+ if ((Source == m_InputParamsArray[i].eMode) && (Native == m_InputParamsArray[0].eModeExt)) {
-+ pBuffer = new SafetySurfaceBuffer(pBuffer);
-+ m_pBufferArray.push_back(std::unique_ptr<SafetySurfaceBuffer>(pBuffer));
-+ }
-+
-+ /* And N_to_1 case: composition should be enabled!
-+ * else it is logic error */
-+ if ((Source != m_InputParamsArray[i].eMode) &&
-+ ((VppComp == m_InputParamsArray[0].eModeExt) ||
-+ (VppCompOnly == m_InputParamsArray[0].eModeExt))) {
-+ pBuffer = new SafetySurfaceBuffer(pBuffer);
-+ m_pBufferArray.push_back(std::unique_ptr<SafetySurfaceBuffer>(pBuffer));
-+ }
-+ }
-+ return MFX_ERR_NONE;
-+
-+} // mfxStatus Launcher::CreateSafetyBuffers
-+
-+void Launcher::Close() {
-+ while (m_pThreadContextArray.size()) {
-+ m_pThreadContextArray[m_pThreadContextArray.size() - 1].reset();
-+ m_pThreadContextArray.pop_back();
-+ }
-+
-+ m_pAllocArray.clear();
-+ m_pBufferArray.clear();
-+ m_pExtBSProcArray.clear();
-+ m_pAllocParams.clear();
-+ m_hwdevs.clear();
-+
-+} // void Launcher::Close()
-+
-+#if defined(_WIN32) || defined(_WIN64)
-+int _tmain(int argc, TCHAR* argv[])
-+#else
-+int main(int argc, char* argv[])
-+#endif
-+{
-+ mfxStatus sts;
-+ Launcher transcode;
-+ if (argc < 2) {
-+ msdk_printf(MSDK_STRING(
-+ "[ERROR] Command line is empty. Use -? for getting help on available options.\n"));
-+ return 0;
-+ }
-+
-+ sts = transcode.Init(argc, argv);
-+ if (sts == MFX_WRN_OUT_OF_RANGE) {
-+ // There's no error in parameters parsing, but we should not continue further. For instance, in case of -? option
-+ return MFX_ERR_NONE;
-+ }
-+
-+ fflush(stdout);
-+ fflush(stderr);
-+
-+ MSDK_CHECK_STATUS(sts, "transcode.Init failed");
-+
-+ transcode.Run();
-+
-+ sts = transcode.ProcessResult();
-+ fflush(stdout);
-+ fflush(stderr);
-+ MSDK_CHECK_STATUS(sts, "transcode.ProcessResult failed");
-+
-+ return 0;
-+}
-diff --git a/tools/legacy/sample_multi_transcode/src/transcode_utils.cpp b/tools/legacy/sample_multi_transcode/src/transcode_utils.cpp
-new file mode 100644
-index 0000000..db26c82
---- /dev/null
-+++ b/tools/legacy/sample_multi_transcode/src/transcode_utils.cpp
-@@ -0,0 +1,2765 @@
-+/******************************************************************************\
-+Copyright (c) 2005-2020, Intel Corporation
-+All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-+
-+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-+
-+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-+
-+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+This sample was distributed or derived from the Intel's Media Samples package.
-+The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
-+or https://software.intel.com/en-us/media-client-solutions-support.
-+\**********************************************************************************/
-+
-+#include "mfx_samples_config.h"
-+#include "plugin_utils.h"
-+
-+#if defined(_WIN32) || defined(_WIN64)
-+ #include <d3d9.h>
-+ #include <psapi.h>
-+ #include <windows.h>
-+ #include "d3d11_allocator.h"
-+ #include "d3d_allocator.h"
-+#else
-+ #include <stdarg.h>
-+ #include "vaapi_allocator.h"
-+#endif
-+
-+#include "sysmem_allocator.h"
-+#include "transcode_utils.h"
-+
-+#include "version.h"
-+
-+#include <algorithm>
-+#include <cctype>
-+#include <cstdlib>
-+#include <cstring>
-+#include <fstream>
-+#include <iterator>
-+#include <sstream>
-+#include <string>
-+#include <vector>
-+
-+using namespace TranscodingSample;
-+
-+// parsing defines
-+#define IS_SEPARATOR(ch) ((ch) <= ' ' || (ch) == '=')
-+#define VAL_CHECK(val, argIdx, argName) \
-+ { \
-+ if (val) { \
-+ PrintError(MSDK_STRING("Input argument number %d \"%s\" require more parameters"), \
-+ argIdx, \
-+ argName); \
-+ return MFX_ERR_UNSUPPORTED; \
-+ } \
-+ }
-+
-+#define SIZE_CHECK(cond) \
-+ { \
-+ if (cond) { \
-+ PrintError(MSDK_STRING("Buffer is too small")); \
-+ return MFX_ERR_UNSUPPORTED; \
-+ } \
-+ }
-+
-+#ifndef MFX_VERSION
-+ #error MFX_VERSION not defined
-+#endif
-+
-+msdk_tick TranscodingSample::GetTick() {
-+ return msdk_time_get_tick();
-+}
-+
-+mfxF64 TranscodingSample::GetTime(msdk_tick start) {
-+ static msdk_tick frequency = msdk_time_get_frequency();
-+
-+ return MSDK_GET_TIME(msdk_time_get_tick(), start, frequency);
-+}
-+
-+void TranscodingSample::PrintError(const msdk_char* strErrorMessage, ...) {
-+ if (strErrorMessage) {
-+ msdk_printf(MSDK_STRING("ERROR: "));
-+ va_list args;
-+ va_start(args, strErrorMessage);
-+ msdk_vprintf(strErrorMessage, args);
-+ va_end(args);
-+ msdk_printf(
-+ MSDK_STRING("\nUsage: sample_multi_transcode [options] [--] pipeline-description\n"));
-+ msdk_printf(MSDK_STRING(" or: sample_multi_transcode [options] -par ParFile\n"));
-+ msdk_printf(MSDK_STRING("\n"));
-+ msdk_printf(MSDK_STRING("Run application with -? option to get full help text.\n\n"));
-+ }
-+}
-+
-+void TranscodingSample::PrintHelp() {
-+ msdk_printf(MSDK_STRING("Multi Transcoding Sample Version %s\n\n"),
-+ GetMSDKSampleVersion().c_str());
-+ msdk_printf(MSDK_STRING("Command line parameters\n"));
-+
-+ msdk_printf(MSDK_STRING("Usage: sample_multi_transcode [options] [--] pipeline-description\n"));
-+ msdk_printf(MSDK_STRING(" or: sample_multi_transcode [options] -par ParFile\n"));
-+ msdk_printf(MSDK_STRING("\n"));
-+ msdk_printf(MSDK_STRING(" -stat <N>\n"));
-+ msdk_printf(MSDK_STRING(" Output statistic every N transcoding cycles\n"));
-+ msdk_printf(MSDK_STRING(" -stat-log <name>\n"));
-+ msdk_printf(MSDK_STRING(
-+ " Output statistic to the specified file (opened in append mode)\n"));
-+ msdk_printf(MSDK_STRING(" -stat-per-frame <name>\n"));
-+ msdk_printf(MSDK_STRING(
-+ " Output per-frame latency values to a file (opened in append mode). The file name will be for an input sesssion: <name>_input_ID_<N>.log\n"));
-+ msdk_printf(MSDK_STRING(
-+ " or, for output session: <name>_output_ID_<N>.log; <N> - a number of a session.\n"));
-+
-+ msdk_printf(MSDK_STRING("Options:\n"));
-+ // (" ............xx
-+ msdk_printf(MSDK_STRING(" -? Print this help and exit\n"));
-+ msdk_printf(MSDK_STRING(" -p <file-name>\n"));
-+ msdk_printf(MSDK_STRING(" Collect performance statistics in specified file\n"));
-+ msdk_printf(MSDK_STRING(" -timeout <seconds>\n"));
-+ msdk_printf(MSDK_STRING(" Set time to run transcoding in seconds\n"));
-+ msdk_printf(MSDK_STRING(" -greedy \n"));
-+ msdk_printf(
-+ MSDK_STRING(" Use greedy formula to calculate number of surfaces\n"));
-+ msdk_printf(MSDK_STRING("\n"));
-+ msdk_printf(MSDK_STRING("Pipeline description (general options):\n"));
-+ msdk_printf(MSDK_STRING(" -i::h265|h264|mpeg2|vc1|mvc|jpeg|vp9|av1 <file-name>\n"));
-+ msdk_printf(MSDK_STRING(" Set input file and decoder type\n"));
-+ msdk_printf(MSDK_STRING(" -i::i420|nv12 <file-name>\n"));
-+ msdk_printf(MSDK_STRING(" Set raw input file and color format\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -i::rgb4_frame Set input rgb4 file for compositon. File should contain just one single frame (-vpp_comp_src_h and -vpp_comp_src_w should be specified as well).\n"));
-+ msdk_printf(MSDK_STRING(" -o::h265|h264|mpeg2|mvc|jpeg|vp9|raw <file-name>\n"));
-+ msdk_printf(MSDK_STRING(" Set output file and encoder type\n"));
-+ msdk_printf(MSDK_STRING(" -sw|-hw|-hw_d3d11|-hw_d3d9\n"));
-+ msdk_printf(MSDK_STRING(" SDK implementation to use: \n"));
-+ msdk_printf(MSDK_STRING(
-+ " -hw - platform-specific on default display adapter (default)\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -hw_d3d11 - platform-specific via d3d11 (d3d11 is default for win)\n"));
-+ msdk_printf(MSDK_STRING(" -hw_d3d9 - platform-specific via d3d9\n"));
-+ msdk_printf(MSDK_STRING(" -sw - software\n"));
-+#if defined(LINUX32) || defined(LINUX64)
-+ msdk_printf(MSDK_STRING(" -device /path/to/device - set graphics device for processing\n"));
-+ msdk_printf(
-+ MSDK_STRING(" For example: '-device /dev/dri/card0'\n"));
-+ msdk_printf(
-+ MSDK_STRING(" '-device /dev/dri/renderD128'\n"));
-+ msdk_printf(MSDK_STRING(
-+ " If not specified, defaults to the first Intel device found on the system\n"));
-+#endif
-+#if (defined(_WIN64) || defined(_WIN32)) && (MFX_VERSION >= 1031)
-+ msdk_printf(
-+ MSDK_STRING(" [-dGfx] - preffer processing on dGfx (by default system decides)\n"));
-+ msdk_printf(
-+ MSDK_STRING(" [-iGfx] - preffer processing on iGfx (by default system decides)\n"));
-+#endif
-+#if (MFX_VERSION >= 1025)
-+ msdk_printf(MSDK_STRING(
-+ " -mfe_frames <N> maximum number of frames to be combined in multi-frame encode pipeline"));
-+ msdk_printf(MSDK_STRING(" 0 - default for platform will be used\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -mfe_mode 0|1|2|3 multi-frame encode operation mode - should be the same for all sessions\n"));
-+ msdk_printf(MSDK_STRING(
-+ " 0, MFE operates as DEFAULT mode, decided by SDK if MFE enabled\n"));
-+ msdk_printf(MSDK_STRING(" 1, MFE is disabled\n"));
-+ msdk_printf(MSDK_STRING(" 2, MFE operates as AUTO mode\n"));
-+ msdk_printf(MSDK_STRING(" 3, MFE operates as MANUAL mode\n"));
-+
-+ msdk_printf(MSDK_STRING(
-+ " -mfe_timeout <N> multi-frame encode timeout in milliseconds - set per sessions control\n"));
-+#endif
-+
-+#ifdef ENABLE_MCTF
-+ #if !defined ENABLE_MCTF_EXT
-+ msdk_printf(MSDK_STRING(" -mctf [Strength]\n"));
-+ msdk_printf(MSDK_STRING(" Strength is an optional value; it is in range [0...20]\n"));
-+ msdk_printf(MSDK_STRING(" value 0 makes MCTF operates in auto mode;\n"));
-+ msdk_printf(MSDK_STRING(
-+ " Strength: integer, [0...20]. Default value is 0.Might be a CSV filename (upto 15 symbols); if a string is convertable to an integer, integer has a priority over filename\n"));
-+ msdk_printf(MSDK_STRING(
-+ " In fixed-strength mode, MCTF strength can be adjusted at framelevel;\n"));
-+ msdk_printf(MSDK_STRING(" If no Strength is given, MCTF operates in auto mode.\n"));
-+ #else
-+ msdk_printf(MSDK_STRING(" -mctf MctfMode:BitsPerPixel:Strength:ME:Overlap:DB\n"));
-+ msdk_printf(MSDK_STRING(
-+ " every parameter may be missed; in this case default value is used.\n"));
-+ msdk_printf(MSDK_STRING(" MctfMode: 0 - spatial filter\n"));
-+ msdk_printf(MSDK_STRING(" MctfMode: 1- temporal filtering, 1 backward reference\n"));
-+ msdk_printf(
-+ MSDK_STRING(" MctfMode: 2- temporal filtering, 1 backward & 1 forward reference\n"));
-+ msdk_printf(MSDK_STRING(
-+ " MctfMode: 3- temporal filtering, 2 backward & 2 forward references\n"));
-+ msdk_printf(MSDK_STRING(" MctfMode: other values: force default mode to be used\n"));
-+ msdk_printf(MSDK_STRING(
-+ " BitsPerPixel: float, valid range [0...12.0]; if exists, is used for automatic filter strength adaptation. Default is 0.0\n"));
-+ msdk_printf(MSDK_STRING(
-+ " Strength: integer, [0...20]. Default value is 0.Might be a CSV filename (upto 15 symbols); if a string is convertable to an integer, integer has a priority over filename\n"));
-+ msdk_printf(MSDK_STRING(
-+ " ME: Motion Estimation precision; 0 - integer ME (default); 1 - quater-pel ME\n"));
-+ msdk_printf(MSDK_STRING(
-+ " Overlap: 0 - do not apply overlap ME (default); 1 - to apply overlap ME\n"));
-+ msdk_printf(MSDK_STRING(
-+ " DB: 0 - do not apply deblock Filter (default); 1 - to apply Deblock Filter\n"));
-+ #endif //ENABLE_MCTF_EXT
-+#endif //ENABLE_MCTF
-+
-+ msdk_printf(MSDK_STRING(
-+ " -robust Recover from gpu hang errors as they come (by resetting components)\n"));
-+ msdk_printf(MSDK_STRING(" -robust:soft Recover from gpu hang errors by inserting an IDR\n"));
-+
-+ msdk_printf(MSDK_STRING(" -async Depth of asynchronous pipeline. default value 1\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -join Join session with other session(s), by default sessions are not joined\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -priority Use priority for join sessions. 0 - Low, 1 - Normal, 2 - High. Normal by default\n"));
-+ msdk_printf(MSDK_STRING(" -threads num Number of session internal threads to create\n"));
-+ msdk_printf(
-+ MSDK_STRING(" -n Number of frames to transcode\n") MSDK_STRING(
-+ " (session ends after this number of frames is reached). \n")
-+ MSDK_STRING(
-+ " In decoding sessions (-o::sink) this parameter limits number\n")
-+ MSDK_STRING(" of frames acquired from decoder.\n") MSDK_STRING(
-+ " In encoding sessions (-o::source) and transcoding sessions \n")
-+ MSDK_STRING(
-+ " this parameter limits number of frames sent to encoder.\n"));
-+
-+ msdk_printf(
-+ MSDK_STRING(" -MemType::video Force usage of external video allocator (default)\n"));
-+ msdk_printf(MSDK_STRING(" -MemType::system Force usage of external system allocator\n"));
-+ msdk_printf(MSDK_STRING(" -MemType::opaque Force usage of internal allocator\n"));
-+
-+ msdk_printf(MSDK_STRING(" -MemModel::GeneralAlloc (default)\n"));
-+ msdk_printf(MSDK_STRING(" Force usage of:\n"));
-+ msdk_printf(
-+ MSDK_STRING(" External allocator in the case of video/system memory type\n"));
-+ msdk_printf(
-+ MSDK_STRING(" Internal allocator in the case of opaque memory type\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -MemModel::VisibleIntAlloc Force usage of internal allocation with manual surfaces control\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -MemModel::HiddenIntAlloc Force usage of internal allocation without manual surfaces control\n"));
-+
-+ msdk_printf(MSDK_STRING(" -dec::sys Set dec output to system memory\n"));
-+ msdk_printf(MSDK_STRING(" -vpp::sys Set vpp output to system memory\n"));
-+ msdk_printf(MSDK_STRING(" -vpp::vid Set vpp output to video memory\n"));
-+ msdk_printf(MSDK_STRING(" -fps <frames per second>\n"));
-+ msdk_printf(MSDK_STRING(" Transcoding frame rate limit\n"));
-+ msdk_printf(MSDK_STRING(" -pe Set encoding plugin for this particular session.\n"));
-+ msdk_printf(MSDK_STRING(
-+ " This setting overrides plugin settings defined by SET clause.\n"));
-+ msdk_printf(MSDK_STRING(" -pd Set decoding plugin for this particular session.\n"));
-+ msdk_printf(MSDK_STRING(
-+ " This setting overrides plugin settings defined by SET clause.\n"));
-+ msdk_printf(MSDK_STRING(
-+ " Supported values: hevcd_sw, hevcd_hw, hevce_sw, hevce_gacc, hevce_hw, vp8d_hw, vp8e_hw, vp9d_hw, vp9e_hw, camera_hw, capture_hw, h264_la_hw, ptir_hw, hevce_fei_hw\n"));
-+ msdk_printf(MSDK_STRING(" Direct GUID number can be used as well\n"));
-+ msdk_printf(MSDK_STRING("\n"));
-+ msdk_printf(MSDK_STRING("Pipeline description (encoding options):\n"));
-+ MOD_SMT_PRINT_HELP;
-+ msdk_printf(MSDK_STRING(" -b <Kbits per second>\n"));
-+ msdk_printf(
-+ MSDK_STRING(" Encoded bit rate, valid for H.264, MPEG2 and MVC encoders\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -bm Bitrate multiplier. Use it when required bitrate isn't fit into 16-bit\n"));
-+ msdk_printf(MSDK_STRING(
-+ " Affects following parameters: InitialDelayInKB, BufferSizeInKB, TargetKbps, MaxKbps\n"));
-+ msdk_printf(MSDK_STRING(" -f <frames per second>\n"));
-+ msdk_printf(
-+ MSDK_STRING(" Video frame rate for the FRC and deinterlace options\n"));
-+ msdk_printf(MSDK_STRING(" -fe <frames per second>\n"));
-+ msdk_printf(MSDK_STRING(
-+ " Video frame rate for the FRC and deinterlace options (deprecated, will be removed in next versions).\n"));
-+ msdk_printf(MSDK_STRING(" -override_decoder_framerate <framerate> \n"));
-+ msdk_printf(MSDK_STRING(
-+ " Forces decoder output framerate to be set to provided value (overwriting actual framerate from decoder)\n"));
-+ msdk_printf(MSDK_STRING(" -override_encoder_framerate <framerate> \n"));
-+ msdk_printf(MSDK_STRING(
-+ " Overwrites framerate of stream going into encoder input with provided value (this option does not enable FRC, it just ovewrites framerate value)\n"));
-+ msdk_printf(MSDK_STRING(" -override_encoder_picstruct <picstruct> \n"));
-+ msdk_printf(MSDK_STRING(" Overwrites encoder picstruct with specific value"));
-+ msdk_printf(MSDK_STRING(
-+ " -u <usage> Target usage. Valid for H.265, H.264, MPEG2 and MVC encoders. Expected values:\n"));
-+ msdk_printf(MSDK_STRING(
-+ " veryslow(quality), slower, slow, medium(balanced), fast, faster, veryfast(speed)\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -q <quality> Quality parameter for JPEG encoder; in range [1,100], 100 is the best quality\n"));
-+ msdk_printf(MSDK_STRING(" -l numSlices Number of slices for encoder; default value 0 \n"));
-+ msdk_printf(MSDK_STRING(" -mss maxSliceSize \n"));
-+ msdk_printf(MSDK_STRING(
-+ " Maximum slice size in bytes. Supported only with -hw and h264 codec. This option is not compatible with -l option.\n"));
-+ msdk_printf(MSDK_STRING(" -BitrateLimit:<on,off>\n"));
-+ msdk_printf(MSDK_STRING(
-+ " Turn this flag ON to set bitrate limitations imposed by the SDK encoder. Off by default.\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -la Use the look ahead bitrate control algorithm (LA BRC) for H.264 encoder. Supported only with -hw option on 4th Generation Intel Core processors. \n"));
-+ msdk_printf(MSDK_STRING(
-+ " -lad depth Depth parameter for the LA BRC, the number of frames to be analyzed before encoding. In range [0,100] (0 - default: auto-select by mediasdk library).\n"));
-+ msdk_printf(
-+ MSDK_STRING(" May be 1 in the case when -mss option is specified \n"));
-+ msdk_printf(MSDK_STRING(
-+ " -la_ext Use external LA plugin (compatible with h264 & hevc encoders)\n"));
-+ msdk_printf(MSDK_STRING(" -vbr Variable bitrate control\n"));
-+ msdk_printf(MSDK_STRING(" -cbr Constant bitrate control\n"));
-+ msdk_printf(MSDK_STRING(" -vcm Video Conferencing Mode (VCM) bitrate control\n"));
-+ msdk_printf(MSDK_STRING(" -hrd <KBytes> Maximum possible size of any compressed frames \n"));
-+ msdk_printf(MSDK_STRING(" -wb <Kbits per second>\n"));
-+ msdk_printf(MSDK_STRING(" Maximum bitrate for sliding window\n"));
-+ msdk_printf(MSDK_STRING(" -ws Sliding window size in frames\n"));
-+ msdk_printf(MSDK_STRING(" -gop_size Size of GOP structure in frames \n"));
-+ msdk_printf(MSDK_STRING(" -dist Distance between I- or P- key frames \n"));
-+ msdk_printf(MSDK_STRING(" -num_ref Number of reference frames\n"));
-+ msdk_printf(MSDK_STRING(" -bref Arrange B frames in B pyramid reference structure\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -nobref Do not use B-pyramid (by default the decision is made by library)\n"));
-+ msdk_printf(MSDK_STRING(" -bpyr Enable B pyramid\n"));
-+ msdk_printf(
-+ MSDK_STRING(" -gpb:<on,off> - Enable or disable Generalized P/B frames\n"));
-+#if (MFX_VERSION >= 1026)
-+ msdk_printf(MSDK_STRING(" -TransformSkip:<on,off>- Enable or disable TransformSkip\n"));
-+#endif
-+ msdk_printf(MSDK_STRING(" -trows <rows> - Number of rows for tiled encoding\n"));
-+ msdk_printf(MSDK_STRING(" -tcols <cols> - Number of columns for tiled encoding\n"));
-+ msdk_printf(MSDK_STRING(" -CodecProfile - Specifies codec profile\n"));
-+ msdk_printf(MSDK_STRING(" -CodecLevel - Specifies codec level\n"));
-+ msdk_printf(MSDK_STRING(" -GopOptFlag:closed - Closed gop\n"));
-+ msdk_printf(MSDK_STRING(" -GopOptFlag:strict - Strict gop\n"));
-+ msdk_printf(MSDK_STRING(" -AdaptiveI:<on,off> - Turn Adaptive I frames on/off\n"));
-+ msdk_printf(MSDK_STRING(" -AdaptiveB:<on,off> - Turn Adaptive B frames on/off\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -InitialDelayInKB - The decoder starts decoding after the buffer reaches the initial size InitialDelayInKB, \n\
-+ which is equivalent to reaching an initial delay of InitialDelayInKB*8000/TargetKbps ms\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -MaxKbps - For variable bitrate control, specifies the maximum bitrate at which \n\
-+ the encoded data enters the Video Buffering Verifier buffer\n"));
-+ msdk_printf(MSDK_STRING(" -gpucopy::<on,off> Enable or disable GPU copy mode\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -repartitioncheck::<on,off> Enable or disable RepartitionCheckEnable mode\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -cqp Constant quantization parameter (CQP BRC) bitrate control method\n"));
-+ msdk_printf(MSDK_STRING(
-+ " (by default constant bitrate control method is used), should be used along with -qpi, -qpp, -qpb.\n"));
-+#if (MFX_VERSION >= 1022)
-+ msdk_printf(MSDK_STRING(
-+ " -qpi Constant quantizer for I frames (if bitrace control method is CQP). In range [1,51]. 0 by default, i.e.no limitations on QP.\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -qpp Constant quantizer for P frames (if bitrace control method is CQP). In range [1,51]. 0 by default, i.e.no limitations on QP.\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -qpb Constant quantizer for B frames (if bitrace control method is CQP). In range [1,51]. 0 by default, i.e.no limitations on QP.\n"));
-+#endif
-+ msdk_printf(MSDK_STRING(
-+ " -DisableQPOffset Disable QP adjustment for GOP pyramid-level frames\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -lowpower:<on,off> Turn this option ON to enable QuickSync Fixed Function (low-power HW) encoding mode\n"));
-+#if (MFX_VERSION >= 1027)
-+ msdk_printf(MSDK_STRING(
-+ " [-TargetBitDepthLuma] - Encoding target bit depth for luma samples, by default same as source one.\n"));
-+ msdk_printf(MSDK_STRING(
-+ " [-TargetBitDepthChroma] - Encoding target bit depth for chroma samples, by default same as source one.\n"));
-+#endif
-+#if MFX_VERSION >= 1022
-+ msdk_printf(MSDK_STRING(" -roi_file <roi-file-name>\n"));
-+ msdk_printf(MSDK_STRING(
-+ " Set Regions of Interest for each frame from <roi-file-name>\n"));
-+ msdk_printf(MSDK_STRING(" -roi_qpmap Use QP map to emulate ROI for CQP mode\n"));
-+ msdk_printf(MSDK_STRING(" -extmbqp Use external MBQP map\n"));
-+#endif //MFX_VERSION >= 1022
-+ msdk_printf(MSDK_STRING(
-+ " -AvcTemporalLayers [array:Layer.Scale] Configures the temporal layers hierarchy\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -BaseLayerPID <pid> Sets priority ID for the base layer\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -SPSId <pid> Sets sequence parameter set ID\n"));
-+ msdk_printf(
-+ MSDK_STRING(" -PPSId <pid> Sets picture parameter set ID\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -PicTimingSEI:<on,off> Enables or disables picture timing SEI\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -NalHrdConformance:<on,off> Enables or disables picture HRD conformance\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -VuiNalHrdParameters:<on,off> Enables or disables NAL HRD parameters in VUI header\n"));
-+
-+ msdk_printf(MSDK_STRING("\n"));
-+ msdk_printf(MSDK_STRING("Pipeline description (vpp options):\n"));
-+ msdk_printf(MSDK_STRING(" -deinterlace Forces VPP to deinterlace input stream\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -deinterlace::ADI Forces VPP to deinterlace input stream using ADI algorithm\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -deinterlace::ADI_SCD Forces VPP to deinterlace input stream using ADI_SCD algorithm\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -deinterlace::ADI_NO_REF Forces VPP to deinterlace input stream using ADI no ref algorithm\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -deinterlace::BOB Forces VPP to deinterlace input stream using BOB algorithm\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -detail <level> Enables detail (edge enhancement) filter with provided level(0..100)\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -denoise <level> Enables denoise filter with provided level (0..100)\n"));
-+ msdk_printf(
-+ MSDK_STRING(" -FRC::PT Enables FRC filter with Preserve Timestamp algorithm\n"));
-+ msdk_printf(
-+ MSDK_STRING(" -FRC::DT Enables FRC filter with Distributed Timestamp algorithm\n"));
-+ msdk_printf(
-+ MSDK_STRING(" -FRC::INTERP Enables FRC filter with Frame Interpolation algorithm\n"));
-+ msdk_printf(MSDK_STRING(" -scaling_mode <mode> Specifies scaling mode (lowpower/quality)\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -ec::nv12|rgb4|yuy2|nv16|p010|p210|y210|y410|p016|y216|y416 Forces encoder input to use provided chroma mode\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -dc::nv12|rgb4|yuy2|p010|y210|y410|p016|y216 Forces decoder output to use provided chroma mode\n"));
-+ msdk_printf(MSDK_STRING(
-+ " NOTE: chroma transform VPP may be automatically enabled if -ec/-dc parameters are provided\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -angle 180 Enables 180 degrees picture rotation user module before encoding\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -opencl Uses implementation of rotation plugin (enabled with -angle option) through Intel(R) OpenCL\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -w Destination picture width, invokes VPP resize or decoder fixed function resize engine (if -dec_postproc specified)\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -h Destination picture height, invokes VPP resize or decoder fixed function resize engine (if -dec_postproc specified)\n"));
-+ msdk_printf(MSDK_STRING(" -field_processing t2t|t2b|b2t|b2b|fr2fr - Field Copy feature\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -WeightedPred::default|implicit Enambles weighted prediction usage\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -WeightedBiPred::default|implicit Enambles weighted bi-prediction usage\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -ir_type - Intra refresh type. 0 - no refresh, 1 - vertical refresh, 2 - horisontal refresh, 3 - slice refresh\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -ir_cycle_size - Number of pictures within refresh cycle starting from 2\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -ir_qp_delta - QP difference for inserted intra MBs. This is signed value in [-51, 51] range\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -ir_cycle_dist - Distance between the beginnings of the intra-refresh cycles in frames\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -LowDelayBRC - strictly obey average frame size set by MaxKbps\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -amfs:<on,off> - adaptive max frame size. If set on, P or B frame size can exceed MaxFrameSize when the scene change is detected.\
-+ It can benefit the video quality \n"));
-+ msdk_printf(MSDK_STRING(
-+ " -mfs - maximum frame size in bytes. Supported only with h264 and hevc codec for VBR mode.\n"));
-+
-+#if (MFX_VERSION >= 1024)
-+ msdk_printf(MSDK_STRING(
-+ " -extbrc::<on,off,implicit> Enables external BRC for AVC and HEVC encoders\n"));
-+#endif
-+#if (MFX_VERSION >= 1026)
-+ msdk_printf(
-+ MSDK_STRING(" -ExtBrcAdaptiveLTR:<on,off> Set AdaptiveLTR for implicit extbrc"));
-+#endif
-+ msdk_printf(MSDK_STRING(
-+ " -vpp_comp <sourcesNum> Enables composition from several decoding sessions. Result is written to the file\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -vpp_comp_only <sourcesNum> Enables composition from several decoding sessions. Result is shown on screen\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -vpp_comp_num_tiles <Num> Quantity of tiles for composition. if equal to 0 tiles processing ignored\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -vpp_comp_dst_x X position of this stream in composed stream (should be used in decoder session)\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -vpp_comp_dst_y Y position of this stream in composed stream (should be used in decoder session)\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -vpp_comp_dst_h Height of this stream in composed stream (should be used in decoder session)\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -vpp_comp_dst_w Width of this stream in composed stream (should be used in decoder session)\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -vpp_comp_src_h Width of this stream in composed stream (should be used in decoder session)\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -vpp_comp_src_w Width of this stream in composed stream (should be used in decoder session)\n"));
-+#if MFX_VERSION >= 1023
-+ msdk_printf(MSDK_STRING(
-+ " -vpp_comp_tile_id Tile_id for current channel of composition (should be used in decoder session)\n"));
-+#endif
-+ msdk_printf(MSDK_STRING(
-+ " -vpp_comp_dump <file-name> Dump of VPP Composition's output into file. Valid if with -vpp_comp* options\n"));
-+ msdk_printf(MSDK_STRING(
-+ " -vpp_comp_dump null_render Disabling rendering after VPP Composition. This is for performance measurements\n"));
-+#if MFX_VERSION >= 1022
-+ msdk_printf(MSDK_STRING(
-+ " -dec_postproc Resize after decoder using direct pipe (should be used in decoder session)\n"));
-+ msdk_printf(
-+ MSDK_STRING(" -single_texture_d3d11 single texture mode for d3d11 allocator \n"));
-+#endif //MFX_VERSION >= 1022
-+ msdk_printf(MSDK_STRING(
-+ " -preset <default,dss,conference,gaming> Use particular preset for encoding parameters\n"));
-+ msdk_printf(MSDK_STRING(" -pp Print preset parameters\n"));
-+
-+ msdk_printf(MSDK_STRING("\n"));
-+ msdk_printf(MSDK_STRING("ParFile format:\n"));
-+ msdk_printf(MSDK_STRING(
-+ " ParFile is extension of what can be achieved by setting pipeline in the command\n"));
-+ msdk_printf(MSDK_STRING(
-+ "line. For more information on ParFile format see readme-multi-transcode.pdf\n"));
-+ msdk_printf(MSDK_STRING("\n"));
-+ msdk_printf(MSDK_STRING("Examples:\n"));
-+ msdk_printf(MSDK_STRING(" sample_multi_transcode -i::mpeg2 in.mpeg2 -o::h264 out.h264\n"));
-+ msdk_printf(
-+ MSDK_STRING(" sample_multi_transcode -i::mvc in.mvc -o::mvc out.mvc -w 320 -h 240\n"));
-+}
-+
-+void TranscodingSample::PrintInfo(mfxU32 session_number, sInputParams* pParams, mfxVersion* pVer) {
-+ msdk_char buf[2048];
-+ MSDK_CHECK_POINTER_NO_RET(pVer);
-+
-+ if ((MFX_IMPL_AUTO <= pParams->libType) && (MFX_IMPL_HARDWARE4 >= pParams->libType)) {
-+ msdk_printf(MSDK_STRING("MFX %s Session %d API ver %d.%d parameters: \n"),
-+ (MFX_IMPL_SOFTWARE == pParams->libType) ? MSDK_STRING("SOFTWARE")
-+ : MSDK_STRING("HARDWARE"),
-+ session_number,
-+ pVer->Major,
-+ pVer->Minor);
-+ }
-+
-+ if (0 == pParams->DecodeId)
-+ msdk_printf(MSDK_STRING("Input video: From parent session\n"));
-+ else
-+ msdk_printf(MSDK_STRING("Input video: %s\n"), CodecIdToStr(pParams->DecodeId).c_str());
-+
-+ // means that source is parent session
-+ if (0 == pParams->EncodeId)
-+ msdk_printf(MSDK_STRING("Output video: To child session\n"));
-+ else
-+ msdk_printf(MSDK_STRING("Output video: %s\n"), CodecIdToStr(pParams->EncodeId).c_str());
-+ if (PrintDllInfo(buf, MSDK_ARRAY_LEN(buf), pParams))
-+ msdk_printf(MSDK_STRING("MFX dll: %s\n"), buf);
-+ msdk_printf(MSDK_STRING("\n"));
-+}
-+
-+bool TranscodingSample::PrintDllInfo(msdk_char* buf, mfxU32 buf_size, sInputParams* pParams) {
-+#if defined(_WIN32) || defined(_WIN64)
-+ HANDLE hCurrent = GetCurrentProcess();
-+ HMODULE* pModules;
-+ DWORD cbNeeded;
-+ int nModules;
-+ if (NULL == EnumProcessModules(hCurrent, NULL, 0, &cbNeeded))
-+ return false;
-+
-+ nModules = cbNeeded / sizeof(HMODULE);
-+
-+ pModules = new HMODULE[nModules];
-+ if (NULL == pModules) {
-+ return false;
-+ }
-+ if (NULL == EnumProcessModules(hCurrent, pModules, cbNeeded, &cbNeeded)) {
-+ delete[] pModules;
-+ return false;
-+ }
-+
-+ for (int i = 0; i < nModules; i++) {
-+ GetModuleFileName(pModules[i], buf, buf_size);
-+ if (_tcsstr(buf, MSDK_STRING("libmfxhw")) && (MFX_IMPL_SOFTWARE != pParams->libType)) {
-+ delete[] pModules;
-+ return true;
-+ }
-+ else if (_tcsstr(buf, MSDK_STRING("libmfxsw")) && (MFX_IMPL_SOFTWARE == pParams->libType)) {
-+ delete[] pModules;
-+ return true;
-+ }
-+ }
-+ delete[] pModules;
-+ return false;
-+#else
-+ return false;
-+#endif
-+}
-+
-+CmdProcessor::CmdProcessor() {
-+ m_SessionParamId = 0;
-+ m_SessionArray.clear();
-+ m_decoderPlugins.clear();
-+ m_encoderPlugins.clear();
-+ m_PerfFILE = NULL;
-+ m_parName = NULL;
-+ m_nTimeout = 0;
-+ statisticsWindowSize = 0;
-+ statisticsLogFile = NULL;
-+ DumpLogFileName.clear();
-+ shouldUseGreedyFormula = false;
-+ bRobustFlag = false;
-+ bSoftRobustFlag = false;
-+
-+} //CmdProcessor::CmdProcessor()
-+
-+CmdProcessor::~CmdProcessor() {
-+ m_SessionArray.clear();
-+ m_decoderPlugins.clear();
-+ m_encoderPlugins.clear();
-+ if (m_PerfFILE)
-+ fclose(m_PerfFILE);
-+ if (statisticsLogFile)
-+ fclose(statisticsLogFile);
-+
-+} //CmdProcessor::~CmdProcessor()
-+
-+void CmdProcessor::PrintParFileName() {
-+ if (m_parName && m_PerfFILE) {
-+ msdk_fprintf(m_PerfFILE, MSDK_STRING("Input par file: %s\n\n"), m_parName);
-+ }
-+}
-+
-+msdk_string CmdProcessor::GetLine(mfxU32 n) {
-+ if (m_lines.size() > n)
-+ return m_lines[n];
-+ return msdk_string();
-+}
-+
-+mfxStatus CmdProcessor::ParseCmdLine(int argc, msdk_char* argv[]) {
-+ FILE* parFile = NULL;
-+ mfxStatus sts = MFX_ERR_UNSUPPORTED;
-+
-+ if (1 == argc) {
-+ PrintError(MSDK_STRING("Too few parameters"), NULL);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ --argc;
-+ ++argv;
-+
-+ while (argv[0]) {
-+ if (0 == msdk_strcmp(argv[0], MSDK_STRING("-par"))) {
-+ --argc;
-+ ++argv;
-+ if (!argv[0]) {
-+ msdk_printf(MSDK_STRING("error: no argument given for '-par' option\n"));
-+ }
-+ m_parName = argv[0];
-+ }
-+ else if (0 == msdk_strcmp(argv[0], MSDK_STRING("-timeout"))) {
-+ --argc;
-+ ++argv;
-+ if (!argv[0]) {
-+ msdk_printf(MSDK_STRING("error: no argument given for '-timeout' option\n"));
-+ }
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[0], m_nTimeout)) {
-+ msdk_printf(MSDK_STRING("error: -timeout \"%s\" is invalid"), argv[0]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[0], MSDK_STRING("-robust"))) {
-+ bRobustFlag = true;
-+ }
-+ else if (0 == msdk_strcmp(argv[0], MSDK_STRING("-robust:soft"))) {
-+ bSoftRobustFlag = true;
-+ }
-+ else if (0 == msdk_strcmp(argv[0], MSDK_STRING("-?"))) {
-+ PrintHelp();
-+ return MFX_WRN_OUT_OF_RANGE;
-+ }
-+ else if (0 == msdk_strcmp(argv[0], MSDK_STRING("-greedy"))) {
-+ shouldUseGreedyFormula = true;
-+ }
-+ else if (0 == msdk_strcmp(argv[0], MSDK_STRING("-p"))) {
-+ if (m_PerfFILE) {
-+ msdk_printf(MSDK_STRING("error: only one performance file is supported"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ --argc;
-+ ++argv;
-+ if (!argv[0]) {
-+ msdk_printf(MSDK_STRING("error: no argument given for '-p' option\n"));
-+ }
-+ MSDK_FOPEN(m_PerfFILE, argv[0], MSDK_STRING("w"));
-+ if (NULL == m_PerfFILE) {
-+ msdk_printf(MSDK_STRING("error: performance file \"%s\" not found"), argv[0]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[0], MSDK_STRING("--"))) {
-+ // just skip separator "--" which delimits cmd options and pipeline settings
-+ break;
-+ }
-+ else if (0 == msdk_strcmp(argv[0], MSDK_STRING("-stat"))) {
-+ --argc;
-+ ++argv;
-+ if (!argv[0]) {
-+ msdk_printf(MSDK_STRING("error: no argument given for 'stat' option\n"));
-+ }
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[0], statisticsWindowSize)) {
-+ msdk_printf(MSDK_STRING("error: stat \"%s\" is invalid"), argv[0]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[0], MSDK_STRING("-stat-log"))) {
-+ if (statisticsLogFile) {
-+ msdk_printf(MSDK_STRING("error: only one statistics file is supported"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ --argc;
-+ ++argv;
-+ if (!argv[0]) {
-+ msdk_printf(MSDK_STRING("error: no argument given for 'stat-log' option\n"));
-+ }
-+ MSDK_FOPEN(statisticsLogFile, argv[0], MSDK_STRING("w"));
-+ if (NULL == statisticsLogFile) {
-+ msdk_printf(MSDK_STRING("error: statistics file \"%s\" not found"), argv[0]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[0], MSDK_STRING("-stat-per-frame"))) {
-+ if (!DumpLogFileName.empty()) {
-+ msdk_printf(MSDK_STRING("error: only one dump file is supported"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ --argc;
-+ ++argv;
-+ if (!argv[0]) {
-+ msdk_printf(MSDK_STRING("error: no argument given for 'stat-dump' option\n"));
-+ }
-+ DumpLogFileName = argv[0];
-+ }
-+ else {
-+ break;
-+ }
-+ --argc;
-+ ++argv;
-+ }
-+
-+ msdk_printf(MSDK_STRING("Multi Transcoding Sample Version %s\n\n"),
-+ GetMSDKSampleVersion().c_str());
-+
-+ //Read pipeline from par file
-+ if (m_parName && !argv[0]) {
-+ MSDK_FOPEN(parFile, m_parName, MSDK_STRING("r"));
-+ if (NULL == parFile) {
-+ msdk_printf(MSDK_STRING("error: ParFile \"%s\" not found\n"), m_parName);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ if (NULL != m_parName)
-+ msdk_printf(MSDK_STRING("Par file is: %s\n\n"), m_parName);
-+
-+ sts = ParseParFile(parFile);
-+
-+ if (MFX_ERR_NONE != sts) {
-+ fclose(parFile);
-+ return sts;
-+ }
-+
-+ fclose(parFile);
-+ }
-+ //Read pipeline from cmd line
-+ else if (!argv[0]) {
-+ msdk_printf(MSDK_STRING("error: pipeline description not found\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ else if (argv[0] && m_parName) {
-+ msdk_printf(MSDK_STRING(
-+ "error: simultaneously enabling parfile and description pipeline from command line forbidden\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ else {
-+ sts = ParseParamsForOneSession(argc, argv);
-+ if (MFX_ERR_NONE != sts) {
-+ msdk_printf(MSDK_STRING("error: pipeline description is invalid\n"));
-+ return sts;
-+ }
-+ }
-+
-+ return sts;
-+
-+} //mfxStatus CmdProcessor::ParseCmdLine(int argc, msdk_char *argv[])
-+
-+mfxStatus CmdProcessor::ParseParFile(FILE* parFile) {
-+ mfxStatus sts = MFX_ERR_UNSUPPORTED;
-+ if (!parFile)
-+ return MFX_ERR_UNSUPPORTED;
-+
-+ mfxU32 currPos = 0;
-+ mfxU32 lineIndex = 0;
-+
-+ // calculate file size
-+ fseek(parFile, 0, SEEK_END);
-+ mfxU32 fileSize = ftell(parFile) + 1;
-+ fseek(parFile, 0, SEEK_SET);
-+
-+ // allocate buffer for parsing
-+ std::unique_ptr<msdk_char[]> parBuf(new msdk_char[fileSize]);
-+ msdk_char* pCur;
-+
-+ while (currPos < fileSize) {
-+ pCur = /*_fgetts*/ msdk_fgets(parBuf.get(), fileSize, parFile);
-+ if (!pCur)
-+ return MFX_ERR_NONE;
-+ while (pCur[currPos] != '\n' && pCur[currPos] != 0) {
-+ currPos++;
-+ if (pCur + currPos >= parBuf.get() + fileSize)
-+ return sts;
-+ }
-+ // zero string
-+ if (!currPos)
-+ continue;
-+
-+ sts = TokenizeLine(pCur, currPos);
-+ MSDK_CHECK_STATUS(sts, "TokenizeLine failed");
-+
-+ currPos = 0;
-+ lineIndex++;
-+ }
-+
-+ return MFX_ERR_NONE;
-+
-+} //mfxStatus CmdProcessor::ParseParFile(FILE *parFile)
-+
-+// calculate length of string literal, including leading and trailing "
-+// pTempLine = start of string (must begin with ")
-+// length = remaining characters in pTempLine
-+// returns length of string, or 0 if error
-+mfxU32 CmdProcessor::GetStringLength(msdk_char* pTempLine, mfxU32 length) {
-+ mfxU32 i;
-+
-+ // error - no leading " found
-+ if (pTempLine[0] != '\"')
-+ return 0;
-+
-+ for (i = 1; i < length; i++) {
-+ if (pTempLine[i] == '\"')
-+ break;
-+ }
-+
-+ // error - no closing " found
-+ if (i == length)
-+ return 0;
-+
-+ return i + 1;
-+}
-+
-+mfxStatus CmdProcessor::TokenizeLine(msdk_char* pLine, mfxU32 length) {
-+ mfxU32 i, strArgLen;
-+ const mfxU8 maxArgNum = 255;
-+ msdk_char* argv[maxArgNum + 1];
-+ mfxU32 argc = 0;
-+ std::unique_ptr<msdk_char[]> pMemLine(new msdk_char[length + 2]);
-+
-+ msdk_char* pTempLine = pMemLine.get();
-+ pTempLine[0] = ' ';
-+ pTempLine++;
-+
-+ MSDK_MEMCPY_BUF(pTempLine, 0, length * sizeof(msdk_char), pLine, length * sizeof(msdk_char));
-+
-+ // parse into command streams
-+ for (i = 0; i < length; i++) {
-+ // check if separator
-+ if (IS_SEPARATOR(pTempLine[-1]) && !IS_SEPARATOR(pTempLine[0])) {
-+ argv[argc++] = pTempLine;
-+ if (argc > maxArgNum) {
-+ PrintError(MSDK_STRING("Too many parameters (reached maximum of %d)"), maxArgNum);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+
-+ if (*pTempLine == '\"') {
-+ strArgLen = GetStringLength(pTempLine, length - i);
-+ if (!strArgLen) {
-+ PrintError(MSDK_STRING("Error parsing string literal"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ // remove leading and trailing ", bump pointer ahead to next argument
-+ pTempLine[0] = ' ';
-+ pTempLine[strArgLen - 1] = ' ';
-+ pTempLine += strArgLen;
-+ i += strArgLen;
-+ }
-+
-+ if (*pTempLine == ' ' || *pTempLine == '\r' || *pTempLine == '\n') {
-+ *pTempLine = 0;
-+ }
-+ pTempLine++;
-+ }
-+
-+ // EOL for last parameter
-+ pTempLine[0] = 0;
-+
-+ return ParseParamsForOneSession(argc, argv);
-+}
-+
-+#if MFX_VERSION >= 1022
-+bool CmdProcessor::isspace(char a) {
-+ return (std::isspace(a) != 0);
-+}
-+
-+bool CmdProcessor::is_not_allowed_char(char a) {
-+ return (std::isdigit(a) == 0) && (std::isspace(a) == 0) && (a != ';') && (a != '-');
-+}
-+
-+bool CmdProcessor::ParseROIFile(const msdk_char* roi_file_name,
-+ std::vector<mfxExtEncoderROI>& m_ROIData) {
-+ FILE* roi_file = NULL;
-+ MSDK_FOPEN(roi_file, roi_file_name, MSDK_STRING("rb"));
-+
-+ m_ROIData.clear();
-+
-+ if (roi_file) {
-+ // read file to buffer
-+ fseek(roi_file, 0, SEEK_END);
-+ long file_size = ftell(roi_file);
-+ rewind(roi_file);
-+ std::vector<char> buffer(file_size);
-+ char* roi_data = &buffer[0];
-+ if (file_size < 0 || (size_t)file_size != fread(roi_data, 1, file_size, roi_file)) {
-+ fclose(roi_file);
-+ return false;
-+ }
-+ fclose(roi_file);
-+
-+ // search for not allowed characters
-+ char* not_allowed_char = std::find_if(roi_data, roi_data + file_size, is_not_allowed_char);
-+ if (not_allowed_char != (roi_data + file_size)) {
-+ return false;
-+ }
-+
-+ // get unformatted roi data
-+ std::string unformatted_roi_data;
-+ unformatted_roi_data.clear();
-+ std::remove_copy_if(roi_data,
-+ roi_data + file_size,
-+ std::inserter(unformatted_roi_data, unformatted_roi_data.end()),
-+ isspace);
-+
-+ // split data to items
-+ std::stringstream unformatted_roi_data_ss(unformatted_roi_data);
-+ std::vector<std::string> items;
-+ items.clear();
-+ std::string item;
-+ while (std::getline(unformatted_roi_data_ss, item, ';')) {
-+ items.push_back(item);
-+ }
-+
-+ // parse data and store roi data for each frame
-+ unsigned int item_ind = 0;
-+ while (1) {
-+ if (item_ind >= items.size())
-+ break;
-+
-+ mfxExtEncoderROI frame_roi;
-+ std::memset(&frame_roi, 0, sizeof(frame_roi));
-+ frame_roi.Header.BufferId = MFX_EXTBUFF_ENCODER_ROI;
-+ #if (MFX_VERSION >= 1022)
-+ frame_roi.ROIMode = MFX_ROI_MODE_QP_DELTA;
-+ #endif
-+
-+ int roi_num = std::atoi(items[item_ind].c_str());
-+ if (roi_num < 0 || roi_num > (int)(sizeof(frame_roi.ROI) / sizeof(frame_roi.ROI[0]))) {
-+ m_ROIData.clear();
-+ return false;
-+ }
-+ if ((item_ind + 5 * roi_num) >= items.size()) {
-+ m_ROIData.clear();
-+ return false;
-+ }
-+
-+ for (int i = 0; i < roi_num; i++) {
-+ // do not handle out of range integer errors
-+ frame_roi.ROI[i].Left = std::atoi(items[item_ind + i * 5 + 1].c_str());
-+ frame_roi.ROI[i].Top = std::atoi(items[item_ind + i * 5 + 2].c_str());
-+ frame_roi.ROI[i].Right = std::atoi(items[item_ind + i * 5 + 3].c_str());
-+ frame_roi.ROI[i].Bottom = std::atoi(items[item_ind + i * 5 + 4].c_str());
-+ #if (MFX_VERSION >= 1022)
-+ frame_roi.ROI[i].DeltaQP = (mfxI16)std::atoi(items[item_ind + i * 5 + 5].c_str());
-+ #endif
-+ }
-+ frame_roi.NumROI = (mfxU16)roi_num;
-+ m_ROIData.push_back(frame_roi);
-+ item_ind = item_ind + roi_num * 5 + 1;
-+ }
-+ }
-+ else {
-+ return false;
-+ }
-+ return true;
-+}
-+#endif //MFX_VERSION >= 1022
-+#ifdef ENABLE_MCTF
-+
-+// returns a pointer to start of argument with a number argn;
-+// if failes to find argn, returns NULL
-+msdk_char* ParseArgn(msdk_char* pIn, mfxU32 argn, msdk_char separator) {
-+ msdk_char* pstr = pIn;
-+ if (!argn)
-+ return pIn;
-+ else {
-+ for (mfxU32 n = 0; n != argn; ++n) {
-+ while (separator != *pstr && msdk_char('\0') != *pstr)
-+ ++pstr;
-+ if (msdk_char('\0') == *pstr)
-+ return NULL;
-+ else
-+ ++pstr;
-+ }
-+ return pstr;
-+ }
-+};
-+
-+template <typename T>
-+bool ArgConvert(msdk_char* pIn,
-+ mfxU32 argn,
-+ const msdk_char* pattern,
-+ T* pArg,
-+ const T& ArgDefault,
-+ mfxU32& NumOfGoodConverts) {
-+ bool bConvertIsOk = false;
-+ msdk_char* pargs = ParseArgn(pIn, argn, msdk_char(':'));
-+ if (pargs) {
-+ if (!msdk_sscanf(pargs, pattern, pArg))
-+ *pArg = ArgDefault;
-+ else {
-+ ++NumOfGoodConverts;
-+ bConvertIsOk = true;
-+ }
-+ };
-+ return bConvertIsOk;
-+}
-+
-+//template <typename T=msdk_string>
-+bool ArgConvert(msdk_char* pIn,
-+ mfxU32 argn,
-+ const msdk_char* pattern,
-+ msdk_char* pArg,
-+ mfxU32 MaxChars2Read,
-+ mfxU32& NumOfGoodConverts) {
-+ bool bConvertIsOk = false;
-+ msdk_char* pargs = ParseArgn(pIn, argn, msdk_char(':'));
-+ if (pargs) {
-+ // lets calculate length of potential name:
-+ msdk_char* temp(pargs);
-+ while (*temp != msdk_char(':') && *temp != msdk_char('\0'))
-+ ++temp;
-+ std::iterator_traits<msdk_char*>::difference_type distance = std::distance(pargs, temp);
-+ if (distance < std::iterator_traits<msdk_char*>::difference_type(MaxChars2Read)) {
-+ if (msdk_sscanf(pargs, pattern, pArg, MaxChars2Read)) {
-+ ++NumOfGoodConverts;
-+ bConvertIsOk = true;
-+ }
-+ };
-+ };
-+ return bConvertIsOk;
-+}
-+
-+void ParseMCTFParams(msdk_char* strInput[], mfxU32 nArgNum, mfxU32& curArg, sInputParams* pParams) {
-+ mfxU32& i = curArg;
-+ if (0 == msdk_strcmp(strInput[i], MSDK_STRING("-mctf"))) {
-+ pParams->mctfParam.mode = VPP_FILTER_ENABLED_DEFAULT;
-+ pParams->mctfParam.params.FilterStrength = 0;
-+ pParams->mctfParam.rtParams.Reset();
-+ bool bFSByValue = true;
-+ #if defined ENABLE_MCTF_EXT
-+ pParams->mctfParam.params.TemporalMode = MFX_MCTF_TEMPORAL_MODE_2REF; // default
-+ pParams->mctfParam.params.BitsPerPixelx100k = 0;
-+ pParams->mctfParam.params.Deblocking = MFX_CODINGOPTION_OFF;
-+ pParams->mctfParam.params.Overlap = MFX_CODINGOPTION_OFF;
-+ pParams->mctfParam.params.MVPrecision = MFX_MVPRECISION_INTEGER;
-+ #endif
-+
-+ if (i + 1 < nArgNum) {
-+ mfxU16 _strength(0);
-+ mfxU32 strength_idx = 0;
-+ mfxU32 ParsedArgsNumber = 0;
-+ const mfxU32 max_name_len = 15;
-+ const mfxU32 max_elems_in_file = 10000;
-+ msdk_stringstream file_pattern;
-+ file_pattern << MSDK_STRING("%") << max_name_len << MSDK_STRING("ls:%*c") << std::ends;
-+ msdk_char _tmp_str[max_name_len + 1];
-+ memset(_tmp_str, 0, sizeof(_tmp_str));
-+ #if defined ENABLE_MCTF_EXT
-+ strength_idx = 2;
-+ #endif
-+ //the order of arguments is:
-+ // MctfMode:BitsPerPixel:Strength:ME:Overlap:DB
-+ // try to read fs defined as a value:
-+ bool res = ArgConvert(strInput[i + 1],
-+ strength_idx,
-+ MSDK_STRING("%hd:%*c"),
-+ &_strength,
-+ _strength,
-+ ParsedArgsNumber);
-+ if (!res) {
-+ bFSByValue = false;
-+ // if it was not possible, try to get a file-name (upto 15 chars):
-+ res = ArgConvert(strInput[i + 1],
-+ strength_idx,
-+ file_pattern.str().c_str(),
-+ &(_tmp_str[0]),
-+ max_name_len,
-+ ParsedArgsNumber);
-+ if (res) {
-+ msdk_fstream fs_file(_tmp_str, std::ios_base::in);
-+ if (!fs_file.is_open()) {
-+ msdk_printf(MSDK_STRING(
-+ "MCTF Filter-strength file is not exist; decay to default FS value;.\n"));
-+ bFSByValue = true;
-+ }
-+ else {
-+ mfxU32 nOfRTParams(0);
-+ for (msdk_string line; std::getline(fs_file, line, msdk_char(',')) &&
-+ nOfRTParams < max_elems_in_file;
-+ ++nOfRTParams) {
-+ // currently, there is just 1 param in the file;
-+ sMctfRunTimeParam tmp;
-+ if (msdk_sscanf(line.c_str(),
-+ MSDK_STRING("%hu:%*c"),
-+ &(tmp.FilterStrength)))
-+ pParams->mctfParam.rtParams.RunTimeParams.push_back(tmp);
-+ else {
-+ msdk_printf(MSDK_STRING(
-+ "there was an error met during parsing FS file;.only a few values were parsed.\n"));
-+ break;
-+ }
-+ }
-+ }
-+ }
-+ else
-+ bFSByValue = true;
-+ }
-+ #if defined ENABLE_MCTF_EXT
-+ mfxU16 _refnum(2);
-+ mfxF64 _bitsperpixel(0.0);
-+ mfxU16 _me_precision(0);
-+ mfxU16 _overlap(0);
-+ mfxU16 _deblock(0);
-+
-+ ArgConvert(strInput[i + 1],
-+ 0,
-+ MSDK_STRING("%hd:%*c"),
-+ &_refnum,
-+ _refnum,
-+ ParsedArgsNumber);
-+ ArgConvert(strInput[i + 1],
-+ 1,
-+ MSDK_STRING("%lf:%*c"),
-+ &_bitsperpixel,
-+ _bitsperpixel,
-+ ParsedArgsNumber);
-+ ArgConvert(strInput[i + 1],
-+ 3,
-+ MSDK_STRING("%hd:%*c"),
-+ &_me_precision,
-+ _me_precision,
-+ ParsedArgsNumber);
-+ ArgConvert(strInput[i + 1],
-+ 4,
-+ MSDK_STRING("%hd:%*c"),
-+ &_overlap,
-+ _overlap,
-+ ParsedArgsNumber);
-+ ArgConvert(strInput[i + 1],
-+ 5,
-+ MSDK_STRING("%hd:%*c"),
-+ &_deblock,
-+ _deblock,
-+ ParsedArgsNumber);
-+ #endif
-+ if (0 == ParsedArgsNumber) {
-+ pParams->mctfParam.mode = VPP_FILTER_ENABLED_DEFAULT;
-+ msdk_printf(MSDK_STRING("MCTF works in default mode; no parameters are passed.\n"));
-+ }
-+ else {
-+ pParams->mctfParam.mode = VPP_FILTER_ENABLED_CONFIGURED;
-+ pParams->mctfParam.rtParams.Restart();
-+ if (bFSByValue) {
-+ pParams->mctfParam.params.FilterStrength = _strength;
-+ }
-+ else {
-+ // take very first FS value from the file and use it as a value for FilterStrength
-+ if (pParams->mctfParam.rtParams.GetCurParam()) {
-+ pParams->mctfParam.params.FilterStrength =
-+ pParams->mctfParam.rtParams.GetCurParam()->FilterStrength;
-+ }
-+ }
-+ #if defined ENABLE_MCTF_EXT
-+ pParams->mctfParam.params.BitsPerPixelx100k =
-+ mfxU32(_bitsperpixel * MCTF_BITRATE_MULTIPLIER);
-+ switch (_refnum) {
-+ case 0:
-+ pParams->mctfParam.params.TemporalMode = MFX_MCTF_TEMPORAL_MODE_SPATIAL;
-+ break;
-+ case 1:
-+ pParams->mctfParam.params.TemporalMode = MFX_MCTF_TEMPORAL_MODE_1REF;
-+ break;
-+ case 2:
-+ pParams->mctfParam.params.TemporalMode = MFX_MCTF_TEMPORAL_MODE_2REF;
-+ break;
-+ case 3:
-+ pParams->mctfParam.params.TemporalMode = MFX_MCTF_TEMPORAL_MODE_4REF;
-+ break;
-+ default:
-+ pParams->mctfParam.params.TemporalMode = MFX_MCTF_TEMPORAL_MODE_UNKNOWN;
-+ };
-+ switch (_deblock) {
-+ case 0:
-+ pParams->mctfParam.params.Deblocking = MFX_CODINGOPTION_OFF;
-+ break;
-+ case 1:
-+ pParams->mctfParam.params.Deblocking = MFX_CODINGOPTION_ON;
-+ break;
-+ default:
-+ pParams->mctfParam.params.Deblocking = MFX_CODINGOPTION_UNKNOWN;
-+ };
-+ switch (_overlap) {
-+ case 0:
-+ pParams->mctfParam.params.Overlap = MFX_CODINGOPTION_OFF;
-+ break;
-+ case 1:
-+ pParams->mctfParam.params.Overlap = MFX_CODINGOPTION_ON;
-+ break;
-+ default:
-+ pParams->mctfParam.params.Overlap = MFX_CODINGOPTION_UNKNOWN;
-+ };
-+ switch (_me_precision) {
-+ case 0:
-+ pParams->mctfParam.params.MVPrecision = MFX_MVPRECISION_INTEGER;
-+ break;
-+ case 1:
-+ pParams->mctfParam.params.MVPrecision = MFX_MVPRECISION_QUARTERPEL;
-+ break;
-+ default:
-+ pParams->mctfParam.params.MVPrecision = MFX_MVPRECISION_UNKNOWN;
-+ };
-+ #endif
-+ }
-+ if (ParsedArgsNumber)
-+ i++;
-+ }
-+ else {
-+ msdk_printf(MSDK_STRING("MCTF works in default mode; no parameters are passed.\n"));
-+ }
-+ }
-+}
-+#endif
-+
-+// return values:
-+// 0 if argv[i] is processed successfully (MFX_ERR_NONE)
-+// < 1 if argv[i] is processed and generates an error OR argv[i] is not processed (no match)
-+mfxStatus ParseAdditionalParams(msdk_char* argv[],
-+ mfxU32 argc,
-+ mfxU32& i,
-+ TranscodingSample::sInputParams& InputParams) {
-+ if (0 == msdk_strcmp(argv[i], MSDK_STRING("-AvcTemporalLayers"))) {
-+ InputParams.nAvcTemp = 1;
-+ VAL_CHECK(i + 1 >= argc, i, argv[i]);
-+ mfxU16 arr[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
-+ int j, k;
-+ k = msdk_sscanf(argv[i + 1],
-+ MSDK_STRING("%hu %hu %hu %hu %hu %hu %hu %hu"),
-+ &arr[0],
-+ &arr[1],
-+ &arr[2],
-+ &arr[3],
-+ &arr[4],
-+ &arr[5],
-+ &arr[6],
-+ &arr[7]);
-+ if (k != 8) {
-+ PrintError(argv[0], MSDK_STRING("Invalid number of layers for AvcTemporalLayers"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ for (j = 0; j < 8; j++) {
-+ InputParams.nAvcTemporalLayers[j] = arr[j];
-+ }
-+ i += 1;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-BaseLayerPID"))) {
-+ VAL_CHECK(i + 1 >= argc, i, argv[i]);
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[++i], InputParams.nBaseLayerPID)) {
-+ PrintError(argv[0], MSDK_STRING("BaseLayerPID is invalid"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-SPSId"))) {
-+ VAL_CHECK(i + 1 >= argc, i, argv[i]);
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[++i], InputParams.nSPSId)) {
-+ PrintError(argv[0], MSDK_STRING("SPSId is invalid"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-PPSId"))) {
-+ VAL_CHECK(i + 1 >= argc, i, argv[i]);
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[++i], InputParams.nPPSId)) {
-+ PrintError(argv[0], MSDK_STRING("PPSId is invalid"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-lowpower:on"))) {
-+ InputParams.enableQSVFF = true;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-lowpower:off"))) {
-+ InputParams.enableQSVFF = false;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-PicTimingSEI:on"))) {
-+ InputParams.nPicTimingSEI = MFX_CODINGOPTION_ON;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-PicTimingSEI:off"))) {
-+ InputParams.nPicTimingSEI = MFX_CODINGOPTION_OFF;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-NalHrdConformance:on"))) {
-+ InputParams.nNalHrdConformance = MFX_CODINGOPTION_ON;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-NalHrdConformance:off"))) {
-+ InputParams.nNalHrdConformance = MFX_CODINGOPTION_OFF;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-VuiNalHrdParameters:on"))) {
-+ InputParams.nVuiNalHrdParameters = MFX_CODINGOPTION_ON;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-VuiNalHrdParameters:off"))) {
-+ InputParams.nVuiNalHrdParameters = MFX_CODINGOPTION_OFF;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-BitrateLimit:on"))) {
-+ InputParams.BitrateLimit = MFX_CODINGOPTION_ON;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-BitrateLimit:off"))) {
-+ InputParams.BitrateLimit = MFX_CODINGOPTION_OFF;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-AdaptiveI:on"))) {
-+ InputParams.AdaptiveI = MFX_CODINGOPTION_ON;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-AdaptiveI:off"))) {
-+ InputParams.AdaptiveI = MFX_CODINGOPTION_OFF;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-AdaptiveB:on"))) {
-+ InputParams.AdaptiveB = MFX_CODINGOPTION_ON;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-AdaptiveB:off"))) {
-+ InputParams.AdaptiveB = MFX_CODINGOPTION_OFF;
-+ }
-+#if (defined(_WIN32) || defined(_WIN64)) && (MFX_VERSION >= 1031)
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-iGfx"))) {
-+ InputParams.bPrefferiGfx = true;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-dGfx"))) {
-+ InputParams.bPrefferdGfx = true;
-+ }
-+#endif
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-dec::sys"))) {
-+ InputParams.DecOutPattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
-+ }
-+#ifdef ENABLE_MCTF
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-mctf"))) {
-+ ParseMCTFParams(argv, argc, i, &InputParams);
-+ }
-+#endif
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-ext_allocator")) ||
-+ 0 == msdk_strcmp(argv[i], MSDK_STRING("-MemType::video"))) {
-+ InputParams.bForceSysMem = false;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-sys")) ||
-+ 0 == msdk_strcmp(argv[i], MSDK_STRING("-MemType::system"))) {
-+ InputParams.bForceSysMem = true;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-opaq")) ||
-+ 0 == msdk_strcmp(argv[i], MSDK_STRING("-MemType::opaque"))) {
-+ msdk_printf(MSDK_STRING(
-+ "WARNING: -opaq option is ignored, opaque memory support is disabled in opeVPL.\n"));
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-memory"))) {
-+ VAL_CHECK(i + 1 >= argc, i, argv[i]);
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[++i], InputParams.nMemoryModel)) {
-+ PrintError(MSDK_STRING("-memory %s is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ if (InputParams.nMemoryModel < 1 || InputParams.nMemoryModel > 3) {
-+ PrintError(MSDK_STRING(" \"%s\" memory type is invalid. Default (1) will be used."),
-+ argv[i]);
-+ InputParams.nMemoryModel = GENERAL_ALLOC;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-MemModel::GeneralAlloc"))) {
-+ InputParams.nMemoryModel = GENERAL_ALLOC;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-MemModel::VisibleIntAlloc"))) {
-+ InputParams.nMemoryModel = VISIBLE_INT_ALLOC;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-MemModel::HiddenIntAlloc"))) {
-+ InputParams.nMemoryModel = HIDDEN_INT_ALLOC;
-+ }
-+#if (MFX_VERSION >= 1027)
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-TargetBitDepthLuma"))) {
-+ VAL_CHECK(i + 1 >= argc, i, argv[i]);
-+
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[++i], InputParams.TargetBitDepthLuma)) {
-+ PrintError(MSDK_STRING("TargetBitDepthLuma param is invalid"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-TargetBitDepthChroma"))) {
-+ VAL_CHECK(i + 1 >= argc, i, argv[i]);
-+
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[++i], InputParams.TargetBitDepthChroma)) {
-+ PrintError(MSDK_STRING("TargetBitDepthChroma param is invalid"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+#endif
-+ else {
-+ // no matching argument was found
-+ return MFX_ERR_NOT_FOUND;
-+ }
-+
-+ return MFX_ERR_NONE;
-+}
-+
-+mfxStatus ParseVPPCmdLine(msdk_char* argv[],
-+ mfxU32 argc,
-+ mfxU32& index,
-+ TranscodingSample::sInputParams* params,
-+ mfxU32& skipped) {
-+ if (0 == msdk_strcmp(argv[index], MSDK_STRING("-denoise"))) {
-+ VAL_CHECK(index + 1 == argc, index, argv[index]);
-+ index++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[index], params->DenoiseLevel) ||
-+ !(params->DenoiseLevel >= 0 && params->DenoiseLevel <= 100)) {
-+ PrintError(NULL, MSDK_STRING("-denoise \"%s\" is invalid"), argv[index]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ skipped += 2;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-detail"))) {
-+ VAL_CHECK(index + 1 == argc, index, argv[index]);
-+ index++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[index], params->DetailLevel) ||
-+ !(params->DetailLevel >= 0 && params->DetailLevel <= 100)) {
-+ PrintError(NULL, MSDK_STRING("-detail \"%s\" is invalid"), argv[index]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ skipped += 2;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-FRC::PT"))) {
-+ params->FRCAlgorithm = MFX_FRCALGM_PRESERVE_TIMESTAMP;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-FRC::DT"))) {
-+ params->FRCAlgorithm = MFX_FRCALGM_DISTRIBUTED_TIMESTAMP;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-FRC::INTERP"))) {
-+ params->FRCAlgorithm = MFX_FRCALGM_FRAME_INTERPOLATION;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-deinterlace"))) {
-+ params->bEnableDeinterlacing = true;
-+ params->DeinterlacingMode = 0;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-deinterlace::ADI"))) {
-+ params->bEnableDeinterlacing = true;
-+ params->DeinterlacingMode = MFX_DEINTERLACING_ADVANCED;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-deinterlace::ADI_SCD"))) {
-+ params->bEnableDeinterlacing = true;
-+ params->DeinterlacingMode = MFX_DEINTERLACING_ADVANCED_SCD;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-deinterlace::BOB"))) {
-+ params->bEnableDeinterlacing = true;
-+ params->DeinterlacingMode = MFX_DEINTERLACING_BOB;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-deinterlace::ADI_NO_REF"))) {
-+ params->bEnableDeinterlacing = true;
-+ params->DeinterlacingMode = MFX_DEINTERLACING_ADVANCED_NOREF;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-scaling_mode"))) {
-+ VAL_CHECK(index + 1 == argc, index, argv[index]);
-+ index++;
-+ if (0 == msdk_strcmp(argv[index], MSDK_STRING("lowpower")))
-+ params->ScalingMode = MFX_SCALING_MODE_LOWPOWER;
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("quality")))
-+ params->ScalingMode = MFX_SCALING_MODE_QUALITY;
-+ else {
-+ PrintError(NULL, MSDK_STRING("-scaling_mode \"%s\" is invalid"), argv[index]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-ec::rgb4"))) {
-+ params->EncoderFourCC = MFX_FOURCC_RGB4;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-ec::yuy2"))) {
-+ params->EncoderFourCC = MFX_FOURCC_YUY2;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-ec::nv12"))) {
-+ params->EncoderFourCC = MFX_FOURCC_NV12;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-ec::nv16"))) {
-+ params->EncoderFourCC = MFX_FOURCC_NV16;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-ec::p010"))) {
-+ params->EncoderFourCC = MFX_FOURCC_P010;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-ec::p210"))) {
-+ params->EncoderFourCC = MFX_FOURCC_P210;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-dc::p010"))) {
-+ params->DecoderFourCC = MFX_FOURCC_P010;
-+ return MFX_ERR_NONE;
-+ }
-+#if (MFX_VERSION >= 1031)
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-dc::p016"))) {
-+ params->DecoderFourCC = MFX_FOURCC_P016;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-dc::y216"))) {
-+ params->DecoderFourCC = MFX_FOURCC_Y216;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-dc::y416"))) {
-+ params->DecoderFourCC = MFX_FOURCC_Y216;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-ec::p016"))) {
-+ params->EncoderFourCC = MFX_FOURCC_P016;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-ec::y216"))) {
-+ params->EncoderFourCC = MFX_FOURCC_Y216;
-+ return MFX_ERR_NONE;
-+ }
-+#endif
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-dc::rgb4"))) {
-+ params->DecoderFourCC = MFX_FOURCC_RGB4;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-dc::yuy2"))) {
-+ params->DecoderFourCC = MFX_FOURCC_YUY2;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-dc::nv12"))) {
-+ params->DecoderFourCC = MFX_FOURCC_NV12;
-+ return MFX_ERR_NONE;
-+ }
-+#if (MFX_VERSION >= 1027)
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-dc::y210"))) {
-+ params->DecoderFourCC = MFX_FOURCC_Y210;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-dc::y410"))) {
-+ params->DecoderFourCC = MFX_FOURCC_Y410;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-ec::y210"))) {
-+ params->EncoderFourCC = MFX_FOURCC_Y210;
-+ return MFX_ERR_NONE;
-+ }
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-ec::y410"))) {
-+ params->EncoderFourCC = MFX_FOURCC_Y410;
-+ return MFX_ERR_NONE;
-+ }
-+#endif
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("-field_processing"))) {
-+ VAL_CHECK(index + 1 == argc, index, argv[index]);
-+ index++;
-+ if (0 == msdk_strcmp(argv[index], MSDK_STRING("t2t")))
-+ params->fieldProcessingMode = FC_T2T;
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("t2b")))
-+ params->fieldProcessingMode = FC_T2B;
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("b2t")))
-+ params->fieldProcessingMode = FC_B2T;
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("b2b")))
-+ params->fieldProcessingMode = FC_B2B;
-+ else if (0 == msdk_strcmp(argv[index], MSDK_STRING("fr2fr")))
-+ params->fieldProcessingMode = FC_FR2FR;
-+ else {
-+ PrintError(NULL, MSDK_STRING("-field_processing \"%s\" is invalid"), argv[index]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ return MFX_ERR_NONE;
-+ }
-+
-+ return MFX_ERR_MORE_DATA;
-+}
-+
-+mfxStatus CmdProcessor::ParseParamsForOneSession(mfxU32 argc, msdk_char* argv[]) {
-+ mfxStatus sts = MFX_ERR_NONE;
-+ mfxStatus stsExtBuf = MFX_ERR_NONE;
-+ mfxStatus stsAddlParams = MFX_ERR_NONE;
-+ mfxU32 skipped = 0;
-+
-+ // save original cmd line for debug purpose
-+ msdk_stringstream cmd;
-+ for (mfxU32 i = 0; i < argc; i++)
-+ cmd << argv[i] << MSDK_STRING(" ");
-+ m_lines.push_back(cmd.str());
-+
-+ TranscodingSample::sInputParams InputParams;
-+ if (m_nTimeout)
-+ InputParams.nTimeout = m_nTimeout;
-+ if (bRobustFlag)
-+ InputParams.bRobustFlag = true;
-+ if (bSoftRobustFlag)
-+ InputParams.bSoftRobustFlag = true;
-+
-+ InputParams.shouldUseGreedyFormula = shouldUseGreedyFormula;
-+
-+ InputParams.statisticsWindowSize = statisticsWindowSize;
-+ InputParams.statisticsLogFile = statisticsLogFile;
-+
-+ //bind to a dump-log-file name
-+ InputParams.DumpLogFileName = DumpLogFileName;
-+
-+ if (0 == msdk_strcmp(argv[0], MSDK_STRING("set"))) {
-+ if (argc != 3) {
-+ msdk_printf(MSDK_STRING("error: number of arguments for 'set' options is wrong"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ sts = ParseOption__set(argv[1], argv[2]);
-+ return sts;
-+ }
-+ // default implementation
-+ InputParams.libType = MFX_IMPL_HARDWARE_ANY;
-+#if defined(_WIN32) || defined(_WIN64)
-+ InputParams.libType = MFX_IMPL_HARDWARE_ANY | MFX_IMPL_VIA_D3D11;
-+#endif
-+ InputParams.eModeExt = Native;
-+
-+ for (mfxU32 i = 0; i < argc; i++) {
-+ // process multi-character options
-+ if ((0 == msdk_strncmp(MSDK_STRING("-i::"), argv[i], msdk_strlen(MSDK_STRING("-i::")))) &&
-+ (0 != msdk_strncmp(argv[i] + 4,
-+ MSDK_STRING("source"),
-+ msdk_strlen(MSDK_STRING("source"))))) {
-+ sts = StrFormatToCodecFormatFourCC(argv[i] + 4, InputParams.DecodeId);
-+ if (sts != MFX_ERR_NONE) {
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ SIZE_CHECK((msdk_strlen(argv[i]) + 1) > MSDK_ARRAY_LEN(InputParams.strSrcFile));
-+ msdk_opt_read(argv[i], InputParams.strSrcFile);
-+ if (InputParams.eMode == Source) {
-+ switch (InputParams.DecodeId) {
-+ case MFX_CODEC_MPEG2:
-+ case MFX_CODEC_HEVC:
-+ case MFX_CODEC_AVC:
-+ case MFX_CODEC_VC1:
-+ case MFX_CODEC_VP9:
-+ case MFX_CODEC_AV1:
-+ case CODEC_MVC:
-+ case MFX_CODEC_JPEG:
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ if (InputParams.DecodeId == CODEC_MVC) {
-+ InputParams.DecodeId = MFX_CODEC_AVC;
-+ InputParams.bIsMVC = true;
-+ }
-+ }
-+ else if ((0 ==
-+ msdk_strncmp(MSDK_STRING("-o::"), argv[i], msdk_strlen(MSDK_STRING("-o::")))) &&
-+ (0 != msdk_strncmp(argv[i] + 4,
-+ MSDK_STRING("sink"),
-+ msdk_strlen(MSDK_STRING("sink"))))) {
-+ sts = StrFormatToCodecFormatFourCC(argv[i] + 4, InputParams.EncodeId);
-+
-+ if (sts != MFX_ERR_NONE) {
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ SIZE_CHECK((msdk_strlen(argv[i]) + 1) > MSDK_ARRAY_LEN(InputParams.strDstFile));
-+ msdk_opt_read(argv[i], InputParams.strDstFile);
-+ if (InputParams.eMode == Sink || InputParams.bIsMVC) {
-+ switch (InputParams.EncodeId) {
-+ case MFX_CODEC_MPEG2:
-+ case MFX_CODEC_HEVC:
-+ case MFX_CODEC_AVC:
-+ case MFX_CODEC_JPEG:
-+ case MFX_CODEC_DUMP:
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ if (InputParams.EncodeId == CODEC_MVC) {
-+ if (InputParams.eMode == Sink)
-+ return MFX_ERR_UNSUPPORTED;
-+
-+ InputParams.EncodeId = MFX_CODEC_AVC;
-+ InputParams.bIsMVC = true;
-+ }
-+ }
-+#if MFX_VERSION >= 1022
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-roi_file"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+
-+ msdk_char strRoiFile[MSDK_MAX_FILENAME_LEN];
-+ SIZE_CHECK((msdk_strlen(argv[i]) + 1) > MSDK_ARRAY_LEN(strRoiFile));
-+ msdk_opt_read(argv[i], strRoiFile);
-+
-+ if (!ParseROIFile(strRoiFile, InputParams.m_ROIData)) {
-+ PrintError(MSDK_STRING("Incorrect ROI file: \"%s\" "), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-p"))) {
-+ if (m_PerfFILE) {
-+ msdk_printf(MSDK_STRING("error: only one performance file is supported"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ --argc;
-+ ++argv;
-+ if (!argv[i]) {
-+ msdk_printf(MSDK_STRING("error: no argument given for '-p' option\n"));
-+ }
-+ MSDK_FOPEN(m_PerfFILE, argv[i], MSDK_STRING("w"));
-+ if (NULL == m_PerfFILE) {
-+ msdk_printf(MSDK_STRING("error: performance file \"%s\" not found"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-roi_qpmap"))) {
-+ InputParams.bROIasQPMAP = true;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-extmbqp"))) {
-+ InputParams.bExtMBQP = true;
-+ }
-+#endif //MFX_VERSION >= 1022
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-sw"))) {
-+ InputParams.libType = MFX_IMPL_SOFTWARE;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-hw"))) {
-+#if defined(_WIN32) || defined(_WIN64)
-+ InputParams.libType = MFX_IMPL_HARDWARE_ANY | MFX_IMPL_VIA_D3D11;
-+#elif defined(LIBVA_SUPPORT)
-+ InputParams.libType = MFX_IMPL_HARDWARE_ANY;
-+#endif
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-hw_d3d11"))) {
-+ InputParams.libType = MFX_IMPL_HARDWARE_ANY | MFX_IMPL_VIA_D3D11;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-hw_d3d9"))) {
-+ InputParams.libType = MFX_IMPL_HARDWARE_ANY | MFX_IMPL_VIA_D3D9;
-+ }
-+#if (defined(LINUX32) || defined(LINUX64))
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-device"))) {
-+ if (!InputParams.strDevicePath.empty()) {
-+ msdk_printf(MSDK_STRING("error: you can specify only one device\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ InputParams.strDevicePath = argv[++i];
-+ }
-+#endif
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-perf_opt"))) {
-+ InputParams.bIsPerf = true;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-robust"))) {
-+ InputParams.bRobustFlag = true;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-robust:soft"))) {
-+ InputParams.bSoftRobustFlag = true;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-threads"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nThreadsNum)) {
-+ PrintError(MSDK_STRING("Threads number is invalid"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-f"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ // Temporary check for giving priority to -fe option
-+ if (!InputParams.dVPPOutFramerate) {
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.dVPPOutFramerate)) {
-+ PrintError(MSDK_STRING("FrameRate \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-fe"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.dVPPOutFramerate)) {
-+ PrintError(MSDK_STRING("FrameRate \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-fps"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nFPS)) {
-+ PrintError(MSDK_STRING("FPS limit \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-b"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nBitRate)) {
-+ PrintError(MSDK_STRING("BitRate \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-bm"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nBitRateMultiplier)) {
-+ PrintError(MSDK_STRING("Bitrate multiplier \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-wb"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.WinBRCMaxAvgKbps)) {
-+ PrintError(MSDK_STRING("Maximum bitrate for sliding window \"%s\" is invalid"),
-+ argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-ws"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.WinBRCSize)) {
-+ PrintError(MSDK_STRING("Sliding window size \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-hrd"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.BufferSizeInKB)) {
-+ PrintError(MSDK_STRING("Frame buffer size \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-dist"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.GopRefDist)) {
-+ PrintError(MSDK_STRING("GOP reference distance \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-gop_size"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.GopPicSize)) {
-+ PrintError(MSDK_STRING("GOP size \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-num_ref"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.NumRefFrame)) {
-+ PrintError(MSDK_STRING("Number of reference frames \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-trows"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nEncTileRows)) {
-+ PrintError(MSDK_STRING("Encoding tile row count \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-tcols"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nEncTileCols)) {
-+ PrintError(MSDK_STRING("Encoding tile column count \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-CodecLevel"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.CodecLevel)) {
-+ PrintError(MSDK_STRING("CodecLevel \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-CodecProfile"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.CodecProfile)) {
-+ PrintError(MSDK_STRING("CodecProfile \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-MaxKbps"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.MaxKbps)) {
-+ PrintError(MSDK_STRING("MaxKbps \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-InitialDelayInKB"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.InitialDelayInKB)) {
-+ PrintError(MSDK_STRING("InitialDelayInKB \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-GopOptFlag:closed"))) {
-+ InputParams.GopOptFlag = MFX_GOP_CLOSED;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-GopOptFlag:strict"))) {
-+ InputParams.GopOptFlag = MFX_GOP_STRICT;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-bref"))) {
-+ InputParams.nBRefType = MFX_B_REF_PYRAMID;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-nobref"))) {
-+ InputParams.nBRefType = MFX_B_REF_OFF;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-gpb:on"))) {
-+ InputParams.GPB = MFX_CODINGOPTION_ON;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-gpb:off"))) {
-+ InputParams.GPB = MFX_CODINGOPTION_OFF;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-TransformSkip:on"))) {
-+ InputParams.nTransformSkip = MFX_CODINGOPTION_ON;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-TransformSkip:off"))) {
-+ InputParams.nTransformSkip = MFX_CODINGOPTION_OFF;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-u"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ InputParams.nTargetUsage = StrToTargetUsage(argv[i]);
-+ if (!InputParams.nTargetUsage) {
-+ PrintError(MSDK_STRING(" \"%s\" target usage is invalid. Balanced will be used."),
-+ argv[i]);
-+ InputParams.nTargetUsage = MFX_TARGETUSAGE_BALANCED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-WeightedPred::default"))) {
-+ InputParams.WeightedPred = MFX_WEIGHTED_PRED_DEFAULT;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-WeightedPred::implicit"))) {
-+ InputParams.WeightedPred = MFX_WEIGHTED_PRED_IMPLICIT;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-WeightedBiPred::default"))) {
-+ InputParams.WeightedBiPred = MFX_WEIGHTED_PRED_DEFAULT;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-WeightedBiPred::implicit"))) {
-+ InputParams.WeightedBiPred = MFX_WEIGHTED_PRED_IMPLICIT;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-q"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nQuality)) {
-+ PrintError(MSDK_STRING(" \"%s\" quality is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-w"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nDstWidth)) {
-+ PrintError(MSDK_STRING("width \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-h"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nDstHeight)) {
-+ PrintError(MSDK_STRING("height \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-l"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nSlices)) {
-+ PrintError(MSDK_STRING("numSlices \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-mss"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nMaxSliceSize)) {
-+ PrintError(MSDK_STRING("maxSliceSize \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-async"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nAsyncDepth)) {
-+ PrintError(MSDK_STRING("async \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-join"))) {
-+ InputParams.bIsJoin = true;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-priority"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.priority)) {
-+ PrintError(MSDK_STRING("priority \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-i::source"))) {
-+ if (InputParams.eMode != Native) {
-+ PrintError(NULL, "-i::source cannot be used here");
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ InputParams.eMode = Source;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-o::sink"))) {
-+ if (InputParams.eMode != Native) {
-+ PrintError(NULL, "-o::sink cannot be used here");
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ InputParams.eMode = Sink;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-vpp_comp"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ /* NB! numSurf4Comp should be equal to Number of decoding session */
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.numSurf4Comp)) {
-+ PrintError(MSDK_STRING("-n \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ /* This is can init early */
-+ if (InputParams.eModeExt == Native)
-+ InputParams.eModeExt = VppComp;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-vpp_comp_only"))) {
-+ /* for VPP comp with rendering we have to use ext allocator */
-+#ifdef LIBVA_SUPPORT
-+ InputParams.libvaBackend = MFX_LIBVA_DRM;
-+#endif
-+
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ /* NB! numSurf4Comp should be equal to Number of decoding session */
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.numSurf4Comp)) {
-+ PrintError(MSDK_STRING("-n \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ /* This is can init early */
-+ if (InputParams.eModeExt == Native)
-+ InputParams.eModeExt = VppCompOnly;
-+ }
-+ else if (0 == msdk_strncmp(MSDK_STRING("-vpp_comp_dump"),
-+ argv[i],
-+ msdk_strlen(MSDK_STRING("-vpp_comp_dump")))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ SIZE_CHECK((msdk_strlen(argv[i]) + 1) > MSDK_ARRAY_LEN(InputParams.strDumpVppCompFile));
-+ msdk_opt_read(argv[i], InputParams.strDumpVppCompFile);
-+ }
-+#if defined(LIBVA_X11_SUPPORT)
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-rx11"))) {
-+ InputParams.libvaBackend = MFX_LIBVA_X11;
-+ }
-+#endif
-+
-+#if defined(LIBVA_WAYLAND_SUPPORT)
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-rwld"))) {
-+ InputParams.nRenderWinX = 0;
-+ InputParams.nRenderWinY = 0;
-+ InputParams.bPerfMode = false;
-+ InputParams.libvaBackend = MFX_LIBVA_WAYLAND;
-+ }
-+#endif
-+
-+#if defined(LIBVA_DRM_SUPPORT)
-+ else if (0 == msdk_strncmp(argv[i], MSDK_STRING("-rdrm"), 5)) {
-+ InputParams.libvaBackend = MFX_LIBVA_DRM_MODESET;
-+ InputParams.monitorType = getMonitorType(&argv[i][5]);
-+ if (argv[i][5]) {
-+ if (argv[i][5] != '-') {
-+ PrintError(MSDK_STRING("unsupported monitor type"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ InputParams.monitorType = getMonitorType(&argv[i][6]);
-+ if (InputParams.monitorType >= MFX_MONITOR_MAXNUMBER) {
-+ PrintError(MSDK_STRING("unsupported monitor type"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else {
-+ InputParams.monitorType = MFX_MONITOR_AUTO; // that's case of "-rdrm" pure option
-+ }
-+ }
-+#endif
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-vpp::sys"))) {
-+ InputParams.VppOutPattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-vpp::vid"))) {
-+ InputParams.VppOutPattern = MFX_IOPATTERN_OUT_VIDEO_MEMORY;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-vpp_comp_dst_x"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nVppCompDstX)) {
-+ PrintError(MSDK_STRING("vpp_comp_dst_x %s is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ if (InputParams.eModeExt != VppComp)
-+ InputParams.eModeExt = VppComp;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-vpp_comp_dst_y"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nVppCompDstY)) {
-+ PrintError(MSDK_STRING("-vpp_comp_dst_y %s is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ if (InputParams.eModeExt != VppComp)
-+ InputParams.eModeExt = VppComp;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-vpp_comp_dst_w"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nVppCompDstW)) {
-+ PrintError(MSDK_STRING("-vpp_comp_dst_w %s is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ if (InputParams.eModeExt != VppComp)
-+ InputParams.eModeExt = VppComp;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-vpp_comp_dst_h"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nVppCompDstH)) {
-+ PrintError(MSDK_STRING("-vpp_comp_dst_h %s is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ if (InputParams.eModeExt != VppComp)
-+ InputParams.eModeExt = VppComp;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-vpp_comp_src_w"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nVppCompSrcW)) {
-+ PrintError(MSDK_STRING("-vpp_comp_src_w %s is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ if (InputParams.eModeExt != VppComp)
-+ InputParams.eModeExt = VppComp;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-vpp_comp_src_h"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nVppCompSrcH)) {
-+ PrintError(MSDK_STRING("-vpp_comp_src_h %s is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ if (InputParams.eModeExt != VppComp)
-+ InputParams.eModeExt = VppComp;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-vpp_comp_num_tiles"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.numTiles4Comp)) {
-+ PrintError(MSDK_STRING("-vpp_comp_num_tiles %s is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ if (InputParams.eModeExt != VppCompOnly)
-+ InputParams.eModeExt = VppCompOnly;
-+ }
-+#if MFX_VERSION >= 1023
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-vpp_comp_tile_id"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nVppCompTileId)) {
-+ PrintError(MSDK_STRING("-vpp_comp_tile_id %s is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+#endif
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-vpp_comp_render"))) {
-+ if (InputParams.eModeExt != VppComp)
-+ InputParams.eModeExt = VppComp;
-+ }
-+#if MFX_VERSION >= 1022
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-dec_postproc"))) {
-+ InputParams.bDecoderPostProcessing = true;
-+ }
-+#endif //MFX_VERSION >= 1022
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-n"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.MaxFrameNumber)) {
-+ PrintError(MSDK_STRING("-n %s is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-angle"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nRotationAngle)) {
-+ PrintError(MSDK_STRING("-angle %s is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ if (InputParams.strVPPPluginDLLPath[0] == '\0') {
-+ msdk_opt_read(MSDK_CPU_ROTATE_PLUGIN, InputParams.strVPPPluginDLLPath);
-+ }
-+ }
-+#if (MFX_VERSION >= 1025)
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-mfe_frames"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.numMFEFrames)) {
-+ PrintError(MSDK_STRING("-mfe_frames %s num frames is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-mfe_mode"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.MFMode)) {
-+ PrintError(MSDK_STRING("-mfe_mode %s is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-mfe_timeout"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.mfeTimeout)) {
-+ PrintError(MSDK_STRING("-mfe_timeout %s is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+#endif
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-timeout"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nTimeout)) {
-+ PrintError(MSDK_STRING("-timeout %s is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ skipped += 2;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-dump"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.strMfxParamsDumpFile)) {
-+ PrintError(MSDK_STRING("Dump file name \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-robust"))) {
-+ InputParams.bRobustFlag = true;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-opencl"))) {
-+ msdk_opt_read(MSDK_OCL_ROTATE_PLUGIN, InputParams.strVPPPluginDLLPath);
-+ InputParams.bOpenCL = true;
-+ }
-+
-+ // output PicStruct
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-la_ext"))) {
-+ InputParams.bEnableExtLA = true;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-la"))) {
-+ InputParams.bLABRC = true;
-+ InputParams.nRateControlMethod = MFX_RATECONTROL_LA;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-vbr"))) {
-+ InputParams.nRateControlMethod = MFX_RATECONTROL_VBR;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-cbr"))) {
-+ InputParams.nRateControlMethod = MFX_RATECONTROL_CBR;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-bpyr"))) {
-+ InputParams.bEnableBPyramid = true;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-vcm"))) {
-+ InputParams.nRateControlMethod = MFX_RATECONTROL_VCM;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-lad"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ InputParams.nRateControlMethod = MFX_RATECONTROL_LA;
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.nLADepth)) {
-+ PrintError(MSDK_STRING("look ahead depth \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-pe"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ InputParams.encoderPluginParams = ParsePluginGuid(argv[i + 1]);
-+ if (AreGuidsEqual(InputParams.encoderPluginParams.pluginGuid, MSDK_PLUGINGUID_NULL)) {
-+ PrintError(MSDK_STRING("Invalid encoder guid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ i++;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-pd"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ InputParams.decoderPluginParams = ParsePluginGuid(argv[i + 1]);
-+ if (AreGuidsEqual(InputParams.decoderPluginParams.pluginGuid, MSDK_PLUGINGUID_NULL)) {
-+ PrintError(MSDK_STRING("Invalid decoder guid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ i++;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-override_decoder_framerate"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.dDecoderFrameRateOverride)) {
-+ PrintError(MSDK_STRING("Framerate \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-override_encoder_framerate"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.dEncoderFrameRateOverride)) {
-+ PrintError(MSDK_STRING("Framerate \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-override_encoder_picstruct"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ i++;
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[i], InputParams.EncoderPicstructOverride)) {
-+ PrintError(MSDK_STRING("Picstruct \"%s\" is invalid"), argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-gpucopy::on"))) {
-+ InputParams.nGpuCopyMode = MFX_GPUCOPY_ON;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-gpucopy::off"))) {
-+ InputParams.nGpuCopyMode = MFX_GPUCOPY_OFF;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-repartitioncheck::on"))) {
-+ InputParams.RepartitionCheckMode = MFX_CODINGOPTION_ON;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-repartitioncheck::off"))) {
-+ InputParams.RepartitionCheckMode = MFX_CODINGOPTION_OFF;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-cqp"))) {
-+ InputParams.nRateControlMethod = MFX_RATECONTROL_CQP;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-qpi"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[++i], InputParams.nQPI)) {
-+ PrintError(MSDK_STRING("Quantizer for I frames is invalid"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-qpp"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[++i], InputParams.nQPP)) {
-+ PrintError(MSDK_STRING("Quantizer for P frames is invalid"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-qpb"))) {
-+ VAL_CHECK(i + 1 == argc, i, argv[i]);
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[++i], InputParams.nQPB)) {
-+ PrintError(MSDK_STRING("Quantizer for B frames is invalid"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-DisableQPOffset"))) {
-+ InputParams.bDisableQPOffset = true;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-qsv-ff"))) {
-+ InputParams.enableQSVFF = true;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-single_texture_d3d11"))) {
-+ InputParams.bSingleTexture = true;
-+ }
-+#if (MFX_VERSION >= 1024)
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-extbrc::on"))) {
-+ InputParams.nExtBRC = EXTBRC_ON;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-extbrc::off"))) {
-+ InputParams.nExtBRC = EXTBRC_OFF;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-extbrc::implicit"))) {
-+ InputParams.nExtBRC = EXTBRC_IMPLICIT;
-+ }
-+#endif
-+#if (MFX_VERSION >= 1026)
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-ExtBrcAdaptiveLTR:on"))) {
-+ InputParams.ExtBrcAdaptiveLTR = MFX_CODINGOPTION_ON;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-ExtBrcAdaptiveLTR:off"))) {
-+ InputParams.ExtBrcAdaptiveLTR = MFX_CODINGOPTION_OFF;
-+ }
-+
-+#endif
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-pp"))) {
-+ InputParams.shouldPrintPresets = true;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-preset"))) {
-+ msdk_char presetName[MSDK_MAX_FILENAME_LEN];
-+ VAL_CHECK(i + 1 >= argc, i, argv[i]);
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[++i], presetName)) {
-+ PrintError(MSDK_STRING("Preset Name is not defined"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ InputParams.PresetMode = CPresetManager::PresetNameToMode(presetName);
-+ if (InputParams.PresetMode == PRESET_MAX_MODES) {
-+ PrintError(MSDK_STRING("Preset Name is invalid"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-ir_type"))) {
-+ VAL_CHECK(i + 1 >= argc, i, argv[i]);
-+
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[++i], InputParams.IntRefType)) {
-+ PrintError(MSDK_STRING("Intra refresh type is invalid"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-ir_cycle_size"))) {
-+ VAL_CHECK(i + 1 >= argc, i, argv[i]);
-+
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[++i], InputParams.IntRefCycleSize)) {
-+ PrintError(MSDK_STRING("IR refresh cycle size param is invalid"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-ir_qp_delta"))) {
-+ VAL_CHECK(i + 1 >= argc, i, argv[i]);
-+
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[++i], InputParams.IntRefQPDelta)) {
-+ PrintError(MSDK_STRING("IR QP delta param is invalid"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-ir_cycle_dist"))) {
-+ VAL_CHECK(i + 1 >= argc, i, argv[i]);
-+
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[++i], InputParams.IntRefCycleDist)) {
-+ PrintError(MSDK_STRING("IR cycle distance param is invalid"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-LowDelayBRC"))) {
-+ InputParams.LowDelayBRC = MFX_CODINGOPTION_ON;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-amfs:on"))) {
-+ InputParams.nAdaptiveMaxFrameSize = MFX_CODINGOPTION_ON;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-amfs:off"))) {
-+ InputParams.nAdaptiveMaxFrameSize = MFX_CODINGOPTION_OFF;
-+ }
-+ else if (0 == msdk_strcmp(argv[i], MSDK_STRING("-mfs"))) {
-+ VAL_CHECK(i + 1 >= argc, i, argv[i]);
-+ if (MFX_ERR_NONE != msdk_opt_read(argv[++i], InputParams.nMaxFrameSize)) {
-+ PrintError(MSDK_STRING("MaxFrameSize is invalid"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ MOD_SMT_PARSE_INPUT
-+ else if ((stsExtBuf = ParseVPPCmdLine(argv, argc, i, &InputParams, skipped)) !=
-+ MFX_ERR_MORE_DATA) {
-+ if (stsExtBuf == MFX_ERR_UNSUPPORTED) {
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ else {
-+ // WA for compiler error C1061 (too many chained else-if clauses)
-+ // ParseAdditionalParams returns:
-+ // 0 if argv[i] is processed successfully by this function
-+ // < 1 if argv[i] is processed and generates an error
-+ // OR
-+ // if argv[i] was not processed (did not match any switches)
-+ stsAddlParams = ParseAdditionalParams(argv, argc, i, InputParams);
-+
-+ // either unrecognized parameter, or parse error with recognized parameter
-+ if (stsAddlParams) {
-+ if (stsAddlParams == MFX_ERR_NOT_FOUND)
-+ PrintError(MSDK_STRING("Invalid input argument number %d %s"), i, argv[i]);
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+ }
-+
-+ if (skipped < argc) {
-+ sts = VerifyAndCorrectInputParams(InputParams);
-+ MSDK_CHECK_STATUS(sts, "VerifyAndCorrectInputParams failed");
-+ m_SessionArray.push_back(InputParams);
-+ }
-+
-+ return MFX_ERR_NONE;
-+
-+} //mfxStatus CmdProcessor::ParseParamsForOneSession(msdk_char *pLine, mfxU32 length)
-+
-+mfxStatus CmdProcessor::ParseOption__set(msdk_char* strCodecType, msdk_char* strPluginGuid) {
-+ mfxU32 codecid = 0;
-+ mfxU32 type = 0;
-+ sPluginParams pluginParams;
-+
-+ //Parse codec type - decoder or encoder
-+ if (0 == msdk_strncmp(MSDK_STRING("-i::"), strCodecType, 4)) {
-+ type = MSDK_VDECODE;
-+ }
-+ else if (0 == msdk_strncmp(MSDK_STRING("-o::"), strCodecType, 4)) {
-+ type = MSDK_VENCODE;
-+ }
-+ else {
-+ msdk_printf(MSDK_STRING("error: incorrect definition codec type (must be -i:: or -o::)\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ if (StrFormatToCodecFormatFourCC(strCodecType + 4, codecid) != MFX_ERR_NONE) {
-+ msdk_printf(MSDK_STRING("error: codec is unknown\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ if (!IsPluginCodecSupported(codecid)) {
-+ msdk_printf(MSDK_STRING("error: codec is unsupported\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ pluginParams = ParsePluginGuid(strPluginGuid);
-+ if (AreGuidsEqual(pluginParams.pluginGuid, MSDK_PLUGINGUID_NULL)) {
-+ msdk_printf(MSDK_STRING("error: invalid codec guid\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ if (type == MSDK_VDECODE)
-+ m_decoderPlugins.insert(std::pair<mfxU32, sPluginParams>(codecid, pluginParams));
-+ else
-+ m_encoderPlugins.insert(std::pair<mfxU32, sPluginParams>(codecid, pluginParams));
-+
-+ return MFX_ERR_NONE;
-+};
-+
-+mfxStatus CmdProcessor::VerifyAndCorrectInputParams(TranscodingSample::sInputParams& InputParams) {
-+ if (0 == msdk_strlen(InputParams.strSrcFile) &&
-+ (InputParams.eMode == Sink || InputParams.eMode == Native)) {
-+ PrintError(MSDK_STRING("Source file name not found"));
-+ return MFX_ERR_UNSUPPORTED;
-+ };
-+
-+ if (0 == msdk_strlen(InputParams.strDstFile) &&
-+ (InputParams.eMode == Source || InputParams.eMode == Native ||
-+ InputParams.eMode == VppComp) &&
-+ InputParams.eModeExt != VppCompOnly) {
-+ PrintError(MSDK_STRING("Destination file name not found"));
-+ return MFX_ERR_UNSUPPORTED;
-+ };
-+
-+ if (MFX_CODEC_JPEG != InputParams.EncodeId && MFX_CODEC_MPEG2 != InputParams.EncodeId &&
-+ MFX_CODEC_AVC != InputParams.EncodeId && MFX_CODEC_HEVC != InputParams.EncodeId &&
-+ MFX_CODEC_VP9 != InputParams.EncodeId && MFX_CODEC_DUMP != InputParams.EncodeId &&
-+ InputParams.eMode != Sink && InputParams.eModeExt != VppCompOnly) {
-+ PrintError(MSDK_STRING("Unknown encoder\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ if (MFX_CODEC_MPEG2 != InputParams.DecodeId && MFX_CODEC_AVC != InputParams.DecodeId &&
-+ MFX_CODEC_HEVC != InputParams.DecodeId && MFX_CODEC_VC1 != InputParams.DecodeId &&
-+ MFX_CODEC_JPEG != InputParams.DecodeId && MFX_CODEC_VP9 != InputParams.DecodeId &&
-+ MFX_CODEC_VP8 != InputParams.DecodeId && MFX_CODEC_AV1 != InputParams.DecodeId &&
-+ MFX_CODEC_RGB4 != InputParams.DecodeId && MFX_CODEC_NV12 != InputParams.DecodeId &&
-+ MFX_CODEC_I420 != InputParams.DecodeId && InputParams.eMode != Source) {
-+ PrintError(MSDK_STRING("Unknown decoder\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ if (MFX_CODEC_I420 == InputParams.DecodeId || MFX_CODEC_NV12 == InputParams.DecodeId) {
-+ InputParams.rawInput = true;
-+ }
-+ else {
-+ InputParams.rawInput = false;
-+ }
-+
-+ if (MFX_CODEC_RGB4 == InputParams.DecodeId &&
-+ (!InputParams.nVppCompSrcH || !InputParams.nVppCompSrcW)) {
-+ PrintError(MSDK_STRING(
-+ "VppCompSrcH and VppCompSrcW must be specified in case of -i::rgb4_frame\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ if ((!InputParams.FRCAlgorithm && !InputParams.bEnableDeinterlacing) &&
-+ InputParams.dVPPOutFramerate) {
-+ msdk_printf(MSDK_STRING(
-+ "-f option is ignored, it can be used with FRC or deinterlace options only. \n"));
-+ InputParams.dVPPOutFramerate = 0;
-+ }
-+
-+ if (InputParams.FRCAlgorithm && InputParams.bEnableExtLA) {
-+ PrintError(MSDK_STRING("-la_ext and FRC options cannot be used together\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ if (InputParams.nQuality && InputParams.EncodeId && (MFX_CODEC_JPEG != InputParams.EncodeId)) {
-+ PrintError(MSDK_STRING("-q option is supported only for JPEG encoder\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ if ((InputParams.nTargetUsage || InputParams.nBitRate) &&
-+ (MFX_CODEC_JPEG == InputParams.EncodeId)) {
-+ PrintError(MSDK_STRING(
-+ "-b and -u options are supported only for H.264, MPEG2 and MVC encoders. For JPEG encoder use -q\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ // valid target usage range is: [MFX_TARGETUSAGE_BEST_QUALITY .. MFX_TARGETUSAGE_BEST_SPEED] (at the moment [1..7])
-+ // If target usage is kept unknown - presets manager will fill in proper value
-+ if ((InputParams.nTargetUsage < MFX_TARGETUSAGE_UNKNOWN) ||
-+ (InputParams.nTargetUsage > MFX_TARGETUSAGE_BEST_SPEED)) {
-+ PrintError(NULL, "Unsupported target usage");
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ // Ignoring user-defined Async Depth for LA
-+ if (InputParams.nMaxSliceSize) {
-+ InputParams.nAsyncDepth = 1;
-+ }
-+
-+ // For decoder session of inter-session case, let's set AsyncDepth to 4 by default
-+ if (InputParams.eMode == Sink && !InputParams.nAsyncDepth) {
-+ InputParams.nAsyncDepth = 4;
-+ }
-+
-+ if (InputParams.bLABRC && !(InputParams.libType & MFX_IMPL_HARDWARE_ANY)) {
-+ PrintError(MSDK_STRING("Look ahead BRC is supported only with -hw option!"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ if (InputParams.bLABRC && (InputParams.EncodeId != MFX_CODEC_AVC) &&
-+ (InputParams.eMode == Source)) {
-+ PrintError(MSDK_STRING("Look ahead BRC is supported only with H.264 encoder!"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ if ((InputParams.nRateControlMethod == MFX_RATECONTROL_LA ||
-+ InputParams.nRateControlMethod == MFX_RATECONTROL_LA_EXT ||
-+ InputParams.nRateControlMethod == MFX_RATECONTROL_LA_ICQ ||
-+ InputParams.nRateControlMethod == MFX_RATECONTROL_LA_HRD) &&
-+ (InputParams.nLADepth > 100)) {
-+ PrintError(MSDK_STRING(
-+ "Unsupported value of -lad parameter, must be in range [1,100] or 0 for automatic selection"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ if ((InputParams.nMaxSliceSize) && !(InputParams.libType & MFX_IMPL_HARDWARE_ANY)) {
-+ PrintError(MSDK_STRING("MaxSliceSize option is supported only with -hw option!"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ if ((InputParams.nMaxSliceSize) && (InputParams.nSlices)) {
-+ PrintError(MSDK_STRING("-mss and -l options are not compatible!"));
-+ }
-+ if ((InputParams.nMaxSliceSize) && (InputParams.EncodeId != MFX_CODEC_AVC)) {
-+ PrintError(MSDK_STRING("MaxSliceSize option is supported only with H.264 encoder!"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ if (InputParams.BitrateLimit == MFX_CODINGOPTION_UNKNOWN) {
-+ InputParams.BitrateLimit = MFX_CODINGOPTION_OFF;
-+ }
-+
-+ if (InputParams.enableQSVFF && InputParams.eMode == Sink) {
-+ msdk_printf(MSDK_STRING(
-+ "WARNING: -lowpower(-qsv-ff) option is not valid for decoder-only sessions, this parameter will be ignored.\n"));
-+ }
-+
-+ std::map<mfxU32, sPluginParams>::iterator it;
-+
-+ // Set decoder plugins parameters only if they were not set before
-+ if (!memcmp(InputParams.decoderPluginParams.pluginGuid.Data,
-+ MSDK_PLUGINGUID_NULL.Data,
-+ sizeof(MSDK_PLUGINGUID_NULL)) &&
-+ !strcmp(InputParams.decoderPluginParams.strPluginPath, "")) {
-+ it = m_decoderPlugins.find(InputParams.DecodeId);
-+ if (it != m_decoderPlugins.end())
-+ InputParams.decoderPluginParams = it->second;
-+ }
-+ else {
-+ // Decoding plugin was set manually, so let's check if codec supports plugins
-+ if (!IsPluginCodecSupported(InputParams.DecodeId)) {
-+ msdk_printf(MSDK_STRING("error: decoder does not support plugins\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+
-+ // Set encoder plugins parameters only if they were not set before
-+ if (!memcmp(InputParams.encoderPluginParams.pluginGuid.Data,
-+ MSDK_PLUGINGUID_NULL.Data,
-+ sizeof(MSDK_PLUGINGUID_NULL)) &&
-+ !strcmp(InputParams.encoderPluginParams.strPluginPath, "")) {
-+ it = m_encoderPlugins.find(InputParams.EncodeId);
-+ if (it != m_encoderPlugins.end())
-+ InputParams.encoderPluginParams = it->second;
-+ }
-+ else {
-+ // Encoding plugin was set manually, so let's check if codec supports plugins
-+ if (!IsPluginCodecSupported(InputParams.EncodeId)) {
-+ msdk_printf(MSDK_STRING("error: encoder does not support plugins\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+ }
-+
-+ if (InputParams.EncoderFourCC && InputParams.eMode == Sink) {
-+ msdk_printf(MSDK_STRING(
-+ "WARNING: -ec option is used in session without encoder, this parameter will be ignored \n"));
-+ }
-+
-+ if (InputParams.DecoderFourCC && InputParams.eMode != Native && InputParams.eMode != Sink) {
-+ msdk_printf(MSDK_STRING(
-+ "WARNING: -dc option is used in session without decoder, this parameter will be ignored \n"));
-+ }
-+
-+ if (InputParams.EncoderFourCC && InputParams.EncoderFourCC != MFX_FOURCC_NV12 &&
-+ InputParams.EncoderFourCC != MFX_FOURCC_RGB4 &&
-+ InputParams.EncoderFourCC != MFX_FOURCC_YUY2 && InputParams.EncodeId == MFX_CODEC_DUMP) {
-+ PrintError(MSDK_STRING(
-+ "-o::raw option can be used with NV12, RGB4 and YUY2 color formats only.\n"));
-+ return MFX_ERR_UNSUPPORTED;
-+ }
-+
-+ if ((InputParams.nEncTileRows || InputParams.nEncTileCols) &&
-+ (InputParams.EncodeId != MFX_CODEC_HEVC)
-+#if (MFX_VERSION >= 1029)
-+ && (InputParams.EncodeId != MFX_CODEC_VP9)
-+#endif
-+ ) {
-+ msdk_printf(MSDK_STRING("WARNING: -trows and -tcols are only supported for")
-+#if (MFX_VERSION >= 1029)
-+ MSDK_STRING(" VP9 and")
-+#endif
-+ MSDK_STRING(" HEVC encoder, these parameters will be ignored.\n"));
-+ InputParams.nEncTileRows = 0;
-+ InputParams.nEncTileCols = 0;
-+ }
-+
-+#if (defined(_WIN32) || defined(_WIN64)) && (MFX_VERSION >= 1031)
-+ if (InputParams.bPrefferiGfx && InputParams.bPrefferdGfx) {
-+ msdk_printf(MSDK_STRING("WARNING: both dGfx and iGfx flags set. iGfx will be preffered\n"));
-+ InputParams.bPrefferdGfx = false;
-+ }
-+#endif
-+
-+ return MFX_ERR_NONE;
-+} //mfxStatus CmdProcessor::VerifyAndCorrectInputParams(TranscodingSample::sInputParams &InputParams)
-+
-+bool CmdProcessor::GetNextSessionParams(TranscodingSample::sInputParams& InputParams) {
-+ if (!m_SessionArray.size())
-+ return false;
-+ if (m_SessionParamId == m_SessionArray.size()) {
-+ return false;
-+ }
-+ InputParams = m_SessionArray[m_SessionParamId];
-+
-+ m_SessionParamId++;
-+ return true;
-+
-+} //bool CmdProcessor::GetNextSessionParams(TranscodingSample::sInputParams &InputParams)
---
-2.31.1
-
diff --git a/recipes-multimedia/onevpl/onevpl/0001-Add-X11-support-to-legacy-tools.patch b/recipes-multimedia/onevpl/onevpl/0001-Add-X11-support-to-legacy-tools.patch
deleted file mode 100644
index fd7faa82..00000000
--- a/recipes-multimedia/onevpl/onevpl/0001-Add-X11-support-to-legacy-tools.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 3c485ba902da0a4a2e9fc43b34eb9174c739929e Mon Sep 17 00:00:00 2001
-From: "Yew, Chang Ching" <chang.ching.yew@intel.com>
-Date: Fri, 21 May 2021 14:11:44 +0800
-Subject: [PATCH] Add X11 support to legacy tools
-
-Upstream-Status: Pending
-
-Signed-off-by: jinchung <jin.chung.teng@intel.com>
-Signed-off-by: Yew, Chang Ching <chang.ching.yew@intel.com>
----
- tools/legacy/sample_common/CMakeLists.txt | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/tools/legacy/sample_common/CMakeLists.txt b/tools/legacy/sample_common/CMakeLists.txt
-index 5cf69d3..db4de3d 100644
---- a/tools/legacy/sample_common/CMakeLists.txt
-+++ b/tools/legacy/sample_common/CMakeLists.txt
-@@ -32,6 +32,7 @@ if(UNIX)
- src/vm/time_linux.cpp
- src/vm/atomic_linux.cpp
- src/vm/thread_linux.cpp
-+ src/vaapi_utils_x11.cpp
- src/vaapi_utils_drm.cpp)
- else()
- list(
-@@ -67,6 +68,8 @@ if(UNIX)
- find_package(PkgConfig REQUIRED)
- pkg_check_modules(PKG_LIBVA libva libva-drm)
- pkg_check_modules(PKG_LIBDRM libdrm)
-+ pkg_check_modules(PKG_X11 x11)
-+ pkg_check_modules(PKG_LIBVA_X11 libva-x11>=1.10.0)
- if(PKG_LIBVA_FOUND)
- target_compile_definitions(${TARGET} PUBLIC -DLIBVA_SUPPORT)
- target_include_directories(${TARGET} PUBLIC ${PKG_LIBVA_INCLUDE_DIRS})
-@@ -79,6 +82,12 @@ if(UNIX)
- else()
- message(WARNING "libva-drm not found: building without libVA DRM support")
- endif()
-+ if(PKG_X11_FOUND)
-+ target_compile_definitions(${TARGET} PUBLIC -DLIBVA_X11_SUPPORT)
-+ target_include_directories(${TARGET} PUBLIC ${PKG_X11_LIBRARY_DIRS})
-+ else()
-+ message(WARNING "x11 modules not found: building without libVA X11 support")
-+ endif()
-
- target_link_libraries(${TARGET} ${CMAKE_DL_LIBS})
-
---
-2.31.1
-
diff --git a/recipes-multimedia/onevpl/onevpl/0001-Adding-Wayland-support-to-legacy-tools.patch b/recipes-multimedia/onevpl/onevpl/0001-Adding-Wayland-support-to-legacy-tools.patch
deleted file mode 100644
index 857626b4..00000000
--- a/recipes-multimedia/onevpl/onevpl/0001-Adding-Wayland-support-to-legacy-tools.patch
+++ /dev/null
@@ -1,1301 +0,0 @@
-From 64250fb3e73c1977067381c70aeffbaa980f4136 Mon Sep 17 00:00:00 2001
-From: jinchung <jin.chung.teng@intel.com>
-Date: Fri, 28 May 2021 11:34:01 +0800
-Subject: [PATCH] Adding Wayland support to legacy tools
-
-Upstream-Status: Submitted
-https://github.com/oneapi-src/oneVPL/pull/6
-
-Signed-off-by: jinchung <jin.chung.teng@intel.com>
----
- tools/legacy/CMakeLists.txt | 1 +
- tools/legacy/sample_common/CMakeLists.txt | 8 +
- tools/legacy/sample_common/src/vaapi_device.cpp | 2 +-
- tools/legacy/sample_misc/wayland/CMakeLists.txt | 29 ++
- .../sample_misc/wayland/include/class_wayland.h | 160 +++++++
- .../sample_misc/wayland/include/listener_wayland.h | 66 +++
- .../wayland/include/wayland-drm-client-protocol.h | 235 ++++++++++
- .../sample_misc/wayland/src/class_wayland.cpp | 500 +++++++++++++++++++++
- .../sample_misc/wayland/src/listener_wayland.cpp | 105 +++++
- .../sample_misc/wayland/src/wayland-drm-protocol.c | 84 ++++
- 10 files changed, 1189 insertions(+), 1 deletion(-)
- create mode 100644 tools/legacy/sample_misc/wayland/CMakeLists.txt
- create mode 100644 tools/legacy/sample_misc/wayland/include/class_wayland.h
- create mode 100644 tools/legacy/sample_misc/wayland/include/listener_wayland.h
- create mode 100644 tools/legacy/sample_misc/wayland/include/wayland-drm-client-protocol.h
- create mode 100644 tools/legacy/sample_misc/wayland/src/class_wayland.cpp
- create mode 100644 tools/legacy/sample_misc/wayland/src/listener_wayland.cpp
- create mode 100644 tools/legacy/sample_misc/wayland/src/wayland-drm-protocol.c
-
-diff --git a/tools/legacy/CMakeLists.txt b/tools/legacy/CMakeLists.txt
-index 165a5b2..1d4af73 100644
---- a/tools/legacy/CMakeLists.txt
-+++ b/tools/legacy/CMakeLists.txt
-@@ -11,3 +11,4 @@ add_subdirectory(sample_common)
- add_subdirectory(sample_decode)
- add_subdirectory(sample_vpp)
- add_subdirectory(sample_encode)
-+add_subdirectory(sample_misc/wayland)
-diff --git a/tools/legacy/sample_common/CMakeLists.txt b/tools/legacy/sample_common/CMakeLists.txt
-index db4de3d..4f04226 100644
---- a/tools/legacy/sample_common/CMakeLists.txt
-+++ b/tools/legacy/sample_common/CMakeLists.txt
-@@ -70,6 +70,7 @@ if(UNIX)
- pkg_check_modules(PKG_LIBDRM libdrm)
- pkg_check_modules(PKG_X11 x11)
- pkg_check_modules(PKG_LIBVA_X11 libva-x11>=1.10.0)
-+ pkg_check_modules(PKG_WAYLAND_CLIENT wayland-client)
- if(PKG_LIBVA_FOUND)
- target_compile_definitions(${TARGET} PUBLIC -DLIBVA_SUPPORT)
- target_include_directories(${TARGET} PUBLIC ${PKG_LIBVA_INCLUDE_DIRS})
-@@ -88,6 +89,13 @@ if(UNIX)
- else()
- message(WARNING "x11 modules not found: building without libVA X11 support")
- endif()
-+ if(PKG_WAYLAND_CLIENT_FOUND)
-+ target_compile_definitions(${TARGET} PUBLIC -DLIBVA_WAYLAND_SUPPORT)
-+ target_include_directories(${TARGET} PUBLIC ${PKG_WAYLAND_CLIENT_LIBRARY_DIRS})
-+ target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../sample_misc/wayland/include)
-+ else()
-+ message(WARNING "wayland modules not found: building without Wayland support")
-+ endif()
-
- target_link_libraries(${TARGET} ${CMAKE_DL_LIBS})
-
-diff --git a/tools/legacy/sample_common/src/vaapi_device.cpp b/tools/legacy/sample_common/src/vaapi_device.cpp
-index 3f6d3ba..b034376 100644
---- a/tools/legacy/sample_common/src/vaapi_device.cpp
-+++ b/tools/legacy/sample_common/src/vaapi_device.cpp
-@@ -396,7 +396,7 @@ mfxStatus CVAAPIDeviceWayland::RenderFrame(mfxFrameSurface1* pSurface,
- return mfx_res;
- }
-
-- m_Wayland->RenderBuffer(m_wl_buffer, pSurface->Info.CropW, pSurface->Info.CropH);
-+ m_Wayland->RenderBuffer(m_wl_buffer, pSurface);
-
- return mfx_res;
- }
-diff --git a/tools/legacy/sample_misc/wayland/CMakeLists.txt b/tools/legacy/sample_misc/wayland/CMakeLists.txt
-new file mode 100644
-index 0000000..95057d4
---- /dev/null
-+++ b/tools/legacy/sample_misc/wayland/CMakeLists.txt
-@@ -0,0 +1,29 @@
-+if (NOT PKG_WAYLAND_CLIENT_FOUND)
-+ return()
-+endif()
-+
-+set(TARGET mfx_wayland)
-+
-+find_package(PkgConfig REQUIRED)
-+pkg_check_modules(PKG_WAYLAND_CLIENT wayland-client)
-+pkg_check_modules(PKG_LIBVA libva libva-drm)
-+pkg_check_modules(PKG_LIBDRM libdrm)
-+
-+include_directories (
-+ ${CMAKE_CURRENT_SOURCE_DIR}/../../sample_common/include
-+ ${CMAKE_CURRENT_SOURCE_DIR}/include
-+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../api/vpl
-+ ${PKG_LIBDRM_INCLUDE_DIRS}
-+ ${PKG_WAYLAND_CLIENT_LIBRARY_DIRS}
-+)
-+
-+add_definitions(-DLIBVA_WAYLAND_SUPPORT)
-+add_library(${TARGET} SHARED "")
-+target_sources(${TARGET} PRIVATE
-+ ${CMAKE_CURRENT_SOURCE_DIR}/src/class_wayland.cpp
-+ ${CMAKE_CURRENT_SOURCE_DIR}/src/listener_wayland.cpp
-+ ${CMAKE_CURRENT_SOURCE_DIR}/src/wayland-drm-protocol.c)
-+
-+target_link_libraries(${TARGET} sample_common wayland-client va drm drm_intel)
-+
-+install( TARGETS ${TARGETS} LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR} )
-diff --git a/tools/legacy/sample_misc/wayland/include/class_wayland.h b/tools/legacy/sample_misc/wayland/include/class_wayland.h
-new file mode 100644
-index 0000000..1c64f9c
---- /dev/null
-+++ b/tools/legacy/sample_misc/wayland/include/class_wayland.h
-@@ -0,0 +1,160 @@
-+/******************************************************************************\
-+Copyright (c) 2005-2019, Intel Corporation
-+All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-+
-+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-+
-+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-+
-+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+This sample was distributed or derived from the Intel's Media Samples package.
-+The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
-+or https://software.intel.com/en-us/media-client-solutions-support.
-+\**********************************************************************************/
-+
-+#ifndef WAYLAND_CLASS_H
-+#define WAYLAND_CLASS_H
-+
-+#if defined(LIBVA_WAYLAND_SUPPORT)
-+
-+extern "C"
-+{
-+ #include <intel_bufmgr.h>
-+}
-+#include <poll.h>
-+#include <wayland-client.h>
-+#include <list>
-+#include "wayland-drm-client-protocol.h"
-+#include "vpl/mfxstructures.h"
-+#include "mfx_buffering.h"
-+#include "sample_defs.h"
-+
-+typedef struct buffer wld_buffer;
-+
-+/* ShmPool Struct */
-+struct ShmPool {
-+ int fd;
-+ uint32_t *memory;
-+ unsigned capacity;
-+ unsigned size;
-+};
-+
-+class Wayland: public CBuffering {
-+ public:
-+ Wayland();
-+ virtual ~Wayland();
-+ virtual bool InitDisplay();
-+ virtual bool CreateSurface();
-+ virtual void FreeSurface();
-+ virtual void SetRenderWinPos(int x, int y);
-+ virtual void RenderBuffer(struct wl_buffer *buffer
-+ , mfxFrameSurface1 *surface);
-+ virtual void RenderBufferWinPosSize(struct wl_buffer *buffer
-+ , int x
-+ , int y
-+ , int32_t width
-+ , int32_t height);
-+ bool CreateShmPool(int fd, int32_t size, int prot);
-+ void FreeShmPool();
-+ /* Create wl_buffer from shm_pool */
-+ struct wl_buffer * CreateShmBuffer(unsigned width
-+ , unsigned height
-+ , unsigned stride
-+ , uint32_t PIXEL_FORMAT_ID);
-+ void FreeShmBuffer(struct wl_buffer *buffer);
-+ int Dispatch();
-+ struct wl_buffer * CreatePlanarBuffer(uint32_t name
-+ , int32_t width
-+ , int32_t height
-+ , uint32_t format
-+ , int32_t offsets[3]
-+ , int32_t pitches[3]);
-+ virtual struct wl_buffer * CreatePrimeBuffer(uint32_t name
-+ , int32_t width
-+ , int32_t height
-+ , uint32_t format
-+ , int32_t offsets[3]
-+ , int32_t pitches[3]);
-+ struct wl_display * GetDisplay() { return m_display; }
-+ struct wl_registry * GetRegistry() { return m_registry; }
-+ struct wl_compositor * GetCompositor() { return m_compositor; }
-+ struct wl_shell * GetShell() { return m_shell; }
-+ struct wl_drm * GetDrm() { return m_drm; }
-+ struct wl_shm * GetShm() { return m_shm; };
-+ struct wl_shm_pool * GetShmPool() { return m_pool; }
-+ struct wl_surface * GetSurface() { return m_surface; }
-+ struct wl_shell_surface * GetShellSurface() { return m_shell_surface; }
-+ struct wl_callback * GetCallback() { return m_callback; }
-+ void SetCompositor(struct wl_compositor *compositor)
-+ {
-+ m_compositor = compositor;
-+ }
-+ void SetShell(struct wl_shell *shell)
-+ {
-+ m_shell = shell;
-+ }
-+ void SetShm(struct wl_shm *shm)
-+ {
-+ m_shm = shm;
-+ }
-+ void SetDrm(struct wl_drm *drm)
-+ {
-+ m_drm = drm;
-+ }
-+ void DrmHandleDevice(const char* device);
-+ void DrmHandleAuthenticated();
-+ void RegistryGlobal(struct wl_registry *registry
-+ , uint32_t name
-+ , const char *interface
-+ , uint32_t version);
-+ void DisplayFlush()
-+ {
-+ wl_display_flush(m_display);
-+ }
-+ virtual int DisplayRoundtrip();
-+ void DestroyCallback();
-+ virtual void Sync();
-+ virtual void SetPerfMode(bool perf_mode);
-+ void AddBufferToList(wld_buffer *buffer);
-+ void RemoveBufferFromList(struct wl_buffer *buffer);
-+ void DestroyBufferList();
-+ private:
-+ //no copies allowed
-+ Wayland(const Wayland &);
-+ void operator = (const Wayland&);
-+
-+ struct wl_display *m_display;
-+ struct wl_registry *m_registry;
-+ struct wl_compositor *m_compositor;
-+ struct wl_shell *m_shell;
-+ struct wl_drm *m_drm;
-+ struct wl_shm *m_shm;
-+ struct wl_shm_pool *m_pool;
-+ struct wl_surface *m_surface;
-+ struct wl_shell_surface *m_shell_surface;
-+ struct wl_callback *m_callback;
-+ struct wl_event_queue *m_event_queue;
-+ volatile int m_pending_frame;
-+ struct ShmPool *m_shm_pool;
-+ int m_display_fd;
-+ int m_fd;
-+ struct pollfd m_poll;
-+ drm_intel_bufmgr *m_bufmgr;
-+ char *m_device_name;
-+ int m_x, m_y;
-+ bool m_perf_mode;
-+ protected:
-+ std::list<wld_buffer*> m_buffers_list;
-+};
-+
-+extern "C" Wayland* WaylandCreate();
-+extern "C" void WaylandDestroy(Wayland *pWld);
-+
-+#endif //LIBVA_WAYLAND_SUPPORT
-+
-+#endif /* WAYLAND_CLASS_H */
-diff --git a/tools/legacy/sample_misc/wayland/include/listener_wayland.h b/tools/legacy/sample_misc/wayland/include/listener_wayland.h
-new file mode 100644
-index 0000000..1bbaa91
---- /dev/null
-+++ b/tools/legacy/sample_misc/wayland/include/listener_wayland.h
-@@ -0,0 +1,66 @@
-+/******************************************************************************\
-+Copyright (c) 2005-2019, Intel Corporation
-+All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-+
-+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-+
-+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-+
-+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+This sample was distributed or derived from the Intel's Media Samples package.
-+The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
-+or https://software.intel.com/en-us/media-client-solutions-support.
-+\**********************************************************************************/
-+
-+#ifndef LISTENER_WAYLAND_H
-+#define LISTENER_WAYLAND_H
-+
-+#include "class_wayland.h"
-+
-+/* drm listeners */
-+void drm_handle_device(void *data
-+ , struct wl_drm *drm
-+ , const char *device);
-+
-+void drm_handle_format(void *data
-+ , struct wl_drm *drm
-+ , uint32_t format);
-+
-+void drm_handle_authenticated(void *data
-+ , struct wl_drm *drm);
-+
-+void drm_handle_capabilities(void *data
-+ , struct wl_drm *drm
-+ , uint32_t value);
-+
-+/* registry listeners */
-+void registry_handle_global(void *data
-+ , struct wl_registry *registry
-+ , uint32_t name
-+ , const char *interface
-+ , uint32_t version);
-+
-+void remove_registry_global(void *data
-+ , struct wl_registry *regsitry
-+ , uint32_t name);
-+
-+/* surface listener */
-+void shell_surface_ping(void *data
-+ , struct wl_shell_surface *shell_surface
-+ , uint32_t serial);
-+
-+void shell_surface_configure(void *data
-+ , struct wl_shell_surface *shell_surface
-+ , uint32_t edges
-+ , int32_t width
-+ , int32_t height);
-+
-+void handle_done(void *data, struct wl_callback *callback, uint32_t time);
-+
-+void buffer_release(void *data, struct wl_buffer *buffer);
-+#endif /* LISTENER_WAYLAND_H */
-diff --git a/tools/legacy/sample_misc/wayland/include/wayland-drm-client-protocol.h b/tools/legacy/sample_misc/wayland/include/wayland-drm-client-protocol.h
-new file mode 100644
-index 0000000..e11b35d
---- /dev/null
-+++ b/tools/legacy/sample_misc/wayland/include/wayland-drm-client-protocol.h
-@@ -0,0 +1,235 @@
-+/*
-+ * Copyright � 2008-2011 Kristian H�gsberg
-+ * Copyright � 2010-2011 Intel Corporation
-+ *
-+ * Permission to use, copy, modify, distribute, and sell this
-+ * software and its documentation for any purpose is hereby granted
-+ * without fee, provided that\n the above copyright notice appear in
-+ * all copies and that both that copyright notice and this permission
-+ * notice appear in supporting documentation, and that the name of
-+ * the copyright holders not be used in advertising or publicity
-+ * pertaining to distribution of the software without specific,
-+ * written prior permission. The copyright holders make no
-+ * representations about the suitability of this software for any
-+ * purpose. It is provided "as is" without express or implied
-+ * warranty.
-+ *
-+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
-+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
-+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
-+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
-+ * THIS SOFTWARE.
-+ */
-+
-+#ifndef DRM_CLIENT_PROTOCOL_H
-+#define DRM_CLIENT_PROTOCOL_H
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+#include <stdint.h>
-+#include <stddef.h>
-+#include "wayland-client.h"
-+
-+struct wl_client;
-+struct wl_resource;
-+
-+struct wl_drm;
-+
-+extern const struct wl_interface wl_drm_interface;
-+
-+#ifndef WL_DRM_ERROR_ENUM
-+#define WL_DRM_ERROR_ENUM
-+enum wl_drm_error {
-+ WL_DRM_ERROR_AUTHENTICATE_FAIL = 0,
-+ WL_DRM_ERROR_INVALID_FORMAT = 1,
-+ WL_DRM_ERROR_INVALID_NAME = 2,
-+};
-+#endif /* WL_DRM_ERROR_ENUM */
-+
-+#ifndef WL_DRM_FORMAT_ENUM
-+#define WL_DRM_FORMAT_ENUM
-+enum wl_drm_format {
-+ WL_DRM_FORMAT_C8 = 0x20203843,
-+ WL_DRM_FORMAT_RGB332 = 0x38424752,
-+ WL_DRM_FORMAT_BGR233 = 0x38524742,
-+ WL_DRM_FORMAT_XRGB4444 = 0x32315258,
-+ WL_DRM_FORMAT_XBGR4444 = 0x32314258,
-+ WL_DRM_FORMAT_RGBX4444 = 0x32315852,
-+ WL_DRM_FORMAT_BGRX4444 = 0x32315842,
-+ WL_DRM_FORMAT_ARGB4444 = 0x32315241,
-+ WL_DRM_FORMAT_ABGR4444 = 0x32314241,
-+ WL_DRM_FORMAT_RGBA4444 = 0x32314152,
-+ WL_DRM_FORMAT_BGRA4444 = 0x32314142,
-+ WL_DRM_FORMAT_XRGB1555 = 0x35315258,
-+ WL_DRM_FORMAT_XBGR1555 = 0x35314258,
-+ WL_DRM_FORMAT_RGBX5551 = 0x35315852,
-+ WL_DRM_FORMAT_BGRX5551 = 0x35315842,
-+ WL_DRM_FORMAT_ARGB1555 = 0x35315241,
-+ WL_DRM_FORMAT_ABGR1555 = 0x35314241,
-+ WL_DRM_FORMAT_RGBA5551 = 0x35314152,
-+ WL_DRM_FORMAT_BGRA5551 = 0x35314142,
-+ WL_DRM_FORMAT_RGB565 = 0x36314752,
-+ WL_DRM_FORMAT_BGR565 = 0x36314742,
-+ WL_DRM_FORMAT_RGB888 = 0x34324752,
-+ WL_DRM_FORMAT_BGR888 = 0x34324742,
-+ WL_DRM_FORMAT_XRGB8888 = 0x34325258,
-+ WL_DRM_FORMAT_XBGR8888 = 0x34324258,
-+ WL_DRM_FORMAT_RGBX8888 = 0x34325852,
-+ WL_DRM_FORMAT_BGRX8888 = 0x34325842,
-+ WL_DRM_FORMAT_ARGB8888 = 0x34325241,
-+ WL_DRM_FORMAT_ABGR8888 = 0x34324241,
-+ WL_DRM_FORMAT_RGBA8888 = 0x34324152,
-+ WL_DRM_FORMAT_BGRA8888 = 0x34324142,
-+ WL_DRM_FORMAT_XRGB2101010 = 0x30335258,
-+ WL_DRM_FORMAT_XBGR2101010 = 0x30334258,
-+ WL_DRM_FORMAT_RGBX1010102 = 0x30335852,
-+ WL_DRM_FORMAT_BGRX1010102 = 0x30335842,
-+ WL_DRM_FORMAT_ARGB2101010 = 0x30335241,
-+ WL_DRM_FORMAT_ABGR2101010 = 0x30334241,
-+ WL_DRM_FORMAT_RGBA1010102 = 0x30334152,
-+ WL_DRM_FORMAT_BGRA1010102 = 0x30334142,
-+ WL_DRM_FORMAT_YUYV = 0x56595559,
-+ WL_DRM_FORMAT_YVYU = 0x55595659,
-+ WL_DRM_FORMAT_UYVY = 0x59565955,
-+ WL_DRM_FORMAT_VYUY = 0x59555956,
-+ WL_DRM_FORMAT_AYUV = 0x56555941,
-+ WL_DRM_FORMAT_NV12 = 0x3231564e,
-+ WL_DRM_FORMAT_NV21 = 0x3132564e,
-+ WL_DRM_FORMAT_NV16 = 0x3631564e,
-+ WL_DRM_FORMAT_NV61 = 0x3136564e,
-+ WL_DRM_FORMAT_YUV410 = 0x39565559,
-+ WL_DRM_FORMAT_YVU410 = 0x39555659,
-+ WL_DRM_FORMAT_YUV411 = 0x31315559,
-+ WL_DRM_FORMAT_YVU411 = 0x31315659,
-+ WL_DRM_FORMAT_YUV420 = 0x32315559,
-+ WL_DRM_FORMAT_YVU420 = 0x32315659,
-+ WL_DRM_FORMAT_YUV422 = 0x36315559,
-+ WL_DRM_FORMAT_YVU422 = 0x36315659,
-+ WL_DRM_FORMAT_YUV444 = 0x34325559,
-+ WL_DRM_FORMAT_YVU444 = 0x34325659,
-+};
-+#endif /* WL_DRM_FORMAT_ENUM */
-+
-+#ifndef WL_DRM_CAPABILITY_ENUM
-+#define WL_DRM_CAPABILITY_ENUM
-+/**
-+ * wl_drm_capability - wl_drm capability bitmask
-+ * @WL_DRM_CAPABILITY_PRIME: wl_drm prime available
-+ *
-+ * Bitmask of capabilities.
-+ */
-+enum wl_drm_capability {
-+ WL_DRM_CAPABILITY_PRIME = 1,
-+};
-+#endif /* WL_DRM_CAPABILITY_ENUM */
-+
-+struct wl_drm_listener {
-+ /**
-+ * device - (none)
-+ * @name: (none)
-+ */
-+ void (*device)(void *data,
-+ struct wl_drm *wl_drm,
-+ const char *name);
-+ /**
-+ * format - (none)
-+ * @format: (none)
-+ */
-+ void (*format)(void *data,
-+ struct wl_drm *wl_drm,
-+ uint32_t format);
-+ /**
-+ * authenticated - (none)
-+ */
-+ void (*authenticated)(void *data,
-+ struct wl_drm *wl_drm);
-+ /**
-+ * capabilities - (none)
-+ * @value: (none)
-+ */
-+ void (*capabilities)(void *data,
-+ struct wl_drm *wl_drm,
-+ uint32_t value);
-+};
-+
-+static inline int
-+wl_drm_add_listener(struct wl_drm *wl_drm,
-+ const struct wl_drm_listener *listener, void *data)
-+{
-+ return wl_proxy_add_listener((struct wl_proxy *) wl_drm,
-+ (void (**)(void)) listener, data);
-+}
-+
-+#define WL_DRM_AUTHENTICATE 0
-+#define WL_DRM_CREATE_BUFFER 1
-+#define WL_DRM_CREATE_PLANAR_BUFFER 2
-+#define WL_DRM_CREATE_PRIME_BUFFER 3
-+
-+static inline void
-+wl_drm_set_user_data(struct wl_drm *wl_drm, void *user_data)
-+{
-+ wl_proxy_set_user_data((struct wl_proxy *) wl_drm, user_data);
-+}
-+
-+static inline void *
-+wl_drm_get_user_data(struct wl_drm *wl_drm)
-+{
-+ return wl_proxy_get_user_data((struct wl_proxy *) wl_drm);
-+}
-+
-+static inline void
-+wl_drm_destroy(struct wl_drm *wl_drm)
-+{
-+ wl_proxy_destroy((struct wl_proxy *) wl_drm);
-+}
-+
-+static inline void
-+wl_drm_authenticate(struct wl_drm *wl_drm, uint32_t id)
-+{
-+ wl_proxy_marshal((struct wl_proxy *) wl_drm,
-+ WL_DRM_AUTHENTICATE, id);
-+}
-+
-+static inline struct wl_buffer *
-+wl_drm_create_buffer(struct wl_drm *wl_drm, uint32_t name, int32_t width, int32_t height, uint32_t stride, uint32_t format)
-+{
-+ struct wl_proxy *id;
-+
-+ id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_drm,
-+ WL_DRM_CREATE_BUFFER, &wl_buffer_interface, NULL, name, width, height, stride, format);
-+
-+ return (struct wl_buffer *) id;
-+}
-+
-+static inline struct wl_buffer *
-+wl_drm_create_planar_buffer(struct wl_drm *wl_drm, uint32_t name, int32_t width, int32_t height, uint32_t format, int32_t offset0, int32_t stride0, int32_t offset1, int32_t stride1, int32_t offset2, int32_t stride2)
-+{
-+ struct wl_proxy *id;
-+
-+ id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_drm,
-+ WL_DRM_CREATE_PLANAR_BUFFER, &wl_buffer_interface, NULL, name, width, height, format, offset0, stride0, offset1, stride1, offset2, stride2);
-+
-+ return (struct wl_buffer *) id;
-+}
-+
-+static inline struct wl_buffer *
-+wl_drm_create_prime_buffer(struct wl_drm *wl_drm, int32_t name, int32_t width, int32_t height, uint32_t format, int32_t offset0, int32_t stride0, int32_t offset1, int32_t stride1, int32_t offset2, int32_t stride2)
-+{
-+ struct wl_proxy *id;
-+
-+ id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_drm,
-+ WL_DRM_CREATE_PRIME_BUFFER, &wl_buffer_interface, NULL, name, width, height, format, offset0, stride0, offset1, stride1, offset2, stride2);
-+
-+ return (struct wl_buffer *) id;
-+}
-+
-+#ifdef __cplusplus
-+}
-+#endif
-+
-+#endif
-diff --git a/tools/legacy/sample_misc/wayland/src/class_wayland.cpp b/tools/legacy/sample_misc/wayland/src/class_wayland.cpp
-new file mode 100644
-index 0000000..2bafdb2
---- /dev/null
-+++ b/tools/legacy/sample_misc/wayland/src/class_wayland.cpp
-@@ -0,0 +1,500 @@
-+/******************************************************************************\
-+Copyright (c) 2005-2019, Intel Corporation
-+All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-+
-+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-+
-+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-+
-+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+This sample was distributed or derived from the Intel's Media Samples package.
-+The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
-+or https://software.intel.com/en-us/media-client-solutions-support.
-+\**********************************************************************************/
-+
-+#include <iostream>
-+#include <exception>
-+#include <cstring>
-+#include <fcntl.h>
-+#include <unistd.h>
-+#include <poll.h>
-+#include <sys/mman.h>
-+extern "C" {
-+#include <drm.h>
-+#include <xf86drm.h>
-+#include <intel_bufmgr.h>
-+}
-+#include "class_wayland.h"
-+#include "listener_wayland.h"
-+#include "wayland-drm-client-protocol.h"
-+
-+#define BATCH_SIZE 0x80000
-+
-+struct buffer {
-+ struct wl_buffer *buffer;
-+ mfxFrameSurface1 *pInSurface;
-+};
-+
-+static const struct wl_callback_listener frame_listener = {
-+ handle_done
-+};
-+
-+static const struct wl_buffer_listener buffer_listener = {
-+ buffer_release
-+};
-+
-+Wayland::Wayland()
-+ : m_display(NULL)
-+ , m_registry(NULL)
-+ , m_compositor(NULL)
-+ , m_shell(NULL)
-+ , m_drm(NULL)
-+ , m_shm(NULL)
-+ , m_pool(NULL)
-+ , m_surface(NULL)
-+ , m_shell_surface(NULL)
-+ , m_callback(NULL)
-+ , m_event_queue(NULL)
-+ , m_pending_frame(0)
-+ , m_shm_pool(NULL)
-+ , m_display_fd(-1)
-+ , m_fd(-1)
-+ , m_bufmgr(NULL)
-+ , m_device_name(NULL)
-+ , m_x(0), m_y(0)
-+ , m_perf_mode(false)
-+{
-+ std::memset(&m_poll, 0, sizeof(m_poll));
-+}
-+
-+bool Wayland::InitDisplay()
-+{
-+ static const struct wl_registry_listener registry_listener = {
-+ .global = registry_handle_global,
-+ .global_remove = remove_registry_global
-+ };
-+
-+ m_display = wl_display_connect(NULL);
-+ if (NULL == m_display) {
-+ std::cout << "Error: Cannot connect to wayland display\n";
-+ return false;
-+ }
-+ m_registry = wl_display_get_registry(m_display);
-+ wl_registry_add_listener(m_registry
-+ , &registry_listener
-+ , this);
-+
-+ m_display_fd = wl_display_get_fd(m_display);
-+ wl_display_roundtrip(m_display);
-+ wl_display_roundtrip(m_display);
-+ m_event_queue = wl_display_create_queue(m_display);
-+ if(NULL == m_event_queue)
-+ return false;
-+
-+ m_poll.fd = m_display_fd;
-+ m_poll.events = POLLIN;
-+ return true;
-+}
-+
-+int Wayland::DisplayRoundtrip()
-+{
-+ return wl_display_roundtrip(m_display);
-+}
-+
-+bool Wayland::CreateSurface()
-+{
-+ static const struct wl_shell_surface_listener
-+ shell_surface_listener = {
-+ shell_surface_ping,
-+ shell_surface_configure
-+ };
-+
-+ m_surface = wl_compositor_create_surface(m_compositor);
-+ if (NULL == m_surface)
-+ return false;
-+
-+ m_shell_surface = wl_shell_get_shell_surface(m_shell
-+ , m_surface);
-+ if(NULL == m_shell_surface)
-+ {
-+ wl_surface_destroy(m_surface);
-+ return false;
-+ }
-+
-+ wl_shell_surface_add_listener(m_shell_surface
-+ , &shell_surface_listener
-+ , 0);
-+ wl_shell_surface_set_toplevel(m_shell_surface);
-+ wl_shell_surface_set_user_data(m_shell_surface, m_surface);
-+ wl_surface_set_user_data(m_surface, NULL);
-+ return true;
-+}
-+
-+
-+void Wayland::FreeSurface()
-+{
-+ if(NULL != m_shell_surface)
-+ wl_shell_surface_destroy(m_shell_surface);
-+ if(NULL != m_surface)
-+ wl_surface_destroy(m_surface);
-+}
-+
-+void Wayland::Sync()
-+{
-+ int ret;
-+ while(NULL != m_callback)
-+ {
-+ while(wl_display_prepare_read_queue(m_display, m_event_queue) < 0)
-+ wl_display_dispatch_queue_pending(m_display, m_event_queue);
-+
-+ wl_display_flush(m_display);
-+
-+ ret = poll(&m_poll,1,-1);
-+ if(ret < 0 )
-+ wl_display_cancel_read(m_display);
-+ else
-+ wl_display_read_events(m_display);
-+ wl_display_dispatch_queue_pending(m_display, m_event_queue);
-+ }
-+}
-+
-+void Wayland::SetPerfMode(bool perf_mode)
-+{
-+ m_perf_mode = perf_mode;
-+}
-+
-+void Wayland::SetRenderWinPos(int x, int y)
-+{
-+ m_x = x; m_y = y;
-+}
-+
-+void Wayland::RenderBuffer(struct wl_buffer *buffer
-+ , mfxFrameSurface1 *surface)
-+{
-+ wld_buffer *m_buffer = new wld_buffer;
-+ if (m_buffer == NULL)
-+ return;
-+
-+ m_buffer->buffer = buffer;
-+ m_buffer->pInSurface = surface;
-+
-+ wl_surface_attach(m_surface, buffer, 0, 0);
-+ wl_surface_damage(m_surface, m_x, m_y, surface->Info.CropW, surface->Info.CropH);
-+
-+ wl_proxy_set_queue((struct wl_proxy *) buffer, m_event_queue);
-+
-+ AddBufferToList(m_buffer);
-+ wl_buffer_add_listener(buffer, &buffer_listener, this);
-+ m_pending_frame=1;
-+ if (m_perf_mode)
-+ m_callback = wl_display_sync(m_display);
-+ else
-+ m_callback = wl_surface_frame(m_surface);
-+ wl_callback_add_listener(m_callback, &frame_listener, this);
-+ wl_proxy_set_queue((struct wl_proxy *) m_callback, m_event_queue);
-+ wl_surface_commit(m_surface);
-+ wl_display_dispatch_queue(m_display, m_event_queue);
-+ /* Force a Sync before and after render to ensure client handles
-+ wayland events in a timely fashion. This also fixes the one time
-+ flicker issue on wl_shell_surface pointer enter */
-+ Sync();
-+
-+}
-+
-+void Wayland::RenderBufferWinPosSize(struct wl_buffer *buffer
-+ , int x
-+ , int y
-+ , int32_t width
-+ , int32_t height)
-+{
-+ wl_surface_attach(m_surface, buffer, 0, 0);
-+ wl_surface_damage(m_surface, x, y, width, height);
-+
-+ wl_proxy_set_queue((struct wl_proxy *) buffer, m_event_queue);
-+
-+ wl_buffer_add_listener(buffer, &buffer_listener, NULL);
-+ m_pending_frame=1;
-+ if (m_perf_mode)
-+ m_callback = wl_display_sync(m_display);
-+ else
-+ m_callback = wl_surface_frame(m_surface);
-+ wl_callback_add_listener(m_callback, &frame_listener, this);
-+ wl_proxy_set_queue((struct wl_proxy *) m_callback, m_event_queue);
-+ wl_surface_commit(m_surface);
-+ wl_display_dispatch_queue(m_display, m_event_queue);
-+}
-+
-+
-+void Wayland::DestroyCallback()
-+{
-+ if(m_callback)
-+ {
-+ wl_callback_destroy(m_callback);
-+ m_callback = NULL;
-+ m_pending_frame=0;
-+ }
-+}
-+
-+//ShmPool
-+bool Wayland::CreateShmPool(int fd, int32_t size, int prot)
-+{
-+ m_shm_pool = new struct ShmPool;
-+ if (NULL == m_shm_pool)
-+ return false;
-+
-+ m_shm_pool->capacity = size;
-+ m_shm_pool->size = 0;
-+ m_shm_pool->fd = fd;
-+
-+ m_shm_pool->memory = static_cast<uint32_t*>(mmap(0
-+ , size
-+ , prot
-+ , MAP_SHARED
-+ , m_shm_pool->fd
-+ , 0));
-+ if (MAP_FAILED == m_shm_pool->memory)
-+ {
-+ delete m_shm_pool;
-+ return false;
-+ }
-+
-+ m_pool = wl_shm_create_pool(m_shm
-+ , m_shm_pool->fd
-+ , size);
-+ if (NULL == m_pool)
-+ {
-+ munmap(m_shm_pool->memory, size);
-+ delete m_shm_pool;
-+ return false;
-+ }
-+ wl_shm_pool_set_user_data(m_pool, m_shm_pool);
-+ return true;
-+}
-+
-+
-+void Wayland::FreeShmPool()
-+{
-+ wl_shm_pool_destroy(m_pool);
-+ munmap(m_shm_pool->memory, m_shm_pool->capacity);
-+ delete m_shm_pool;
-+}
-+
-+
-+struct wl_buffer * Wayland::CreateShmBuffer(unsigned width
-+ , unsigned height
-+ , unsigned stride
-+ , uint32_t PIXEL_FORMAT_ID)
-+{
-+ struct wl_buffer *buffer;
-+ buffer = wl_shm_pool_create_buffer(m_pool
-+ , m_shm_pool->size*sizeof(uint32_t)
-+ , width
-+ , height
-+ , stride
-+ , PIXEL_FORMAT_ID);
-+ if(NULL == buffer)
-+ return NULL;
-+
-+ m_shm_pool->size += stride*height;
-+ return buffer;
-+}
-+
-+void Wayland::FreeShmBuffer(struct wl_buffer *buffer)
-+{
-+ wl_buffer_destroy(buffer);
-+}
-+
-+int Wayland::Dispatch()
-+{
-+ return wl_display_dispatch(m_display);
-+}
-+
-+struct wl_buffer * Wayland::CreatePlanarBuffer(uint32_t name
-+ , int32_t width
-+ , int32_t height
-+ , uint32_t format
-+ , int32_t offsets[3]
-+ , int32_t pitches[3])
-+{
-+ struct wl_buffer * buffer = NULL;
-+ if(NULL == m_drm)
-+ return NULL;
-+
-+ buffer = wl_drm_create_planar_buffer(m_drm
-+ , name
-+ , width
-+ , height
-+ , format
-+ , offsets[0]
-+ , pitches[0]
-+ , offsets[1]
-+ , pitches[1]
-+ , offsets[2]
-+ , pitches[2]);
-+ return buffer;
-+}
-+
-+struct wl_buffer * Wayland::CreatePrimeBuffer(uint32_t name
-+ , int32_t width
-+ , int32_t height
-+ , uint32_t format
-+ , int32_t offsets[3]
-+ , int32_t pitches[3])
-+{
-+ struct wl_buffer * buffer = NULL;
-+ if(NULL == m_drm)
-+ return NULL;
-+
-+ buffer = wl_drm_create_prime_buffer(m_drm
-+ , name
-+ , width
-+ , height
-+ , format
-+ , offsets[0]
-+ , pitches[0]
-+ , offsets[1]
-+ , pitches[1]
-+ , offsets[2]
-+ , pitches[2]);
-+ return buffer;
-+}
-+
-+Wayland::~Wayland()
-+{
-+ if(NULL != m_shell)
-+ wl_shell_destroy(m_shell);
-+ if(NULL != m_shm)
-+ wl_shm_destroy(m_shm);
-+ if(NULL != m_bufmgr) {
-+ drm_intel_bufmgr_destroy(m_bufmgr);
-+ }
-+ if(NULL != m_compositor)
-+ wl_compositor_destroy(m_compositor);
-+ if(NULL != m_event_queue)
-+ wl_event_queue_destroy(m_event_queue);
-+ if(0 != m_buffers_list.size())
-+ DestroyBufferList();
-+ if(NULL != m_registry)
-+ wl_registry_destroy(m_registry);
-+ if(NULL != m_display)
-+ wl_display_disconnect(m_display);
-+ if(NULL != m_device_name)
-+ delete m_device_name;
-+}
-+
-+// Registry
-+void Wayland::RegistryGlobal(struct wl_registry *registry
-+ , uint32_t name
-+ , const char *interface
-+ , uint32_t version)
-+{
-+ if(0 == strcmp(interface, "wl_compositor"))
-+ m_compositor = static_cast<wl_compositor*>
-+ (wl_registry_bind(registry
-+ , name
-+ , &wl_compositor_interface
-+ , version));
-+ else if(0 == strcmp(interface, "wl_shell"))
-+ m_shell = static_cast<wl_shell*>
-+ (wl_registry_bind(registry
-+ , name
-+ , &wl_shell_interface
-+ , version));
-+ else if(0 == strcmp(interface, "wl_drm")) {
-+ static const struct wl_drm_listener drm_listener = {
-+ drm_handle_device,
-+ drm_handle_format,
-+ drm_handle_authenticated,
-+ drm_handle_capabilities
-+ };
-+ m_drm = static_cast<wl_drm*>(wl_registry_bind(registry
-+ , name
-+ , &wl_drm_interface
-+ , 2));
-+ wl_drm_add_listener(m_drm, &drm_listener, this);
-+ }
-+}
-+
-+void Wayland::DrmHandleDevice(const char *name)
-+{
-+ m_device_name = strdup(name);
-+ if (!m_device_name)
-+ return;
-+
-+ drm_magic_t magic;
-+ m_fd = open(m_device_name, O_RDWR | O_CLOEXEC);
-+ if (-1 == m_fd) {
-+ std::cout << "Error: Could not open " <<
-+ m_device_name << "\n";
-+ return;
-+ }
-+ int type = drmGetNodeTypeFromFd(m_fd);
-+ if (type != DRM_NODE_RENDER) {
-+ drmGetMagic(m_fd, &magic);
-+ wl_drm_authenticate(m_drm, magic);
-+ }
-+}
-+
-+void Wayland::DrmHandleAuthenticated()
-+{
-+ m_bufmgr = drm_intel_bufmgr_gem_init(m_fd, BATCH_SIZE);
-+}
-+
-+void Wayland::AddBufferToList(wld_buffer *buffer)
-+{
-+ if (buffer == NULL)
-+ return;
-+
-+ if (buffer->pInSurface) {
-+ msdkFrameSurface *surface = FindUsedSurface(buffer->pInSurface);
-+ msdk_atomic_inc16(&(surface->render_lock));
-+ m_buffers_list.push_back(buffer);
-+ }
-+}
-+
-+void Wayland::RemoveBufferFromList(struct wl_buffer *buffer)
-+{
-+ wld_buffer *m_buffer = NULL;
-+ m_buffer = m_buffers_list.front();
-+ if (NULL != m_buffer && (m_buffer->buffer == buffer)) {
-+ if (m_buffer->pInSurface) {
-+ msdkFrameSurface *surface = FindUsedSurface(m_buffer->pInSurface);
-+ msdk_atomic_dec16(&(surface->render_lock));
-+ }
-+ m_buffer->buffer = NULL;
-+ m_buffer->pInSurface = NULL;
-+ m_buffers_list.pop_front();
-+ delete m_buffer;
-+ }
-+}
-+
-+void Wayland::DestroyBufferList()
-+{
-+ wld_buffer *m_buffer = NULL;
-+ while (!m_buffers_list.empty())
-+ {
-+ m_buffer = m_buffers_list.front();
-+ if (m_buffer->pInSurface)
-+ {
-+ msdkFrameSurface *surface = FindUsedSurface(m_buffer->pInSurface);
-+ msdk_atomic_dec16(&(surface->render_lock));
-+ }
-+ m_buffers_list.pop_front();
-+ delete m_buffer;
-+ }
-+}
-+
-+Wayland* WaylandCreate()
-+{
-+ return new Wayland;
-+}
-+
-+void WaylandDestroy(Wayland *pWld)
-+{
-+ delete pWld;
-+}
-diff --git a/tools/legacy/sample_misc/wayland/src/listener_wayland.cpp b/tools/legacy/sample_misc/wayland/src/listener_wayland.cpp
-new file mode 100644
-index 0000000..90f582a
---- /dev/null
-+++ b/tools/legacy/sample_misc/wayland/src/listener_wayland.cpp
-@@ -0,0 +1,105 @@
-+/******************************************************************************\
-+Copyright (c) 2005-2019, Intel Corporation
-+All rights reserved.
-+
-+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-+
-+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-+
-+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-+
-+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-+
-+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+This sample was distributed or derived from the Intel's Media Samples package.
-+The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
-+or https://software.intel.com/en-us/media-client-solutions-support.
-+\**********************************************************************************/
-+
-+#include <iostream>
-+#include "listener_wayland.h"
-+#include "class_wayland.h"
-+
-+/* drm listener */
-+void drm_handle_device(void *data
-+ , struct wl_drm *drm
-+ , const char *device)
-+{
-+ Wayland *wayland = static_cast<Wayland*>(data);
-+ wayland->DrmHandleDevice(device);
-+}
-+
-+void drm_handle_format(void *data
-+ , struct wl_drm *drm
-+ , uint32_t format)
-+{
-+ /* NOT IMPLEMENTED */
-+}
-+
-+void drm_handle_capabilities(void *data
-+ , struct wl_drm *drm
-+ , uint32_t value)
-+{
-+ /* NOT IMPLEMENTED */
-+}
-+
-+void drm_handle_authenticated(void *data
-+ , struct wl_drm *drm)
-+{
-+ Wayland *wayland = static_cast<Wayland*>(data);
-+ wayland->DrmHandleAuthenticated();
-+}
-+
-+/* registry listener */
-+void registry_handle_global(void *data
-+ , struct wl_registry *registry
-+ , uint32_t name
-+ , const char *interface
-+ , uint32_t version)
-+{
-+ Wayland *wayland = static_cast<Wayland*>(data);
-+ wayland->RegistryGlobal(registry
-+ , name
-+ , interface
-+ , version);
-+}
-+
-+void remove_registry_global(void *data
-+ , struct wl_registry *registy
-+ , uint32_t name)
-+{
-+ /* NOT IMPLEMENTED */
-+}
-+
-+
-+/* surface listener */
-+void shell_surface_ping(void *data
-+ , struct wl_shell_surface *shell_surface
-+ , uint32_t serial)
-+{
-+ wl_shell_surface_pong(shell_surface, serial);
-+}
-+
-+void shell_surface_configure(void *data
-+ , struct wl_shell_surface *shell_surface
-+ , uint32_t edges
-+ , int32_t width
-+ , int32_t height)
-+{
-+ /* NOT IMPLEMENTED */
-+}
-+
-+void handle_done(void *data, struct wl_callback *callback, uint32_t time)
-+{
-+ Wayland *wayland = static_cast<Wayland*>(data);
-+ wayland->DestroyCallback();
-+}
-+
-+void buffer_release(void *data, struct wl_buffer *buffer)
-+{
-+ Wayland *wayland = static_cast<Wayland*>(data);
-+ wayland->RemoveBufferFromList(buffer);
-+ wl_buffer_destroy(buffer);
-+ buffer = NULL;
-+}
-diff --git a/tools/legacy/sample_misc/wayland/src/wayland-drm-protocol.c b/tools/legacy/sample_misc/wayland/src/wayland-drm-protocol.c
-new file mode 100644
-index 0000000..8e1fd50
---- /dev/null
-+++ b/tools/legacy/sample_misc/wayland/src/wayland-drm-protocol.c
-@@ -0,0 +1,84 @@
-+/*
-+ * Copyright � 2008-2011 Kristian H�gsberg
-+ * Copyright � 2010-2011 Intel Corporation
-+ *
-+ * Permission to use, copy, modify, distribute, and sell this
-+ * software and its documentation for any purpose is hereby granted
-+ * without fee, provided that\n the above copyright notice appear in
-+ * all copies and that both that copyright notice and this permission
-+ * notice appear in supporting documentation, and that the name of
-+ * the copyright holders not be used in advertising or publicity
-+ * pertaining to distribution of the software without specific,
-+ * written prior permission. The copyright holders make no
-+ * representations about the suitability of this software for any
-+ * purpose. It is provided "as is" without express or implied
-+ * warranty.
-+ *
-+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
-+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
-+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
-+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
-+ * THIS SOFTWARE.
-+ */
-+
-+#include <stdlib.h>
-+#include <stdint.h>
-+#include "wayland-util.h"
-+
-+extern const struct wl_interface wl_buffer_interface;
-+
-+static const struct wl_interface *types[] = {
-+ NULL,
-+ &wl_buffer_interface,
-+ NULL,
-+ NULL,
-+ NULL,
-+ NULL,
-+ NULL,
-+ &wl_buffer_interface,
-+ NULL,
-+ NULL,
-+ NULL,
-+ NULL,
-+ NULL,
-+ NULL,
-+ NULL,
-+ NULL,
-+ NULL,
-+ NULL,
-+ &wl_buffer_interface,
-+ NULL,
-+ NULL,
-+ NULL,
-+ NULL,
-+ NULL,
-+ NULL,
-+ NULL,
-+ NULL,
-+ NULL,
-+ NULL,
-+};
-+
-+static const struct wl_message wl_drm_requests[] = {
-+ { "authenticate", "u", types + 0 },
-+ { "create_buffer", "nuiiuu", types + 1 },
-+ { "create_planar_buffer", "nuiiuiiiiii", types + 7 },
-+ { "create_prime_buffer", "2nhiiuiiiiii", types + 18 },
-+};
-+
-+static const struct wl_message wl_drm_events[] = {
-+ { "device", "s", types + 0 },
-+ { "format", "u", types + 0 },
-+ { "authenticated", "", types + 0 },
-+ { "capabilities", "u", types + 0 },
-+};
-+
-+WL_EXPORT const struct wl_interface wl_drm_interface = {
-+ "wl_drm", 2,
-+ 4, wl_drm_requests,
-+ 4, wl_drm_events,
-+};
-+
---
-2.7.4
-
diff --git a/recipes-multimedia/onevpl/onevpl/0001-Remove-duplicate-MFXVideoDECODE_VPP-from-samples.patch b/recipes-multimedia/onevpl/onevpl/0001-Remove-duplicate-MFXVideoDECODE_VPP-from-samples.patch
deleted file mode 100644
index 8470e418..00000000
--- a/recipes-multimedia/onevpl/onevpl/0001-Remove-duplicate-MFXVideoDECODE_VPP-from-samples.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From 0b74a78b99822bce5ea197513dd5683f41badd7b Mon Sep 17 00:00:00 2001
-From: Jon Recker <jon.recker@intel.com>
-Date: Mon, 29 Mar 2021 09:59:03 -0700
-Subject: [PATCH] Remove duplicate MFXVideoDECODE_VPP from samples
-
-Upstream-Status: Submitted
----
- .../sample_common/include/sample_vpl_common.h | 38 -------------------
- 1 file changed, 38 deletions(-)
-
-diff --git a/tools/legacy/sample_common/include/sample_vpl_common.h b/tools/legacy/sample_common/include/sample_vpl_common.h
-index 4450b7f..016955a 100644
---- a/tools/legacy/sample_common/include/sample_vpl_common.h
-+++ b/tools/legacy/sample_common/include/sample_vpl_common.h
-@@ -49,44 +49,6 @@ public:
- }
- };
-
--class MFXVideoDECODE_VPP {
--public:
-- explicit MFXVideoDECODE_VPP(mfxSession session) {
-- m_session = session;
-- }
-- virtual ~MFXVideoDECODE_VPP(void) {}
--
-- virtual mfxStatus Init(mfxVideoParam *decode_par,
-- mfxVideoChannelParam **vpp_par_array,
-- mfxU32 num_vpp_par) {
-- return MFXVideoDECODE_VPP_Init(m_session, decode_par, vpp_par_array, num_vpp_par);
-- }
--
-- virtual mfxStatus DecodeFrameAsync(mfxBitstream *bs,
-- mfxU32 *skip_channels,
-- mfxU32 num_skip_channels,
-- mfxSurfaceArray **surf_array_out) {
-- return MFXVideoDECODE_VPP_DecodeFrameAsync(m_session,
-- bs,
-- skip_channels,
-- num_skip_channels,
-- surf_array_out);
-- }
--
-- virtual mfxStatus Reset(mfxVideoParam *decode_par,
-- mfxVideoChannelParam **vpp_par_array,
-- mfxU32 num_vpp_par) {
-- return MFXVideoDECODE_VPP_Reset(m_session, decode_par, vpp_par_array, num_vpp_par);
-- }
--
-- virtual mfxStatus GetChannelParam(mfxVideoChannelParam *par, mfxU32 channel_id) {
-- return MFXVideoDECODE_VPP_GetChannelParam(m_session, par, channel_id);
-- }
--
--protected:
-- mfxSession m_session; // (mfxSession) handle to the owning session
--};
--
- #endif
-
- #endif //__SAMPLE_VPL_COMMON_H__
---
-2.31.1
-
diff --git a/recipes-multimedia/onevpl/onevpl/0001-Update-headers-to-oneAPI-spec-v2.3-e170992.patch b/recipes-multimedia/onevpl/onevpl/0001-Update-headers-to-oneAPI-spec-v2.3-e170992.patch
deleted file mode 100644
index 030b395c..00000000
--- a/recipes-multimedia/onevpl/onevpl/0001-Update-headers-to-oneAPI-spec-v2.3-e170992.patch
+++ /dev/null
@@ -1,741 +0,0 @@
-From bb2f6199088879568e31f91f6d9b7aa737c5aa04 Mon Sep 17 00:00:00 2001
-From: Jon Recker <jon.recker@intel.com>
-Date: Wed, 9 Jun 2021 10:39:10 +0800
-Subject: [PATCH] Update headers to oneAPI-spec v2.3 (e170992)
-
-Upstream-Status: Submitted
----
- api/vpl/mfx.h | 25 ++++++++
- api/vpl/mfxcommon.h | 9 ++-
- api/vpl/mfxdefs.h | 86 ++++++++++++-------------
- api/vpl/mfxdispatcher.h | 4 +-
- api/vpl/mfximplcaps.h | 4 +-
- api/vpl/mfxsession.h | 11 +++-
- api/vpl/mfxstructures.h | 137 ++++++++++++++++++++++------------------
- api/vpl/mfxvideo++.h | 76 ++++++++++++++++++++++
- 8 files changed, 238 insertions(+), 114 deletions(-)
- create mode 100644 api/vpl/mfx.h
-
-diff --git a/api/vpl/mfx.h b/api/vpl/mfx.h
-new file mode 100644
-index 0000000..32fc50b
---- /dev/null
-+++ b/api/vpl/mfx.h
-@@ -0,0 +1,25 @@
-+/*############################################################################
-+ # Copyright (C) 2021 Intel Corporation
-+ #
-+ # SPDX-License-Identifier: MIT
-+ ############################################################################*/
-+
-+#ifndef __MFX_H__
-+#define __MFX_H__
-+
-+#include "mfxdefs.h"
-+#include "mfxcommon.h"
-+#include "mfxstructures.h"
-+#include "mfxdispatcher.h"
-+#include "mfximplcaps.h"
-+#include "mfxsession.h"
-+#include "mfxvideo.h"
-+#include "mfxadapter.h"
-+
-+#include "mfxbrc.h"
-+#include "mfxmvc.h"
-+#include "mfxpcp.h"
-+#include "mfxvp8.h"
-+#include "mfxjpeg.h"
-+
-+#endif /* __MFXDEFS_H__ */
-diff --git a/api/vpl/mfxcommon.h b/api/vpl/mfxcommon.h
-index 90a2f3d..9884aa4 100644
---- a/api/vpl/mfxcommon.h
-+++ b/api/vpl/mfxcommon.h
-@@ -172,7 +172,7 @@ typedef struct {
- } mfxExtThreadsParam;
- MFX_PACK_END()
-
--/*! The PlatformCodeName enumerator itemizes microarchitecture code names for the Legacy mode.
-+/*! The PlatformCodeName enumerator itemizes product code names for platforms.
- For details about Intel code names, see ark.intel.com. */
- enum {
- MFX_PLATFORM_UNKNOWN = 0, /*!< Unknown platform. */
-@@ -192,6 +192,10 @@ enum {
- MFX_PLATFORM_JASPERLAKE = 32, /*!< Code name Jasper Lake. */
- MFX_PLATFORM_ELKHARTLAKE = 33, /*!< Code name Elkhart Lake. */
- MFX_PLATFORM_TIGERLAKE = 40, /*!< Code name Tiger Lake. */
-+ MFX_PLATFORM_ROCKETLAKE = 42, /*!< Code name Rocket Lake. */
-+ MFX_PLATFORM_ALDERLAKE_S = 43, /*!< Code name Alder Lake S. */
-+ MFX_PLATFORM_ALDERLAKE_P = 44, /*!< Code name Alder Lake P. */
-+ MFX_PLATFORM_ARCTICSOUND_P = 45, /*!< Code name Arctic Sound P. */
- MFX_PLATFORM_KEEMBAY = 50, /*!< Code name Keem Bay. */
- };
-
-@@ -370,7 +374,6 @@ typedef enum {
- MFX_ACCEL_MODE_VIA_HDDLUNITE = 0x0500, /*!< Hardware acceleration goes through the HDDL* Unite*. */
- } mfxAccelerationMode;
-
--
- #define MFX_ACCELERATIONMODESCRIPTION_VERSION MFX_STRUCT_VERSION(1, 0)
-
- MFX_PACK_BEGIN_STRUCT_W_PTR()
-@@ -438,7 +441,7 @@ typedef struct {
- mfxU16 reserved[3]; /*!< Reserved for future use. */
- mfxU16 NumExtParam; /*!< The number of extra configuration structures attached to this structure. */
- mfxExtBuffer **ExtParam; /*!< Points to an array of pointers to the extra configuration structures; see the ExtendedBufferID enumerator for a list of extended configurations. */
-- mfxU32 VendorImplID; /*!< Vendor specific number with given implementation ID. Represents the same filed from mfxImplDescription. */
-+ mfxU32 VendorImplID; /*!< Vendor specific number with given implementation ID. Represents the same field from mfxImplDescription. */
- mfxU32 reserved2[3]; /*!< Reserved for future use. */
- } mfxInitializationParam;
- MFX_PACK_END()
-diff --git a/api/vpl/mfxdefs.h b/api/vpl/mfxdefs.h
-index 14cece0..dfd9f98 100644
---- a/api/vpl/mfxdefs.h
-+++ b/api/vpl/mfxdefs.h
-@@ -8,7 +8,7 @@
- #define __MFXDEFS_H__
-
- #define MFX_VERSION_MAJOR 2
--#define MFX_VERSION_MINOR 2
-+#define MFX_VERSION_MINOR 3
-
- // MFX_VERSION - version of API that 'assumed' by build may be provided externally
- // if it omitted then latest stable API derived from Major.Minor is assumed
-@@ -27,7 +27,7 @@
- /*! The corresponding version of the Intel(r) Media SDK legacy API that is used as a basis
- for the current API. */
-
--#define MFX_LEGACY_VERSION 1034
-+#define MFX_LEGACY_VERSION 1035
-
-
- #ifdef __cplusplus
-@@ -90,47 +90,47 @@ extern "C"
- #endif
-
- #ifndef MFX_DEPRECATED_OFF
-- #if defined(__cplusplus) && __cplusplus >= 201402L
-- #define MFX_DEPRECATED [[deprecated]]
-- #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg [[deprecated]]
-- #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
-- #elif defined(__clang__)
-- #define MFX_DEPRECATED __attribute__((deprecated))
-- #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated))
-- #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
-- #elif defined(__INTEL_COMPILER)
-- #if (defined(_WIN32) || defined(_WIN64))
-- #define MFX_DEPRECATED __declspec(deprecated)
-- #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
-- #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) __pragma(deprecated(arg))
-- #elif defined(__linux__)
-- #define MFX_DEPRECATED __attribute__((deprecated))
-- #if defined(__cplusplus)
-- #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated))
-- #else
-- #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
-- #endif
-- #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
-- #endif
-- #elif defined(_MSC_VER) && _MSC_VER > 1200 // VS 6 doesn't support deprecation
-- #define MFX_DEPRECATED __declspec(deprecated)
-- #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
-- #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) __pragma(deprecated(arg))
-- #elif defined(__GNUC__)
-- #define MFX_DEPRECATED __attribute__((deprecated))
-- #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated))
-- #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
-- #else
-- #define MFX_DEPRECATED
-- #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
-- #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
-- #endif
--#else
-- #define MFX_DEPRECATED
-- #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
-- #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
--#endif
--
-+ #if defined(__cplusplus) && __cplusplus >= 201402L
-+ #define MFX_DEPRECATED [[deprecated]]
-+ #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg [[deprecated]]
-+ #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
-+ #elif defined(__clang__)
-+ #define MFX_DEPRECATED __attribute__((deprecated))
-+ #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated))
-+ #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
-+ #elif defined(__INTEL_COMPILER)
-+ #if (defined(_WIN32) || defined(_WIN64))
-+ #define MFX_DEPRECATED __declspec(deprecated)
-+ #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
-+ #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) __pragma(deprecated(arg))
-+ #elif defined(__linux__)
-+ #define MFX_DEPRECATED __attribute__((deprecated))
-+ #if defined(__cplusplus)
-+ #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated))
-+ #else
-+ #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
-+ #endif
-+ #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
-+ #endif
-+ #elif defined(_MSC_VER) && _MSC_VER > 1200 // VS 6 doesn't support deprecation
-+ #define MFX_DEPRECATED __declspec(deprecated)
-+ #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
-+ #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) __pragma(deprecated(arg))
-+ #elif defined(__GNUC__)
-+ #define MFX_DEPRECATED __attribute__((deprecated))
-+ #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated))
-+ #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
-+ #else
-+ #define MFX_DEPRECATED
-+ #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
-+ #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
-+ #endif
-+ #else
-+ #define MFX_DEPRECATED
-+ #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
-+ #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
-+ #endif
-+
- typedef unsigned char mfxU8; /*!< Unsigned integer, 8 bit type. */
- typedef char mfxI8; /*!< Signed integer, 8 bit type. */
- typedef short mfxI16; /*!< Signed integer, 16 bit type. */
-diff --git a/api/vpl/mfxdispatcher.h b/api/vpl/mfxdispatcher.h
-index 8db716b..86ecea3 100644
---- a/api/vpl/mfxdispatcher.h
-+++ b/api/vpl/mfxdispatcher.h
-@@ -1,5 +1,5 @@
- /*############################################################################
-- # Copyright (C) Intel Corporation
-+ # Copyright (C) 2020 Intel Corporation
- #
- # SPDX-License-Identifier: MIT
- ############################################################################*/
-@@ -193,7 +193,7 @@ mfxStatus MFX_CDECL MFXCreateSession(mfxLoader loader, mfxU32 i, mfxSession* ses
-
- /*!
- @brief
-- Destroys handle allocated by the MFXQueryImplsCapabilities function.
-+ Destroys handle allocated by the MFXEnumImplementations function.
-
- @param[in] loader Loader handle.
- @param[in] hdl Handle to destroy. Can be equal to NULL.
-diff --git a/api/vpl/mfximplcaps.h b/api/vpl/mfximplcaps.h
-index 16851d0..514a1c4 100644
---- a/api/vpl/mfximplcaps.h
-+++ b/api/vpl/mfximplcaps.h
-@@ -1,5 +1,5 @@
- /*############################################################################
-- # Copyright (C) Intel Corporation
-+ # Copyright (C) 2020 Intel Corporation
- #
- # SPDX-License-Identifier: MIT
- ############################################################################*/
-@@ -33,7 +33,7 @@ mfxHDL* MFX_CDECL MFXQueryImplsDescription(mfxImplCapsDeliveryFormat format, mfx
-
- /*!
- @brief
-- Destroys the handle allocated by the MFXQueryImplsCapabilities function.
-+ Destroys the handle allocated by the MFXQueryImplsDescription function.
- Implementation must remember which handles are released. Once the last handle is released, this function must release memory
- allocated for the array of handles.
-
-diff --git a/api/vpl/mfxsession.h b/api/vpl/mfxsession.h
-index e9c7127..7e2493a 100644
---- a/api/vpl/mfxsession.h
-+++ b/api/vpl/mfxsession.h
-@@ -49,6 +49,9 @@ typedef struct _mfxSession *mfxSession;
- MFX_ERR_UNSUPPORTED The function cannot find the desired legacy Intel(r) Media SDK implementation or version.
-
- @since This function is available since API version 1.0.
-+
-+ @deprecated Deprecated in API version 2.3. Use MFXLoad and MFXCreateSession to initialize the session.
-+ Use MFX_DEPRECATED_OFF macro to turn off the deprecation message visualization.
- */
- MFX_DEPRECATED mfxStatus MFX_CDECL MFXInit(mfxIMPL impl, mfxVersion *ver, mfxSession *session);
-
-@@ -56,8 +59,7 @@ MFX_DEPRECATED mfxStatus MFX_CDECL MFXInit(mfxIMPL impl, mfxVersion *ver, mfxSes
- @brief
- Creates and initializes a session in the legacy mode for compatibility with Intel(r) Media SDK applications.
- This function is deprecated starting from API version 2.0, applications must use MFXLoad with mfxCreateSession
-- to select the implementation and initialize the session.
--
-+ to select the implementation and initialize the session.
-
- Call this function before calling any other API functions.
- If the desired implementation specified by ``par`` is MFX_IMPL_AUTO, the function will search for
-@@ -72,7 +74,7 @@ MFX_DEPRECATED mfxStatus MFX_CDECL MFXInit(mfxIMPL impl, mfxVersion *ver, mfxSes
- For example, if an application uses only H.264 decoding as described in API v1.0, the application should initialize the library with API v1.0. This ensures backward compatibility.
-
- The argument ``par.ExternalThreads`` specifies threading mode. Value 0 means that the implementation should create and
-- handle work threads internally (this is essentially the equivalent of the regular MFXInit). I
-+ handle work threads internally (this is essentially the equivalent of the regular MFXInit).
-
- @param[in] par mfxInitParam structure that indicates the desired implementation, minimum library version and desired threading mode.
- @param[out] session Pointer to the session handle.
-@@ -82,6 +84,9 @@ MFX_DEPRECATED mfxStatus MFX_CDECL MFXInit(mfxIMPL impl, mfxVersion *ver, mfxSes
- MFX_ERR_UNSUPPORTED The function cannot find the desired implementation or version.
-
- @since This function is available since API version 1.14.
-+
-+ @deprecated Deprecated in API version 2.3. Use MFXLoad and MFXCreateSession to initialize the session.
-+ Use MFX_DEPRECATED_OFF macro to turn off the deprecation message visualization.
- */
- MFX_DEPRECATED mfxStatus MFX_CDECL MFXInitEx(mfxInitParam par, mfxSession *session);
-
-diff --git a/api/vpl/mfxstructures.h b/api/vpl/mfxstructures.h
-index f285979..94d8d25 100644
---- a/api/vpl/mfxstructures.h
-+++ b/api/vpl/mfxstructures.h
-@@ -40,13 +40,13 @@ MFX_PACK_BEGIN_USUAL_STRUCT()
- /*! Specifies properties of video frames. See also "Configuration Parameter Constraints" chapter. */
- typedef struct {
- mfxU32 reserved[4]; /*!< Reserved for future use. */
-- /*! The unique ID of each VPP channel set by application. It's required that during Init/Reset application fills ChannelId for
-- each mfxVideoChannelParam provided by the application and the SDK sets it back to the correspondent
-- mfxSurfaceArray::mfxFrameSurface1 to distinguish different channels. It's expected that surfaces for some channels might be
-- returned with some delay so application has to use mfxFrameInfo::ChannelId to distinguish what returned surface belongs to
-- what VPP channel. Decoder's initialization parameters are always sent through channel with mfxFrameInfo::ChannelId equals to
-+ /*! The unique ID of each VPP channel set by application. It's required that during Init/Reset application fills ChannelId for
-+ each mfxVideoChannelParam provided by the application and the SDK sets it back to the correspondent
-+ mfxSurfaceArray::mfxFrameSurface1 to distinguish different channels. It's expected that surfaces for some channels might be
-+ returned with some delay so application has to use mfxFrameInfo::ChannelId to distinguish what returned surface belongs to
-+ what VPP channel. Decoder's initialization parameters are always sent through channel with mfxFrameInfo::ChannelId equals to
- zero. It's allowed to skip setting of decoder's parameters for simplified decoding procedure */
-- mfxU16 ChannelId;
-+ mfxU16 ChannelId;
- /*! Number of bits used to represent luma samples.
- @note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported. */
- mfxU16 BitDepthLuma;
-@@ -552,22 +552,22 @@ typedef struct mfxFrameSurfaceInterface {
- MFX_ERR_UNKNOWN Any internal error.
- */
- mfxStatus (MFX_CDECL *Synchronize)(mfxFrameSurface1* surface, mfxU32 wait);
--
-+
- /*! @brief
-- The library calls the function after complete of associated video operation
-- notifying the application that frame surface is ready.
--
-- @attention This is callback function and intended to be called by
-- the library only.
--
-- It is expected that the function is low-intrusive designed otherwise it may
-- impact performance.
-+ The library calls the function after complete of associated video operation
-+ notifying the application that frame surface is ready.
-+
-+ @attention This is callback function and intended to be called by
-+ the library only.
-+
-+ It is expected that the function is low-intrusive designed otherwise it may
-+ impact performance.
-
- @param[in] sts The status of completed operation.
-
- */
- void (MFX_CDECL *OnComplete)(mfxStatus sts);
--
-+
- mfxHDL reserved2[3];
- } mfxFrameSurfaceInterface;
- MFX_PACK_END()
-@@ -719,22 +719,22 @@ typedef struct {
- return MFX_ERR_REALLOC_SURFACE. See the CodingOptionValue enumerator for values of this option. Use the Query API
- function to check if this feature is supported. */
- mfxU16 EnableReallocRequest;
-- /*! Special parameter for AV1 decoder. Indicates presence/absence of film grain parameters in bitstream.
-- Also controls decoding behavior for streams with film grain parameters. MFXVideoDECODE_DecodeHeader returns nonzero FilmGrain
-+ /*! Special parameter for AV1 decoder. Indicates presence/absence of film grain parameters in bitstream.
-+ Also controls decoding behavior for streams with film grain parameters. MFXVideoDECODE_DecodeHeader returns nonzero FilmGrain
- for streams with film grain parameters and zero for streams w/o them. Decoding with film grain requires additional output surfaces.
- If FilmGrain` is non-zero then MFXVideoDECODE_QueryIOSurf will request more surfaces in case of external allocated video memory at decoder output.
- FilmGrain is passed to MFXVideoDECODE_Init function to control decoding operation for AV1 streams with film grain parameters.
-- If FilmGrain is nonzero decoding of each frame require two output surfaces (one for reconstructed frame and one for output frame with film grain applied).
-+ If FilmGrain is nonzero decoding of each frame require two output surfaces (one for reconstructed frame and one for output frame with film grain applied).
- The decoder returns MFX_ERR_MORE_SURFACE from MFXVideoDECODE_DecodeFrameAsync if it has insufficient output surfaces to decode frame.
-- Application can forcibly disable the feature passing zero value of `FilmGrain` to `MFXVideoDECODE_Init`.
-- In this case the decoder will output reconstructed frames w/o film grain applied.
-+ Application can forcibly disable the feature passing zero value of `FilmGrain` to `MFXVideoDECODE_Init`.
-+ In this case the decoder will output reconstructed frames w/o film grain applied.
- Application can retrieve film grain parameters for a frame by attaching extended buffer mfxExtAV1FilmGrainParam to mfxFrameSurface1.
- If stream has no film grain parameters `FilmGrain` passed to `MFXVideoDECODE_Init` is ignored by the decoder. */
- mfxU16 FilmGrain;
- /*! If not zero, it forces SDK to attempt to decode bitstream even if a decoder may not support all features associated with given CodecLevel. Decoder may produce visual artifacts. Only AVC decoder supports this field. */
- mfxU16 IgnoreLevelConstrain;
- /*! This flag is used to disable output of main decoding channel. When it's ON SkipOutput = MFX_CODINGOPTION_ON decoder outputs only video processed channels. For pure decode this flag should be always disabled. */
-- mfxU16 SkipOutput;
-+ mfxU16 SkipOutput;
- mfxU16 reserved2[4];
- };
- struct { /* JPEG Decoding Options */
-@@ -898,7 +898,7 @@ enum {
- MFX_LEVEL_AVC_6 =60,
- MFX_LEVEL_AVC_61 =61,
- MFX_LEVEL_AVC_62 =62,
-- /*! @} */
-+ /*! @} */
-
- /*! @{ */
- /* MPEG2 Profiles. */
-@@ -1484,8 +1484,7 @@ typedef struct {
- mfxU16 WinBRCSize;
-
- /*! When rate control method is MFX_RATECONTROL_QVBR, this parameter specifies quality factor.
--Values are in the 1 to 51 range,
-- where 1 corresponds to the best quality.
-+ Values are in the 1 to 51 range, where 1 corresponds to the best quality.
- */
- mfxU16 QVBRQuality;
- /*!
-@@ -1678,6 +1677,7 @@ Values are in the 1 to 51 range,
- This parameter is valid only during initialization.
- */
- mfxU16 AdaptiveCQM;
-+
- mfxU16 reserved[162];
- } mfxExtCodingOption3;
- MFX_PACK_END()
-@@ -2024,13 +2024,16 @@ enum {
- See the mfxExtInCrops structure for details.
- */
- MFX_EXTBUFF_CROPS = MFX_MAKEFOURCC('C', 'R', 'O', 'P'),
--
-+
- /*!
- See the mfxExtAV1FilmGrainParam structure for more details.
- */
-- MFX_EXTBUFF_AV1_FILM_GRAIN_PARAM = MFX_MAKEFOURCC('A','1','F','G')
-+ MFX_EXTBUFF_AV1_FILM_GRAIN_PARAM = MFX_MAKEFOURCC('A','1','F','G'),
-
--
-+ /*!
-+ See the mfxExtHyperModeParam structure for more details.
-+ */
-+ MFX_EXTBUFF_HYPER_MODE_PARAM = MFX_MAKEFOURCC('H', 'Y', 'P', 'M')
- };
-
- /* VPP Conf: Do not use certain algorithms */
-@@ -2488,10 +2491,10 @@ MFX_PACK_BEGIN_STRUCT_W_PTR()
- Each filter may be included in the pipeline in one of two different ways:
-
- @li Adding a filter ID to this structure. In this method,
-- the default filter parameters are used.
--
-+ the default filter parameters are used.
-+
- @li Attaching a filter configuration structure directly to the mfxVideoParam structure.
-- In this method, adding filter ID to the mfxExtVPPDoUse structure is optional.
-+ In this method, adding filter ID to the mfxExtVPPDoUse structure is optional.
-
- See Table “Configurable VPP filters” for complete list of
- configurable filters, their IDs, and configuration structures.
-@@ -2590,7 +2593,7 @@ MFX_PACK_BEGIN_USUAL_STRUCT()
-
- On some platforms this filter is not supported. To query its support, the application should use the same approach that it uses
- to configure VPP filters: adding the filter ID to the mfxExtVPPDoUse structure or by attaching the mfxExtVPPImageStab structure
-- directly to the mfxVideoParam structure and calling the MFXVideoVPP_Query function.
-+ directly to the mfxVideoParam structure and calling the MFXVideoVPP_Query function.
-
- If this filter is supported, the function returns a MFX_ERR_NONE
- status and copies the content of the input structure to the output structure. If the filter is not supported, the function returns MFX_WRN_FILTER_SKIPPED, removes the
-@@ -2617,14 +2620,14 @@ enum {
-
- MFX_PACK_BEGIN_USUAL_STRUCT()
- /*!
-- Configures the HDR SEI message.
-+ Configures the HDR SEI message.
-
- If the application attaches this structure to the mfxEncodeCtrl structure
-- at runtime, the encoder inserts the HDR SEI message for the current frame and ignores InsertPayloadToggle.
-+ at runtime, the encoder inserts the HDR SEI message for the current frame and ignores InsertPayloadToggle.
-
- If the application attaches this
- structure to the mfxVideoParam structure during initialization or reset, the encoder inserts the HDR SEI message based on InsertPayloadToggle.
--
-+
- Field semantics are defined in ITU-T* H.265 Annex D.
- */
- typedef struct {
-@@ -2633,10 +2636,10 @@ typedef struct {
-
- mfxU16 InsertPayloadToggle; /*!< InsertHDRPayload enumerator value. */
- mfxU16 DisplayPrimariesX[3]; /*!< Color primaries for a video source in increments of 0.00002. Consist of RGB x coordinates and
-- define how to convert colors from RGB color space to CIE XYZ color space. Fields range is
-+ define how to convert colors from RGB color space to CIE XYZ color space. Fields range is
- 0 to 50000. */
- mfxU16 DisplayPrimariesY[3]; /*!< Color primaries for a video source in increments of 0.00002. Consists of RGB y coordinates and
-- defines how to convert colors from RGB color space to CIE XYZ color space. Field range is
-+ defines how to convert colors from RGB color space to CIE XYZ color space. Field range is
- 0 to 50000. */
- mfxU16 WhitePointX; /*!< White point X coordinate. */
- mfxU16 WhitePointY; /*!< White point Y coordinate. */
-@@ -2649,14 +2652,14 @@ MFX_PACK_END()
-
- MFX_PACK_BEGIN_USUAL_STRUCT()
- /*!
-- Configures the HDR SEI message.
-+ Configures the HDR SEI message.
-
- If the application attaches this structure to the mfxEncodeCtrl
-- structure at runtime, the encoder inserts the HDR SEI message for the current frame and ignores InsertPayloadToggle.
-+ structure at runtime, the encoder inserts the HDR SEI message for the current frame and ignores InsertPayloadToggle.
-
- If the application
- attaches this structure to the mfxVideoParam structure during initialization or reset, the encoder inserts the HDR SEI message based on
-- InsertPayloadToggle.
-+ InsertPayloadToggle.
-
- Field semantics are defined in ITU-T* H.265 Annex D.
- */
-@@ -3659,12 +3662,8 @@ enum {
- MFX_SCALING_MODE_DEFAULT = 0, /*!< Default scaling mode. The library selects the most appropriate scaling method. */
- MFX_SCALING_MODE_LOWPOWER = 1, /*!< Low power scaling mode which is applicable for library implementations.
- The exact scaling algorithm is defined by the library. */
-- MFX_SCALING_MODE_QUALITY = 2, /*!< The best quality scaling mode. */
--
--
-+ MFX_SCALING_MODE_QUALITY = 2, /*!< The best quality scaling mode. */
- MFX_SCALING_MODE_VENDOR = 1000, /*!< The enumeration to separate common scaling controls above and vendor specific. */
--
--
- MFX_SCALING_MODE_INTEL_GEN_COMPUTE = MFX_SCALING_MODE_VENDOR + 1, /*! The mode to run scaling operation on Execution Units (EUs). */
- MFX_SCALING_MODE_INTEL_GEN_VDBOX = MFX_SCALING_MODE_VENDOR + 2, /*! The special optimization mode where scaling operation running on SFC (Scaler & Format Converter) is coupled with VDBOX (also known as Multi-Format Codec fixed-function engine). This mode is applicable for DECODE_VPP domain functions. */
- MFX_SCALING_MODE_INTEL_GEN_VEBOX = MFX_SCALING_MODE_VENDOR + 3 /*! The special optimization mode where scaling operation running on SFC is coupled with VEBOX (HW video processing pipe). */
-@@ -4040,14 +4039,14 @@ MFX_PACK_BEGIN_USUAL_STRUCT()
- */
- typedef struct {
- mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_MCTF. */
-- mfxU16 FilterStrength; /*!< Value in range of 0 to 20 (inclusive) to indicate the filter strength of MCTF.
-+ mfxU16 FilterStrength; /*!< Value in range of 0 to 20 (inclusive) to indicate the filter strength of MCTF.
-
- The strength of the MCTF process controls the degree of possible change of pixel values eligible for MCTF - the greater the strength value, the larger the change. It is a dimensionless quantity - values in the range of 1 to 20 inclusively imply strength; value 0 stands for AUTO mode and is
- valid during initialization or reset only
-
- If an invalid value is given, it is fixed to the default value of 0.
- If the field value is in the range of 1 to 20 inclusive, MCTF operates in fixed-strength mode with the given strength of MCTF process.
--
-+
- At runtime, values of 0 and greater than 20 are ignored. */
- mfxU16 reserved[27];
- } mfxExtVppMctf;
-@@ -4160,7 +4159,7 @@ typedef struct {
- } mfxExtDeviceAffinityMask;
- MFX_PACK_END()
-
--/*! The FilmGrainFlags enumerator itemizes flags in AV1 film grain parameters.
-+/*! The FilmGrainFlags enumerator itemizes flags in AV1 film grain parameters.
- The flags are equivalent to respective syntax elements from film_grain_params() section of uncompressed header. */
- enum {
- MFX_FILM_GRAIN_NO = 0, /*!< Film grain isn't added to this frame. */
-@@ -4196,7 +4195,7 @@ typedef struct {
- mfxAV1FilmGrainPoint PointCb[10]; /*!< The array of points for Cb component. */
- mfxAV1FilmGrainPoint PointCr[10]; /*!< The array of points for Cr component. */
-
-- mfxU8 GrainScalingMinus8; /*!< The shift – 8 applied to the values of the chroma component. The grain_scaling_minus_8 can take values of 0..3 and
-+ mfxU8 GrainScalingMinus8; /*!< The shift – 8 applied to the values of the chroma component. The grain_scaling_minus_8 can take values of 0..3 and
- determines the range and quantization step of the standard deviation of film grain.*/
- mfxU8 ArCoeffLag; /*!< The number of auto-regressive coefficients for luma and chroma.*/
-
-@@ -4204,8 +4203,8 @@ typedef struct {
- mfxU8 ArCoeffsCbPlus128[25]; /*!< Auto-regressive coefficients used for the Cb plane. */
- mfxU8 ArCoeffsCrPlus128[25]; /*!< The number of points for the piece-wise linear scaling function of the Cr component.*/
-
-- mfxU8 ArCoeffShiftMinus6; /*!< The range of the auto-regressive coefficients.
-- Values of 0, 1, 2, and 3 correspond to the ranges for auto-regressive coefficients of
-+ mfxU8 ArCoeffShiftMinus6; /*!< The range of the auto-regressive coefficients.
-+ Values of 0, 1, 2, and 3 correspond to the ranges for auto-regressive coefficients of
- [-2, 2), [-1, 1), [-0.5, 0.5) and [-0.25, 0.25) respectively.*/
- mfxU8 GrainScaleShift; /*!< Downscaling factor of the grain synthesis process for the Gaussian random numbers .*/
-
-@@ -4229,8 +4228,8 @@ MFX_PACK_BEGIN_STRUCT_W_PTR()
- typedef struct mfxSurfaceArray
- {
- mfxHDL Context; /*!< The context of the memory interface. User should not touch (change, set, null) this pointer. */
-- mfxStructVersion Version; /*!< The version of the structure. */
-- mfxU16 reserved[3];
-+ mfxStructVersion Version; /*!< The version of the structure. */
-+ mfxU16 reserved[3];
- /*! @brief
- Increments the internal reference counter of the surface. The surface is not destroyed until the surface is released using the (*Release) function. (*AddRef) should be used each time a new link to the surface is created (for example, copy structure) for proper surface management.
-
-@@ -4242,11 +4241,11 @@ typedef struct mfxSurfaceArray
- MFX_ERR_INVALID_HANDLE If mfxSurfaceArray->Context is invalid (for example NULL). \n
- MFX_ERR_UNKNOWN Any internal error.
-
-- */
-- mfxStatus (*AddRef)(struct mfxSurfaceArray* surface_array);
-+ */
-+ mfxStatus (*AddRef)(struct mfxSurfaceArray* surface_array);
- /*! @brief
-- Decrements the internal reference counter of the surface. (*Release) should be called after using the (*AddRef) function to add a
-- surface or when allocation logic requires it.
-+ Decrements the internal reference counter of the surface. (*Release) should be called after using the (*AddRef) function to add a
-+ surface or when allocation logic requires it.
-
- @param[in] surface_array Valid mfxSurfaceArray.
-
-@@ -4257,7 +4256,7 @@ typedef struct mfxSurfaceArray
- MFX_ERR_UNDEFINED_BEHAVIOR If Reference Counter of surface is zero before call. \n
- MFX_ERR_UNKNOWN Any internal error.
- */
-- mfxStatus (*Release)(struct mfxSurfaceArray* surface_array);
-+ mfxStatus (*Release)(struct mfxSurfaceArray* surface_array);
-
- /*! @brief
- Returns current reference counter of mfxSurfaceArray structure.
-@@ -4270,10 +4269,10 @@ typedef struct mfxSurfaceArray
- MFX_ERR_NULL_PTR If surface or counter is NULL. \n
- MFX_ERR_INVALID_HANDLE If mfxSurfaceArray->Context is invalid (for example NULL). \n
- MFX_ERR_UNKNOWN Any internal error.
-- */
-+ */
- mfxStatus (*GetRefCounter)(struct mfxSurfaceArray* surface_array, mfxU32* counter);
-
-- mfxFrameSurface1** Surfaces; /*!< The array of pointers to mfxFrameSurface1. mfxFrameSurface1 surfaces are allocated by the same
-+ mfxFrameSurface1** Surfaces; /*!< The array of pointers to mfxFrameSurface1. mfxFrameSurface1 surfaces are allocated by the same
- agent who allocates mfxSurfaceArray. */
- mfxU32 NumSurfaces; /*!<The size of array of pointers to mfxFrameSurface1. */
- mfxU32 reserved1;
-@@ -4299,7 +4298,7 @@ MFX_PACK_BEGIN_USUAL_STRUCT()
- mfxU16 Top; /*!< Y coordinate of region of top-left corner of rectangle. */
- mfxU16 Right; /*!< X coordinate of region of bottom-right corner of rectangle. */
- mfxU16 Bottom; /*!< Y coordinate of region of bottom-right corner of rectangle. */
-- } mfxRect;
-+ } mfxRect;
- MFX_PACK_END()
-
- MFX_PACK_BEGIN_USUAL_STRUCT()
-@@ -4313,6 +4312,22 @@ typedef struct {
- }mfxExtInCrops;
- MFX_PACK_END()
-
-+/*! The mfxHyperMode enumerator describes HyperMode implementation behavior. */
-+typedef enum {
-+ MFX_HYPERMODE_OFF = 0x0, /*!< Don't use HyperMode implementation. */
-+ MFX_HYPERMODE_ON = 0x1, /*!< Enable HyperMode implementation and return error if some issue on initialization. */
-+ MFX_HYPERMODE_ADAPTIVE = 0x2, /*!< Enable HyperMode implementation and switch to single fallback if some issue on initialization. */
-+} mfxHyperMode;
-+
-+MFX_PACK_BEGIN_USUAL_STRUCT()
-+/*! The structure is used for HyperMode initialization. */
-+typedef struct {
-+ mfxExtBuffer Header; /*!< Extension buffer header. BufferId must be equal to MFX_EXTBUFF_HYPER_MODE_PARAM. */
-+ mfxHyperMode Mode; /*!< HyperMode implementation behavior. */
-+ mfxU16 reserved[19];
-+} mfxExtHyperModeParam;
-+MFX_PACK_END()
-+
- #ifdef __cplusplus
- } // extern "C"
- #endif
-diff --git a/api/vpl/mfxvideo++.h b/api/vpl/mfxvideo++.h
-index 1b10390..c05cd50 100644
---- a/api/vpl/mfxvideo++.h
-+++ b/api/vpl/mfxvideo++.h
-@@ -71,6 +71,19 @@ public:
- return MFXVideoCORE_SyncOperation(m_session, syncp, wait);
- }
-
-+ virtual mfxStatus GetSurfaceForEncode(mfxFrameSurface1** output_surf) {
-+ return MFXMemory_GetSurfaceForEncode(m_session, output_surf);
-+ }
-+ virtual mfxStatus GetSurfaceForDecode(mfxFrameSurface1** output_surf) {
-+ return MFXMemory_GetSurfaceForDecode(m_session, output_surf);
-+ }
-+ virtual mfxStatus GetSurfaceForVPP (mfxFrameSurface1** output_surf) {
-+ return MFXMemory_GetSurfaceForVPP (m_session, output_surf);
-+ }
-+ virtual mfxStatus GetSurfaceForVPPOut(mfxFrameSurface1** output_surf) {
-+ return MFXMemory_GetSurfaceForVPPOut(m_session, output_surf);
-+ }
-+
- virtual operator mfxSession(void) {
- return m_session;
- }
-@@ -121,6 +134,10 @@ public:
- return MFXVideoENCODE_EncodeFrameAsync(m_session, ctrl, surface, bs, syncp);
- }
-
-+ virtual mfxStatus GetSurface(mfxFrameSurface1** output_surf) {
-+ return MFXMemory_GetSurfaceForEncode(m_session, output_surf);
-+ }
-+
- protected:
- mfxSession m_session; // (mfxSession) handle to the owning session
- };
-@@ -173,6 +190,10 @@ public:
- return MFXVideoDECODE_DecodeFrameAsync(m_session, bs, surface_work, surface_out, syncp);
- }
-
-+ virtual mfxStatus GetSurface(mfxFrameSurface1** output_surf) {
-+ return MFXMemory_GetSurfaceForDecode(m_session, output_surf);
-+ }
-+
- protected:
- mfxSession m_session; // (mfxSession) handle to the owning session
- };
-@@ -215,6 +236,61 @@ public:
- return MFXVideoVPP_RunFrameVPPAsync(m_session, in, out, aux, syncp);
- }
-
-+ virtual mfxStatus GetSurfaceIn(mfxFrameSurface1** output_surf) {
-+ return MFXMemory_GetSurfaceForVPP(m_session, output_surf);
-+ }
-+ virtual mfxStatus GetSurfaceOut(mfxFrameSurface1** output_surf) {
-+ return MFXMemory_GetSurfaceForVPPOut(m_session, output_surf);
-+ }
-+
-+ virtual mfxStatus ProcessFrameAsync(mfxFrameSurface1 *in, mfxFrameSurface1 **out) {
-+ return MFXVideoVPP_ProcessFrameAsync(m_session, in, out);
-+ }
-+
-+protected:
-+ mfxSession m_session; // (mfxSession) handle to the owning session
-+};
-+
-+class MFXVideoDECODE_VPP
-+{
-+public:
-+ explicit MFXVideoDECODE_VPP(mfxSession session) { m_session = session; }
-+ virtual ~MFXVideoDECODE_VPP(void) {
-+ Close();
-+ }
-+
-+ virtual mfxStatus Init(mfxVideoParam* decode_par, mfxVideoChannelParam** vpp_par_array, mfxU32 num_channel_par) {
-+ return MFXVideoDECODE_VPP_Init(m_session, decode_par, vpp_par_array, num_channel_par);
-+ }
-+ virtual mfxStatus Reset(mfxVideoParam* decode_par, mfxVideoChannelParam** vpp_par_array, mfxU32 num_channel_par) {
-+ return MFXVideoDECODE_VPP_Reset(m_session, decode_par, vpp_par_array, num_channel_par);
-+ }
-+ virtual mfxStatus GetChannelParam(mfxVideoChannelParam *par, mfxU32 channel_id) {
-+ return MFXVideoDECODE_VPP_GetChannelParam(m_session, par, channel_id);
-+ }
-+ virtual mfxStatus DecodeFrameAsync(mfxBitstream *bs, mfxU32* skip_channels, mfxU32 num_skip_channels, mfxSurfaceArray **surf_array_out) {
-+ return MFXVideoDECODE_VPP_DecodeFrameAsync(m_session, bs, skip_channels, num_skip_channels, surf_array_out);
-+ }
-+
-+ virtual mfxStatus DecodeHeader(mfxBitstream *bs, mfxVideoParam *par) {
-+ return MFXVideoDECODE_VPP_DecodeHeader(m_session, bs, par);
-+ }
-+ virtual mfxStatus Close(void) {
-+ return MFXVideoDECODE_VPP_Close(m_session);
-+ }
-+ virtual mfxStatus GetVideoParam(mfxVideoParam *par) {
-+ return MFXVideoDECODE_VPP_GetVideoParam(m_session, par);
-+ }
-+ virtual mfxStatus GetDecodeStat(mfxDecodeStat *stat) {
-+ return MFXVideoDECODE_VPP_GetDecodeStat(m_session, stat);
-+ }
-+ virtual mfxStatus GetPayload(mfxU64 *ts, mfxPayload *payload) {
-+ return MFXVideoDECODE_VPP_GetPayload(m_session, ts, payload);
-+ }
-+ virtual mfxStatus SetSkipMode(mfxSkipMode mode) {
-+ return MFXVideoDECODE_VPP_SetSkipMode(m_session, mode);
-+ }
-+
- protected:
- mfxSession m_session; // (mfxSession) handle to the owning session
- };
---
-2.31.1
-
diff --git a/recipes-multimedia/onevpl/onevpl/0001-cmake-Allow-build-env-to-set-variables.patch b/recipes-multimedia/onevpl/onevpl/0001-cmake-Allow-build-env-to-set-variables.patch
deleted file mode 100644
index bb867a83..00000000
--- a/recipes-multimedia/onevpl/onevpl/0001-cmake-Allow-build-env-to-set-variables.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From 79eea3016649aa9e33e564b6971473ac15fa601a Mon Sep 17 00:00:00 2001
-From: Naveen Saini <naveen.kumar.saini@intel.com>
-Date: Tue, 27 Apr 2021 17:09:01 +0800
-Subject: [PATCH] cmake: Allow build env to set variables
-
-Upstream-Status: Inappropriate
-
-Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
----
- cmake/oneAPIInstallDirs.cmake | 32 ++++++++++++++++++++++----------
- 1 file changed, 22 insertions(+), 10 deletions(-)
-
-diff --git a/cmake/oneAPIInstallDirs.cmake b/cmake/oneAPIInstallDirs.cmake
-index 184e19b..0773500 100644
---- a/cmake/oneAPIInstallDirs.cmake
-+++ b/cmake/oneAPIInstallDirs.cmake
-@@ -8,23 +8,35 @@
- # Set installation directories
- #
-
--if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
-- set(CMAKE_INSTALL_BINDIR bin32)
-- set(CMAKE_INSTALL_LIBDIR lib32)
--else()
-- set(CMAKE_INSTALL_BINDIR bin)
-- set(CMAKE_INSTALL_LIBDIR lib)
-+if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
-+ set(CMAKE_INSTALL_LIBDIR lib)
-+endif()
-+
-+if(NOT DEFINED CMAKE_INSTALL_BINDIR)
-+ set(CMAKE_INSTALL_BINDIR bin)
-+endif()
-+
-+if(NOT DEFINED CMAKE_INSTALL_ENVDIR)
-+ set(CMAKE_INSTALL_ENVDIR env)
-+endif()
-+
-+if(NOT DEFINED CMAKE_INSTALL_MODDIR)
-+ set(CMAKE_INSTALL_MODDIR modulefiles)
-+endif()
-+
-+if(NOT CMAKE_INSTALL_EXAMPLEDIR)
-+ set(CMAKE_INSTALL_EXAMPLEDIR examples)
-+endif()
-+
-+if(NOT CMAKE_INSTALL_LICENSEDIR)
-+ set(CMAKE_INSTALL_LICENSEDIR licensing)
- endif()
-
- set(CMAKE_INSTALL_INCLUDEDIR include)
- set(CMAKE_INSTALL_DOCDIR documentation)
--set(CMAKE_INSTALL_ENVDIR env)
--set(CMAKE_INSTALL_MODDIR modulefiles)
- set(CMAKE_INSTALL_SYSCHECKDIR sys_check)
- set(CMAKE_INSTALL_MODFILEDIR modulefiles)
- set(CMAKE_INSTALL_REDISTDIR redist)
--set(CMAKE_INSTALL_EXAMPLEDIR examples)
--set(CMAKE_INSTALL_LICENSEDIR licensing)
- set(CMAKE_INSTALL_TOOLSDIR tools)
- set(CMAKE_INSTALL_SYSCONFDIR config)
- set(CMAKE_INSTALL_SRCDIR src)
---
-2.17.1
-
diff --git a/recipes-multimedia/onevpl/onevpl_2021.2.2.bb b/recipes-multimedia/onevpl/onevpl_2021.2.2.bb
deleted file mode 100644
index 911b5927..00000000
--- a/recipes-multimedia/onevpl/onevpl_2021.2.2.bb
+++ /dev/null
@@ -1,46 +0,0 @@
-SUMMARY = "oneAPI Video Processing Library"
-DESCRIPTION = "The oneAPI Video Processing Library (oneVPL) provides \
-a single video processing API for encode, decode, and video processing \
-that works across a wide range of accelerators."
-
-HOMEPAGE = "https://github.com/oneapi-src/oneVPL"
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=c18ea6bb4786a26bf4eee88a7424a408 \
- file://third-party-programs.txt;md5=0a071a05786c453d52f8b3e511ed39c4"
-
-SRC_URI = "git://github.com/oneapi-src/oneVPL.git;protocol=https \
- file://0001-cmake-Allow-build-env-to-set-variables.patch \
- file://0001-Add-X11-support-to-legacy-tools.patch \
- file://0001-Adding-Wayland-support-to-legacy-tools.patch \
- file://0001-Update-headers-to-oneAPI-spec-v2.3-e170992.patch \
- file://0001-Remove-duplicate-MFXVideoDECODE_VPP-from-samples.patch \
- file://0001-Add-SMT-and-media_sdk_compatibility_headers.patch \
- "
-SRCREV = "17968d8d2299352f5a9e09388d24e81064c81c87"
-S = "${WORKDIR}/git"
-
-inherit cmake
-DEPENDS = "libva"
-
-COMPATIBLE_HOST = '(x86_64).*-linux'
-
-PACKAGES =+ "${PN}-examples"
-
-EXTRA_OECMAKE += " \
- -DVPL_UTIL_PATH=${S}/examples/util \
- -DCMAKE_INSTALL_ENVDIR=${datadir}/vpl/env \
- -DCMAKE_INSTALL_MODDIR=${datadir}/vpl/modulefiles \
- -DCMAKE_INSTALL_EXAMPLEDIR=${datadir}/vpl/examples \
- -DCMAKE_INSTALL_LICENSEDIR=${datadir}/vpl/licensing \
-"
-do_install_append () {
- # delete examples source files
- find "${D}${datadir}/vpl/examples/" -type d \! -name 'examples' \! -name 'content' -exec rm -rf {} +
-}
-
-
-FILES_${PN}-examples = "${bindir}/dpcpp-blur \
- ${bindir}/hello-* \
- ${datadir}/vpl/examples \
- "
-FILES_${PN} += "${datadir}"
diff --git a/recipes-multimedia/vpl/files/0001-vpl.pc.in-dont-pass-pcfiledir-to-cflags.patch b/recipes-multimedia/vpl/files/0001-vpl.pc.in-dont-pass-pcfiledir-to-cflags.patch
new file mode 100644
index 00000000..f9a568a7
--- /dev/null
+++ b/recipes-multimedia/vpl/files/0001-vpl.pc.in-dont-pass-pcfiledir-to-cflags.patch
@@ -0,0 +1,25 @@
+From ff715f4c543ddabc5c90160d0ae5c5598e8e1289 Mon Sep 17 00:00:00 2001
+From: Markus Volk <f_l_k@t-online.de>
+Date: Thu, 15 Jun 2023 13:43:32 +0200
+Subject: [PATCH] vpl.pc.in: dont pass pcfiledir to cflags
+
+Signed-off-by: Markus Volk <f_l_k@t-online.de>
+
+Upstream-Status: Inappropriate [oe specific]
+---
+ libvpl/pkgconfig/vpl.pc.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libvpl/pkgconfig/vpl.pc.in b/libvpl/pkgconfig/vpl.pc.in
+index aa9b158..b4e85ff 100644
+--- a/libvpl/pkgconfig/vpl.pc.in
++++ b/libvpl/pkgconfig/vpl.pc.in
+@@ -7,6 +7,6 @@ Description: Accelerated video decode, encode, and frame processing capabilities
+ Version: @API_VERSION_MAJOR@.@API_VERSION_MINOR@
+ URL: https://github.com/intel/libvpl
+
+-Libs: -L${libdir} -l@OUTPUT_NAME@ @VPL_PKGCONFIG_DEPENDENT_LIBS@
++Libs: -L@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ -l@OUTPUT_NAME@ @VPL_PKGCONFIG_DEPENDENT_LIBS@
+ Libs.private: @VPL_PKGCONFIG_PRIVATE_LIBS@
+-Cflags: -I${includedir} -I${includedir}/vpl
++Cflags: -I@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@ -I@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/vpl
diff --git a/recipes-multimedia/vpl/libvpl_2.10.2.bb b/recipes-multimedia/vpl/libvpl_2.10.2.bb
new file mode 100644
index 00000000..7dbb5417
--- /dev/null
+++ b/recipes-multimedia/vpl/libvpl_2.10.2.bb
@@ -0,0 +1,43 @@
+SUMMARY = "Intel Video Processing Library"
+DESCRIPTION = "Intel Video Processing Library (VPL) provides \
+a single video processing API for encode, decode, and video processing \
+that works across a wide range of accelerators."
+
+HOMEPAGE = "https://github.com/intel/libvpl"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=c18ea6bb4786a26bf4eee88a7424a408 \
+ file://third-party-programs.txt;md5=ddf05049184e74942f45b0ca4cc69b8a"
+
+SRC_URI = "git://github.com/intel/libvpl.git;protocol=https;branch=master \
+ file://0001-vpl.pc.in-dont-pass-pcfiledir-to-cflags.patch \
+ "
+SRCREV = "383b5caac6df614e76ade5a07c4f53be702e9176"
+S = "${WORKDIR}/git"
+
+inherit cmake
+DEPENDS += "libva pkgconfig-native"
+
+PACKAGECONFIG ??= "tools"
+PACKAGECONFIG[tools] = "-DBUILD_TOOLS=ON, -DBUILD_TOOLS=OFF, wayland wayland-native wayland-protocols"
+
+do_install:append() {
+ mkdir -p ${D}${datadir}/VPL/samples
+ mv ${D}${bindir}/sample_* ${D}${datadir}/VPL/samples
+}
+
+COMPATIBLE_HOST = '(x86_64).*-linux'
+
+PACKAGES =+ "${PN}-examples"
+
+RREPLACES:${PN} = "onevpl"
+RCONFLICTS:${PN} = "onevpl"
+
+FILES:${PN}-examples = "${datadir}/vpl \
+ "
+
+FILES_SOLIBSDEV = ""
+FILES:${PN}-dev += "${libdir}/libvpl.so"
+
+FILES:${PN} += " ${datadir}/VPL/samples \
+ ${libdir}/vpl/libvpl_wayland.so \
+ "
diff --git a/recipes-multimedia/vpl/vpl-gpu-rt_24.1.5.bb b/recipes-multimedia/vpl/vpl-gpu-rt_24.1.5.bb
new file mode 100644
index 00000000..40909a9c
--- /dev/null
+++ b/recipes-multimedia/vpl/vpl-gpu-rt_24.1.5.bb
@@ -0,0 +1,33 @@
+SUMMARY = "Intel(R) oneVPL runtime for Intel GPU accelerated media processing"
+DESCRIPTION = "Intel(R) oneVPL runtime provides an runtime to access hardware-accelerated \
+video decode, encode and filtering on Intel® graphics."
+
+HOMEPAGE = "https://github.com/intel/vpl-gpu-rt"
+BUGTRACKER = "https://github.com/intel/vpl-gpu-rt/issues"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=eb8cb45b9b57dbaa9fcc9adc4230202b"
+
+PE = "1"
+
+# Only for 64 bit
+COMPATIBLE_HOST = '(x86_64).*-linux'
+COMPATIBLE_HOST:x86-x32 = "null"
+
+DEPENDS += "libdrm libva intel-media-driver libvpl pkgconfig-native"
+RDEPENDS:${PN} += "intel-media-driver"
+
+SRC_URI = "git://github.com/intel/vpl-gpu-rt.git;protocol=https;nobranch=1;lfs=0 \
+ "
+
+SRCREV = "088db9f5a8164525f00685c72f00a4baed97b90a"
+S = "${WORKDIR}/git"
+
+FILES:${PN} += " \
+ ${libdir}/libmfx-gen/enctools.so \
+ "
+
+inherit cmake
+
+RREPLACES:${PN} = "onevpl-intel-gpu"
+RCONFLICTS:${PN} = "onevpl-intel-gpu"
diff --git a/recipes-oneapi/crypto/intel-crypto-mb/0001-CMakeLists.txt-exclude-host-system-headers.patch b/recipes-oneapi/crypto/intel-crypto-mb/0001-CMakeLists.txt-exclude-host-system-headers.patch
new file mode 100644
index 00000000..58ed1c9a
--- /dev/null
+++ b/recipes-oneapi/crypto/intel-crypto-mb/0001-CMakeLists.txt-exclude-host-system-headers.patch
@@ -0,0 +1,27 @@
+From efedbf9080c19241c2aa9ee7ba901245d38c8fa2 Mon Sep 17 00:00:00 2001
+From: Naveen Saini <naveen.kumar.saini@intel.com>
+Date: Mon, 7 Mar 2022 16:44:24 +0800
+Subject: [PATCH 1/2] CMakeLists.txt: exclude host system headers
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
+---
+ sources/ippcp/crypto_mb/CMakeLists.txt | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/sources/ippcp/crypto_mb/CMakeLists.txt b/sources/ippcp/crypto_mb/CMakeLists.txt
+index c4cc82a..4094f34 100644
+--- a/sources/ippcp/crypto_mb/CMakeLists.txt
++++ b/sources/ippcp/crypto_mb/CMakeLists.txt
+@@ -82,7 +82,6 @@ include_directories(
+ ${CRYPTO_MB_INCLUDE_DIR}
+ ${OPENSSL_INCLUDE_DIR}
+ $<$<C_COMPILER_ID:Intel>:$ENV{ROOT}/compiler/include $ENV{ROOT}/compiler/include/icc>
+- $<$<NOT:$<C_COMPILER_ID:Intel>>:${CMAKE_SYSTEM_INCLUDE_PATH}>
+ $<$<OR:$<C_COMPILER_ID:Intel>,$<BOOL:${MSVC_IDE}>>:$ENV{INCLUDE}>
+ )
+
+--
+2.17.1
+
diff --git a/recipes-oneapi/crypto/intel-crypto-mb/0001-crypto-mb-Make-sure-libs-are-installed-correctly.patch b/recipes-oneapi/crypto/intel-crypto-mb/0001-crypto-mb-Make-sure-libs-are-installed-correctly.patch
new file mode 100644
index 00000000..c47c8de5
--- /dev/null
+++ b/recipes-oneapi/crypto/intel-crypto-mb/0001-crypto-mb-Make-sure-libs-are-installed-correctly.patch
@@ -0,0 +1,42 @@
+From 3b7b4eca54aa8d851e37f60c74e4a027fa7b21f2 Mon Sep 17 00:00:00 2001
+From: Anuj Mittal <anuj.mittal@intel.com>
+Date: Wed, 14 Jun 2023 13:18:45 +0800
+Subject: [PATCH] crypto-mb: Make sure libs are installed correctly
+
+Dont assume that "lib" is always the correct destination. This fixes
+multilib builds when libdir != /usr/lib.
+
+Upstream-Status: Pending
+
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+---
+ sources/ippcp/crypto_mb/src/CMakeLists.txt | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/sources/ippcp/crypto_mb/src/CMakeLists.txt b/sources/ippcp/crypto_mb/src/CMakeLists.txt
+index c9cad06..31f52bd 100644
+--- a/sources/ippcp/crypto_mb/src/CMakeLists.txt
++++ b/sources/ippcp/crypto_mb/src/CMakeLists.txt
+@@ -123,8 +123,8 @@ endif(DYNAMIC_LIB OR MB_STANDALONE)
+ # Installation of the shared library
+ if (MB_STANDALONE) # standalone crypto_mb's cmake run
+ install(TARGETS ${MB_DYN_LIB_TARGET}
+- LIBRARY DESTINATION "lib"
+- RUNTIME DESTINATION "lib"
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ PUBLIC_HEADER DESTINATION "include/crypto_mb")
+ elseif (DYNAMIC_LIB) # build from ippcp's cmake
+ install(TARGETS ${MB_DYN_LIB_TARGET}
+@@ -154,7 +154,7 @@ endif()
+ # Static lib installation
+ if(MB_STANDALONE)
+ install(TARGETS ${MB_STATIC_LIB_TARGET}
+- ARCHIVE DESTINATION "lib"
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ PUBLIC_HEADER DESTINATION "include/crypto_mb")
+ else()
+ install(TARGETS ${MB_STATIC_LIB_TARGET}
+--
+2.37.3
+
diff --git a/recipes-oneapi/crypto/intel-crypto-mb/0002-cmake-exclude-Yocto-build-flags.patch b/recipes-oneapi/crypto/intel-crypto-mb/0002-cmake-exclude-Yocto-build-flags.patch
new file mode 100644
index 00000000..62b56ea2
--- /dev/null
+++ b/recipes-oneapi/crypto/intel-crypto-mb/0002-cmake-exclude-Yocto-build-flags.patch
@@ -0,0 +1,45 @@
+From b4549bb765d279b5ba042c6340e1dd69d0890b64 Mon Sep 17 00:00:00 2001
+From: Naveen Saini <naveen.kumar.saini@intel.com>
+Date: Thu, 10 Mar 2022 14:30:01 +0800
+Subject: [PATCH 2/2] cmake: exclude Yocto build flags
+
+Ipp-crypto has its own set of flags and -march values,
+which causes conflict with default -march=nehalem in gcc
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
+---
+ sources/ippcp/crypto_mb/src/CMakeLists.txt | 2 +-
+ sources/ippcp/crypto_mb/src/cmake/linux/GNU.cmake | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sources/ippcp/crypto_mb/src/CMakeLists.txt b/sources/ippcp/crypto_mb/src/CMakeLists.txt
+index 1ca1a8c..5284d62 100644
+--- a/sources/ippcp/crypto_mb/src/CMakeLists.txt
++++ b/sources/ippcp/crypto_mb/src/CMakeLists.txt
+@@ -81,7 +81,7 @@ endif()
+ set(MB_LIB_TARGET ${MB_DYN_LIB_TARGET})
+
+ set_source_files_properties(${CRYPTO_MB_SOURCES} PROPERTIES COMPILE_DEFINITIONS "${AVX512_LIBRARY_DEFINES}"
+- COMPILE_FLAGS "${AVX512_CFLAGS} ${CMAKE_ASM_FLAGS} ${CMAKE_C_FLAGS_SECURITY}")
++ COMPILE_FLAGS "${AVX512_CFLAGS} ${CMAKE_C_FLAGS_SECURITY}")
+
+ # Don't specify architectural flags for the assembler for this sources, because of the bug in Intel® C Compiler under MacOS: error: invalid instruction mnemonic 'vkmovb'
+ # The bug has been fixed since version 2021.3. This is a workaround to support older versions of Intel® C Compiler.
+diff --git a/sources/ippcp/crypto_mb/src/cmake/linux/GNU.cmake b/sources/ippcp/crypto_mb/src/cmake/linux/GNU.cmake
+index a2abeeb..aadd6e2 100644
+--- a/sources/ippcp/crypto_mb/src/cmake/linux/GNU.cmake
++++ b/sources/ippcp/crypto_mb/src/cmake/linux/GNU.cmake
+@@ -58,7 +58,7 @@ set(LINK_FLAGS_DYNAMIC "${LINK_FLAGS_DYNAMIC} ${CRYPTO_MB_SOURCES_DIR}/cmake/dll
+ # Compiler flags
+
+ # Tells the compiler to align functions and loops
+-set(CMAKE_C_FLAGS " -falign-functions=32 -falign-loops=32")
++set(CMAKE_C_FLAGS " -falign-functions=32 -falign-loops=32 ${TOOLCHAIN_OPTIONS}")
+ # Ensures that compilation takes place in a freestanding environment
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffreestanding")
+
+--
+2.17.1
+
diff --git a/recipes-oneapi/crypto/intel-crypto-mb_2021.11.1.bb b/recipes-oneapi/crypto/intel-crypto-mb_2021.11.1.bb
new file mode 100644
index 00000000..be72fd85
--- /dev/null
+++ b/recipes-oneapi/crypto/intel-crypto-mb_2021.11.1.bb
@@ -0,0 +1,28 @@
+SUMMARY = "Crypto Multi-buffer Library"
+DESCRIPTION = "Intel® Integrated Performance Primitives (Intel® IPP) Cryptography \
+is a secure, fast and lightweight library of building blocks for cryptography, \
+highly-optimized for various Intel® CPUs."
+HOMEPAGE = "https://github.com/intel/ipp-crypto"
+
+LICENSE = "Apache-2.0"
+
+LIC_FILES_CHKSUM = "file://../../../LICENSE;md5=e787af283468feca985d6b865d27d95b"
+
+IPP_BRANCH = "ipp-crypto_${@'_'.join(d.getVar('PV').rsplit('.')[-3:])}"
+
+SRC_URI = "git://github.com/intel/ipp-crypto;protocol=https;branch=${IPP_BRANCH} \
+ file://0001-CMakeLists.txt-exclude-host-system-headers.patch;striplevel=4 \
+ file://0002-cmake-exclude-Yocto-build-flags.patch;striplevel=4 \
+ file://0001-crypto-mb-Make-sure-libs-are-installed-correctly.patch;striplevel=4 \
+ "
+SRCREV = "d02611e34328898d16025467d3deeb7d62b6076b"
+
+S = "${WORKDIR}/git/sources/ippcp/crypto_mb"
+
+DEPENDS = "openssl"
+
+inherit cmake pkgconfig
+COMPATIBLE_HOST = '(x86_64).*-linux'
+
+EXTRA_OECMAKE += " -DARCH=intel64"
+EXTRA_OECMAKE += " -DTOOLCHAIN_OPTIONS='${TOOLCHAIN_OPTIONS}'"
diff --git a/recipes-oneapi/onedpl/onedpl_2022.3.0.bb b/recipes-oneapi/onedpl/onedpl_2022.3.0.bb
new file mode 100644
index 00000000..d80b64c9
--- /dev/null
+++ b/recipes-oneapi/onedpl/onedpl_2022.3.0.bb
@@ -0,0 +1,26 @@
+SUMMARY = "oneAPI DPC++ Library (oneDPL)"
+DESCRIPTION = "The oneAPI DPC++ Library (oneDPL) aims to work with the \
+oneAPI DPC++ Compiler to provide high-productivity APIs to developers, \
+which can minimize DPC++ programming efforts across devices for high \
+performance parallel applications."
+HOMEPAGE = "https://github.com/oneapi-src/oneDPL"
+
+LICENSE = "Apache-2.0-with-LLVM-exception"
+LIC_FILES_CHKSUM = "file://licensing/LICENSE.txt;md5=2e982d844baa4df1c80de75470e0c5cb \
+ file://licensing/third-party-programs.txt;md5=cfb8d6b1f04a8fcc7d0dddd817619634"
+
+S = "${WORKDIR}/git"
+
+SRC_URI = "git://github.com/oneapi-src/oneDPL.git;protocol=https;branch=release/2022.3 \
+ "
+SRCREV = "180f18ad25fbc39fa13bad43f1df7d54ee8f5609"
+
+do_compile[noexec] = "1"
+do_configure[noexec] = "1"
+
+do_install() {
+ install -d -m 755 ${D}${includedir}/onedpl
+ cp -r ${S}/include/* ${D}${includedir}/onedpl
+}
+
+UPSTREAM_CHECK_GITTAGREGEX = "^oneDPL-(?P<pver>(\d+(\.\d+)+))-release$"
diff --git a/recipes-oneapi/setup-oneapi-env/files/intel-oneapi-runtime.conf b/recipes-oneapi/setup-oneapi-env/files/intel-oneapi-runtime.conf
new file mode 100644
index 00000000..5faf9854
--- /dev/null
+++ b/recipes-oneapi/setup-oneapi-env/files/intel-oneapi-runtime.conf
@@ -0,0 +1,4 @@
+/opt/intel/oneapi/lib
+/opt/intel/oneapi/lib/intel64
+/opt/intel/oneapi/lib/ia32
+/opt/intel/oneapi/lib/emu
diff --git a/recipes-oneapi/setup-oneapi-env/setup-intel-oneapi-env_2023.0.0-25370.bb b/recipes-oneapi/setup-oneapi-env/setup-intel-oneapi-env_2023.0.0-25370.bb
new file mode 100644
index 00000000..702f794e
--- /dev/null
+++ b/recipes-oneapi/setup-oneapi-env/setup-intel-oneapi-env_2023.0.0-25370.bb
@@ -0,0 +1,20 @@
+SUMMARY = "Intel® oneAPI runtime libraries environment set up"
+DESCRIPTION = "Recipe to set up the environment for Intel® oneAPI runtime libraries \
+via configuration file in ld.so.conf.d directory."
+
+LICENSE = "EULA"
+LIC_FILES_CHKSUM = "file://${CUSTOM_LICENSES_PATH}/EULA;md5=7bfc91523de2e84e7131d0eacf2827d4"
+
+SRC_URI = "file://intel-oneapi-runtime.conf"
+
+do_install() {
+ mkdir -p ${D}${sysconfdir}/ld.so.conf.d/
+ install -m 644 ${WORKDIR}/intel-oneapi-runtime.conf ${D}${sysconfdir}/ld.so.conf.d/
+}
+
+pkg_postinst_ontarget:${PN}() {
+if [ x"$D" = "x" ]; then
+ if [ -x /sbin/ldconfig ]; then /sbin/ldconfig ; fi
+fi
+}
+BBCLASSEXTEND = "native nativesdk"
diff --git a/recipes-selftest/images/secureboot-selftest-image-unsigned.bb b/recipes-selftest/images/secureboot-selftest-image-unsigned.bb
index e03e7b47..d0fa6405 100644
--- a/recipes-selftest/images/secureboot-selftest-image-unsigned.bb
+++ b/recipes-selftest/images/secureboot-selftest-image-unsigned.bb
@@ -1,12 +1,12 @@
require recipes-core/images/core-image-minimal.bb
-DEPENDS_remove = "grub-efi"
+DEPENDS:remove = "grub-efi"
inherit uefi-comboapp
WKS_FILE = "generic-bootdisk.wks.in"
-do_uefiapp_deploy_append() {
+do_uefiapp_deploy:append() {
for i in ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.boot*.efi; do
target=`basename $i`
target=`echo $target | sed -e 's/${IMAGE_LINK_NAME}.//'`
diff --git a/recipes-support/isa-l/isa-l_2.30.0.bb b/recipes-support/isa-l/isa-l_2.31.0.bb
index f06fd0b7..d5d09002 100644
--- a/recipes-support/isa-l/isa-l_2.30.0.bb
+++ b/recipes-support/isa-l/isa-l_2.31.0.bb
@@ -2,16 +2,18 @@ SUMMARY = "Intelligent Storage Acceleration Library"
DESCRIPTION = "ISA-L is a collection of optimized low-level functions \
targeting storage applications."
LICENSE = "BSD-3-Clause"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=e6c7d82ad7dd512687b0991a159a1ca9"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=2476688d0948d4a3f7c69473a603540d"
SECTION = "lib"
inherit autotools pkgconfig
S = "${WORKDIR}/git"
-SRCREV = "2df39cf5f1b9ccaa2973f6ef273857e4dc46f0cf"
-SRC_URI = "git://github.com/intel/isa-l.git"
+SRCREV = "bd226375027899087bd48f3e59b910430615cc0a"
+SRC_URI = "git://github.com/intel/isa-l.git;branch=master;protocol=https"
DEPENDS = "nasm-native"
AS[unexport] = "1"
+TARGET_CC_ARCH += "${LDFLAGS}"
+
COMPATIBLE_HOST = '(x86_64).*-linux'
diff --git a/recipes-support/jhi/jhi_1.41.bb b/recipes-support/jhi/jhi_1.41.bb
deleted file mode 100644
index badb928f..00000000
--- a/recipes-support/jhi/jhi_1.41.bb
+++ /dev/null
@@ -1,72 +0,0 @@
-SUMMARY = "Intel Dynamic Application Loader (DAL) Host Interface"
-DESCRIPTION = "A daemon and libraries which allow user space applications \
-to install Java applets on DAL FW and communicate with them"
-LICENSE = "Apache-2.0"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=833126f14614a3276708a4d7c9734645"
-
-SRC_URI = "git://github.com/intel/dynamic-application-loader-host-interface.git;protocol=https"
-
-inherit cmake useradd systemd pkgconfig update-rc.d
-
-SRCREV = "4c9ef52bcd55fa03b30ac323e553a05be858d41e"
-
-S = "${WORKDIR}/git"
-
-DEPENDS += "util-linux libxml2"
-DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
-RDEPENDS_${PN} += "bash"
-
-USERADD_PACKAGES = "${PN}"
-USERADD_PARAM_${PN} = "--system --no-create-home --shell /bin/false -g mei jhi"
-
-GROUPADD_PARAM_${PN} = "-g 880 mei"
-
-COMPATIBLE_HOST_libc-musl = 'null'
-
-SYSTEMD_SERVICE_${PN} = "jhi.service"
-
-INITSCRIPT_PACKAGES = "${PN}"
-INITSCRIPT_NAME_${PN} = "${PN}"
-INITSCRIPT_PARAMS_${PN} = "defaults"
-
-# systemd is the default so they are installed when sysvinit is not selected as INIT_SYSTEM
-EXTRA_OECMAKE = "-DCMAKE_SKIP_RPATH=ON \
- -DINIT_SYSTEM=${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'SysVinit', 'systemd', d)} \
- -DAPPLETS_DIR=${libdir}/dal/applets \
- -DAPP_REPO_DIR=${localstatedir}/cache/dal/applet_repository \
- "
-
-do_install_append () {
- install -d ${D}${localstatedir}/cache/dal/applet_repository
-
- chown -R jhi ${D}${localstatedir}/cache/dal/applet_repository
- chgrp -R mei ${D}${localstatedir}/cache/dal/applet_repository
-
- install -d ${D}${bindir}
- install -m 755 ${B}/bin_linux/smoketest ${D}${bindir}
- install -m 755 ${B}/bin_linux/bist ${D}${bindir}
-
- install -d ${D}${libdir}/dal/applets
- cp -r ${S}/test/smoketest/applets/* ${D}${libdir}/dal/applets/
-}
-
-PACKAGES += "${PN}-test"
-
-FILES_${PN}-dev = ""
-
-FILES_${PN} = "\
- ${sbindir} \
- ${sysconfdir} \
- ${libdir}/lib*${SOLIBSDEV} \
- ${libdir}/dal/applets/SpoolerApplet.dalp \
- ${nonarch_libdir}/tmpfiles.d \
- ${systemd_system_unitdir} \
- ${localstatedir}/cache/dal/applet_repository \
- "
-
-FILES_${PN}-test = "\
- ${bindir} \
- ${libdir}/dal/applets \
- "
-
-UPSTREAM_CHECK_COMMITS = "1"
diff --git a/recipes-support/libipt/libipt_2.0.4.bb b/recipes-support/libipt/libipt_2.1.1.bb
index a0554f44..c4b5ecaa 100644
--- a/recipes-support/libipt/libipt_2.0.4.bb
+++ b/recipes-support/libipt/libipt_2.1.1.bb
@@ -5,29 +5,30 @@ library or it can be partially or fully integrated into your tool."
HOMEPAGE = "https://github.com/intel/libipt"
LICENSE = "BSD-3-Clause"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=aea4783603fc6bd8dff5157996ccb9d9"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=a429afa59f273b5d12778eda69d10313"
inherit pkgconfig cmake
S = "${WORKDIR}/git"
-SRC_URI = "git://github.com/intel/libipt.git;protocol=https;branch=stable/v2.0"
+SRC_URI = "git://github.com/intel/libipt.git;protocol=https;branch=stable/v2.1"
-SRCREV = "63813186694487a2bc005f32be57eb526e16714b"
+SRCREV = "1c9bc700f4b9a71fd2d1cf1742de7e2351ddb281"
EXTRA_OECMAKE += " \
-DPTDUMP=ON \
-DPTTC=ON \
+ -DPTSEG=ON \
-DCMAKE_SKIP_RPATH=ON \
"
-do_install_append() {
+do_install:append() {
install -d ${D}${bindir}/libipt
install -d ${D}${bindir}/libipt/tests
cp -r ${B}/bin/* ${D}${bindir}/libipt/
- cp -r ${WORKDIR}/git/test/src/* ${D}${bindir}/libipt/tests
+ cp -r ${S}/test/src/* ${D}${bindir}/libipt/tests
}
-FILES_${PN}-test = "${bindir}"
+FILES:${PN}-test = "${bindir}"
PACKAGES =+ "${PN}-test"
diff --git a/recipes-support/sbsigntool/sbsigntool-native_git.bb b/recipes-support/sbsigntool/sbsigntool-native_git.bb
index f6094a5c..5a9f5b4d 100644
--- a/recipes-support/sbsigntool/sbsigntool-native_git.bb
+++ b/recipes-support/sbsigntool/sbsigntool-native_git.bb
@@ -1,5 +1,5 @@
DESCRIPTION = "Utility for signing and verifying files for UEFI Secure Boot"
-LICENSE = "GPLv3 & LGPL-2.1 & LGPL-3.0 & MIT"
+LICENSE = "GPL-3.0-only & LGPL-2.1-only & LGPL-3.0-only & MIT"
# sbsigntool statically links to libccan.a which is built with modules
# passed to "create-ccan-tree" (and their dependencies). Therefore,
@@ -19,25 +19,25 @@ LIC_FILES_CHKSUM = "file://LICENSE.GPLv3;md5=9eef91148a9b14ec7f9df333daebc746 \
# The original upstream is git://kernel.ubuntu.com/jk/sbsigntool but it has
# not been maintained and many patches have been backported in this repo.
-SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git;protocol=https;name=sbsigntools \
- git://github.com/rustyrussell/ccan.git;protocol=https;destsuffix=git/lib/ccan.git;name=ccan \
+SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git;protocol=https;name=sbsigntools;branch=master \
+ git://github.com/rustyrussell/ccan.git;protocol=https;destsuffix=git/lib/ccan.git;name=ccan;branch=master \
file://0001-configure-Fixup-build-dependencies-for-cross-compili.patch \
- "
+ "
-SRCREV_sbsigntools ?= "f12484869c9590682ac3253d583bf59b890bb826"
+SRCREV_sbsigntools ?= "9cfca9fe7aa7a8e29b92fe33ce8433e212c9a8ba"
SRCREV_ccan ?= "b1f28e17227f2320d07fe052a8a48942fe17caa5"
SRCREV_FORMAT = "sbsigntools_ccan"
DEPENDS = "binutils-native gnu-efi-native help2man-native openssl-native util-linux-native"
-PV = "0.9.4-git${SRCPV}"
+PV = "0.9.5"
S = "${WORKDIR}/git"
inherit autotools pkgconfig
inherit native
-do_configure_prepend() {
+do_configure:prepend() {
cd ${S}
sed -i s#RECIPE_SYSROOT#${RECIPE_SYSROOT_NATIVE}#g configure.ac
@@ -79,3 +79,5 @@ EXTRA_OEMAKE = "\
-I${STAGING_INCDIR_NATIVE} \
-I${STAGING_INCDIR_NATIVE}/efi/${@efi_arch(d)}' \
"
+
+CFLAGS:append = " -Wno-error"
diff --git a/recipes-support/sbsigntool/sbsigntool/0001-configure-Fixup-build-dependencies-for-cross-compili.patch b/recipes-support/sbsigntool/sbsigntool/0001-configure-Fixup-build-dependencies-for-cross-compili.patch
index ef686511..ea7bee29 100644
--- a/recipes-support/sbsigntool/sbsigntool/0001-configure-Fixup-build-dependencies-for-cross-compili.patch
+++ b/recipes-support/sbsigntool/sbsigntool/0001-configure-Fixup-build-dependencies-for-cross-compili.patch
@@ -10,7 +10,7 @@ under /usr/include and /usr/lib.
Prepend these paths with a placeholder that can be replaced with the
actual paths once they are resolved.
-Upstream status: inappropriate [OE specific]
+Upstream-Status: Inappropriate [OE specific]
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>