summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG87
-rw-r--r--README459
-rw-r--r--README.md32
-rw-r--r--README.sources17
-rw-r--r--SECURITY.md6
-rw-r--r--classes/uefi-comboapp.bbclass6
-rw-r--r--conf/include/maintainers.inc94
-rw-r--r--conf/layer.conf13
-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.conf5
-rw-r--r--conf/machine/intel-corei7-64.conf10
-rw-r--r--conf/machine/intel-skylake-64.conf9
-rw-r--r--custom-licenses/EULA392
-rw-r--r--custom-licenses/ISSL114
-rw-r--r--custom-licenses/syrah32
-rw-r--r--documentation/MAINTAINERS.md (renamed from MAINTAINERS)16
-rw-r--r--documentation/building_and_booting.md134
-rw-r--r--documentation/dpcpp-compiler.md107
-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/onednn_3.4.bb (renamed from dynamic-layers/clang-layer/recipes-core/dnn/onednn_2.1.1.bb)22
-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.05.28454.6.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.15985.7.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.0.0.bb (renamed from dynamic-layers/meta-python/recipes-opencv/dldt/openvino-model-optimizer_2021.2.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_2102.1.0.0.bb)25
-rw-r--r--dynamic-layers/openembedded-layer/recipes-bsp/thermald/files/0001-Makefile-Fix-build-Issue.patch39
-rw-r--r--dynamic-layers/openembedded-layer/recipes-bsp/thermald/thermald_2.5.6.bb (renamed from dynamic-layers/openembedded-layer/recipes-bsp/thermald/thermald_2.4.3.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.0302.bb)30
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-CPU-Solving-the-build-failure-caused-by-setting-the-.patch43
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-cmake-fix-build-when-using-sysroot.patch32
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-cmake-yocto-specific-tweaks-to-the-build-process.patch90
-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.patch172
-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/0003-cmake-Fix-overloaded-virtual-error.patch33
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/files/0003-inference-engine-installation-fixes.patch223
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/files/0004-protobuf-allow-target-protoc-to-be-built.patch45
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/files/0005-cldnn-fix-inclusion-of-headers.patch53
-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.2.bb63
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo_2024.0.0.bb54
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/openvino-inference-engine_2021.2.bb123
-rw-r--r--dynamic-layers/openembedded-layer/recipes-support/opencv/openvino-inference-engine_2024.0.0.bb143
-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.0.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.bb13
-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_20210216.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.patch38
-rw-r--r--recipes-graphics/gmmlib/files/0001-Introduce-ARL-H-support-172.patch42
-rw-r--r--recipes-graphics/gmmlib/gmmlib_22.3.15.bb (renamed from recipes-graphics/gmmlib/gmmlib_21.1.1.bb)10
-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_20.4.0.bb)6
-rw-r--r--recipes-graphics/libva/libva-intel-utils_2.20.1.bb (renamed from recipes-graphics/libva/libva-intel-utils_2.11.1.bb)6
-rw-r--r--recipes-graphics/libva/libva-intel_2.20.0.bb (renamed from recipes-graphics/libva/libva-intel_2.11.0.bb)23
-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.170.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)16
-rw-r--r--recipes-kernel/intel-ethernet/ixgbevf_4.18.7.bb (renamed from recipes-kernel/intel-ethernet/ixgbevf_4.11.1.bb)18
-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.4.bb30
-rw-r--r--recipes-kernel/linux/linux-intel-rt_6.6.bb (renamed from recipes-kernel/linux/linux-intel-rt_5.10.bb)24
-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.bb22
-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.6.bb (renamed from recipes-multimedia/itt/itt_3.18.10.bb)10
-rw-r--r--recipes-multimedia/libva/files/0001-Disable-vp9-padding-on-mtl.patch35
-rw-r--r--recipes-multimedia/libva/files/0002-Force-ARGB-surface-to-tile4-for-ACM.patch44
-rw-r--r--recipes-multimedia/libva/files/0004-Add-device-ID-for-ARL.patch45
-rw-r--r--recipes-multimedia/libva/files/0005-Add-XR24-support-to-DMABuf.patch34
-rw-r--r--recipes-multimedia/libva/files/0006-add-INTEL-MEDIA-ALLOC-refineE-to-specify-the-memory-.patch214
-rw-r--r--recipes-multimedia/libva/files/0007-Skip-report-keys.patch78
-rw-r--r--recipes-multimedia/libva/files/0008-Limit-INTEL-MEDIA-ALLOC-MODE-to-MTL-and-ARL-only.patch255
-rw-r--r--recipes-multimedia/libva/files/0009-Skip-cache-bucket-realloc-for-default-mode-0.patch33
-rw-r--r--recipes-multimedia/libva/files/0010-Fix-failed-4k-video-wall-test-case-and-color-corrupt.patch195
-rw-r--r--recipes-multimedia/libva/files/0011-Disable-422H-format-output.patch33
-rw-r--r--recipes-multimedia/libva/files/0012-Decode-Fix-AVC-decode-SFC-4K-hang-issue.patch32
-rw-r--r--recipes-multimedia/libva/intel-media-driver_23.4.3.bb (renamed from recipes-multimedia/libva/intel-media-driver_21.1.3.bb)25
-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/files/0001-ARLH-DID-open-source-6286.patch39
-rw-r--r--recipes-multimedia/onevpl/files/0001-Fix-SetBuffersYV12-V-U-plane-offsets-calculation-647.patch32
-rw-r--r--recipes-multimedia/onevpl/files/0001-JPEGe-Enable-BGR4-JPEG-Enc-support-6470.patch96
-rw-r--r--recipes-multimedia/onevpl/files/0001-vpl.pc.in-dont-pass-pcfiledir-to-cflags.patch28
-rw-r--r--recipes-multimedia/onevpl/onevpl-intel-gpu_23.4.3.bb33
-rw-r--r--recipes-multimedia/onevpl/onevpl_2023.4.0.bb40
-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)11
-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
201 files changed, 4825 insertions, 23873 deletions
diff --git a/CHANGELOG b/CHANGELOG
deleted file mode 100644
index a99cbb1f..00000000
--- a/CHANGELOG
+++ /dev/null
@@ -1,87 +0,0 @@
1This file will only list major changes that occur within a release.
2For a full list of changes, view the git log of the repository.
3
4Rocko Release 11/2017
5=====================
6
7Moved qat support to separate layer
8-----------------------------------
9Quick Assist Technology (QAT) is more middleware and should not be part of the
10core BSP. The new layer can be found here:
11https://git.yoctoproject.org/cgit/cgit.cgi/meta-intel-qat/
12
13Moved dpdk support to separate layer
14------------------------------------
15We had some requests to make DPDK standalone so that it could be included
16without bringing in anything else from meta-intel, as it is not specific to
17Intel(R) hardware. The new layer is located here:
18https://git.yoctoproject.org/cgit/cgit.cgi/meta-dpdk/
19
20Added support for out-of-tree iwlwifi drivers
21---------------------------------------------
22Backport-iwlwifi out-of-tree wifi modules are now available via meta-intel.
23Backport-iwlwifi brings the latest iwlwifi drivers to almost any kernel
24Note that mac80211 and cfg80211 backports are also necessary, which will most
25likely cause incompatibility with other in-tree wifi drivers.
26See https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi for more info.
27
28Added support for out-of-tree ixgbe drivers
29-------------------------------------------
30The out-of-tree ixgbe drivers bring ixgbe support to nearly any kernel. See
31here: http://www.intel.com/network/connectivity/products/server_adapters.htm
32
33Added an implementation of Secure Boot
34--------------------------------------
35meta-intel now supports a simple Secure Boot implementation. This implementation
36consists of a single binary consisting of an EFI stub, the kernel, an
37initrd, and a kernel command line. The binary is then signed via keys defined by
38the variables SECUREBOOT_SIGNING_KEY and SECUREBOOT_SIGNING_CERT. These keys
39should match the keys embedded in your hardware's firmware.
40See documentation/secureboot/README for more information on this feature.
41
42Improved Yocto Project Compatibility status
43-------------------------------------------
44The common layer should now be considered Yocto Project compatible - it should
45no longer modify OE-core values when adding the layer to your bblayers.conf.
46The meta-tlk layer is still not Yocto Project compatible, however.
47
48Pyro Release 5/2017
49===================
50
51Changed default kernel provider from linux-yocto to linux-intel.
52----------------------------------------------------------------
53Linux-intel is an Intel(R)-maintained kernel based on the latest stable
54branch, along with backports from upstream to better support Intel(R)
55hardware. The intel-linux kernel also has a branch with the preempt-rt
56patches applied, providing a preempt-rt kernel with no additional work.
57
58Added QEMU support.
59-------------------
60We now build several virtio drivers into the kernel by default, and
61have qemuboot.conf files for intel-corei7-64 and intel-core2-32
62targets. This allows one to do basic testing on meta-intel images
63without having to use hardware. The virtio drivers are added via
64KERNEL_FEATURES_INTEL_COMMON. This prevents them from being added to
65custom kernels by default. They can be removed by adding the
66following to a conf or kernel bbappend file:
67 KERNEL_FEATURES_INTEL_COMMON_remove = “cfg/virtio.scc”
68OVMF firmware is also built and can be used in order to emulate a UEFI
69environment. A full runqemu command line for intel-corei7-64 could look
70like this:
71 runqemu core-image-minimal intel-corei7-64 wic ovmf
72
73Musl support
74------------
75Meta-intel is now compatible with the musl C library. You can specify musl
76As your C library by adding the following to your local.conf:
77 TCLIBC = “musl”
78Note: there is a known failure with DPDK.
79
80X32 support
81-----------
82The meta-intel layer can now build with the x32 tune settings in a multi-lib
83setting, it will not work in as the primary MACHINE tune as the bootloader needs
84to be built as a 64bit binary. The setup for this would be as follows:
85 require conf/multilib.conf
86 MULTILIBS = "multilib:libx32
87 DEFAULTTUNE_virtclass-multilib-libx32 = "corei7-64-x32"
diff --git a/README b/README
deleted file mode 100644
index f377c67b..00000000
--- a/README
+++ /dev/null
@@ -1,459 +0,0 @@
1meta-intel
2==========
3
4This README file contains information on building and booting
5meta-intel BSP layers. Please see the corresponding sections below
6for details.
7
8
9Yocto Project Compatible
10========================
11
12The BSPs contained in this layer are compatible with the Yocto Project
13as per the requirements listed here:
14
15 https://www.yoctoproject.org/webform/yocto-project-compatible-registration
16
17
18Dependencies
19============
20
21This layer depends on:
22
23 URI: git://git.openembedded.org/bitbake
24
25 URI: git://git.openembedded.org/openembedded-core
26 layers: meta
27 branch: master
28
29
30Table of Contents
31=================
32
33 I. Overview
34 II. Building and booting meta-intel BSP layers
35 a. Building the intel-common BSP layers
36 b. Booting the intel-common BSP images
37 c. Building the installer image
38 III. Technical Miscellany
39 Benefits of using meta-intel
40 The intel-common kernel package architecture
41 Intel-specific machine features
42 IV. Tested Hardware
43 V. Guidelines for submitting patches
44
45
46I. Overview
47===========
48
49This is the location for Intel-maintained BSPs.
50
51For details on the intel-common, see the information below.
52
53For all others, please see the README files contained in the
54individual BSP layers for BSP-specific information.
55
56If you have problems with or questions about a particular BSP, please
57contact the maintainer listed in the MAINTAINERS file directly (cc:ing
58the Yocto mailing list puts it in the archive and helps other people
59who might have the same questions in the future), but please try to do
60the following first:
61
62 - look in the Yocto Project Bugzilla
63 (http://bugzilla.yoctoproject.org/) to see if a problem has
64 already been reported
65
66 - look through recent entries of the meta-intel
67 (https://lists.yoctoproject.org/pipermail/meta-intel/) and Yocto
68 (https://lists.yoctoproject.org/pipermail/yocto/) mailing list
69 archives to see if other people have run into similar problems or
70 had similar questions answered.
71
72If you believe you have encountered a bug, you can open a new bug and
73enter the details in the Yocto Project Bugzilla
74(http://bugzilla.yoctoproject.org/). If you're relatively certain
75that it's a bug against the BSP itself, please use the 'Yocto Project
76Components: BSPs | meta-intel' category for the bug; otherwise, please
77submit the bug against the most likely category for the problem - if
78you're wrong, it's not a big deal and the bug will be recategorized
79upon triage.
80
81
82II. Building and booting meta-intel BSP layers
83==============================================
84
85The following sections contain information on building and booting the
86BSPs contained in the meta-intel layer.
87
88Note that these instructions specifically cover the intel-common, which
89may or may not be applicable to other BSPs contained in this layer - if
90a given BSP contains its own README, that version should be used instead,
91and these instructions can be ignored.
92
93a. Building the intel-common BSP layers
94-------------------------------------------------
95
96In order to build an image with BSP support for a given release, you
97need to download the corresponding BSP tarball from the 'Board Support
98Package (BSP) Downloads' page of the Yocto Project website (or
99equivalently, check out the appropriate branch from the meta-intel git
100repository, see below). For the intel-common BSPs, those tarballs would
101correspond to the following choices in the BSP downloads section:
102
103 - Intel-core2-32 Intel® Common Core BSP (Intel-core2-32)
104 - Intel-corei7-64 Intel® Common Core BSP (Intel-corei7-64)
105
106The intel-* BSPs, also known as the intel-common BSPs, provide a few
107carefully selected tune options and generic hardware support to cover
108the majority of current Intel CPUs and devices. The naming follows the
109convention of intel-<TUNE>-<BITS>, where TUNE is the gcc cpu-type
110(used with mtune and march typically) and BITS is either 32 bit or 64
111bit.
112
113Having done that, and assuming you extracted the BSP tarball contents
114at the top-level of your yocto build tree, you can build a BSP image
115by adding the location of the meta-intel layer to bblayers.conf e.g.:
116
117 yocto/meta-intel \
118
119To enable a particular machine, you need to add a MACHINE line naming
120the BSP to the local.conf file:
121
122 MACHINE ?= "xxx"
123
124where 'xxx' is replaced by one of the following BSP names:
125
126 - intel-core2-32
127
128 This BSP is optimized for the Core2 family of CPUs as well as all
129 Atom CPUs prior to the Silvermont core.
130
131 - intel-corei7-64
132
133 This BSP is optimized for Nehalem and later Core and Xeon CPUs as
134 well as Silvermont and later Atom CPUs, such as the Baytrail SoCs.
135
136You should then be able to build an image as such:
137
138 $ source oe-init-build-env
139 $ bitbake core-image-sato
140
141At the end of a successful build, you should have an image that
142you can boot from a USB flash drive (see instructions on how to do
143that below, in the section 'Booting the intel-common BSP images').
144
145As an alternative to downloading the BSP tarball, you can also work
146directly from the meta-intel git repository. For each BSP in the
147'meta-intel' repository, there are multiple branches, one
148corresponding to each major release starting with 'laverne' (0.90), in
149addition to the latest code which tracks the current master (note that
150not all BSPs are present in every release). Instead of extracting
151a BSP tarball at the top level of your yocto build tree, you can
152equivalently check out the appropriate branch from the meta-intel
153repository at the same location.
154
155b. Booting the intel-common BSP images
156--------------------------------------
157
158If you've built your own image, either from the downloaded BSP layer
159or from the meta-intel git repository, you'll find the bootable
160image in the build/tmp/deploy/images/xxx directory, where again
161'xxx' refers to the machine name used in the build.
162
163Under Linux, insert a USB flash drive. Assuming the USB flash drive
164takes device /dev/sdf, use dd to copy the image to it. Before the image
165can be burned onto a USB drive, it should be un-mounted. Some Linux distros
166may automatically mount a USB drive when it is plugged in. Using USB device
167/dev/sdf as an example, find all mounted partitions:
168
169 $ mount | grep sdf
170
171and un-mount those that are mounted, for example:
172
173 $ umount /dev/sdf1
174 $ umount /dev/sdf2
175
176Now burn the image onto the USB drive:
177
178 $ sudo dd if=core-image-sato-intel-corei7-64.wic of=/dev/sdf status=progress
179 $ sync
180 $ eject /dev/sdf
181
182This should give you a bootable USB flash device. Insert the device
183into a bootable USB socket on the target, and power on. This should
184result in a system booted to the Sato graphical desktop.
185
186If you want a terminal, use the arrows at the top of the UI to move to
187different pages of available applications, one of which is named
188'Terminal'. Clicking that should give you a root terminal.
189
190If you want to ssh into the system, you can use the root terminal to
191ifconfig the IP address and use that to ssh in. The root password is
192empty, so to log in type 'root' for the user name and hit 'Enter' at
193the Password prompt: and you should be in.
194
195If you find you're getting corrupt images on the USB (it doesn't show
196the syslinux boot: prompt, or the boot: prompt contains strange
197characters), try doing this first:
198
199 $ dd if=/dev/zero of=/dev/sdf bs=1M count=512
200
201c. Building the installer image
202-----------------------------------------------
203
204If you plan to install your image to your target machine, you can build a wic
205based installer image instead of default wic image. To build it, you need to
206add below configuration to local.conf :
207
208 WKS_FILE = "image-installer.wks.in"
209 IMAGE_FSTYPES_append = " ext4"
210 IMAGE_TYPEDEP_wic = "ext4"
211 INITRD_IMAGE_LIVE="core-image-minimal-initramfs"
212 do_image_wic[depends] += "${INITRD_IMAGE_LIVE}:do_image_complete"
213 do_rootfs[depends] += "virtual/kernel:do_deploy"
214 IMAGE_BOOT_FILES_append = "\
215 ${KERNEL_IMAGETYPE} \
216 microcode.cpio \
217 ${IMGDEPLOYDIR}/${IMAGE_BASENAME}-${MACHINE}.ext4;rootfs.img \
218 ${@bb.utils.contains('EFI_PROVIDER', 'grub-efi', 'grub-efi-bootx64.efi;EFI/BOOT/bootx64.efi', '', d)} \
219 ${@bb.utils.contains('EFI_PROVIDER', 'grub-efi', '${IMAGE_ROOTFS}/boot/EFI/BOOT/grub.cfg;EFI/BOOT/grub.cfg', '', d)} \
220 ${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', 'systemd-bootx64.efi;EFI/BOOT/bootx64.efi', '', d)} \
221 ${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', '${IMAGE_ROOTFS}/boot/loader/loader.conf;loader/loader.conf ', '', d)} \
222 ${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', '${IMAGE_ROOTFS}/boot/loader/entries/boot.conf;loader/entries/boot.conf', '', d)} "
223
224Burn the wic image onto USB flash device, insert the device to target machine
225and power on. This should start the installation process.
226
227III. Technical Miscellany
228=========================
229
230Benefits of using meta-intel
231----------------------------
232
233Using meta-intel has the following benefits over a generic BSP:
234
235tune flags
236++++++++++
237intel-* MACHINEs each have different compilation flags appropriate for their
238targeted hardware sets. intel-corei7-64 has tune flags appropriate for modern
23964-bit Intel Core i microarchitecture, and includes instruction sets up to
240SSE4.2. intel-core2-32 has tune flags appropriate for legacy 32-bit Intel Core2
241microarchitecture, and includes instruction sets up to SSE3.
242
243linux-intel kernel
244++++++++++++++++++
245The linux-intel kernel is an initiative to bring better Intel(R) hardware
246support to the current LTS linux kernel. It contains a base LTS kernel with
247additional backports from upstream Intel drivers. In addition, a default kernel
248config containing most features found on Intel boards is supplied via the
249yocto-kernel-cache.
250
251graphics stack
252++++++++++++++
253Meta-intel provides the latest Intel Graphics Linux Stack drivers to support
254Intel hardware as defined by the https://01.org/linuxgraphics.
255
256Other software
257++++++++++++++
258 * intel ucode - provides the latest microcode updates for Intel processors
259
260 * thermald - which proactively controls thermal, using P-states, T-states, and
261the Intel power clamp driver.
262(https://01.org/linux-thermal-daemon/documentation/introduction-thermal-daemon)
263
264The intel-common kernel package architecture
265--------------------------------------------
266
267These BSPs use what we call the intel-common Linux kernel package
268architecture. This includes core2-32-intel-common and
269corei7-64-intel-common. These kernel packages can also be used by any
270of the BSPs in meta-intel that choose to include the
271intel-common-pkgarch.inc file.
272
273To minimize the proliferation of vendor trees, reduce the sources we
274must support, and consolidate QA efforts, all BSP maintainers are
275encouraged to make use of the intel-common Linux kernel package
276architecture.
277
278Intel-specific machine features
279-------------------------------
280
281The meta-intel layer makes some additional machine features available
282to BSPs. These machine features can be used in a BSP layer in the
283same way that machine features are used in other layers based on
284oe-core, via the MACHINE_FEATURES variable.
285
286Requirements
287++++++++++++
288
289The meta-intel-specific machine features are only available to a BSP
290when the meta-intel layer is included in the build configuration, and
291the meta-intel.inc file is included in the machine configuration of
292that BSP.
293
294To make these features available for your machine, you will need to:
295
296 1. include a configuration line such as the below in bblayers.conf
297 BBLAYERS += "<local path>/meta-intel"
298 2. include the following line in the machine configuration file
299 require conf/machine/include/meta-intel.inc
300
301Once the above requirements are met, the machine features provided by
302the meta-intel layer will be available for the BSP to use.
303
304Available machine features
305++++++++++++++++++++++++++
306
307Currently, the meta-intel layer makes the following set of
308Intel-specific machine features available:
309
310 * intel-ucode
311
312These machine features can be included by listing them in the
313MACHINE_FEATURES variable in the machine configuration file. For
314example:
315
316 MACHINE_FEATURES += "intel-ucode"
317
318Machine feature details
319+++++++++++++++++++++++
320
321 * intel-ucode
322
323 This feature provides support for microcode updates to Intel
324 processors. The intel-ucode feature runs at early boot and uses
325 the microcode data file added by the feature into the BSP's
326 initrd. It also puts the userland microcode-updating tool,
327 iucode_tool, into the target images along with the microcode data
328 file.
329
330 Q. Why might a user want to enable the intel-ucode feature?
331
332 A. Intel releases microcode updates to correct processor behavior
333 as documented in the respective processor specification
334 updates. While the normal approach to getting such microcode
335 updates is via a BIOS upgrade, this can be an administrative
336 hassle and not always possible in the field. The intel-ucode
337 feature enables the microcode update capability present in the
338 Linux kernel. It provides an easy path for upgrading processor
339 microcode without the need to change the BIOS. If the feature
340 is enabled, it is also possible to update the existing target
341 images with a newer microcode update in the future.
342
343 Q. How would a user bundle only target-specific microcode in the
344 target image?
345
346 A. The Intel microcode data file released by Intel contains
347 microcode updates for multiple processors. If the BSP image is
348 meant to run on only a certain subset of processor types, a
349 processor-specific subset of microcode can be bundled into the
350 target image via the UCODE_FILTER_PARAMETERS variable. This
351 works by listing a sequence of iucode-tool parameters in the
352 UCODE_FILTER_PARAMETERS variable, which in this case will
353 select only the specific microcode relevant to the BSP. For
354 more information on the underlying parameters refer to the
355 iucode-tool manual page at http://manned.org/iucode-tool
356
357 To define a set of parameters for microcode-filtering via the
358 UCODE_FILTER_PARAMETERS variable, one needs to identify the
359 cpuid signatures of all the processors the BSP is meant to run
360 on. One way to determine the cpuid signature for a specific
361 processor is to build and run an intel-ucode-feature-enabled
362 image on the target hardware, without first assigning any value
363 to the UCODE_FILTER_PARAMETERS variable, and then once the
364 image is booted, run the "ucode_tool -S" command to have the
365 ucode tool scan the system for processor signatures. These
366 signatures can then be used in the UCODE_FILTER_PARAMETERS
367 variable in conjunction with -s parameter. For example, for
368 the fri2 BSP, the cpuid can be determined as such:
369
370 [root@fri2 ~]# iucode_tool -S
371 iucode_tool: system has processor(s) with signature 0x00020661
372
373 Given that output, a suitable UCODE_FILTER_PARAMETERS variable
374 definition could be specified in the machine configuration as
375 such:
376
377 UCODE_FILTER_PARAMETERS = "-s 0x00020661"
378
379 Q. Are there any reasons a user might want to disable the
380 intel-ucode feature?
381
382 A. The microcode data file and associated tools occupy a small
383 amount of space (a few KB) on the target image. BSPs which are
384 highly sensitive to target image size and which are not
385 experiencing microcode-related issues might consider not
386 enabling this feature.
387
388
389IV. Tested Hardware
390===================
391
392The following undergo regular basic testing with their respective MACHINE types.
393Note that both 64-bit and 32-bit firmware is available for the MinnowBoard
394Turbot, so it is tested against both intel-corei7-64 and intel-core2-32.
395
396intel-corei7-64:
397 NUC6i5SYH
398 NUC7i7BNH
399 Coffee Lake-H
400
401intel-core2-32:
402 MinnowBoard Turbot
403
404
405V. Guidelines for submitting patches
406====================================
407
408Please submit any patches against meta-intel BSPs to the meta-intel
409mailing list (meta-intel@lists.yoctoproject.org). Also, if your patches are
410available via a public git repository, please also include a URL to
411the repo and branch containing your patches as that makes it easier
412for maintainers to grab and test your patches.
413
414There are patch submission scripts available that will, among other
415things, automatically include the repo URL and branch as mentioned.
416Please see the Yocto Project Development Manual sections entitled
417'Using Scripts to Push a Change Upstream and Request a Pull' and
418'Using Email to Submit a Patch' for details.
419
420Regardless of how you submit a patch or patchset, the patches should
421at minimum follow the suggestions outlined in the 'Submitting a Change
422to the Yocto Project' section in the Yocto Project Development Manual.
423Specifically, they should:
424
425 - Include a 'Signed-off-by:' line. A commit can't legally be pulled
426 in without this.
427
428 - Provide a single-line, short summary of the change. This short
429 description should be prefixed by the BSP or recipe name, as
430 appropriate, followed by a colon. Capitalize the first character
431 of the summary (following the colon).
432
433 - For the body of the commit message, provide detailed information
434 that describes what you changed, why you made the change, and the
435 approach you used.
436
437 - If the change addresses a specific bug or issue that is associated
438 with a bug-tracking ID, include a reference to that ID in your
439 detailed description in the following format: [YOCTO #<bug-id>].
440
441 - Pay attention to line length - please don't allow any particular
442 line in the commit message to stretch past 72 characters.
443
444 - For any non-trivial patch, provide information about how you
445 tested the patch, and for any non-trivial or non-obvious testing
446 setup, provide details of that setup.
447
448Doing a quick 'git log' in meta-intel will provide you with many
449examples of good example commits if you have questions about any
450aspect of the preferred format.
451
452The meta-intel maintainers will do their best to review and/or pull in
453a patch or patchset within 24 hours of the time it was posted. For
454larger and/or more involved patches and patchsets, the review process
455may take longer.
456
457Please see the meta-intel/MAINTAINERS file for the list of maintainers
458and their specific areas; it's also a good idea to cc: the specific
459maintainer, if applicable.
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..ef1dd842
--- /dev/null
+++ b/README.md
@@ -0,0 +1,32 @@
1# meta-intel
2
3OpenEmbedded/Yocto BSP layer for Intel platforms.
4
5## Dependencies
6
7This layer primarily depends on OpenEmbedded-Core (OE-Core). However, certain
8recipes may require additional layers to support optional features or
9programming languages not supported by OE-Core. Such recipes are located within
10the `dynamic-layers` directory.
11
12Base dependencies:
13- [Bitbake](https://git.openembedded.org/bitbake)
14- [OE-Core](https://git.openembedded.org/openembedded-core)
15
16Dynamic additional dependencies:
17
18- [meta-openembedded](https://git.openembedded.org/meta-openembedded/tree/meta-oe)
19- [meta-python](https://git.openembedded.org/meta-openembedded/tree/meta-python)
20- [meta-clang](https://github.com/kraj/meta-clang.git)
21
22
23## Contents
24
25- [Building and booting meta-intel BSP layers](documentation/building_and_booting.md)
26- [Intel oneAPI DPC++/C++ Compiler](documentation/dpcpp-compiler.md)
27- [Tested Hardware](documentation/tested_hardware.md)
28- [Guidelines for submitting patches](documentation/submitting_patches.md)
29- [Reporting bugs](documentation/reporting_bugs.md)
30- [Reporting security bugs](SECURITY.md)
31- [Maintainers](documentation/MAINTAINERS.md)
32
diff --git a/README.sources b/README.sources
deleted file mode 100644
index 9b483ee0..00000000
--- a/README.sources
+++ /dev/null
@@ -1,17 +0,0 @@
1The sources for the packages comprising the images shipped with this
2BSP can be found at the following location:
3
4http://downloads.yoctoproject.org/mirror/sources/
5
6The metadata used to generate the images shipped with this BSP, in
7addition to the code contained in this BSP, can be found at the
8following location:
9
10http://downloads.yoctoproject.org/releases/yocto/yocto-2.7/poky-warrior-21.0.0.tar.bz2
11
12The metadata used to generate the images shipped with this BSP, in
13addition to the code contained in this BSP, can also be found at the
14following locations:
15
16git://git.yoctoproject.org/poky.git
17git://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 @@
1# Security Policy
2Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation.
3
4## Reporting a Vulnerability
5Please 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).
6
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 @@
4# it with the efi stub obtained from systemd-boot. 4# it with the efi stub obtained from systemd-boot.
5 5
6# Don't add syslinux or build an ISO 6# Don't add syslinux or build an ISO
7PCBIOS_forcevariable = "0" 7PCBIOS:forcevariable = "0"
8NOISO_forcevariable = "1" 8NOISO:forcevariable = "1"
9 9
10# image-live.bbclass will default INITRD_LIVE to the image INITRD_IMAGE creates. 10# image-live.bbclass will default INITRD_LIVE to the image INITRD_IMAGE creates.
11# We want behavior to be consistent whether or not "live" is in IMAGE_FSTYPES, so 11# We want behavior to be consistent whether or not "live" is in IMAGE_FSTYPES, so
@@ -138,7 +138,7 @@ build_efi_cfg() {
138 : 138 :
139} 139}
140 140
141populate_kernel_append() { 141populate_kernel:append() {
142 # The kernel and initrd are built into the app, so we don't need these 142 # The kernel and initrd are built into the app, so we don't need these
143 if [ -f $dest/initrd ]; then 143 if [ -f $dest/initrd ]; then
144 rm $dest/initrd 144 rm $dest/initrd
diff --git a/conf/include/maintainers.inc b/conf/include/maintainers.inc
index 90c39e4e..9849d0d8 100644
--- a/conf/include/maintainers.inc
+++ b/conf/include/maintainers.inc
@@ -1,44 +1,54 @@
1# This file contains a list of recipe maintainers for meta-intel 1# This file contains a list of recipe maintainers for meta-intel
2 2
3RECIPE_MAINTAINER_pn-backport-iwlwifi = "Naveen Saini <naveen.kumar.saini@intel.com>" 3RECIPE_MAINTAINER:pn-backport-iwlwifi = "Naveen Saini <naveen.kumar.saini@intel.com>"
4RECIPE_MAINTAINER_pn-core-image-rt = "Anuj Mittal <anuj.mittal@intel.com>" 4RECIPE_MAINTAINER:pn-core-image-rt = "Anuj Mittal <anuj.mittal@intel.com>"
5RECIPE_MAINTAINER_pn-core-image-rt-sdk = "Anuj Mittal <anuj.mittal@intel.com>" 5RECIPE_MAINTAINER:pn-core-image-rt-sdk = "Anuj Mittal <anuj.mittal@intel.com>"
6RECIPE_MAINTAINER_pn-core-image-tiny = "Naveen Saini <naveen.kumar.saini@intel.com>" 6RECIPE_MAINTAINER:pn-core-image-tiny = "Naveen Saini <naveen.kumar.saini@intel.com>"
7RECIPE_MAINTAINER_pn-core-image-minimal-initramfs = "Anuj Mittal <anuj.mittal@intel.com>" 7RECIPE_MAINTAINER:pn-core-image-minimal-initramfs = "Anuj Mittal <anuj.mittal@intel.com>"
8RECIPE_MAINTAINER_pn-gmmlib = "Anuj Mittal <anuj.mittal@intel.com>" 8RECIPE_MAINTAINER:pn-embree = "Naveen Saini <naveen.kumar.saini@intel.com>"
9RECIPE_MAINTAINER_pn-hdcp = "Naveen Saini <naveen.kumar.saini@intel.com>" 9RECIPE_MAINTAINER:pn-gmmlib = "Lim Siew Hoon <siew.hoon.lim@intel.com>"
10RECIPE_MAINTAINER_pn-intel-graphics-compiler = "Naveen Saini <naveen.kumar.saini@intel.com>" 10RECIPE_MAINTAINER:pn-hdcp = "Naveen Saini <naveen.kumar.saini@intel.com>"
11RECIPE_MAINTAINER_pn-intel-compute-runtime = "Naveen Saini <naveen.kumar.saini@intel.com>" 11RECIPE_MAINTAINER:pn-intel-cmt-cat = "Naveen Saini <naveen.kumar.saini@intel.com>"
12RECIPE_MAINTAINER_pn-intel-media-driver = "Anuj Mittal <anuj.mittal@intel.com>" 12RECIPE_MAINTAINER:pn-intel-compute-runtime = "Naveen Saini <naveen.kumar.saini@intel.com>"
13RECIPE_MAINTAINER_pn-intel-mediasdk = "Anuj Mittal <anuj.mittal@intel.com>" 13RECIPE_MAINTAINER:pn-intel-crypto-mb = "Anuj Mittal <anuj.mittal@intel.com>"
14RECIPE_MAINTAINER_pn-intel-microcode = "Anuj Mittal <anuj.mittal@intel.com>" 14RECIPE_MAINTAINER:pn-intel-graphics-compiler = "Naveen Saini <naveen.kumar.saini@intel.com>"
15RECIPE_MAINTAINER_pn-intel-vaapi-driver = "Anuj Mittal <anuj.mittal@intel.com>" 15RECIPE_MAINTAINER:pn-intel-media-driver = "Lim Siew Hoon <siew.hoon.lim@intel.com>"
16RECIPE_MAINTAINER_pn-isa-l = "Naveen Saini <naveen.kumar.saini@intel.com>" 16RECIPE_MAINTAINER:pn-intel-mediasdk = "Lim Siew Hoon <siew.hoon.lim@intel.com>"
17RECIPE_MAINTAINER_pn-itt = "Naveen Saini <naveen.kumar.saini@intel.com>" 17RECIPE_MAINTAINER:pn-intel-microcode = "Anuj Mittal <anuj.mittal@intel.com>"
18RECIPE_MAINTAINER_pn-ixgbe = "Naveen Saini <naveen.kumar.saini@intel.com>" 18RECIPE_MAINTAINER:pn-intel-vaapi-driver = "Lim Siew Hoon <siew.hoon.lim@intel.com>"
19RECIPE_MAINTAINER_pn-ixgbevf = "Naveen Saini <naveen.kumar.saini@intel.com>" 19RECIPE_MAINTAINER:pn-ipmctl = "Anuj Mittal <anuj.mittal@intel.com>"
20RECIPE_MAINTAINER_pn-iucode-tool = "Anuj Mittal <anuj.mittal@intel.com>" 20RECIPE_MAINTAINER:pn-isa-l = "Naveen Saini <naveen.kumar.saini@intel.com>"
21RECIPE_MAINTAINER_pn-jhi = "Naveen Saini <naveen.kumar.saini@intel.com>" 21RECIPE_MAINTAINER:pn-ispc = "Naveen Saini <naveen.kumar.saini@intel.com>"
22RECIPE_MAINTAINER_pn-level-zero = "Naveen Saini <naveen.kumar.saini@intel.com>" 22RECIPE_MAINTAINER:pn-itt = "Naveen Saini <naveen.kumar.saini@intel.com>"
23RECIPE_MAINTAINER_pn-libipt = "Naveen Saini <naveen.kumar.saini@intel.com>" 23RECIPE_MAINTAINER:pn-ixgbe = "Naveen Saini <naveen.kumar.saini@intel.com>"
24RECIPE_MAINTAINER_pn-libyami = "Anuj Mittal <anuj.mittal@intel.com>" 24RECIPE_MAINTAINER:pn-ixgbevf = "Naveen Saini <naveen.kumar.saini@intel.com>"
25RECIPE_MAINTAINER_pn-libyami-utils = "Anuj Mittal <anuj.mittal@intel.com>" 25RECIPE_MAINTAINER:pn-iucode-tool = "Anuj Mittal <anuj.mittal@intel.com>"
26RECIPE_MAINTAINER_pn-libxcam = "Naveen Saini <naveen.kumar.saini@intel.com>" 26RECIPE_MAINTAINER:pn-level-zero = "Naveen Saini <naveen.kumar.saini@intel.com>"
27RECIPE_MAINTAINER_pn-linux-intel = "Anuj Mittal <anuj.mittal@intel.com>" 27RECIPE_MAINTAINER:pn-libipt = "Naveen Saini <naveen.kumar.saini@intel.com>"
28RECIPE_MAINTAINER_pn-linux-intel-rt = "Anuj Mittal <anuj.mittal@intel.com>" 28RECIPE_MAINTAINER:pn-libva-intel = "Anuj Mittal <anuj.mittal@intel.com>"
29RECIPE_MAINTAINER_pn-linux-intel-dev = "Naveen Saini <naveen.kumar.saini@intel.com>" 29RECIPE_MAINTAINER:pn-libva-intel-utils = "Anuj Mittal <anuj.mittal@intel.com>"
30RECIPE_MAINTAINER_pn-lms = "Anuj Mittal <anuj.mittal@intel.com>" 30RECIPE_MAINTAINER:pn-libxcam = "Naveen Saini <naveen.kumar.saini@intel.com>"
31RECIPE_MAINTAINER_pn-metee = "Naveen Saini <naveen.kumar.saini@intel.com>" 31RECIPE_MAINTAINER:pn-linux-intel = "Anuj Mittal <anuj.mittal@intel.com>"
32RECIPE_MAINTAINER_pn-metrics-discovery = "Naveen Saini <naveen.kumar.saini@intel.com>" 32RECIPE_MAINTAINER:pn-linux-intel-rt = "Anuj Mittal <anuj.mittal@intel.com>"
33RECIPE_MAINTAINER_pn-onednn = "Naveen Saini <naveen.kumar.saini@intel.com>" 33RECIPE_MAINTAINER:pn-linux-intel-dev = "Naveen Saini <naveen.kumar.saini@intel.com>"
34RECIPE_MAINTAINER_pn-open-model-zoo = "Anuj Mittal <anuj.mittal@intel.com>" 34RECIPE_MAINTAINER:pn-lms = "Anuj Mittal <anuj.mittal@intel.com>"
35RECIPE_MAINTAINER_pn-opencl-clang = "Naveen Saini <naveen.kumar.saini@intel.com>" 35RECIPE_MAINTAINER:pn-metee = "Naveen Saini <naveen.kumar.saini@intel.com>"
36RECIPE_MAINTAINER_pn-openvino-inference-engine = "Anuj Mittal <anuj.mittal@intel.com>" 36RECIPE_MAINTAINER:pn-metrics-discovery = "Naveen Saini <naveen.kumar.saini@intel.com>"
37RECIPE_MAINTAINER_pn-openvino-model-optimizer = "Anuj Mittal <anuj.mittal@intel.com>" 37RECIPE_MAINTAINER:pn-oidn = "Naveen Saini <naveen.kumar.saini@intel.com>"
38RECIPE_MAINTAINER_pn-ovmf-shell-image-enrollkeys = "Naveen Saini <naveen.kumar.saini@intel.com>" 38RECIPE_MAINTAINER:pn-onednn = "Naveen Saini <naveen.kumar.saini@intel.com>"
39RECIPE_MAINTAINER_pn-sbsigntool-native = "Anuj Mittal <anuj.mittal@intel.com>" 39RECIPE_MAINTAINER:pn-onedpl = "Naveen Saini <naveen.kumar.saini@intel.com>"
40RECIPE_MAINTAINER_pn-secureboot-selftest-image-signed = "Anuj Mittal <anuj.mittal@intel.com>" 40RECIPE_MAINTAINER:pn-onevpl = "Naveen Saini <naveen.kumar.saini@intel.com>"
41RECIPE_MAINTAINER_pn-secureboot-selftest-image-unsigned = "Anuj Mittal <anuj.mittal@intel.com>" 41RECIPE_MAINTAINER:pn-onevpl-intel-gpu = "Yew Chang Ching <chang.ching.yew@intel.com>"
42RECIPE_MAINTAINER_pn-thermald = "Anuj Mittal <anuj.mittal@intel.com>" 42RECIPE_MAINTAINER:pn-open-model-zoo = "Anuj Mittal <anuj.mittal@intel.com>"
43RECIPE_MAINTAINER_pn-xf86-video-ast = "Anuj Mittal <anuj.mittal@intel.com>" 43RECIPE_MAINTAINER:pn-opencl-clang = "Naveen Saini <naveen.kumar.saini@intel.com>"
44RECIPE_MAINTAINER_pn-zlib-intel = "Naveen Saini <naveen.kumar.saini@intel.com>" 44RECIPE_MAINTAINER:pn-openvino-inference-engine = "Anuj Mittal <anuj.mittal@intel.com>"
45RECIPE_MAINTAINER:pn-openvino-model-optimizer = "Anuj Mittal <anuj.mittal@intel.com>"
46RECIPE_MAINTAINER:pn-openvkl = "Naveen Saini <naveen.kumar.saini@intel.com>"
47RECIPE_MAINTAINER:pn-ospray = "Naveen Saini <naveen.kumar.saini@intel.com>"
48RECIPE_MAINTAINER:pn-ovmf-shell-image-enrollkeys = "Naveen Saini <naveen.kumar.saini@intel.com>"
49RECIPE_MAINTAINER:pn-rkcommon = "Naveen Saini <naveen.kumar.saini@intel.com>"
50RECIPE_MAINTAINER:pn-sbsigntool-native = "Anuj Mittal <anuj.mittal@intel.com>"
51RECIPE_MAINTAINER:pn-secureboot-selftest-image-signed = "Anuj Mittal <anuj.mittal@intel.com>"
52RECIPE_MAINTAINER:pn-secureboot-selftest-image-unsigned = "Anuj Mittal <anuj.mittal@intel.com>"
53RECIPE_MAINTAINER:pn-thermald = "Anuj Mittal <anuj.mittal@intel.com>"
54RECIPE_MAINTAINER:pn-xf86-video-ast = "Anuj Mittal <anuj.mittal@intel.com>"
diff --git a/conf/layer.conf b/conf/layer.conf
index c4781ffd..97dfb897 100644
--- a/conf/layer.conf
+++ b/conf/layer.conf
@@ -10,15 +10,16 @@ BBFILE_PATTERN_intel := "^${LAYERDIR}/"
10BBFILE_PRIORITY_intel = "5" 10BBFILE_PRIORITY_intel = "5"
11 11
12# Additional license directories. 12# Additional license directories.
13LICENSE_PATH += "${LAYERDIR}/custom-licenses" 13CUSTOM_LICENSES_PATH = "${LAYERDIR}/custom-licenses"
14LICENSE_PATH += "${CUSTOM_LICENSES_PATH}"
14 15
15LAYERDEPENDS_intel = "core" 16LAYERDEPENDS_intel = "core"
16LAYERRECOMMENDS_intel = "dpdk intel-qat" 17LAYERRECOMMENDS_intel = "dpdk"
17 18
18# This should only be incremented on significant changes that will 19# This should only be incremented on significant changes that will
19# cause compatibility issues with other layers 20# cause compatibility issues with other layers
20LAYERVERSION_intel = "5" 21LAYERVERSION_intel = "5"
21LAYERSERIES_COMPAT_intel = "dunfell gatesgarth hardknott" 22LAYERSERIES_COMPAT_intel = "kirkstone scarthgap"
22 23
23BBFILES_DYNAMIC += " \ 24BBFILES_DYNAMIC += " \
24 clang-layer:${LAYERDIR}/dynamic-layers/clang-layer/*/*/*.bb \ 25 clang-layer:${LAYERDIR}/dynamic-layers/clang-layer/*/*/*.bb \
@@ -31,10 +32,6 @@ BBFILES_DYNAMIC += " \
31 32
32require ${LAYERDIR}/conf/include/maintainers.inc 33require ${LAYERDIR}/conf/include/maintainers.inc
33 34
34PREFERRED_PROVIDER_zlib ?= "zlib"
35PREFERRED_PROVIDER_zlib-native ?= "zlib-native"
36PREFERRED_PROVIDER_nativesdk-zlib ?= "nativesdk-zlib"
37
38# Use the libva from OE-Core when layer is included but no MACHINE 35# Use the libva from OE-Core when layer is included but no MACHINE
39# from meta-intel is being used. 36# from meta-intel is being used.
40PREFERRED_PROVIDER_libva ?= "libva" 37PREFERRED_PROVIDER_libva ?= "libva"
@@ -44,3 +41,5 @@ PREFERRED_PROVIDER_nativesdk-libva ?= "nativesdk-libva"
44PREFERRED_PROVIDER_libva-utils ?= "libva-utils" 41PREFERRED_PROVIDER_libva-utils ?= "libva-utils"
45PREFERRED_PROVIDER_libva-utils-native ?= "libva-utils-native" 42PREFERRED_PROVIDER_libva-utils-native ?= "libva-utils-native"
46PREFERRED_PROVIDER_nativesdk-libva-utils ?= "nativesdk-libva-utils" 43PREFERRED_PROVIDER_nativesdk-libva-utils ?= "nativesdk-libva-utils"
44
45# 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 @@
1INTEL_COMMON_PACKAGE_ARCH ?= "${TUNE_PKGARCH}-intel-common" 1INTEL_COMMON_PACKAGE_ARCH ?= "${TUNE_PKGARCH}-intel-common"
2PACKAGE_ARCH_pn-linux-intel = "${INTEL_COMMON_PACKAGE_ARCH}" 2PACKAGE_ARCH:pn-linux-intel = "${INTEL_COMMON_PACKAGE_ARCH}"
3PACKAGE_ARCH_pn-linux-intel-rt = "${INTEL_COMMON_PACKAGE_ARCH}" 3PACKAGE_ARCH:pn-linux-intel-rt = "${INTEL_COMMON_PACKAGE_ARCH}"
4PACKAGE_ARCH_pn-linux-intel-tiny = "${INTEL_COMMON_PACKAGE_ARCH}" 4PACKAGE_ARCH:pn-linux-intel-tiny = "${INTEL_COMMON_PACKAGE_ARCH}"
5PACKAGE_ARCH_pn-linux-intel-dev = "${INTEL_COMMON_PACKAGE_ARCH}" 5PACKAGE_ARCH:pn-linux-intel-dev = "${INTEL_COMMON_PACKAGE_ARCH}"
6PACKAGE_ARCH_pn-linux-yocto = "${INTEL_COMMON_PACKAGE_ARCH}" 6PACKAGE_ARCH:pn-linux-yocto = "${INTEL_COMMON_PACKAGE_ARCH}"
7PACKAGE_ARCH_pn-linux-yocto-rt = "${INTEL_COMMON_PACKAGE_ARCH}" 7PACKAGE_ARCH:pn-linux-yocto-rt = "${INTEL_COMMON_PACKAGE_ARCH}"
8PACKAGE_ARCH_pn-linux-yocto-tiny = "${INTEL_COMMON_PACKAGE_ARCH}" 8PACKAGE_ARCH:pn-linux-yocto-tiny = "${INTEL_COMMON_PACKAGE_ARCH}"
9PACKAGE_ARCH_pn-linux-yocto-dev = "${INTEL_COMMON_PACKAGE_ARCH}" 9PACKAGE_ARCH:pn-linux-yocto-dev = "${INTEL_COMMON_PACKAGE_ARCH}"
10PACKAGE_ARCH_pn-intel-microcode = "${INTEL_COMMON_PACKAGE_ARCH}" 10PACKAGE_ARCH:pn-intel-microcode = "${INTEL_COMMON_PACKAGE_ARCH}"
11PACKAGE_ARCH_pn-backport-iwlwifi = "${INTEL_COMMON_PACKAGE_ARCH}" 11PACKAGE_ARCH:pn-backport-iwlwifi = "${INTEL_COMMON_PACKAGE_ARCH}"
12PACKAGE_ARCH_pn-ixgbe = "${INTEL_COMMON_PACKAGE_ARCH}" 12PACKAGE_ARCH:pn-ixgbe = "${INTEL_COMMON_PACKAGE_ARCH}"
13PACKAGE_ARCH_pn-ixgbevf = "${INTEL_COMMON_PACKAGE_ARCH}" 13PACKAGE_ARCH:pn-ixgbevf = "${INTEL_COMMON_PACKAGE_ARCH}"
14PACKAGE_EXTRA_ARCHS_append += "${INTEL_COMMON_PACKAGE_ARCH}" 14PACKAGE_EXTRA_ARCHS:append = " ${INTEL_COMMON_PACKAGE_ARCH}"
15MACHINEOVERRIDES =. "${INTEL_COMMON_PACKAGE_ARCH}:" 15MACHINEOVERRIDES =. "${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 @@
3# 3#
4 4
5DEFAULTTUNE ?= "core2-32" 5DEFAULTTUNE ?= "core2-32"
6require conf/machine/include/tune-core2.inc 6require conf/machine/include/x86/tune-core2.inc
7require conf/machine/include/x86-base.inc 7require 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 @@
3# 3#
4 4
5DEFAULTTUNE ?= "corei7-64" 5DEFAULTTUNE ?= "corei7-64"
6require conf/machine/include/tune-corei7.inc 6require conf/machine/include/x86/tune-corei7.inc
7require conf/machine/include/x86-base.inc 7require 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 @@
5# 5#
6 6
7PREFERRED_PROVIDER_virtual/kernel ?= "linux-intel" 7PREFERRED_PROVIDER_virtual/kernel ?= "linux-intel"
8PREFERRED_PROVIDER_virtual/kernel_poky-tiny ?= "linux-intel" 8PREFERRED_PROVIDER_virtual/kernel:poky-tiny ?= "linux-intel"
9 9
10# Only use the Intel-tuned zlib for target builds to improve reuse 10PREFERRED_VERSION_linux-intel ?= "6.6%"
11PREFERRED_PROVIDER_zlib = "zlib-intel" 11PREFERRED_VERSION_linux-intel-rt ?= "6.6%"
12PREFERRED_PROVIDER_zlib-native = "zlib-native" 12PREFERRED_VERSION_linux-intel:poky-altcfg ?= "6.8%"
13PREFERRED_PROVIDER_nativesdk-zlib = "nativesdk-zlib"
14
15PREFERRED_VERSION_linux-intel ?= "5.10%"
16PREFERRED_VERSION_linux-intel-rt ?= "5.10%"
17PREFERRED_VERSION_linux-intel_poky-altcfg ?= "5.4%"
18PREFERRED_VERSION_linux-intel-rt_poky-altcfg ?= "5.4%"
19 13
20# Need to point to latest version of libva needed for media components 14# Need to point to latest version of libva needed for media components
21PREFERRED_PROVIDER_libva = "libva-intel" 15PREFERRED_PROVIDER_libva = "libva-intel"
@@ -26,29 +20,28 @@ PREFERRED_PROVIDER_libva-utils = "libva-intel-utils"
26PREFERRED_PROVIDER_libva-utils-native = "libva-intel-utils-native" 20PREFERRED_PROVIDER_libva-utils-native = "libva-intel-utils-native"
27PREFERRED_PROVIDER_nativesdk-libva-utils = "nativesdk-libva-intel-utils" 21PREFERRED_PROVIDER_nativesdk-libva-utils = "nativesdk-libva-intel-utils"
28 22
29PREFERRED_VERSION_opencl-clang ?= "${@bb.utils.contains('LLVMVERSION', '10.0.1', '10.0.0', \ 23LLVM_MAJOR_VERSION = "${@d.getVar('LLVMVERSION').split('.')[0]}"
30 bb.utils.contains('LLVMVERSION', '11.1.0', '11.0.0', '12.0.0', d), d)}" 24PREFERRED_VERSION_opencl-clang ?= "${@bb.utils.contains('LLVM_MAJOR_VERSION', '14', '14.0.0', '15.0.0', d)}"
31PREFERRED_VERSION_opencl-clang-native ?= "${@bb.utils.contains('LLVMVERSION', '10.0.1', '10.0.0', \ 25PREFERRED_VERSION_opencl-clang-native ?= "${@bb.utils.contains('LLVM_MAJOR_VERSION', '14', '14.0.0', '15.0.0', d)}"
32 bb.utils.contains('LLVMVERSION', '11.1.0', '11.0.0', '12.0.0', d), d)}"
33 26
34XSERVER_X86_ASPEED_AST = "xf86-video-ast \ 27XSERVER_X86_ASPEED_AST = "xf86-video-ast \
35 " 28 "
36 29
37# include the user space intel microcode loading support in the generated images. 30# include the user space intel microcode loading support in the generated images.
38MACHINE_ESSENTIAL_EXTRA_RDEPENDS_append = "${@bb.utils.contains('MACHINE_FEATURES', 'intel-ucode', ' intel-microcode', '', d)}" 31MACHINE_ESSENTIAL_EXTRA_RDEPENDS:append = "${@bb.utils.contains('MACHINE_FEATURES', 'intel-ucode', ' intel-microcode', '', d)}"
39 32
40# recommended extra packages common to all intel machines 33# recommended extra packages common to all intel machines
41MACHINE_EXTRA_RRECOMMENDS_append = " kernel-modules linux-firmware" 34MACHINE_EXTRA_RRECOMMENDS:append = " kernel-modules linux-firmware"
42MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS_append = " kernel-module-i915 linux-firmware-i915" 35MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS:append = " kernel-module-i915 linux-firmware-i915 kernel-module-igc kernel-module-r8152"
43 36
44# for the early boot time kernel microcode loading support, 37# for the early boot time kernel microcode loading support,
45# merge the microcode data in the final initrd image. 38# merge the microcode data in the final initrd image.
46INITRD_LIVE_prepend = "${@bb.utils.contains('MACHINE_FEATURES', 'intel-ucode', '${DEPLOY_DIR_IMAGE}/microcode.cpio ', '', d)}" 39INITRD_LIVE:prepend = "${@bb.utils.contains('MACHINE_FEATURES', 'intel-ucode', '${DEPLOY_DIR_IMAGE}/microcode.cpio ', '', d)}"
47 40
48DISK_SIGNATURE_UUID ??= "deadbeef-dead-beef-dead-beefdeadbeef" 41DISK_SIGNATURE_UUID ??= "deadbeef-dead-beef-dead-beefdeadbeef"
49 42
50EFI_PROVIDER ?= "systemd-boot" 43EFI_PROVIDER ?= "systemd-boot"
51EFI_PROVIDER_x86-x32 = "grub-efi" 44EFI_PROVIDER:x86-x32 = "grub-efi"
52 45
53# Add general MACHINEOVERRIDE for meta-intel 46# Add general MACHINEOVERRIDE for meta-intel
54MACHINEOVERRIDES =. "intel-x86-common:" 47MACHINEOVERRIDES =. "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 @@
2# distro content (in particular the kernel) less than qemu.inc. 2# distro content (in particular the kernel) less than qemu.inc.
3 3
4# Ensure that qemu gets built when building images. 4# Ensure that qemu gets built when building images.
5EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native" 5EXTRA_IMAGEDEPENDS += "qemu-system-native qemu-helper-native:do_addto_recipe_sysroot"
6 6
7# Build ovmf firmware for uefi support in qemu. 7# Build ovmf firmware for uefi support in qemu.
8EXTRA_IMAGEDEPENDS += "ovmf" 8EXTRA_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 @@
1# For runqemu 1# For runqemu
2IMAGE_CLASSES += "qemuboot" 2IMAGE_CLASSES += "qemuboot"
3QB_SYSTEM_NAME_intel-core2-32 = "qemu-system-i386" 3QB_SYSTEM_NAME:intel-core2-32 = "qemu-system-i386"
4QB_CPU_intel-core2-32 = "-cpu coreduo" 4QB_CPU:intel-core2-32 = "-cpu coreduo"
5QB_CPU_KVM_intel-core2-32 = "-cpu kvm32" 5QB_CPU_KVM:intel-core2-32 = "-cpu kvm32"
6 6
7QB_SYSTEM_NAME_intel-corei7-64 = "qemu-system-x86_64" 7QB_SYSTEM_NAME:intel-corei7-64 = "qemu-system-x86_64"
8QB_CPU_intel-corei7-64 = "-cpu Nehalem" 8QB_CPU:intel-corei7-64 = "-cpu Nehalem"
9QB_CPU_KVM_intel-corei7-64 = "-cpu kvm64" 9QB_CPU_KVM:intel-corei7-64 = "-cpu kvm64"
10 10
11QB_SYSTEM_NAME_intel-skylake-64 = "qemu-system-x86_64" 11QB_SYSTEM_NAME:intel-skylake-64 = "qemu-system-x86_64"
12QB_CPU_intel-skylake-64 = "-cpu Skylake-Client" 12QB_CPU:intel-skylake-64 = "-cpu Skylake-Client"
13QB_CPU_KVM_intel-skylake-64 = "-cpu Skylake-Client" 13QB_CPU_KVM:intel-skylake-64 = "-cpu Skylake-Client"
14 14
15QB_AUDIO_DRV = "alsa" 15QB_AUDIO_DRV = "alsa"
16QB_AUDIO_OPT = "-soundhw ac97,es1370" 16QB_AUDIO_OPT = "-device AC97"
17QB_KERNEL_CMDLINE_APPEND = "vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 uvesafb.task_timeout=-1" 17QB_KERNEL_CMDLINE_APPEND = " oprofile.timer=1"
18# Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy 18QB_OPT_APPEND = " -usb -usbdevice tablet "
19QB_OPT_APPEND = "-vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci"
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 @@
1# Settings for the GCC(1) cpu-type "skylake":
2#
3# Intel Skylake CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
4# SSE4.2, AVX, AVX2 and POPCNT instruction set support.
5#
6# This tune is recommended for Intel Skylake CPU (and beyond).
7#
8DEFAULTTUNE ?= "skylake-64"
9
10# Include the previous tune to pull in PACKAGE_EXTRA_ARCHS
11require conf/machine/include/tune-corei7.inc
12
13# Extra tune features
14TUNEVALID[skylake] = "Enable skylake specific processor optimizations"
15TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'skylake', ' -march=skylake ${SKYLAKE_TUNE} -mfpmath=sse', '', d)}"
16
17# Extra tune selections
18
19AVAILTUNES += "skylake-64"
20TUNE_FEATURES_tune-skylake-64 = "${TUNE_FEATURES_tune-x86-64} skylake"
21BASE_LIB_tune-skylake-64 = "lib64"
22TUNE_PKGARCH_tune-skylake-64 = "skylake-64"
23PACKAGE_EXTRA_ARCHS_tune-skylake-64 = "${PACKAGE_EXTRA_ARCHS_tune-core2-64} skylake-64"
24QEMU_EXTRAOPTIONS_skylake-64 = " -cpu Skylake-Client"
25
26
27# Disable QEMU usermode by default (get avx2)
28MACHINE_FEATURES_remove = "qemu-usermode"
29
30# If qemu-usermode is enabled, we have to disable avx2 ISA extensions, but we can keep mtune as skylake vs generic
31SKYLAKE_TUNE .= "${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', ' -mtune=skylake ${QEMU_UNAVAILABLE_ISA}', '-mtune=generic -mavx2', d)}"
32
33QEMU_UNAVAILABLE_ISA = " \
34-mno-avx \
35-mno-avx2 \
36-mno-avx512f \
37-mno-avx512er \
38-mno-avx512cd \
39-mno-avx512pf \
40-mno-avx512dq \
41-mno-avx512bw \
42-mno-avx512vl \
43-mno-avx512ifma \
44-mno-avx512vbmi \
45-mno-avx512vbmi2 \
46-mno-avx512vnni \
47-mno-avx512bitalg \
48"
diff --git a/conf/machine/intel-core2-32.conf b/conf/machine/intel-core2-32.conf
index 384ad1e9..5b134dc3 100644
--- a/conf/machine/intel-core2-32.conf
+++ b/conf/machine/intel-core2-32.conf
@@ -13,9 +13,6 @@ MACHINE_FEATURES += "intel-ucode"
13 13
14MACHINE_HWCODECS ?= "intel-vaapi-driver gstreamer1.0-vaapi" 14MACHINE_HWCODECS ?= "intel-vaapi-driver gstreamer1.0-vaapi"
15 15
16# Enable optional QAT items:
17COMPATIBLE_MACHINE_pn-qat17 = "intel-core2-32"
18
19XSERVER ?= "${XSERVER_X86_BASE} \ 16XSERVER ?= "${XSERVER_X86_BASE} \
20 ${XSERVER_X86_EXT} \ 17 ${XSERVER_X86_EXT} \
21 ${XSERVER_X86_FBDEV} \ 18 ${XSERVER_X86_FBDEV} \
@@ -32,4 +29,4 @@ APPEND += "rootwait console=ttyS0,115200 console=ttyPCH0,115200 console=tty0"
32 29
33IMAGE_FSTYPES += "wic" 30IMAGE_FSTYPES += "wic"
34WKS_FILE ?= "${@bb.utils.contains_any("EFI_PROVIDER", "systemd-boot", "systemd-bootdisk-microcode.wks.in", "grub-bootdisk-microcode.wks.in", d)}" 31WKS_FILE ?= "${@bb.utils.contains_any("EFI_PROVIDER", "systemd-boot", "systemd-bootdisk-microcode.wks.in", "grub-bootdisk-microcode.wks.in", d)}"
35WKS_FILE_DEPENDS_append = " intel-microcode" 32WKS_FILE_DEPENDS:append = " intel-microcode"
diff --git a/conf/machine/intel-corei7-64.conf b/conf/machine/intel-corei7-64.conf
index 033b1aa9..968395fe 100644
--- a/conf/machine/intel-corei7-64.conf
+++ b/conf/machine/intel-corei7-64.conf
@@ -14,12 +14,8 @@ MACHINE_FEATURES += "intel-ucode"
14MACHINE_HWCODECS ?= "${@bb.utils.contains('TUNE_FEATURES', 'mx32', '', 'intel-media-driver intel-mediasdk', d)} gstreamer1.0-vaapi" 14MACHINE_HWCODECS ?= "${@bb.utils.contains('TUNE_FEATURES', 'mx32', '', 'intel-media-driver intel-mediasdk', d)} gstreamer1.0-vaapi"
15 15
16# Enable optional dpdk: 16# Enable optional dpdk:
17COMPATIBLE_MACHINE_pn-dpdk = "intel-corei7-64" 17COMPATIBLE_MACHINE:pn-dpdk = "intel-corei7-64"
18 18COMPATIBLE_MACHINE:pn-dpdk-module = "intel-corei7-64"
19# Enable optional QAT items:
20COMPATIBLE_MACHINE_pn-qat16 = "intel-corei7-64"
21COMPATIBLE_MACHINE_pn-qat17 = "intel-corei7-64"
22COMPATIBLE_MACHINE_pn-zlib-qat = "intel-corei7-64"
23 19
24XSERVER ?= "${XSERVER_X86_BASE} \ 20XSERVER ?= "${XSERVER_X86_BASE} \
25 ${XSERVER_X86_EXT} \ 21 ${XSERVER_X86_EXT} \
@@ -37,4 +33,4 @@ APPEND += "rootwait console=ttyS0,115200 console=tty0"
37 33
38IMAGE_FSTYPES += "wic" 34IMAGE_FSTYPES += "wic"
39WKS_FILE ?= "${@bb.utils.contains_any("EFI_PROVIDER", "systemd-boot", "systemd-bootdisk-microcode.wks.in", "grub-bootdisk-microcode.wks.in", d)}" 35WKS_FILE ?= "${@bb.utils.contains_any("EFI_PROVIDER", "systemd-boot", "systemd-bootdisk-microcode.wks.in", "grub-bootdisk-microcode.wks.in", d)}"
40WKS_FILE_DEPENDS_append = " intel-microcode" 36WKS_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 @@
4#@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. 4#@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.
5 5
6require conf/machine/include/meta-intel.inc 6require conf/machine/include/meta-intel.inc
7require conf/machine/include/x86-base.inc 7require conf/machine/include/x86/x86-base.inc
8require conf/machine/include/tune-skylake.inc 8require conf/machine/include/x86/tune-x86-64-v3.inc
9require conf/machine/include/intel-common-pkgarch.inc 9require conf/machine/include/intel-common-pkgarch.inc
10 10
11MACHINE_FEATURES += "efi" 11MACHINE_FEATURES += "efi"
@@ -14,7 +14,8 @@ MACHINE_FEATURES += "intel-ucode"
14 14
15MACHINE_HWCODECS ?= "intel-media-driver intel-mediasdk gstreamer1.0-vaapi" 15MACHINE_HWCODECS ?= "intel-media-driver intel-mediasdk gstreamer1.0-vaapi"
16 16
17COMPATIBLE_MACHINE_pn-dpdk = "intel-skylake-64" 17COMPATIBLE_MACHINE:pn-dpdk = "intel-skylake-64"
18COMPATIBLE_MACHINE:pn-dpdk-module = "intel-skylake-64"
18 19
19XSERVER ?= "${XSERVER_X86_BASE} \ 20XSERVER ?= "${XSERVER_X86_BASE} \
20 ${XSERVER_X86_EXT} \ 21 ${XSERVER_X86_EXT} \
@@ -32,4 +33,4 @@ APPEND += "rootwait console=ttyS0,115200 console=tty0"
32 33
33IMAGE_FSTYPES += "wic" 34IMAGE_FSTYPES += "wic"
34WKS_FILE ?= "${@bb.utils.contains_any("EFI_PROVIDER", "systemd-boot", "systemd-bootdisk-microcode.wks.in", "grub-bootdisk-microcode.wks.in", d)}" 35WKS_FILE ?= "${@bb.utils.contains_any("EFI_PROVIDER", "systemd-boot", "systemd-bootdisk-microcode.wks.in", "grub-bootdisk-microcode.wks.in", d)}"
35WKS_FILE_DEPENDS_append = " intel-microcode" 36WKS_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 @@
1Intel End User License Agreement for Developer Tools (Version October 2021)
2
3IMPORTANT NOTICE - PLEASE READ AND AGREE BEFORE DOWNLOADING, INSTALLING, COPYING
4OR USING
5
6This Agreement is between you, or the company or other legal entity that you
7represent and warrant you have the legal authority to bind, (each, "You" or
8"Your") and Intel Corporation and its subsidiaries (collectively, "Intel")
9regarding Your use of the Materials. By downloading, installing, copying or
10using the Materials, You agree to be bound by the terms of this Agreement. If
11You do not agree to the terms of this Agreement, or do not have legal authority
12or required age to agree to them, do not download, install, copy or use the
13Materials.
14
151. LICENSE DEFINITIONS.
16
17 A. "Cloud Provider" means a third party service provider offering a cloud-based
18 platform, infrastructure, application or storage services, such as Microsoft
19 Azure or Amazon Web Services, which You may only utilize to host the
20 Materials subject to the restrictions set forth in Section 2.3 B.
21
22 B. "Derivative Work" means a derivative work, as defined in 17 U.S.C. 101, of
23 the Source Code.
24
25 C. "Executable Code" means computer programming code in binary form suitable
26 for machine execution by a processor without the intervening steps of
27 interpretation or compilation.
28
29 D. "Materials" mean the software, documentation, the software product serial
30 number, and other collateral, including any updates, made available to You
31 by Intel under this Agreement. Materials include Redistributables,
32 Executable Code, Source Code, Sample Source Code, and Pre-Release Materials,
33 but do not include Third Party Software.
34
35 E. "Pre-Release Materials" mean the Materials, or portions of the Materials,
36 that are identified (in the product release notes, on Intel's download
37 website for the Materials or elsewhere) or labeled as pre-release,
38 prototype, alpha or beta code and, as such, are deemed to be pre-release
39 code (i) which may not be fully functional or tested and may contain bugs or
40 errors; (ii) which Intel may substantially modify in its development of a
41 production version; or (iii) for which Intel makes no assurances that it
42 will ever develop or make a production version generally available.
43 Pre-Release Materials are subject to the terms of Section 3.2.
44
45 F. "Reciprocal Open Source Software" means any software that is subject to a
46 license which requires that (i) it must be distributed in source code form;
47 (ii) it must be licensed under the same open source license terms; and (iii)
48 its derivative works must be licensed under the same open source license
49 terms. Examples of this type of license are the GNU General Public License
50 or the Mozilla Public License.
51
52 G. "Redistributables" mean the files (if any) listed in the "redist.txt,"
53 "redist-rt.txt" or similarly-named text files that may be included in the
54 Materials. Redistributables include Sample Source Code.
55
56 H. "Sample Source Code" means those portions of the Materials that are Source
57 Code and are identified as sample code. Sample Source Code may not have been
58 tested or validated by Intel and is provided purely as a programming example.
59
60 I. "Source Code" means the software portion of the Materials provided in human
61 readable format.
62
63 J. "Third Party Software" mean the files (if any) listed in the
64 "third-party-software.txt" or other similarly-named text file that may be
65 included in the Materials for the applicable software. Third Party Software
66 is subject to the terms of Section 2.2.
67
68 K. "Your Product" means one or more applications, products or projects
69 developed by or for You using the Materials.
70
712. LICENSE GRANTS.
72
732.1 License to the Materials. Subject to the terms and conditions of this
74 Agreement, Intel grants You a non-exclusive, worldwide, non-assignable,
75 non-sublicensable, limited right and license under its copyrights, to:
76
77 A. reproduce internally a reasonable number of copies of the Materials for Your
78 personal or business use;
79
80 B. use the Materials solely for Your personal or business use to develop Your
81 Product, in accordance with the documentation included as part of the
82 Materials;
83
84 C. modify or create Derivative Works only of the Redistributables, or any
85 portions, that are provided to You in Source Code;
86
87 D. distribute (directly and through Your distributors, resellers, and other
88 channel partners, if applicable), the Redistributables, including any
89 modifications to or Derivative Works of the Redistributables or any portions
90 made pursuant to Section 2.1.C subject to the following conditions:
91
92 (1) Any distribution of the Redistributables must only be as part of Your
93 Product which must add significant primary functionality different than
94 that of the Redistributables themselves;
95
96 (2) You must only distribute the Redistributables originally provided to You
97 by Intel only in Executable Code subject to a license agreement that
98 prohibits reverse engineering, decompiling or disassembling the
99 Redistributables;
100
101 (3) This distribution right includes a limited right to sublicense only the
102 Intel copyrights in the Redistributables and only to the extent necessary
103 to perform, display, and distribute the Redistributables (including Your
104 modifications and Derivative Works of the Redistributables provided in
105 Source Code) solely as incorporated in Your Product; and
106
107 (4) You: (i) will be solely responsible to Your customers for any update,
108 support obligation or other obligation or liability which may arise from
109 the distribution of Your Product, (ii) will not make any statement that
110 Your Product is "certified" or that its performance is guaranteed by Intel
111 or its suppliers, (iii) will not use Intel's or its suppliers' names or
112 trademarks to market Your Product, (iv) will comply with any additional
113 restrictions which are included in the text files with the
114 Redistributables and in Section 3 below, (v) will indemnify, hold
115 harmless, and defend Intel and its suppliers from and against any claims
116 or lawsuits, costs, damages, and expenses, including attorney's fees, that
117 arise or result from (a) Your modifications or Derivative Works of the
118 Materials or (b) Your distribution of Your Product.
119
1202.2 Third Party Software. Third Party Software, even if included with the
121 distribution of the Materials, may be governed by separate license terms,
122 including without limitation, third party license terms, open source
123 software notices and terms, and/or other Intel software license terms. These
124 separate license terms solely govern Your use of the Third Party Software.
125
1262.3 Third Party Use.
127
128 A. If You are an entity, Your contractors may use the Materials under the
129 license specified in Section 2, provided: (i) their use of the Materials is
130 solely on behalf of and in support of Your business, (ii) they agree to the
131 terms and conditions of this Agreement, and (iii) You are solely responsible
132 for their use, misuse or disclosure of the Materials.
133
134 B. You may utilize a Cloud Provider to host the Materials for You, provided:
135 (i) the Cloud Provider may only host the Materials for Your exclusive use
136 and may not use the Materials for any other purpose whatsoever, including the
137 restriction set forth in Section 3.1(xi); (ii) the Cloud Provider's use of
138 the Materials must be solely on behalf of and in support of Your Product, and
139 (iii) You will indemnify, hold harmless, and defend Intel and its suppliers
140 from and against any claims or lawsuits, costs, damages, and expenses,
141 including attorney's fees, that arise or result from Your Cloud Provider's
142 use, misuse or disclosure of the Materials.
143
1443. LICENSE CONDITIONS.
145
1463.1 Restrictions. Except as expressly provided in this Agreement, You may NOT:
147 (i) use, reproduce, disclose, distribute, or publicly display the
148 Materials; (ii) share, publish, rent or lease the Materials to any third
149 party; (iii) assign this Agreement or transfer the Materials; (iv) modify,
150 adapt, or translate the Materials in whole or in part; (v) reverse engineer,
151 decompile, or disassemble the Materials, or otherwise attempt to derive the
152 source code for the software; (vi) work around any technical limitations in
153 the Materials; (vii) distribute, sublicense or transfer any Source Code,
154 modifications or Derivative Works of any Source Code to any third party;
155 (viii) remove, minimize, block or modify any notices of Intel or its
156 suppliers in the Materials; (ix) include the Redistributables in malicious,
157 deceptive, or unlawful programs or products or use the Materials in any way
158 that is against the law; (x) modify, create a Derivative Work, link, or
159 distribute the Materials so that any part of it becomes Reciprocal Open
160 Source Software; (xi) use the Materials directly or indirectly for SaaS
161 services or service bureau purposes (i.e., a service that allows use of or
162 access to the Materials by a third party as part of that service, such as
163 the salesforce.com service business model).
164
1653.2 Pre-Release Materials. If You receive Pre-Release Materials, You may
166 reproduce a reasonable number of copies and use the Pre-Release Materials
167 for evaluation and testing purposes only. You may not (i) modify or
168 incorporate the Pre-Release Materials into Your Product; (ii) continue to
169 use the Pre-Release Materials once a commercial version is released; or
170 (iii) disclose to any third party any benchmarks, performance results, or
171 other information relating to the Pre-Release Materials. Intel may waive
172 these restrictions in writing at its sole discretion; however, if You decide
173 to use the Pre-Release Materials in Your Product (even with Intel's waiver),
174 You acknowledge and agree that You are fully responsible for any and all
175 issues that result from such use.
176
1773.3 Safety-Critical, and Life-Saving Applications; Indemnity. The Materials may
178 provide information relevant to safety-critical applications
179 ("Safety-Critical Applications") to allow compliance with functional safety
180 standards or requirements. You acknowledge and agree that safety is Your
181 responsibility. To the extent You use the Materials to create, or as part
182 of, products used in Safety-Critical Applications, it is Your responsibility
183 to design, manage, and ensure that there are system-level safeguards to
184 anticipate, monitor, and control system failures, and You agree that You are
185 solely responsible for all applicable regulatory standards and
186 safety-related requirements concerning Your use of the Materials in Safety
187 Critical Applications.
188
189 Should You use the Materials for Safety-Critical Applications or in any type
190 of a system or application in which the failure of the Materials could
191 create a situation where personal injury or death may occur (e.g., medical
192 systems, life-sustaining or life-saving systems) ("Life-Saving
193 Applications"), You agree to indemnify, defend, and hold Intel and its
194 representatives harmless against any claims or lawsuits, costs, damages, and
195 expenses, including reasonable attorney fees, arising in any way out of Your
196 use of the Materials in Safety-Critical Applications or Life-Saving
197 Applications and claims of product liability, personal injury or death
198 associated with those applications; even if such claims allege that Intel
199 was negligent or strictly liable regarding the design or manufacture of the
200 Materials or its failure to warn regarding the Materials.
201
2023.4 Media Format Codecs and Digital Rights Management. You acknowledge and agree
203 that Your use of the Materials or distribution of the Redistributables with
204 Your Product as permitted by this Agreement may require You to procure
205 license(s) from third parties that may hold intellectual property rights
206 applicable to any media decoding, encoding or transcoding technology (e.g.,
207 the use of an audio or video codec) and/or digital rights management
208 capabilities of the Materials, if any. Should any such additional licenses
209 be required, You are solely responsible for obtaining any such licenses and
210 agree to obtain any such licenses at Your own expense.
211
2124. DATA COLLECTION AND PRIVACY.
213
2144.1 Data Collection. The Materials may generate and collect anonymous data
215 and/or provisioning data about the Materials and/or the development
216 environment and transmit the data to Intel as a one-time event during
217 installation. Optional data may also be collected by the Materials, however,
218 You will be provided notice of the request to collect optional data and no
219 optional data will be collected without Your consent. All data collection by
220 Intel is performed pursuant to relevant privacy laws, including notice and
221 consent requirements.
222
2234.2 Intel's Privacy Notice. Intel is committed to respecting Your privacy. To
224 learn more about Intel's privacy practices, please visit
225 http://www.intel.com/privacy.
226
2275. OWNERSHIP. Title to the Materials and all copies remain with Intel or its
228 suppliers. The Materials are protected by intellectual property rights,
229 including without limitation, United States copyright laws and international
230 treaty provisions. You will not remove any copyright or other proprietary
231 notices from the Materials. Except as expressly provided herein, no license
232 or right is granted to You directly or by implication, inducement, estoppel
233 or otherwise; specifically, Intel does not grant any express or implied right
234 to You under Intel patents, copyrights, trademarks, or trade secrets.
235
2366. NO WARRANTY AND NO SUPPORT.
237
2386.1 No Warranty. Disclaimer. Intel disclaims all warranties of any kind and the
239 terms and remedies provided in this Agreement are instead of any other
240 warranty or condition, express, implied or statutory, including those
241 regarding merchantability, fitness for any particular purpose,
242 non-infringement or any warranty arising out of any course of dealing, usage
243 of trade, proposal, specification or sample. Intel does not assume (and does
244 not authorize any person to assume on its behalf) any liability.
245
2466.2 No Support; Priority Support. Intel may make changes to the Materials, or to
247 items referenced therein, at any time without notice, but is not obligated
248 to support, update or provide training for the Materials under the terms of
249 this Agreement. Intel offers free community and paid priority support
250 options. More information on these support options can be found at:
251 https://software.intel.com/content/www/us/en/develop/support/priority-support.html.
252
2537. LIMITATION OF LIABILITY.
254
2557.1 Intel will not be liable for any of the following losses or damages (whether
256 such losses or damages were foreseen, foreseeable, known or otherwise): (i)
257 loss of revenue; (ii) loss of actual or anticipated profits; (iii) loss of
258 the use of money; (iv) loss of anticipated savings; (v) loss of business;
259 (vi) loss of opportunity; (vii) loss of goodwill; (viii) loss of use of the
260 Materials; (ix) loss of reputation; (x) loss of, damage to, or corruption of
261 data; or (xi) any indirect, incidental, special or consequential loss of
262 damage however caused (including loss or damage of the type specified in
263 this Section 7).
264
2657.2 Intel's total cumulative liability to You, including for direct damages for
266 claims relating to this Agreement, and whether for breach of contract,
267 negligence, or for any other reason, will not exceed $100.
268
2697.3 You acknowledge that the limitations of liability provided in this Section 7
270 are an essential part of this Agreement. You agree that the limitations of
271 liability provided in this Agreement with respect to Intel will be conveyed
272 to and made binding upon any customer of Yours that acquires the
273 Redistributables.
274
2758. USER SUBMISSIONS. Should you provide Intel with comments, modifications,
276 corrections, enhancements or other input ("Feedback") related to the
277 Materials, Intel will be free to use, disclose, reproduce, license or
278 otherwise distribute or exploit the Feedback in its sole discretion without
279 any obligations or restrictions of any kind, including without limitation,
280 intellectual property rights or licensing obligations. If You wish to provide
281 Intel with information that You intend to be treated as confidential
282 information, Intel requires that such confidential information be provided
283 pursuant to a non-disclosure agreement ("NDA"); please contact Your Intel
284 representative to ensure the proper NDA is in place.
285
2869. NON-DISCLOSURE. Information provided by Intel to You may include information
287 marked as confidential. You must treat such information as confidential under
288 the terms of the applicable NDA between Intel and You. If You have not
289 entered into an NDA with Intel, You must not disclose, distribute or make use
290 of any information marked as confidential, except as expressly authorized in
291 writing by Intel. Intel retains all rights in and to its confidential
292 information specifications, designs, engineering details, discoveries,
293 inventions, patents, copyrights, trademarks, trade secrets, and other
294 proprietary rights relating to the Materials. Any breach by You of the
295 confidentiality obligations provided for in this Section 9 will cause
296 irreparable injury to Intel for which money damages may be inadequate to
297 compensate Intel for losses arising from such a breach. Intel may obtain
298 equitable relief, including injunctive relief, if You breach or threaten to
299 breach Your confidentiality obligations.
300
30110. TERM AND TERMINATION. This Agreement becomes effective on the date You
302 accept this Agreement and will continue until terminated as provided for in
303 this Agreement. The term for any Pre-Release Materials terminates upon
304 release of a commercial version. This Agreement will terminate if You are in
305 breach of any of its terms and conditions. Upon termination, You will
306 promptly destroy the Materials and all copies. In the event of termination of
307 this Agreement, Your license to any Redistributables distributed by You in
308 accordance with the terms and conditions of this Agreement, prior to the
309 effective date of such termination, will survive any such termination of this
310 Agreement. Sections 1, 2.1.D(4)(v), 2.2, 2.3.A(iii), 2.3.B(iii), 3.3, 5, 6,
311 7, 8, 9, 10 (with respect to these survival provisions in the last sentence),
312 and 12 will survive expiration or termination of this Agreement.
313
31411. U.S. GOVERNMENT RESTRICTED RIGHTS. The technical data and computer software
315 covered by this license is a "Commercial Item," as such term is defined by
316 the FAR 2.101 (48 C.F.R. 2.101) and is "commercial computer software" and
317 "commercial computer software documentation" as specified under FAR 12.212
318 (48 C.F.R. 12.212) or DFARS 227.7202 (48 C.F.R. 227.7202), as applicable.
319 This commercial computer software and related documentation is provided to
320 end users for use by and on behalf of the U.S. Government with only those
321 rights as are granted to all other end users pursuant to the terms and
322 conditions of this Agreement.
323
32412. GENERAL PROVISIONS.
325
32612.1 ENTIRE AGREEMENT. This Agreement contains the complete and exclusive
327 agreement and understanding between the parties concerning the subject
328 matter of this Agreement, and supersedes all prior and contemporaneous
329 proposals, agreements, understanding, negotiations, representations,
330 warranties, conditions, and communications, oral or written, between the
331 parties relating to the same subject matter. Each party acknowledges and
332 agrees that in entering into this Agreement it has not relied on, and will
333 not be entitled to rely on, any oral or written representations,
334 warranties, conditions, understanding, or communications between the
335 parties that are not expressly set forth in this Agreement. The express
336 provisions of this Agreement control over any course of performance, course
337 of dealing, or usage of the trade inconsistent with any of the provisions
338 of this Agreement. The provisions of this Agreement will prevail
339 notwithstanding any different, conflicting, or additional provisions that
340 may appear on any purchase order, acknowledgement, invoice, or other
341 writing issued by either party in connection with this Agreement. No
342 modification or amendment to this Agreement will be effective unless in
343 writing and signed by authorized representatives of each party, and must
344 specifically identify this Agreement by its title and version (e.g., "Intel
345 End User License Agreement for Developer Tools (Version October 2021)");
346 except that Intel may make changes to this Agreement as it distributes new
347 versions of the Materials. When changes are made, Intel will make a new
348 version of the Agreement available on its website. If You received a copy
349 of this Agreement translated into another language, the English language
350 version of this Agreement will prevail in the event of any conflict between
351 versions.
352
35312.2 EXPORT. You acknowledge that the Materials and all related technical
354 information are subject to export controls and you agree to comply with all
355 laws and regulations of the United States and other applicable governments
356 governing export, re-export, import, transfer, distribution, and use of the
357 Materials. In particular, but without limitation, the Materials may not be
358 exported or re-exported (i) into any U.S. embargoed countries or (ii) to
359 any person or entity listed on a denial order published by the U.S.
360 government or any other applicable governments. By using the Materials, You
361 represent and warrant that You are not located in any such country or on
362 any such list. You also agree that You will not use the Materials for, or
363 sell or transfer them to a third party who is known or suspected to be
364 involved in, any purposes prohibited by the U.S. government or other
365 applicable governments, including, without limitation, the development,
366 design, manufacture, or production of nuclear, missile, chemical or
367 biological weapons.
368
36912.3 GOVERNING LAW, JURISDICTION, AND VENUE. All disputes arising out of or
370 related to this Agreement, whether based on contract, tort, or any other
371 legal or equitable theory, will in all respects be governed by, and
372 construed and interpreted under, the laws of the United States of America
373 and the State of Delaware, without reference to conflict of laws
374 principles. The parties agree that the United Nations Convention on
375 Contracts for the International Sale of Goods (1980) is specifically
376 excluded from and will not apply to this Agreement. All disputes arising
377 out of or related to this Agreement, whether based on contract, tort, or
378 any other legal or equitable theory, will be subject to the exclusive
379 jurisdiction of the courts of the State of Delaware or of the Federal
380 courts sitting in that State. Each party submits to the personal
381 jurisdiction of those courts and waives all objections to that jurisdiction
382 and venue for those disputes.
383
38412.4 SEVERABILITY. The parties intend that if a court holds that any provision
385 or part of this Agreement is invalid or unenforceable under applicable law,
386 the court will modify the provision to the minimum extent necessary to make
387 it valid and enforceable, or if it cannot be made valid and enforceable,
388 the parties intend that the court will sever and delete the provision or
389 part from this Agreement. Any change to or deletion of a provision or part
390 of this Agreement under this Section will not affect the validity or
391 enforceability of the remainder of this Agreement, which will continue in
392 full force and effect.
diff --git a/custom-licenses/ISSL b/custom-licenses/ISSL
index 5435ee04..f987e502 100644
--- a/custom-licenses/ISSL
+++ b/custom-licenses/ISSL
@@ -1,63 +1,73 @@
1Intel Simplified Software License (Version April 2018) 1Intel Simplified Software License (Version August 2021)
2 2
3Copyright (c) 2018 Intel Corporation. 3Use and Redistribution. You may use and redistribute the software (the
4"Software"), without modification, provided the following conditions are met:
4 5
5Use and Redistribution. You may use and redistribute the software (the "Software"), without modification, 6* Redistributions must reproduce the above copyright notice and the following
6provided the following conditions are met: 7 terms of use in the Software and in the documentation and/or other materials
8 provided with the distribution.
9* Neither the name of Intel nor the names of its suppliers may be used to
10 endorse or promote products derived from this Software without specific
11 prior written permission.
12* No reverse engineering, decompilation, or disassembly of this Software is
13 permitted.
7 14
8* Redistributions must reproduce the above copyright notice and the following terms of use in the Software 15No other licenses. Except as provided in the preceding section, Intel grants no
9and in the documentation and/or other materials provided with the distribution. 16licenses or other rights by implication, estoppel or otherwise to, patent,
17copyright, trademark, trade name, service mark or other intellectual property
18licenses or rights of Intel.
10 19
11* Neither the name of Intel nor the names of its suppliers may be used to endorse or promote products derived 20Third party software. The Software may contain Third Party Software. "Third
12from this Software without specific prior written permission. 21Party Software" is open source software, third party software, or other Intel
22software that may be identified in the Software itself or in the files (if any)
23listed in the "third-party-software.txt" or similarly named text file included
24with the Software. Third Party Software, even if included with the distribution
25of the Software, may be governed by separate license terms, including without
26limitation, open source software license terms, third party software license
27terms, and other Intel software license terms. Those separate license terms
28solely govern your use of the Third Party Software, and nothing in this license
29limits any rights under, or grants rights that supersede, the terms of the
30applicable license terms.
13 31
14* No reverse engineering, decompilation, or disassembly of this Software is permitted. 32DISCLAIMER. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
33WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
34MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT ARE
35DISCLAIMED. THIS SOFTWARE IS NOT INTENDED FOR USE IN SYSTEMS OR APPLICATIONS
36WHERE FAILURE OF THE SOFTWARE MAY CAUSE PERSONAL INJURY OR DEATH AND YOU AGREE
37THAT YOU ARE FULLY RESPONSIBLE FOR ANY CLAIMS, COSTS, DAMAGES, EXPENSES, AND
38ATTORNEYS' FEES ARISING OUT OF ANY SUCH USE, EVEN IF ANY CLAIM ALLEGES THAT
39INTEL WAS NEGLIGENT REGARDING THE DESIGN OR MANUFACTURE OF THE SOFTWARE.
15 40
16Limited patent license. Intel grants you a world-wide, royalty-free, non-exclusive license under patents 41LIMITATION OF LIABILITY. IN NO EVENT WILL INTEL BE LIABLE FOR ANY DIRECT,
17it now or hereafter owns or controls to make, have made, use, import, offer to sell and sell ("Utilize") 42INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
18this Software, but solely to the extent that any such patent is necessary to Utilize the Software alone. 43BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19The patent license shall not apply to any combinations which include this software. No hardware per se 44DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
20is licensed hereunder. 45LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
46OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
47ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 48
22Third party and other Intel programs. "Third Party Programs" are the files listed in the 49No support. Intel may make changes to the Software, at any time without notice,
23"third-party-programs.txt" text file that is included with the Software and may include Intel programs 50and is not obligated to support, update or provide training for the Software.
24under separate license terms. Third Party Programs, even if included with the distribution of the Materials,
25are governed by separate license terms and those license terms solely govern your use of those programs.
26 51
27DISCLAIMER. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 52Termination. Your right to use the Software is terminated in the event of your
28BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, 53breach of this license.
29AND NON-INFRINGEMENT ARE DISCLAIMED. THIS SOFTWARE IS NOT INTENDED FOR USE IN SYSTEMS OR APPLICATIONS
30WHERE FAILURE OF THE SOFTWARE MAY CAUSE PERSONAL INJURY OR DEATH AND YOU AGREE THAT YOU ARE FULLY RESPONSIBLE
31FOR ANY CLAIMS, COSTS, DAMAGES, EXPENSES, AND ATTORNEYS’ FEES ARISING OUT OF ANY SUCH USE, EVEN IF ANY CLAIM
32ALLEGES THAT INTEL WAS NEGLIGENT REGARDING THE DESIGN OR MANUFACTURE OF THE MATERIALS.
33 54
34LIMITATION OF LIABILITY. IN NO EVENT WILL INTEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 55Feedback. Should you provide Intel with comments, modifications, corrections,
35EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 56enhancements or other input ("Feedback") related to the Software, Intel will be
36SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 57free to use, disclose, reproduce, license or otherwise distribute or exploit the
37LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 58Feedback in its sole discretion without any obligations or restrictions of any
38ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. YOU AGREE TO 59kind, including without limitation, intellectual property rights or licensing
39INDEMNIFY AND HOLD INTEL HARMLESS AGAINST ANY CLAIMS AND EXPENSES RESULTING FROM YOUR USE OR UNAUTHORIZED 60obligations.
40USE OF THE SOFTWARE.
41 61
42No support. Intel may make changes to the Software, at any time without notice, and is not obligated to 62Compliance with laws. You agree to comply with all relevant laws and regulations
43support, update or provide training for the Software. 63governing your use, transfer, import or export (or prohibition thereof) of the
64Software.
44 65
45Termination. Intel may terminate your right to use the Software in the event of your breach of this Agreement 66Governing law. All disputes will be governed by the laws of the United States of
46and you fail to cure the breach within a reasonable period of time. 67America and the State of Delaware without reference to conflict of law
47 68principles and subject to the exclusive jurisdiction of the state or federal
48Feedback. Should you provide Intel with comments, modifications, corrections, enhancements or other input 69courts sitting in the State of Delaware, and each party agrees that it submits
49("Feedback") related to the Software Intel will be free to use, disclose, reproduce, license or otherwise 70to the personal jurisdiction and venue of those courts and waives any
50distribute or exploit the Feedback in its sole discretion without any obligations or restrictions of any 71objections. The United Nations Convention on Contracts for the International
51kind, including without limitation, intellectual property rights or licensing obligations. 72Sale of Goods (1980) is specifically excluded and will not apply to the
52 73Software.
53Compliance with laws. You agree to comply with all relevant laws and regulations governing your use,
54transfer, import or export (or prohibition thereof) of the Software.
55
56Governing law. All disputes will be governed by the laws of the United States of America and the State
57of Delaware without reference to conflict of law principles and subject to the exclusive jurisdiction of
58the state or federal courts sitting in the State of Delaware, and each party agrees that it submits to
59the personal jurisdiction and venue of those courts and waives any objections. The United Nations
60Convention on Contracts for the International Sale of Goods (1980) is specifically excluded and will
61not apply to the Software.
62
63*Other names and brands may be claimed as the property of others. \ No newline at end of file
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 @@
1Copyright (c) 2009, Stanford University, and authors listed below.
2All rights reserved.
3
4Original authors:
5 Solomon Boulos
6
7Redistribution and use in source and binary forms, with or without
8modification, are permitted provided that the following conditions are
9met:
10
11Redistributions of source code must retain the above copyright notice,
12this list of conditions and the following disclaimer.
13
14Redistributions in binary form must reproduce the above copyright
15notice, this list of conditions and the following disclaimer in the
16documentation and/or other materials provided with the distribution.
17
18Neither the name of Stanford University nor the names of its
19contributors may be used to endorse or promote products derived from
20this software without specific prior written permission.
21
22THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file
diff --git a/MAINTAINERS b/documentation/MAINTAINERS.md
index 73a9fe3a..ea435849 100644
--- a/MAINTAINERS
+++ b/documentation/MAINTAINERS.md
@@ -1,15 +1,13 @@
1This file contains a list of BSP maintainers for the BSPs contained in
2the meta-intel repository.
3
4The purpose of this file is to provide contact information for 1The purpose of this file is to provide contact information for
5specific BSPs and other code contained within meta-intel. You should 2specific BSPs and other code contained within meta-intel. You should
6address questions and patches for a particular BSP or other code to 3address questions and patches for a particular BSP or other code to
7the appropriate maintainer listed in this file, cc'ing the meta-intel 4the appropriate maintainer listed in this file, cc'ing the meta-intel
8mailing list. This ensures that your question or patch will be 5mailing list. This ensures that your question or patch will be
9addressed by the appropriate person, and that it will be seen by other 6addressed by the appropriate person, and that it will be seen by other
10users who may be facing similar problems or questions. 7users who may be facing similar problems or questions.
11 8
12Please see the top-level README file for guidelines relating to the 9Please see the [Guidelines for submitting patches](submitting_patches.md)
10and [Reporting bugs](reporting_bugs.md) guidelines relating to the
13details of submitting patches, reporting problems, or asking questions 11details of submitting patches, reporting problems, or asking questions
14about any of the BSPs or other recipes contained within meta-intel. 12about any of the BSPs or other recipes contained within meta-intel.
15 13
@@ -26,7 +24,5 @@ Please keep this list in alphabetical order.
26 24
27Maintainers List (try to look for most precise areas first) 25Maintainers List (try to look for most precise areas first)
28 26
29 ----------------------------------- 27M: Anuj Mittal <anuj.mittal@intel.com>
30 28F: *
31M: Anuj Mittal <anuj.mittal@intel.com>
32F: *
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 @@
1### Building the Intel BSP layers
2
3The intel-common BSP provide a few carefully selected tune options and
4generic hardware support to cover the majority of current Intel CPUs and
5devices. The naming follows the convention of intel-<TUNE>-<BITS>, where
6TUNE is the gcc cpu-type (used with mtune and march typically) and BITS
7is either 32 bit or 64 bit.
8
9In order to build an image with BSP support for a given release, you
10need to clone the meta-intel layer from git repository:
11```
12git clone https://git.yoctoproject.org/meta-intel
13```
14
15Check out the appropriate branch or release tags. The branch name and tags
16would align with Yocto Project
17[Release Codenames](https://wiki.yoctoproject.org/wiki/Releases).
18Assuming meta-intel repository is cloned at the top-level of
19OE-Core build tree, you can build a BSP image by adding the location of
20the meta-intel layer to bblayers.conf:
21```
22BBLAYERS = " \
23 /openembedded-core/meta \
24 /openembedded-core/meta-intel "
25```
26
27To enable a particular machine, add a MACHINE line naming the BSP
28to the local.conf file:
29```
30MACHINE ?= "intel-corei7-64"
31```
32
33where this can be replaced by other MACHINE types available:
34
35 - intel-core2-32
36
37 This BSP is optimized for the Core2 family of CPUs as well as all
38 Atom CPUs prior to the Silvermont core.
39
40 - intel-corei7-64
41
42 This BSP is optimized for Nehalem and later Core and Xeon CPUs as
43 well as Silvermont and later Atom CPUs, such as the Baytrail SoCs.
44
45 - intel-skylake-64
46
47 This BSP uses [x86-64-v3 tuning](https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html).
48
49You should then be able to build an image as such:
50```
51$ source oe-init-build-env
52$ bitbake core-image-sato
53```
54
55At the end of a successful build, you should have an image that
56you can boot from a USB flash drive.
57
58
59## Booting the intel-common BSP images
60
61If you've built your own image, you'll find the bootable
62image in the build/tmp/deploy/images/{MACHINE} directory, where
63'MACHINE' refers to the machine name used in the build.
64
65Under Linux, insert a USB flash drive. Assuming the USB flash drive
66takes device /dev/sdf, use dd to copy the image to it. Before the image
67can be burned onto a USB drive, it should be un-mounted. Some Linux distros
68may automatically mount a USB drive when it is plugged in. Using USB device
69/dev/sdf as an example, find all mounted partitions:
70```
71$ mount | grep sdf
72```
73
74and un-mount those that are mounted, for example:
75```
76$ umount /dev/sdf1
77$ umount /dev/sdf2
78```
79
80Now burn the image onto the USB drive:
81```
82$ sudo dd if=core-image-sato-intel-corei7-64.wic of=/dev/sdf status=progress
83$ sync
84$ eject /dev/sdf
85```
86
87This should give you a bootable USB flash device. Insert the device
88into a bootable USB socket on the target, and power on. This should
89result in a system booted to the Sato graphical desktop.
90
91If you want a terminal, use the arrows at the top of the UI to move to
92different pages of available applications, one of which is named
93'Terminal'. Clicking that should give you a root terminal.
94
95If you want to ssh into the system, you can use the root terminal to
96ifconfig the IP address and use that to ssh in. The root password is
97empty, so to log in type 'root' for the user name and hit 'Enter' at
98the Password prompt: and you should be in.
99
100If you find you're getting corrupt images on the USB (it doesn't show
101the syslinux boot: prompt, or the boot: prompt contains strange
102characters), try doing this first:
103```
104$ dd if=/dev/zero of=/dev/sdf bs=1M count=512
105```
106
107## Building the installer image
108
109If you plan to install your image to your target machine, you can build a wic
110based installer image instead of default wic image. To build it, you need to
111add below configuration to local.conf :
112
113```
114WKS_FILE = "image-installer.wks.in"
115IMAGE_FSTYPES:append = " ext4"
116IMAGE_TYPEDEP:wic = "ext4"
117INITRD_IMAGE_LIVE="core-image-minimal-initramfs"
118do_image_wic[depends] += "${INITRD_IMAGE_LIVE}:do_image_complete"
119do_rootfs[depends] += "virtual/kernel:do_deploy"
120IMAGE_BOOT_FILES:append = "\
121 ${KERNEL_IMAGETYPE} \
122 microcode.cpio \
123 ${IMGDEPLOYDIR}/${IMAGE_BASENAME}-${MACHINE}.rootfs.ext4;rootfs.img \
124 ${@bb.utils.contains('EFI_PROVIDER', 'grub-efi', 'grub-efi-bootx64.efi;EFI/BOOT/bootx64.efi', '', d)} \
125 ${@bb.utils.contains('EFI_PROVIDER', 'grub-efi', '${IMAGE_ROOTFS}/boot/EFI/BOOT/grub.cfg;EFI/BOOT/grub.cfg', '', d)} \
126 ${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', 'systemd-bootx64.efi;EFI/BOOT/bootx64.efi', '', d)} \
127 ${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', '${IMAGE_ROOTFS}/boot/loader/loader.conf;loader/loader.conf ', '', d)} \
128 ${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', '${IMAGE_ROOTFS}/boot/loader/entries/boot.conf;loader/entries/boot.conf', '', d)} "
129```
130
131Burn the wic image onto USB flash device, insert the device to target machine
132and power on. This should start the installation process.
133
134
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 @@
1Intel(R) oneAPI DPC++/C++ Compiler (ICX) toolchain
2==========================================================================
3
4Get Started with the Intel oneAPI DPC++/C++ Compiler:
5
6https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compiler.html#
7
8
9Getting Started
10===============
11
12Clone the required layers and include them in bblayers.conf:
13
14```
15git clone https://git.openembedded.org/openembedded-core
16git clone https://git.openembedded.org/bitbake
17git clone https://git.openembedded.org/meta-openembedded
18git clone https://github.com/kraj/meta-clang.git
19git clone https://git.yoctoproject.org/meta-intel
20
21$ source openembedded-core/oe-init-build-env
22
23$ bitbake-layers add-layer ../meta-openembedded/meta-oe/
24$ bitbake-layers add-layer ../meta-intel
25$ bitbake-layers add-layer ../meta-clang
26```
27
28Distro
29======
30
31Note that oneAPI DPC++/C++ compiler currently only works when the vendor string is "oe".
32
33```
34DISTRO ?= "nodistro"
35```
36
37MACHINE configuration
38=====================
39
40```
41MACHINE ?= "intel-skylake-64"
42```
43
44Package installation
45====================
46
47```
48# To include OpenCL driver that might be needed when compiling SYCL programs, include:
49IMAGE_INSTALL:append = " intel-compute-runtime intel-graphics-compiler"
50
51# To install only runtime libraries, include:
52IMAGE_INSTALL:append = " intel-oneapi-dpcpp-cpp-runtime intel-oneapi-dpcpp-cpp-runtime-dev"
53
54# To install the toolchain, include:
55IMAGE_INSTALL:append = " intel-oneapi-dpcpp-cpp intel-oneapi-dpcpp-cpp-dev"
56```
57in local.conf.
58
59Build an image
60==============
61
62```
63$ bitbake core-image-minimal
64```
65
66Including oneAPI C++/DPC++ compiler in generated SDK toolchain
67==============================================================
68
69The 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:
70
71```
72ICXSDK = "1"
73```
74
75Generate SDK:
76```
77bitbake core-image-minimal -c populate_sdk
78```
79
80
81To setup PATH variables on target
82=================================
83
84Once image is booted successfully, some variables would need to be exported to make sure compiler can be used:
85
86```
87$ source /opt/intel/oneapi/compiler/2022.1.0/env/vars.sh
88
89$ mkdir -p /lib64
90
91$ ln -sf /lib/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2
92```
93
94Build application and run
95=========================
96
97To compile a sycl application, for example:
98
99```
100$ icpx --target=x86_64-oe-linux -fsycl simple-sycl-app.c -o simple-sycl-app
101```
102
103To run:
104
105```
106$ ./simple-sycl-app
107```
diff --git a/documentation/reporting_bugs.md b/documentation/reporting_bugs.md
new file mode 100644
index 00000000..59621c1e
--- /dev/null
+++ b/documentation/reporting_bugs.md
@@ -0,0 +1,22 @@
1## Reporting bugs
2
3If you have problems with or questions about a particular BSP, please
4contact the maintainer listed in the [Maintainers](MAINTAINERS.md) file directly (cc:ing
5the Yocto mailing list puts it in the archive and helps other people
6who might have the same questions in the future), but please try to do
7the following first:
8
9- look in the [Yocto Project Bugzilla](http://bugzilla.yoctoproject.org/) to see if a
10 problem has already been reported
11
12- look through recent entries of the [meta-intel](https://lists.yoctoproject.org/g/meta-intel/messages)
13 and [Yocto Archives](https://lists.yoctoproject.org/g/yocto/messages) mailing list archives to see
14 if other people have run into similar problems or had similar questions answered.
15
16If you believe you have encountered a bug, you can open a new bug and
17enter the details in the [Yocto Project Bugzilla](https://bugzilla.yoctoproject.org/).
18If you're relatively certain that it's a bug against the BSP itself, please use the
19'BSPs | bsps-meta-intel' category for the bug; otherwise, please submit the bug against
20the most likely category for the problem. if you're wrong, it's not a big deal and
21the bug will be recategorized upon triage.
22
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 @@
1Currently, only one implementation of Secure Boot is available out of the box,
2which is using a single signed EFI application to directly boot the kernel with
3an optional initramfs.
4
5This can be added to your build either through local.conf, or via your own
6custom image recipe.
7
8If you are adding it via local.conf, set the following variables:
9
10IMAGE_FEATURES += "secureboot"
11WKS_FILE = "generic-bootdisk.wks.in"
12SECURE_BOOT_SIGNING_KEY = "/path/to/your/signing/key"
13SECURE_BOOT_SIGNING_CERT = "/path/to/your/signing/cert"
14IMAGE_CLASSES += "uefi-comboapp"
15
16If working with an image recipe, you can inherit uefi-comboapp directly instead
17of using the IMAGE_CLASSES variable.
18
19The signing keys and certs can be created via openssl commands. Here's an
20example:
21openssl req -new -x509 -newkey rsa:2048 -subj "/CN=your-subject/" -keyout \
22your-key.key -out your-key.crt -days 365 -nodes -sha256
23openssl x509 -in your-key.crt -out your-key.cer -outform DER
24
25The .crt file is your SECURE_BOOT_SIGNING_CERT, and the .key file is your
26SECURE_BOOT_SIGNING_KEY.
27
28You should enroll the .crt key in your firmware under the PK, KEK, and DB
29options (methods are different depending on your firmware). If a key should ever
30become invalid, enroll it under DBX to blacklist it.
31
32The comboapp can be further manipulated in a number of ways. You can modify the
33kernel command line via the APPEND variable, you can change the default UUID via
34the DISK_SIGNATURE_UUID variable, and you can modify the contents of the
35initramfs via the INITRD_IMAGE or INITRD_LIVE variables.
36
37A simple Secure Boot enabled image used for testing can be viewed at:
38common/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..41a039bd
--- /dev/null
+++ b/documentation/submitting_patches.md
@@ -0,0 +1,26 @@
1## Guidelines for submitting patches
2
3Please submit any patches against meta-intel BSPs to the
4[meta-intel mailing list](https://lists.yoctoproject.org/g/meta-intel)
5(email: meta-intel@lists.yoctoproject.org). Also, if your patches are
6available via a public git repository, please also include a URL to
7the repo and branch containing your patches as that makes it easier
8for maintainers to grab and test your patches.
9
10The patches should follow the suggestions outlined in the
11[Yocto Project and OpenEmbedded Contributor Guide](https://docs.yoctoproject.org/dev/contributor-guide/index.html).
12In addition, for any non-trivial patch, provide information about how you
13tested the patch, and for any non-trivial or non-obvious testing
14setup, provide details of that setup.
15
16Doing a quick 'git log' in meta-intel will provide you with many
17examples of good example commits if you have questions about any
18aspect of the preferred format.
19
20The meta-intel maintainers will do their best to review and/or pull in
21a patch or patch sets within 24 hours of the time it was posted. For
22larger and/or more involved patches and patch sets, the review process
23may take longer.
24
25Please see the [MAINTAINERS](MAINTAINERS.md) for the list of maintainers. It's also
26a 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 @@
1## Tested Hardware
2
3The following undergo regular basic testing with their respective MACHINE types.
4
5- intel-corei7-64:
6 * Alder Lake-P
7 * Alder Lake-S
8 * Alder Lake-PS
9 * Elkhart Lake
10 * Metor Lake-P
11 * Raptor Lake-P
12 * Tiger Lake
13
14- intel-skylake-64:
15 * Alder Lake-P
16 * Alder Lake-S
17 * Alder Lake-PS
18 * Elkhart Lake
19 * Metor Lake-P
20 * Raptor Lake-P
21 * Tiger Lake
22
23- intel-core2-32:
24 * MinnowBoard Turbot
diff --git a/dynamic-layers/clang-layer/recipes-core/dnn/onednn_2.1.1.bb b/dynamic-layers/clang-layer/recipes-core/dnn/onednn_3.4.bb
index 5b96ea0e..afea70df 100644
--- a/dynamic-layers/clang-layer/recipes-core/dnn/onednn_2.1.1.bb
+++ b/dynamic-layers/clang-layer/recipes-core/dnn/onednn_3.4.bb
@@ -3,19 +3,20 @@ SUMMARY = "Deep Neural Network Library"
3DESCRIPTION = "This software is a user mode library that accelerates\ 3DESCRIPTION = "This software is a user mode library that accelerates\
4deep-learning applications and frameworks on Intel architecture." 4deep-learning applications and frameworks on Intel architecture."
5LICENSE = "Apache-2.0 & BSD-3-Clause & BSL-1.0" 5LICENSE = "Apache-2.0 & BSD-3-Clause & BSL-1.0"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=8e17c0f9656ebaf0c380d9b22707c846 \ 6LIC_FILES_CHKSUM = "file://LICENSE;md5=3b64000f6e7d52516017622a37a94ce9 \
7 file://tests/gtests/gtest/LICENSE;md5=cbbd27594afd089daa160d3a16dd515a \ 7 file://tests/gtests/gtest/LICENSE;md5=cbbd27594afd089daa160d3a16dd515a \
8 file://src/cpu/x64/xbyak/COPYRIGHT;md5=3b9bf048d063d54cdb28964db558bcc7 \ 8 file://src/cpu/x64/xbyak/COPYRIGHT;md5=3b9bf048d063d54cdb28964db558bcc7 \
9 file://src/cpu/x64/jit_utils/jitprofiling/LICENSE.BSD;md5=e671ff178b24a95a382ba670503c66fb \ 9 file://src/common/ittnotify/LICENSE.BSD;md5=e671ff178b24a95a382ba670503c66fb \
10 file://doc/assets/mathjax/MathJax.js;endline=17;md5=25a014ad78c3d72a0e15d15f1d007c20 \
11 " 10 "
12SECTION = "lib" 11SECTION = "lib"
13 12
14inherit pkgconfig cmake ptest 13inherit pkgconfig cmake ptest
15 14
15DNN_BRANCH = "rls-v${@'.'.join(d.getVar('PV').split('.')[0:2])}"
16
16S = "${WORKDIR}/git" 17S = "${WORKDIR}/git"
17SRCREV = "53f53c2bb859d386a40e03f7623a4f9af758c1b3" 18SRCREV = "ecd7fb6d5a0df6503d1691c1754a684b9c769c16"
18SRC_URI = "git://github.com/oneapi-src/oneDNN.git;branch=rls-v2.1 \ 19SRC_URI = "git://github.com/oneapi-src/oneDNN.git;branch=${DNN_BRANCH};protocol=https \
19 file://run-ptest \ 20 file://run-ptest \
20 " 21 "
21 22
@@ -24,7 +25,7 @@ UPSTREAM_CHECK_GITTAGREGEX = "^v(?P<pver>(\d+(\.\d+)+))$"
24CVE_PRODUCT = "intel:math_kernel_library" 25CVE_PRODUCT = "intel:math_kernel_library"
25 26
26COMPATIBLE_HOST = '(x86_64).*-linux' 27COMPATIBLE_HOST = '(x86_64).*-linux'
27COMPATIBLE_HOST_libc-musl = 'null' 28COMPATIBLE_HOST:libc-musl = 'null'
28 29
29EXTRA_OECMAKE += " \ 30EXTRA_OECMAKE += " \
30 -DDNNL_LIBRARY_TYPE=SHARED \ 31 -DDNNL_LIBRARY_TYPE=SHARED \
@@ -33,12 +34,13 @@ EXTRA_OECMAKE += " \
33 -DDNNL_CPU_RUNTIME=OMP \ 34 -DDNNL_CPU_RUNTIME=OMP \
34 -DDNNL_ARCH_OPT_FLAGS="" \ 35 -DDNNL_ARCH_OPT_FLAGS="" \
35 -DCMAKE_SKIP_RPATH=ON \ 36 -DCMAKE_SKIP_RPATH=ON \
37 -DONEDNN_BUILD_GRAPH=OFF \
36 " 38 "
37 39
38PACKAGECONFIG ??= "" 40PACKAGECONFIG ??= "gpu"
39PACKAGECONFIG[gpu] = "-DDNNL_GPU_RUNTIME=OCL, , opencl-headers ocl-icd, intel-compute-runtime" 41PACKAGECONFIG[gpu] = "-DDNNL_GPU_RUNTIME=OCL, , opencl-headers virtual/opencl-icd, intel-compute-runtime"
40 42
41do_install_append () { 43do_install:append () {
42 install -d ${D}${bindir}/mkl-dnn/tests/benchdnn/inputs 44 install -d ${D}${bindir}/mkl-dnn/tests/benchdnn/inputs
43 install -m 0755 ${B}/tests/benchdnn/benchdnn ${D}${bindir}/mkl-dnn/tests/benchdnn 45 install -m 0755 ${B}/tests/benchdnn/benchdnn ${D}${bindir}/mkl-dnn/tests/benchdnn
44 cp -r ${B}/tests/benchdnn/inputs/* ${D}${bindir}/mkl-dnn/tests/benchdnn/inputs 46 cp -r ${B}/tests/benchdnn/inputs/* ${D}${bindir}/mkl-dnn/tests/benchdnn/inputs
@@ -52,4 +54,4 @@ do_install_ptest () {
52 54
53PACKAGES =+ "${PN}-test" 55PACKAGES =+ "${PN}-test"
54 56
55FILES_${PN}-test = "${bindir}/mkl-dnn/*" 57FILES:${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 @@
1From 200c200eb19602ffd7c8f29d0b2df9df1fd311bf Mon Sep 17 00:00:00 2001
2From: Naveen Saini <naveen.kumar.saini@intel.com>
3Date: Wed, 7 Apr 2021 17:44:20 +0800
4Subject: [PATCH] Fix debug info of work-item builtin translation (#745)
5
6debug info of work-item builtins are lost in both llvm IR -> spirv and
7spirv -> llvm IR translations. See #744
8
9Upstream-Status: Backport [https://github.com/KhronosGroup/SPIRV-LLVM-Translator/commit/c734c5c8bbd3012a09c610e4be68e90cc603c580]
10Signed-off-by: Wenju He <wenju.he@intel.com>
11Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
12---
13 lib/SPIRV/OCL20ToSPIRV.cpp | 5 ++-
14 lib/SPIRV/SPIRVReader.cpp | 1 +
15 test/DebugInfo/builtin-get-global-id.ll | 60 +++++++++++++++++++++++++
16 3 files changed, 65 insertions(+), 1 deletion(-)
17 create mode 100644 test/DebugInfo/builtin-get-global-id.ll
18
19diff --git a/lib/SPIRV/OCL20ToSPIRV.cpp b/lib/SPIRV/OCL20ToSPIRV.cpp
20index 1262c48c..a742c8cf 100644
21--- a/lib/SPIRV/OCL20ToSPIRV.cpp
22+++ b/lib/SPIRV/OCL20ToSPIRV.cpp
23@@ -1297,11 +1297,14 @@ void OCL20ToSPIRV::transWorkItemBuiltinsToVariables() {
24 for (auto UI = I.user_begin(), UE = I.user_end(); UI != UE; ++UI) {
25 auto CI = dyn_cast<CallInst>(*UI);
26 assert(CI && "invalid instruction");
27- Value *NewValue = new LoadInst(BV, "", CI);
28+ const DebugLoc &DLoc = CI->getDebugLoc();
29+ Instruction *NewValue = new LoadInst(BV, "", CI);
30+ NewValue->setDebugLoc(DLoc);
31 LLVM_DEBUG(dbgs() << "Transform: " << *CI << " => " << *NewValue << '\n');
32 if (IsVec) {
33 NewValue =
34 ExtractElementInst::Create(NewValue, CI->getArgOperand(0), "", CI);
35+ NewValue->setDebugLoc(DLoc);
36 LLVM_DEBUG(dbgs() << *NewValue << '\n');
37 }
38 NewValue->takeName(CI);
39diff --git a/lib/SPIRV/SPIRVReader.cpp b/lib/SPIRV/SPIRVReader.cpp
40index 16a3dd38..528f6663 100644
41--- a/lib/SPIRV/SPIRVReader.cpp
42+++ b/lib/SPIRV/SPIRVReader.cpp
43@@ -307,6 +307,7 @@ bool SPIRVToLLVM::transOCLBuiltinFromVariable(GlobalVariable *GV,
44 auto Replace = [&](std::vector<Value *> Arg, Instruction *I) {
45 auto Call = CallInst::Create(Func, Arg, "", I);
46 Call->takeName(I);
47+ Call->setDebugLoc(I->getDebugLoc());
48 setAttrByCalledFunc(Call);
49 SPIRVDBG(dbgs() << "[transOCLBuiltinFromVariable] " << *I << " -> " << *Call
50 << '\n';)
51diff --git a/test/DebugInfo/builtin-get-global-id.ll b/test/DebugInfo/builtin-get-global-id.ll
52new file mode 100644
53index 00000000..a4a00e63
54--- /dev/null
55+++ b/test/DebugInfo/builtin-get-global-id.ll
56@@ -0,0 +1,60 @@
57+; Check debug info of builtin get_global_id is preserved from LLVM IR to spirv
58+; and spirv to LLVM IR translation.
59+
60+; Original .cl source:
61+; kernel void test() {
62+; size_t gid = get_global_id(0);
63+; }
64+
65+; Command line:
66+; ./clang -cc1 1.cl -triple spir64 -cl-std=cl2.0 -emit-llvm -finclude-default-header -debug-info-kind=line-tables-only -O0
67+
68+; RUN: llvm-as %s -o %t.bc
69+; RUN: llvm-spirv %t.bc -spirv-text -o - | FileCheck %s --check-prefix CHECK-SPIRV
70+; RUN: llvm-spirv %t.bc -o %t.spv
71+; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o - | FileCheck %s
72+
73+target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
74+target triple = "spir64"
75+
76+; CHECK-SPIRV: ExtInst {{.*}} DebugScope
77+; CHECK-SPIRV-NEXT: Line {{[0-9]+}} 2 16
78+; CHECK-SPIRV-NEXT: Load {{[0-9]+}} [[LoadRes:[0-9]+]]
79+; CHECK-SPIRV-NEXT: CompositeExtract {{[0-9]+}} {{[0-9]+}} [[LoadRes]] 0
80+
81+; Function Attrs: convergent noinline norecurse nounwind optnone
82+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 {
83+entry:
84+ %gid = alloca i64, align 8
85+ %call = call spir_func i64 @_Z13get_global_idj(i32 0) #2, !dbg !10
86+; CHECK: %call = call spir_func i64 @_Z13get_global_idj(i32 0) #1, !dbg [[DBG:![0-9]+]]
87+ store i64 %call, i64* %gid, align 8, !dbg !11
88+ ret void, !dbg !12
89+}
90+
91+; Function Attrs: convergent nounwind readnone
92+declare spir_func i64 @_Z13get_global_idj(i32) #1
93+
94+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" }
95+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" }
96+attributes #2 = { convergent nounwind readnone }
97+
98+!llvm.dbg.cu = !{!0}
99+!llvm.module.flags = !{!3, !4}
100+!opencl.ocl.version = !{!5}
101+!opencl.spir.version = !{!5}
102+!llvm.ident = !{!6}
103+
104+!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)
105+!1 = !DIFile(filename: "<stdin>", directory: "")
106+!2 = !{}
107+!3 = !{i32 2, !"Debug Info Version", i32 3}
108+!4 = !{i32 1, !"wchar_size", i32 4}
109+!5 = !{i32 2, i32 0}
110+!6 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project.git b5bc56da8aa23dc57db9d286b0591dbcf9b1bdd3)"}
111+!7 = distinct !DISubprogram(name: "test", scope: !8, file: !8, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
112+!8 = !DIFile(filename: "1.cl", directory: "")
113+!9 = !DISubroutineType(types: !2)
114+!10 = !DILocation(line: 2, column: 16, scope: !7)
115+!11 = !DILocation(line: 2, column: 10, scope: !7)
116+!12 = !DILocation(line: 3, column: 1, scope: !7)
117--
1182.17.1
119
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 @@
1From c86c43b70e029b102543e8a85d269cbeb5c00279 Mon Sep 17 00:00:00 2001
2From: juanrod2 <>
3Date: Tue, 22 Dec 2020 08:33:08 +0800
4Subject: [PATCH] Memory leak fix for Managed Static Mutex
5
6Upstream-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]
7
8Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
9
10Cleaning a mutex inside ManagedStatic llvm class.
11---
12 llvm/lib/Support/ManagedStatic.cpp | 6 +++++-
13 1 file changed, 5 insertions(+), 1 deletion(-)
14
15diff --git a/llvm/lib/Support/ManagedStatic.cpp b/llvm/lib/Support/ManagedStatic.cpp
16index 053493f72fb5..6571580ccecf 100644
17--- a/llvm/lib/Support/ManagedStatic.cpp
18+++ b/llvm/lib/Support/ManagedStatic.cpp
19@@ -76,8 +76,12 @@ void ManagedStaticBase::destroy() const {
20
21 /// llvm_shutdown - Deallocate and destroy all ManagedStatic variables.
22 void llvm::llvm_shutdown() {
23- std::lock_guard<std::recursive_mutex> Lock(*getManagedStaticMutex());
24+ getManagedStaticMutex()->lock();
25
26 while (StaticList)
27 StaticList->destroy();
28+
29+ getManagedStaticMutex()->unlock();
30+ delete ManagedStaticMutex;
31+ ManagedStaticMutex = nullptr;
32 }
33--
342.29.2
35
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 @@
1From 27d47f1a17c8921b07acc8cdc26e38cc609de4a9 Mon Sep 17 00:00:00 2001
2From: Naveen Saini <naveen.kumar.saini@intel.com>
3Date: Wed, 7 Apr 2021 16:38:38 +0800
4Subject: [PATCH 2/2] Add cl_khr_extended_subgroup extensions.
5
6Added extensions and their function declarations into
7the standard header.
8
9Patch by Piotr Fusik!
10
11Tags: #clang
12
13Upstream-Status: Backport [https://github.com/llvm/llvm-project/commit/4a4402f0d72167477a6252e4c3daf5089ebc8f9a]
14Signed-off-by: Anastasia Stulova <anastasia.stulova@arm.com>
15Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
16---
17 .../include/clang/Basic/OpenCLExtensions.def | 7 +
18 clang/lib/Headers/opencl-c.h | 668 ++++++++++++++++++
19 clang/test/SemaOpenCL/extension-version.cl | 83 +++
20 3 files changed, 758 insertions(+)
21
22diff --git a/clang/include/clang/Basic/OpenCLExtensions.def b/clang/include/clang/Basic/OpenCLExtensions.def
23index 608f78a13eef..d1574164f9b2 100644
24--- a/clang/include/clang/Basic/OpenCLExtensions.def
25+++ b/clang/include/clang/Basic/OpenCLExtensions.def
26@@ -74,6 +74,13 @@ OPENCLEXT_INTERNAL(cl_khr_mipmap_image_writes, 200, ~0U)
27 OPENCLEXT_INTERNAL(cl_khr_srgb_image_writes, 200, ~0U)
28 OPENCLEXT_INTERNAL(cl_khr_subgroups, 200, ~0U)
29 OPENCLEXT_INTERNAL(cl_khr_terminate_context, 200, ~0U)
30+OPENCLEXT_INTERNAL(cl_khr_subgroup_extended_types, 200, ~0U)
31+OPENCLEXT_INTERNAL(cl_khr_subgroup_non_uniform_vote, 200, ~0U)
32+OPENCLEXT_INTERNAL(cl_khr_subgroup_ballot, 200, ~0U)
33+OPENCLEXT_INTERNAL(cl_khr_subgroup_non_uniform_arithmetic, 200, ~0U)
34+OPENCLEXT_INTERNAL(cl_khr_subgroup_shuffle, 200, ~0U)
35+OPENCLEXT_INTERNAL(cl_khr_subgroup_shuffle_relative, 200, ~0U)
36+OPENCLEXT_INTERNAL(cl_khr_subgroup_clustered_reduce, 200, ~0U)
37
38 // Clang Extensions.
39 OPENCLEXT_INTERNAL(cl_clang_storage_class_specifiers, 100, ~0U)
40diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
41index 93a946cec5b1..67d900eb1c3d 100644
42--- a/clang/lib/Headers/opencl-c.h
43+++ b/clang/lib/Headers/opencl-c.h
44@@ -17530,6 +17530,674 @@ double __ovld __conv sub_group_scan_inclusive_max(double x);
45
46 #endif //cl_khr_subgroups cl_intel_subgroups
47
48+#if defined(cl_khr_subgroup_extended_types)
49+char __ovld __conv sub_group_broadcast( char value, uint index );
50+char2 __ovld __conv sub_group_broadcast( char2 value, uint index );
51+char3 __ovld __conv sub_group_broadcast( char3 value, uint index );
52+char4 __ovld __conv sub_group_broadcast( char4 value, uint index );
53+char8 __ovld __conv sub_group_broadcast( char8 value, uint index );
54+char16 __ovld __conv sub_group_broadcast( char16 value, uint index );
55+
56+uchar __ovld __conv sub_group_broadcast( uchar value, uint index );
57+uchar2 __ovld __conv sub_group_broadcast( uchar2 value, uint index );
58+uchar3 __ovld __conv sub_group_broadcast( uchar3 value, uint index );
59+uchar4 __ovld __conv sub_group_broadcast( uchar4 value, uint index );
60+uchar8 __ovld __conv sub_group_broadcast( uchar8 value, uint index );
61+uchar16 __ovld __conv sub_group_broadcast( uchar16 value, uint index );
62+
63+short __ovld __conv sub_group_broadcast( short value, uint index );
64+short2 __ovld __conv sub_group_broadcast( short2 value, uint index );
65+short3 __ovld __conv sub_group_broadcast( short3 value, uint index );
66+short4 __ovld __conv sub_group_broadcast( short4 value, uint index );
67+short8 __ovld __conv sub_group_broadcast( short8 value, uint index );
68+short16 __ovld __conv sub_group_broadcast( short16 value, uint index );
69+
70+ushort __ovld __conv sub_group_broadcast( ushort value, uint index );
71+ushort2 __ovld __conv sub_group_broadcast( ushort2 value, uint index );
72+ushort3 __ovld __conv sub_group_broadcast( ushort3 value, uint index );
73+ushort4 __ovld __conv sub_group_broadcast( ushort4 value, uint index );
74+ushort8 __ovld __conv sub_group_broadcast( ushort8 value, uint index );
75+ushort16 __ovld __conv sub_group_broadcast( ushort16 value, uint index );
76+
77+// scalar int broadcast is part of cl_khr_subgroups
78+int2 __ovld __conv sub_group_broadcast( int2 value, uint index );
79+int3 __ovld __conv sub_group_broadcast( int3 value, uint index );
80+int4 __ovld __conv sub_group_broadcast( int4 value, uint index );
81+int8 __ovld __conv sub_group_broadcast( int8 value, uint index );
82+int16 __ovld __conv sub_group_broadcast( int16 value, uint index );
83+
84+// scalar uint broadcast is part of cl_khr_subgroups
85+uint2 __ovld __conv sub_group_broadcast( uint2 value, uint index );
86+uint3 __ovld __conv sub_group_broadcast( uint3 value, uint index );
87+uint4 __ovld __conv sub_group_broadcast( uint4 value, uint index );
88+uint8 __ovld __conv sub_group_broadcast( uint8 value, uint index );
89+uint16 __ovld __conv sub_group_broadcast( uint16 value, uint index );
90+
91+// scalar long broadcast is part of cl_khr_subgroups
92+long2 __ovld __conv sub_group_broadcast( long2 value, uint index );
93+long3 __ovld __conv sub_group_broadcast( long3 value, uint index );
94+long4 __ovld __conv sub_group_broadcast( long4 value, uint index );
95+long8 __ovld __conv sub_group_broadcast( long8 value, uint index );
96+long16 __ovld __conv sub_group_broadcast( long16 value, uint index );
97+
98+// scalar ulong broadcast is part of cl_khr_subgroups
99+ulong2 __ovld __conv sub_group_broadcast( ulong2 value, uint index );
100+ulong3 __ovld __conv sub_group_broadcast( ulong3 value, uint index );
101+ulong4 __ovld __conv sub_group_broadcast( ulong4 value, uint index );
102+ulong8 __ovld __conv sub_group_broadcast( ulong8 value, uint index );
103+ulong16 __ovld __conv sub_group_broadcast( ulong16 value, uint index );
104+
105+// scalar float broadcast is part of cl_khr_subgroups
106+float2 __ovld __conv sub_group_broadcast( float2 value, uint index );
107+float3 __ovld __conv sub_group_broadcast( float3 value, uint index );
108+float4 __ovld __conv sub_group_broadcast( float4 value, uint index );
109+float8 __ovld __conv sub_group_broadcast( float8 value, uint index );
110+float16 __ovld __conv sub_group_broadcast( float16 value, uint index );
111+
112+char __ovld __conv sub_group_reduce_add( char value );
113+uchar __ovld __conv sub_group_reduce_add( uchar value );
114+short __ovld __conv sub_group_reduce_add( short value );
115+ushort __ovld __conv sub_group_reduce_add( ushort value );
116+
117+char __ovld __conv sub_group_reduce_min( char value );
118+uchar __ovld __conv sub_group_reduce_min( uchar value );
119+short __ovld __conv sub_group_reduce_min( short value );
120+ushort __ovld __conv sub_group_reduce_min( ushort value );
121+
122+char __ovld __conv sub_group_reduce_max( char value );
123+uchar __ovld __conv sub_group_reduce_max( uchar value );
124+short __ovld __conv sub_group_reduce_max( short value );
125+ushort __ovld __conv sub_group_reduce_max( ushort value );
126+
127+char __ovld __conv sub_group_scan_inclusive_add( char value );
128+uchar __ovld __conv sub_group_scan_inclusive_add( uchar value );
129+short __ovld __conv sub_group_scan_inclusive_add( short value );
130+ushort __ovld __conv sub_group_scan_inclusive_add( ushort value );
131+
132+char __ovld __conv sub_group_scan_inclusive_min( char value );
133+uchar __ovld __conv sub_group_scan_inclusive_min( uchar value );
134+short __ovld __conv sub_group_scan_inclusive_min( short value );
135+ushort __ovld __conv sub_group_scan_inclusive_min( ushort value );
136+
137+char __ovld __conv sub_group_scan_inclusive_max( char value );
138+uchar __ovld __conv sub_group_scan_inclusive_max( uchar value );
139+short __ovld __conv sub_group_scan_inclusive_max( short value );
140+ushort __ovld __conv sub_group_scan_inclusive_max( ushort value );
141+
142+char __ovld __conv sub_group_scan_exclusive_add( char value );
143+uchar __ovld __conv sub_group_scan_exclusive_add( uchar value );
144+short __ovld __conv sub_group_scan_exclusive_add( short value );
145+ushort __ovld __conv sub_group_scan_exclusive_add( ushort value );
146+
147+char __ovld __conv sub_group_scan_exclusive_min( char value );
148+uchar __ovld __conv sub_group_scan_exclusive_min( uchar value );
149+short __ovld __conv sub_group_scan_exclusive_min( short value );
150+ushort __ovld __conv sub_group_scan_exclusive_min( ushort value );
151+
152+char __ovld __conv sub_group_scan_exclusive_max( char value );
153+uchar __ovld __conv sub_group_scan_exclusive_max( uchar value );
154+short __ovld __conv sub_group_scan_exclusive_max( short value );
155+ushort __ovld __conv sub_group_scan_exclusive_max( ushort value );
156+
157+#if defined(cl_khr_fp16)
158+// scalar half broadcast is part of cl_khr_subgroups
159+half2 __ovld __conv sub_group_broadcast( half2 value, uint index );
160+half3 __ovld __conv sub_group_broadcast( half3 value, uint index );
161+half4 __ovld __conv sub_group_broadcast( half4 value, uint index );
162+half8 __ovld __conv sub_group_broadcast( half8 value, uint index );
163+half16 __ovld __conv sub_group_broadcast( half16 value, uint index );
164+#endif // cl_khr_fp16
165+
166+#if defined(cl_khr_fp64)
167+// scalar double broadcast is part of cl_khr_subgroups
168+double2 __ovld __conv sub_group_broadcast( double2 value, uint index );
169+double3 __ovld __conv sub_group_broadcast( double3 value, uint index );
170+double4 __ovld __conv sub_group_broadcast( double4 value, uint index );
171+double8 __ovld __conv sub_group_broadcast( double8 value, uint index );
172+double16 __ovld __conv sub_group_broadcast( double16 value, uint index );
173+#endif // cl_khr_fp64
174+
175+#endif // cl_khr_subgroup_extended_types
176+
177+#if defined(cl_khr_subgroup_non_uniform_vote)
178+int __ovld sub_group_elect(void);
179+int __ovld sub_group_non_uniform_all( int predicate );
180+int __ovld sub_group_non_uniform_any( int predicate );
181+
182+int __ovld sub_group_non_uniform_all_equal( char value );
183+int __ovld sub_group_non_uniform_all_equal( uchar value );
184+int __ovld sub_group_non_uniform_all_equal( short value );
185+int __ovld sub_group_non_uniform_all_equal( ushort value );
186+int __ovld sub_group_non_uniform_all_equal( int value );
187+int __ovld sub_group_non_uniform_all_equal( uint value );
188+int __ovld sub_group_non_uniform_all_equal( long value );
189+int __ovld sub_group_non_uniform_all_equal( ulong value );
190+int __ovld sub_group_non_uniform_all_equal( float value );
191+
192+#if defined(cl_khr_fp16)
193+int __ovld sub_group_non_uniform_all_equal( half value );
194+#endif // cl_khr_fp16
195+
196+#if defined(cl_khr_fp64)
197+int __ovld sub_group_non_uniform_all_equal( double value );
198+#endif // cl_khr_fp64
199+
200+#endif // cl_khr_subgroup_non_uniform_vote
201+
202+#if defined(cl_khr_subgroup_ballot)
203+char __ovld sub_group_non_uniform_broadcast( char value, uint index );
204+char2 __ovld sub_group_non_uniform_broadcast( char2 value, uint index );
205+char3 __ovld sub_group_non_uniform_broadcast( char3 value, uint index );
206+char4 __ovld sub_group_non_uniform_broadcast( char4 value, uint index );
207+char8 __ovld sub_group_non_uniform_broadcast( char8 value, uint index );
208+char16 __ovld sub_group_non_uniform_broadcast( char16 value, uint index );
209+
210+uchar __ovld sub_group_non_uniform_broadcast( uchar value, uint index );
211+uchar2 __ovld sub_group_non_uniform_broadcast( uchar2 value, uint index );
212+uchar3 __ovld sub_group_non_uniform_broadcast( uchar3 value, uint index );
213+uchar4 __ovld sub_group_non_uniform_broadcast( uchar4 value, uint index );
214+uchar8 __ovld sub_group_non_uniform_broadcast( uchar8 value, uint index );
215+uchar16 __ovld sub_group_non_uniform_broadcast( uchar16 value, uint index );
216+
217+short __ovld sub_group_non_uniform_broadcast( short value, uint index );
218+short2 __ovld sub_group_non_uniform_broadcast( short2 value, uint index );
219+short3 __ovld sub_group_non_uniform_broadcast( short3 value, uint index );
220+short4 __ovld sub_group_non_uniform_broadcast( short4 value, uint index );
221+short8 __ovld sub_group_non_uniform_broadcast( short8 value, uint index );
222+short16 __ovld sub_group_non_uniform_broadcast( short16 value, uint index );
223+
224+ushort __ovld sub_group_non_uniform_broadcast( ushort value, uint index );
225+ushort2 __ovld sub_group_non_uniform_broadcast( ushort2 value, uint index );
226+ushort3 __ovld sub_group_non_uniform_broadcast( ushort3 value, uint index );
227+ushort4 __ovld sub_group_non_uniform_broadcast( ushort4 value, uint index );
228+ushort8 __ovld sub_group_non_uniform_broadcast( ushort8 value, uint index );
229+ushort16 __ovld sub_group_non_uniform_broadcast( ushort16 value, uint index );
230+
231+int __ovld sub_group_non_uniform_broadcast( int value, uint index );
232+int2 __ovld sub_group_non_uniform_broadcast( int2 value, uint index );
233+int3 __ovld sub_group_non_uniform_broadcast( int3 value, uint index );
234+int4 __ovld sub_group_non_uniform_broadcast( int4 value, uint index );
235+int8 __ovld sub_group_non_uniform_broadcast( int8 value, uint index );
236+int16 __ovld sub_group_non_uniform_broadcast( int16 value, uint index );
237+
238+uint __ovld sub_group_non_uniform_broadcast( uint value, uint index );
239+uint2 __ovld sub_group_non_uniform_broadcast( uint2 value, uint index );
240+uint3 __ovld sub_group_non_uniform_broadcast( uint3 value, uint index );
241+uint4 __ovld sub_group_non_uniform_broadcast( uint4 value, uint index );
242+uint8 __ovld sub_group_non_uniform_broadcast( uint8 value, uint index );
243+uint16 __ovld sub_group_non_uniform_broadcast( uint16 value, uint index );
244+
245+long __ovld sub_group_non_uniform_broadcast( long value, uint index );
246+long2 __ovld sub_group_non_uniform_broadcast( long2 value, uint index );
247+long3 __ovld sub_group_non_uniform_broadcast( long3 value, uint index );
248+long4 __ovld sub_group_non_uniform_broadcast( long4 value, uint index );
249+long8 __ovld sub_group_non_uniform_broadcast( long8 value, uint index );
250+long16 __ovld sub_group_non_uniform_broadcast( long16 value, uint index );
251+
252+ulong __ovld sub_group_non_uniform_broadcast( ulong value, uint index );
253+ulong2 __ovld sub_group_non_uniform_broadcast( ulong2 value, uint index );
254+ulong3 __ovld sub_group_non_uniform_broadcast( ulong3 value, uint index );
255+ulong4 __ovld sub_group_non_uniform_broadcast( ulong4 value, uint index );
256+ulong8 __ovld sub_group_non_uniform_broadcast( ulong8 value, uint index );
257+ulong16 __ovld sub_group_non_uniform_broadcast( ulong16 value, uint index );
258+
259+float __ovld sub_group_non_uniform_broadcast( float value, uint index );
260+float2 __ovld sub_group_non_uniform_broadcast( float2 value, uint index );
261+float3 __ovld sub_group_non_uniform_broadcast( float3 value, uint index );
262+float4 __ovld sub_group_non_uniform_broadcast( float4 value, uint index );
263+float8 __ovld sub_group_non_uniform_broadcast( float8 value, uint index );
264+float16 __ovld sub_group_non_uniform_broadcast( float16 value, uint index );
265+
266+char __ovld sub_group_broadcast_first( char value );
267+uchar __ovld sub_group_broadcast_first( uchar value );
268+short __ovld sub_group_broadcast_first( short value );
269+ushort __ovld sub_group_broadcast_first( ushort value );
270+int __ovld sub_group_broadcast_first( int value );
271+uint __ovld sub_group_broadcast_first( uint value );
272+long __ovld sub_group_broadcast_first( long value );
273+ulong __ovld sub_group_broadcast_first( ulong value );
274+float __ovld sub_group_broadcast_first( float value );
275+
276+uint4 __ovld sub_group_ballot( int predicate );
277+int __ovld __cnfn sub_group_inverse_ballot( uint4 value );
278+int __ovld __cnfn sub_group_ballot_bit_extract( uint4 value, uint index );
279+uint __ovld __cnfn sub_group_ballot_bit_count( uint4 value );
280+
281+uint __ovld sub_group_ballot_inclusive_scan( uint4 value );
282+uint __ovld sub_group_ballot_exclusive_scan( uint4 value );
283+uint __ovld sub_group_ballot_find_lsb( uint4 value );
284+uint __ovld sub_group_ballot_find_msb( uint4 value );
285+
286+uint4 __ovld __cnfn get_sub_group_eq_mask(void);
287+uint4 __ovld __cnfn get_sub_group_ge_mask(void);
288+uint4 __ovld __cnfn get_sub_group_gt_mask(void);
289+uint4 __ovld __cnfn get_sub_group_le_mask(void);
290+uint4 __ovld __cnfn get_sub_group_lt_mask(void);
291+
292+#if defined(cl_khr_fp16)
293+half __ovld sub_group_non_uniform_broadcast( half value, uint index );
294+half2 __ovld sub_group_non_uniform_broadcast( half2 value, uint index );
295+half3 __ovld sub_group_non_uniform_broadcast( half3 value, uint index );
296+half4 __ovld sub_group_non_uniform_broadcast( half4 value, uint index );
297+half8 __ovld sub_group_non_uniform_broadcast( half8 value, uint index );
298+half16 __ovld sub_group_non_uniform_broadcast( half16 value, uint index );
299+
300+half __ovld sub_group_broadcast_first( half value );
301+#endif // cl_khr_fp16
302+
303+#if defined(cl_khr_fp64)
304+double __ovld sub_group_non_uniform_broadcast( double value, uint index );
305+double2 __ovld sub_group_non_uniform_broadcast( double2 value, uint index );
306+double3 __ovld sub_group_non_uniform_broadcast( double3 value, uint index );
307+double4 __ovld sub_group_non_uniform_broadcast( double4 value, uint index );
308+double8 __ovld sub_group_non_uniform_broadcast( double8 value, uint index );
309+double16 __ovld sub_group_non_uniform_broadcast( double16 value, uint index );
310+
311+double __ovld sub_group_broadcast_first( double value );
312+#endif // cl_khr_fp64
313+
314+#endif // cl_khr_subgroup_ballot
315+
316+#if defined(cl_khr_subgroup_non_uniform_arithmetic)
317+char __ovld sub_group_non_uniform_reduce_add( char value );
318+uchar __ovld sub_group_non_uniform_reduce_add( uchar value );
319+short __ovld sub_group_non_uniform_reduce_add( short value );
320+ushort __ovld sub_group_non_uniform_reduce_add( ushort value );
321+int __ovld sub_group_non_uniform_reduce_add( int value );
322+uint __ovld sub_group_non_uniform_reduce_add( uint value );
323+long __ovld sub_group_non_uniform_reduce_add( long value );
324+ulong __ovld sub_group_non_uniform_reduce_add( ulong value );
325+float __ovld sub_group_non_uniform_reduce_add( float value );
326+
327+char __ovld sub_group_non_uniform_reduce_mul( char value );
328+uchar __ovld sub_group_non_uniform_reduce_mul( uchar value );
329+short __ovld sub_group_non_uniform_reduce_mul( short value );
330+ushort __ovld sub_group_non_uniform_reduce_mul( ushort value );
331+int __ovld sub_group_non_uniform_reduce_mul( int value );
332+uint __ovld sub_group_non_uniform_reduce_mul( uint value );
333+long __ovld sub_group_non_uniform_reduce_mul( long value );
334+ulong __ovld sub_group_non_uniform_reduce_mul( ulong value );
335+float __ovld sub_group_non_uniform_reduce_mul( float value );
336+
337+char __ovld sub_group_non_uniform_reduce_min( char value );
338+uchar __ovld sub_group_non_uniform_reduce_min( uchar value );
339+short __ovld sub_group_non_uniform_reduce_min( short value );
340+ushort __ovld sub_group_non_uniform_reduce_min( ushort value );
341+int __ovld sub_group_non_uniform_reduce_min( int value );
342+uint __ovld sub_group_non_uniform_reduce_min( uint value );
343+long __ovld sub_group_non_uniform_reduce_min( long value );
344+ulong __ovld sub_group_non_uniform_reduce_min( ulong value );
345+float __ovld sub_group_non_uniform_reduce_min( float value );
346+
347+char __ovld sub_group_non_uniform_reduce_max( char value );
348+uchar __ovld sub_group_non_uniform_reduce_max( uchar value );
349+short __ovld sub_group_non_uniform_reduce_max( short value );
350+ushort __ovld sub_group_non_uniform_reduce_max( ushort value );
351+int __ovld sub_group_non_uniform_reduce_max( int value );
352+uint __ovld sub_group_non_uniform_reduce_max( uint value );
353+long __ovld sub_group_non_uniform_reduce_max( long value );
354+ulong __ovld sub_group_non_uniform_reduce_max( ulong value );
355+float __ovld sub_group_non_uniform_reduce_max( float value );
356+
357+char __ovld sub_group_non_uniform_scan_inclusive_add( char value );
358+uchar __ovld sub_group_non_uniform_scan_inclusive_add( uchar value );
359+short __ovld sub_group_non_uniform_scan_inclusive_add( short value );
360+ushort __ovld sub_group_non_uniform_scan_inclusive_add( ushort value );
361+int __ovld sub_group_non_uniform_scan_inclusive_add( int value );
362+uint __ovld sub_group_non_uniform_scan_inclusive_add( uint value );
363+long __ovld sub_group_non_uniform_scan_inclusive_add( long value );
364+ulong __ovld sub_group_non_uniform_scan_inclusive_add( ulong value );
365+float __ovld sub_group_non_uniform_scan_inclusive_add( float value );
366+
367+char __ovld sub_group_non_uniform_scan_inclusive_mul( char value );
368+uchar __ovld sub_group_non_uniform_scan_inclusive_mul( uchar value );
369+short __ovld sub_group_non_uniform_scan_inclusive_mul( short value );
370+ushort __ovld sub_group_non_uniform_scan_inclusive_mul( ushort value );
371+int __ovld sub_group_non_uniform_scan_inclusive_mul( int value );
372+uint __ovld sub_group_non_uniform_scan_inclusive_mul( uint value );
373+long __ovld sub_group_non_uniform_scan_inclusive_mul( long value );
374+ulong __ovld sub_group_non_uniform_scan_inclusive_mul( ulong value );
375+float __ovld sub_group_non_uniform_scan_inclusive_mul( float value );
376+
377+char __ovld sub_group_non_uniform_scan_inclusive_min( char value );
378+uchar __ovld sub_group_non_uniform_scan_inclusive_min( uchar value );
379+short __ovld sub_group_non_uniform_scan_inclusive_min( short value );
380+ushort __ovld sub_group_non_uniform_scan_inclusive_min( ushort value );
381+int __ovld sub_group_non_uniform_scan_inclusive_min( int value );
382+uint __ovld sub_group_non_uniform_scan_inclusive_min( uint value );
383+long __ovld sub_group_non_uniform_scan_inclusive_min( long value );
384+ulong __ovld sub_group_non_uniform_scan_inclusive_min( ulong value );
385+float __ovld sub_group_non_uniform_scan_inclusive_min( float value );
386+
387+char __ovld sub_group_non_uniform_scan_inclusive_max( char value );
388+uchar __ovld sub_group_non_uniform_scan_inclusive_max( uchar value );
389+short __ovld sub_group_non_uniform_scan_inclusive_max( short value );
390+ushort __ovld sub_group_non_uniform_scan_inclusive_max( ushort value );
391+int __ovld sub_group_non_uniform_scan_inclusive_max( int value );
392+uint __ovld sub_group_non_uniform_scan_inclusive_max( uint value );
393+long __ovld sub_group_non_uniform_scan_inclusive_max( long value );
394+ulong __ovld sub_group_non_uniform_scan_inclusive_max( ulong value );
395+float __ovld sub_group_non_uniform_scan_inclusive_max( float value );
396+
397+char __ovld sub_group_non_uniform_scan_exclusive_add( char value );
398+uchar __ovld sub_group_non_uniform_scan_exclusive_add( uchar value );
399+short __ovld sub_group_non_uniform_scan_exclusive_add( short value );
400+ushort __ovld sub_group_non_uniform_scan_exclusive_add( ushort value );
401+int __ovld sub_group_non_uniform_scan_exclusive_add( int value );
402+uint __ovld sub_group_non_uniform_scan_exclusive_add( uint value );
403+long __ovld sub_group_non_uniform_scan_exclusive_add( long value );
404+ulong __ovld sub_group_non_uniform_scan_exclusive_add( ulong value );
405+float __ovld sub_group_non_uniform_scan_exclusive_add( float value );
406+
407+char __ovld sub_group_non_uniform_scan_exclusive_mul( char value );
408+uchar __ovld sub_group_non_uniform_scan_exclusive_mul( uchar value );
409+short __ovld sub_group_non_uniform_scan_exclusive_mul( short value );
410+ushort __ovld sub_group_non_uniform_scan_exclusive_mul( ushort value );
411+int __ovld sub_group_non_uniform_scan_exclusive_mul( int value );
412+uint __ovld sub_group_non_uniform_scan_exclusive_mul( uint value );
413+long __ovld sub_group_non_uniform_scan_exclusive_mul( long value );
414+ulong __ovld sub_group_non_uniform_scan_exclusive_mul( ulong value );
415+float __ovld sub_group_non_uniform_scan_exclusive_mul( float value );
416+
417+char __ovld sub_group_non_uniform_scan_exclusive_min( char value );
418+uchar __ovld sub_group_non_uniform_scan_exclusive_min( uchar value );
419+short __ovld sub_group_non_uniform_scan_exclusive_min( short value );
420+ushort __ovld sub_group_non_uniform_scan_exclusive_min( ushort value );
421+int __ovld sub_group_non_uniform_scan_exclusive_min( int value );
422+uint __ovld sub_group_non_uniform_scan_exclusive_min( uint value );
423+long __ovld sub_group_non_uniform_scan_exclusive_min( long value );
424+ulong __ovld sub_group_non_uniform_scan_exclusive_min( ulong value );
425+float __ovld sub_group_non_uniform_scan_exclusive_min( float value );
426+
427+char __ovld sub_group_non_uniform_scan_exclusive_max( char value );
428+uchar __ovld sub_group_non_uniform_scan_exclusive_max( uchar value );
429+short __ovld sub_group_non_uniform_scan_exclusive_max( short value );
430+ushort __ovld sub_group_non_uniform_scan_exclusive_max( ushort value );
431+int __ovld sub_group_non_uniform_scan_exclusive_max( int value );
432+uint __ovld sub_group_non_uniform_scan_exclusive_max( uint value );
433+long __ovld sub_group_non_uniform_scan_exclusive_max( long value );
434+ulong __ovld sub_group_non_uniform_scan_exclusive_max( ulong value );
435+float __ovld sub_group_non_uniform_scan_exclusive_max( float value );
436+
437+char __ovld sub_group_non_uniform_reduce_and( char value );
438+uchar __ovld sub_group_non_uniform_reduce_and( uchar value );
439+short __ovld sub_group_non_uniform_reduce_and( short value );
440+ushort __ovld sub_group_non_uniform_reduce_and( ushort value );
441+int __ovld sub_group_non_uniform_reduce_and( int value );
442+uint __ovld sub_group_non_uniform_reduce_and( uint value );
443+long __ovld sub_group_non_uniform_reduce_and( long value );
444+ulong __ovld sub_group_non_uniform_reduce_and( ulong value );
445+
446+char __ovld sub_group_non_uniform_reduce_or( char value );
447+uchar __ovld sub_group_non_uniform_reduce_or( uchar value );
448+short __ovld sub_group_non_uniform_reduce_or( short value );
449+ushort __ovld sub_group_non_uniform_reduce_or( ushort value );
450+int __ovld sub_group_non_uniform_reduce_or( int value );
451+uint __ovld sub_group_non_uniform_reduce_or( uint value );
452+long __ovld sub_group_non_uniform_reduce_or( long value );
453+ulong __ovld sub_group_non_uniform_reduce_or( ulong value );
454+
455+char __ovld sub_group_non_uniform_reduce_xor( char value );
456+uchar __ovld sub_group_non_uniform_reduce_xor( uchar value );
457+short __ovld sub_group_non_uniform_reduce_xor( short value );
458+ushort __ovld sub_group_non_uniform_reduce_xor( ushort value );
459+int __ovld sub_group_non_uniform_reduce_xor( int value );
460+uint __ovld sub_group_non_uniform_reduce_xor( uint value );
461+long __ovld sub_group_non_uniform_reduce_xor( long value );
462+ulong __ovld sub_group_non_uniform_reduce_xor( ulong value );
463+
464+char __ovld sub_group_non_uniform_scan_inclusive_and( char value );
465+uchar __ovld sub_group_non_uniform_scan_inclusive_and( uchar value );
466+short __ovld sub_group_non_uniform_scan_inclusive_and( short value );
467+ushort __ovld sub_group_non_uniform_scan_inclusive_and( ushort value );
468+int __ovld sub_group_non_uniform_scan_inclusive_and( int value );
469+uint __ovld sub_group_non_uniform_scan_inclusive_and( uint value );
470+long __ovld sub_group_non_uniform_scan_inclusive_and( long value );
471+ulong __ovld sub_group_non_uniform_scan_inclusive_and( ulong value );
472+
473+char __ovld sub_group_non_uniform_scan_inclusive_or( char value );
474+uchar __ovld sub_group_non_uniform_scan_inclusive_or( uchar value );
475+short __ovld sub_group_non_uniform_scan_inclusive_or( short value );
476+ushort __ovld sub_group_non_uniform_scan_inclusive_or( ushort value );
477+int __ovld sub_group_non_uniform_scan_inclusive_or( int value );
478+uint __ovld sub_group_non_uniform_scan_inclusive_or( uint value );
479+long __ovld sub_group_non_uniform_scan_inclusive_or( long value );
480+ulong __ovld sub_group_non_uniform_scan_inclusive_or( ulong value );
481+
482+char __ovld sub_group_non_uniform_scan_inclusive_xor( char value );
483+uchar __ovld sub_group_non_uniform_scan_inclusive_xor( uchar value );
484+short __ovld sub_group_non_uniform_scan_inclusive_xor( short value );
485+ushort __ovld sub_group_non_uniform_scan_inclusive_xor( ushort value );
486+int __ovld sub_group_non_uniform_scan_inclusive_xor( int value );
487+uint __ovld sub_group_non_uniform_scan_inclusive_xor( uint value );
488+long __ovld sub_group_non_uniform_scan_inclusive_xor( long value );
489+ulong __ovld sub_group_non_uniform_scan_inclusive_xor( ulong value );
490+
491+char __ovld sub_group_non_uniform_scan_exclusive_and( char value );
492+uchar __ovld sub_group_non_uniform_scan_exclusive_and( uchar value );
493+short __ovld sub_group_non_uniform_scan_exclusive_and( short value );
494+ushort __ovld sub_group_non_uniform_scan_exclusive_and( ushort value );
495+int __ovld sub_group_non_uniform_scan_exclusive_and( int value );
496+uint __ovld sub_group_non_uniform_scan_exclusive_and( uint value );
497+long __ovld sub_group_non_uniform_scan_exclusive_and( long value );
498+ulong __ovld sub_group_non_uniform_scan_exclusive_and( ulong value );
499+
500+char __ovld sub_group_non_uniform_scan_exclusive_or( char value );
501+uchar __ovld sub_group_non_uniform_scan_exclusive_or( uchar value );
502+short __ovld sub_group_non_uniform_scan_exclusive_or( short value );
503+ushort __ovld sub_group_non_uniform_scan_exclusive_or( ushort value );
504+int __ovld sub_group_non_uniform_scan_exclusive_or( int value );
505+uint __ovld sub_group_non_uniform_scan_exclusive_or( uint value );
506+long __ovld sub_group_non_uniform_scan_exclusive_or( long value );
507+ulong __ovld sub_group_non_uniform_scan_exclusive_or( ulong value );
508+
509+char __ovld sub_group_non_uniform_scan_exclusive_xor( char value );
510+uchar __ovld sub_group_non_uniform_scan_exclusive_xor( uchar value );
511+short __ovld sub_group_non_uniform_scan_exclusive_xor( short value );
512+ushort __ovld sub_group_non_uniform_scan_exclusive_xor( ushort value );
513+int __ovld sub_group_non_uniform_scan_exclusive_xor( int value );
514+uint __ovld sub_group_non_uniform_scan_exclusive_xor( uint value );
515+long __ovld sub_group_non_uniform_scan_exclusive_xor( long value );
516+ulong __ovld sub_group_non_uniform_scan_exclusive_xor( ulong value );
517+
518+int __ovld sub_group_non_uniform_reduce_logical_and( int predicate );
519+int __ovld sub_group_non_uniform_reduce_logical_or( int predicate );
520+int __ovld sub_group_non_uniform_reduce_logical_xor( int predicate );
521+
522+int __ovld sub_group_non_uniform_scan_inclusive_logical_and( int predicate );
523+int __ovld sub_group_non_uniform_scan_inclusive_logical_or( int predicate );
524+int __ovld sub_group_non_uniform_scan_inclusive_logical_xor( int predicate );
525+
526+int __ovld sub_group_non_uniform_scan_exclusive_logical_and( int predicate );
527+int __ovld sub_group_non_uniform_scan_exclusive_logical_or( int predicate );
528+int __ovld sub_group_non_uniform_scan_exclusive_logical_xor( int predicate );
529+
530+#if defined(cl_khr_fp16)
531+half __ovld sub_group_non_uniform_reduce_add( half value );
532+half __ovld sub_group_non_uniform_reduce_mul( half value );
533+half __ovld sub_group_non_uniform_reduce_min( half value );
534+half __ovld sub_group_non_uniform_reduce_max( half value );
535+half __ovld sub_group_non_uniform_scan_inclusive_add( half value );
536+half __ovld sub_group_non_uniform_scan_inclusive_mul( half value );
537+half __ovld sub_group_non_uniform_scan_inclusive_min( half value );
538+half __ovld sub_group_non_uniform_scan_inclusive_max( half value );
539+half __ovld sub_group_non_uniform_scan_exclusive_add( half value );
540+half __ovld sub_group_non_uniform_scan_exclusive_mul( half value );
541+half __ovld sub_group_non_uniform_scan_exclusive_min( half value );
542+half __ovld sub_group_non_uniform_scan_exclusive_max( half value );
543+#endif // cl_khr_fp16
544+
545+#if defined(cl_khr_fp64)
546+double __ovld sub_group_non_uniform_reduce_add( double value );
547+double __ovld sub_group_non_uniform_reduce_mul( double value );
548+double __ovld sub_group_non_uniform_reduce_min( double value );
549+double __ovld sub_group_non_uniform_reduce_max( double value );
550+double __ovld sub_group_non_uniform_scan_inclusive_add( double value );
551+double __ovld sub_group_non_uniform_scan_inclusive_mul( double value );
552+double __ovld sub_group_non_uniform_scan_inclusive_min( double value );
553+double __ovld sub_group_non_uniform_scan_inclusive_max( double value );
554+double __ovld sub_group_non_uniform_scan_exclusive_add( double value );
555+double __ovld sub_group_non_uniform_scan_exclusive_mul( double value );
556+double __ovld sub_group_non_uniform_scan_exclusive_min( double value );
557+double __ovld sub_group_non_uniform_scan_exclusive_max( double value );
558+#endif // cl_khr_fp64
559+
560+#endif // cl_khr_subgroup_non_uniform_arithmetic
561+
562+#if defined(cl_khr_subgroup_shuffle)
563+char __ovld sub_group_shuffle( char value, uint index );
564+uchar __ovld sub_group_shuffle( uchar value, uint index );
565+short __ovld sub_group_shuffle( short value, uint index );
566+ushort __ovld sub_group_shuffle( ushort value, uint index );
567+int __ovld sub_group_shuffle( int value, uint index );
568+uint __ovld sub_group_shuffle( uint value, uint index );
569+long __ovld sub_group_shuffle( long value, uint index );
570+ulong __ovld sub_group_shuffle( ulong value, uint index );
571+float __ovld sub_group_shuffle( float value, uint index );
572+
573+char __ovld sub_group_shuffle_xor( char value, uint mask );
574+uchar __ovld sub_group_shuffle_xor( uchar value, uint mask );
575+short __ovld sub_group_shuffle_xor( short value, uint mask );
576+ushort __ovld sub_group_shuffle_xor( ushort value, uint mask );
577+int __ovld sub_group_shuffle_xor( int value, uint mask );
578+uint __ovld sub_group_shuffle_xor( uint value, uint mask );
579+long __ovld sub_group_shuffle_xor( long value, uint mask );
580+ulong __ovld sub_group_shuffle_xor( ulong value, uint mask );
581+float __ovld sub_group_shuffle_xor( float value, uint mask );
582+
583+#if defined(cl_khr_fp16)
584+half __ovld sub_group_shuffle( half value, uint index );
585+half __ovld sub_group_shuffle_xor( half value, uint mask );
586+#endif // cl_khr_fp16
587+
588+#if defined(cl_khr_fp64)
589+double __ovld sub_group_shuffle( double value, uint index );
590+double __ovld sub_group_shuffle_xor( double value, uint mask );
591+#endif // cl_khr_fp64
592+
593+#endif // cl_khr_subgroup_shuffle
594+
595+#if defined(cl_khr_subgroup_shuffle_relative)
596+char __ovld sub_group_shuffle_up( char value, uint delta );
597+uchar __ovld sub_group_shuffle_up( uchar value, uint delta );
598+short __ovld sub_group_shuffle_up( short value, uint delta );
599+ushort __ovld sub_group_shuffle_up( ushort value, uint delta );
600+int __ovld sub_group_shuffle_up( int value, uint delta );
601+uint __ovld sub_group_shuffle_up( uint value, uint delta );
602+long __ovld sub_group_shuffle_up( long value, uint delta );
603+ulong __ovld sub_group_shuffle_up( ulong value, uint delta );
604+float __ovld sub_group_shuffle_up( float value, uint delta );
605+
606+char __ovld sub_group_shuffle_down( char value, uint delta );
607+uchar __ovld sub_group_shuffle_down( uchar value, uint delta );
608+short __ovld sub_group_shuffle_down( short value, uint delta );
609+ushort __ovld sub_group_shuffle_down( ushort value, uint delta );
610+int __ovld sub_group_shuffle_down( int value, uint delta );
611+uint __ovld sub_group_shuffle_down( uint value, uint delta );
612+long __ovld sub_group_shuffle_down( long value, uint delta );
613+ulong __ovld sub_group_shuffle_down( ulong value, uint delta );
614+float __ovld sub_group_shuffle_down( float value, uint delta );
615+
616+#if defined(cl_khr_fp16)
617+half __ovld sub_group_shuffle_up( half value, uint delta );
618+half __ovld sub_group_shuffle_down( half value, uint delta );
619+#endif // cl_khr_fp16
620+
621+#if defined(cl_khr_fp64)
622+double __ovld sub_group_shuffle_up( double value, uint delta );
623+double __ovld sub_group_shuffle_down( double value, uint delta );
624+#endif // cl_khr_fp64
625+
626+#endif // cl_khr_subgroup_shuffle_relative
627+
628+#if defined(cl_khr_subgroup_clustered_reduce)
629+char __ovld sub_group_clustered_reduce_add( char value, uint clustersize );
630+uchar __ovld sub_group_clustered_reduce_add( uchar value, uint clustersize );
631+short __ovld sub_group_clustered_reduce_add( short value, uint clustersize );
632+ushort __ovld sub_group_clustered_reduce_add( ushort value, uint clustersize );
633+int __ovld sub_group_clustered_reduce_add( int value, uint clustersize );
634+uint __ovld sub_group_clustered_reduce_add( uint value, uint clustersize );
635+long __ovld sub_group_clustered_reduce_add( long value, uint clustersize );
636+ulong __ovld sub_group_clustered_reduce_add( ulong value, uint clustersize );
637+float __ovld sub_group_clustered_reduce_add( float value, uint clustersize );
638+
639+char __ovld sub_group_clustered_reduce_mul( char value, uint clustersize );
640+uchar __ovld sub_group_clustered_reduce_mul( uchar value, uint clustersize );
641+short __ovld sub_group_clustered_reduce_mul( short value, uint clustersize );
642+ushort __ovld sub_group_clustered_reduce_mul( ushort value, uint clustersize );
643+int __ovld sub_group_clustered_reduce_mul( int value, uint clustersize );
644+uint __ovld sub_group_clustered_reduce_mul( uint value, uint clustersize );
645+long __ovld sub_group_clustered_reduce_mul( long value, uint clustersize );
646+ulong __ovld sub_group_clustered_reduce_mul( ulong value, uint clustersize );
647+float __ovld sub_group_clustered_reduce_mul( float value, uint clustersize );
648+
649+char __ovld sub_group_clustered_reduce_min( char value, uint clustersize );
650+uchar __ovld sub_group_clustered_reduce_min( uchar value, uint clustersize );
651+short __ovld sub_group_clustered_reduce_min( short value, uint clustersize );
652+ushort __ovld sub_group_clustered_reduce_min( ushort value, uint clustersize );
653+int __ovld sub_group_clustered_reduce_min( int value, uint clustersize );
654+uint __ovld sub_group_clustered_reduce_min( uint value, uint clustersize );
655+long __ovld sub_group_clustered_reduce_min( long value, uint clustersize );
656+ulong __ovld sub_group_clustered_reduce_min( ulong value, uint clustersize );
657+float __ovld sub_group_clustered_reduce_min( float value, uint clustersize );
658+
659+char __ovld sub_group_clustered_reduce_max( char value, uint clustersize );
660+uchar __ovld sub_group_clustered_reduce_max( uchar value, uint clustersize );
661+short __ovld sub_group_clustered_reduce_max( short value, uint clustersize );
662+ushort __ovld sub_group_clustered_reduce_max( ushort value, uint clustersize );
663+int __ovld sub_group_clustered_reduce_max( int value, uint clustersize );
664+uint __ovld sub_group_clustered_reduce_max( uint value, uint clustersize );
665+long __ovld sub_group_clustered_reduce_max( long value, uint clustersize );
666+ulong __ovld sub_group_clustered_reduce_max( ulong value, uint clustersize );
667+float __ovld sub_group_clustered_reduce_max( float value, uint clustersize );
668+
669+char __ovld sub_group_clustered_reduce_and( char value, uint clustersize );
670+uchar __ovld sub_group_clustered_reduce_and( uchar value, uint clustersize );
671+short __ovld sub_group_clustered_reduce_and( short value, uint clustersize );
672+ushort __ovld sub_group_clustered_reduce_and( ushort value, uint clustersize );
673+int __ovld sub_group_clustered_reduce_and( int value, uint clustersize );
674+uint __ovld sub_group_clustered_reduce_and( uint value, uint clustersize );
675+long __ovld sub_group_clustered_reduce_and( long value, uint clustersize );
676+ulong __ovld sub_group_clustered_reduce_and( ulong value, uint clustersize );
677+
678+char __ovld sub_group_clustered_reduce_or( char value, uint clustersize );
679+uchar __ovld sub_group_clustered_reduce_or( uchar value, uint clustersize );
680+short __ovld sub_group_clustered_reduce_or( short value, uint clustersize );
681+ushort __ovld sub_group_clustered_reduce_or( ushort value, uint clustersize );
682+int __ovld sub_group_clustered_reduce_or( int value, uint clustersize );
683+uint __ovld sub_group_clustered_reduce_or( uint value, uint clustersize );
684+long __ovld sub_group_clustered_reduce_or( long value, uint clustersize );
685+ulong __ovld sub_group_clustered_reduce_or( ulong value, uint clustersize );
686+
687+char __ovld sub_group_clustered_reduce_xor( char value, uint clustersize );
688+uchar __ovld sub_group_clustered_reduce_xor( uchar value, uint clustersize );
689+short __ovld sub_group_clustered_reduce_xor( short value, uint clustersize );
690+ushort __ovld sub_group_clustered_reduce_xor( ushort value, uint clustersize );
691+int __ovld sub_group_clustered_reduce_xor( int value, uint clustersize );
692+uint __ovld sub_group_clustered_reduce_xor( uint value, uint clustersize );
693+long __ovld sub_group_clustered_reduce_xor( long value, uint clustersize );
694+ulong __ovld sub_group_clustered_reduce_xor( ulong value, uint clustersize );
695+
696+int __ovld sub_group_clustered_reduce_logical_and( int predicate, uint clustersize );
697+int __ovld sub_group_clustered_reduce_logical_or( int predicate, uint clustersize );
698+int __ovld sub_group_clustered_reduce_logical_xor( int predicate, uint clustersize );
699+
700+#if defined(cl_khr_fp16)
701+half __ovld sub_group_clustered_reduce_add( half value, uint clustersize );
702+half __ovld sub_group_clustered_reduce_mul( half value, uint clustersize );
703+half __ovld sub_group_clustered_reduce_min( half value, uint clustersize );
704+half __ovld sub_group_clustered_reduce_max( half value, uint clustersize );
705+#endif // cl_khr_fp16
706+
707+#if defined(cl_khr_fp64)
708+double __ovld sub_group_clustered_reduce_add( double value, uint clustersize );
709+double __ovld sub_group_clustered_reduce_mul( double value, uint clustersize );
710+double __ovld sub_group_clustered_reduce_min( double value, uint clustersize );
711+double __ovld sub_group_clustered_reduce_max( double value, uint clustersize );
712+#endif // cl_khr_fp64
713+
714+#endif // cl_khr_subgroup_clustered_reduce
715+
716 #if defined(cl_intel_subgroups)
717 // Intel-Specific Sub Group Functions
718 float __ovld __conv intel_sub_group_shuffle( float x, uint c );
719diff --git a/clang/test/SemaOpenCL/extension-version.cl b/clang/test/SemaOpenCL/extension-version.cl
720index 0e6bbb7d3bcd..86c78143a0eb 100644
721--- a/clang/test/SemaOpenCL/extension-version.cl
722+++ b/clang/test/SemaOpenCL/extension-version.cl
723@@ -333,3 +333,86 @@
724 #endif
725 #pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : enable
726
727+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
728+#ifndef cl_khr_subgroup_extended_types
729+#error "Missing cl_khr_subgroup_extended_types"
730+#endif
731+#else
732+#ifdef cl_khr_subgroup_extended_types
733+#error "Incorrect cl_khr_subgroup_extended_types define"
734+#endif
735+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_extended_types' - ignoring}}
736+#endif
737+#pragma OPENCL EXTENSION cl_khr_subgroup_extended_types : enable
738+
739+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
740+#ifndef cl_khr_subgroup_non_uniform_vote
741+#error "Missing cl_khr_subgroup_non_uniform_vote"
742+#endif
743+#else
744+#ifdef cl_khr_subgroup_non_uniform_vote
745+#error "Incorrect cl_khr_subgroup_non_uniform_vote define"
746+#endif
747+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_non_uniform_vote' - ignoring}}
748+#endif
749+#pragma OPENCL EXTENSION cl_khr_subgroup_non_uniform_vote : enable
750+
751+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
752+#ifndef cl_khr_subgroup_ballot
753+#error "Missing cl_khr_subgroup_ballot"
754+#endif
755+#else
756+#ifdef cl_khr_subgroup_ballot
757+#error "Incorrect cl_khr_subgroup_ballot define"
758+#endif
759+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_ballot' - ignoring}}
760+#endif
761+#pragma OPENCL EXTENSION cl_khr_subgroup_ballot : enable
762+
763+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
764+#ifndef cl_khr_subgroup_non_uniform_arithmetic
765+#error "Missing cl_khr_subgroup_non_uniform_arithmetic"
766+#endif
767+#else
768+#ifdef cl_khr_subgroup_non_uniform_arithmetic
769+#error "Incorrect cl_khr_subgroup_non_uniform_arithmetic define"
770+#endif
771+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_non_uniform_arithmetic' - ignoring}}
772+#endif
773+#pragma OPENCL EXTENSION cl_khr_subgroup_non_uniform_arithmetic : enable
774+
775+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
776+#ifndef cl_khr_subgroup_shuffle
777+#error "Missing cl_khr_subgroup_shuffle"
778+#endif
779+#else
780+#ifdef cl_khr_subgroup_shuffle
781+#error "Incorrect cl_khr_subgroup_shuffle define"
782+#endif
783+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_shuffle' - ignoring}}
784+#endif
785+#pragma OPENCL EXTENSION cl_khr_subgroup_shuffle : enable
786+
787+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
788+#ifndef cl_khr_subgroup_shuffle_relative
789+#error "Missing cl_khr_subgroup_shuffle_relative"
790+#endif
791+#else
792+#ifdef cl_khr_subgroup_shuffle_relative
793+#error "Incorrect cl_khr_subgroup_shuffle_relative define"
794+#endif
795+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_shuffle_relative' - ignoring}}
796+#endif
797+#pragma OPENCL EXTENSION cl_khr_subgroup_shuffle_relative : enable
798+
799+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
800+#ifndef cl_khr_subgroup_clustered_reduce
801+#error "Missing cl_khr_subgroup_clustered_reduce"
802+#endif
803+#else
804+#ifdef cl_khr_subgroup_clustered_reduce
805+#error "Incorrect cl_khr_subgroup_clustered_reduce define"
806+#endif
807+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_clustered_reduce' - ignoring}}
808+#endif
809+#pragma OPENCL EXTENSION cl_khr_subgroup_clustered_reduce : enable
810--
8112.17.1
812
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 @@
1From eeb816d95f0910bd246e37bb2bb3923acf0edf6b Mon Sep 17 00:00:00 2001
2From: Aleksander Us <aleksander.us@intel.com>
3Date: Mon, 26 Aug 2019 15:47:41 +0300
4Subject: [PATCH] [BasicBlockUtils] Add metadata fixing in
5 SplitBlockPredecessors.
6
7In case when BB is header of some loop and predecessor is latch of
8this loop, metadata was not attached to newly created basic block.
9This led to loss of loop metadata for other passes.
10
11Upstream-Status: Submitted [https://reviews.llvm.org/D66892]
12
13https://github.com/intel/llvm-patches/commit/8af4449e2d201707f7f2f832b473a0439e255f32
14
15Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
16---
17 lib/Transforms/Utils/BasicBlockUtils.cpp | 23 ++++++++----
18 test/Transforms/LoopSimplify/loop_metadata.ll | 36 +++++++++++++++++++
19 2 files changed, 52 insertions(+), 7 deletions(-)
20 create mode 100644 test/Transforms/LoopSimplify/loop_metadata.ll
21
22diff --git a/lib/Transforms/Utils/BasicBlockUtils.cpp b/lib/Transforms/Utils/BasicBlockUtils.cpp
23index 5fa371377c8..3a90ae061fb 100644
24--- a/lib/Transforms/Utils/BasicBlockUtils.cpp
25+++ b/lib/Transforms/Utils/BasicBlockUtils.cpp
26@@ -579,24 +579,33 @@ BasicBlock *llvm::SplitBlockPredecessors(BasicBlock *BB,
27
28 // The new block unconditionally branches to the old block.
29 BranchInst *BI = BranchInst::Create(BB, NewBB);
30+ bool IsBBHeader = LI && LI->isLoopHeader(BB);
31+ Loop *BBLoop = LI ? LI->getLoopFor(BB) : nullptr;
32 // Splitting the predecessors of a loop header creates a preheader block.
33- if (LI && LI->isLoopHeader(BB))
34+ if (IsBBHeader)
35 // Using the loop start line number prevents debuggers stepping into the
36 // loop body for this instruction.
37- BI->setDebugLoc(LI->getLoopFor(BB)->getStartLoc());
38+ BI->setDebugLoc(BBLoop->getStartLoc());
39 else
40 BI->setDebugLoc(BB->getFirstNonPHIOrDbg()->getDebugLoc());
41
42 // Move the edges from Preds to point to NewBB instead of BB.
43- for (unsigned i = 0, e = Preds.size(); i != e; ++i) {
44+ for (BasicBlock *Pred : Preds) {
45+ Instruction *PI = Pred->getTerminator();
46 // This is slightly more strict than necessary; the minimum requirement
47 // is that there be no more than one indirectbr branching to BB. And
48 // all BlockAddress uses would need to be updated.
49- assert(!isa<IndirectBrInst>(Preds[i]->getTerminator()) &&
50+ assert(!isa<IndirectBrInst>(PI) &&
51 "Cannot split an edge from an IndirectBrInst");
52- assert(!isa<CallBrInst>(Preds[i]->getTerminator()) &&
53- "Cannot split an edge from a CallBrInst");
54- Preds[i]->getTerminator()->replaceUsesOfWith(BB, NewBB);
55+ assert(!isa<CallBrInst>(PI) && "Cannot split an edge from a CallBrInst");
56+ if (IsBBHeader && BBLoop->contains(Pred) && BBLoop->isLoopLatch(Pred)) {
57+ // Update loop metadata if it exists.
58+ if (MDNode *LoopMD = PI->getMetadata(LLVMContext::MD_loop)) {
59+ BI->setMetadata(LLVMContext::MD_loop, LoopMD);
60+ PI->setMetadata(LLVMContext::MD_loop, nullptr);
61+ }
62+ }
63+ PI->replaceUsesOfWith(BB, NewBB);
64 }
65
66 // Insert a new PHI node into NewBB for every PHI node in BB and that new PHI
67diff --git a/test/Transforms/LoopSimplify/loop_metadata.ll b/test/Transforms/LoopSimplify/loop_metadata.ll
68new file mode 100644
69index 00000000000..c15c92fe3ae
70--- /dev/null
71+++ b/test/Transforms/LoopSimplify/loop_metadata.ll
72@@ -0,0 +1,36 @@
73+; RUN: opt -S -loop-simplify < %s | FileCheck %s
74+
75+; CHECK: for.cond.loopexit:
76+; CHECK: br label %for.cond, !llvm.loop !0
77+; CHECK: br i1 %cmp1, label %for.body1, label %for.cond.loopexit
78+
79+define void @foo() {
80+entry:
81+ br label %for.cond
82+
83+for.cond: ; preds = %for.cond1, %entry
84+ %j = phi i32 [ 0, %entry ], [ %add, %for.cond1 ]
85+ %cmp = icmp ult i32 %j, 8
86+ br i1 %cmp, label %for.body, label %for.end
87+
88+for.body: ; preds = %for.cond
89+ %dummy1 = add i32 1, 1
90+ %add = add nuw nsw i32 %j, 1
91+ br label %for.cond1
92+
93+for.cond1: ; preds = %for.body1, %for.body
94+ %i.0 = phi i32 [ 1, %for.body ], [ %inc, %for.body1 ]
95+ %cmp1 = icmp ult i32 %i.0, 8
96+ br i1 %cmp1, label %for.body1, label %for.cond, !llvm.loop !0
97+
98+for.body1: ; preds = %for.cond1
99+ %dummy2 = add i32 1, 1
100+ %inc = add nuw nsw i32 %i.0, 1
101+ br label %for.cond1
102+
103+for.end: ; preds = %for.cond
104+ ret void
105+}
106+
107+!0 = distinct !{!0, !1}
108+!1 = !{!"llvm.loop.unroll.full"}
109--
1102.18.0
111
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 @@
1From 35e218a886f4c066eabd18685240d55270bd5a6d Mon Sep 17 00:00:00 2001
2From: Aleksander Us <aleksander.us@intel.com>
3Date: Mon, 26 Aug 2019 15:45:47 +0300
4Subject: [PATCH] [IndVarSimplify] Do not use SCEV expander for IVCount in
5 LFTR when possible.
6
7SCEV analysis cannot properly cache instruction with poison flags
8(for example, add nsw outside of loop will not be reused by expander).
9This can lead to generating of additional instructions by SCEV expander.
10
11Example IR:
12
13 ...
14 %maxval = add nuw nsw i32 %a1, %a2
15 ...
16for.body:
17 ...
18 %cmp22 = icmp ult i32 %ivadd, %maxval
19 br i1 %cmp22, label %for.body, label %for.end
20 ...
21
22SCEV expander will generate copy of %maxval in preheader but without
23nuw/nsw flags. This can be avoided by explicit check that iv count
24value gives the same SCEV expressions as calculated by LFTR.
25
26Upstream-Status: Submitted [https://reviews.llvm.org/D66890]
27
28https://github.com/intel/llvm-patches/commit/fd6a6c97341a56fd21bc32bc940afea751312e8f
29
30Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
31---
32 lib/Transforms/Scalar/IndVarSimplify.cpp | 12 +++++++++-
33 test/Transforms/IndVarSimplify/add_nsw.ll | 23 ++++++++++++++++++++
34 test/Transforms/IndVarSimplify/lftr-reuse.ll | 9 +++-----
35 test/Transforms/IndVarSimplify/udiv.ll | 1 +
36 4 files changed, 38 insertions(+), 7 deletions(-)
37 create mode 100644 test/Transforms/IndVarSimplify/add_nsw.ll
38
39diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
40index f9fc698a4a9..5e04dac8aa6 100644
41--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
42+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
43@@ -2375,6 +2375,17 @@ static Value *genLoopLimit(PHINode *IndVar, BasicBlock *ExitingBB,
44 if (UsePostInc)
45 IVLimit = SE->getAddExpr(IVLimit, SE->getOne(IVLimit->getType()));
46
47+ // If computed limit is equal to old limit then do not use SCEV expander
48+ // because it can lost NUW/NSW flags and create extra instructions.
49+ BranchInst *BI = cast<BranchInst>(ExitingBB->getTerminator());
50+ if (ICmpInst *Cmp = dyn_cast<ICmpInst>(BI->getOperand(0))) {
51+ Value *Limit = Cmp->getOperand(0);
52+ if (!L->isLoopInvariant(Limit))
53+ Limit = Cmp->getOperand(1);
54+ if (SE->getSCEV(Limit) == IVLimit)
55+ return Limit;
56+ }
57+
58 // Expand the code for the iteration count.
59 assert(SE->isLoopInvariant(IVLimit, L) &&
60 "Computed iteration count is not loop invariant!");
61@@ -2383,7 +2394,6 @@ static Value *genLoopLimit(PHINode *IndVar, BasicBlock *ExitingBB,
62 // SCEV expression (IVInit) for a pointer type IV value (IndVar).
63 Type *LimitTy = ExitCount->getType()->isPointerTy() ?
64 IndVar->getType() : ExitCount->getType();
65- BranchInst *BI = cast<BranchInst>(ExitingBB->getTerminator());
66 return Rewriter.expandCodeFor(IVLimit, LimitTy, BI);
67 }
68 }
69diff --git a/test/Transforms/IndVarSimplify/add_nsw.ll b/test/Transforms/IndVarSimplify/add_nsw.ll
70new file mode 100644
71index 00000000000..abd1cbb6c51
72--- /dev/null
73+++ b/test/Transforms/IndVarSimplify/add_nsw.ll
74@@ -0,0 +1,23 @@
75+; RUN: opt -indvars -S %s | FileCheck %s
76+
77+target datalayout = "e-p:32:32-i64:64-n8:16:32"
78+
79+; CHECK: for.body.preheader:
80+; CHECK-NOT: add
81+; CHECK: for.body:
82+
83+define void @foo(i32 %a1, i32 %a2) {
84+entry:
85+ %maxval = add nuw nsw i32 %a1, %a2
86+ %cmp = icmp slt i32 %maxval, 1
87+ br i1 %cmp, label %for.end, label %for.body
88+
89+for.body: ; preds = %entry, %for.body
90+ %j.02 = phi i32 [ 0, %entry ], [ %add31, %for.body ]
91+ %add31 = add nuw nsw i32 %j.02, 1
92+ %cmp22 = icmp slt i32 %add31, %maxval
93+ br i1 %cmp22, label %for.body, label %for.end
94+
95+for.end: ; preds = %for.body
96+ ret void
97+}
98diff --git a/test/Transforms/IndVarSimplify/lftr-reuse.ll b/test/Transforms/IndVarSimplify/lftr-reuse.ll
99index 14ae9738696..509d662b767 100644
100--- a/test/Transforms/IndVarSimplify/lftr-reuse.ll
101+++ b/test/Transforms/IndVarSimplify/lftr-reuse.ll
102@@ -67,11 +67,9 @@ define void @expandOuterRecurrence(i32 %arg) nounwind {
103 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 0, [[SUB1]]
104 ; CHECK-NEXT: br i1 [[CMP1]], label [[OUTER_PREHEADER:%.*]], label [[EXIT:%.*]]
105 ; CHECK: outer.preheader:
106-; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[ARG]], -1
107 ; CHECK-NEXT: br label [[OUTER:%.*]]
108 ; CHECK: outer:
109-; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i32 [ [[TMP0]], [[OUTER_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], [[OUTER_INC:%.*]] ]
110-; CHECK-NEXT: [[I:%.*]] = phi i32 [ [[I_INC:%.*]], [[OUTER_INC]] ], [ 0, [[OUTER_PREHEADER]] ]
111+; CHECK-NEXT: [[I:%.*]] = phi i32 [ [[I_INC:%.*]], [[OUTER_INC:%.*]] ], [ 0, [[OUTER_PREHEADER]] ]
112 ; CHECK-NEXT: [[SUB2:%.*]] = sub nsw i32 [[ARG]], [[I]]
113 ; CHECK-NEXT: [[SUB3:%.*]] = sub nsw i32 [[SUB2]], 1
114 ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 0, [[SUB3]]
115@@ -81,14 +79,13 @@ define void @expandOuterRecurrence(i32 %arg) nounwind {
116 ; CHECK: inner:
117 ; CHECK-NEXT: [[J:%.*]] = phi i32 [ 0, [[INNER_PH]] ], [ [[J_INC:%.*]], [[INNER]] ]
118 ; CHECK-NEXT: [[J_INC]] = add nuw nsw i32 [[J]], 1
119-; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[J_INC]], [[INDVARS_IV]]
120+; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[J_INC]], [[SUB3]]
121 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[INNER]], label [[OUTER_INC_LOOPEXIT:%.*]]
122 ; CHECK: outer.inc.loopexit:
123 ; CHECK-NEXT: br label [[OUTER_INC]]
124 ; CHECK: outer.inc:
125 ; CHECK-NEXT: [[I_INC]] = add nuw nsw i32 [[I]], 1
126-; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add i32 [[INDVARS_IV]], -1
127-; CHECK-NEXT: [[EXITCOND1:%.*]] = icmp ne i32 [[I_INC]], [[TMP0]]
128+; CHECK-NEXT: [[EXITCOND1:%.*]] = icmp ne i32 [[I_INC]], [[SUB1]]
129 ; CHECK-NEXT: br i1 [[EXITCOND1]], label [[OUTER]], label [[EXIT_LOOPEXIT:%.*]]
130 ; CHECK: exit.loopexit:
131 ; CHECK-NEXT: br label [[EXIT]]
132diff --git a/test/Transforms/IndVarSimplify/udiv.ll b/test/Transforms/IndVarSimplify/udiv.ll
133index b3f2c2a6a66..3530343ef4a 100644
134--- a/test/Transforms/IndVarSimplify/udiv.ll
135+++ b/test/Transforms/IndVarSimplify/udiv.ll
136@@ -133,6 +133,7 @@ declare i32 @printf(i8* nocapture, ...) nounwind
137 ; CHECK-LABEL: @foo(
138 ; CHECK: for.body.preheader:
139 ; CHECK-NOT: udiv
140+; CHECK: for.body:
141
142 define void @foo(double* %p, i64 %n) nounwind {
143 entry:
144--
1452.18.0
146
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 @@
1From a6d4ccf082858e63e139ca06c02a071c343d2657 Mon Sep 17 00:00:00 2001
2From: Andrea Bocci <andrea.bocci@cern.ch>
3Date: Sun, 15 Mar 2020 17:35:44 +0100
4Subject: [PATCH] Fix building in-tree with cmake -DLLVM_LINK_LLVM_DYLIB=ON
5
6Building in-tree with LLVM 11.0 master with the LLVM_LINK_LLVM_DYLIB
7cmake flag fails to link with the LLVMSPIRVLib library.
8
9Add an explicit dependency to force the correct build order and linking.
10
11Signed-off-by: Andrea Bocci <andrea.bocci@cern.ch>
12Upstream-Status: Backport
13Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
14---
15 tools/llvm-spirv/CMakeLists.txt | 2 +-
16 1 file changed, 1 insertion(+), 1 deletion(-)
17
18diff --git a/tools/llvm-spirv/CMakeLists.txt b/tools/llvm-spirv/CMakeLists.txt
19index 9aa96d9c..501c0daf 100644
20--- a/tools/llvm-spirv/CMakeLists.txt
21+++ b/tools/llvm-spirv/CMakeLists.txt
22@@ -14,7 +14,7 @@ add_llvm_tool(llvm-spirv
23 NO_INSTALL_RPATH
24 )
25
26-if (LLVM_SPIRV_BUILD_EXTERNAL)
27+if (LLVM_SPIRV_BUILD_EXTERNAL OR LLVM_LINK_LLVM_DYLIB)
28 target_link_libraries(llvm-spirv PRIVATE LLVMSPIRVLib)
29 endif()
30
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 @@
1From 31ec702cb365f4d02dd2146fb4329d642b8fc30b Mon Sep 17 00:00:00 2001
2From: Naveen Saini <naveen.kumar.saini@intel.com>
3Date: Wed, 7 Apr 2021 16:36:10 +0800
4Subject: [PATCH 1/2] OpenCL 3.0 support
5
6Upstream-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]
7Signed-off-by: Anton Zabaznov <anton.zabaznov@intel.com>
8Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
9---
10 clang/include/clang/Basic/Builtins.def | 65 +-
11 clang/include/clang/Basic/Builtins.h | 13 +-
12 .../clang/Basic/DiagnosticParseKinds.td | 2 +
13 .../clang/Basic/DiagnosticSemaKinds.td | 7 +
14 clang/include/clang/Basic/LangOptions.def | 2 +
15 clang/include/clang/Basic/LangStandards.def | 4 +
16 .../include/clang/Basic/OpenCLExtensions.def | 15 +
17 clang/include/clang/Basic/OpenCLOptions.h | 175 +-
18 clang/include/clang/Driver/Options.td | 2 +-
19 clang/include/clang/Sema/Sema.h | 9 +
20 clang/lib/AST/ASTContext.cpp | 3 +-
21 clang/lib/Basic/Builtins.cpp | 28 +-
22 clang/lib/Basic/TargetInfo.cpp | 11 +
23 clang/lib/Basic/Targets.cpp | 1 -
24 clang/lib/CodeGen/CodeGenFunction.cpp | 6 +-
25 clang/lib/Frontend/CompilerInvocation.cpp | 22 +-
26 clang/lib/Frontend/InitPreprocessor.cpp | 6 +-
27 clang/lib/Headers/opencl-c-base.h | 75 +-
28 clang/lib/Headers/opencl-c.h | 3228 ++++++++++++++---
29 clang/lib/Parse/ParseDecl.cpp | 12 +-
30 clang/lib/Parse/ParsePragma.cpp | 10 +-
31 clang/lib/Sema/OpenCLBuiltins.td | 49 +-
32 clang/lib/Sema/Sema.cpp | 47 +-
33 clang/lib/Sema/SemaChecking.cpp | 38 +-
34 clang/lib/Sema/SemaDecl.cpp | 15 +-
35 clang/lib/Sema/SemaDeclAttr.cpp | 9 +-
36 clang/lib/Sema/SemaDeclCXX.cpp | 10 +
37 clang/lib/Sema/SemaLookup.cpp | 19 +-
38 clang/lib/Sema/SemaType.cpp | 14 +-
39 .../CodeGenOpenCL/addr-space-struct-arg.cl | 7 +-
40 .../address-spaces-conversions.cl | 2 +
41 .../CodeGenOpenCL/address-spaces-mangling.cl | 3 +-
42 clang/test/CodeGenOpenCL/address-spaces.cl | 4 +
43 .../amdgcn-automatic-variable.cl | 1 +
44 .../CodeGenOpenCL/amdgpu-sizeof-alignof.cl | 21 +-
45 .../CodeGenOpenCL/arm-integer-dot-product.cl | 1 +
46 .../test/CodeGenOpenCL/cl-uniform-wg-size.cl | 2 +
47 clang/test/CodeGenOpenCL/fpmath.cl | 2 +
48 .../generic-address-space-feature.cl | 28 +
49 .../intel-subgroups-avc-ext-types.cl | 1 +
50 .../kernels-have-spir-cc-by-default.cl | 3 +
51 clang/test/CodeGenOpenCL/logical-ops.cl | 1 +
52 clang/test/CodeGenOpenCL/no-half.cl | 1 +
53 clang/test/CodeGenOpenCL/pipe_builtin.cl | 3 +
54 clang/test/CodeGenOpenCL/pipe_types.cl | 1 +
55 clang/test/CodeGenOpenCL/printf.cl | 2 +
56 clang/test/CodeGenOpenCL/unroll-hint.cl | 1 +
57 clang/test/Driver/autocomplete.c | 2 +
58 clang/test/Driver/opencl.cl | 2 +
59 clang/test/Driver/unknown-std.cl | 1 +
60 clang/test/Frontend/stdlang.c | 1 +
61 clang/test/Headers/opencl-c-header.cl | 7 +-
62 clang/test/Index/pipe-size.cl | 7 +
63 clang/test/Preprocessor/predefined-macros.c | 13 +
64 .../Sema/feature-extensions-simult-support.cl | 75 +
65 clang/test/Sema/features-ignore-pragma.cl | 24 +
66 clang/test/Sema/opencl-features-pipes.cl | 18 +
67 clang/test/Sema/opencl-features.cl | 128 +
68 clang/test/Sema/pipe_builtins_feature.cl | 21 +
69 .../address-spaces-conversions-cl2.0.cl | 3 +
70 clang/test/SemaOpenCL/address-spaces.cl | 1 +
71 .../SemaOpenCL/cl20-device-side-enqueue.cl | 16 +-
72 .../SemaOpenCL/forget-unsupported-builtins.cl | 22 +
73 clang/test/SemaOpenCL/image-features.cl | 20 +
74 .../SemaOpenCL/invalid-pipe-builtin-cl2.0.cl | 1 +
75 clang/test/SemaOpenCL/storageclass-cl20.cl | 1 +
76 .../TableGen/ClangOpenCLBuiltinEmitter.cpp | 35 +-
77 67 files changed, 3656 insertions(+), 723 deletions(-)
78 create mode 100644 clang/test/CodeGenOpenCL/generic-address-space-feature.cl
79 create mode 100644 clang/test/Sema/feature-extensions-simult-support.cl
80 create mode 100644 clang/test/Sema/features-ignore-pragma.cl
81 create mode 100644 clang/test/Sema/opencl-features-pipes.cl
82 create mode 100644 clang/test/Sema/opencl-features.cl
83 create mode 100644 clang/test/Sema/pipe_builtins_feature.cl
84 create mode 100644 clang/test/SemaOpenCL/forget-unsupported-builtins.cl
85 create mode 100644 clang/test/SemaOpenCL/image-features.cl
86
87diff --git a/clang/include/clang/Basic/Builtins.def b/clang/include/clang/Basic/Builtins.def
88index 1a6c85ce2dd3..b76e277f0337 100644
89--- a/clang/include/clang/Basic/Builtins.def
90+++ b/clang/include/clang/Basic/Builtins.def
91@@ -106,6 +106,10 @@
92 # define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
93 #endif
94
95+#if defined(BUILTIN) && !defined(OPENCLBUILTIN)
96+# define OPENCLBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG, FEATURE) BUILTIN(ID, TYPE, ATTRS)
97+#endif
98+
99 // Standard libc/libm functions:
100 BUILTIN(__builtin_atan2 , "ddd" , "Fne")
101 BUILTIN(__builtin_atan2f, "fff" , "Fne")
102@@ -1514,50 +1518,54 @@ BUILTIN(__builtin_coro_param, "bv*v*", "n")
103
104 // OpenCL v2.0 s6.13.16, s9.17.3.5 - Pipe functions.
105 // We need the generic prototype, since the packet type could be anything.
106-LANGBUILTIN(read_pipe, "i.", "tn", OCLC20_LANG)
107-LANGBUILTIN(write_pipe, "i.", "tn", OCLC20_LANG)
108+OPENCLBUILTIN(read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
109+OPENCLBUILTIN(write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
110
111-LANGBUILTIN(reserve_read_pipe, "i.", "tn", OCLC20_LANG)
112-LANGBUILTIN(reserve_write_pipe, "i.", "tn", OCLC20_LANG)
113+OPENCLBUILTIN(reserve_read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
114+OPENCLBUILTIN(reserve_write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
115
116-LANGBUILTIN(commit_write_pipe, "v.", "tn", OCLC20_LANG)
117-LANGBUILTIN(commit_read_pipe, "v.", "tn", OCLC20_LANG)
118+OPENCLBUILTIN(commit_write_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
119+OPENCLBUILTIN(commit_read_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
120
121-LANGBUILTIN(sub_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG)
122-LANGBUILTIN(sub_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG)
123+OPENCLBUILTIN(sub_group_reserve_read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
124+OPENCLBUILTIN(sub_group_reserve_write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
125
126-LANGBUILTIN(sub_group_commit_read_pipe, "v.", "tn", OCLC20_LANG)
127-LANGBUILTIN(sub_group_commit_write_pipe, "v.", "tn", OCLC20_LANG)
128+OPENCLBUILTIN(sub_group_commit_read_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
129+OPENCLBUILTIN(sub_group_commit_write_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
130
131-LANGBUILTIN(work_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG)
132-LANGBUILTIN(work_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG)
133+OPENCLBUILTIN(work_group_reserve_read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
134+OPENCLBUILTIN(work_group_reserve_write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
135
136-LANGBUILTIN(work_group_commit_read_pipe, "v.", "tn", OCLC20_LANG)
137-LANGBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCLC20_LANG)
138+OPENCLBUILTIN(work_group_commit_read_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
139+OPENCLBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
140
141-LANGBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC20_LANG)
142-LANGBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC20_LANG)
143+OPENCLBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
144+OPENCLBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
145
146 // OpenCL v2.0 s6.13.17 - Enqueue kernel functions.
147 // Custom builtin check allows to perform special check of passed block arguments.
148-LANGBUILTIN(enqueue_kernel, "i.", "tn", OCLC20_LANG)
149-LANGBUILTIN(get_kernel_work_group_size, "Ui.", "tn", OCLC20_LANG)
150-LANGBUILTIN(get_kernel_preferred_work_group_size_multiple, "Ui.", "tn", OCLC20_LANG)
151-LANGBUILTIN(get_kernel_max_sub_group_size_for_ndrange, "Ui.", "tn", OCLC20_LANG)
152-LANGBUILTIN(get_kernel_sub_group_count_for_ndrange, "Ui.", "tn", OCLC20_LANG)
153+OPENCLBUILTIN(enqueue_kernel, "i.", "tn", OCLC2P_LANG,
154+ "__opencl_c_device_enqueue")
155+OPENCLBUILTIN(get_kernel_work_group_size, "Ui.", "tn", OCLC2P_LANG,
156+ "__opencl_c_device_enqueue")
157+OPENCLBUILTIN(get_kernel_preferred_work_group_size_multiple, "Ui.", "tn",
158+ OCLC2P_LANG, "__opencl_c_device_enqueue")
159+OPENCLBUILTIN(get_kernel_max_sub_group_size_for_ndrange, "Ui.", "tn",
160+ OCLC2P_LANG, "__opencl_c_device_enqueue")
161+OPENCLBUILTIN(get_kernel_sub_group_count_for_ndrange, "Ui.", "tn", OCLC2P_LANG, "__opencl_c_device_enqueue")
162
163 // OpenCL v2.0 s6.13.9 - Address space qualifier functions.
164 // FIXME: Pointer parameters of OpenCL builtins should have their address space
165 // requirement defined.
166-LANGBUILTIN(to_global, "v*v*", "tn", OCLC20_LANG)
167-LANGBUILTIN(to_local, "v*v*", "tn", OCLC20_LANG)
168-LANGBUILTIN(to_private, "v*v*", "tn", OCLC20_LANG)
169+OPENCLBUILTIN(to_global, "v*v*", "tn", OCLC2P_LANG, "__opencl_c_generic_address_space")
170+OPENCLBUILTIN(to_local, "v*v*", "tn", OCLC2P_LANG, "__opencl_c_generic_address_space")
171+OPENCLBUILTIN(to_private, "v*v*", "tn", OCLC2P_LANG, "__opencl_c_generic_address_space")
172
173 // OpenCL half load/store builtin
174-LANGBUILTIN(__builtin_store_half, "vdh*", "n", ALL_OCLC_LANGUAGES)
175-LANGBUILTIN(__builtin_store_halff, "vfh*", "n", ALL_OCLC_LANGUAGES)
176-LANGBUILTIN(__builtin_load_half, "dhC*", "nc", ALL_OCLC_LANGUAGES)
177-LANGBUILTIN(__builtin_load_halff, "fhC*", "nc", ALL_OCLC_LANGUAGES)
178+OPENCLBUILTIN(__builtin_store_half, "vdh*", "n", ALL_OCLC_LANGUAGES, "")
179+OPENCLBUILTIN(__builtin_store_halff, "vfh*", "n", ALL_OCLC_LANGUAGES, "")
180+OPENCLBUILTIN(__builtin_load_half, "dhC*", "nc", ALL_OCLC_LANGUAGES, "")
181+OPENCLBUILTIN(__builtin_load_halff, "fhC*", "nc", ALL_OCLC_LANGUAGES, "")
182
183 // Builtins for os_log/os_trace
184 BUILTIN(__builtin_os_log_format_buffer_size, "zcC*.", "p:0:nut")
185@@ -1578,3 +1586,4 @@ BUILTIN(__builtin_ms_va_copy, "vc*&c*&", "n")
186 #undef BUILTIN
187 #undef LIBBUILTIN
188 #undef LANGBUILTIN
189+#undef OPENCLBUILTIN
190diff --git a/clang/include/clang/Basic/Builtins.h b/clang/include/clang/Basic/Builtins.h
191index e4ed482d9068..713ea4bc267d 100644
192--- a/clang/include/clang/Basic/Builtins.h
193+++ b/clang/include/clang/Basic/Builtins.h
194@@ -33,13 +33,13 @@ enum LanguageID {
195 CXX_LANG = 0x4, // builtin for cplusplus only.
196 OBJC_LANG = 0x8, // builtin for objective-c and objective-c++
197 MS_LANG = 0x10, // builtin requires MS mode.
198- OCLC20_LANG = 0x20, // builtin for OpenCL C 2.0 only.
199+ OCLC2P_LANG = 0x20, // builtin for OpenCL C 2.0+ versions.
200 OCLC1X_LANG = 0x40, // builtin for OpenCL C 1.x only.
201 OMP_LANG = 0x80, // builtin requires OpenMP.
202 ALL_LANGUAGES = C_LANG | CXX_LANG | OBJC_LANG, // builtin for all languages.
203 ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG, // builtin requires GNU mode.
204 ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG, // builtin requires MS mode.
205- ALL_OCLC_LANGUAGES = OCLC1X_LANG | OCLC20_LANG // builtin for OCLC languages.
206+ ALL_OCLC_LANGUAGES = OCLC1X_LANG | OCLC2P_LANG // builtin for OCLC languages.
207 };
208
209 namespace Builtin {
210@@ -228,6 +228,10 @@ public:
211 /// for non-builtins.
212 bool canBeRedeclared(unsigned ID) const;
213
214+ bool requiresFeatures(unsigned ID) const {
215+ return requiresFeatures(getRecord(ID));
216+ }
217+
218 private:
219 const Info &getRecord(unsigned ID) const;
220
221@@ -235,6 +239,11 @@ private:
222 bool builtinIsSupported(const Builtin::Info &BuiltinInfo,
223 const LangOptions &LangOpts);
224
225+ bool OclBuiltinIsSupported(const Builtin::Info &BuiltinInfo,
226+ const LangOptions &LangOpts) const;
227+
228+ bool requiresFeatures(const Builtin::Info &BuiltinInfo) const;
229+
230 /// Helper function for isPrintfLike and isScanfLike.
231 bool isLike(unsigned ID, unsigned &FormatIdx, bool &HasVAListArg,
232 const char *Fmt) const;
233diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
234index 33adf093693f..43ea63586f91 100644
235--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
236+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
237@@ -1199,6 +1199,8 @@ def warn_pragma_unsupported_extension : Warning<
238 "unsupported OpenCL extension %0 - ignoring">, InGroup<IgnoredPragmas>;
239 def warn_pragma_extension_is_core : Warning<
240 "OpenCL extension %0 is core feature or supported optional core feature - ignoring">, InGroup<DiagGroup<"pedantic-core-features">>, DefaultIgnore;
241+def warn_opencl_pragma_feature_ignore : Warning<
242+ "OpenCL feature support can't be controlled via pragma, ignoring">, InGroup<IgnoredPragmas>;
243
244 // OpenCL errors.
245 def err_opencl_taking_function_address_parser : Error<
246diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
247index 917377420505..91648aa27820 100644
248--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
249+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
250@@ -9378,6 +9378,13 @@ def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
251 def err_openclcxx_placement_new : Error<
252 "use of placement new requires explicit declaration">;
253
254+def err_opencl_pipes_require_feat : Error<
255+ "usage of OpenCL pipes requires feature support">;
256+def err_opencl_memory_scope_require_feat : Error<
257+ "usage of memory scope requires feature support">;
258+def err_opencl_memory_ordering_require_feat : Error<
259+ "usage of memory ordering requires feature support">;
260+
261 // MIG routine annotations.
262 def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
263 "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
264diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def
265index 3319a3123976..406f45c0be69 100644
266--- a/clang/include/clang/Basic/LangOptions.def
267+++ b/clang/include/clang/Basic/LangOptions.def
268@@ -203,6 +203,8 @@ LANGOPT(OpenCL , 1, 0, "OpenCL")
269 LANGOPT(OpenCLVersion , 32, 0, "OpenCL C version")
270 LANGOPT(OpenCLCPlusPlus , 1, 0, "C++ for OpenCL")
271 LANGOPT(OpenCLCPlusPlusVersion , 32, 0, "C++ for OpenCL version")
272+LANGOPT(OpenCLGenericKeyword , 1, 0, "OpenCL generic keyword")
273+LANGOPT(OpenCLPipeKeyword , 1, 0, "OpenCL pipe keyword")
274 LANGOPT(NativeHalfType , 1, 0, "Native half type support")
275 LANGOPT(NativeHalfArgsAndReturns, 1, 0, "Native half args and returns")
276 LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns")
277diff --git a/clang/include/clang/Basic/LangStandards.def b/clang/include/clang/Basic/LangStandards.def
278index 7f1a24db7e9b..69aaba3ff5a2 100644
279--- a/clang/include/clang/Basic/LangStandards.def
280+++ b/clang/include/clang/Basic/LangStandards.def
281@@ -167,6 +167,9 @@ LANGSTANDARD(opencl12, "cl1.2",
282 LANGSTANDARD(opencl20, "cl2.0",
283 OpenCL, "OpenCL 2.0",
284 LineComment | C99 | Digraphs | HexFloat | OpenCL)
285+LANGSTANDARD(opencl30, "cl3.0",
286+ OpenCL, "OpenCL 3.0",
287+ LineComment | C99 | Digraphs | HexFloat | OpenCL)
288 LANGSTANDARD(openclcpp, "clc++",
289 OpenCL, "C++ for OpenCL",
290 LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
291@@ -176,6 +179,7 @@ LANGSTANDARD_ALIAS_DEPR(opencl10, "CL")
292 LANGSTANDARD_ALIAS_DEPR(opencl11, "CL1.1")
293 LANGSTANDARD_ALIAS_DEPR(opencl12, "CL1.2")
294 LANGSTANDARD_ALIAS_DEPR(opencl20, "CL2.0")
295+LANGSTANDARD_ALIAS_DEPR(opencl30, "CL3.0")
296 LANGSTANDARD_ALIAS_DEPR(openclcpp, "CLC++")
297
298 // CUDA
299diff --git a/clang/include/clang/Basic/OpenCLExtensions.def b/clang/include/clang/Basic/OpenCLExtensions.def
300index 517481584313..608f78a13eef 100644
301--- a/clang/include/clang/Basic/OpenCLExtensions.def
302+++ b/clang/include/clang/Basic/OpenCLExtensions.def
303@@ -93,6 +93,21 @@ OPENCLEXT_INTERNAL(cl_intel_subgroups, 120, ~0U)
304 OPENCLEXT_INTERNAL(cl_intel_subgroups_short, 120, ~0U)
305 OPENCLEXT_INTERNAL(cl_intel_device_side_avc_motion_estimation, 120, ~0U)
306
307+OPENCLEXT_INTERNAL(__opencl_c_pipes, 200, ~0U)
308+OPENCLEXT_INTERNAL(__opencl_c_generic_address_space, 200, ~0U)
309+OPENCLEXT_INTERNAL(__opencl_c_work_group_collective_functions, 200, ~0U)
310+OPENCLEXT_INTERNAL(__opencl_c_atomic_order_acq_rel, 200, ~0U)
311+OPENCLEXT_INTERNAL(__opencl_c_atomic_order_seq_cst, 200, ~0U)
312+OPENCLEXT_INTERNAL(__opencl_c_atomic_scope_device, 200, ~0U)
313+OPENCLEXT_INTERNAL(__opencl_c_atomic_scope_all_devices, 200, ~0U)
314+OPENCLEXT_INTERNAL(__opencl_c_subgroups, 200, ~0U)
315+OPENCLEXT_INTERNAL(__opencl_c_3d_image_writes, 100, ~0U)
316+OPENCLEXT_INTERNAL(__opencl_c_device_enqueue, 200, ~0U)
317+OPENCLEXT_INTERNAL(__opencl_c_read_write_images, 200, ~0U)
318+OPENCLEXT_INTERNAL(__opencl_c_program_scope_global_variables, 200, ~0U)
319+OPENCLEXT_INTERNAL(__opencl_c_fp64, 120, ~0U)
320+OPENCLEXT_INTERNAL(__opencl_c_int64, 100, ~0U)
321+OPENCLEXT_INTERNAL(__opencl_c_images, 100, ~0U)
322 #undef OPENCLEXT_INTERNAL
323
324 #ifdef OPENCLEXT
325diff --git a/clang/include/clang/Basic/OpenCLOptions.h b/clang/include/clang/Basic/OpenCLOptions.h
326index 15661154eab5..9a3a8e33cadd 100644
327--- a/clang/include/clang/Basic/OpenCLOptions.h
328+++ b/clang/include/clang/Basic/OpenCLOptions.h
329@@ -16,11 +16,16 @@
330
331 #include "clang/Basic/LangOptions.h"
332 #include "llvm/ADT/StringMap.h"
333+#include "llvm/ADT/StringSwitch.h"
334
335 namespace clang {
336
337 /// OpenCL supported extensions and optional core features
338 class OpenCLOptions {
339+ // OpenCL Version
340+ unsigned CLVer = 120;
341+ bool IsOpenCLCPlusPlus = false;
342+
343 struct Info {
344 bool Supported; // Is this option supported
345 bool Enabled; // Is this option enabled
346@@ -31,7 +36,38 @@ class OpenCLOptions {
347 :Supported(S), Enabled(E), Avail(A), Core(C){}
348 };
349 llvm::StringMap<Info> OptMap;
350+
351 public:
352+ void setOpenCLVersion(const LangOptions &LO) {
353+ IsOpenCLCPlusPlus = LO.OpenCLCPlusPlus;
354+ CLVer = IsOpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
355+ }
356+
357+ // Get extension which is semantically equivalent to a given feature
358+ // if exists (e.g. __opencl_c_subgroups -> cl_khr_subgroups)
359+ llvm::Optional<StringRef> getEquivalentExtension(StringRef Feature) const {
360+ return llvm::StringSwitch<llvm::Optional<StringRef>>(Feature)
361+ .Case("__opencl_c_3d_image_writes",
362+ Optional<StringRef>("cl_khr_3d_image_writes"))
363+ .Case("__opencl_c_subgroups", Optional<StringRef>("cl_khr_subgroups"))
364+ .Case("__opencl_c_fp64", Optional<StringRef>("cl_khr_fp64"))
365+ .Default(Optional<StringRef>());
366+ }
367+
368+ // Same as above but for extensions
369+ llvm::Optional<StringRef> getEquivalentFeature(StringRef Extension) const {
370+ return llvm::StringSwitch<llvm::Optional<StringRef>>(Extension)
371+ .Case("cl_khr_3d_image_writes",
372+ Optional<StringRef>("__opencl_c_3d_image_writes"))
373+ .Case("cl_khr_subgroups", Optional<StringRef>("__opencl_c_subgroups"))
374+ .Case("cl_khr_fp64", Optional<StringRef>("__opencl_c_fp64"))
375+ .Default(Optional<StringRef>());
376+ }
377+
378+ bool isFeature(llvm::StringRef Ext) const {
379+ return Ext.startswith("__opencl_c");
380+ }
381+
382 bool isKnown(llvm::StringRef Ext) const {
383 return OptMap.find(Ext) != OptMap.end();
384 }
385@@ -42,32 +78,88 @@ public:
386
387 // Is supported as either an extension or an (optional) core feature for
388 // OpenCL version \p CLVer.
389- bool isSupported(llvm::StringRef Ext, const LangOptions &LO) const {
390+ bool isSupported(llvm::StringRef Ext) const {
391 // In C++ mode all extensions should work at least as in v2.0.
392- auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
393 auto I = OptMap.find(Ext)->getValue();
394 return I.Supported && I.Avail <= CLVer;
395 }
396
397 // Is supported (optional) OpenCL core features for OpenCL version \p CLVer.
398 // For supported extension, return false.
399- bool isSupportedCore(llvm::StringRef Ext, const LangOptions &LO) const {
400+ bool isSupportedCore(llvm::StringRef Ext) const {
401 // In C++ mode all extensions should work at least as in v2.0.
402- auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
403 auto I = OptMap.find(Ext)->getValue();
404 return I.Supported && I.Avail <= CLVer && I.Core != ~0U && CLVer >= I.Core;
405 }
406
407 // Is supported OpenCL extension for OpenCL version \p CLVer.
408 // For supported (optional) core feature, return false.
409- bool isSupportedExtension(llvm::StringRef Ext, const LangOptions &LO) const {
410+ bool isSupportedExtension(llvm::StringRef Ext) const {
411 // In C++ mode all extensions should work at least as in v2.0.
412- auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
413 auto I = OptMap.find(Ext)->getValue();
414 return I.Supported && I.Avail <= CLVer && (I.Core == ~0U || CLVer < I.Core);
415 }
416
417+ // Support features whose support is directly related to the
418+ // specific OpenCL version. For example, OpenCL 2.0 supports
419+ // all features that are optional in 3.0
420+ void adjustFeatures() {
421+ // Support int64 by default (assume compiling for FULL profile)
422+ OptMap["__opencl_c_int64"].Supported = true;
423+
424+ if (CLVer >= 300) {
425+ // Simultaneously support extension and corresponding feature
426+ for (llvm::StringRef F :
427+ {"__opencl_c_subgroups", "__opencl_c_3d_image_writes",
428+ "__opencl_c_fp64"}) {
429+ auto Ext = getEquivalentExtension(F);
430+ OptMap[*Ext].Supported = OptMap[F].Supported;
431+ }
432+
433+ // OpenCL C compilers that define the feature macro __opencl_c_pipes or
434+ // or __opencl_c_device_enqueue must also define the
435+ // feature macro __opencl_c_generic_address_space.
436+ if (OptMap["__opencl_c_pipes"].Supported ||
437+ OptMap["__opencl_c_device_enqueue"].Supported)
438+ OptMap["__opencl_c_generic_address_space"].Supported = true;
439+
440+ // OpenCL C compilers that define the feature macro
441+ // __opencl_c_3d_image_writes or __opencl_c_read_write_images must also
442+ // define the feature macro __opencl_c_images
443+ if (OptMap["__opencl_c_3d_image_writes"].Supported ||
444+ OptMap["__opencl_c_read_write_images"].Supported)
445+ OptMap["__opencl_c_images"].Supported = true;
446+
447+ // All other features are already supported with options
448+ // or in target settings
449+ return;
450+ }
451+
452+ auto FeaturesRange = llvm::make_filter_range(
453+ OptMap, [&](llvm::StringMapEntry<Info> &OptVal) {
454+ auto Opt = OptVal.getKey();
455+ return isFeature(Opt);
456+ });
457+
458+ for (auto &It : FeaturesRange) {
459+ auto &Info = It.getValue();
460+ // For OpenCL version less then 3.0 some
461+ // features should be supported simulateneously
462+ // with specific extension
463+ if (Optional<llvm::StringRef> Ext = getEquivalentExtension(It.getKey()))
464+ Info.Supported = Info.Enabled = OptMap[*Ext].Supported;
465+ else if (Info.Avail <= CLVer)
466+ Info.Supported = Info.Enabled = true;
467+ }
468+ }
469+
470 void enable(llvm::StringRef Ext, bool V = true) {
471+ // Ignore disabling extensions if corresponding features
472+ // already supported for OpenCL version higher then 3.0
473+ if (CLVer >= 300)
474+ if (Optional<llvm::StringRef> F = getEquivalentFeature(Ext))
475+ if (V != OptMap[*F].Enabled)
476+ return;
477 OptMap[Ext].Enabled = V;
478 }
479
480@@ -96,7 +188,7 @@ public:
481 OptMap[Ext].Supported = V;
482 }
483
484- OpenCLOptions(){
485+ OpenCLOptions() {
486 #define OPENCLEXT_INTERNAL(Ext, AvailVer, CoreVer) \
487 OptMap[#Ext].Avail = AvailVer; \
488 OptMap[#Ext].Core = CoreVer;
489@@ -104,35 +196,86 @@ public:
490 }
491
492 void addSupport(const OpenCLOptions &Opts) {
493+ assert(IsOpenCLCPlusPlus == Opts.IsOpenCLCPlusPlus && CLVer == Opts.CLVer);
494 for (auto &I:Opts.OptMap)
495- if (I.second.Supported)
496+ if (I.second.Supported) {
497 OptMap[I.getKey()].Supported = true;
498+ // All features are enabled as they are supported
499+ if (isFeature(I.getKey()))
500+ OptMap[I.getKey()].Enabled = true;
501+ }
502+ if (CLVer >= 300) {
503+ // Enabling extensions with respect to features
504+ for (llvm::StringRef Ext :
505+ {"cl_khr_3d_image_writes", "cl_khr_subgroups", "cl_khr_fp64"}) {
506+ auto Feature = getEquivalentFeature(Ext);
507+ enable(Ext, OptMap[*Feature].Enabled);
508+ }
509+ }
510 }
511
512 void copy(const OpenCLOptions &Opts) {
513+ CLVer = Opts.CLVer;
514+ IsOpenCLCPlusPlus = Opts.IsOpenCLCPlusPlus;
515 OptMap = Opts.OptMap;
516 }
517
518 // Turn on or off support of all options.
519 void supportAll(bool On = true) {
520- for (llvm::StringMap<Info>::iterator I = OptMap.begin(),
521- E = OptMap.end(); I != E; ++I)
522- I->second.Supported = On;
523+ for (llvm::StringMap<Info>::iterator I = OptMap.begin(), E = OptMap.end();
524+ I != E; ++I)
525+ if (!isFeature(I->getKey()))
526+ I->second.Supported = On;
527 }
528
529 void disableAll() {
530- for (llvm::StringMap<Info>::iterator I = OptMap.begin(),
531- E = OptMap.end(); I != E; ++I)
532- I->second.Enabled = false;
533+ for (llvm::StringMap<Info>::iterator I = OptMap.begin(), E = OptMap.end();
534+ I != E; ++I) {
535+ auto Ext = I->getKey();
536+ if (!isFeature(Ext))
537+ enable(Ext, false);
538+ }
539 }
540
541- void enableSupportedCore(LangOptions LO) {
542+ void enableSupportedCore() {
543 for (llvm::StringMap<Info>::iterator I = OptMap.begin(), E = OptMap.end();
544 I != E; ++I)
545- if (isSupportedCore(I->getKey(), LO))
546+ if (isSupportedCore(I->getKey()))
547 I->second.Enabled = true;
548 }
549
550+ // This enum specifies how OpenCL versions map into values
551+ // for encoding. This is used when generating built-ins
552+ // from tablegen
553+ enum OpenCLVersionsEncodings : unsigned short {
554+ OPENCL_C_100_CODE = 0x1,
555+ OPENCL_C_110_CODE = 0x2,
556+ OPENCL_C_120_CODE = 0x4,
557+ OPENCL_C_200_CODE = 0x8,
558+ OPENCL_C_300_CODE = 0x10,
559+ OPENCL_C_ALL_CODE = 0x1f
560+ };
561+
562+ // Encode version into single integer
563+ static unsigned short EncodeVersion(unsigned OpenCLVersion) {
564+ switch (OpenCLVersion) {
565+ default:
566+ llvm_unreachable("Unknown OpenCL version");
567+ case 0:
568+ return OpenCLVersionsEncodings::OPENCL_C_ALL_CODE;
569+ case 100:
570+ return OpenCLVersionsEncodings::OPENCL_C_100_CODE;
571+ case 110:
572+ return OpenCLVersionsEncodings::OPENCL_C_110_CODE;
573+ case 120:
574+ return OpenCLVersionsEncodings::OPENCL_C_120_CODE;
575+ case 200:
576+ return OpenCLVersionsEncodings::OPENCL_C_200_CODE;
577+ case 300:
578+ return OpenCLVersionsEncodings::OPENCL_C_300_CODE;
579+ }
580+ }
581+
582 friend class ASTWriter;
583 friend class ASTReader;
584 };
585diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
586index 391c895a453b..e03c22c749ad 100644
587--- a/clang/include/clang/Driver/Options.td
588+++ b/clang/include/clang/Driver/Options.td
589@@ -522,7 +522,7 @@ def cl_mad_enable : Flag<["-"], "cl-mad-enable">, Group<opencl_Group>, Flags<[CC
590 def cl_no_signed_zeros : Flag<["-"], "cl-no-signed-zeros">, Group<opencl_Group>, Flags<[CC1Option]>,
591 HelpText<"OpenCL only. Allow use of less precise no signed zeros computations in the generated binary.">;
592 def cl_std_EQ : Joined<["-"], "cl-std=">, Group<opencl_Group>, Flags<[CC1Option]>,
593- HelpText<"OpenCL language standard to compile for.">, Values<"cl,CL,cl1.1,CL1.1,cl1.2,CL1.2,cl2.0,CL2.0,clc++,CLC++">;
594+ 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++">;
595 def cl_denorms_are_zero : Flag<["-"], "cl-denorms-are-zero">, Group<opencl_Group>, Flags<[CC1Option]>,
596 HelpText<"OpenCL only. Allow denormals to be flushed to zero.">;
597 def cl_fp32_correctly_rounded_divide_sqrt : Flag<["-"], "cl-fp32-correctly-rounded-divide-sqrt">, Group<opencl_Group>, Flags<[CC1Option]>,
598diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
599index 842e49602274..d8ac91bc8a31 100644
600--- a/clang/include/clang/Sema/Sema.h
601+++ b/clang/include/clang/Sema/Sema.h
602@@ -9632,6 +9632,10 @@ public:
603 /// \return true if type is disabled.
604 bool checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E);
605
606+ bool checkOpenCLSubgroupExtForCallExpr(CallExpr *Call);
607+
608+ bool isSupportedOpenCLOMemoryOrdering(int64_t Ordering) const;
609+
610 //===--------------------------------------------------------------------===//
611 // OpenMP directives and clauses.
612 //
613@@ -11102,6 +11106,11 @@ public:
614 /// that the user intended an assignment used as condition.
615 void DiagnoseEqualityWithExtraParens(ParenExpr *ParenE);
616
617+ template <typename DiagLocT, typename DiagInfoT>
618+ void DiagnoseOpenCLRequiresOption(llvm::StringRef OpenCLOptName,
619+ DiagLocT DiagLoc, DiagInfoT DiagInfo,
620+ unsigned Selector, SourceRange SrcRange);
621+
622 /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
623 ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr = false);
624
625diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
626index 1be72efe4de8..2a81fbcde79d 100644
627--- a/clang/lib/AST/ASTContext.cpp
628+++ b/clang/lib/AST/ASTContext.cpp
629@@ -1490,7 +1490,8 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target,
630 ObjCSuperType = QualType();
631
632 // void * type
633- if (LangOpts.OpenCLVersion >= 200) {
634+ if (Target.getSupportedOpenCLOpts().isEnabled(
635+ "__opencl_c_generic_address_space")) {
636 auto Q = VoidTy.getQualifiers();
637 Q.setAddressSpace(LangAS::opencl_generic);
638 VoidPtrTy = getPointerType(getCanonicalType(
639diff --git a/clang/lib/Basic/Builtins.cpp b/clang/lib/Basic/Builtins.cpp
640index 0cd89df41b67..7a3067345098 100644
641--- a/clang/lib/Basic/Builtins.cpp
642+++ b/clang/lib/Basic/Builtins.cpp
643@@ -23,6 +23,8 @@ static const Builtin::Info BuiltinInfo[] = {
644 { #ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr },
645 #define LANGBUILTIN(ID, TYPE, ATTRS, LANGS) \
646 { #ID, TYPE, ATTRS, nullptr, LANGS, nullptr },
647+#define OPENCLBUILTIN(ID, TYPE, ATTRS, LANGS, FEATURE) \
648+ {#ID, TYPE, ATTRS, nullptr, LANGS, FEATURE},
649 #define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, LANGS) \
650 { #ID, TYPE, ATTRS, HEADER, LANGS, nullptr },
651 #include "clang/Basic/Builtins.def"
652@@ -69,16 +71,17 @@ bool Builtin::Context::builtinIsSupported(const Builtin::Info &BuiltinInfo,
653 bool ObjCUnsupported = !LangOpts.ObjC && BuiltinInfo.Langs == OBJC_LANG;
654 bool OclC1Unsupported = (LangOpts.OpenCLVersion / 100) != 1 &&
655 (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES ) == OCLC1X_LANG;
656- bool OclC2Unsupported =
657- (LangOpts.OpenCLVersion != 200 && !LangOpts.OpenCLCPlusPlus) &&
658- (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES) == OCLC20_LANG;
659+ bool OclC2PUnsupported =
660+ (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES) == OCLC2P_LANG &&
661+ ((LangOpts.OpenCLVersion < 200 && !LangOpts.OpenCLCPlusPlus) ||
662+ !OclBuiltinIsSupported(BuiltinInfo, LangOpts));
663 bool OclCUnsupported = !LangOpts.OpenCL &&
664 (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES);
665 bool OpenMPUnsupported = !LangOpts.OpenMP && BuiltinInfo.Langs == OMP_LANG;
666 bool CPlusPlusUnsupported =
667 !LangOpts.CPlusPlus && BuiltinInfo.Langs == CXX_LANG;
668 return !BuiltinsUnsupported && !MathBuiltinsUnsupported && !OclCUnsupported &&
669- !OclC1Unsupported && !OclC2Unsupported && !OpenMPUnsupported &&
670+ !OclC1Unsupported && !OclC2PUnsupported && !OpenMPUnsupported &&
671 !GnuModeUnsupported && !MSModeUnsupported && !ObjCUnsupported &&
672 !CPlusPlusUnsupported;
673 }
674@@ -191,3 +194,20 @@ bool Builtin::Context::canBeRedeclared(unsigned ID) const {
675 (!hasReferenceArgsOrResult(ID) &&
676 !hasCustomTypechecking(ID));
677 }
678+
679+bool Builtin::Context::OclBuiltinIsSupported(
680+ const Builtin::Info &BuiltinInfo, const LangOptions &LangOpts) const {
681+ if (!requiresFeatures(BuiltinInfo))
682+ return true;
683+
684+ return llvm::StringSwitch<bool>(BuiltinInfo.Features)
685+ .Case("__opencl_c_device_enqueue", LangOpts.Blocks)
686+ .Case("__opencl_c_generic_address_space", LangOpts.OpenCLGenericKeyword)
687+ .Case("__opencl_c_pipes", LangOpts.OpenCLPipeKeyword)
688+ .Default(false);
689+}
690+
691+bool Builtin::Context::requiresFeatures(
692+ const Builtin::Info &BuiltinInfo) const {
693+ return BuiltinInfo.Features && llvm::StringRef(BuiltinInfo.Features) != "";
694+}
695diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
696index 3a21a19e1f19..795311d5934e 100644
697--- a/clang/lib/Basic/TargetInfo.cpp
698+++ b/clang/lib/Basic/TargetInfo.cpp
699@@ -377,6 +377,17 @@ void TargetInfo::adjust(LangOptions &Opts) {
700 HalfFormat = &llvm::APFloat::IEEEhalf();
701 FloatFormat = &llvm::APFloat::IEEEsingle();
702 LongDoubleFormat = &llvm::APFloat::IEEEquad();
703+
704+ auto &SupportedOCLOpts = getTargetOpts().SupportedOpenCLOptions;
705+
706+ SupportedOCLOpts.setOpenCLVersion(Opts);
707+ SupportedOCLOpts.adjustFeatures();
708+
709+ if (!Opts.OpenCLCPlusPlus && Opts.OpenCLVersion >= 200)
710+ Opts.Blocks = SupportedOCLOpts.isSupported("__opencl_c_device_enqueue");
711+ Opts.OpenCLGenericKeyword =
712+ SupportedOCLOpts.isSupported("__opencl_c_generic_address_space");
713+ Opts.OpenCLPipeKeyword = SupportedOCLOpts.isSupported("__opencl_c_pipes");
714 }
715
716 if (Opts.LongDoubleSize) {
717diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
718index c063f8ca4472..b394be18a234 100644
719--- a/clang/lib/Basic/Targets.cpp
720+++ b/clang/lib/Basic/Targets.cpp
721@@ -39,7 +39,6 @@
722 #include "clang/Basic/Diagnostic.h"
723 #include "llvm/ADT/StringExtras.h"
724 #include "llvm/ADT/Triple.h"
725-
726 using namespace clang;
727
728 namespace clang {
729diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
730index 648e6d9c214a..6d839fa61abc 100644
731--- a/clang/lib/CodeGen/CodeGenFunction.cpp
732+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
733@@ -2303,11 +2303,11 @@ void CodeGenFunction::checkTargetFeatures(SourceLocation Loc,
734 std::string MissingFeature;
735 if (BuiltinID) {
736 SmallVector<StringRef, 1> ReqFeatures;
737- const char *FeatureList =
738- CGM.getContext().BuiltinInfo.getRequiredFeatures(BuiltinID);
739 // Return if the builtin doesn't have any required features.
740- if (!FeatureList || StringRef(FeatureList) == "")
741+ if (!CGM.getContext().BuiltinInfo.requiresFeatures(BuiltinID))
742 return;
743+ const char *FeatureList =
744+ CGM.getContext().BuiltinInfo.getRequiredFeatures(BuiltinID);
745 StringRef(FeatureList).split(ReqFeatures, ',');
746 if (!hasRequiredFeatures(ReqFeatures, CGM, FD, MissingFeature))
747 CGM.getDiags().Report(Loc, diag::err_builtin_needs_feature)
748diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
749index e98a407ac42f..18fa06bf3c6d 100644
750--- a/clang/lib/Frontend/CompilerInvocation.cpp
751+++ b/clang/lib/Frontend/CompilerInvocation.cpp
752@@ -2298,6 +2298,8 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
753 Opts.OpenCLVersion = 120;
754 else if (LangStd == LangStandard::lang_opencl20)
755 Opts.OpenCLVersion = 200;
756+ else if (LangStd == LangStandard::lang_opencl30)
757+ Opts.OpenCLVersion = 300;
758 else if (LangStd == LangStandard::lang_openclcpp)
759 Opts.OpenCLCPlusPlusVersion = 100;
760
761@@ -2498,14 +2500,15 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
762 // -cl-std only applies for OpenCL language standards.
763 // Override the -std option in this case.
764 if (const Arg *A = Args.getLastArg(OPT_cl_std_EQ)) {
765- LangStandard::Kind OpenCLLangStd
766- = llvm::StringSwitch<LangStandard::Kind>(A->getValue())
767- .Cases("cl", "CL", LangStandard::lang_opencl10)
768- .Cases("cl1.1", "CL1.1", LangStandard::lang_opencl11)
769- .Cases("cl1.2", "CL1.2", LangStandard::lang_opencl12)
770- .Cases("cl2.0", "CL2.0", LangStandard::lang_opencl20)
771- .Cases("clc++", "CLC++", LangStandard::lang_openclcpp)
772- .Default(LangStandard::lang_unspecified);
773+ LangStandard::Kind OpenCLLangStd =
774+ llvm::StringSwitch<LangStandard::Kind>(A->getValue())
775+ .Cases("cl", "CL", LangStandard::lang_opencl10)
776+ .Cases("cl1.1", "CL1.1", LangStandard::lang_opencl11)
777+ .Cases("cl1.2", "CL1.2", LangStandard::lang_opencl12)
778+ .Cases("cl2.0", "CL2.0", LangStandard::lang_opencl20)
779+ .Cases("cl3.0", "CL3.0", LangStandard::lang_opencl30)
780+ .Cases("clc++", "CLC++", LangStandard::lang_openclcpp)
781+ .Default(LangStandard::lang_unspecified);
782
783 if (OpenCLLangStd == LangStandard::lang_unspecified) {
784 Diags.Report(diag::err_drv_invalid_value)
785@@ -2787,8 +2790,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
786
787 Opts.RTTI = Opts.CPlusPlus && !Args.hasArg(OPT_fno_rtti);
788 Opts.RTTIData = Opts.RTTI && !Args.hasArg(OPT_fno_rtti_data);
789- Opts.Blocks = Args.hasArg(OPT_fblocks) || (Opts.OpenCL
790- && Opts.OpenCLVersion == 200);
791+ Opts.Blocks = Args.hasArg(OPT_fblocks);
792 Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);
793 Opts.Coroutines = Opts.CPlusPlus2a || Args.hasArg(OPT_fcoroutines_ts);
794
795diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
796index c273cb96d9b9..aefd208e6cd3 100644
797--- a/clang/lib/Frontend/InitPreprocessor.cpp
798+++ b/clang/lib/Frontend/InitPreprocessor.cpp
799@@ -445,6 +445,9 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
800 case 200:
801 Builder.defineMacro("__OPENCL_C_VERSION__", "200");
802 break;
803+ case 300:
804+ Builder.defineMacro("__OPENCL_C_VERSION__", "300");
805+ break;
806 default:
807 llvm_unreachable("Unsupported OpenCL version");
808 }
809@@ -453,6 +456,7 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
810 Builder.defineMacro("CL_VERSION_1_1", "110");
811 Builder.defineMacro("CL_VERSION_1_2", "120");
812 Builder.defineMacro("CL_VERSION_2_0", "200");
813+ Builder.defineMacro("CL_VERSION_3_0", "300");
814
815 if (TI.isLittleEndian())
816 Builder.defineMacro("__ENDIAN_LITTLE__");
817@@ -1101,7 +1105,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
818 // OpenCL definitions.
819 if (LangOpts.OpenCL) {
820 #define OPENCLEXT(Ext) \
821- if (TI.getSupportedOpenCLOpts().isSupported(#Ext, LangOpts)) \
822+ if (TI.getSupportedOpenCLOpts().isSupported(#Ext)) \
823 Builder.defineMacro(#Ext);
824 #include "clang/Basic/OpenCLExtensions.def"
825
826diff --git a/clang/lib/Headers/opencl-c-base.h b/clang/lib/Headers/opencl-c-base.h
827index 430e07d36f62..2cc688ccc3da 100644
828--- a/clang/lib/Headers/opencl-c-base.h
829+++ b/clang/lib/Headers/opencl-c-base.h
830@@ -9,6 +9,59 @@
831 #ifndef _OPENCL_BASE_H_
832 #define _OPENCL_BASE_H_
833
834+// Add predefined macros to build headers with standalone executable
835+#ifndef CL_VERSION_3_0
836+ #define CL_VERSION_3_0 300
837+#endif
838+
839+// Define features for 2.0 for header backward compatibility
840+#ifndef __opencl_c_int64
841+ #define __opencl_c_int64 1
842+#endif
843+#if __OPENCL_C_VERSION__ != CL_VERSION_3_0
844+ #ifndef __opencl_c_images
845+ #define __opencl_c_images 1
846+ #endif
847+#endif
848+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
849+#ifndef __opencl_c_pipes
850+ #define __opencl_c_pipes 1
851+#endif
852+#ifndef __opencl_c_generic_address_space
853+ #define __opencl_c_generic_address_space 1
854+#endif
855+#ifndef __opencl_c_work_group_collective_functions
856+ #define __opencl_c_work_group_collective_functions 1
857+#endif
858+#ifndef __opencl_c_atomic_order_acq_rel
859+ #define __opencl_c_atomic_order_acq_rel 1
860+#endif
861+#ifndef __opencl_c_atomic_order_seq_cst
862+ #define __opencl_c_atomic_order_seq_cst 1
863+#endif
864+#ifndef __opencl_c_atomic_scope_device
865+ #define __opencl_c_atomic_scope_device 1
866+#endif
867+#ifndef __opencl_c_atomic_scope_all_devices
868+ #define __opencl_c_atomic_scope_all_devices 1
869+#endif
870+#ifndef __opencl_c_subgroups
871+ #define __opencl_c_subgroups 1
872+#endif
873+#ifndef __opencl_c_3d_image_writes
874+ #define __opencl_c_3d_image_writes 1
875+#endif
876+#ifndef __opencl_c_device_enqueue
877+ #define __opencl_c_device_enqueue 1
878+#endif
879+#ifndef __opencl_c_read_write_images
880+ #define __opencl_c_read_write_images 1
881+#endif
882+#ifndef __opencl_c_program_scope_global_variables
883+ #define __opencl_c_program_scope_global_variables 1
884+#endif
885+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
886+
887 // built-in scalar data types:
888
889 /**
890@@ -115,7 +168,12 @@ typedef half half4 __attribute__((ext_vector_type(4)));
891 typedef half half8 __attribute__((ext_vector_type(8)));
892 typedef half half16 __attribute__((ext_vector_type(16)));
893 #endif
894-#ifdef cl_khr_fp64
895+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
896+
897+#ifndef __opencl_c_fp64
898+ #define __opencl_c_fp64 1
899+#endif
900+
901 #if __OPENCL_C_VERSION__ < CL_VERSION_1_2
902 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
903 #endif
904@@ -281,9 +339,17 @@ typedef uint cl_mem_fence_flags;
905 typedef enum memory_scope {
906 memory_scope_work_item = __OPENCL_MEMORY_SCOPE_WORK_ITEM,
907 memory_scope_work_group = __OPENCL_MEMORY_SCOPE_WORK_GROUP,
908+#ifdef __opencl_c_atomic_scope_device
909 memory_scope_device = __OPENCL_MEMORY_SCOPE_DEVICE,
910+#endif
911+#ifdef __opencl_c_atomic_scope_all_devices
912+ #if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
913+ memory_scope_all_devices = __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES,
914+ #endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
915 memory_scope_all_svm_devices = __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES,
916-#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups)
917+#endif
918+#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups) || \
919+ defined(__opencl_c_subgroups)
920 memory_scope_sub_group = __OPENCL_MEMORY_SCOPE_SUB_GROUP
921 #endif
922 } memory_scope;
923@@ -301,13 +367,14 @@ typedef enum memory_scope {
924 #define ATOMIC_FLAG_INIT 0
925
926 // enum values aligned with what clang uses in EmitAtomicExpr()
927-typedef enum memory_order
928-{
929+typedef enum memory_order {
930 memory_order_relaxed = __ATOMIC_RELAXED,
931 memory_order_acquire = __ATOMIC_ACQUIRE,
932 memory_order_release = __ATOMIC_RELEASE,
933 memory_order_acq_rel = __ATOMIC_ACQ_REL,
934+#ifdef __opencl_c_atomic_order_seq_cst
935 memory_order_seq_cst = __ATOMIC_SEQ_CST
936+#endif //__opencl_c_atomic_order_seq_cst
937 } memory_order;
938
939 #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
940diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
941index 3210f93cc851..93a946cec5b1 100644
942--- a/clang/lib/Headers/opencl-c.h
943+++ b/clang/lib/Headers/opencl-c.h
944@@ -35,7 +35,6 @@
945 #define __purefn __attribute__((pure))
946 #define __cnfn __attribute__((const))
947
948-
949 // OpenCL v1.1/1.2/2.0 s6.2.3 - Explicit conversions
950
951 char __ovld __cnfn convert_char_rte(char);
952@@ -4632,7 +4631,7 @@ float16 __ovld __cnfn convert_float16(float16);
953
954 // Conversions with double data type parameters or return value.
955
956-#ifdef cl_khr_fp64
957+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
958 char __ovld __cnfn convert_char(double);
959 char __ovld __cnfn convert_char_rte(double);
960 char __ovld __cnfn convert_char_rtn(double);
961@@ -5452,7 +5451,7 @@ double16 __ovld __cnfn convert_double16_rtz(uchar16);
962 double16 __ovld __cnfn convert_double16_rtz(uint16);
963 double16 __ovld __cnfn convert_double16_rtz(ulong16);
964 double16 __ovld __cnfn convert_double16_rtz(ushort16);
965-#endif //cl_khr_fp64
966+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
967
968 #ifdef cl_khr_fp16
969 // Convert half types to non-double types.
970@@ -6270,7 +6269,7 @@ half16 __ovld __cnfn convert_half16_rtz(float16);
971 half16 __ovld __cnfn convert_half16_rtz(half16);
972
973 // Convert half types to double types.
974-#ifdef cl_khr_fp64
975+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
976 double __ovld __cnfn convert_double(half);
977 double __ovld __cnfn convert_double_rte(half);
978 double __ovld __cnfn convert_double_rtp(half);
979@@ -6333,7 +6332,7 @@ half16 __ovld __cnfn convert_half16_rte(double16);
980 half16 __ovld __cnfn convert_half16_rtp(double16);
981 half16 __ovld __cnfn convert_half16_rtn(double16);
982 half16 __ovld __cnfn convert_half16_rtz(double16);
983-#endif //cl_khr_fp64
984+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
985
986 #endif // cl_khr_fp16
987
988@@ -6404,14 +6403,14 @@ half16 __ovld __cnfn convert_half16_rtz(double16);
989 #define as_float8(x) __builtin_astype((x), float8)
990 #define as_float16(x) __builtin_astype((x), float16)
991
992-#ifdef cl_khr_fp64
993+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
994 #define as_double(x) __builtin_astype((x), double)
995 #define as_double2(x) __builtin_astype((x), double2)
996 #define as_double3(x) __builtin_astype((x), double3)
997 #define as_double4(x) __builtin_astype((x), double4)
998 #define as_double8(x) __builtin_astype((x), double8)
999 #define as_double16(x) __builtin_astype((x), double16)
1000-#endif //cl_khr_fp64
1001+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1002
1003 #ifdef cl_khr_fp16
1004 #define as_half(x) __builtin_astype((x), half)
1005@@ -6534,14 +6533,14 @@ float3 __ovld __cnfn acos(float3);
1006 float4 __ovld __cnfn acos(float4);
1007 float8 __ovld __cnfn acos(float8);
1008 float16 __ovld __cnfn acos(float16);
1009-#ifdef cl_khr_fp64
1010+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1011 double __ovld __cnfn acos(double);
1012 double2 __ovld __cnfn acos(double2);
1013 double3 __ovld __cnfn acos(double3);
1014 double4 __ovld __cnfn acos(double4);
1015 double8 __ovld __cnfn acos(double8);
1016 double16 __ovld __cnfn acos(double16);
1017-#endif //cl_khr_fp64
1018+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1019 #ifdef cl_khr_fp16
1020 half __ovld __cnfn acos(half);
1021 half2 __ovld __cnfn acos(half2);
1022@@ -6560,14 +6559,14 @@ float3 __ovld __cnfn acosh(float3);
1023 float4 __ovld __cnfn acosh(float4);
1024 float8 __ovld __cnfn acosh(float8);
1025 float16 __ovld __cnfn acosh(float16);
1026-#ifdef cl_khr_fp64
1027+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1028 double __ovld __cnfn acosh(double);
1029 double2 __ovld __cnfn acosh(double2);
1030 double3 __ovld __cnfn acosh(double3);
1031 double4 __ovld __cnfn acosh(double4);
1032 double8 __ovld __cnfn acosh(double8);
1033 double16 __ovld __cnfn acosh(double16);
1034-#endif //cl_khr_fp64
1035+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1036 #ifdef cl_khr_fp16
1037 half __ovld __cnfn acosh(half);
1038 half2 __ovld __cnfn acosh(half2);
1039@@ -6586,14 +6585,14 @@ float3 __ovld __cnfn acospi(float3 x);
1040 float4 __ovld __cnfn acospi(float4 x);
1041 float8 __ovld __cnfn acospi(float8 x);
1042 float16 __ovld __cnfn acospi(float16 x);
1043-#ifdef cl_khr_fp64
1044+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1045 double __ovld __cnfn acospi(double x);
1046 double2 __ovld __cnfn acospi(double2 x);
1047 double3 __ovld __cnfn acospi(double3 x);
1048 double4 __ovld __cnfn acospi(double4 x);
1049 double8 __ovld __cnfn acospi(double8 x);
1050 double16 __ovld __cnfn acospi(double16 x);
1051-#endif //cl_khr_fp64
1052+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1053 #ifdef cl_khr_fp16
1054 half __ovld __cnfn acospi(half x);
1055 half2 __ovld __cnfn acospi(half2 x);
1056@@ -6612,14 +6611,14 @@ float3 __ovld __cnfn asin(float3);
1057 float4 __ovld __cnfn asin(float4);
1058 float8 __ovld __cnfn asin(float8);
1059 float16 __ovld __cnfn asin(float16);
1060-#ifdef cl_khr_fp64
1061+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1062 double __ovld __cnfn asin(double);
1063 double2 __ovld __cnfn asin(double2);
1064 double3 __ovld __cnfn asin(double3);
1065 double4 __ovld __cnfn asin(double4);
1066 double8 __ovld __cnfn asin(double8);
1067 double16 __ovld __cnfn asin(double16);
1068-#endif //cl_khr_fp64
1069+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1070 #ifdef cl_khr_fp16
1071 half __ovld __cnfn asin(half);
1072 half2 __ovld __cnfn asin(half2);
1073@@ -6638,14 +6637,14 @@ float3 __ovld __cnfn asinh(float3);
1074 float4 __ovld __cnfn asinh(float4);
1075 float8 __ovld __cnfn asinh(float8);
1076 float16 __ovld __cnfn asinh(float16);
1077-#ifdef cl_khr_fp64
1078+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1079 double __ovld __cnfn asinh(double);
1080 double2 __ovld __cnfn asinh(double2);
1081 double3 __ovld __cnfn asinh(double3);
1082 double4 __ovld __cnfn asinh(double4);
1083 double8 __ovld __cnfn asinh(double8);
1084 double16 __ovld __cnfn asinh(double16);
1085-#endif //cl_khr_fp64
1086+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1087 #ifdef cl_khr_fp16
1088 half __ovld __cnfn asinh(half);
1089 half2 __ovld __cnfn asinh(half2);
1090@@ -6664,14 +6663,14 @@ float3 __ovld __cnfn asinpi(float3 x);
1091 float4 __ovld __cnfn asinpi(float4 x);
1092 float8 __ovld __cnfn asinpi(float8 x);
1093 float16 __ovld __cnfn asinpi(float16 x);
1094-#ifdef cl_khr_fp64
1095+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1096 double __ovld __cnfn asinpi(double x);
1097 double2 __ovld __cnfn asinpi(double2 x);
1098 double3 __ovld __cnfn asinpi(double3 x);
1099 double4 __ovld __cnfn asinpi(double4 x);
1100 double8 __ovld __cnfn asinpi(double8 x);
1101 double16 __ovld __cnfn asinpi(double16 x);
1102-#endif //cl_khr_fp64
1103+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1104 #ifdef cl_khr_fp16
1105 half __ovld __cnfn asinpi(half x);
1106 half2 __ovld __cnfn asinpi(half2 x);
1107@@ -6690,14 +6689,14 @@ float3 __ovld __cnfn atan(float3 y_over_x);
1108 float4 __ovld __cnfn atan(float4 y_over_x);
1109 float8 __ovld __cnfn atan(float8 y_over_x);
1110 float16 __ovld __cnfn atan(float16 y_over_x);
1111-#ifdef cl_khr_fp64
1112+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1113 double __ovld __cnfn atan(double y_over_x);
1114 double2 __ovld __cnfn atan(double2 y_over_x);
1115 double3 __ovld __cnfn atan(double3 y_over_x);
1116 double4 __ovld __cnfn atan(double4 y_over_x);
1117 double8 __ovld __cnfn atan(double8 y_over_x);
1118 double16 __ovld __cnfn atan(double16 y_over_x);
1119-#endif //cl_khr_fp64
1120+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1121 #ifdef cl_khr_fp16
1122 half __ovld __cnfn atan(half y_over_x);
1123 half2 __ovld __cnfn atan(half2 y_over_x);
1124@@ -6716,14 +6715,14 @@ float3 __ovld __cnfn atan2(float3 y, float3 x);
1125 float4 __ovld __cnfn atan2(float4 y, float4 x);
1126 float8 __ovld __cnfn atan2(float8 y, float8 x);
1127 float16 __ovld __cnfn atan2(float16 y, float16 x);
1128-#ifdef cl_khr_fp64
1129+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1130 double __ovld __cnfn atan2(double y, double x);
1131 double2 __ovld __cnfn atan2(double2 y, double2 x);
1132 double3 __ovld __cnfn atan2(double3 y, double3 x);
1133 double4 __ovld __cnfn atan2(double4 y, double4 x);
1134 double8 __ovld __cnfn atan2(double8 y, double8 x);
1135 double16 __ovld __cnfn atan2(double16 y, double16 x);
1136-#endif //cl_khr_fp64
1137+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1138 #ifdef cl_khr_fp16
1139 half __ovld __cnfn atan2(half y, half x);
1140 half2 __ovld __cnfn atan2(half2 y, half2 x);
1141@@ -6742,14 +6741,14 @@ float3 __ovld __cnfn atanh(float3);
1142 float4 __ovld __cnfn atanh(float4);
1143 float8 __ovld __cnfn atanh(float8);
1144 float16 __ovld __cnfn atanh(float16);
1145-#ifdef cl_khr_fp64
1146+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1147 double __ovld __cnfn atanh(double);
1148 double2 __ovld __cnfn atanh(double2);
1149 double3 __ovld __cnfn atanh(double3);
1150 double4 __ovld __cnfn atanh(double4);
1151 double8 __ovld __cnfn atanh(double8);
1152 double16 __ovld __cnfn atanh(double16);
1153-#endif //cl_khr_fp64
1154+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1155 #ifdef cl_khr_fp16
1156 half __ovld __cnfn atanh(half);
1157 half2 __ovld __cnfn atanh(half2);
1158@@ -6768,14 +6767,14 @@ float3 __ovld __cnfn atanpi(float3 x);
1159 float4 __ovld __cnfn atanpi(float4 x);
1160 float8 __ovld __cnfn atanpi(float8 x);
1161 float16 __ovld __cnfn atanpi(float16 x);
1162-#ifdef cl_khr_fp64
1163+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1164 double __ovld __cnfn atanpi(double x);
1165 double2 __ovld __cnfn atanpi(double2 x);
1166 double3 __ovld __cnfn atanpi(double3 x);
1167 double4 __ovld __cnfn atanpi(double4 x);
1168 double8 __ovld __cnfn atanpi(double8 x);
1169 double16 __ovld __cnfn atanpi(double16 x);
1170-#endif //cl_khr_fp64
1171+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1172 #ifdef cl_khr_fp16
1173 half __ovld __cnfn atanpi(half x);
1174 half2 __ovld __cnfn atanpi(half2 x);
1175@@ -6794,14 +6793,14 @@ float3 __ovld __cnfn atan2pi(float3 y, float3 x);
1176 float4 __ovld __cnfn atan2pi(float4 y, float4 x);
1177 float8 __ovld __cnfn atan2pi(float8 y, float8 x);
1178 float16 __ovld __cnfn atan2pi(float16 y, float16 x);
1179-#ifdef cl_khr_fp64
1180+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1181 double __ovld __cnfn atan2pi(double y, double x);
1182 double2 __ovld __cnfn atan2pi(double2 y, double2 x);
1183 double3 __ovld __cnfn atan2pi(double3 y, double3 x);
1184 double4 __ovld __cnfn atan2pi(double4 y, double4 x);
1185 double8 __ovld __cnfn atan2pi(double8 y, double8 x);
1186 double16 __ovld __cnfn atan2pi(double16 y, double16 x);
1187-#endif //cl_khr_fp64
1188+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1189 #ifdef cl_khr_fp16
1190 half __ovld __cnfn atan2pi(half y, half x);
1191 half2 __ovld __cnfn atan2pi(half2 y, half2 x);
1192@@ -6820,14 +6819,14 @@ float3 __ovld __cnfn cbrt(float3);
1193 float4 __ovld __cnfn cbrt(float4);
1194 float8 __ovld __cnfn cbrt(float8);
1195 float16 __ovld __cnfn cbrt(float16);
1196-#ifdef cl_khr_fp64
1197+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1198 double __ovld __cnfn cbrt(double);
1199 double2 __ovld __cnfn cbrt(double2);
1200 double3 __ovld __cnfn cbrt(double3);
1201 double4 __ovld __cnfn cbrt(double4);
1202 double8 __ovld __cnfn cbrt(double8);
1203 double16 __ovld __cnfn cbrt(double16);
1204-#endif //cl_khr_fp64
1205+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1206 #ifdef cl_khr_fp16
1207 half __ovld __cnfn cbrt(half);
1208 half2 __ovld __cnfn cbrt(half2);
1209@@ -6847,14 +6846,14 @@ float3 __ovld __cnfn ceil(float3);
1210 float4 __ovld __cnfn ceil(float4);
1211 float8 __ovld __cnfn ceil(float8);
1212 float16 __ovld __cnfn ceil(float16);
1213-#ifdef cl_khr_fp64
1214+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1215 double __ovld __cnfn ceil(double);
1216 double2 __ovld __cnfn ceil(double2);
1217 double3 __ovld __cnfn ceil(double3);
1218 double4 __ovld __cnfn ceil(double4);
1219 double8 __ovld __cnfn ceil(double8);
1220 double16 __ovld __cnfn ceil(double16);
1221-#endif //cl_khr_fp64
1222+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1223 #ifdef cl_khr_fp16
1224 half __ovld __cnfn ceil(half);
1225 half2 __ovld __cnfn ceil(half2);
1226@@ -6873,14 +6872,14 @@ float3 __ovld __cnfn copysign(float3 x, float3 y);
1227 float4 __ovld __cnfn copysign(float4 x, float4 y);
1228 float8 __ovld __cnfn copysign(float8 x, float8 y);
1229 float16 __ovld __cnfn copysign(float16 x, float16 y);
1230-#ifdef cl_khr_fp64
1231+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1232 double __ovld __cnfn copysign(double x, double y);
1233 double2 __ovld __cnfn copysign(double2 x, double2 y);
1234 double3 __ovld __cnfn copysign(double3 x, double3 y);
1235 double4 __ovld __cnfn copysign(double4 x, double4 y);
1236 double8 __ovld __cnfn copysign(double8 x, double8 y);
1237 double16 __ovld __cnfn copysign(double16 x, double16 y);
1238-#endif //cl_khr_fp64
1239+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1240 #ifdef cl_khr_fp16
1241 half __ovld __cnfn copysign(half x, half y);
1242 half2 __ovld __cnfn copysign(half2 x, half2 y);
1243@@ -6899,14 +6898,14 @@ float3 __ovld __cnfn cos(float3);
1244 float4 __ovld __cnfn cos(float4);
1245 float8 __ovld __cnfn cos(float8);
1246 float16 __ovld __cnfn cos(float16);
1247-#ifdef cl_khr_fp64
1248+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1249 double __ovld __cnfn cos(double);
1250 double2 __ovld __cnfn cos(double2);
1251 double3 __ovld __cnfn cos(double3);
1252 double4 __ovld __cnfn cos(double4);
1253 double8 __ovld __cnfn cos(double8);
1254 double16 __ovld __cnfn cos(double16);
1255-#endif //cl_khr_fp64
1256+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1257 #ifdef cl_khr_fp16
1258 half __ovld __cnfn cos(half);
1259 half2 __ovld __cnfn cos(half2);
1260@@ -6925,14 +6924,14 @@ float3 __ovld __cnfn cosh(float3);
1261 float4 __ovld __cnfn cosh(float4);
1262 float8 __ovld __cnfn cosh(float8);
1263 float16 __ovld __cnfn cosh(float16);
1264-#ifdef cl_khr_fp64
1265+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1266 double __ovld __cnfn cosh(double);
1267 double2 __ovld __cnfn cosh(double2);
1268 double3 __ovld __cnfn cosh(double3);
1269 double4 __ovld __cnfn cosh(double4);
1270 double8 __ovld __cnfn cosh(double8);
1271 double16 __ovld __cnfn cosh(double16);
1272-#endif //cl_khr_fp64
1273+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1274 #ifdef cl_khr_fp16
1275 half __ovld __cnfn cosh(half);
1276 half2 __ovld __cnfn cosh(half2);
1277@@ -6951,14 +6950,14 @@ float3 __ovld __cnfn cospi(float3 x);
1278 float4 __ovld __cnfn cospi(float4 x);
1279 float8 __ovld __cnfn cospi(float8 x);
1280 float16 __ovld __cnfn cospi(float16 x);
1281-#ifdef cl_khr_fp64
1282+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1283 double __ovld __cnfn cospi(double x);
1284 double2 __ovld __cnfn cospi(double2 x);
1285 double3 __ovld __cnfn cospi(double3 x);
1286 double4 __ovld __cnfn cospi(double4 x);
1287 double8 __ovld __cnfn cospi(double8 x);
1288 double16 __ovld __cnfn cospi(double16 x);
1289-#endif //cl_khr_fp64
1290+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1291 #ifdef cl_khr_fp16
1292 half __ovld __cnfn cospi(half x);
1293 half2 __ovld __cnfn cospi(half2 x);
1294@@ -6977,14 +6976,14 @@ float3 __ovld __cnfn erfc(float3);
1295 float4 __ovld __cnfn erfc(float4);
1296 float8 __ovld __cnfn erfc(float8);
1297 float16 __ovld __cnfn erfc(float16);
1298-#ifdef cl_khr_fp64
1299+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1300 double __ovld __cnfn erfc(double);
1301 double2 __ovld __cnfn erfc(double2);
1302 double3 __ovld __cnfn erfc(double3);
1303 double4 __ovld __cnfn erfc(double4);
1304 double8 __ovld __cnfn erfc(double8);
1305 double16 __ovld __cnfn erfc(double16);
1306-#endif //cl_khr_fp64
1307+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1308 #ifdef cl_khr_fp16
1309 half __ovld __cnfn erfc(half);
1310 half2 __ovld __cnfn erfc(half2);
1311@@ -7004,14 +7003,14 @@ float3 __ovld __cnfn erf(float3);
1312 float4 __ovld __cnfn erf(float4);
1313 float8 __ovld __cnfn erf(float8);
1314 float16 __ovld __cnfn erf(float16);
1315-#ifdef cl_khr_fp64
1316+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1317 double __ovld __cnfn erf(double);
1318 double2 __ovld __cnfn erf(double2);
1319 double3 __ovld __cnfn erf(double3);
1320 double4 __ovld __cnfn erf(double4);
1321 double8 __ovld __cnfn erf(double8);
1322 double16 __ovld __cnfn erf(double16);
1323-#endif //cl_khr_fp64
1324+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1325 #ifdef cl_khr_fp16
1326 half __ovld __cnfn erf(half);
1327 half2 __ovld __cnfn erf(half2);
1328@@ -7030,14 +7029,14 @@ float3 __ovld __cnfn exp(float3 x);
1329 float4 __ovld __cnfn exp(float4 x);
1330 float8 __ovld __cnfn exp(float8 x);
1331 float16 __ovld __cnfn exp(float16 x);
1332-#ifdef cl_khr_fp64
1333+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1334 double __ovld __cnfn exp(double x);
1335 double2 __ovld __cnfn exp(double2 x);
1336 double3 __ovld __cnfn exp(double3 x);
1337 double4 __ovld __cnfn exp(double4 x);
1338 double8 __ovld __cnfn exp(double8 x);
1339 double16 __ovld __cnfn exp(double16 x);
1340-#endif //cl_khr_fp64
1341+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1342 #ifdef cl_khr_fp16
1343 half __ovld __cnfn exp(half x);
1344 half2 __ovld __cnfn exp(half2 x);
1345@@ -7056,14 +7055,14 @@ float3 __ovld __cnfn exp2(float3);
1346 float4 __ovld __cnfn exp2(float4);
1347 float8 __ovld __cnfn exp2(float8);
1348 float16 __ovld __cnfn exp2(float16);
1349-#ifdef cl_khr_fp64
1350+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1351 double __ovld __cnfn exp2(double);
1352 double2 __ovld __cnfn exp2(double2);
1353 double3 __ovld __cnfn exp2(double3);
1354 double4 __ovld __cnfn exp2(double4);
1355 double8 __ovld __cnfn exp2(double8);
1356 double16 __ovld __cnfn exp2(double16);
1357-#endif //cl_khr_fp64
1358+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1359 #ifdef cl_khr_fp16
1360 half __ovld __cnfn exp2(half);
1361 half2 __ovld __cnfn exp2(half2);
1362@@ -7082,14 +7081,14 @@ float3 __ovld __cnfn exp10(float3);
1363 float4 __ovld __cnfn exp10(float4);
1364 float8 __ovld __cnfn exp10(float8);
1365 float16 __ovld __cnfn exp10(float16);
1366-#ifdef cl_khr_fp64
1367+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1368 double __ovld __cnfn exp10(double);
1369 double2 __ovld __cnfn exp10(double2);
1370 double3 __ovld __cnfn exp10(double3);
1371 double4 __ovld __cnfn exp10(double4);
1372 double8 __ovld __cnfn exp10(double8);
1373 double16 __ovld __cnfn exp10(double16);
1374-#endif //cl_khr_fp64
1375+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1376 #ifdef cl_khr_fp16
1377 half __ovld __cnfn exp10(half);
1378 half2 __ovld __cnfn exp10(half2);
1379@@ -7108,14 +7107,14 @@ float3 __ovld __cnfn expm1(float3 x);
1380 float4 __ovld __cnfn expm1(float4 x);
1381 float8 __ovld __cnfn expm1(float8 x);
1382 float16 __ovld __cnfn expm1(float16 x);
1383-#ifdef cl_khr_fp64
1384+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1385 double __ovld __cnfn expm1(double x);
1386 double2 __ovld __cnfn expm1(double2 x);
1387 double3 __ovld __cnfn expm1(double3 x);
1388 double4 __ovld __cnfn expm1(double4 x);
1389 double8 __ovld __cnfn expm1(double8 x);
1390 double16 __ovld __cnfn expm1(double16 x);
1391-#endif //cl_khr_fp64
1392+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1393 #ifdef cl_khr_fp16
1394 half __ovld __cnfn expm1(half x);
1395 half2 __ovld __cnfn expm1(half2 x);
1396@@ -7134,14 +7133,14 @@ float3 __ovld __cnfn fabs(float3);
1397 float4 __ovld __cnfn fabs(float4);
1398 float8 __ovld __cnfn fabs(float8);
1399 float16 __ovld __cnfn fabs(float16);
1400-#ifdef cl_khr_fp64
1401+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1402 double __ovld __cnfn fabs(double);
1403 double2 __ovld __cnfn fabs(double2);
1404 double3 __ovld __cnfn fabs(double3);
1405 double4 __ovld __cnfn fabs(double4);
1406 double8 __ovld __cnfn fabs(double8);
1407 double16 __ovld __cnfn fabs(double16);
1408-#endif //cl_khr_fp64
1409+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1410 #ifdef cl_khr_fp16
1411 half __ovld __cnfn fabs(half);
1412 half2 __ovld __cnfn fabs(half2);
1413@@ -7160,14 +7159,14 @@ float3 __ovld __cnfn fdim(float3 x, float3 y);
1414 float4 __ovld __cnfn fdim(float4 x, float4 y);
1415 float8 __ovld __cnfn fdim(float8 x, float8 y);
1416 float16 __ovld __cnfn fdim(float16 x, float16 y);
1417-#ifdef cl_khr_fp64
1418+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1419 double __ovld __cnfn fdim(double x, double y);
1420 double2 __ovld __cnfn fdim(double2 x, double2 y);
1421 double3 __ovld __cnfn fdim(double3 x, double3 y);
1422 double4 __ovld __cnfn fdim(double4 x, double4 y);
1423 double8 __ovld __cnfn fdim(double8 x, double8 y);
1424 double16 __ovld __cnfn fdim(double16 x, double16 y);
1425-#endif //cl_khr_fp64
1426+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1427 #ifdef cl_khr_fp16
1428 half __ovld __cnfn fdim(half x, half y);
1429 half2 __ovld __cnfn fdim(half2 x, half2 y);
1430@@ -7187,14 +7186,14 @@ float3 __ovld __cnfn floor(float3);
1431 float4 __ovld __cnfn floor(float4);
1432 float8 __ovld __cnfn floor(float8);
1433 float16 __ovld __cnfn floor(float16);
1434-#ifdef cl_khr_fp64
1435+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1436 double __ovld __cnfn floor(double);
1437 double2 __ovld __cnfn floor(double2);
1438 double3 __ovld __cnfn floor(double3);
1439 double4 __ovld __cnfn floor(double4);
1440 double8 __ovld __cnfn floor(double8);
1441 double16 __ovld __cnfn floor(double16);
1442-#endif //cl_khr_fp64
1443+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1444 #ifdef cl_khr_fp16
1445 half __ovld __cnfn floor(half);
1446 half2 __ovld __cnfn floor(half2);
1447@@ -7217,14 +7216,14 @@ float3 __ovld __cnfn fma(float3 a, float3 b, float3 c);
1448 float4 __ovld __cnfn fma(float4 a, float4 b, float4 c);
1449 float8 __ovld __cnfn fma(float8 a, float8 b, float8 c);
1450 float16 __ovld __cnfn fma(float16 a, float16 b, float16 c);
1451-#ifdef cl_khr_fp64
1452+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1453 double __ovld __cnfn fma(double a, double b, double c);
1454 double2 __ovld __cnfn fma(double2 a, double2 b, double2 c);
1455 double3 __ovld __cnfn fma(double3 a, double3 b, double3 c);
1456 double4 __ovld __cnfn fma(double4 a, double4 b, double4 c);
1457 double8 __ovld __cnfn fma(double8 a, double8 b, double8 c);
1458 double16 __ovld __cnfn fma(double16 a, double16 b, double16 c);
1459-#endif //cl_khr_fp64
1460+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1461 #ifdef cl_khr_fp16
1462 half __ovld __cnfn fma(half a, half b, half c);
1463 half2 __ovld __cnfn fma(half2 a, half2 b, half2 c);
1464@@ -7251,7 +7250,7 @@ float3 __ovld __cnfn fmax(float3 x, float y);
1465 float4 __ovld __cnfn fmax(float4 x, float y);
1466 float8 __ovld __cnfn fmax(float8 x, float y);
1467 float16 __ovld __cnfn fmax(float16 x, float y);
1468-#ifdef cl_khr_fp64
1469+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1470 double __ovld __cnfn fmax(double x, double y);
1471 double2 __ovld __cnfn fmax(double2 x, double2 y);
1472 double3 __ovld __cnfn fmax(double3 x, double3 y);
1473@@ -7263,7 +7262,7 @@ double3 __ovld __cnfn fmax(double3 x, double y);
1474 double4 __ovld __cnfn fmax(double4 x, double y);
1475 double8 __ovld __cnfn fmax(double8 x, double y);
1476 double16 __ovld __cnfn fmax(double16 x, double y);
1477-#endif //cl_khr_fp64
1478+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1479 #ifdef cl_khr_fp16
1480 half __ovld __cnfn fmax(half x, half y);
1481 half2 __ovld __cnfn fmax(half2 x, half2 y);
1482@@ -7295,7 +7294,7 @@ float3 __ovld __cnfn fmin(float3 x, float y);
1483 float4 __ovld __cnfn fmin(float4 x, float y);
1484 float8 __ovld __cnfn fmin(float8 x, float y);
1485 float16 __ovld __cnfn fmin(float16 x, float y);
1486-#ifdef cl_khr_fp64
1487+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1488 double __ovld __cnfn fmin(double x, double y);
1489 double2 __ovld __cnfn fmin(double2 x, double2 y);
1490 double3 __ovld __cnfn fmin(double3 x, double3 y);
1491@@ -7307,7 +7306,7 @@ double3 __ovld __cnfn fmin(double3 x, double y);
1492 double4 __ovld __cnfn fmin(double4 x, double y);
1493 double8 __ovld __cnfn fmin(double8 x, double y);
1494 double16 __ovld __cnfn fmin(double16 x, double y);
1495-#endif //cl_khr_fp64
1496+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1497 #ifdef cl_khr_fp16
1498 half __ovld __cnfn fmin(half x, half y);
1499 half2 __ovld __cnfn fmin(half2 x, half2 y);
1500@@ -7331,14 +7330,14 @@ float3 __ovld __cnfn fmod(float3 x, float3 y);
1501 float4 __ovld __cnfn fmod(float4 x, float4 y);
1502 float8 __ovld __cnfn fmod(float8 x, float8 y);
1503 float16 __ovld __cnfn fmod(float16 x, float16 y);
1504-#ifdef cl_khr_fp64
1505+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1506 double __ovld __cnfn fmod(double x, double y);
1507 double2 __ovld __cnfn fmod(double2 x, double2 y);
1508 double3 __ovld __cnfn fmod(double3 x, double3 y);
1509 double4 __ovld __cnfn fmod(double4 x, double4 y);
1510 double8 __ovld __cnfn fmod(double8 x, double8 y);
1511 double16 __ovld __cnfn fmod(double16 x, double16 y);
1512-#endif //cl_khr_fp64
1513+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1514 #ifdef cl_khr_fp16
1515 half __ovld __cnfn fmod(half x, half y);
1516 half2 __ovld __cnfn fmod(half2 x, half2 y);
1517@@ -7352,21 +7351,21 @@ half16 __ovld __cnfn fmod(half16 x, half16 y);
1518 * Returns fmin(x - floor (x), 0x1.fffffep-1f ).
1519 * floor(x) is returned in iptr.
1520 */
1521-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1522+#ifdef __opencl_c_generic_address_space
1523 float __ovld fract(float x, float *iptr);
1524 float2 __ovld fract(float2 x, float2 *iptr);
1525 float3 __ovld fract(float3 x, float3 *iptr);
1526 float4 __ovld fract(float4 x, float4 *iptr);
1527 float8 __ovld fract(float8 x, float8 *iptr);
1528 float16 __ovld fract(float16 x, float16 *iptr);
1529-#ifdef cl_khr_fp64
1530+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1531 double __ovld fract(double x, double *iptr);
1532 double2 __ovld fract(double2 x, double2 *iptr);
1533 double3 __ovld fract(double3 x, double3 *iptr);
1534 double4 __ovld fract(double4 x, double4 *iptr);
1535 double8 __ovld fract(double8 x, double8 *iptr);
1536 double16 __ovld fract(double16 x, double16 *iptr);
1537-#endif //cl_khr_fp64
1538+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1539 #ifdef cl_khr_fp16
1540 half __ovld fract(half x, half *iptr);
1541 half2 __ovld fract(half2 x, half2 *iptr);
1542@@ -7375,7 +7374,9 @@ half4 __ovld fract(half4 x, half4 *iptr);
1543 half8 __ovld fract(half8 x, half8 *iptr);
1544 half16 __ovld fract(half16 x, half16 *iptr);
1545 #endif //cl_khr_fp16
1546-#else
1547+#endif //__opencl_c_generic_address_space
1548+
1549+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
1550 float __ovld fract(float x, __global float *iptr);
1551 float2 __ovld fract(float2 x, __global float2 *iptr);
1552 float3 __ovld fract(float3 x, __global float3 *iptr);
1553@@ -7394,7 +7395,7 @@ float3 __ovld fract(float3 x, __private float3 *iptr);
1554 float4 __ovld fract(float4 x, __private float4 *iptr);
1555 float8 __ovld fract(float8 x, __private float8 *iptr);
1556 float16 __ovld fract(float16 x, __private float16 *iptr);
1557-#ifdef cl_khr_fp64
1558+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1559 double __ovld fract(double x, __global double *iptr);
1560 double2 __ovld fract(double2 x, __global double2 *iptr);
1561 double3 __ovld fract(double3 x, __global double3 *iptr);
1562@@ -7413,7 +7414,7 @@ double3 __ovld fract(double3 x, __private double3 *iptr);
1563 double4 __ovld fract(double4 x, __private double4 *iptr);
1564 double8 __ovld fract(double8 x, __private double8 *iptr);
1565 double16 __ovld fract(double16 x, __private double16 *iptr);
1566-#endif //cl_khr_fp64
1567+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1568 #ifdef cl_khr_fp16
1569 half __ovld fract(half x, __global half *iptr);
1570 half2 __ovld fract(half2 x, __global half2 *iptr);
1571@@ -7434,29 +7435,29 @@ half4 __ovld fract(half4 x, __private half4 *iptr);
1572 half8 __ovld fract(half8 x, __private half8 *iptr);
1573 half16 __ovld fract(half16 x, __private half16 *iptr);
1574 #endif //cl_khr_fp16
1575-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1576-
1577+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
1578+ //! CL_VERSION_2_0)
1579 /**
1580 * Extract mantissa and exponent from x. For each
1581 * component the mantissa returned is a float with
1582 * magnitude in the interval [1/2, 1) or 0. Each
1583 * component of x equals mantissa returned * 2^exp.
1584 */
1585-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1586+#ifdef __opencl_c_generic_address_space
1587 float __ovld frexp(float x, int *exp);
1588 float2 __ovld frexp(float2 x, int2 *exp);
1589 float3 __ovld frexp(float3 x, int3 *exp);
1590 float4 __ovld frexp(float4 x, int4 *exp);
1591 float8 __ovld frexp(float8 x, int8 *exp);
1592 float16 __ovld frexp(float16 x, int16 *exp);
1593-#ifdef cl_khr_fp64
1594+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1595 double __ovld frexp(double x, int *exp);
1596 double2 __ovld frexp(double2 x, int2 *exp);
1597 double3 __ovld frexp(double3 x, int3 *exp);
1598 double4 __ovld frexp(double4 x, int4 *exp);
1599 double8 __ovld frexp(double8 x, int8 *exp);
1600 double16 __ovld frexp(double16 x, int16 *exp);
1601-#endif //cl_khr_fp64
1602+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1603 #ifdef cl_khr_fp16
1604 half __ovld frexp(half x, int *exp);
1605 half2 __ovld frexp(half2 x, int2 *exp);
1606@@ -7465,7 +7466,9 @@ half4 __ovld frexp(half4 x, int4 *exp);
1607 half8 __ovld frexp(half8 x, int8 *exp);
1608 half16 __ovld frexp(half16 x, int16 *exp);
1609 #endif //cl_khr_fp16
1610-#else
1611+#endif //__opencl_c_generic_address_space
1612+
1613+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
1614 float __ovld frexp(float x, __global int *exp);
1615 float2 __ovld frexp(float2 x, __global int2 *exp);
1616 float3 __ovld frexp(float3 x, __global int3 *exp);
1617@@ -7484,7 +7487,7 @@ float3 __ovld frexp(float3 x, __private int3 *exp);
1618 float4 __ovld frexp(float4 x, __private int4 *exp);
1619 float8 __ovld frexp(float8 x, __private int8 *exp);
1620 float16 __ovld frexp(float16 x, __private int16 *exp);
1621-#ifdef cl_khr_fp64
1622+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1623 double __ovld frexp(double x, __global int *exp);
1624 double2 __ovld frexp(double2 x, __global int2 *exp);
1625 double3 __ovld frexp(double3 x, __global int3 *exp);
1626@@ -7503,7 +7506,7 @@ double3 __ovld frexp(double3 x, __private int3 *exp);
1627 double4 __ovld frexp(double4 x, __private int4 *exp);
1628 double8 __ovld frexp(double8 x, __private int8 *exp);
1629 double16 __ovld frexp(double16 x, __private int16 *exp);
1630-#endif //cl_khr_fp64
1631+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1632 #ifdef cl_khr_fp16
1633 half __ovld frexp(half x, __global int *exp);
1634 half2 __ovld frexp(half2 x, __global int2 *exp);
1635@@ -7524,7 +7527,8 @@ half4 __ovld frexp(half4 x, __private int4 *exp);
1636 half8 __ovld frexp(half8 x, __private int8 *exp);
1637 half16 __ovld frexp(half16 x, __private int16 *exp);
1638 #endif //cl_khr_fp16
1639-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1640+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
1641+ //! CL_VERSION_2_0)
1642
1643 /**
1644 * Compute the value of the square root of x^2 + y^2
1645@@ -7536,14 +7540,14 @@ float3 __ovld __cnfn hypot(float3 x, float3 y);
1646 float4 __ovld __cnfn hypot(float4 x, float4 y);
1647 float8 __ovld __cnfn hypot(float8 x, float8 y);
1648 float16 __ovld __cnfn hypot(float16 x, float16 y);
1649-#ifdef cl_khr_fp64
1650+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1651 double __ovld __cnfn hypot(double x, double y);
1652 double2 __ovld __cnfn hypot(double2 x, double2 y);
1653 double3 __ovld __cnfn hypot(double3 x, double3 y);
1654 double4 __ovld __cnfn hypot(double4 x, double4 y);
1655 double8 __ovld __cnfn hypot(double8 x, double8 y);
1656 double16 __ovld __cnfn hypot(double16 x, double16 y);
1657-#endif //cl_khr_fp64
1658+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1659 #ifdef cl_khr_fp16
1660 half __ovld __cnfn hypot(half x, half y);
1661 half2 __ovld __cnfn hypot(half2 x, half2 y);
1662@@ -7562,14 +7566,14 @@ int3 __ovld __cnfn ilogb(float3 x);
1663 int4 __ovld __cnfn ilogb(float4 x);
1664 int8 __ovld __cnfn ilogb(float8 x);
1665 int16 __ovld __cnfn ilogb(float16 x);
1666-#ifdef cl_khr_fp64
1667+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1668 int __ovld __cnfn ilogb(double x);
1669 int2 __ovld __cnfn ilogb(double2 x);
1670 int3 __ovld __cnfn ilogb(double3 x);
1671 int4 __ovld __cnfn ilogb(double4 x);
1672 int8 __ovld __cnfn ilogb(double8 x);
1673 int16 __ovld __cnfn ilogb(double16 x);
1674-#endif //cl_khr_fp64
1675+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1676 #ifdef cl_khr_fp16
1677 int __ovld __cnfn ilogb(half x);
1678 int2 __ovld __cnfn ilogb(half2 x);
1679@@ -7593,7 +7597,7 @@ float3 __ovld __cnfn ldexp(float3 x, int n);
1680 float4 __ovld __cnfn ldexp(float4 x, int n);
1681 float8 __ovld __cnfn ldexp(float8 x, int n);
1682 float16 __ovld __cnfn ldexp(float16 x, int n);
1683-#ifdef cl_khr_fp64
1684+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1685 double __ovld __cnfn ldexp(double x, int n);
1686 double2 __ovld __cnfn ldexp(double2 x, int2 n);
1687 double3 __ovld __cnfn ldexp(double3 x, int3 n);
1688@@ -7605,7 +7609,7 @@ double3 __ovld __cnfn ldexp(double3 x, int n);
1689 double4 __ovld __cnfn ldexp(double4 x, int n);
1690 double8 __ovld __cnfn ldexp(double8 x, int n);
1691 double16 __ovld __cnfn ldexp(double16 x, int n);
1692-#endif //cl_khr_fp64
1693+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1694 #ifdef cl_khr_fp16
1695 half __ovld __cnfn ldexp(half x, int n);
1696 half2 __ovld __cnfn ldexp(half2 x, int2 n);
1697@@ -7632,14 +7636,14 @@ float3 __ovld __cnfn lgamma(float3 x);
1698 float4 __ovld __cnfn lgamma(float4 x);
1699 float8 __ovld __cnfn lgamma(float8 x);
1700 float16 __ovld __cnfn lgamma(float16 x);
1701-#ifdef cl_khr_fp64
1702+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1703 double __ovld __cnfn lgamma(double x);
1704 double2 __ovld __cnfn lgamma(double2 x);
1705 double3 __ovld __cnfn lgamma(double3 x);
1706 double4 __ovld __cnfn lgamma(double4 x);
1707 double8 __ovld __cnfn lgamma(double8 x);
1708 double16 __ovld __cnfn lgamma(double16 x);
1709-#endif //cl_khr_fp64
1710+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1711 #ifdef cl_khr_fp16
1712 half __ovld __cnfn lgamma(half x);
1713 half2 __ovld __cnfn lgamma(half2 x);
1714@@ -7649,21 +7653,21 @@ half8 __ovld __cnfn lgamma(half8 x);
1715 half16 __ovld __cnfn lgamma(half16 x);
1716 #endif //cl_khr_fp16
1717
1718-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1719+#ifdef __opencl_c_generic_address_space
1720 float __ovld lgamma_r(float x, int *signp);
1721 float2 __ovld lgamma_r(float2 x, int2 *signp);
1722 float3 __ovld lgamma_r(float3 x, int3 *signp);
1723 float4 __ovld lgamma_r(float4 x, int4 *signp);
1724 float8 __ovld lgamma_r(float8 x, int8 *signp);
1725 float16 __ovld lgamma_r(float16 x, int16 *signp);
1726-#ifdef cl_khr_fp64
1727+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1728 double __ovld lgamma_r(double x, int *signp);
1729 double2 __ovld lgamma_r(double2 x, int2 *signp);
1730 double3 __ovld lgamma_r(double3 x, int3 *signp);
1731 double4 __ovld lgamma_r(double4 x, int4 *signp);
1732 double8 __ovld lgamma_r(double8 x, int8 *signp);
1733 double16 __ovld lgamma_r(double16 x, int16 *signp);
1734-#endif //cl_khr_fp64
1735+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1736 #ifdef cl_khr_fp16
1737 half __ovld lgamma_r(half x, int *signp);
1738 half2 __ovld lgamma_r(half2 x, int2 *signp);
1739@@ -7672,7 +7676,9 @@ half4 __ovld lgamma_r(half4 x, int4 *signp);
1740 half8 __ovld lgamma_r(half8 x, int8 *signp);
1741 half16 __ovld lgamma_r(half16 x, int16 *signp);
1742 #endif //cl_khr_fp16
1743-#else
1744+#endif //__opencl_c_generic_address_space
1745+
1746+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
1747 float __ovld lgamma_r(float x, __global int *signp);
1748 float2 __ovld lgamma_r(float2 x, __global int2 *signp);
1749 float3 __ovld lgamma_r(float3 x, __global int3 *signp);
1750@@ -7691,7 +7697,7 @@ float3 __ovld lgamma_r(float3 x, __private int3 *signp);
1751 float4 __ovld lgamma_r(float4 x, __private int4 *signp);
1752 float8 __ovld lgamma_r(float8 x, __private int8 *signp);
1753 float16 __ovld lgamma_r(float16 x, __private int16 *signp);
1754-#ifdef cl_khr_fp64
1755+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1756 double __ovld lgamma_r(double x, __global int *signp);
1757 double2 __ovld lgamma_r(double2 x, __global int2 *signp);
1758 double3 __ovld lgamma_r(double3 x, __global int3 *signp);
1759@@ -7710,7 +7716,7 @@ double3 __ovld lgamma_r(double3 x, __private int3 *signp);
1760 double4 __ovld lgamma_r(double4 x, __private int4 *signp);
1761 double8 __ovld lgamma_r(double8 x, __private int8 *signp);
1762 double16 __ovld lgamma_r(double16 x, __private int16 *signp);
1763-#endif //cl_khr_fp64
1764+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1765 #ifdef cl_khr_fp16
1766 half __ovld lgamma_r(half x, __global int *signp);
1767 half2 __ovld lgamma_r(half2 x, __global int2 *signp);
1768@@ -7731,8 +7737,8 @@ half4 __ovld lgamma_r(half4 x, __private int4 *signp);
1769 half8 __ovld lgamma_r(half8 x, __private int8 *signp);
1770 half16 __ovld lgamma_r(half16 x, __private int16 *signp);
1771 #endif //cl_khr_fp16
1772-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1773-
1774+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
1775+ //! CL_VERSION_2_0)
1776 /**
1777 * Compute natural logarithm.
1778 */
1779@@ -7742,14 +7748,14 @@ float3 __ovld __cnfn log(float3);
1780 float4 __ovld __cnfn log(float4);
1781 float8 __ovld __cnfn log(float8);
1782 float16 __ovld __cnfn log(float16);
1783-#ifdef cl_khr_fp64
1784+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1785 double __ovld __cnfn log(double);
1786 double2 __ovld __cnfn log(double2);
1787 double3 __ovld __cnfn log(double3);
1788 double4 __ovld __cnfn log(double4);
1789 double8 __ovld __cnfn log(double8);
1790 double16 __ovld __cnfn log(double16);
1791-#endif //cl_khr_fp64
1792+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1793 #ifdef cl_khr_fp16
1794 half __ovld __cnfn log(half);
1795 half2 __ovld __cnfn log(half2);
1796@@ -7760,7 +7766,7 @@ half16 __ovld __cnfn log(half16);
1797 #endif //cl_khr_fp16
1798
1799 /**
1800- * Compute a base 2 logarithm.
1801+ * Compute a base 2 logarithm
1802 */
1803 float __ovld __cnfn log2(float);
1804 float2 __ovld __cnfn log2(float2);
1805@@ -7768,14 +7774,14 @@ float3 __ovld __cnfn log2(float3);
1806 float4 __ovld __cnfn log2(float4);
1807 float8 __ovld __cnfn log2(float8);
1808 float16 __ovld __cnfn log2(float16);
1809-#ifdef cl_khr_fp64
1810+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1811 double __ovld __cnfn log2(double);
1812 double2 __ovld __cnfn log2(double2);
1813 double3 __ovld __cnfn log2(double3);
1814 double4 __ovld __cnfn log2(double4);
1815 double8 __ovld __cnfn log2(double8);
1816 double16 __ovld __cnfn log2(double16);
1817-#endif //cl_khr_fp64
1818+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1819 #ifdef cl_khr_fp16
1820 half __ovld __cnfn log2(half);
1821 half2 __ovld __cnfn log2(half2);
1822@@ -7794,14 +7800,14 @@ float3 __ovld __cnfn log10(float3);
1823 float4 __ovld __cnfn log10(float4);
1824 float8 __ovld __cnfn log10(float8);
1825 float16 __ovld __cnfn log10(float16);
1826-#ifdef cl_khr_fp64
1827+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1828 double __ovld __cnfn log10(double);
1829 double2 __ovld __cnfn log10(double2);
1830 double3 __ovld __cnfn log10(double3);
1831 double4 __ovld __cnfn log10(double4);
1832 double8 __ovld __cnfn log10(double8);
1833 double16 __ovld __cnfn log10(double16);
1834-#endif //cl_khr_fp64
1835+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1836 #ifdef cl_khr_fp16
1837 half __ovld __cnfn log10(half);
1838 half2 __ovld __cnfn log10(half2);
1839@@ -7820,14 +7826,14 @@ float3 __ovld __cnfn log1p(float3 x);
1840 float4 __ovld __cnfn log1p(float4 x);
1841 float8 __ovld __cnfn log1p(float8 x);
1842 float16 __ovld __cnfn log1p(float16 x);
1843-#ifdef cl_khr_fp64
1844+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1845 double __ovld __cnfn log1p(double x);
1846 double2 __ovld __cnfn log1p(double2 x);
1847 double3 __ovld __cnfn log1p(double3 x);
1848 double4 __ovld __cnfn log1p(double4 x);
1849 double8 __ovld __cnfn log1p(double8 x);
1850 double16 __ovld __cnfn log1p(double16 x);
1851-#endif //cl_khr_fp64
1852+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1853 #ifdef cl_khr_fp16
1854 half __ovld __cnfn log1p(half x);
1855 half2 __ovld __cnfn log1p(half2 x);
1856@@ -7847,14 +7853,14 @@ float3 __ovld __cnfn logb(float3 x);
1857 float4 __ovld __cnfn logb(float4 x);
1858 float8 __ovld __cnfn logb(float8 x);
1859 float16 __ovld __cnfn logb(float16 x);
1860-#ifdef cl_khr_fp64
1861+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1862 double __ovld __cnfn logb(double x);
1863 double2 __ovld __cnfn logb(double2 x);
1864 double3 __ovld __cnfn logb(double3 x);
1865 double4 __ovld __cnfn logb(double4 x);
1866 double8 __ovld __cnfn logb(double8 x);
1867 double16 __ovld __cnfn logb(double16 x);
1868-#endif //cl_khr_fp64
1869+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1870 #ifdef cl_khr_fp16
1871 half __ovld __cnfn logb(half x);
1872 half2 __ovld __cnfn logb(half2 x);
1873@@ -7877,14 +7883,14 @@ float3 __ovld __cnfn mad(float3 a, float3 b, float3 c);
1874 float4 __ovld __cnfn mad(float4 a, float4 b, float4 c);
1875 float8 __ovld __cnfn mad(float8 a, float8 b, float8 c);
1876 float16 __ovld __cnfn mad(float16 a, float16 b, float16 c);
1877-#ifdef cl_khr_fp64
1878+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1879 double __ovld __cnfn mad(double a, double b, double c);
1880 double2 __ovld __cnfn mad(double2 a, double2 b, double2 c);
1881 double3 __ovld __cnfn mad(double3 a, double3 b, double3 c);
1882 double4 __ovld __cnfn mad(double4 a, double4 b, double4 c);
1883 double8 __ovld __cnfn mad(double8 a, double8 b, double8 c);
1884 double16 __ovld __cnfn mad(double16 a, double16 b, double16 c);
1885-#endif //cl_khr_fp64
1886+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1887 #ifdef cl_khr_fp16
1888 half __ovld __cnfn mad(half a, half b, half c);
1889 half2 __ovld __cnfn mad(half2 a, half2 b, half2 c);
1890@@ -7904,14 +7910,14 @@ float3 __ovld __cnfn maxmag(float3 x, float3 y);
1891 float4 __ovld __cnfn maxmag(float4 x, float4 y);
1892 float8 __ovld __cnfn maxmag(float8 x, float8 y);
1893 float16 __ovld __cnfn maxmag(float16 x, float16 y);
1894-#ifdef cl_khr_fp64
1895+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1896 double __ovld __cnfn maxmag(double x, double y);
1897 double2 __ovld __cnfn maxmag(double2 x, double2 y);
1898 double3 __ovld __cnfn maxmag(double3 x, double3 y);
1899 double4 __ovld __cnfn maxmag(double4 x, double4 y);
1900 double8 __ovld __cnfn maxmag(double8 x, double8 y);
1901 double16 __ovld __cnfn maxmag(double16 x, double16 y);
1902-#endif //cl_khr_fp64
1903+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1904 #ifdef cl_khr_fp16
1905 half __ovld __cnfn maxmag(half x, half y);
1906 half2 __ovld __cnfn maxmag(half2 x, half2 y);
1907@@ -7931,14 +7937,14 @@ float3 __ovld __cnfn minmag(float3 x, float3 y);
1908 float4 __ovld __cnfn minmag(float4 x, float4 y);
1909 float8 __ovld __cnfn minmag(float8 x, float8 y);
1910 float16 __ovld __cnfn minmag(float16 x, float16 y);
1911-#ifdef cl_khr_fp64
1912+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1913 double __ovld __cnfn minmag(double x, double y);
1914 double2 __ovld __cnfn minmag(double2 x, double2 y);
1915 double3 __ovld __cnfn minmag(double3 x, double3 y);
1916 double4 __ovld __cnfn minmag(double4 x, double4 y);
1917 double8 __ovld __cnfn minmag(double8 x, double8 y);
1918 double16 __ovld __cnfn minmag(double16 x, double16 y);
1919-#endif //cl_khr_fp64
1920+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1921 #ifdef cl_khr_fp16
1922 half __ovld __cnfn minmag(half x, half y);
1923 half2 __ovld __cnfn minmag(half2 x, half2 y);
1924@@ -7955,21 +7961,21 @@ half16 __ovld __cnfn minmag(half16 x, half16 y);
1925 * the argument. It stores the integral part in the object
1926 * pointed to by iptr.
1927 */
1928-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1929+#ifdef __opencl_c_generic_address_space
1930 float __ovld modf(float x, float *iptr);
1931 float2 __ovld modf(float2 x, float2 *iptr);
1932 float3 __ovld modf(float3 x, float3 *iptr);
1933 float4 __ovld modf(float4 x, float4 *iptr);
1934 float8 __ovld modf(float8 x, float8 *iptr);
1935 float16 __ovld modf(float16 x, float16 *iptr);
1936-#ifdef cl_khr_fp64
1937+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1938 double __ovld modf(double x, double *iptr);
1939 double2 __ovld modf(double2 x, double2 *iptr);
1940 double3 __ovld modf(double3 x, double3 *iptr);
1941 double4 __ovld modf(double4 x, double4 *iptr);
1942 double8 __ovld modf(double8 x, double8 *iptr);
1943 double16 __ovld modf(double16 x, double16 *iptr);
1944-#endif //cl_khr_fp64
1945+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1946 #ifdef cl_khr_fp16
1947 half __ovld modf(half x, half *iptr);
1948 half2 __ovld modf(half2 x, half2 *iptr);
1949@@ -7978,7 +7984,9 @@ half4 __ovld modf(half4 x, half4 *iptr);
1950 half8 __ovld modf(half8 x, half8 *iptr);
1951 half16 __ovld modf(half16 x, half16 *iptr);
1952 #endif //cl_khr_fp16
1953-#else
1954+#endif //__opencl_c_generic_address_space
1955+
1956+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
1957 float __ovld modf(float x, __global float *iptr);
1958 float2 __ovld modf(float2 x, __global float2 *iptr);
1959 float3 __ovld modf(float3 x, __global float3 *iptr);
1960@@ -7997,7 +8005,7 @@ float3 __ovld modf(float3 x, __private float3 *iptr);
1961 float4 __ovld modf(float4 x, __private float4 *iptr);
1962 float8 __ovld modf(float8 x, __private float8 *iptr);
1963 float16 __ovld modf(float16 x, __private float16 *iptr);
1964-#ifdef cl_khr_fp64
1965+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1966 double __ovld modf(double x, __global double *iptr);
1967 double2 __ovld modf(double2 x, __global double2 *iptr);
1968 double3 __ovld modf(double3 x, __global double3 *iptr);
1969@@ -8016,7 +8024,7 @@ double3 __ovld modf(double3 x, __private double3 *iptr);
1970 double4 __ovld modf(double4 x, __private double4 *iptr);
1971 double8 __ovld modf(double8 x, __private double8 *iptr);
1972 double16 __ovld modf(double16 x, __private double16 *iptr);
1973-#endif //cl_khr_fp64
1974+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1975 #ifdef cl_khr_fp16
1976 half __ovld modf(half x, __global half *iptr);
1977 half2 __ovld modf(half2 x, __global half2 *iptr);
1978@@ -8037,7 +8045,8 @@ half4 __ovld modf(half4 x, __private half4 *iptr);
1979 half8 __ovld modf(half8 x, __private half8 *iptr);
1980 half16 __ovld modf(half16 x, __private half16 *iptr);
1981 #endif //cl_khr_fp16
1982-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1983+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
1984+ //! CL_VERSION_2_0)
1985
1986 /**
1987 * Returns a quiet NaN. The nancode may be placed
1988@@ -8049,14 +8058,14 @@ float3 __ovld __cnfn nan(uint3 nancode);
1989 float4 __ovld __cnfn nan(uint4 nancode);
1990 float8 __ovld __cnfn nan(uint8 nancode);
1991 float16 __ovld __cnfn nan(uint16 nancode);
1992-#ifdef cl_khr_fp64
1993+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1994 double __ovld __cnfn nan(ulong nancode);
1995 double2 __ovld __cnfn nan(ulong2 nancode);
1996 double3 __ovld __cnfn nan(ulong3 nancode);
1997 double4 __ovld __cnfn nan(ulong4 nancode);
1998 double8 __ovld __cnfn nan(ulong8 nancode);
1999 double16 __ovld __cnfn nan(ulong16 nancode);
2000-#endif //cl_khr_fp64
2001+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2002 #ifdef cl_khr_fp16
2003 half __ovld __cnfn nan(ushort nancode);
2004 half2 __ovld __cnfn nan(ushort2 nancode);
2005@@ -8079,14 +8088,14 @@ float3 __ovld __cnfn nextafter(float3 x, float3 y);
2006 float4 __ovld __cnfn nextafter(float4 x, float4 y);
2007 float8 __ovld __cnfn nextafter(float8 x, float8 y);
2008 float16 __ovld __cnfn nextafter(float16 x, float16 y);
2009-#ifdef cl_khr_fp64
2010+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2011 double __ovld __cnfn nextafter(double x, double y);
2012 double2 __ovld __cnfn nextafter(double2 x, double2 y);
2013 double3 __ovld __cnfn nextafter(double3 x, double3 y);
2014 double4 __ovld __cnfn nextafter(double4 x, double4 y);
2015 double8 __ovld __cnfn nextafter(double8 x, double8 y);
2016 double16 __ovld __cnfn nextafter(double16 x, double16 y);
2017-#endif //cl_khr_fp64
2018+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2019 #ifdef cl_khr_fp16
2020 half __ovld __cnfn nextafter(half x, half y);
2021 half2 __ovld __cnfn nextafter(half2 x, half2 y);
2022@@ -8105,14 +8114,14 @@ float3 __ovld __cnfn pow(float3 x, float3 y);
2023 float4 __ovld __cnfn pow(float4 x, float4 y);
2024 float8 __ovld __cnfn pow(float8 x, float8 y);
2025 float16 __ovld __cnfn pow(float16 x, float16 y);
2026-#ifdef cl_khr_fp64
2027+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2028 double __ovld __cnfn pow(double x, double y);
2029 double2 __ovld __cnfn pow(double2 x, double2 y);
2030 double3 __ovld __cnfn pow(double3 x, double3 y);
2031 double4 __ovld __cnfn pow(double4 x, double4 y);
2032 double8 __ovld __cnfn pow(double8 x, double8 y);
2033 double16 __ovld __cnfn pow(double16 x, double16 y);
2034-#endif //cl_khr_fp64
2035+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2036 #ifdef cl_khr_fp16
2037 half __ovld __cnfn pow(half x, half y);
2038 half2 __ovld __cnfn pow(half2 x, half2 y);
2039@@ -8131,14 +8140,14 @@ float3 __ovld __cnfn pown(float3 x, int3 y);
2040 float4 __ovld __cnfn pown(float4 x, int4 y);
2041 float8 __ovld __cnfn pown(float8 x, int8 y);
2042 float16 __ovld __cnfn pown(float16 x, int16 y);
2043-#ifdef cl_khr_fp64
2044+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2045 double __ovld __cnfn pown(double x, int y);
2046 double2 __ovld __cnfn pown(double2 x, int2 y);
2047 double3 __ovld __cnfn pown(double3 x, int3 y);
2048 double4 __ovld __cnfn pown(double4 x, int4 y);
2049 double8 __ovld __cnfn pown(double8 x, int8 y);
2050 double16 __ovld __cnfn pown(double16 x, int16 y);
2051-#endif //cl_khr_fp64
2052+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2053 #ifdef cl_khr_fp16
2054 half __ovld __cnfn pown(half x, int y);
2055 half2 __ovld __cnfn pown(half2 x, int2 y);
2056@@ -8157,14 +8166,14 @@ float3 __ovld __cnfn powr(float3 x, float3 y);
2057 float4 __ovld __cnfn powr(float4 x, float4 y);
2058 float8 __ovld __cnfn powr(float8 x, float8 y);
2059 float16 __ovld __cnfn powr(float16 x, float16 y);
2060-#ifdef cl_khr_fp64
2061+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2062 double __ovld __cnfn powr(double x, double y);
2063 double2 __ovld __cnfn powr(double2 x, double2 y);
2064 double3 __ovld __cnfn powr(double3 x, double3 y);
2065 double4 __ovld __cnfn powr(double4 x, double4 y);
2066 double8 __ovld __cnfn powr(double8 x, double8 y);
2067 double16 __ovld __cnfn powr(double16 x, double16 y);
2068-#endif //cl_khr_fp64
2069+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2070 #ifdef cl_khr_fp16
2071 half __ovld __cnfn powr(half x, half y);
2072 half2 __ovld __cnfn powr(half2 x, half2 y);
2073@@ -8186,14 +8195,14 @@ float3 __ovld __cnfn remainder(float3 x, float3 y);
2074 float4 __ovld __cnfn remainder(float4 x, float4 y);
2075 float8 __ovld __cnfn remainder(float8 x, float8 y);
2076 float16 __ovld __cnfn remainder(float16 x, float16 y);
2077-#ifdef cl_khr_fp64
2078+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2079 double __ovld __cnfn remainder(double x, double y);
2080 double2 __ovld __cnfn remainder(double2 x, double2 y);
2081 double3 __ovld __cnfn remainder(double3 x, double3 y);
2082 double4 __ovld __cnfn remainder(double4 x, double4 y);
2083 double8 __ovld __cnfn remainder(double8 x, double8 y);
2084 double16 __ovld __cnfn remainder(double16 x, double16 y);
2085-#endif //cl_khr_fp64
2086+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2087 #ifdef cl_khr_fp16
2088 half __ovld __cnfn remainder(half x, half y);
2089 half2 __ovld __cnfn remainder(half2 x, half2 y);
2090@@ -8215,21 +8224,21 @@ half16 __ovld __cnfn remainder(half16 x, half16 y);
2091 * sign as x/y. It stores this signed value in the object
2092 * pointed to by quo.
2093 */
2094-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
2095+#ifdef __opencl_c_generic_address_space
2096 float __ovld remquo(float x, float y, int *quo);
2097 float2 __ovld remquo(float2 x, float2 y, int2 *quo);
2098 float3 __ovld remquo(float3 x, float3 y, int3 *quo);
2099 float4 __ovld remquo(float4 x, float4 y, int4 *quo);
2100 float8 __ovld remquo(float8 x, float8 y, int8 *quo);
2101 float16 __ovld remquo(float16 x, float16 y, int16 *quo);
2102-#ifdef cl_khr_fp64
2103+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2104 double __ovld remquo(double x, double y, int *quo);
2105 double2 __ovld remquo(double2 x, double2 y, int2 *quo);
2106 double3 __ovld remquo(double3 x, double3 y, int3 *quo);
2107 double4 __ovld remquo(double4 x, double4 y, int4 *quo);
2108 double8 __ovld remquo(double8 x, double8 y, int8 *quo);
2109 double16 __ovld remquo(double16 x, double16 y, int16 *quo);
2110-#endif //cl_khr_fp64
2111+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2112 #ifdef cl_khr_fp16
2113 half __ovld remquo(half x, half y, int *quo);
2114 half2 __ovld remquo(half2 x, half2 y, int2 *quo);
2115@@ -8237,9 +8246,10 @@ half3 __ovld remquo(half3 x, half3 y, int3 *quo);
2116 half4 __ovld remquo(half4 x, half4 y, int4 *quo);
2117 half8 __ovld remquo(half8 x, half8 y, int8 *quo);
2118 half16 __ovld remquo(half16 x, half16 y, int16 *quo);
2119-
2120 #endif //cl_khr_fp16
2121-#else
2122+#endif //__opencl_c_generic_address_space
2123+
2124+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
2125 float __ovld remquo(float x, float y, __global int *quo);
2126 float2 __ovld remquo(float2 x, float2 y, __global int2 *quo);
2127 float3 __ovld remquo(float3 x, float3 y, __global int3 *quo);
2128@@ -8258,7 +8268,7 @@ float3 __ovld remquo(float3 x, float3 y, __private int3 *quo);
2129 float4 __ovld remquo(float4 x, float4 y, __private int4 *quo);
2130 float8 __ovld remquo(float8 x, float8 y, __private int8 *quo);
2131 float16 __ovld remquo(float16 x, float16 y, __private int16 *quo);
2132-#ifdef cl_khr_fp64
2133+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2134 double __ovld remquo(double x, double y, __global int *quo);
2135 double2 __ovld remquo(double2 x, double2 y, __global int2 *quo);
2136 double3 __ovld remquo(double3 x, double3 y, __global int3 *quo);
2137@@ -8277,7 +8287,7 @@ double3 __ovld remquo(double3 x, double3 y, __private int3 *quo);
2138 double4 __ovld remquo(double4 x, double4 y, __private int4 *quo);
2139 double8 __ovld remquo(double8 x, double8 y, __private int8 *quo);
2140 double16 __ovld remquo(double16 x, double16 y, __private int16 *quo);
2141-#endif //cl_khr_fp64
2142+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2143 #ifdef cl_khr_fp16
2144 half __ovld remquo(half x, half y, __global int *quo);
2145 half2 __ovld remquo(half2 x, half2 y, __global int2 *quo);
2146@@ -8298,7 +8308,8 @@ half4 __ovld remquo(half4 x, half4 y, __private int4 *quo);
2147 half8 __ovld remquo(half8 x, half8 y, __private int8 *quo);
2148 half16 __ovld remquo(half16 x, half16 y, __private int16 *quo);
2149 #endif //cl_khr_fp16
2150-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
2151+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
2152+ //! CL_VERSION_2_0)
2153 /**
2154 * Round to integral value (using round to nearest
2155 * even rounding mode) in floating-point format.
2156@@ -8311,14 +8322,14 @@ float3 __ovld __cnfn rint(float3);
2157 float4 __ovld __cnfn rint(float4);
2158 float8 __ovld __cnfn rint(float8);
2159 float16 __ovld __cnfn rint(float16);
2160-#ifdef cl_khr_fp64
2161+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2162 double __ovld __cnfn rint(double);
2163 double2 __ovld __cnfn rint(double2);
2164 double3 __ovld __cnfn rint(double3);
2165 double4 __ovld __cnfn rint(double4);
2166 double8 __ovld __cnfn rint(double8);
2167 double16 __ovld __cnfn rint(double16);
2168-#endif //cl_khr_fp64
2169+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2170 #ifdef cl_khr_fp16
2171 half __ovld __cnfn rint(half);
2172 half2 __ovld __cnfn rint(half2);
2173@@ -8337,14 +8348,14 @@ float3 __ovld __cnfn rootn(float3 x, int3 y);
2174 float4 __ovld __cnfn rootn(float4 x, int4 y);
2175 float8 __ovld __cnfn rootn(float8 x, int8 y);
2176 float16 __ovld __cnfn rootn(float16 x, int16 y);
2177-#ifdef cl_khr_fp64
2178+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2179 double __ovld __cnfn rootn(double x, int y);
2180 double2 __ovld __cnfn rootn(double2 x, int2 y);
2181 double3 __ovld __cnfn rootn(double3 x, int3 y);
2182 double4 __ovld __cnfn rootn(double4 x, int4 y);
2183 double8 __ovld __cnfn rootn(double8 x, int8 y);
2184 double16 __ovld __cnfn rootn(double16 x, int16 y);
2185-#endif //cl_khr_fp64
2186+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2187 #ifdef cl_khr_fp16
2188 half __ovld __cnfn rootn(half x, int y);
2189 half2 __ovld __cnfn rootn(half2 x, int2 y);
2190@@ -8365,14 +8376,14 @@ float3 __ovld __cnfn round(float3 x);
2191 float4 __ovld __cnfn round(float4 x);
2192 float8 __ovld __cnfn round(float8 x);
2193 float16 __ovld __cnfn round(float16 x);
2194-#ifdef cl_khr_fp64
2195+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2196 double __ovld __cnfn round(double x);
2197 double2 __ovld __cnfn round(double2 x);
2198 double3 __ovld __cnfn round(double3 x);
2199 double4 __ovld __cnfn round(double4 x);
2200 double8 __ovld __cnfn round(double8 x);
2201 double16 __ovld __cnfn round(double16 x);
2202-#endif //cl_khr_fp64
2203+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2204 #ifdef cl_khr_fp16
2205 half __ovld __cnfn round(half x);
2206 half2 __ovld __cnfn round(half2 x);
2207@@ -8391,14 +8402,14 @@ float3 __ovld __cnfn rsqrt(float3);
2208 float4 __ovld __cnfn rsqrt(float4);
2209 float8 __ovld __cnfn rsqrt(float8);
2210 float16 __ovld __cnfn rsqrt(float16);
2211-#ifdef cl_khr_fp64
2212+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2213 double __ovld __cnfn rsqrt(double);
2214 double2 __ovld __cnfn rsqrt(double2);
2215 double3 __ovld __cnfn rsqrt(double3);
2216 double4 __ovld __cnfn rsqrt(double4);
2217 double8 __ovld __cnfn rsqrt(double8);
2218 double16 __ovld __cnfn rsqrt(double16);
2219-#endif //cl_khr_fp64
2220+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2221 #ifdef cl_khr_fp16
2222 half __ovld __cnfn rsqrt(half);
2223 half2 __ovld __cnfn rsqrt(half2);
2224@@ -8417,14 +8428,14 @@ float3 __ovld __cnfn sin(float3);
2225 float4 __ovld __cnfn sin(float4);
2226 float8 __ovld __cnfn sin(float8);
2227 float16 __ovld __cnfn sin(float16);
2228-#ifdef cl_khr_fp64
2229+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2230 double __ovld __cnfn sin(double);
2231 double2 __ovld __cnfn sin(double2);
2232 double3 __ovld __cnfn sin(double3);
2233 double4 __ovld __cnfn sin(double4);
2234 double8 __ovld __cnfn sin(double8);
2235 double16 __ovld __cnfn sin(double16);
2236-#endif //cl_khr_fp64
2237+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2238 #ifdef cl_khr_fp16
2239 half __ovld __cnfn sin(half);
2240 half2 __ovld __cnfn sin(half2);
2241@@ -8439,21 +8450,21 @@ half16 __ovld __cnfn sin(half16);
2242 * is the return value and computed cosine is returned
2243 * in cosval.
2244 */
2245-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
2246+#ifdef __opencl_c_generic_address_space
2247 float __ovld sincos(float x, float *cosval);
2248 float2 __ovld sincos(float2 x, float2 *cosval);
2249 float3 __ovld sincos(float3 x, float3 *cosval);
2250 float4 __ovld sincos(float4 x, float4 *cosval);
2251 float8 __ovld sincos(float8 x, float8 *cosval);
2252 float16 __ovld sincos(float16 x, float16 *cosval);
2253-#ifdef cl_khr_fp64
2254+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2255 double __ovld sincos(double x, double *cosval);
2256 double2 __ovld sincos(double2 x, double2 *cosval);
2257 double3 __ovld sincos(double3 x, double3 *cosval);
2258 double4 __ovld sincos(double4 x, double4 *cosval);
2259 double8 __ovld sincos(double8 x, double8 *cosval);
2260 double16 __ovld sincos(double16 x, double16 *cosval);
2261-#endif //cl_khr_fp64
2262+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2263 #ifdef cl_khr_fp16
2264 half __ovld sincos(half x, half *cosval);
2265 half2 __ovld sincos(half2 x, half2 *cosval);
2266@@ -8462,7 +8473,9 @@ half4 __ovld sincos(half4 x, half4 *cosval);
2267 half8 __ovld sincos(half8 x, half8 *cosval);
2268 half16 __ovld sincos(half16 x, half16 *cosval);
2269 #endif //cl_khr_fp16
2270-#else
2271+#endif //__opencl_c_generic_address_space
2272+
2273+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
2274 float __ovld sincos(float x, __global float *cosval);
2275 float2 __ovld sincos(float2 x, __global float2 *cosval);
2276 float3 __ovld sincos(float3 x, __global float3 *cosval);
2277@@ -8481,7 +8494,7 @@ float3 __ovld sincos(float3 x, __private float3 *cosval);
2278 float4 __ovld sincos(float4 x, __private float4 *cosval);
2279 float8 __ovld sincos(float8 x, __private float8 *cosval);
2280 float16 __ovld sincos(float16 x, __private float16 *cosval);
2281-#ifdef cl_khr_fp64
2282+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2283 double __ovld sincos(double x, __global double *cosval);
2284 double2 __ovld sincos(double2 x, __global double2 *cosval);
2285 double3 __ovld sincos(double3 x, __global double3 *cosval);
2286@@ -8500,7 +8513,7 @@ double3 __ovld sincos(double3 x, __private double3 *cosval);
2287 double4 __ovld sincos(double4 x, __private double4 *cosval);
2288 double8 __ovld sincos(double8 x, __private double8 *cosval);
2289 double16 __ovld sincos(double16 x, __private double16 *cosval);
2290-#endif //cl_khr_fp64
2291+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2292 #ifdef cl_khr_fp16
2293 half __ovld sincos(half x, __global half *cosval);
2294 half2 __ovld sincos(half2 x, __global half2 *cosval);
2295@@ -8521,8 +8534,8 @@ half4 __ovld sincos(half4 x, __private half4 *cosval);
2296 half8 __ovld sincos(half8 x, __private half8 *cosval);
2297 half16 __ovld sincos(half16 x, __private half16 *cosval);
2298 #endif //cl_khr_fp16
2299-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
2300-
2301+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
2302+ //! CL_VERSION_2_0)
2303 /**
2304 * Compute hyperbolic sine.
2305 */
2306@@ -8532,14 +8545,14 @@ float3 __ovld __cnfn sinh(float3);
2307 float4 __ovld __cnfn sinh(float4);
2308 float8 __ovld __cnfn sinh(float8);
2309 float16 __ovld __cnfn sinh(float16);
2310-#ifdef cl_khr_fp64
2311+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2312 double __ovld __cnfn sinh(double);
2313 double2 __ovld __cnfn sinh(double2);
2314 double3 __ovld __cnfn sinh(double3);
2315 double4 __ovld __cnfn sinh(double4);
2316 double8 __ovld __cnfn sinh(double8);
2317 double16 __ovld __cnfn sinh(double16);
2318-#endif //cl_khr_fp64
2319+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2320 #ifdef cl_khr_fp16
2321 half __ovld __cnfn sinh(half);
2322 half2 __ovld __cnfn sinh(half2);
2323@@ -8558,14 +8571,14 @@ float3 __ovld __cnfn sinpi(float3 x);
2324 float4 __ovld __cnfn sinpi(float4 x);
2325 float8 __ovld __cnfn sinpi(float8 x);
2326 float16 __ovld __cnfn sinpi(float16 x);
2327-#ifdef cl_khr_fp64
2328+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2329 double __ovld __cnfn sinpi(double x);
2330 double2 __ovld __cnfn sinpi(double2 x);
2331 double3 __ovld __cnfn sinpi(double3 x);
2332 double4 __ovld __cnfn sinpi(double4 x);
2333 double8 __ovld __cnfn sinpi(double8 x);
2334 double16 __ovld __cnfn sinpi(double16 x);
2335-#endif //cl_khr_fp64
2336+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2337 #ifdef cl_khr_fp16
2338 half __ovld __cnfn sinpi(half x);
2339 half2 __ovld __cnfn sinpi(half2 x);
2340@@ -8584,14 +8597,14 @@ float3 __ovld __cnfn sqrt(float3);
2341 float4 __ovld __cnfn sqrt(float4);
2342 float8 __ovld __cnfn sqrt(float8);
2343 float16 __ovld __cnfn sqrt(float16);
2344-#ifdef cl_khr_fp64
2345+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2346 double __ovld __cnfn sqrt(double);
2347 double2 __ovld __cnfn sqrt(double2);
2348 double3 __ovld __cnfn sqrt(double3);
2349 double4 __ovld __cnfn sqrt(double4);
2350 double8 __ovld __cnfn sqrt(double8);
2351 double16 __ovld __cnfn sqrt(double16);
2352-#endif //cl_khr_fp64
2353+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2354 #ifdef cl_khr_fp16
2355 half __ovld __cnfn sqrt(half);
2356 half2 __ovld __cnfn sqrt(half2);
2357@@ -8610,14 +8623,14 @@ float3 __ovld __cnfn tan(float3);
2358 float4 __ovld __cnfn tan(float4);
2359 float8 __ovld __cnfn tan(float8);
2360 float16 __ovld __cnfn tan(float16);
2361-#ifdef cl_khr_fp64
2362+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2363 double __ovld __cnfn tan(double);
2364 double2 __ovld __cnfn tan(double2);
2365 double3 __ovld __cnfn tan(double3);
2366 double4 __ovld __cnfn tan(double4);
2367 double8 __ovld __cnfn tan(double8);
2368 double16 __ovld __cnfn tan(double16);
2369-#endif //cl_khr_fp64
2370+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2371 #ifdef cl_khr_fp16
2372 half __ovld __cnfn tan(half);
2373 half2 __ovld __cnfn tan(half2);
2374@@ -8636,14 +8649,14 @@ float3 __ovld __cnfn tanh(float3);
2375 float4 __ovld __cnfn tanh(float4);
2376 float8 __ovld __cnfn tanh(float8);
2377 float16 __ovld __cnfn tanh(float16);
2378-#ifdef cl_khr_fp64
2379+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2380 double __ovld __cnfn tanh(double);
2381 double2 __ovld __cnfn tanh(double2);
2382 double3 __ovld __cnfn tanh(double3);
2383 double4 __ovld __cnfn tanh(double4);
2384 double8 __ovld __cnfn tanh(double8);
2385 double16 __ovld __cnfn tanh(double16);
2386-#endif //cl_khr_fp64
2387+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2388 #ifdef cl_khr_fp16
2389 half __ovld __cnfn tanh(half);
2390 half2 __ovld __cnfn tanh(half2);
2391@@ -8662,14 +8675,14 @@ float3 __ovld __cnfn tanpi(float3 x);
2392 float4 __ovld __cnfn tanpi(float4 x);
2393 float8 __ovld __cnfn tanpi(float8 x);
2394 float16 __ovld __cnfn tanpi(float16 x);
2395-#ifdef cl_khr_fp64
2396+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2397 double __ovld __cnfn tanpi(double x);
2398 double2 __ovld __cnfn tanpi(double2 x);
2399 double3 __ovld __cnfn tanpi(double3 x);
2400 double4 __ovld __cnfn tanpi(double4 x);
2401 double8 __ovld __cnfn tanpi(double8 x);
2402 double16 __ovld __cnfn tanpi(double16 x);
2403-#endif //cl_khr_fp64
2404+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2405 #ifdef cl_khr_fp16
2406 half __ovld __cnfn tanpi(half x);
2407 half2 __ovld __cnfn tanpi(half2 x);
2408@@ -8688,14 +8701,14 @@ float3 __ovld __cnfn tgamma(float3);
2409 float4 __ovld __cnfn tgamma(float4);
2410 float8 __ovld __cnfn tgamma(float8);
2411 float16 __ovld __cnfn tgamma(float16);
2412-#ifdef cl_khr_fp64
2413+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2414 double __ovld __cnfn tgamma(double);
2415 double2 __ovld __cnfn tgamma(double2);
2416 double3 __ovld __cnfn tgamma(double3);
2417 double4 __ovld __cnfn tgamma(double4);
2418 double8 __ovld __cnfn tgamma(double8);
2419 double16 __ovld __cnfn tgamma(double16);
2420-#endif //cl_khr_fp64
2421+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2422 #ifdef cl_khr_fp16
2423 half __ovld __cnfn tgamma(half);
2424 half2 __ovld __cnfn tgamma(half2);
2425@@ -8715,14 +8728,14 @@ float3 __ovld __cnfn trunc(float3);
2426 float4 __ovld __cnfn trunc(float4);
2427 float8 __ovld __cnfn trunc(float8);
2428 float16 __ovld __cnfn trunc(float16);
2429-#ifdef cl_khr_fp64
2430+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2431 double __ovld __cnfn trunc(double);
2432 double2 __ovld __cnfn trunc(double2);
2433 double3 __ovld __cnfn trunc(double3);
2434 double4 __ovld __cnfn trunc(double4);
2435 double8 __ovld __cnfn trunc(double8);
2436 double16 __ovld __cnfn trunc(double16);
2437-#endif //cl_khr_fp64
2438+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2439 #ifdef cl_khr_fp16
2440 half __ovld __cnfn trunc(half);
2441 half2 __ovld __cnfn trunc(half2);
2442@@ -10108,7 +10121,7 @@ float3 __ovld __cnfn clamp(float3 x, float minval, float maxval);
2443 float4 __ovld __cnfn clamp(float4 x, float minval, float maxval);
2444 float8 __ovld __cnfn clamp(float8 x, float minval, float maxval);
2445 float16 __ovld __cnfn clamp(float16 x, float minval, float maxval);
2446-#ifdef cl_khr_fp64
2447+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2448 double __ovld __cnfn clamp(double x, double minval, double maxval);
2449 double2 __ovld __cnfn clamp(double2 x, double2 minval, double2 maxval);
2450 double3 __ovld __cnfn clamp(double3 x, double3 minval, double3 maxval);
2451@@ -10120,7 +10133,7 @@ double3 __ovld __cnfn clamp(double3 x, double minval, double maxval);
2452 double4 __ovld __cnfn clamp(double4 x, double minval, double maxval);
2453 double8 __ovld __cnfn clamp(double8 x, double minval, double maxval);
2454 double16 __ovld __cnfn clamp(double16 x, double minval, double maxval);
2455-#endif //cl_khr_fp64
2456+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2457 #ifdef cl_khr_fp16
2458 half __ovld __cnfn clamp(half x, half minval, half maxval);
2459 half2 __ovld __cnfn clamp(half2 x, half2 minval, half2 maxval);
2460@@ -10145,14 +10158,14 @@ float3 __ovld __cnfn degrees(float3 radians);
2461 float4 __ovld __cnfn degrees(float4 radians);
2462 float8 __ovld __cnfn degrees(float8 radians);
2463 float16 __ovld __cnfn degrees(float16 radians);
2464-#ifdef cl_khr_fp64
2465+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2466 double __ovld __cnfn degrees(double radians);
2467 double2 __ovld __cnfn degrees(double2 radians);
2468 double3 __ovld __cnfn degrees(double3 radians);
2469 double4 __ovld __cnfn degrees(double4 radians);
2470 double8 __ovld __cnfn degrees(double8 radians);
2471 double16 __ovld __cnfn degrees(double16 radians);
2472-#endif //cl_khr_fp64
2473+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2474 #ifdef cl_khr_fp16
2475 half __ovld __cnfn degrees(half radians);
2476 half2 __ovld __cnfn degrees(half2 radians);
2477@@ -10177,7 +10190,7 @@ float3 __ovld __cnfn max(float3 x, float y);
2478 float4 __ovld __cnfn max(float4 x, float y);
2479 float8 __ovld __cnfn max(float8 x, float y);
2480 float16 __ovld __cnfn max(float16 x, float y);
2481-#ifdef cl_khr_fp64
2482+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2483 double __ovld __cnfn max(double x, double y);
2484 double2 __ovld __cnfn max(double2 x, double2 y);
2485 double3 __ovld __cnfn max(double3 x, double3 y);
2486@@ -10189,7 +10202,7 @@ double3 __ovld __cnfn max(double3 x, double y);
2487 double4 __ovld __cnfn max(double4 x, double y);
2488 double8 __ovld __cnfn max(double8 x, double y);
2489 double16 __ovld __cnfn max(double16 x, double y);
2490-#endif //cl_khr_fp64
2491+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2492 #ifdef cl_khr_fp16
2493 half __ovld __cnfn max(half x, half y);
2494 half2 __ovld __cnfn max(half2 x, half2 y);
2495@@ -10219,7 +10232,7 @@ float3 __ovld __cnfn min(float3 x, float y);
2496 float4 __ovld __cnfn min(float4 x, float y);
2497 float8 __ovld __cnfn min(float8 x, float y);
2498 float16 __ovld __cnfn min(float16 x, float y);
2499-#ifdef cl_khr_fp64
2500+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2501 double __ovld __cnfn min(double x, double y);
2502 double2 __ovld __cnfn min(double2 x, double2 y);
2503 double3 __ovld __cnfn min(double3 x, double3 y);
2504@@ -10231,7 +10244,7 @@ double3 __ovld __cnfn min(double3 x, double y);
2505 double4 __ovld __cnfn min(double4 x, double y);
2506 double8 __ovld __cnfn min(double8 x, double y);
2507 double16 __ovld __cnfn min(double16 x, double y);
2508-#endif //cl_khr_fp64
2509+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2510 #ifdef cl_khr_fp16
2511 half __ovld __cnfn min(half x, half y);
2512 half2 __ovld __cnfn min(half2 x, half2 y);
2513@@ -10264,7 +10277,7 @@ float3 __ovld __cnfn mix(float3 x, float3 y, float a);
2514 float4 __ovld __cnfn mix(float4 x, float4 y, float a);
2515 float8 __ovld __cnfn mix(float8 x, float8 y, float a);
2516 float16 __ovld __cnfn mix(float16 x, float16 y, float a);
2517-#ifdef cl_khr_fp64
2518+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2519 double __ovld __cnfn mix(double x, double y, double a);
2520 double2 __ovld __cnfn mix(double2 x, double2 y, double2 a);
2521 double3 __ovld __cnfn mix(double3 x, double3 y, double3 a);
2522@@ -10276,7 +10289,7 @@ double3 __ovld __cnfn mix(double3 x, double3 y, double a);
2523 double4 __ovld __cnfn mix(double4 x, double4 y, double a);
2524 double8 __ovld __cnfn mix(double8 x, double8 y, double a);
2525 double16 __ovld __cnfn mix(double16 x, double16 y, double a);
2526-#endif //cl_khr_fp64
2527+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2528 #ifdef cl_khr_fp16
2529 half __ovld __cnfn mix(half x, half y, half a);
2530 half2 __ovld __cnfn mix(half2 x, half2 y, half2 a);
2531@@ -10301,14 +10314,14 @@ float3 __ovld __cnfn radians(float3 degrees);
2532 float4 __ovld __cnfn radians(float4 degrees);
2533 float8 __ovld __cnfn radians(float8 degrees);
2534 float16 __ovld __cnfn radians(float16 degrees);
2535-#ifdef cl_khr_fp64
2536+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2537 double __ovld __cnfn radians(double degrees);
2538 double2 __ovld __cnfn radians(double2 degrees);
2539 double3 __ovld __cnfn radians(double3 degrees);
2540 double4 __ovld __cnfn radians(double4 degrees);
2541 double8 __ovld __cnfn radians(double8 degrees);
2542 double16 __ovld __cnfn radians(double16 degrees);
2543-#endif //cl_khr_fp64
2544+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2545 #ifdef cl_khr_fp16
2546 half __ovld __cnfn radians(half degrees);
2547 half2 __ovld __cnfn radians(half2 degrees);
2548@@ -10332,7 +10345,7 @@ float3 __ovld __cnfn step(float edge, float3 x);
2549 float4 __ovld __cnfn step(float edge, float4 x);
2550 float8 __ovld __cnfn step(float edge, float8 x);
2551 float16 __ovld __cnfn step(float edge, float16 x);
2552-#ifdef cl_khr_fp64
2553+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2554 double __ovld __cnfn step(double edge, double x);
2555 double2 __ovld __cnfn step(double2 edge, double2 x);
2556 double3 __ovld __cnfn step(double3 edge, double3 x);
2557@@ -10344,7 +10357,7 @@ double3 __ovld __cnfn step(double edge, double3 x);
2558 double4 __ovld __cnfn step(double edge, double4 x);
2559 double8 __ovld __cnfn step(double edge, double8 x);
2560 double16 __ovld __cnfn step(double edge, double16 x);
2561-#endif //cl_khr_fp64
2562+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2563 #ifdef cl_khr_fp16
2564 half __ovld __cnfn step(half edge, half x);
2565 half2 __ovld __cnfn step(half2 edge, half2 x);
2566@@ -10383,7 +10396,7 @@ float3 __ovld __cnfn smoothstep(float edge0, float edge1, float3 x);
2567 float4 __ovld __cnfn smoothstep(float edge0, float edge1, float4 x);
2568 float8 __ovld __cnfn smoothstep(float edge0, float edge1, float8 x);
2569 float16 __ovld __cnfn smoothstep(float edge0, float edge1, float16 x);
2570-#ifdef cl_khr_fp64
2571+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2572 double __ovld __cnfn smoothstep(double edge0, double edge1, double x);
2573 double2 __ovld __cnfn smoothstep(double2 edge0, double2 edge1, double2 x);
2574 double3 __ovld __cnfn smoothstep(double3 edge0, double3 edge1, double3 x);
2575@@ -10395,7 +10408,7 @@ double3 __ovld __cnfn smoothstep(double edge0, double edge1, double3 x);
2576 double4 __ovld __cnfn smoothstep(double edge0, double edge1, double4 x);
2577 double8 __ovld __cnfn smoothstep(double edge0, double edge1, double8 x);
2578 double16 __ovld __cnfn smoothstep(double edge0, double edge1, double16 x);
2579-#endif //cl_khr_fp64
2580+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2581 #ifdef cl_khr_fp16
2582 half __ovld __cnfn smoothstep(half edge0, half edge1, half x);
2583 half2 __ovld __cnfn smoothstep(half2 edge0, half2 edge1, half2 x);
2584@@ -10420,14 +10433,14 @@ float3 __ovld __cnfn sign(float3 x);
2585 float4 __ovld __cnfn sign(float4 x);
2586 float8 __ovld __cnfn sign(float8 x);
2587 float16 __ovld __cnfn sign(float16 x);
2588-#ifdef cl_khr_fp64
2589+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2590 double __ovld __cnfn sign(double x);
2591 double2 __ovld __cnfn sign(double2 x);
2592 double3 __ovld __cnfn sign(double3 x);
2593 double4 __ovld __cnfn sign(double4 x);
2594 double8 __ovld __cnfn sign(double8 x);
2595 double16 __ovld __cnfn sign(double16 x);
2596-#endif //cl_khr_fp64
2597+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2598 #ifdef cl_khr_fp16
2599 half __ovld __cnfn sign(half x);
2600 half2 __ovld __cnfn sign(half2 x);
2601@@ -10445,10 +10458,10 @@ half16 __ovld __cnfn sign(half16 x);
2602 */
2603 float4 __ovld __cnfn cross(float4 p0, float4 p1);
2604 float3 __ovld __cnfn cross(float3 p0, float3 p1);
2605-#ifdef cl_khr_fp64
2606+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2607 double4 __ovld __cnfn cross(double4 p0, double4 p1);
2608 double3 __ovld __cnfn cross(double3 p0, double3 p1);
2609-#endif //cl_khr_fp64
2610+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2611 #ifdef cl_khr_fp16
2612 half4 __ovld __cnfn cross(half4 p0, half4 p1);
2613 half3 __ovld __cnfn cross(half3 p0, half3 p1);
2614@@ -10461,12 +10474,12 @@ float __ovld __cnfn dot(float p0, float p1);
2615 float __ovld __cnfn dot(float2 p0, float2 p1);
2616 float __ovld __cnfn dot(float3 p0, float3 p1);
2617 float __ovld __cnfn dot(float4 p0, float4 p1);
2618-#ifdef cl_khr_fp64
2619+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2620 double __ovld __cnfn dot(double p0, double p1);
2621 double __ovld __cnfn dot(double2 p0, double2 p1);
2622 double __ovld __cnfn dot(double3 p0, double3 p1);
2623 double __ovld __cnfn dot(double4 p0, double4 p1);
2624-#endif //cl_khr_fp64
2625+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2626 #ifdef cl_khr_fp16
2627 half __ovld __cnfn dot(half p0, half p1);
2628 half __ovld __cnfn dot(half2 p0, half2 p1);
2629@@ -10482,12 +10495,12 @@ float __ovld __cnfn distance(float p0, float p1);
2630 float __ovld __cnfn distance(float2 p0, float2 p1);
2631 float __ovld __cnfn distance(float3 p0, float3 p1);
2632 float __ovld __cnfn distance(float4 p0, float4 p1);
2633-#ifdef cl_khr_fp64
2634+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2635 double __ovld __cnfn distance(double p0, double p1);
2636 double __ovld __cnfn distance(double2 p0, double2 p1);
2637 double __ovld __cnfn distance(double3 p0, double3 p1);
2638 double __ovld __cnfn distance(double4 p0, double4 p1);
2639-#endif //cl_khr_fp64
2640+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2641 #ifdef cl_khr_fp16
2642 half __ovld __cnfn distance(half p0, half p1);
2643 half __ovld __cnfn distance(half2 p0, half2 p1);
2644@@ -10503,12 +10516,12 @@ float __ovld __cnfn length(float p);
2645 float __ovld __cnfn length(float2 p);
2646 float __ovld __cnfn length(float3 p);
2647 float __ovld __cnfn length(float4 p);
2648-#ifdef cl_khr_fp64
2649+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2650 double __ovld __cnfn length(double p);
2651 double __ovld __cnfn length(double2 p);
2652 double __ovld __cnfn length(double3 p);
2653 double __ovld __cnfn length(double4 p);
2654-#endif //cl_khr_fp64
2655+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2656 #ifdef cl_khr_fp16
2657 half __ovld __cnfn length(half p);
2658 half __ovld __cnfn length(half2 p);
2659@@ -10524,12 +10537,12 @@ float __ovld __cnfn normalize(float p);
2660 float2 __ovld __cnfn normalize(float2 p);
2661 float3 __ovld __cnfn normalize(float3 p);
2662 float4 __ovld __cnfn normalize(float4 p);
2663-#ifdef cl_khr_fp64
2664+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2665 double __ovld __cnfn normalize(double p);
2666 double2 __ovld __cnfn normalize(double2 p);
2667 double3 __ovld __cnfn normalize(double3 p);
2668 double4 __ovld __cnfn normalize(double4 p);
2669-#endif //cl_khr_fp64
2670+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2671 #ifdef cl_khr_fp16
2672 half __ovld __cnfn normalize(half p);
2673 half2 __ovld __cnfn normalize(half2 p);
2674@@ -10610,14 +10623,14 @@ int3 __ovld __cnfn isequal(float3 x, float3 y);
2675 int4 __ovld __cnfn isequal(float4 x, float4 y);
2676 int8 __ovld __cnfn isequal(float8 x, float8 y);
2677 int16 __ovld __cnfn isequal(float16 x, float16 y);
2678-#ifdef cl_khr_fp64
2679+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2680 int __ovld __cnfn isequal(double x, double y);
2681 long2 __ovld __cnfn isequal(double2 x, double2 y);
2682 long3 __ovld __cnfn isequal(double3 x, double3 y);
2683 long4 __ovld __cnfn isequal(double4 x, double4 y);
2684 long8 __ovld __cnfn isequal(double8 x, double8 y);
2685 long16 __ovld __cnfn isequal(double16 x, double16 y);
2686-#endif //cl_khr_fp64
2687+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2688 #ifdef cl_khr_fp16
2689 int __ovld __cnfn isequal(half x, half y);
2690 short2 __ovld __cnfn isequal(half2 x, half2 y);
2691@@ -10636,14 +10649,14 @@ int3 __ovld __cnfn isnotequal(float3 x, float3 y);
2692 int4 __ovld __cnfn isnotequal(float4 x, float4 y);
2693 int8 __ovld __cnfn isnotequal(float8 x, float8 y);
2694 int16 __ovld __cnfn isnotequal(float16 x, float16 y);
2695-#ifdef cl_khr_fp64
2696+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2697 int __ovld __cnfn isnotequal(double x, double y);
2698 long2 __ovld __cnfn isnotequal(double2 x, double2 y);
2699 long3 __ovld __cnfn isnotequal(double3 x, double3 y);
2700 long4 __ovld __cnfn isnotequal(double4 x, double4 y);
2701 long8 __ovld __cnfn isnotequal(double8 x, double8 y);
2702 long16 __ovld __cnfn isnotequal(double16 x, double16 y);
2703-#endif //cl_khr_fp64
2704+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2705 #ifdef cl_khr_fp16
2706 int __ovld __cnfn isnotequal(half x, half y);
2707 short2 __ovld __cnfn isnotequal(half2 x, half2 y);
2708@@ -10662,14 +10675,14 @@ int3 __ovld __cnfn isgreater(float3 x, float3 y);
2709 int4 __ovld __cnfn isgreater(float4 x, float4 y);
2710 int8 __ovld __cnfn isgreater(float8 x, float8 y);
2711 int16 __ovld __cnfn isgreater(float16 x, float16 y);
2712-#ifdef cl_khr_fp64
2713+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2714 int __ovld __cnfn isgreater(double x, double y);
2715 long2 __ovld __cnfn isgreater(double2 x, double2 y);
2716 long3 __ovld __cnfn isgreater(double3 x, double3 y);
2717 long4 __ovld __cnfn isgreater(double4 x, double4 y);
2718 long8 __ovld __cnfn isgreater(double8 x, double8 y);
2719 long16 __ovld __cnfn isgreater(double16 x, double16 y);
2720-#endif //cl_khr_fp64
2721+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2722 #ifdef cl_khr_fp16
2723 int __ovld __cnfn isgreater(half x, half y);
2724 short2 __ovld __cnfn isgreater(half2 x, half2 y);
2725@@ -10688,14 +10701,14 @@ int3 __ovld __cnfn isgreaterequal(float3 x, float3 y);
2726 int4 __ovld __cnfn isgreaterequal(float4 x, float4 y);
2727 int8 __ovld __cnfn isgreaterequal(float8 x, float8 y);
2728 int16 __ovld __cnfn isgreaterequal(float16 x, float16 y);
2729-#ifdef cl_khr_fp64
2730+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2731 int __ovld __cnfn isgreaterequal(double x, double y);
2732 long2 __ovld __cnfn isgreaterequal(double2 x, double2 y);
2733 long3 __ovld __cnfn isgreaterequal(double3 x, double3 y);
2734 long4 __ovld __cnfn isgreaterequal(double4 x, double4 y);
2735 long8 __ovld __cnfn isgreaterequal(double8 x, double8 y);
2736 long16 __ovld __cnfn isgreaterequal(double16 x, double16 y);
2737-#endif //cl_khr_fp64
2738+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2739 #ifdef cl_khr_fp16
2740 int __ovld __cnfn isgreaterequal(half x, half y);
2741 short2 __ovld __cnfn isgreaterequal(half2 x, half2 y);
2742@@ -10714,14 +10727,14 @@ int3 __ovld __cnfn isless(float3 x, float3 y);
2743 int4 __ovld __cnfn isless(float4 x, float4 y);
2744 int8 __ovld __cnfn isless(float8 x, float8 y);
2745 int16 __ovld __cnfn isless(float16 x, float16 y);
2746-#ifdef cl_khr_fp64
2747+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2748 int __ovld __cnfn isless(double x, double y);
2749 long2 __ovld __cnfn isless(double2 x, double2 y);
2750 long3 __ovld __cnfn isless(double3 x, double3 y);
2751 long4 __ovld __cnfn isless(double4 x, double4 y);
2752 long8 __ovld __cnfn isless(double8 x, double8 y);
2753 long16 __ovld __cnfn isless(double16 x, double16 y);
2754-#endif //cl_khr_fp64
2755+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2756 #ifdef cl_khr_fp16
2757 int __ovld __cnfn isless(half x, half y);
2758 short2 __ovld __cnfn isless(half2 x, half2 y);
2759@@ -10740,14 +10753,14 @@ int3 __ovld __cnfn islessequal(float3 x, float3 y);
2760 int4 __ovld __cnfn islessequal(float4 x, float4 y);
2761 int8 __ovld __cnfn islessequal(float8 x, float8 y);
2762 int16 __ovld __cnfn islessequal(float16 x, float16 y);
2763-#ifdef cl_khr_fp64
2764+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2765 int __ovld __cnfn islessequal(double x, double y);
2766 long2 __ovld __cnfn islessequal(double2 x, double2 y);
2767 long3 __ovld __cnfn islessequal(double3 x, double3 y);
2768 long4 __ovld __cnfn islessequal(double4 x, double4 y);
2769 long8 __ovld __cnfn islessequal(double8 x, double8 y);
2770 long16 __ovld __cnfn islessequal(double16 x, double16 y);
2771-#endif //cl_khr_fp64
2772+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2773 #ifdef cl_khr_fp16
2774 int __ovld __cnfn islessequal(half x, half y);
2775 short2 __ovld __cnfn islessequal(half2 x, half2 y);
2776@@ -10767,14 +10780,14 @@ int3 __ovld __cnfn islessgreater(float3 x, float3 y);
2777 int4 __ovld __cnfn islessgreater(float4 x, float4 y);
2778 int8 __ovld __cnfn islessgreater(float8 x, float8 y);
2779 int16 __ovld __cnfn islessgreater(float16 x, float16 y);
2780-#ifdef cl_khr_fp64
2781+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2782 int __ovld __cnfn islessgreater(double x, double y);
2783 long2 __ovld __cnfn islessgreater(double2 x, double2 y);
2784 long3 __ovld __cnfn islessgreater(double3 x, double3 y);
2785 long4 __ovld __cnfn islessgreater(double4 x, double4 y);
2786 long8 __ovld __cnfn islessgreater(double8 x, double8 y);
2787 long16 __ovld __cnfn islessgreater(double16 x, double16 y);
2788-#endif //cl_khr_fp64
2789+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2790 #ifdef cl_khr_fp16
2791 int __ovld __cnfn islessgreater(half x, half y);
2792 short2 __ovld __cnfn islessgreater(half2 x, half2 y);
2793@@ -10793,14 +10806,14 @@ int3 __ovld __cnfn isfinite(float3);
2794 int4 __ovld __cnfn isfinite(float4);
2795 int8 __ovld __cnfn isfinite(float8);
2796 int16 __ovld __cnfn isfinite(float16);
2797-#ifdef cl_khr_fp64
2798+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2799 int __ovld __cnfn isfinite(double);
2800 long2 __ovld __cnfn isfinite(double2);
2801 long3 __ovld __cnfn isfinite(double3);
2802 long4 __ovld __cnfn isfinite(double4);
2803 long8 __ovld __cnfn isfinite(double8);
2804 long16 __ovld __cnfn isfinite(double16);
2805-#endif //cl_khr_fp64
2806+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2807 #ifdef cl_khr_fp16
2808 int __ovld __cnfn isfinite(half);
2809 short2 __ovld __cnfn isfinite(half2);
2810@@ -10819,14 +10832,14 @@ int3 __ovld __cnfn isinf(float3);
2811 int4 __ovld __cnfn isinf(float4);
2812 int8 __ovld __cnfn isinf(float8);
2813 int16 __ovld __cnfn isinf(float16);
2814-#ifdef cl_khr_fp64
2815+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2816 int __ovld __cnfn isinf(double);
2817 long2 __ovld __cnfn isinf(double2);
2818 long3 __ovld __cnfn isinf(double3);
2819 long4 __ovld __cnfn isinf(double4);
2820 long8 __ovld __cnfn isinf(double8);
2821 long16 __ovld __cnfn isinf(double16);
2822-#endif //cl_khr_fp64
2823+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2824 #ifdef cl_khr_fp16
2825 int __ovld __cnfn isinf(half);
2826 short2 __ovld __cnfn isinf(half2);
2827@@ -10845,14 +10858,14 @@ int3 __ovld __cnfn isnan(float3);
2828 int4 __ovld __cnfn isnan(float4);
2829 int8 __ovld __cnfn isnan(float8);
2830 int16 __ovld __cnfn isnan(float16);
2831-#ifdef cl_khr_fp64
2832+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2833 int __ovld __cnfn isnan(double);
2834 long2 __ovld __cnfn isnan(double2);
2835 long3 __ovld __cnfn isnan(double3);
2836 long4 __ovld __cnfn isnan(double4);
2837 long8 __ovld __cnfn isnan(double8);
2838 long16 __ovld __cnfn isnan(double16);
2839-#endif //cl_khr_fp64
2840+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2841 #ifdef cl_khr_fp16
2842 int __ovld __cnfn isnan(half);
2843 short2 __ovld __cnfn isnan(half2);
2844@@ -10871,14 +10884,14 @@ int3 __ovld __cnfn isnormal(float3);
2845 int4 __ovld __cnfn isnormal(float4);
2846 int8 __ovld __cnfn isnormal(float8);
2847 int16 __ovld __cnfn isnormal(float16);
2848-#ifdef cl_khr_fp64
2849+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2850 int __ovld __cnfn isnormal(double);
2851 long2 __ovld __cnfn isnormal(double2);
2852 long3 __ovld __cnfn isnormal(double3);
2853 long4 __ovld __cnfn isnormal(double4);
2854 long8 __ovld __cnfn isnormal(double8);
2855 long16 __ovld __cnfn isnormal(double16);
2856-#endif //cl_khr_fp64
2857+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2858 #ifdef cl_khr_fp16
2859 int __ovld __cnfn isnormal(half);
2860 short2 __ovld __cnfn isnormal(half2);
2861@@ -10899,14 +10912,14 @@ int3 __ovld __cnfn isordered(float3 x, float3 y);
2862 int4 __ovld __cnfn isordered(float4 x, float4 y);
2863 int8 __ovld __cnfn isordered(float8 x, float8 y);
2864 int16 __ovld __cnfn isordered(float16 x, float16 y);
2865-#ifdef cl_khr_fp64
2866+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2867 int __ovld __cnfn isordered(double x, double y);
2868 long2 __ovld __cnfn isordered(double2 x, double2 y);
2869 long3 __ovld __cnfn isordered(double3 x, double3 y);
2870 long4 __ovld __cnfn isordered(double4 x, double4 y);
2871 long8 __ovld __cnfn isordered(double8 x, double8 y);
2872 long16 __ovld __cnfn isordered(double16 x, double16 y);
2873-#endif //cl_khr_fp64
2874+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2875 #ifdef cl_khr_fp16
2876 int __ovld __cnfn isordered(half x, half y);
2877 short2 __ovld __cnfn isordered(half2 x, half2 y);
2878@@ -10927,14 +10940,14 @@ int3 __ovld __cnfn isunordered(float3 x, float3 y);
2879 int4 __ovld __cnfn isunordered(float4 x, float4 y);
2880 int8 __ovld __cnfn isunordered(float8 x, float8 y);
2881 int16 __ovld __cnfn isunordered(float16 x, float16 y);
2882-#ifdef cl_khr_fp64
2883+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2884 int __ovld __cnfn isunordered(double x, double y);
2885 long2 __ovld __cnfn isunordered(double2 x, double2 y);
2886 long3 __ovld __cnfn isunordered(double3 x, double3 y);
2887 long4 __ovld __cnfn isunordered(double4 x, double4 y);
2888 long8 __ovld __cnfn isunordered(double8 x, double8 y);
2889 long16 __ovld __cnfn isunordered(double16 x, double16 y);
2890-#endif //cl_khr_fp64
2891+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2892 #ifdef cl_khr_fp16
2893 int __ovld __cnfn isunordered(half x, half y);
2894 short2 __ovld __cnfn isunordered(half2 x, half2 y);
2895@@ -10957,14 +10970,14 @@ int3 __ovld __cnfn signbit(float3);
2896 int4 __ovld __cnfn signbit(float4);
2897 int8 __ovld __cnfn signbit(float8);
2898 int16 __ovld __cnfn signbit(float16);
2899-#ifdef cl_khr_fp64
2900+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2901 int __ovld __cnfn signbit(double);
2902 long2 __ovld __cnfn signbit(double2);
2903 long3 __ovld __cnfn signbit(double3);
2904 long4 __ovld __cnfn signbit(double4);
2905 long8 __ovld __cnfn signbit(double8);
2906 long16 __ovld __cnfn signbit(double16);
2907-#endif //cl_khr_fp64
2908+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2909 #ifdef cl_khr_fp16
2910 int __ovld __cnfn signbit(half);
2911 short2 __ovld __cnfn signbit(half2);
2912@@ -11091,14 +11104,14 @@ float3 __ovld __cnfn bitselect(float3 a, float3 b, float3 c);
2913 float4 __ovld __cnfn bitselect(float4 a, float4 b, float4 c);
2914 float8 __ovld __cnfn bitselect(float8 a, float8 b, float8 c);
2915 float16 __ovld __cnfn bitselect(float16 a, float16 b, float16 c);
2916-#ifdef cl_khr_fp64
2917+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2918 double __ovld __cnfn bitselect(double a, double b, double c);
2919 double2 __ovld __cnfn bitselect(double2 a, double2 b, double2 c);
2920 double3 __ovld __cnfn bitselect(double3 a, double3 b, double3 c);
2921 double4 __ovld __cnfn bitselect(double4 a, double4 b, double4 c);
2922 double8 __ovld __cnfn bitselect(double8 a, double8 b, double8 c);
2923 double16 __ovld __cnfn bitselect(double16 a, double16 b, double16 c);
2924-#endif //cl_khr_fp64
2925+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2926 #ifdef cl_khr_fp16
2927 half __ovld __cnfn bitselect(half a, half b, half c);
2928 half2 __ovld __cnfn bitselect(half2 a, half2 b, half2 c);
2929@@ -11231,7 +11244,7 @@ ulong8 __ovld __cnfn select(ulong8 a, ulong8 b, ulong8 c);
2930 long16 __ovld __cnfn select(long16 a, long16 b, ulong16 c);
2931 ulong16 __ovld __cnfn select(ulong16 a, ulong16 b, ulong16 c);
2932
2933-#ifdef cl_khr_fp64
2934+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2935 double __ovld __cnfn select(double a, double b, long c);
2936 double2 __ovld __cnfn select(double2 a, double2 b, long2 c);
2937 double3 __ovld __cnfn select(double3 a, double3 b, long3 c);
2938@@ -11244,7 +11257,7 @@ double3 __ovld __cnfn select(double3 a, double3 b, ulong3 c);
2939 double4 __ovld __cnfn select(double4 a, double4 b, ulong4 c);
2940 double8 __ovld __cnfn select(double8 a, double8 b, ulong8 c);
2941 double16 __ovld __cnfn select(double16 a, double16 b, ulong16 c);
2942-#endif //cl_khr_fp64
2943+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2944 #ifdef cl_khr_fp16
2945 half __ovld __cnfn select(half a, half b, short c);
2946 half2 __ovld __cnfn select(half2 a, half2 b, short2 c);
2947@@ -11323,13 +11336,13 @@ uint16 __ovld vload16(size_t offset, const __constant uint *p);
2948 long16 __ovld vload16(size_t offset, const __constant long *p);
2949 ulong16 __ovld vload16(size_t offset, const __constant ulong *p);
2950 float16 __ovld vload16(size_t offset, const __constant float *p);
2951-#ifdef cl_khr_fp64
2952+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2953 double2 __ovld vload2(size_t offset, const __constant double *p);
2954 double3 __ovld vload3(size_t offset, const __constant double *p);
2955 double4 __ovld vload4(size_t offset, const __constant double *p);
2956 double8 __ovld vload8(size_t offset, const __constant double *p);
2957 double16 __ovld vload16(size_t offset, const __constant double *p);
2958-#endif //cl_khr_fp64
2959+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2960
2961 #ifdef cl_khr_fp16
2962 half __ovld vload(size_t offset, const __constant half *p);
2963@@ -11340,7 +11353,7 @@ half8 __ovld vload8(size_t offset, const __constant half *p);
2964 half16 __ovld vload16(size_t offset, const __constant half *p);
2965 #endif //cl_khr_fp16
2966
2967-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
2968+#ifdef __opencl_c_generic_address_space
2969 char2 __ovld vload2(size_t offset, const char *p);
2970 uchar2 __ovld vload2(size_t offset, const uchar *p);
2971 short2 __ovld vload2(size_t offset, const short *p);
2972@@ -11387,13 +11400,13 @@ long16 __ovld vload16(size_t offset, const long *p);
2973 ulong16 __ovld vload16(size_t offset, const ulong *p);
2974 float16 __ovld vload16(size_t offset, const float *p);
2975
2976-#ifdef cl_khr_fp64
2977+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2978 double2 __ovld vload2(size_t offset, const double *p);
2979 double3 __ovld vload3(size_t offset, const double *p);
2980 double4 __ovld vload4(size_t offset, const double *p);
2981 double8 __ovld vload8(size_t offset, const double *p);
2982 double16 __ovld vload16(size_t offset, const double *p);
2983-#endif //cl_khr_fp64
2984+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2985
2986 #ifdef cl_khr_fp16
2987 half __ovld vload(size_t offset, const half *p);
2988@@ -11403,7 +11416,7 @@ half4 __ovld vload4(size_t offset, const half *p);
2989 half8 __ovld vload8(size_t offset, const half *p);
2990 half16 __ovld vload16(size_t offset, const half *p);
2991 #endif //cl_khr_fp16
2992-#else
2993+#endif //__opencl_c_generic_address_space
2994 char2 __ovld vload2(size_t offset, const __global char *p);
2995 uchar2 __ovld vload2(size_t offset, const __global uchar *p);
2996 short2 __ovld vload2(size_t offset, const __global short *p);
2997@@ -11540,7 +11553,7 @@ long16 __ovld vload16(size_t offset, const __private long *p);
2998 ulong16 __ovld vload16(size_t offset, const __private ulong *p);
2999 float16 __ovld vload16(size_t offset, const __private float *p);
3000
3001-#ifdef cl_khr_fp64
3002+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3003 double2 __ovld vload2(size_t offset, const __global double *p);
3004 double3 __ovld vload3(size_t offset, const __global double *p);
3005 double4 __ovld vload4(size_t offset, const __global double *p);
3006@@ -11556,7 +11569,7 @@ double3 __ovld vload3(size_t offset, const __private double *p);
3007 double4 __ovld vload4(size_t offset, const __private double *p);
3008 double8 __ovld vload8(size_t offset, const __private double *p);
3009 double16 __ovld vload16(size_t offset, const __private double *p);
3010-#endif //cl_khr_fp64
3011+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3012
3013 #ifdef cl_khr_fp16
3014 half __ovld vload(size_t offset, const __global half *p);
3015@@ -11578,9 +11591,8 @@ half4 __ovld vload4(size_t offset, const __private half *p);
3016 half8 __ovld vload8(size_t offset, const __private half *p);
3017 half16 __ovld vload16(size_t offset, const __private half *p);
3018 #endif //cl_khr_fp16
3019-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3020
3021-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3022+#ifdef __opencl_c_generic_address_space
3023 void __ovld vstore2(char2 data, size_t offset, char *p);
3024 void __ovld vstore2(uchar2 data, size_t offset, uchar *p);
3025 void __ovld vstore2(short2 data, size_t offset, short *p);
3026@@ -11626,13 +11638,13 @@ void __ovld vstore16(uint16 data, size_t offset, uint *p);
3027 void __ovld vstore16(long16 data, size_t offset, long *p);
3028 void __ovld vstore16(ulong16 data, size_t offset, ulong *p);
3029 void __ovld vstore16(float16 data, size_t offset, float *p);
3030-#ifdef cl_khr_fp64
3031+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3032 void __ovld vstore2(double2 data, size_t offset, double *p);
3033 void __ovld vstore3(double3 data, size_t offset, double *p);
3034 void __ovld vstore4(double4 data, size_t offset, double *p);
3035 void __ovld vstore8(double8 data, size_t offset, double *p);
3036 void __ovld vstore16(double16 data, size_t offset, double *p);
3037-#endif //cl_khr_fp64
3038+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3039 #ifdef cl_khr_fp16
3040 void __ovld vstore(half data, size_t offset, half *p);
3041 void __ovld vstore2(half2 data, size_t offset, half *p);
3042@@ -11641,7 +11653,7 @@ void __ovld vstore4(half4 data, size_t offset, half *p);
3043 void __ovld vstore8(half8 data, size_t offset, half *p);
3044 void __ovld vstore16(half16 data, size_t offset, half *p);
3045 #endif //cl_khr_fp16
3046-#else
3047+#endif //__opencl_c_generic_address_space
3048 void __ovld vstore2(char2 data, size_t offset, __global char *p);
3049 void __ovld vstore2(uchar2 data, size_t offset, __global uchar *p);
3050 void __ovld vstore2(short2 data, size_t offset, __global short *p);
3051@@ -11777,7 +11789,7 @@ void __ovld vstore16(uint16 data, size_t offset, __private uint *p);
3052 void __ovld vstore16(long16 data, size_t offset, __private long *p);
3053 void __ovld vstore16(ulong16 data, size_t offset, __private ulong *p);
3054 void __ovld vstore16(float16 data, size_t offset, __private float *p);
3055-#ifdef cl_khr_fp64
3056+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3057 void __ovld vstore2(double2 data, size_t offset, __global double *p);
3058 void __ovld vstore3(double3 data, size_t offset, __global double *p);
3059 void __ovld vstore4(double4 data, size_t offset, __global double *p);
3060@@ -11793,7 +11805,7 @@ void __ovld vstore3(double3 data, size_t offset, __private double *p);
3061 void __ovld vstore4(double4 data, size_t offset, __private double *p);
3062 void __ovld vstore8(double8 data, size_t offset, __private double *p);
3063 void __ovld vstore16(double16 data, size_t offset, __private double *p);
3064-#endif //cl_khr_fp64
3065+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3066 #ifdef cl_khr_fp16
3067 void __ovld vstore(half data, size_t offset, __global half *p);
3068 void __ovld vstore2(half2 data, size_t offset, __global half *p);
3069@@ -11814,7 +11826,6 @@ void __ovld vstore4(half4 data, size_t offset, __private half *p);
3070 void __ovld vstore8(half8 data, size_t offset, __private half *p);
3071 void __ovld vstore16(half16 data, size_t offset, __private half *p);
3072 #endif //cl_khr_fp16
3073-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3074
3075 /**
3076 * Read sizeof (half) bytes of data from address
3077@@ -11825,13 +11836,12 @@ void __ovld vstore16(half16 data, size_t offset, __private half *p);
3078 * must be 16-bit aligned.
3079 */
3080 float __ovld vload_half(size_t offset, const __constant half *p);
3081-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3082+#ifdef __opencl_c_generic_address_space
3083 float __ovld vload_half(size_t offset, const half *p);
3084-#else
3085+#endif //__opencl_c_generic_address_space
3086 float __ovld vload_half(size_t offset, const __global half *p);
3087 float __ovld vload_half(size_t offset, const __local half *p);
3088 float __ovld vload_half(size_t offset, const __private half *p);
3089-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3090
3091 /**
3092 * Read sizeof (halfn) bytes of data from address
3093@@ -11846,13 +11856,13 @@ float3 __ovld vload_half3(size_t offset, const __constant half *p);
3094 float4 __ovld vload_half4(size_t offset, const __constant half *p);
3095 float8 __ovld vload_half8(size_t offset, const __constant half *p);
3096 float16 __ovld vload_half16(size_t offset, const __constant half *p);
3097-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3098+#ifdef __opencl_c_generic_address_space
3099 float2 __ovld vload_half2(size_t offset, const half *p);
3100 float3 __ovld vload_half3(size_t offset, const half *p);
3101 float4 __ovld vload_half4(size_t offset, const half *p);
3102 float8 __ovld vload_half8(size_t offset, const half *p);
3103 float16 __ovld vload_half16(size_t offset, const half *p);
3104-#else
3105+#endif //__opencl_c_generic_address_space
3106 float2 __ovld vload_half2(size_t offset, const __global half *p);
3107 float3 __ovld vload_half3(size_t offset, const __global half *p);
3108 float4 __ovld vload_half4(size_t offset, const __global half *p);
3109@@ -11868,7 +11878,6 @@ float3 __ovld vload_half3(size_t offset, const __private half *p);
3110 float4 __ovld vload_half4(size_t offset, const __private half *p);
3111 float8 __ovld vload_half8(size_t offset, const __private half *p);
3112 float16 __ovld vload_half16(size_t offset, const __private half *p);
3113-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3114
3115 /**
3116 * The float value given by data is first
3117@@ -11881,20 +11890,20 @@ float16 __ovld vload_half16(size_t offset, const __private half *p);
3118 * The default current rounding mode is round to
3119 * nearest even.
3120 */
3121-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3122+#ifdef __opencl_c_generic_address_space
3123 void __ovld vstore_half(float data, size_t offset, half *p);
3124 void __ovld vstore_half_rte(float data, size_t offset, half *p);
3125 void __ovld vstore_half_rtz(float data, size_t offset, half *p);
3126 void __ovld vstore_half_rtp(float data, size_t offset, half *p);
3127 void __ovld vstore_half_rtn(float data, size_t offset, half *p);
3128-#ifdef cl_khr_fp64
3129+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3130 void __ovld vstore_half(double data, size_t offset, half *p);
3131 void __ovld vstore_half_rte(double data, size_t offset, half *p);
3132 void __ovld vstore_half_rtz(double data, size_t offset, half *p);
3133 void __ovld vstore_half_rtp(double data, size_t offset, half *p);
3134 void __ovld vstore_half_rtn(double data, size_t offset, half *p);
3135-#endif //cl_khr_fp64
3136-#else
3137+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3138+#endif //__opencl_c_generic_address_space
3139 void __ovld vstore_half(float data, size_t offset, __global half *p);
3140 void __ovld vstore_half_rte(float data, size_t offset, __global half *p);
3141 void __ovld vstore_half_rtz(float data, size_t offset, __global half *p);
3142@@ -11910,7 +11919,7 @@ void __ovld vstore_half_rte(float data, size_t offset, __private half *p);
3143 void __ovld vstore_half_rtz(float data, size_t offset, __private half *p);
3144 void __ovld vstore_half_rtp(float data, size_t offset, __private half *p);
3145 void __ovld vstore_half_rtn(float data, size_t offset, __private half *p);
3146-#ifdef cl_khr_fp64
3147+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3148 void __ovld vstore_half(double data, size_t offset, __global half *p);
3149 void __ovld vstore_half_rte(double data, size_t offset, __global half *p);
3150 void __ovld vstore_half_rtz(double data, size_t offset, __global half *p);
3151@@ -11926,8 +11935,7 @@ void __ovld vstore_half_rte(double data, size_t offset, __private half *p);
3152 void __ovld vstore_half_rtz(double data, size_t offset, __private half *p);
3153 void __ovld vstore_half_rtp(double data, size_t offset, __private half *p);
3154 void __ovld vstore_half_rtn(double data, size_t offset, __private half *p);
3155-#endif //cl_khr_fp64
3156-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3157+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3158
3159 /**
3160 * The floatn value given by data is converted to
3161@@ -11940,7 +11948,7 @@ void __ovld vstore_half_rtn(double data, size_t offset, __private half *p);
3162 * The default current rounding mode is round to
3163 * nearest even.
3164 */
3165-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3166+#ifdef __opencl_c_generic_address_space
3167 void __ovld vstore_half2(float2 data, size_t offset, half *p);
3168 void __ovld vstore_half3(float3 data, size_t offset, half *p);
3169 void __ovld vstore_half4(float4 data, size_t offset, half *p);
3170@@ -11966,7 +11974,7 @@ void __ovld vstore_half3_rtn(float3 data, size_t offset, half *p);
3171 void __ovld vstore_half4_rtn(float4 data, size_t offset, half *p);
3172 void __ovld vstore_half8_rtn(float8 data, size_t offset, half *p);
3173 void __ovld vstore_half16_rtn(float16 data, size_t offset, half *p);
3174-#ifdef cl_khr_fp64
3175+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3176 void __ovld vstore_half2(double2 data, size_t offset, half *p);
3177 void __ovld vstore_half3(double3 data, size_t offset, half *p);
3178 void __ovld vstore_half4(double4 data, size_t offset, half *p);
3179@@ -11992,8 +12000,8 @@ void __ovld vstore_half3_rtn(double3 data, size_t offset, half *p);
3180 void __ovld vstore_half4_rtn(double4 data, size_t offset, half *p);
3181 void __ovld vstore_half8_rtn(double8 data, size_t offset, half *p);
3182 void __ovld vstore_half16_rtn(double16 data, size_t offset, half *p);
3183-#endif //cl_khr_fp64
3184-#else
3185+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3186+#endif //__opencl_c_generic_address_space
3187 void __ovld vstore_half2(float2 data, size_t offset, __global half *p);
3188 void __ovld vstore_half3(float3 data, size_t offset, __global half *p);
3189 void __ovld vstore_half4(float4 data, size_t offset, __global half *p);
3190@@ -12069,7 +12077,7 @@ void __ovld vstore_half3_rtn(float3 data, size_t offset, __private half *p);
3191 void __ovld vstore_half4_rtn(float4 data, size_t offset, __private half *p);
3192 void __ovld vstore_half8_rtn(float8 data, size_t offset, __private half *p);
3193 void __ovld vstore_half16_rtn(float16 data, size_t offset, __private half *p);
3194-#ifdef cl_khr_fp64
3195+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3196 void __ovld vstore_half2(double2 data, size_t offset, __global half *p);
3197 void __ovld vstore_half3(double3 data, size_t offset, __global half *p);
3198 void __ovld vstore_half4(double4 data, size_t offset, __global half *p);
3199@@ -12145,8 +12153,7 @@ void __ovld vstore_half3_rtn(double3 data, size_t offset, __private half *p);
3200 void __ovld vstore_half4_rtn(double4 data, size_t offset, __private half *p);
3201 void __ovld vstore_half8_rtn(double8 data, size_t offset, __private half *p);
3202 void __ovld vstore_half16_rtn(double16 data, size_t offset, __private half *p);
3203-#endif //cl_khr_fp64
3204-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3205+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3206
3207 /**
3208 * For n = 1, 2, 4, 8 and 16 read sizeof (halfn)
3209@@ -12167,14 +12174,14 @@ float3 __ovld vloada_half3(size_t offset, const __constant half *p);
3210 float4 __ovld vloada_half4(size_t offset, const __constant half *p);
3211 float8 __ovld vloada_half8(size_t offset, const __constant half *p);
3212 float16 __ovld vloada_half16(size_t offset, const __constant half *p);
3213-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3214+#ifdef __opencl_c_generic_address_space
3215 float __ovld vloada_half(size_t offset, const half *p);
3216 float2 __ovld vloada_half2(size_t offset, const half *p);
3217 float3 __ovld vloada_half3(size_t offset, const half *p);
3218 float4 __ovld vloada_half4(size_t offset, const half *p);
3219 float8 __ovld vloada_half8(size_t offset, const half *p);
3220 float16 __ovld vloada_half16(size_t offset, const half *p);
3221-#else
3222+#endif //__opencl_c_generic_address_space
3223 float __ovld vloada_half(size_t offset, const __global half *p);
3224 float2 __ovld vloada_half2(size_t offset, const __global half *p);
3225 float3 __ovld vloada_half3(size_t offset, const __global half *p);
3226@@ -12193,7 +12200,6 @@ float3 __ovld vloada_half3(size_t offset, const __private half *p);
3227 float4 __ovld vloada_half4(size_t offset, const __private half *p);
3228 float8 __ovld vloada_half8(size_t offset, const __private half *p);
3229 float16 __ovld vloada_half16(size_t offset, const __private half *p);
3230-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3231
3232 /**
3233 * The floatn value given by data is converted to
3234@@ -12211,7 +12217,7 @@ float16 __ovld vloada_half16(size_t offset, const __private half *p);
3235 * mode. The default current rounding mode is
3236 * round to nearest even.
3237 */
3238-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3239+#ifdef __opencl_c_generic_address_space
3240 void __ovld vstorea_half(float data, size_t offset, half *p);
3241 void __ovld vstorea_half2(float2 data, size_t offset, half *p);
3242 void __ovld vstorea_half3(float3 data, size_t offset, half *p);
3243@@ -12247,7 +12253,7 @@ void __ovld vstorea_half4_rtn(float4 data, size_t offset, half *p);
3244 void __ovld vstorea_half8_rtn(float8 data, size_t offset, half *p);
3245 void __ovld vstorea_half16_rtn(float16 data, size_t offset, half *p);
3246
3247-#ifdef cl_khr_fp64
3248+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3249 void __ovld vstorea_half(double data, size_t offset, half *p);
3250 void __ovld vstorea_half2(double2 data, size_t offset, half *p);
3251 void __ovld vstorea_half3(double3 data, size_t offset, half *p);
3252@@ -12282,9 +12288,9 @@ void __ovld vstorea_half3_rtn(double3 data, size_t offset, half *p);
3253 void __ovld vstorea_half4_rtn(double4 data, size_t offset, half *p);
3254 void __ovld vstorea_half8_rtn(double8 data, size_t offset, half *p);
3255 void __ovld vstorea_half16_rtn(double16 data, size_t offset, half *p);
3256-#endif //cl_khr_fp64
3257+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3258+#endif //__opencl_c_generic_address_space
3259
3260-#else
3261 void __ovld vstorea_half(float data, size_t offset, __global half *p);
3262 void __ovld vstorea_half2(float2 data, size_t offset, __global half *p);
3263 void __ovld vstorea_half3(float3 data, size_t offset, __global half *p);
3264@@ -12390,7 +12396,7 @@ void __ovld vstorea_half4_rtn(float4 data, size_t offset, __private half *p);
3265 void __ovld vstorea_half8_rtn(float8 data, size_t offset, __private half *p);
3266 void __ovld vstorea_half16_rtn(float16 data, size_t offset, __private half *p);
3267
3268-#ifdef cl_khr_fp64
3269+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3270 void __ovld vstorea_half(double data, size_t offset, __global half *p);
3271 void __ovld vstorea_half2(double2 data, size_t offset, __global half *p);
3272 void __ovld vstorea_half3(double3 data, size_t offset, __global half *p);
3273@@ -12495,8 +12501,7 @@ void __ovld vstorea_half3_rtn(double3 data,size_t offset, __private half *p);
3274 void __ovld vstorea_half4_rtn(double4 data,size_t offset, __private half *p);
3275 void __ovld vstorea_half8_rtn(double8 data,size_t offset, __private half *p);
3276 void __ovld vstorea_half16_rtn(double16 data,size_t offset, __private half *p);
3277-#endif //cl_khr_fp64
3278-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3279+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3280
3281 // OpenCL v1.1 s6.11.8, v1.2 s6.12.8, v2.0 s6.13.8 - Synchronization Functions
3282
3283@@ -12580,7 +12585,7 @@ void __ovld write_mem_fence(cl_mem_fence_flags flags);
3284
3285 // OpenCL v2.0 s6.13.9 - Address Space Qualifier Functions
3286
3287-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3288+#ifdef __opencl_c_generic_address_space
3289 cl_mem_fence_flags __ovld get_fence(const void *ptr);
3290 cl_mem_fence_flags __ovld get_fence(void *ptr);
3291
3292@@ -12591,7 +12596,7 @@ cl_mem_fence_flags __ovld get_fence(void *ptr);
3293 * where gentype is builtin type or user defined type.
3294 */
3295
3296-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3297+#endif //__opencl_c_generic_address_space
3298
3299 // 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
3300
3301@@ -12730,7 +12735,7 @@ event_t __ovld async_work_group_copy(__global uint16 *dst, const __local uint16
3302 event_t __ovld async_work_group_copy(__global long16 *dst, const __local long16 *src, size_t num_elements, event_t event);
3303 event_t __ovld async_work_group_copy(__global ulong16 *dst, const __local ulong16 *src, size_t num_elements, event_t event);
3304 event_t __ovld async_work_group_copy(__global float16 *dst, const __local float16 *src, size_t num_elements, event_t event);
3305-#ifdef cl_khr_fp64
3306+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3307 event_t __ovld async_work_group_copy(__local double *dst, const __global double *src, size_t num_elements, event_t event);
3308 event_t __ovld async_work_group_copy(__local double2 *dst, const __global double2 *src, size_t num_elements, event_t event);
3309 event_t __ovld async_work_group_copy(__local double3 *dst, const __global double3 *src, size_t num_elements, event_t event);
3310@@ -12743,7 +12748,7 @@ event_t __ovld async_work_group_copy(__global double3 *dst, const __local double
3311 event_t __ovld async_work_group_copy(__global double4 *dst, const __local double4 *src, size_t num_elements, event_t event);
3312 event_t __ovld async_work_group_copy(__global double8 *dst, const __local double8 *src, size_t num_elements, event_t event);
3313 event_t __ovld async_work_group_copy(__global double16 *dst, const __local double16 *src, size_t num_elements, event_t event);
3314-#endif //cl_khr_fp64
3315+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3316 #ifdef cl_khr_fp16
3317 event_t __ovld async_work_group_copy(__local half *dst, const __global half *src, size_t num_elements, event_t event);
3318 event_t __ovld async_work_group_copy(__local half2 *dst, const __global half2 *src, size_t num_elements, event_t event);
3319@@ -12893,7 +12898,7 @@ event_t __ovld async_work_group_strided_copy(__global uint16 *dst, const __local
3320 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);
3321 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);
3322 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);
3323-#ifdef cl_khr_fp64
3324+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3325 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);
3326 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);
3327 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);
3328@@ -12906,7 +12911,7 @@ event_t __ovld async_work_group_strided_copy(__global double3 *dst, const __loca
3329 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);
3330 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);
3331 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);
3332-#endif //cl_khr_fp64
3333+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3334 #ifdef cl_khr_fp16
3335 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);
3336 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);
3337@@ -12996,14 +13001,14 @@ void __ovld prefetch(const __global uint16 *p, size_t num_elements);
3338 void __ovld prefetch(const __global long16 *p, size_t num_elements);
3339 void __ovld prefetch(const __global ulong16 *p, size_t num_elements);
3340 void __ovld prefetch(const __global float16 *p, size_t num_elements);
3341-#ifdef cl_khr_fp64
3342+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3343 void __ovld prefetch(const __global double *p, size_t num_elements);
3344 void __ovld prefetch(const __global double2 *p, size_t num_elements);
3345 void __ovld prefetch(const __global double3 *p, size_t num_elements);
3346 void __ovld prefetch(const __global double4 *p, size_t num_elements);
3347 void __ovld prefetch(const __global double8 *p, size_t num_elements);
3348 void __ovld prefetch(const __global double16 *p, size_t num_elements);
3349-#endif //cl_khr_fp64
3350+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3351 #ifdef cl_khr_fp16
3352 void __ovld prefetch(const __global half *p, size_t num_elements);
3353 void __ovld prefetch(const __global half2 *p, size_t num_elements);
3354@@ -13026,9 +13031,11 @@ void __ovld prefetch(const __global half16 *p, size_t num_elements);
3355 * pointed by p. The function returns old.
3356 */
3357 int __ovld atomic_add(volatile __global int *p, int val);
3358-unsigned int __ovld atomic_add(volatile __global unsigned int *p, unsigned int val);
3359+unsigned int __ovld atomic_add(volatile __global unsigned int *p,
3360+ unsigned int val);
3361 int __ovld atomic_add(volatile __local int *p, int val);
3362-unsigned int __ovld atomic_add(volatile __local unsigned int *p, unsigned int val);
3363+unsigned int __ovld atomic_add(volatile __local unsigned int *p,
3364+ unsigned int val);
3365 #ifdef __OPENCL_CPP_VERSION__
3366 int __ovld atomic_add(volatile int *p, int val);
3367 unsigned int __ovld atomic_add(volatile unsigned int *p, unsigned int val);
3368@@ -13056,9 +13063,11 @@ unsigned long __ovld atom_add(volatile __local unsigned long *p, unsigned long v
3369 * returns old.
3370 */
3371 int __ovld atomic_sub(volatile __global int *p, int val);
3372-unsigned int __ovld atomic_sub(volatile __global unsigned int *p, unsigned int val);
3373+unsigned int __ovld atomic_sub(volatile __global unsigned int *p,
3374+ unsigned int val);
3375 int __ovld atomic_sub(volatile __local int *p, int val);
3376-unsigned int __ovld atomic_sub(volatile __local unsigned int *p, unsigned int val);
3377+unsigned int __ovld atomic_sub(volatile __local unsigned int *p,
3378+ unsigned int val);
3379 #ifdef __OPENCL_CPP_VERSION__
3380 int __ovld atomic_sub(volatile int *p, int val);
3381 unsigned int __ovld atomic_sub(volatile unsigned int *p, unsigned int val);
3382@@ -13086,9 +13095,11 @@ unsigned long __ovld atom_sub(volatile __local unsigned long *p, unsigned long v
3383 * value.
3384 */
3385 int __ovld atomic_xchg(volatile __global int *p, int val);
3386-unsigned int __ovld atomic_xchg(volatile __global unsigned int *p, unsigned int val);
3387+unsigned int __ovld atomic_xchg(volatile __global unsigned int *p,
3388+ unsigned int val);
3389 int __ovld atomic_xchg(volatile __local int *p, int val);
3390-unsigned int __ovld atomic_xchg(volatile __local unsigned int *p, unsigned int val);
3391+unsigned int __ovld atomic_xchg(volatile __local unsigned int *p,
3392+ unsigned int val);
3393 float __ovld atomic_xchg(volatile __global float *p, float val);
3394 float __ovld atomic_xchg(volatile __local float *p, float val);
3395 #ifdef __OPENCL_CPP_VERSION__
3396@@ -13183,12 +13194,15 @@ unsigned long __ovld atom_dec(volatile __local unsigned long *p);
3397 * returns old.
3398 */
3399 int __ovld atomic_cmpxchg(volatile __global int *p, int cmp, int val);
3400-unsigned int __ovld atomic_cmpxchg(volatile __global unsigned int *p, unsigned int cmp, unsigned int val);
3401+unsigned int __ovld atomic_cmpxchg(volatile __global unsigned int *p,
3402+ unsigned int cmp, unsigned int val);
3403 int __ovld atomic_cmpxchg(volatile __local int *p, int cmp, int val);
3404-unsigned int __ovld atomic_cmpxchg(volatile __local unsigned int *p, unsigned int cmp, unsigned int val);
3405+unsigned int __ovld atomic_cmpxchg(volatile __local unsigned int *p,
3406+ unsigned int cmp, unsigned int val);
3407 #ifdef __OPENCL_CPP_VERSION__
3408 int __ovld atomic_cmpxchg(volatile int *p, int cmp, int val);
3409-unsigned int __ovld atomic_cmpxchg(volatile unsigned int *p, unsigned int cmp, unsigned int val);
3410+unsigned int __ovld atomic_cmpxchg(volatile unsigned int *p, unsigned int cmp,
3411+ unsigned int val);
3412 #endif
3413
3414 #if defined(cl_khr_global_int32_base_atomics)
3415@@ -13215,9 +13229,11 @@ unsigned long __ovld atom_cmpxchg(volatile __local unsigned long *p, unsigned lo
3416 * returns old.
3417 */
3418 int __ovld atomic_min(volatile __global int *p, int val);
3419-unsigned int __ovld atomic_min(volatile __global unsigned int *p, unsigned int val);
3420+unsigned int __ovld atomic_min(volatile __global unsigned int *p,
3421+ unsigned int val);
3422 int __ovld atomic_min(volatile __local int *p, int val);
3423-unsigned int __ovld atomic_min(volatile __local unsigned int *p, unsigned int val);
3424+unsigned int __ovld atomic_min(volatile __local unsigned int *p,
3425+ unsigned int val);
3426 #ifdef __OPENCL_CPP_VERSION__
3427 int __ovld atomic_min(volatile int *p, int val);
3428 unsigned int __ovld atomic_min(volatile unsigned int *p, unsigned int val);
3429@@ -13247,9 +13263,11 @@ unsigned long __ovld atom_min(volatile __local unsigned long *p, unsigned long v
3430 * returns old.
3431 */
3432 int __ovld atomic_max(volatile __global int *p, int val);
3433-unsigned int __ovld atomic_max(volatile __global unsigned int *p, unsigned int val);
3434+unsigned int __ovld atomic_max(volatile __global unsigned int *p,
3435+ unsigned int val);
3436 int __ovld atomic_max(volatile __local int *p, int val);
3437-unsigned int __ovld atomic_max(volatile __local unsigned int *p, unsigned int val);
3438+unsigned int __ovld atomic_max(volatile __local unsigned int *p,
3439+ unsigned int val);
3440 #ifdef __OPENCL_CPP_VERSION__
3441 int __ovld atomic_max(volatile int *p, int val);
3442 unsigned int __ovld atomic_max(volatile unsigned int *p, unsigned int val);
3443@@ -13278,9 +13296,11 @@ unsigned long __ovld atom_max(volatile __local unsigned long *p, unsigned long v
3444 * pointed by p. The function returns old.
3445 */
3446 int __ovld atomic_and(volatile __global int *p, int val);
3447-unsigned int __ovld atomic_and(volatile __global unsigned int *p, unsigned int val);
3448+unsigned int __ovld atomic_and(volatile __global unsigned int *p,
3449+ unsigned int val);
3450 int __ovld atomic_and(volatile __local int *p, int val);
3451-unsigned int __ovld atomic_and(volatile __local unsigned int *p, unsigned int val);
3452+unsigned int __ovld atomic_and(volatile __local unsigned int *p,
3453+ unsigned int val);
3454 #ifdef __OPENCL_CPP_VERSION__
3455 int __ovld atomic_and(volatile int *p, int val);
3456 unsigned int __ovld atomic_and(volatile unsigned int *p, unsigned int val);
3457@@ -13309,9 +13329,11 @@ unsigned long __ovld atom_and(volatile __local unsigned long *p, unsigned long v
3458 * pointed by p. The function returns old.
3459 */
3460 int __ovld atomic_or(volatile __global int *p, int val);
3461-unsigned int __ovld atomic_or(volatile __global unsigned int *p, unsigned int val);
3462+unsigned int __ovld atomic_or(volatile __global unsigned int *p,
3463+ unsigned int val);
3464 int __ovld atomic_or(volatile __local int *p, int val);
3465-unsigned int __ovld atomic_or(volatile __local unsigned int *p, unsigned int val);
3466+unsigned int __ovld atomic_or(volatile __local unsigned int *p,
3467+ unsigned int val);
3468 #ifdef __OPENCL_CPP_VERSION__
3469 int __ovld atomic_or(volatile int *p, int val);
3470 unsigned int __ovld atomic_or(volatile unsigned int *p, unsigned int val);
3471@@ -13340,9 +13362,11 @@ unsigned long __ovld atom_or(volatile __local unsigned long *p, unsigned long va
3472 * pointed by p. The function returns old.
3473 */
3474 int __ovld atomic_xor(volatile __global int *p, int val);
3475-unsigned int __ovld atomic_xor(volatile __global unsigned int *p, unsigned int val);
3476+unsigned int __ovld atomic_xor(volatile __global unsigned int *p,
3477+ unsigned int val);
3478 int __ovld atomic_xor(volatile __local int *p, int val);
3479-unsigned int __ovld atomic_xor(volatile __local unsigned int *p, unsigned int val);
3480+unsigned int __ovld atomic_xor(volatile __local unsigned int *p,
3481+ unsigned int val);
3482 #ifdef __OPENCL_CPP_VERSION__
3483 int __ovld atomic_xor(volatile int *p, int val);
3484 unsigned int __ovld atomic_xor(volatile unsigned int *p, unsigned int val);
3485@@ -13380,120 +13404,78 @@ unsigned long __ovld atom_xor(volatile __local unsigned long *p, unsigned long v
3486 #endif
3487
3488 // atomic_init()
3489+#ifdef __opencl_c_generic_address_space
3490 void __ovld atomic_init(volatile atomic_int *object, int value);
3491 void __ovld atomic_init(volatile atomic_uint *object, uint value);
3492 void __ovld atomic_init(volatile atomic_float *object, float value);
3493 #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
3494 void __ovld atomic_init(volatile atomic_long *object, long value);
3495 void __ovld atomic_init(volatile atomic_ulong *object, ulong value);
3496-#ifdef cl_khr_fp64
3497+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3498 void __ovld atomic_init(volatile atomic_double *object, double value);
3499-#endif //cl_khr_fp64
3500-#endif
3501+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3502+#endif // defined(cl_khr_int64_base_atomics) &&
3503+ // defined(cl_khr_int64_extended_atomics)
3504+#endif // __opencl_c_generic_address_space
3505+
3506+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
3507+void __ovld atomic_init(volatile atomic_int __global *object, int value);
3508+void __ovld atomic_init(volatile atomic_int __local *object, int value);
3509+void __ovld atomic_init(volatile atomic_uint __global *object, uint value);
3510+void __ovld atomic_init(volatile atomic_uint __local *object, uint value);
3511+void __ovld atomic_init(volatile atomic_float __global *object, float value);
3512+void __ovld atomic_init(volatile atomic_float __local *object, float value);
3513+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
3514+void __ovld atomic_init(volatile atomic_long __global *object, long value);
3515+void __ovld atomic_init(volatile atomic_long __local *object, long value);
3516+void __ovld atomic_init(volatile atomic_ulong __global *object, ulong value);
3517+void __ovld atomic_init(volatile atomic_ulong __local *object, ulong value);
3518+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3519+void __ovld atomic_init(volatile atomic_double __global *object, double value);
3520+void __ovld atomic_init(volatile atomic_double __local *object, double value);
3521+#endif // cl_khr_fp64
3522+#endif // defined(cl_khr_int64_base_atomics) &&
3523+ // defined(cl_khr_int64_extended_atomics)
3524+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
3525
3526 // atomic_work_item_fence()
3527-void __ovld atomic_work_item_fence(cl_mem_fence_flags flags, memory_order order, memory_scope scope);
3528+void __ovld atomic_work_item_fence(cl_mem_fence_flags flags, memory_order order,
3529+ memory_scope scope);
3530
3531 // atomic_fetch()
3532-
3533+#if defined(__opencl_c_atomic_scope_device) && \
3534+ defined(__opencl_c_atomic_order_seq_cst)
3535+#ifdef __opencl_c_generic_address_space
3536 int __ovld atomic_fetch_add(volatile atomic_int *object, int operand);
3537-int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand, memory_order order);
3538-int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
3539 uint __ovld atomic_fetch_add(volatile atomic_uint *object, uint operand);
3540-uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object, uint operand, memory_order order);
3541-uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
3542 int __ovld atomic_fetch_sub(volatile atomic_int *object, int operand);
3543-int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand, memory_order order);
3544-int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
3545 uint __ovld atomic_fetch_sub(volatile atomic_uint *object, uint operand);
3546-uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object, uint operand, memory_order order);
3547-uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
3548 int __ovld atomic_fetch_or(volatile atomic_int *object, int operand);
3549-int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand, memory_order order);
3550-int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
3551 uint __ovld atomic_fetch_or(volatile atomic_uint *object, uint operand);
3552-uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand, memory_order order);
3553-uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
3554 int __ovld atomic_fetch_xor(volatile atomic_int *object, int operand);
3555-int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand, memory_order order);
3556-int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
3557 uint __ovld atomic_fetch_xor(volatile atomic_uint *object, uint operand);
3558-uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object, uint operand, memory_order order);
3559-uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
3560 int __ovld atomic_fetch_and(volatile atomic_int *object, int operand);
3561-int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand, memory_order order);
3562-int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
3563 uint __ovld atomic_fetch_and(volatile atomic_uint *object, uint operand);
3564-uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object, uint operand, memory_order order);
3565-uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
3566 int __ovld atomic_fetch_min(volatile atomic_int *object, int operand);
3567-int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand, memory_order order);
3568-int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
3569 uint __ovld atomic_fetch_min(volatile atomic_uint *object, uint operand);
3570-uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object, uint operand, memory_order order);
3571-uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
3572-uint __ovld atomic_fetch_min(volatile atomic_uint *object, int operand);
3573-uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object, int operand, memory_order order);
3574-uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object, int operand, memory_order order, memory_scope scope);
3575 int __ovld atomic_fetch_max(volatile atomic_int *object, int operand);
3576-int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand, memory_order order);
3577-int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
3578 uint __ovld atomic_fetch_max(volatile atomic_uint *object, uint operand);
3579-uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object, uint operand, memory_order order);
3580-uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
3581-uint __ovld atomic_fetch_max(volatile atomic_uint *object, int operand);
3582-uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object, int operand, memory_order order);
3583-uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object, int operand, memory_order order, memory_scope scope);
3584
3585 #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
3586 long __ovld atomic_fetch_add(volatile atomic_long *object, long operand);
3587-long __ovld atomic_fetch_add_explicit(volatile atomic_long *object, long operand, memory_order order);
3588-long __ovld atomic_fetch_add_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
3589 ulong __ovld atomic_fetch_add(volatile atomic_ulong *object, ulong operand);
3590-ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
3591-ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
3592 long __ovld atomic_fetch_sub(volatile atomic_long *object, long operand);
3593-long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object, long operand, memory_order order);
3594-long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
3595 ulong __ovld atomic_fetch_sub(volatile atomic_ulong *object, ulong operand);
3596-ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
3597-ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
3598 long __ovld atomic_fetch_or(volatile atomic_long *object, long operand);
3599-long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand, memory_order order);
3600-long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
3601 ulong __ovld atomic_fetch_or(volatile atomic_ulong *object, ulong operand);
3602-ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
3603-ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
3604 long __ovld atomic_fetch_xor(volatile atomic_long *object, long operand);
3605-long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object, long operand, memory_order order);
3606-long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
3607 ulong __ovld atomic_fetch_xor(volatile atomic_ulong *object, ulong operand);
3608-ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
3609-ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
3610 long __ovld atomic_fetch_and(volatile atomic_long *object, long operand);
3611-long __ovld atomic_fetch_and_explicit(volatile atomic_long *object, long operand, memory_order order);
3612-long __ovld atomic_fetch_and_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
3613 ulong __ovld atomic_fetch_and(volatile atomic_ulong *object, ulong operand);
3614-ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
3615-ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
3616 long __ovld atomic_fetch_min(volatile atomic_long *object, long operand);
3617-long __ovld atomic_fetch_min_explicit(volatile atomic_long *object, long operand, memory_order order);
3618-long __ovld atomic_fetch_min_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
3619 ulong __ovld atomic_fetch_min(volatile atomic_ulong *object, ulong operand);
3620-ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
3621-ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
3622-ulong __ovld atomic_fetch_min(volatile atomic_ulong *object, long operand);
3623-ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object, long operand, memory_order order);
3624-ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object, long operand, memory_order order, memory_scope scope);
3625 long __ovld atomic_fetch_max(volatile atomic_long *object, long operand);
3626-long __ovld atomic_fetch_max_explicit(volatile atomic_long *object, long operand, memory_order order);
3627-long __ovld atomic_fetch_max_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
3628 ulong __ovld atomic_fetch_max(volatile atomic_ulong *object, ulong operand);
3629-ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
3630-ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
3631-ulong __ovld atomic_fetch_max(volatile atomic_ulong *object, long operand);
3632-ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, long operand, memory_order order);
3633-ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, long operand, memory_order order, memory_scope scope);
3634 #endif //defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
3635
3636 // OpenCL v2.0 s6.13.11.7.5:
3637@@ -13501,196 +13483,2239 @@ ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, long opera
3638 // or/xor/and/min/max: atomic type argument can be intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t.
3639
3640 #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
3641-uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t *object, ptrdiff_t operand);
3642-uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order);
3643-uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order, memory_scope scope);
3644-uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t *object, ptrdiff_t operand);
3645-uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order);
3646-uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order, memory_scope scope);
3647-
3648-uintptr_t __ovld atomic_fetch_or(volatile atomic_uintptr_t *object, intptr_t operand);
3649-uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order);
3650-uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order, memory_scope scope);
3651-uintptr_t __ovld atomic_fetch_xor(volatile atomic_uintptr_t *object, intptr_t operand);
3652-uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order);
3653-uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order, memory_scope scope);
3654-uintptr_t __ovld atomic_fetch_and(volatile atomic_uintptr_t *object, intptr_t operand);
3655-uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order);
3656-uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order, memory_scope scope);
3657-uintptr_t __ovld atomic_fetch_min(volatile atomic_uintptr_t *object, intptr_t opermax);
3658-uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder);
3659-uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder, memory_scope scope);
3660-uintptr_t __ovld atomic_fetch_max(volatile atomic_uintptr_t *object, intptr_t opermax);
3661-uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder);
3662-uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder, memory_scope scope);
3663-
3664-intptr_t __ovld atomic_fetch_or(volatile atomic_intptr_t *object, uintptr_t operand);
3665-intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order);
3666-intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order, memory_scope scope);
3667-intptr_t __ovld atomic_fetch_xor(volatile atomic_intptr_t *object, uintptr_t operand);
3668-intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order);
3669-intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order, memory_scope scope);
3670-intptr_t __ovld atomic_fetch_and(volatile atomic_intptr_t *object, uintptr_t operand);
3671-intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order);
3672-intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order, memory_scope scope);
3673-intptr_t __ovld atomic_fetch_min(volatile atomic_intptr_t *object, uintptr_t opermax);
3674-intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder);
3675-intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder, memory_scope scope);
3676-intptr_t __ovld atomic_fetch_max(volatile atomic_intptr_t *object, uintptr_t opermax);
3677-intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder);
3678-intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder, memory_scope scope);
3679+uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t *object,
3680+ ptrdiff_t operand);
3681+uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t *object,
3682+ ptrdiff_t operand);
3683+
3684+uintptr_t __ovld atomic_fetch_or(volatile atomic_uintptr_t *object,
3685+ intptr_t operand);
3686+uintptr_t __ovld atomic_fetch_xor(volatile atomic_uintptr_t *object,
3687+ intptr_t operand);
3688+uintptr_t __ovld atomic_fetch_and(volatile atomic_uintptr_t *object,
3689+ intptr_t operand);
3690+uintptr_t __ovld atomic_fetch_min(volatile atomic_uintptr_t *object,
3691+ intptr_t opermax);
3692+uintptr_t __ovld atomic_fetch_max(volatile atomic_uintptr_t *object,
3693+ intptr_t opermax);
3694+
3695+intptr_t __ovld atomic_fetch_or(volatile atomic_intptr_t *object,
3696+ uintptr_t operand);
3697+intptr_t __ovld atomic_fetch_xor(volatile atomic_intptr_t *object,
3698+ uintptr_t operand);
3699+intptr_t __ovld atomic_fetch_and(volatile atomic_intptr_t *object,
3700+ uintptr_t operand);
3701+intptr_t __ovld atomic_fetch_min(volatile atomic_intptr_t *object,
3702+ uintptr_t opermax);
3703+intptr_t __ovld atomic_fetch_max(volatile atomic_intptr_t *object,
3704+ uintptr_t opermax);
3705+#endif // defined(cl_khr_int64_base_atomics) &&
3706+ // defined(cl_khr_int64_extended_atomics)
3707+#endif // __opencl_c_generic_address_space
3708+
3709+#if(__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
3710+int __ovld atomic_fetch_add(volatile atomic_int __global *object, int operand);
3711+uint __ovld atomic_fetch_add(volatile atomic_uint __local *object,
3712+ uint operand);
3713+int __ovld atomic_fetch_sub(volatile atomic_int __global *object, int operand);
3714+int __ovld atomic_fetch_sub(volatile atomic_int __local *object, int operand);
3715+uint __ovld atomic_fetch_sub(volatile atomic_uint __local *object,
3716+ uint operand);
3717+uint __ovld atomic_fetch_sub(volatile atomic_uint __global *object,
3718+ uint operand);
3719+int __ovld atomic_fetch_or(volatile atomic_int __global *object, int operand);
3720+uint __ovld atomic_fetch_sub(volatile atomic_uint __local *object,
3721+ uint operand);
3722+uint __ovld atomic_fetch_or(volatile atomic_uint __global *object,
3723+ uint operand);
3724+uint __ovld atomic_fetch_or(volatile atomic_uint __local *object, uint operand);
3725+int __ovld atomic_fetch_xor(volatile atomic_int __global *object, int operand);
3726+int __ovld atomic_fetch_xor(volatile atomic_int __local *object, int operand);
3727+uint __ovld atomic_fetch_xor(volatile atomic_uint __global *object,
3728+ uint operand);
3729+uint __ovld atomic_fetch_xor(volatile atomic_uint __local *object,
3730+ uint operand);
3731+int __ovld atomic_fetch_and(volatile atomic_int __global *object, int operand);
3732+int __ovld atomic_fetch_and(volatile atomic_int __local *object, int operand);
3733+uint __ovld atomic_fetch_and(volatile atomic_uint __global *object,
3734+ uint operand);
3735+uint __ovld atomic_fetch_and(volatile atomic_uint __local *object,
3736+ uint operand);
3737+int __ovld atomic_fetch_min(volatile atomic_int __global *object, int operand);
3738+int __ovld atomic_fetch_min(volatile atomic_int __local *object, int operand);
3739+uint __ovld atomic_fetch_min(volatile atomic_uint __global *object,
3740+ uint operand);
3741+uint __ovld atomic_fetch_min(volatile atomic_uint __local *object,
3742+ uint operand);
3743+int __ovld atomic_fetch_max(volatile atomic_int __global *object, int operand);
3744+int __ovld atomic_fetch_max(volatile atomic_int __local *object, int operand);
3745+uint __ovld atomic_fetch_max(volatile atomic_uint __global *object,
3746+ uint operand);
3747+uint __ovld atomic_fetch_max(volatile atomic_uint __local *object,
3748+ uint operand);
3749+
3750+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
3751+long __ovld atomic_fetch_add(volatile atomic_long __global *object,
3752+ long operand);
3753+long __ovld atomic_fetch_add(volatile atomic_long __local *object,
3754+ long operand);
3755+ulong __ovld atomic_fetch_add(volatile atomic_ulong __global *object,
3756+ ulong operand);
3757+ulong __ovld atomic_fetch_add(volatile atomic_ulong __local *object,
3758+ ulong operand);
3759+long __ovld atomic_fetch_sub(volatile atomic_long __global *object,
3760+ long operand);
3761+long __ovld atomic_fetch_sub(volatile atomic_long __local *object,
3762+ long operand);
3763+ulong __ovld atomic_fetch_sub(volatile atomic_ulong __global *object,
3764+ ulong operand);
3765+ulong __ovld atomic_fetch_sub(volatile atomic_ulong __local *object,
3766+ ulong operand);
3767+long __ovld atomic_fetch_or(volatile atomic_long __global *object,
3768+ long operand);
3769+long __ovld atomic_fetch_or(volatile atomic_long __local *object, long operand);
3770+ulong __ovld atomic_fetch_or(volatile atomic_ulong __global *object,
3771+ ulong operand);
3772+ulong __ovld atomic_fetch_or(volatile atomic_ulong __local *object,
3773+ ulong operand);
3774+long __ovld atomic_fetch_xor(volatile atomic_long __global *object,
3775+ long operand);
3776+long __ovld atomic_fetch_xor(volatile atomic_long __local *object,
3777+ long operand);
3778+ulong __ovld atomic_fetch_xor(volatile atomic_ulong __global *object,
3779+ ulong operand);
3780+ulong __ovld atomic_fetch_xor(volatile atomic_ulong __local *object,
3781+ ulong operand);
3782+long __ovld atomic_fetch_and(volatile atomic_long __global *object,
3783+ long operand);
3784+long __ovld atomic_fetch_and(volatile atomic_long __local *object,
3785+ long operand);
3786+ulong __ovld atomic_fetch_and(volatile atomic_ulong __global *object,
3787+ ulong operand);
3788+ulong __ovld atomic_fetch_and(volatile atomic_ulong __local *object,
3789+ ulong operand);
3790+long __ovld atomic_fetch_min(volatile atomic_long __global *object,
3791+ long operand);
3792+long __ovld atomic_fetch_min(volatile atomic_long __local *object,
3793+ long operand);
3794+ulong __ovld atomic_fetch_min(volatile atomic_ulong __global *object,
3795+ ulong operand);
3796+ulong __ovld atomic_fetch_min(volatile atomic_ulong __local *object,
3797+ ulong operand);
3798+long __ovld atomic_fetch_max(volatile atomic_long __global *object,
3799+ long operand);
3800+long __ovld atomic_fetch_max(volatile atomic_long __local *object,
3801+ long operand);
3802+ulong __ovld atomic_fetch_max(volatile atomic_ulong __global *object,
3803+ ulong operand);
3804+ulong __ovld atomic_fetch_max(volatile atomic_ulong __local *object,
3805+ ulong operand);
3806+#endif // defined(cl_khr_int64_base_atomics) &&
3807+ // defined(cl_khr_int64_extended_atomics)
3808+
3809+// OpenCL v2.0 s6.13.11.7.5:
3810+// add/sub: atomic type argument can be uintptr_t/intptr_t, value type argument
3811+// can be ptrdiff_t. or/xor/and/min/max: atomic type argument can be
3812+// intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t.
3813+
3814+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
3815+uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t __global *object,
3816+ ptrdiff_t operand);
3817+uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t __local *object,
3818+ ptrdiff_t operand);
3819+uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t __global *object,
3820+ ptrdiff_t operand);
3821+uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t __local *object,
3822+ ptrdiff_t operand);
3823+
3824+uintptr_t __ovld atomic_fetch_or(volatile atomic_uintptr_t __global *object,
3825+ intptr_t operand);
3826+uintptr_t __ovld atomic_fetch_or(volatile atomic_uintptr_t __local *object,
3827+ intptr_t operand);
3828+uintptr_t __ovld atomic_fetch_xor(volatile atomic_uintptr_t __global *object,
3829+ intptr_t operand);
3830+uintptr_t __ovld atomic_fetch_xor(volatile atomic_uintptr_t __local *object,
3831+ intptr_t operand);
3832+uintptr_t __ovld atomic_fetch_and(volatile atomic_uintptr_t __global *object,
3833+ intptr_t operand);
3834+uintptr_t __ovld atomic_fetch_and(volatile atomic_uintptr_t __local *object,
3835+ intptr_t operand);
3836+uintptr_t __ovld atomic_fetch_min(volatile atomic_uintptr_t __global *object,
3837+ intptr_t opermax);
3838+uintptr_t __ovld atomic_fetch_min(volatile atomic_uintptr_t __local *object,
3839+ intptr_t opermax);
3840+uintptr_t __ovld atomic_fetch_max(volatile atomic_uintptr_t __global *object,
3841+ intptr_t opermax);
3842+uintptr_t __ovld atomic_fetch_max(volatile atomic_uintptr_t __local *object,
3843+ intptr_t opermax);
3844+
3845+intptr_t __ovld atomic_fetch_or(volatile atomic_intptr_t __global *object,
3846+ uintptr_t operand);
3847+intptr_t __ovld atomic_fetch_or(volatile atomic_intptr_t __local *object,
3848+ uintptr_t operand);
3849+intptr_t __ovld atomic_fetch_xor(volatile atomic_intptr_t __global *object,
3850+ uintptr_t operand);
3851+intptr_t __ovld atomic_fetch_xor(volatile atomic_intptr_t __local *object,
3852+ uintptr_t operand);
3853+intptr_t __ovld atomic_fetch_and(volatile atomic_intptr_t __global *object,
3854+ uintptr_t operand);
3855+intptr_t __ovld atomic_fetch_and(volatile atomic_intptr_t __local *object,
3856+ uintptr_t operand);
3857+intptr_t __ovld atomic_fetch_min(volatile atomic_intptr_t __global *object,
3858+ uintptr_t opermax);
3859+intptr_t __ovld atomic_fetch_min(volatile atomic_intptr_t __local *object,
3860+ uintptr_t opermax);
3861+intptr_t __ovld atomic_fetch_max(volatile atomic_intptr_t __global *object,
3862+ uintptr_t opermax);
3863+intptr_t __ovld atomic_fetch_max(volatile atomic_intptr_t __local *object,
3864+ uintptr_t opermax);
3865+#endif // defined(cl_khr_int64_base_atomics) &&
3866+ // defined(cl_khr_int64_extended_atomics)
3867+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
3868+
3869+#endif // defined(__opencl_c_atomic_scope_device) &&
3870+ // defined(__opencl_c_atomic_order_seq_cst)
3871+
3872+#ifdef __opencl_c_generic_address_space
3873+#ifdef __opencl_c_atomic_scope_device
3874+int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand,
3875+ memory_order order);
3876+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object,
3877+ uint operand, memory_order order);
3878+int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand,
3879+ memory_order order);
3880+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object,
3881+ uint operand, memory_order order);
3882+int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand,
3883+ memory_order order);
3884+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand,
3885+ memory_order order);
3886+int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand,
3887+ memory_order order);
3888+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object,
3889+ uint operand, memory_order order);
3890+int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand,
3891+ memory_order order);
3892+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object,
3893+ uint operand, memory_order order);
3894+int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand,
3895+ memory_order order);
3896+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object,
3897+ uint operand, memory_order order);
3898+int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand,
3899+ memory_order order);
3900+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object,
3901+ uint operand, memory_order order);
3902+#endif // __opencl_c_atomic_scope_device
3903+int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand,
3904+ memory_order order, memory_scope scope);
3905+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object,
3906+ uint operand, memory_order order,
3907+ memory_scope scope);
3908+int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand,
3909+ memory_order order, memory_scope scope);
3910+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object,
3911+ uint operand, memory_order order,
3912+ memory_scope scope);
3913+int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand,
3914+ memory_order order, memory_scope scope);
3915+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand,
3916+ memory_order order, memory_scope scope);
3917+int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand,
3918+ memory_order order, memory_scope scope);
3919+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object,
3920+ uint operand, memory_order order,
3921+ memory_scope scope);
3922+int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand,
3923+ memory_order order, memory_scope scope);
3924+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object,
3925+ uint operand, memory_order order,
3926+ memory_scope scope);
3927+int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand,
3928+ memory_order order, memory_scope scope);
3929+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object,
3930+ uint operand, memory_order order,
3931+ memory_scope scope);
3932+int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand,
3933+ memory_order order, memory_scope scope);
3934+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object,
3935+ uint operand, memory_order order,
3936+ memory_scope scope);
3937+
3938+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
3939+#ifdef __opencl_c_atomic_scope_device
3940+long __ovld atomic_fetch_add_explicit(volatile atomic_long *object,
3941+ long operand, memory_order order);
3942+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object,
3943+ ulong operand, memory_order order);
3944+long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object,
3945+ long operand, memory_order order);
3946+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object,
3947+ ulong operand, memory_order order);
3948+long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand,
3949+ memory_order order);
3950+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object,
3951+ ulong operand, memory_order order);
3952+long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object,
3953+ long operand, memory_order order);
3954+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object,
3955+ ulong operand, memory_order order);
3956+long __ovld atomic_fetch_and_explicit(volatile atomic_long *object,
3957+ long operand, memory_order order);
3958+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object,
3959+ ulong operand, memory_order order);
3960+long __ovld atomic_fetch_min_explicit(volatile atomic_long *object,
3961+ long operand, memory_order order);
3962+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object,
3963+ ulong operand, memory_order order);
3964+long __ovld atomic_fetch_max_explicit(volatile atomic_long *object,
3965+ long operand, memory_order order);
3966+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object,
3967+ ulong operand, memory_order order);
3968+#endif // __opencl_c_atomic_scope_device
3969+long __ovld atomic_fetch_add_explicit(volatile atomic_long *object,
3970+ long operand, memory_order order,
3971+ memory_scope scope);
3972+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object,
3973+ ulong operand, memory_order order,
3974+ memory_scope scope);
3975+long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object,
3976+ long operand, memory_order order,
3977+ memory_scope scope);
3978+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object,
3979+ ulong operand, memory_order order,
3980+ memory_scope scope);
3981+long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand,
3982+ memory_order order, memory_scope scope);
3983+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object,
3984+ ulong operand, memory_order order,
3985+ memory_scope scope);
3986+long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object,
3987+ long operand, memory_order order,
3988+ memory_scope scope);
3989+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object,
3990+ ulong operand, memory_order order,
3991+ memory_scope scope);
3992+long __ovld atomic_fetch_and_explicit(volatile atomic_long *object,
3993+ long operand, memory_order order,
3994+ memory_scope scope);
3995+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object,
3996+ ulong operand, memory_order order,
3997+ memory_scope scope);
3998+long __ovld atomic_fetch_min_explicit(volatile atomic_long *object,
3999+ long operand, memory_order order,
4000+ memory_scope scope);
4001+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object,
4002+ ulong operand, memory_order order,
4003+ memory_scope scope);
4004+long __ovld atomic_fetch_max_explicit(volatile atomic_long *object,
4005+ long operand, memory_order order,
4006+ memory_scope scope);
4007+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object,
4008+ ulong operand, memory_order order,
4009+ memory_scope scope);
4010+#endif // defined(cl_khr_int64_base_atomics) &&
4011+ // defined(cl_khr_int64_extended_atomics)
4012+
4013+// OpenCL v2.0 s6.13.11.7.5:
4014+// add/sub: atomic type argument can be uintptr_t/intptr_t, value type argument
4015+// can be ptrdiff_t. or/xor/and/min/max: atomic type argument can be
4016+// intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t.
4017+
4018+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4019+#ifdef __opencl_c_atomic_scope_device
4020+uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object,
4021+ ptrdiff_t operand,
4022+ memory_order order);
4023+uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object,
4024+ ptrdiff_t operand,
4025+ memory_order order);
4026+uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object,
4027+ intptr_t operand, memory_order order);
4028+uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object,
4029+ intptr_t operand,
4030+ memory_order order);
4031+uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object,
4032+ intptr_t operand,
4033+ memory_order order);
4034+uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object,
4035+ intptr_t opermax,
4036+ memory_order minder);
4037+uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object,
4038+ intptr_t opermax,
4039+ memory_order minder);
4040+intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object,
4041+ uintptr_t operand, memory_order order);
4042+intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object,
4043+ uintptr_t operand,
4044+ memory_order order);
4045+intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object,
4046+ uintptr_t operand,
4047+ memory_order order);
4048+intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object,
4049+ uintptr_t opermax,
4050+ memory_order minder);
4051+intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object,
4052+ uintptr_t opermax,
4053+ memory_order minder);
4054+#endif // __opencl_c_atomic_scope_device
4055+uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object,
4056+ ptrdiff_t operand,
4057+ memory_order order,
4058+ memory_scope scope);
4059+uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object,
4060+ ptrdiff_t operand,
4061+ memory_order order,
4062+ memory_scope scope);
4063+
4064+uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object,
4065+ intptr_t operand, memory_order order,
4066+ memory_scope scope);
4067+uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object,
4068+ intptr_t operand, memory_order order,
4069+ memory_scope scope);
4070+uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object,
4071+ intptr_t operand, memory_order order,
4072+ memory_scope scope);
4073+uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object,
4074+ intptr_t opermax,
4075+ memory_order minder,
4076+ memory_scope scope);
4077+uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object,
4078+ intptr_t opermax,
4079+ memory_order minder,
4080+ memory_scope scope);
4081+
4082+intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object,
4083+ uintptr_t operand, memory_order order,
4084+ memory_scope scope);
4085+intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object,
4086+ uintptr_t operand, memory_order order,
4087+ memory_scope scope);
4088+intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object,
4089+ uintptr_t operand, memory_order order,
4090+ memory_scope scope);
4091+intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object,
4092+ uintptr_t opermax,
4093+ memory_order minder,
4094+ memory_scope scope);
4095+intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object,
4096+ uintptr_t opermax,
4097+ memory_order minder,
4098+ memory_scope scope);
4099 #endif
4100+#endif // __opencl_c_generic_address_space
4101+
4102+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4103+#ifdef __opencl_c_atomic_scope_device
4104+int __ovld atomic_fetch_add_explicit(volatile atomic_int __global *object,
4105+ int operand, memory_order order);
4106+int __ovld atomic_fetch_add_explicit(volatile atomic_int __local *object,
4107+ int operand, memory_order order);
4108+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint __global *object,
4109+ uint operand, memory_order order);
4110+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint __local *object,
4111+ uint operand, memory_order order);
4112+int __ovld atomic_fetch_sub_explicit(volatile atomic_int __global *object,
4113+ int operand, memory_order order);
4114+int __ovld atomic_fetch_sub_explicit(volatile atomic_int __local *object,
4115+ int operand, memory_order order);
4116+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint __global *object,
4117+ uint operand, memory_order order);
4118+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint __local *object,
4119+ uint operand, memory_order order);
4120+int __ovld atomic_fetch_or_explicit(volatile atomic_int __global *object,
4121+ int operand, memory_order order);
4122+int __ovld atomic_fetch_or_explicit(volatile atomic_int __local *object,
4123+ int operand, memory_order order);
4124+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint __global *object,
4125+ uint operand, memory_order order);
4126+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint __local *object,
4127+ uint operand, memory_order order);
4128+int __ovld atomic_fetch_xor_explicit(volatile atomic_int __global *object,
4129+ int operand, memory_order order);
4130+int __ovld atomic_fetch_xor_explicit(volatile atomic_int __local *object,
4131+ int operand, memory_order order);
4132+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint __global *object,
4133+ uint operand, memory_order order);
4134+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint __local *object,
4135+ uint operand, memory_order order);
4136+int __ovld atomic_fetch_and_explicit(volatile atomic_int __global *object,
4137+ int operand, memory_order order);
4138+int __ovld atomic_fetch_and_explicit(volatile atomic_int __local *object,
4139+ int operand, memory_order order);
4140+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint __global *object,
4141+ uint operand, memory_order order);
4142+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint __local *object,
4143+ uint operand, memory_order order);
4144+int __ovld atomic_fetch_min_explicit(volatile atomic_int __global *object,
4145+ int operand, memory_order order);
4146+int __ovld atomic_fetch_min_explicit(volatile atomic_int __local *object,
4147+ int operand, memory_order order);
4148+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint __global *object,
4149+ uint operand, memory_order order);
4150+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint __local *object,
4151+ uint operand, memory_order order);
4152+int __ovld atomic_fetch_max_explicit(volatile atomic_int __global *object,
4153+ int operand, memory_order order);
4154+int __ovld atomic_fetch_max_explicit(volatile atomic_int __local *object,
4155+ int operand, memory_order order);
4156+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint __global *object,
4157+ uint operand, memory_order order);
4158+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint __local *object,
4159+ uint operand, memory_order order);
4160+#endif // __opencl_c_atomic_scope_device
4161+int __ovld atomic_fetch_add_explicit(volatile atomic_int __global *object,
4162+ int operand, memory_order order,
4163+ memory_scope scope);
4164+int __ovld atomic_fetch_add_explicit(volatile atomic_int __local *object,
4165+ int operand, memory_order order,
4166+ memory_scope scope);
4167+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint __global *object,
4168+ uint operand, memory_order order,
4169+ memory_scope scope);
4170+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint __local *object,
4171+ uint operand, memory_order order,
4172+ memory_scope scope);
4173+int __ovld atomic_fetch_sub_explicit(volatile atomic_int __global *object,
4174+ int operand, memory_order order,
4175+ memory_scope scope);
4176+int __ovld atomic_fetch_sub_explicit(volatile atomic_int __local *object,
4177+ int operand, memory_order order,
4178+ memory_scope scope);
4179+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint __global *object,
4180+ uint operand, memory_order order,
4181+ memory_scope scope);
4182+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint __local *object,
4183+ uint operand, memory_order order,
4184+ memory_scope scope);
4185+int __ovld atomic_fetch_or_explicit(volatile atomic_int __global *object,
4186+ int operand, memory_order order,
4187+ memory_scope scope);
4188+int __ovld atomic_fetch_or_explicit(volatile atomic_int __local *object,
4189+ int operand, memory_order order,
4190+ memory_scope scope);
4191+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint __global *object,
4192+ uint operand, memory_order order,
4193+ memory_scope scope);
4194+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint __local *object,
4195+ uint operand, memory_order order,
4196+ memory_scope scope);
4197+int __ovld atomic_fetch_xor_explicit(volatile atomic_int __global *object,
4198+ int operand, memory_order order,
4199+ memory_scope scope);
4200+int __ovld atomic_fetch_xor_explicit(volatile atomic_int __local *object,
4201+ int operand, memory_order order,
4202+ memory_scope scope);
4203+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint __global *object,
4204+ uint operand, memory_order order,
4205+ memory_scope scope);
4206+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint __local *object,
4207+ uint operand, memory_order order,
4208+ memory_scope scope);
4209+int __ovld atomic_fetch_and_explicit(volatile atomic_int __global *object,
4210+ int operand, memory_order order,
4211+ memory_scope scope);
4212+int __ovld atomic_fetch_and_explicit(volatile atomic_int __local *object,
4213+ int operand, memory_order order,
4214+ memory_scope scope);
4215+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint __global *object,
4216+ uint operand, memory_order order,
4217+ memory_scope scope);
4218+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint __local *object,
4219+ uint operand, memory_order order,
4220+ memory_scope scope);
4221+int __ovld atomic_fetch_min_explicit(volatile atomic_int __global *object,
4222+ int operand, memory_order order,
4223+ memory_scope scope);
4224+int __ovld atomic_fetch_min_explicit(volatile atomic_int __local *object,
4225+ int operand, memory_order order,
4226+ memory_scope scope);
4227+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint __global *object,
4228+ uint operand, memory_order order,
4229+ memory_scope scope);
4230+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint __local *object,
4231+ uint operand, memory_order order,
4232+ memory_scope scope);
4233+int __ovld atomic_fetch_max_explicit(volatile atomic_int __global *object,
4234+ int operand, memory_order order,
4235+ memory_scope scope);
4236+int __ovld atomic_fetch_max_explicit(volatile atomic_int __local *object,
4237+ int operand, memory_order order,
4238+ memory_scope scope);
4239+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint __global *object,
4240+ uint operand, memory_order order,
4241+ memory_scope scope);
4242+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint __local *object,
4243+ uint operand, memory_order order,
4244+ memory_scope scope);
4245+
4246+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4247+#ifdef __opencl_c_atomic_scope_device
4248+long __ovld atomic_fetch_add_explicit(volatile atomic_long __global *object,
4249+ long operand, memory_order order);
4250+long __ovld atomic_fetch_add_explicit(volatile atomic_long __local *object,
4251+ long operand, memory_order order);
4252+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong __global *object,
4253+ ulong operand, memory_order order);
4254+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong __local *object,
4255+ ulong operand, memory_order order);
4256+long __ovld atomic_fetch_sub_explicit(volatile atomic_long __global *object,
4257+ long operand, memory_order order);
4258+long __ovld atomic_fetch_sub_explicit(volatile atomic_long __local *object,
4259+ long operand, memory_order order);
4260+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong __global *object,
4261+ ulong operand, memory_order order);
4262+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong __local *object,
4263+ ulong operand, memory_order order);
4264+long __ovld atomic_fetch_or_explicit(volatile atomic_long __global *object,
4265+ long operand, memory_order order);
4266+long __ovld atomic_fetch_or_explicit(volatile atomic_long __local *object,
4267+ long operand, memory_order order);
4268+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong __global *object,
4269+ ulong operand, memory_order order);
4270+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong __local *object,
4271+ ulong operand, memory_order order);
4272+long __ovld atomic_fetch_xor_explicit(volatile atomic_long __global *object,
4273+ long operand, memory_order order);
4274+long __ovld atomic_fetch_xor_explicit(volatile atomic_long __local *object,
4275+ long operand, memory_order order);
4276+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong __global *object,
4277+ ulong operand, memory_order order);
4278+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong __local *object,
4279+ ulong operand, memory_order order);
4280+long __ovld atomic_fetch_and_explicit(volatile atomic_long __global *object,
4281+ long operand, memory_order order);
4282+long __ovld atomic_fetch_and_explicit(volatile atomic_long __local *object,
4283+ long operand, memory_order order);
4284+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong __global *object,
4285+ ulong operand, memory_order order);
4286+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong __local *object,
4287+ ulong operand, memory_order order);
4288+long __ovld atomic_fetch_min_explicit(volatile atomic_long __global *object,
4289+ long operand, memory_order order);
4290+long __ovld atomic_fetch_min_explicit(volatile atomic_long __local *object,
4291+ long operand, memory_order order);
4292+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong __global *object,
4293+ ulong operand, memory_order order);
4294+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong __local *object,
4295+ ulong operand, memory_order order);
4296+long __ovld atomic_fetch_max_explicit(volatile atomic_long __global *object,
4297+ long operand, memory_order order);
4298+long __ovld atomic_fetch_max_explicit(volatile atomic_long __local *object,
4299+ long operand, memory_order order);
4300+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong __global *object,
4301+ ulong operand, memory_order order);
4302+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong __local *object,
4303+ ulong operand, memory_order order);
4304+#endif // __opencl_c_atomic_scope_device
4305+long __ovld atomic_fetch_add_explicit(volatile atomic_long __global *object,
4306+ long operand, memory_order order,
4307+ memory_scope scope);
4308+long __ovld atomic_fetch_add_explicit(volatile atomic_long __local *object,
4309+ long operand, memory_order order,
4310+ memory_scope scope);
4311+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong __global *object,
4312+ ulong operand, memory_order order,
4313+ memory_scope scope);
4314+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong __local *object,
4315+ ulong operand, memory_order order,
4316+ memory_scope scope);
4317+long __ovld atomic_fetch_sub_explicit(volatile atomic_long __global *object,
4318+ long operand, memory_order order,
4319+ memory_scope scope);
4320+long __ovld atomic_fetch_sub_explicit(volatile atomic_long __local *object,
4321+ long operand, memory_order order,
4322+ memory_scope scope);
4323+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong __global *object,
4324+ ulong operand, memory_order order,
4325+ memory_scope scope);
4326+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong __local *object,
4327+ ulong operand, memory_order order,
4328+ memory_scope scope);
4329+long __ovld atomic_fetch_or_explicit(volatile atomic_long __global *object,
4330+ long operand, memory_order order,
4331+ memory_scope scope);
4332+long __ovld atomic_fetch_or_explicit(volatile atomic_long __local *object,
4333+ long operand, memory_order order,
4334+ memory_scope scope);
4335+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong __global *object,
4336+ ulong operand, memory_order order,
4337+ memory_scope scope);
4338+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong __local *object,
4339+ ulong operand, memory_order order,
4340+ memory_scope scope);
4341+long __ovld atomic_fetch_xor_explicit(volatile atomic_long __global *object,
4342+ long operand, memory_order order,
4343+ memory_scope scope);
4344+long __ovld atomic_fetch_xor_explicit(volatile atomic_long __local *object,
4345+ long operand, memory_order order,
4346+ memory_scope scope);
4347+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong __global *object,
4348+ ulong operand, memory_order order,
4349+ memory_scope scope);
4350+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong __local *object,
4351+ ulong operand, memory_order order,
4352+ memory_scope scope);
4353+long __ovld atomic_fetch_and_explicit(volatile atomic_long __global *object,
4354+ long operand, memory_order order,
4355+ memory_scope scope);
4356+long __ovld atomic_fetch_and_explicit(volatile atomic_long __local *object,
4357+ long operand, memory_order order,
4358+ memory_scope scope);
4359+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong __global *object,
4360+ ulong operand, memory_order order,
4361+ memory_scope scope);
4362+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong __local *object,
4363+ ulong operand, memory_order order,
4364+ memory_scope scope);
4365+long __ovld atomic_fetch_min_explicit(volatile atomic_long __global *object,
4366+ long operand, memory_order order,
4367+ memory_scope scope);
4368+long __ovld atomic_fetch_min_explicit(volatile atomic_long __local *object,
4369+ long operand, memory_order order,
4370+ memory_scope scope);
4371+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong __global *object,
4372+ ulong operand, memory_order order,
4373+ memory_scope scope);
4374+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong __local *object,
4375+ ulong operand, memory_order order,
4376+ memory_scope scope);
4377+long __ovld atomic_fetch_max_explicit(volatile atomic_long __global *object,
4378+ long operand, memory_order order,
4379+ memory_scope scope);
4380+long __ovld atomic_fetch_max_explicit(volatile atomic_long __local *object,
4381+ long operand, memory_order order,
4382+ memory_scope scope);
4383+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong __global *object,
4384+ ulong operand, memory_order order,
4385+ memory_scope scope);
4386+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong __local *object,
4387+ ulong operand, memory_order order,
4388+ memory_scope scope);
4389+#endif // defined(cl_khr_int64_base_atomics) &&
4390+ // defined(cl_khr_int64_extended_atomics)
4391+
4392+// OpenCL v2.0 s6.13.11.7.5:
4393+// add/sub: atomic type argument can be uintptr_t/intptr_t, value type argument
4394+// can be ptrdiff_t. or/xor/and/min/max: atomic type argument can be
4395+// intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t.
4396+
4397+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4398+#ifdef __opencl_c_atomic_scope_device
4399+uintptr_t __ovld
4400+atomic_fetch_add_explicit(volatile atomic_uintptr_t __global *object,
4401+ ptrdiff_t operand, memory_order order);
4402+uintptr_t __ovld
4403+atomic_fetch_add_explicit(volatile atomic_uintptr_t __local *object,
4404+ ptrdiff_t operand, memory_order order);
4405+uintptr_t __ovld
4406+atomic_fetch_sub_explicit(volatile atomic_uintptr_t __global *object,
4407+ ptrdiff_t operand, memory_order order);
4408+uintptr_t __ovld
4409+atomic_fetch_sub_explicit(volatile atomic_uintptr_t __local *object,
4410+ ptrdiff_t operand, memory_order order);
4411+uintptr_t __ovld
4412+atomic_fetch_or_explicit(volatile atomic_uintptr_t __global *object,
4413+ intptr_t operand, memory_order order);
4414+uintptr_t __ovld
4415+atomic_fetch_or_explicit(volatile atomic_uintptr_t __local *object,
4416+ intptr_t operand, memory_order order);
4417+uintptr_t __ovld
4418+atomic_fetch_xor_explicit(volatile atomic_uintptr_t __global *object,
4419+ intptr_t operand, memory_order order);
4420+uintptr_t __ovld
4421+atomic_fetch_xor_explicit(volatile atomic_uintptr_t __local *object,
4422+ intptr_t operand, memory_order order);
4423+uintptr_t __ovld
4424+atomic_fetch_and_explicit(volatile atomic_uintptr_t __global *object,
4425+ intptr_t operand, memory_order order);
4426+uintptr_t __ovld
4427+atomic_fetch_and_explicit(volatile atomic_uintptr_t __local *object,
4428+ intptr_t operand, memory_order order);
4429+uintptr_t __ovld
4430+atomic_fetch_min_explicit(volatile atomic_uintptr_t __global *object,
4431+ intptr_t opermax, memory_order minder);
4432+uintptr_t __ovld
4433+atomic_fetch_min_explicit(volatile atomic_uintptr_t __local *object,
4434+ intptr_t opermax, memory_order minder);
4435+uintptr_t __ovld
4436+atomic_fetch_max_explicit(volatile atomic_uintptr_t __global *object,
4437+ intptr_t opermax, memory_order minder);
4438+uintptr_t __ovld
4439+atomic_fetch_max_explicit(volatile atomic_uintptr_t __local *object,
4440+ intptr_t opermax, memory_order minder);
4441+intptr_t __ovld
4442+atomic_fetch_or_explicit(volatile atomic_intptr_t __global *object,
4443+ uintptr_t operand, memory_order order);
4444+intptr_t __ovld
4445+atomic_fetch_or_explicit(volatile atomic_intptr_t __local *object,
4446+ uintptr_t operand, memory_order order);
4447+intptr_t __ovld
4448+atomic_fetch_xor_explicit(volatile atomic_intptr_t __global *object,
4449+ uintptr_t operand, memory_order order);
4450+intptr_t __ovld
4451+atomic_fetch_xor_explicit(volatile atomic_intptr_t __local *object,
4452+ uintptr_t operand, memory_order order);
4453+intptr_t __ovld
4454+atomic_fetch_and_explicit(volatile atomic_intptr_t __global *object,
4455+ uintptr_t operand, memory_order order);
4456+intptr_t __ovld
4457+atomic_fetch_and_explicit(volatile atomic_intptr_t __local *object,
4458+ uintptr_t operand, memory_order order);
4459+intptr_t __ovld
4460+atomic_fetch_min_explicit(volatile atomic_intptr_t __global *object,
4461+ uintptr_t opermax, memory_order minder);
4462+intptr_t __ovld
4463+atomic_fetch_min_explicit(volatile atomic_intptr_t __local *object,
4464+ uintptr_t opermax, memory_order minder);
4465+intptr_t __ovld
4466+atomic_fetch_max_explicit(volatile atomic_intptr_t __global *object,
4467+ uintptr_t opermax, memory_order minder);
4468+intptr_t __ovld
4469+atomic_fetch_max_explicit(volatile atomic_intptr_t __local *object,
4470+ uintptr_t opermax, memory_order minder);
4471+#endif // __opencl_c_atomic_scope_device
4472+uintptr_t __ovld atomic_fetch_add_explicit(
4473+ volatile atomic_uintptr_t __global *object, ptrdiff_t operand,
4474+ memory_order order, memory_scope scope);
4475+uintptr_t __ovld atomic_fetch_add_explicit(
4476+ volatile atomic_uintptr_t __local *object, ptrdiff_t operand,
4477+ memory_order order, memory_scope scope);
4478+uintptr_t __ovld atomic_fetch_sub_explicit(
4479+ volatile atomic_uintptr_t __global *object, ptrdiff_t operand,
4480+ memory_order order, memory_scope scope);
4481+uintptr_t __ovld atomic_fetch_sub_explicit(
4482+ volatile atomic_uintptr_t __local *object, ptrdiff_t operand,
4483+ memory_order order, memory_scope scope);
4484+
4485+uintptr_t __ovld atomic_fetch_or_explicit(
4486+ volatile atomic_uintptr_t __global *object, intptr_t operand,
4487+ memory_order order, memory_scope scope);
4488+uintptr_t __ovld atomic_fetch_or_explicit(
4489+ volatile atomic_uintptr_t __local *object, intptr_t operand,
4490+ memory_order order, memory_scope scope);
4491+uintptr_t __ovld atomic_fetch_xor_explicit(
4492+ volatile atomic_uintptr_t __global *object, intptr_t operand,
4493+ memory_order order, memory_scope scope);
4494+uintptr_t __ovld atomic_fetch_xor_explicit(
4495+ volatile atomic_uintptr_t __local *object, intptr_t operand,
4496+ memory_order order, memory_scope scope);
4497+uintptr_t __ovld atomic_fetch_and_explicit(
4498+ volatile atomic_uintptr_t __global *object, intptr_t operand,
4499+ memory_order order, memory_scope scope);
4500+uintptr_t __ovld atomic_fetch_and_explicit(
4501+ volatile atomic_uintptr_t __local *object, intptr_t operand,
4502+ memory_order order, memory_scope scope);
4503+uintptr_t __ovld atomic_fetch_min_explicit(
4504+ volatile atomic_uintptr_t __global *object, intptr_t opermax,
4505+ memory_order minder, memory_scope scope);
4506+uintptr_t __ovld atomic_fetch_min_explicit(
4507+ volatile atomic_uintptr_t __local *object, intptr_t opermax,
4508+ memory_order minder, memory_scope scope);
4509+uintptr_t __ovld atomic_fetch_max_explicit(
4510+ volatile atomic_uintptr_t __global *object, intptr_t opermax,
4511+ memory_order minder, memory_scope scope);
4512+uintptr_t __ovld atomic_fetch_max_explicit(
4513+ volatile atomic_uintptr_t __local *object, intptr_t opermax,
4514+ memory_order minder, memory_scope scope);
4515+
4516+intptr_t __ovld atomic_fetch_or_explicit(
4517+ volatile atomic_intptr_t __global *object, uintptr_t operand,
4518+ memory_order order, memory_scope scope);
4519+intptr_t __ovld atomic_fetch_or_explicit(
4520+ volatile atomic_intptr_t __local *object, uintptr_t operand,
4521+ memory_order order, memory_scope scope);
4522+intptr_t __ovld atomic_fetch_xor_explicit(
4523+ volatile atomic_intptr_t __global *object, uintptr_t operand,
4524+ memory_order order, memory_scope scope);
4525+intptr_t __ovld atomic_fetch_xor_explicit(
4526+ volatile atomic_intptr_t __local *object, uintptr_t operand,
4527+ memory_order order, memory_scope scope);
4528+intptr_t __ovld atomic_fetch_and_explicit(
4529+ volatile atomic_intptr_t __global *object, uintptr_t operand,
4530+ memory_order order, memory_scope scope);
4531+intptr_t __ovld atomic_fetch_and_explicit(
4532+ volatile atomic_intptr_t __local *object, uintptr_t operand,
4533+ memory_order order, memory_scope scope);
4534+intptr_t __ovld atomic_fetch_min_explicit(
4535+ volatile atomic_intptr_t __global *object, uintptr_t opermax,
4536+ memory_order minder, memory_scope scope);
4537+intptr_t __ovld atomic_fetch_min_explicit(
4538+ volatile atomic_intptr_t __local *object, uintptr_t opermax,
4539+ memory_order minder, memory_scope scope);
4540+intptr_t __ovld atomic_fetch_max_explicit(
4541+ volatile atomic_intptr_t __global *object, uintptr_t opermax,
4542+ memory_order minder, memory_scope scope);
4543+intptr_t __ovld atomic_fetch_max_explicit(
4544+ volatile atomic_intptr_t __local *object, uintptr_t opermax,
4545+ memory_order minder, memory_scope scope);
4546+#endif // defined(cl_khr_int64_base_atomics) &&
4547+ // defined(cl_khr_int64_extended_atomics)
4548+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4549
4550 // atomic_store()
4551
4552+#if defined(__opencl_c_atomic_scope_device) && \
4553+ defined(__opencl_c_atomic_order_seq_cst)
4554+
4555+#ifdef __opencl_c_generic_address_space
4556 void __ovld atomic_store(volatile atomic_int *object, int desired);
4557-void __ovld atomic_store_explicit(volatile atomic_int *object, int desired, memory_order order);
4558-void __ovld atomic_store_explicit(volatile atomic_int *object, int desired, memory_order order, memory_scope scope);
4559 void __ovld atomic_store(volatile atomic_uint *object, uint desired);
4560-void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired, memory_order order);
4561-void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired, memory_order order, memory_scope scope);
4562 void __ovld atomic_store(volatile atomic_float *object, float desired);
4563-void __ovld atomic_store_explicit(volatile atomic_float *object, float desired, memory_order order);
4564-void __ovld atomic_store_explicit(volatile atomic_float *object, float desired, memory_order order, memory_scope scope);
4565 #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4566-#ifdef cl_khr_fp64
4567+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4568 void __ovld atomic_store(volatile atomic_double *object, double desired);
4569-void __ovld atomic_store_explicit(volatile atomic_double *object, double desired, memory_order order);
4570-void __ovld atomic_store_explicit(volatile atomic_double *object, double desired, memory_order order, memory_scope scope);
4571-#endif //cl_khr_fp64
4572+#endif
4573 void __ovld atomic_store(volatile atomic_long *object, long desired);
4574-void __ovld atomic_store_explicit(volatile atomic_long *object, long desired, memory_order order);
4575-void __ovld atomic_store_explicit(volatile atomic_long *object, long desired, memory_order order, memory_scope scope);
4576 void __ovld atomic_store(volatile atomic_ulong *object, ulong desired);
4577-void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired, memory_order order);
4578-void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired, memory_order order, memory_scope scope);
4579+#endif // defined(cl_khr_int64_base_atomics) &&
4580+ // defined(cl_khr_int64_extended_atomics)
4581+#endif // __opencl_c_generic_address_space
4582+
4583+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4584+void __ovld atomic_store(volatile atomic_int __global *object, int desired);
4585+void __ovld atomic_store(volatile atomic_int __local *object, int desired);
4586+void __ovld atomic_store(volatile atomic_uint __global *object, uint desired);
4587+void __ovld atomic_store(volatile atomic_uint __local *object, uint desired);
4588+void __ovld atomic_store(volatile atomic_float __global *object, float desired);
4589+void __ovld atomic_store(volatile atomic_float __local *object, float desired);
4590+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4591+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4592+void __ovld atomic_store(volatile atomic_double __global *object,
4593+ double desired);
4594+void __ovld atomic_store(volatile atomic_double __local *object,
4595+ double desired);
4596 #endif
4597+void __ovld atomic_store(volatile atomic_long __global *object, long desired);
4598+void __ovld atomic_store(volatile atomic_long __local *object, long desired);
4599+void __ovld atomic_store(volatile atomic_ulong __global *object, ulong desired);
4600+void __ovld atomic_store(volatile atomic_ulong __local *object, ulong desired);
4601+#endif // defined(cl_khr_int64_base_atomics) &&
4602+ // defined(cl_khr_int64_extended_atomics)
4603+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4604+
4605+#endif // defined(__opencl_c_atomic_scope_device) &&
4606+ // defined(__opencl_c_atomic_order_seq_cst)
4607+
4608+#ifdef __opencl_c_generic_address_space
4609+#ifdef __opencl_c_atomic_scope_device
4610+void __ovld atomic_store_explicit(volatile atomic_int *object, int desired,
4611+ memory_order order);
4612+void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired,
4613+ memory_order order);
4614+void __ovld atomic_store_explicit(volatile atomic_float *object, float desired,
4615+ memory_order order);
4616+#endif // __opencl_c_atomic_scope_device
4617+void __ovld atomic_store_explicit(volatile atomic_int *object, int desired,
4618+ memory_order order, memory_scope scope);
4619+void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired,
4620+ memory_order order, memory_scope scope);
4621+void __ovld atomic_store_explicit(volatile atomic_float *object, float desired,
4622+ memory_order order, memory_scope scope);
4623+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4624+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4625+#ifdef __opencl_c_atomic_scope_device
4626+void __ovld atomic_store_explicit(volatile atomic_double *object,
4627+ double desired, memory_order order);
4628+#endif //__opencl_c_atomic_scope_device
4629+void __ovld atomic_store_explicit(volatile atomic_double *object,
4630+ double desired, memory_order order,
4631+ memory_scope scope);
4632+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4633+#ifdef __opencl_c_atomic_scope_device
4634+void __ovld atomic_store_explicit(volatile atomic_long *object, long desired,
4635+ memory_order order);
4636+void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired,
4637+ memory_order order);
4638+#endif //__opencl_c_atomic_scope_device
4639+void __ovld atomic_store_explicit(volatile atomic_long *object, long desired,
4640+ memory_order order, memory_scope scope);
4641+void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired,
4642+ memory_order order, memory_scope scope);
4643+#endif // defined(cl_khr_int64_base_atomics) &&
4644+ // defined(cl_khr_int64_extended_atomics)
4645+#endif // __opencl_c_generic_address_space
4646+
4647+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4648+#ifdef __opencl_c_atomic_scope_device
4649+void __ovld atomic_store_explicit(volatile atomic_int __global *object,
4650+ int desired, memory_order order);
4651+void __ovld atomic_store_explicit(volatile atomic_int __local *object,
4652+ int desired, memory_order order);
4653+void __ovld atomic_store_explicit(volatile atomic_uint __global *object,
4654+ uint desired, memory_order order);
4655+void __ovld atomic_store_explicit(volatile atomic_uint __local *object,
4656+ uint desired, memory_order order);
4657+void __ovld atomic_store_explicit(volatile atomic_float __global *object,
4658+ float desired, memory_order order);
4659+void __ovld atomic_store_explicit(volatile atomic_float __local *object,
4660+ float desired, memory_order order);
4661+#endif // __opencl_c_atomic_scope_device
4662+void __ovld atomic_store_explicit(volatile atomic_int __global *object,
4663+ int desired, memory_order order,
4664+ memory_scope scope);
4665+void __ovld atomic_store_explicit(volatile atomic_int __local *object,
4666+ int desired, memory_order order,
4667+ memory_scope scope);
4668+void __ovld atomic_store_explicit(volatile atomic_uint __global *object,
4669+ uint desired, memory_order order,
4670+ memory_scope scope);
4671+void __ovld atomic_store_explicit(volatile atomic_uint __local *object,
4672+ uint desired, memory_order order,
4673+ memory_scope scope);
4674+void __ovld atomic_store_explicit(volatile atomic_float __global *object,
4675+ float desired, memory_order order,
4676+ memory_scope scope);
4677+void __ovld atomic_store_explicit(volatile atomic_float __local *object,
4678+ float desired, memory_order order,
4679+ memory_scope scope);
4680+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4681+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4682+#ifdef __opencl_c_atomic_scope_device
4683+void __ovld atomic_store_explicit(volatile atomic_double __global *object,
4684+ double desired, memory_order order);
4685+void __ovld atomic_store_explicit(volatile atomic_double __local *object,
4686+ double desired, memory_order order);
4687+#endif //__opencl_c_atomic_scope_device
4688+void __ovld atomic_store_explicit(volatile atomic_double __global *object,
4689+ double desired, memory_order order,
4690+ memory_scope scope);
4691+void __ovld atomic_store_explicit(volatile atomic_double __local *object,
4692+ double desired, memory_order order,
4693+ memory_scope scope);
4694+#endif // cl_khr_fp64
4695+#ifdef __opencl_c_atomic_scope_device
4696+void __ovld atomic_store_explicit(volatile atomic_long __global *object,
4697+ long desired, memory_order order);
4698+void __ovld atomic_store_explicit(volatile atomic_long __local *object,
4699+ long desired, memory_order order);
4700+void __ovld atomic_store_explicit(volatile atomic_ulong __global *object,
4701+ ulong desired, memory_order order);
4702+void __ovld atomic_store_explicit(volatile atomic_ulong __local *object,
4703+ ulong desired, memory_order order);
4704+#endif // __opencl_c_atomic_scope_device
4705+void __ovld atomic_store_explicit(volatile atomic_long __global *object,
4706+ long desired, memory_order order,
4707+ memory_scope scope);
4708+void __ovld atomic_store_explicit(volatile atomic_long __local *object,
4709+ long desired, memory_order order,
4710+ memory_scope scope);
4711+void __ovld atomic_store_explicit(volatile atomic_ulong __global *object,
4712+ ulong desired, memory_order order,
4713+ memory_scope scope);
4714+void __ovld atomic_store_explicit(volatile atomic_ulong __local *object,
4715+ ulong desired, memory_order order,
4716+ memory_scope scope);
4717+#endif // defined(cl_khr_int64_base_atomics) &&
4718+ // defined(cl_khr_int64_extended_atomics)
4719+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4720
4721 // atomic_load()
4722-
4723+#ifdef __opencl_c_generic_address_space
4724+#if defined(__opencl_c_atomic_scope_device) && \
4725+ defined(__opencl_c_atomic_order_seq_cst)
4726 int __ovld atomic_load(volatile atomic_int *object);
4727-int __ovld atomic_load_explicit(volatile atomic_int *object, memory_order order);
4728-int __ovld atomic_load_explicit(volatile atomic_int *object, memory_order order, memory_scope scope);
4729 uint __ovld atomic_load(volatile atomic_uint *object);
4730-uint __ovld atomic_load_explicit(volatile atomic_uint *object, memory_order order);
4731-uint __ovld atomic_load_explicit(volatile atomic_uint *object, memory_order order, memory_scope scope);
4732 float __ovld atomic_load(volatile atomic_float *object);
4733-float __ovld atomic_load_explicit(volatile atomic_float *object, memory_order order);
4734-float __ovld atomic_load_explicit(volatile atomic_float *object, memory_order order, memory_scope scope);
4735 #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4736-#ifdef cl_khr_fp64
4737+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4738 double __ovld atomic_load(volatile atomic_double *object);
4739-double __ovld atomic_load_explicit(volatile atomic_double *object, memory_order order);
4740-double __ovld atomic_load_explicit(volatile atomic_double *object, memory_order order, memory_scope scope);
4741-#endif //cl_khr_fp64
4742+#endif // cl_khr_fp64
4743 long __ovld atomic_load(volatile atomic_long *object);
4744-long __ovld atomic_load_explicit(volatile atomic_long *object, memory_order order);
4745-long __ovld atomic_load_explicit(volatile atomic_long *object, memory_order order, memory_scope scope);
4746 ulong __ovld atomic_load(volatile atomic_ulong *object);
4747-ulong __ovld atomic_load_explicit(volatile atomic_ulong *object, memory_order order);
4748-ulong __ovld atomic_load_explicit(volatile atomic_ulong *object, memory_order order, memory_scope scope);
4749-#endif
4750+#endif // defined(cl_khr_int64_base_atomics) &&
4751+ // defined(cl_khr_int64_extended_atomics)
4752+#endif // defined(__opencl_c_atomic_scope_device) &&
4753+ // defined(__opencl_c_atomic_order_seq_cst)
4754+#endif //__opencl_c_generic_address_space
4755+
4756+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4757+#if defined(__opencl_c_atomic_scope_device) && \
4758+ defined(__opencl_c_atomic_order_seq_cst)
4759+int __ovld atomic_load(volatile atomic_int __global *object);
4760+int __ovld atomic_load(volatile atomic_int __local *object);
4761+uint __ovld atomic_load(volatile atomic_uint __global *object);
4762+uint __ovld atomic_load(volatile atomic_uint __local *object);
4763+float __ovld atomic_load(volatile atomic_float __global *object);
4764+float __ovld atomic_load(volatile atomic_float __local *object);
4765+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4766+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4767+double __ovld atomic_load(volatile atomic_double __global *object);
4768+double __ovld atomic_load(volatile atomic_double __local *object);
4769+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4770+long __ovld atomic_load(volatile atomic_long __global *object);
4771+long __ovld atomic_load(volatile atomic_long __local *object);
4772+ulong __ovld atomic_load(volatile atomic_ulong __global *object);
4773+ulong __ovld atomic_load(volatile atomic_ulong __local *object);
4774+#endif // defined(cl_khr_int64_base_atomics) &&
4775+ // defined(cl_khr_int64_extended_atomics)
4776+#endif // defined(__opencl_c_atomic_scope_device) &&
4777+ // defined(__opencl_c_atomic_order_seq_cst)
4778+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4779+
4780+#ifdef __opencl_c_generic_address_space
4781+#ifdef __opencl_c_atomic_scope_device
4782+int __ovld atomic_load_explicit(volatile atomic_int *object,
4783+ memory_order order);
4784+uint __ovld atomic_load_explicit(volatile atomic_uint *object,
4785+ memory_order order);
4786+float __ovld atomic_load_explicit(volatile atomic_float *object,
4787+ memory_order order);
4788+#endif // __opencl_c_atomic_scope_device
4789+int __ovld atomic_load_explicit(volatile atomic_int *object, memory_order order,
4790+ memory_scope scope);
4791+uint __ovld atomic_load_explicit(volatile atomic_uint *object,
4792+ memory_order order, memory_scope scope);
4793+float __ovld atomic_load_explicit(volatile atomic_float *object,
4794+ memory_order order, memory_scope scope);
4795+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4796+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4797+#ifdef __opencl_c_atomic_scope_device
4798+double __ovld atomic_load_explicit(volatile atomic_double *object,
4799+ memory_order order);
4800+#endif // __opencl_c_atomic_scope_device
4801+double __ovld atomic_load_explicit(volatile atomic_double *object,
4802+ memory_order order, memory_scope scope);
4803+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4804+#ifdef __opencl_c_atomic_scope_device
4805+long __ovld atomic_load_explicit(volatile atomic_long *object,
4806+ memory_order order);
4807+ulong __ovld atomic_load_explicit(volatile atomic_ulong *object,
4808+ memory_order order);
4809+#endif //__opencl_c_atomic_scope_device
4810+long __ovld atomic_load_explicit(volatile atomic_long *object,
4811+ memory_order order, memory_scope scope);
4812+ulong __ovld atomic_load_explicit(volatile atomic_ulong *object,
4813+ memory_order order, memory_scope scope);
4814+#endif // defined(cl_khr_int64_base_atomics) &&
4815+ // defined(cl_khr_int64_extended_atomics)
4816+#endif // __opencl_c_generic_address_space
4817+
4818+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4819+#ifdef __opencl_c_atomic_scope_device
4820+int __ovld atomic_load_explicit(volatile atomic_int __global *object,
4821+ memory_order order);
4822+int __ovld atomic_load_explicit(volatile atomic_int __local *object,
4823+ memory_order order);
4824+uint __ovld atomic_load_explicit(volatile atomic_uint __global *object,
4825+ memory_order order);
4826+uint __ovld atomic_load_explicit(volatile atomic_uint __local *object,
4827+ memory_order order);
4828+float __ovld atomic_load_explicit(volatile atomic_float __global *object,
4829+ memory_order order);
4830+float __ovld atomic_load_explicit(volatile atomic_float __local *object,
4831+ memory_order order);
4832+#endif // __opencl_c_atomic_scope_device
4833+int __ovld atomic_load_explicit(volatile atomic_int __global *object,
4834+ memory_order order, memory_scope scope);
4835+int __ovld atomic_load_explicit(volatile atomic_int __local *object,
4836+ memory_order order, memory_scope scope);
4837+uint __ovld atomic_load_explicit(volatile atomic_uint __global *object,
4838+ memory_order order, memory_scope scope);
4839+uint __ovld atomic_load_explicit(volatile atomic_uint __local *object,
4840+ memory_order order, memory_scope scope);
4841+float __ovld atomic_load_explicit(volatile atomic_float __global *object,
4842+ memory_order order, memory_scope scope);
4843+float __ovld atomic_load_explicit(volatile atomic_float __local *object,
4844+ memory_order order, memory_scope scope);
4845+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4846+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4847+#ifdef __opencl_c_atomic_scope_device
4848+double __ovld atomic_load_explicit(volatile atomic_double __global *object,
4849+ memory_order order);
4850+double __ovld atomic_load_explicit(volatile atomic_double __local *object,
4851+ memory_order order);
4852+#endif // __opencl_c_atomic_scope_device
4853+double __ovld atomic_load_explicit(volatile atomic_double __global *object,
4854+ memory_order order, memory_scope scope);
4855+double __ovld atomic_load_explicit(volatile atomic_double __local *object,
4856+ memory_order order, memory_scope scope);
4857+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4858+#ifdef __opencl_c_atomic_scope_device
4859+long __ovld atomic_load_explicit(volatile atomic_long __global *object,
4860+ memory_order order);
4861+long __ovld atomic_load_explicit(volatile atomic_long __local *object,
4862+ memory_order order);
4863+ulong __ovld atomic_load_explicit(volatile atomic_ulong __global *object,
4864+ memory_order order);
4865+ulong __ovld atomic_load_explicit(volatile atomic_ulong __local *object,
4866+ memory_order order);
4867+#endif // __opencl_c_atomic_scope_device
4868+long __ovld atomic_load_explicit(volatile atomic_long __global *object,
4869+ memory_order order, memory_scope scope);
4870+long __ovld atomic_load_explicit(volatile atomic_long __local *object,
4871+ memory_order order, memory_scope scope);
4872+ulong __ovld atomic_load_explicit(volatile atomic_ulong __global *object,
4873+ memory_order order, memory_scope scope);
4874+ulong __ovld atomic_load_explicit(volatile atomic_ulong __local *object,
4875+ memory_order order, memory_scope scope);
4876+#endif // defined(cl_khr_int64_base_atomics) &&
4877+ // defined(cl_khr_int64_extended_atomics)
4878+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4879
4880 // atomic_exchange()
4881-
4882+#ifdef __opencl_c_generic_address_space
4883+#if defined(__opencl_c_atomic_scope_device) && \
4884+ defined(__opencl_c_atomic_order_seq_cst)
4885 int __ovld atomic_exchange(volatile atomic_int *object, int desired);
4886-int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired, memory_order order);
4887-int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired, memory_order order, memory_scope scope);
4888 uint __ovld atomic_exchange(volatile atomic_uint *object, uint desired);
4889-uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired, memory_order order);
4890-uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired, memory_order order, memory_scope scope);
4891 float __ovld atomic_exchange(volatile atomic_float *object, float desired);
4892-float __ovld atomic_exchange_explicit(volatile atomic_float *object, float desired, memory_order order);
4893-float __ovld atomic_exchange_explicit(volatile atomic_float *object, float desired, memory_order order, memory_scope scope);
4894 #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4895-#ifdef cl_khr_fp64
4896+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4897 double __ovld atomic_exchange(volatile atomic_double *object, double desired);
4898-double __ovld atomic_exchange_explicit(volatile atomic_double *object, double desired, memory_order order);
4899-double __ovld atomic_exchange_explicit(volatile atomic_double *object, double desired, memory_order order, memory_scope scope);
4900-#endif //cl_khr_fp64
4901+#endif
4902 long __ovld atomic_exchange(volatile atomic_long *object, long desired);
4903-long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired, memory_order order);
4904-long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired, memory_order order, memory_scope scope);
4905 ulong __ovld atomic_exchange(volatile atomic_ulong *object, ulong desired);
4906-ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object, ulong desired, memory_order order);
4907-ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object, ulong desired, memory_order order, memory_scope scope);
4908+#endif // defined(cl_khr_int64_base_atomics) &&
4909+ // defined(cl_khr_int64_extended_atomics)
4910+#endif // defined(__opencl_c_atomic_scope_device) &&
4911+ // defined(__opencl_c_atomic_order_seq_cst)
4912+#endif // __opencl_c_generic_address_space
4913+
4914+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4915+#if defined(__opencl_c_atomic_scope_device) && \
4916+ defined(__opencl_c_atomic_order_seq_cst)
4917+int __ovld atomic_exchange(volatile atomic_int __global *object, int desired);
4918+int __ovld atomic_exchange(volatile atomic_int __local *object, int desired);
4919+uint __ovld atomic_exchange(volatile atomic_uint __global *object,
4920+ uint desired);
4921+uint __ovld atomic_exchange(volatile atomic_uint __local *object, uint desired);
4922+float __ovld atomic_exchange(volatile atomic_float __global *object,
4923+ float desired);
4924+float __ovld atomic_exchange(volatile atomic_float __local *object,
4925+ float desired);
4926+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4927+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4928+double __ovld atomic_exchange(volatile atomic_double __global *object,
4929+ double desired);
4930+double __ovld atomic_exchange(volatile atomic_double __local *object,
4931+ double desired);
4932 #endif
4933+long __ovld atomic_exchange(volatile atomic_long __global *object,
4934+ long desired);
4935+long __ovld atomic_exchange(volatile atomic_long __local *object, long desired);
4936+ulong __ovld atomic_exchange(volatile atomic_ulong __global *object,
4937+ ulong desired);
4938+ulong __ovld atomic_exchange(volatile atomic_ulong __local *object,
4939+ ulong desired);
4940+#endif // defined(cl_khr_int64_base_atomics) &&
4941+ // defined(cl_khr_int64_extended_atomics)
4942+#endif // defined(__opencl_c_atomic_scope_device) &&
4943+ // defined(__opencl_c_atomic_order_seq_cst)
4944+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4945+
4946+#ifdef __opencl_c_generic_address_space
4947+#ifdef __opencl_c_atomic_scope_device
4948+int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired,
4949+ memory_order order);
4950+uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired,
4951+ memory_order order);
4952+float __ovld atomic_exchange_explicit(volatile atomic_float *object,
4953+ float desired, memory_order order);
4954+#endif // __opencl_c_atomic_scope_device
4955+int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired,
4956+ memory_order order, memory_scope scope);
4957+uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired,
4958+ memory_order order, memory_scope scope);
4959+float __ovld atomic_exchange_explicit(volatile atomic_float *object,
4960+ float desired, memory_order order,
4961+ memory_scope scope);
4962+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4963+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4964+#ifdef __opencl_c_atomic_scope_device
4965+double __ovld atomic_exchange_explicit(volatile atomic_double *object,
4966+ double desired, memory_order order);
4967+#endif // __opencl_c_atomic_scope_device
4968+double __ovld atomic_exchange_explicit(volatile atomic_double *object,
4969+ double desired, memory_order order,
4970+ memory_scope scope);
4971+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4972+#ifdef __opencl_c_atomic_scope_device
4973+long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired,
4974+ memory_order order);
4975+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object,
4976+ ulong desired, memory_order order);
4977+#endif // __opencl_c_atomic_scope_device
4978+long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired,
4979+ memory_order order, memory_scope scope);
4980+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object,
4981+ ulong desired, memory_order order,
4982+ memory_scope scope);
4983+#endif // defined(cl_khr_int64_base_atomics) &&
4984+ // defined(cl_khr_int64_extended_atomics)
4985+#endif // __opencl_c_generic_address_space
4986+
4987+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4988+#ifdef __opencl_c_atomic_scope_device
4989+int __ovld atomic_exchange_explicit(volatile atomic_int __global *object,
4990+ int desired, memory_order order);
4991+int __ovld atomic_exchange_explicit(volatile atomic_int __local *object,
4992+ int desired, memory_order order);
4993+uint __ovld atomic_exchange_explicit(volatile atomic_uint __global *object,
4994+ uint desired, memory_order order);
4995+uint __ovld atomic_exchange_explicit(volatile atomic_uint __local *object,
4996+ uint desired, memory_order order);
4997+float __ovld atomic_exchange_explicit(volatile atomic_float __global *object,
4998+ float desired, memory_order order);
4999+float __ovld atomic_exchange_explicit(volatile atomic_float __local *object,
5000+ float desired, memory_order order);
5001+#endif // __opencl_c_atomic_scope_device
5002+int __ovld atomic_exchange_explicit(volatile atomic_int __global *object,
5003+ int desired, memory_order order,
5004+ memory_scope scope);
5005+int __ovld atomic_exchange_explicit(volatile atomic_int __local *object,
5006+ int desired, memory_order order,
5007+ memory_scope scope);
5008+uint __ovld atomic_exchange_explicit(volatile atomic_uint __global *object,
5009+ uint desired, memory_order order,
5010+ memory_scope scope);
5011+uint __ovld atomic_exchange_explicit(volatile atomic_uint __local *object,
5012+ uint desired, memory_order order,
5013+ memory_scope scope);
5014+float __ovld atomic_exchange_explicit(volatile atomic_float __global *object,
5015+ float desired, memory_order order,
5016+ memory_scope scope);
5017+float __ovld atomic_exchange_explicit(volatile atomic_float __local *object,
5018+ float desired, memory_order order,
5019+ memory_scope scope);
5020+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
5021+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
5022+#ifdef __opencl_c_atomic_scope_device
5023+double __ovld atomic_exchange_explicit(volatile atomic_double __global *object,
5024+ double desired, memory_order order);
5025+double __ovld atomic_exchange_explicit(volatile atomic_double __local *object,
5026+ double desired, memory_order order);
5027+#endif // __opencl_c_atomic_scope_device
5028+double __ovld atomic_exchange_explicit(volatile atomic_double __global *object,
5029+ double desired, memory_order order,
5030+ memory_scope scope);
5031+double __ovld atomic_exchange_explicit(volatile atomic_double __local *object,
5032+ double desired, memory_order order,
5033+ memory_scope scope);
5034+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
5035+#ifdef __opencl_c_atomic_scope_device
5036+long __ovld atomic_exchange_explicit(volatile atomic_long __global *object,
5037+ long desired, memory_order order);
5038+long __ovld atomic_exchange_explicit(volatile atomic_long __local *object,
5039+ long desired, memory_order order);
5040+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong __global *object,
5041+ ulong desired, memory_order order);
5042+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong __local *object,
5043+ ulong desired, memory_order order);
5044+#endif // __opencl_c_atomic_scope_device
5045+long __ovld atomic_exchange_explicit(volatile atomic_long __global *object,
5046+ long desired, memory_order order,
5047+ memory_scope scope);
5048+long __ovld atomic_exchange_explicit(volatile atomic_long __local *object,
5049+ long desired, memory_order order,
5050+ memory_scope scope);
5051+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong __global *object,
5052+ ulong desired, memory_order order,
5053+ memory_scope scope);
5054+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong __local *object,
5055+ ulong desired, memory_order order,
5056+ memory_scope scope);
5057+#endif // defined(cl_khr_int64_base_atomics) &&
5058+ // defined(cl_khr_int64_extended_atomics)
5059+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
5060
5061 // atomic_compare_exchange_strong() and atomic_compare_exchange_weak()
5062-
5063-bool __ovld atomic_compare_exchange_strong(volatile atomic_int *object, int *expected, int desired);
5064-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object, int *expected,
5065- int desired, memory_order success, memory_order failure);
5066-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object, int *expected,
5067- int desired, memory_order success, memory_order failure, memory_scope scope);
5068-bool __ovld atomic_compare_exchange_strong(volatile atomic_uint *object, uint *expected, uint desired);
5069-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_uint *object, uint *expected,
5070- uint desired, memory_order success, memory_order failure);
5071-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_uint *object, uint *expected,
5072- uint desired, memory_order success, memory_order failure, memory_scope scope);
5073-bool __ovld atomic_compare_exchange_weak(volatile atomic_int *object, int *expected, int desired);
5074-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object, int *expected,
5075- int desired, memory_order success, memory_order failure);
5076-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object, int *expected,
5077- int desired, memory_order success, memory_order failure, memory_scope scope);
5078-bool __ovld atomic_compare_exchange_weak(volatile atomic_uint *object, uint *expected, uint desired);
5079-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object, uint *expected,
5080- uint desired, memory_order success, memory_order failure);
5081-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object, uint *expected,
5082- uint desired, memory_order success, memory_order failure, memory_scope scope);
5083-bool __ovld atomic_compare_exchange_strong(volatile atomic_float *object, float *expected, float desired);
5084-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_float *object, float *expected,
5085- float desired, memory_order success, memory_order failure);
5086-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_float *object, float *expected,
5087- float desired, memory_order success, memory_order failure, memory_scope scope);
5088-bool __ovld atomic_compare_exchange_weak(volatile atomic_float *object, float *expected, float desired);
5089-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_float *object, float *expected,
5090- float desired, memory_order success, memory_order failure);
5091-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_float *object, float *expected,
5092- float desired, memory_order success, memory_order failure, memory_scope scope);
5093+#ifdef __opencl_c_generic_address_space
5094+#if defined(__opencl_c_atomic_scope_device) && \
5095+ defined(__opencl_c_atomic_order_seq_cst)
5096+bool __ovld atomic_compare_exchange_strong(volatile atomic_int *object,
5097+ int *expected, int desired);
5098+bool __ovld atomic_compare_exchange_strong(volatile atomic_uint *object,
5099+ uint *expected, uint desired);
5100+bool __ovld atomic_compare_exchange_weak(volatile atomic_int *object,
5101+ int *expected, int desired);
5102+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint *object,
5103+ uint *expected, uint desired);
5104+bool __ovld atomic_compare_exchange_strong(volatile atomic_float *object,
5105+ float *expected, float desired);
5106+bool __ovld atomic_compare_exchange_weak(volatile atomic_float *object,
5107+ float *expected, float desired);
5108+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
5109+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
5110+bool __ovld atomic_compare_exchange_strong(volatile atomic_double *object,
5111+ double *expected, double desired);
5112+bool __ovld atomic_compare_exchange_weak(volatile atomic_double *object,
5113+ double *expected, double desired);
5114+#endif
5115+bool __ovld atomic_compare_exchange_strong(volatile atomic_long *object,
5116+ long *expected, long desired);
5117+bool __ovld atomic_compare_exchange_weak(volatile atomic_long *object,
5118+ long *expected, long desired);
5119+bool __ovld atomic_compare_exchange_strong(volatile atomic_ulong *object,
5120+ ulong *expected, ulong desired);
5121+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong *object,
5122+ ulong *expected, ulong desired);
5123+#endif // defined(cl_khr_int64_base_atomics) &&
5124+ // defined(cl_khr_int64_extended_atomics)
5125+#endif // defined(__opencl_c_atomic_scope_device) &&
5126+ // defined(__opencl_c_atomic_order_seq_cst)
5127+#endif // __opencl_c_generic_address_space
5128+
5129+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
5130+#if defined(__opencl_c_atomic_scope_device) && \
5131+ defined(__opencl_c_atomic_order_seq_cst)
5132+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __global *object,
5133+ int __global *expected, int desired);
5134+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __local *object,
5135+ int __global *expected, int desired);
5136+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __global *object,
5137+ int __local *expected, int desired);
5138+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __local *object,
5139+ int __local *expected, int desired);
5140+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __global *object,
5141+ int __private *expected,
5142+ int desired);
5143+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __local *object,
5144+ int __private *expected,
5145+ int desired);
5146+bool __ovld
5147+atomic_compare_exchange_strong(volatile atomic_uint __global *object,
5148+ uint __global *expected, uint desired);
5149+bool __ovld atomic_compare_exchange_strong(volatile atomic_uint __local *object,
5150+ uint __global *expected,
5151+ uint desired);
5152+bool __ovld
5153+atomic_compare_exchange_strong(volatile atomic_uint __global *object,
5154+ uint __local *expected, uint desired);
5155+bool __ovld atomic_compare_exchange_strong(volatile atomic_uint __local *object,
5156+ uint __local *expected,
5157+ uint desired);
5158+bool __ovld
5159+atomic_compare_exchange_strong(volatile atomic_uint __global *object,
5160+ uint __private *expected, uint desired);
5161+bool __ovld atomic_compare_exchange_strong(volatile atomic_uint __local *object,
5162+ uint __private *expected,
5163+ uint desired);
5164+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __global *object,
5165+ int __global *expected, int desired);
5166+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __local *object,
5167+ int __global *expected, int desired);
5168+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __global *object,
5169+ int __local *expected, int desired);
5170+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __local *object,
5171+ int __local *expected, int desired);
5172+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __global *object,
5173+ int __private *expected, int desired);
5174+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __local *object,
5175+ int __private *expected, int desired);
5176+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __global *object,
5177+ uint __global *expected, uint desired);
5178+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __local *object,
5179+ uint __global *expected, uint desired);
5180+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __global *object,
5181+ uint __local *expected, uint desired);
5182+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __local *object,
5183+ uint __local *expected, uint desired);
5184+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __global *object,
5185+ uint __private *expected,
5186+ uint desired);
5187+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __local *object,
5188+ uint __private *expected,
5189+ uint desired);
5190+bool __ovld
5191+atomic_compare_exchange_strong(volatile atomic_float __global *object,
5192+ float __global *expected, float desired);
5193+bool __ovld
5194+atomic_compare_exchange_strong(volatile atomic_float __local *object,
5195+ float __global *expected, float desired);
5196+bool __ovld
5197+atomic_compare_exchange_strong(volatile atomic_float __global *object,
5198+ float __local *expected, float desired);
5199+bool __ovld
5200+atomic_compare_exchange_strong(volatile atomic_float __local *object,
5201+ float __local *expected, float desired);
5202+bool __ovld
5203+atomic_compare_exchange_strong(volatile atomic_float __global *object,
5204+ float __private *expected, float desired);
5205+bool __ovld
5206+atomic_compare_exchange_strong(volatile atomic_float __local *object,
5207+ float __private *expected, float desired);
5208+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __global *object,
5209+ float __global *expected,
5210+ float desired);
5211+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __local *object,
5212+ float __global *expected,
5213+ float desired);
5214+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __global *object,
5215+ float __local *expected,
5216+ float desired);
5217+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __local *object,
5218+ float __local *expected,
5219+ float desired);
5220+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __global *object,
5221+ float __private *expected,
5222+ float desired);
5223+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __local *object,
5224+ float __private *expected,
5225+ float desired);
5226 #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
5227-#ifdef cl_khr_fp64
5228-bool __ovld atomic_compare_exchange_strong(volatile atomic_double *object, double *expected, double desired);
5229-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_double *object, double *expected,
5230- double desired, memory_order success, memory_order failure);
5231-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_double *object, double *expected,
5232- double desired, memory_order success, memory_order failure, memory_scope scope);
5233-bool __ovld atomic_compare_exchange_weak(volatile atomic_double *object, double *expected, double desired);
5234-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_double *object, double *expected,
5235- double desired, memory_order success, memory_order failure);
5236-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_double *object, double *expected,
5237- double desired, memory_order success, memory_order failure, memory_scope scope);
5238-#endif //cl_khr_fp64
5239-bool __ovld atomic_compare_exchange_strong(volatile atomic_long *object, long *expected, long desired);
5240-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_long *object, long *expected,
5241- long desired, memory_order success, memory_order failure);
5242-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_long *object, long *expected,
5243- long desired, memory_order success, memory_order failure, memory_scope scope);
5244-bool __ovld atomic_compare_exchange_weak(volatile atomic_long *object, long *expected, long desired);
5245-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object, long *expected,
5246- long desired, memory_order success, memory_order failure);
5247-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object, long *expected,
5248- long desired, memory_order success, memory_order failure, memory_scope scope);
5249-bool __ovld atomic_compare_exchange_strong(volatile atomic_ulong *object, ulong *expected, ulong desired);
5250-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_ulong *object, ulong *expected,
5251- ulong desired, memory_order success, memory_order failure);
5252-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_ulong *object, ulong *expected,
5253- ulong desired, memory_order success, memory_order failure, memory_scope scope);
5254-bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong *object, ulong *expected, ulong desired);
5255-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_ulong *object, ulong *expected,
5256- ulong desired, memory_order success, memory_order failure);
5257-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_ulong *object, ulong *expected,
5258- ulong desired, memory_order success, memory_order failure, memory_scope scope);
5259+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
5260+bool __ovld
5261+atomic_compare_exchange_strong(volatile atomic_double __global *object,
5262+ double __global *expected, double desired);
5263+bool __ovld
5264+atomic_compare_exchange_strong(volatile atomic_double __local *object,
5265+ double __global *expected, double desired);
5266+bool __ovld
5267+atomic_compare_exchange_strong(volatile atomic_double __global *object,
5268+ double __local *expected, double desired);
5269+bool __ovld
5270+atomic_compare_exchange_strong(volatile atomic_double __local *object,
5271+ double __local *expected, double desired);
5272+bool __ovld
5273+atomic_compare_exchange_strong(volatile atomic_double __global *object,
5274+ double __private *expected, double desired);
5275+bool __ovld
5276+atomic_compare_exchange_strong(volatile atomic_double __local *object,
5277+ double __private *expected, double desired);
5278+bool __ovld
5279+atomic_compare_exchange_weak(volatile atomic_double __global *object,
5280+ double __global *expected, double desired);
5281+bool __ovld atomic_compare_exchange_weak(volatile atomic_double __local *object,
5282+ double __global *expected,
5283+ double desired);
5284+bool __ovld
5285+atomic_compare_exchange_weak(volatile atomic_double __global *object,
5286+ double __local *expected, double desired);
5287+bool __ovld atomic_compare_exchange_weak(volatile atomic_double __local *object,
5288+ double __local *expected,
5289+ double desired);
5290+bool __ovld
5291+atomic_compare_exchange_weak(volatile atomic_double __global *object,
5292+ double __private *expected, double desired);
5293+bool __ovld atomic_compare_exchange_weak(volatile atomic_double __local *object,
5294+ double __private *expected,
5295+ double desired);
5296 #endif
5297+bool __ovld
5298+atomic_compare_exchange_strong(volatile atomic_long __global *object,
5299+ long __global *expected, long desired);
5300+bool __ovld atomic_compare_exchange_strong(volatile atomic_long __local *object,
5301+ long __global *expected,
5302+ long desired);
5303+bool __ovld
5304+atomic_compare_exchange_strong(volatile atomic_long __global *object,
5305+ long __local *expected, long desired);
5306+bool __ovld atomic_compare_exchange_strong(volatile atomic_long __local *object,
5307+ long __local *expected,
5308+ long desired);
5309+bool __ovld
5310+atomic_compare_exchange_strong(volatile atomic_long __global *object,
5311+ long __private *expected, long desired);
5312+bool __ovld atomic_compare_exchange_strong(volatile atomic_long __local *object,
5313+ long __private *expected,
5314+ long desired);
5315+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __global *object,
5316+ long __global *expected, long desired);
5317+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __local *object,
5318+ long __global *expected, long desired);
5319+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __global *object,
5320+ long __local *expected, long desired);
5321+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __local *object,
5322+ long __local *expected, long desired);
5323+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __global *object,
5324+ long __private *expected,
5325+ long desired);
5326+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __local *object,
5327+ long __private *expected,
5328+ long desired);
5329+bool __ovld
5330+atomic_compare_exchange_strong(volatile atomic_ulong __global *object,
5331+ ulong __global *expected, ulong desired);
5332+bool __ovld
5333+atomic_compare_exchange_strong(volatile atomic_ulong __local *object,
5334+ ulong __global *expected, ulong desired);
5335+bool __ovld
5336+atomic_compare_exchange_strong(volatile atomic_ulong __global *object,
5337+ ulong __local *expected, ulong desired);
5338+bool __ovld
5339+atomic_compare_exchange_strong(volatile atomic_ulong __local *object,
5340+ ulong __local *expected, ulong desired);
5341+bool __ovld
5342+atomic_compare_exchange_strong(volatile atomic_ulong __global *object,
5343+ ulong __private *expected, ulong desired);
5344+bool __ovld
5345+atomic_compare_exchange_strong(volatile atomic_ulong __local *object,
5346+ ulong __private *expected, ulong desired);
5347+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __global *object,
5348+ ulong __global *expected,
5349+ ulong desired);
5350+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __local *object,
5351+ ulong __global *expected,
5352+ ulong desired);
5353+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __global *object,
5354+ ulong __local *expected,
5355+ ulong desired);
5356+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __local *object,
5357+ ulong __local *expected,
5358+ ulong desired);
5359+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __global *object,
5360+ ulong __private *expected,
5361+ ulong desired);
5362+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __local *object,
5363+ ulong __private *expected,
5364+ ulong desired);
5365+#endif // defined(cl_khr_int64_base_atomics) &&
5366+ // defined(cl_khr_int64_extended_atomics)
5367+#endif // defined(__opencl_c_atomic_scope_device) &&
5368+ // defined(__opencl_c_atomic_order_seq_cst)
5369+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
5370+
5371+#ifdef __opencl_c_generic_address_space
5372+#ifdef __opencl_c_atomic_scope_device
5373+bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object,
5374+ int *expected, int desired,
5375+ memory_order success,
5376+ memory_order failure);
5377+bool __ovld atomic_compare_exchange_strong_explicit(
5378+ volatile atomic_uint *object, uint *expected, uint desired,
5379+ memory_order success, memory_order failure);
5380+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object,
5381+ int *expected, int desired,
5382+ memory_order success,
5383+ memory_order failure);
5384+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object,
5385+ uint *expected, uint desired,
5386+ memory_order success,
5387+ memory_order failure);
5388+bool __ovld atomic_compare_exchange_strong_explicit(
5389+ volatile atomic_float *object, float *expected, float desired,
5390+ memory_order success, memory_order failure);
5391+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_float *object,
5392+ float *expected,
5393+ float desired,
5394+ memory_order success,
5395+ memory_order failure);
5396+#endif // __opencl_c_atomic_scope_device
5397+bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object,
5398+ int *expected, int desired,
5399+ memory_order success,
5400+ memory_order failure,
5401+ memory_scope scope);
5402+bool __ovld atomic_compare_exchange_strong_explicit(
5403+ volatile atomic_uint *object, uint *expected, uint desired,
5404+ memory_order success, memory_order failure, memory_scope scope);
5405+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object,
5406+ int *expected, int desired,
5407+ memory_order success,
5408+ memory_order failure,
5409+ memory_scope scope);
5410+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object,
5411+ uint *expected, uint desired,
5412+ memory_order success,
5413+ memory_order failure,
5414+ memory_scope scope);
5415+bool __ovld atomic_compare_exchange_strong_explicit(
5416+ volatile atomic_float *object, float *expected, float desired,
5417+ memory_order success, memory_order failure, memory_scope scope);
5418+bool __ovld atomic_compare_exchange_weak_explicit(
5419+ volatile atomic_float *object, float *expected, float desired,
5420+ memory_order success, memory_order failure, memory_scope scope);
5421+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
5422+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
5423+#ifdef __opencl_c_atomic_scope_device
5424+bool __ovld atomic_compare_exchange_strong_explicit(
5425+ volatile atomic_double *object, double *expected, double desired,
5426+ memory_order success, memory_order failure);
5427+bool __ovld atomic_compare_exchange_weak_explicit(
5428+ volatile atomic_double *object, double *expected, double desired,
5429+ memory_order success, memory_order failure);
5430+#endif // __opencl_c_atomic_scope_device
5431+bool __ovld atomic_compare_exchange_strong_explicit(
5432+ volatile atomic_double *object, double *expected, double desired,
5433+ memory_order success, memory_order failure, memory_scope scope);
5434+bool __ovld atomic_compare_exchange_weak_explicit(
5435+ volatile atomic_double *object, double *expected, double desired,
5436+ memory_order success, memory_order failure, memory_scope scope);
5437+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
5438+#ifdef __opencl_c_atomic_scope_device
5439+bool __ovld atomic_compare_exchange_strong_explicit(
5440+ volatile atomic_long *object, long *expected, long desired,
5441+ memory_order success, memory_order failure);
5442+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object,
5443+ long *expected, long desired,
5444+ memory_order success,
5445+ memory_order failure);
5446+bool __ovld atomic_compare_exchange_strong_explicit(
5447+ volatile atomic_ulong *object, ulong *expected, ulong desired,
5448+ memory_order success, memory_order failure);
5449+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_ulong *object,
5450+ ulong *expected,
5451+ ulong desired,
5452+ memory_order success,
5453+ memory_order failure);
5454+#endif // __opencl_c_atomic_scope_device
5455+bool __ovld atomic_compare_exchange_strong_explicit(
5456+ volatile atomic_long *object, long *expected, long desired,
5457+ memory_order success, memory_order failure, memory_scope scope);
5458+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object,
5459+ long *expected, long desired,
5460+ memory_order success,
5461+ memory_order failure,
5462+ memory_scope scope);
5463+bool __ovld atomic_compare_exchange_strong_explicit(
5464+ volatile atomic_ulong *object, ulong *expected, ulong desired,
5465+ memory_order success, memory_order failure, memory_scope scope);
5466+bool __ovld atomic_compare_exchange_weak_explicit(
5467+ volatile atomic_ulong *object, ulong *expected, ulong desired,
5468+ memory_order success, memory_order failure, memory_scope scope);
5469+#endif // defined(cl_khr_int64_base_atomics) &&
5470+ // defined(cl_khr_int64_extended_atomics)
5471+#endif // __opencl_c_generic_address_space
5472+
5473+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
5474+#ifdef __opencl_c_atomic_scope_device
5475+bool __ovld atomic_compare_exchange_strong_explicit(
5476+ volatile atomic_int __global *object, int __global *expected, int desired,
5477+ memory_order success, memory_order failure);
5478+bool __ovld atomic_compare_exchange_strong_explicit(
5479+ volatile atomic_int __local *object, int __global *expected, int desired,
5480+ memory_order success, memory_order failure);
5481+bool __ovld atomic_compare_exchange_strong_explicit(
5482+ volatile atomic_int __global *object, int __local *expected, int desired,
5483+ memory_order success, memory_order failure);
5484+bool __ovld atomic_compare_exchange_strong_explicit(
5485+ volatile atomic_int __local *object, int __local *expected, int desired,
5486+ memory_order success, memory_order failure);
5487+bool __ovld atomic_compare_exchange_strong_explicit(
5488+ volatile atomic_int __global *object, int __private *expected, int desired,
5489+ memory_order success, memory_order failure);
5490+bool __ovld atomic_compare_exchange_strong_explicit(
5491+ volatile atomic_int __local *object, int __private *expected, int desired,
5492+ memory_order success, memory_order failure);
5493+bool __ovld atomic_compare_exchange_strong_explicit(
5494+ volatile atomic_uint __global *object, uint __global *expected,
5495+ uint desired, memory_order success, memory_order failure);
5496+bool __ovld atomic_compare_exchange_strong_explicit(
5497+ volatile atomic_uint __local *object, uint __global *expected, uint desired,
5498+ memory_order success, memory_order failure);
5499+bool __ovld atomic_compare_exchange_strong_explicit(
5500+ volatile atomic_uint __global *object, uint __local *expected, uint desired,
5501+ memory_order success, memory_order failure);
5502+bool __ovld atomic_compare_exchange_strong_explicit(
5503+ volatile atomic_uint __local *object, uint __local *expected, uint desired,
5504+ memory_order success, memory_order failure);
5505+bool __ovld atomic_compare_exchange_strong_explicit(
5506+ volatile atomic_uint __global *object, uint __private *expected,
5507+ uint desired, memory_order success, memory_order failure);
5508+bool __ovld atomic_compare_exchange_strong_explicit(
5509+ volatile atomic_uint __local *object, uint __private *expected,
5510+ uint desired, memory_order success, memory_order failure);
5511+bool __ovld atomic_compare_exchange_weak_explicit(
5512+ volatile atomic_int __global *object, int __global *expected, int desired,
5513+ memory_order success, memory_order failure);
5514+bool __ovld atomic_compare_exchange_weak_explicit(
5515+ volatile atomic_int __local *object, int __global *expected, int desired,
5516+ memory_order success, memory_order failure);
5517+bool __ovld atomic_compare_exchange_weak_explicit(
5518+ volatile atomic_int __global *object, int __local *expected, int desired,
5519+ memory_order success, memory_order failure);
5520+bool __ovld atomic_compare_exchange_weak_explicit(
5521+ volatile atomic_int __local *object, int __local *expected, int desired,
5522+ memory_order success, memory_order failure);
5523+bool __ovld atomic_compare_exchange_weak_explicit(
5524+ volatile atomic_int __global *object, int __private *expected, int desired,
5525+ memory_order success, memory_order failure);
5526+bool __ovld atomic_compare_exchange_weak_explicit(
5527+ volatile atomic_int __local *object, int __private *expected, int desired,
5528+ memory_order success, memory_order failure);
5529+bool __ovld atomic_compare_exchange_weak_explicit(
5530+ volatile atomic_uint __global *object, uint __global *expected,
5531+ uint desired, memory_order success, memory_order failure);
5532+bool __ovld atomic_compare_exchange_weak_explicit(
5533+ volatile atomic_uint __local *object, uint __global *expected, uint desired,
5534+ memory_order success, memory_order failure);
5535+bool __ovld atomic_compare_exchange_weak_explicit(
5536+ volatile atomic_uint __global *object, uint __local *expected, uint desired,
5537+ memory_order success, memory_order failure);
5538+bool __ovld atomic_compare_exchange_weak_explicit(
5539+ volatile atomic_uint __local *object, uint __local *expected, uint desired,
5540+ memory_order success, memory_order failure);
5541+bool __ovld atomic_compare_exchange_weak_explicit(
5542+ volatile atomic_uint __global *object, uint __private *expected,
5543+ uint desired, memory_order success, memory_order failure);
5544+bool __ovld atomic_compare_exchange_weak_explicit(
5545+ volatile atomic_uint __local *object, uint __private *expected,
5546+ uint desired, memory_order success, memory_order failure);
5547+bool __ovld atomic_compare_exchange_strong_explicit(
5548+ volatile atomic_float __global *object, float __global *expected,
5549+ float desired, memory_order success, memory_order failure);
5550+bool __ovld atomic_compare_exchange_strong_explicit(
5551+ volatile atomic_float __local *object, float __global *expected,
5552+ float desired, memory_order success, memory_order failure);
5553+bool __ovld atomic_compare_exchange_strong_explicit(
5554+ volatile atomic_float __global *object, float __local *expected,
5555+ float desired, memory_order success, memory_order failure);
5556+bool __ovld atomic_compare_exchange_strong_explicit(
5557+ volatile atomic_float __local *object, float __local *expected,
5558+ float desired, memory_order success, memory_order failure);
5559+bool __ovld atomic_compare_exchange_strong_explicit(
5560+ volatile atomic_float __global *object, float __private *expected,
5561+ float desired, memory_order success, memory_order failure);
5562+bool __ovld atomic_compare_exchange_strong_explicit(
5563+ volatile atomic_float __local *object, float __private *expected,
5564+ float desired, memory_order success, memory_order failure);
5565+bool __ovld atomic_compare_exchange_weak_explicit(
5566+ volatile atomic_float __global *object, float __global *expected,
5567+ float desired, memory_order success, memory_order failure);
5568+bool __ovld atomic_compare_exchange_weak_explicit(
5569+ volatile atomic_float __local *object, float __global *expected,
5570+ float desired, memory_order success, memory_order failure);
5571+bool __ovld atomic_compare_exchange_weak_explicit(
5572+ volatile atomic_float __global *object, float __local *expected,
5573+ float desired, memory_order success, memory_order failure);
5574+bool __ovld atomic_compare_exchange_weak_explicit(
5575+ volatile atomic_float __local *object, float __local *expected,
5576+ float desired, memory_order success, memory_order failure);
5577+bool __ovld atomic_compare_exchange_weak_explicit(
5578+ volatile atomic_float __global *object, float __private *expected,
5579+ float desired, memory_order success, memory_order failure);
5580+bool __ovld atomic_compare_exchange_weak_explicit(
5581+ volatile atomic_float __local *object, float __private *expected,
5582+ float desired, memory_order success, memory_order failure);
5583+#endif // __opencl_c_atomic_scope_device
5584+bool __ovld atomic_compare_exchange_strong_explicit(
5585+ volatile atomic_int __global *object, int __global *expected, int desired,
5586+ memory_order success, memory_order failure, memory_scope scope);
5587+bool __ovld atomic_compare_exchange_strong_explicit(
5588+ volatile atomic_int __local *object, int __global *expected, int desired,
5589+ memory_order success, memory_order failure, memory_scope scope);
5590+bool __ovld atomic_compare_exchange_strong_explicit(
5591+ volatile atomic_int __global *object, int __local *expected, int desired,
5592+ memory_order success, memory_order failure, memory_scope scope);
5593+bool __ovld atomic_compare_exchange_strong_explicit(
5594+ volatile atomic_int __local *object, int __local *expected, int desired,
5595+ memory_order success, memory_order failure, memory_scope scope);
5596+bool __ovld atomic_compare_exchange_strong_explicit(
5597+ volatile atomic_int __global *object, int __private *expected, int desired,
5598+ memory_order success, memory_order failure, memory_scope scope);
5599+bool __ovld atomic_compare_exchange_strong_explicit(
5600+ volatile atomic_int __local *object, int __private *expected, int desired,
5601+ memory_order success, memory_order failure, memory_scope scope);
5602+bool __ovld atomic_compare_exchange_strong_explicit(
5603+ volatile atomic_uint __global *object, uint __global *expected,
5604+ uint desired, memory_order success, memory_order failure,
5605+ memory_scope scope);
5606+bool __ovld atomic_compare_exchange_strong_explicit(
5607+ volatile atomic_uint __local *object, uint __global *expected, uint desired,
5608+ memory_order success, memory_order failure, memory_scope scope);
5609+bool __ovld atomic_compare_exchange_strong_explicit(
5610+ volatile atomic_uint __global *object, uint __local *expected, uint desired,
5611+ memory_order success, memory_order failure, memory_scope scope);
5612+bool __ovld atomic_compare_exchange_strong_explicit(
5613+ volatile atomic_uint __local *object, uint __local *expected, uint desired,
5614+ memory_order success, memory_order failure, memory_scope scope);
5615+bool __ovld atomic_compare_exchange_strong_explicit(
5616+ volatile atomic_uint __global *object, uint __private *expected,
5617+ uint desired, memory_order success, memory_order failure,
5618+ memory_scope scope);
5619+bool __ovld atomic_compare_exchange_strong_explicit(
5620+ volatile atomic_uint __local *object, uint __private *expected,
5621+ uint desired, memory_order success, memory_order failure,
5622+ memory_scope scope);
5623+bool __ovld atomic_compare_exchange_weak_explicit(
5624+ volatile atomic_int __global *object, int __global *expected, int desired,
5625+ memory_order success, memory_order failure, memory_scope scope);
5626+bool __ovld atomic_compare_exchange_weak_explicit(
5627+ volatile atomic_int __local *object, int __global *expected, int desired,
5628+ memory_order success, memory_order failure, memory_scope scope);
5629+bool __ovld atomic_compare_exchange_weak_explicit(
5630+ volatile atomic_int __global *object, int __local *expected, int desired,
5631+ memory_order success, memory_order failure, memory_scope scope);
5632+bool __ovld atomic_compare_exchange_weak_explicit(
5633+ volatile atomic_int __local *object, int __local *expected, int desired,
5634+ memory_order success, memory_order failure, memory_scope scope);
5635+bool __ovld atomic_compare_exchange_weak_explicit(
5636+ volatile atomic_int __global *object, int __private *expected, int desired,
5637+ memory_order success, memory_order failure, memory_scope scope);
5638+bool __ovld atomic_compare_exchange_weak_explicit(
5639+ volatile atomic_int __local *object, int __private *expected, int desired,
5640+ memory_order success, memory_order failure, memory_scope scope);
5641+bool __ovld atomic_compare_exchange_weak_explicit(
5642+ volatile atomic_uint __global *object, uint __global *expected,
5643+ uint desired, memory_order success, memory_order failure,
5644+ memory_scope scope);
5645+bool __ovld atomic_compare_exchange_weak_explicit(
5646+ volatile atomic_uint __local *object, uint __global *expected, uint desired,
5647+ memory_order success, memory_order failure, memory_scope scope);
5648+bool __ovld atomic_compare_exchange_weak_explicit(
5649+ volatile atomic_uint __global *object, uint __local *expected, uint desired,
5650+ memory_order success, memory_order failure, memory_scope scope);
5651+bool __ovld atomic_compare_exchange_weak_explicit(
5652+ volatile atomic_uint __local *object, uint __local *expected, uint desired,
5653+ memory_order success, memory_order failure, memory_scope scope);
5654+bool __ovld atomic_compare_exchange_weak_explicit(
5655+ volatile atomic_uint __global *object, uint __private *expected,
5656+ uint desired, memory_order success, memory_order failure,
5657+ memory_scope scope);
5658+bool __ovld atomic_compare_exchange_weak_explicit(
5659+ volatile atomic_uint __local *object, uint __private *expected,
5660+ uint desired, memory_order success, memory_order failure,
5661+ memory_scope scope);
5662+bool __ovld atomic_compare_exchange_strong_explicit(
5663+ volatile atomic_float __global *object, float __global *expected,
5664+ float desired, memory_order success, memory_order failure,
5665+ memory_scope scope);
5666+bool __ovld atomic_compare_exchange_strong_explicit(
5667+ volatile atomic_float __local *object, float __global *expected,
5668+ float desired, memory_order success, memory_order failure,
5669+ memory_scope scope);
5670+bool __ovld atomic_compare_exchange_strong_explicit(
5671+ volatile atomic_float __global *object, float __local *expected,
5672+ float desired, memory_order success, memory_order failure,
5673+ memory_scope scope);
5674+bool __ovld atomic_compare_exchange_strong_explicit(
5675+ volatile atomic_float __local *object, float __local *expected,
5676+ float desired, memory_order success, memory_order failure,
5677+ memory_scope scope);
5678+bool __ovld atomic_compare_exchange_strong_explicit(
5679+ volatile atomic_float __global *object, float __private *expected,
5680+ float desired, memory_order success, memory_order failure,
5681+ memory_scope scope);
5682+bool __ovld atomic_compare_exchange_strong_explicit(
5683+ volatile atomic_float __local *object, float __private *expected,
5684+ float desired, memory_order success, memory_order failure,
5685+ memory_scope scope);
5686+bool __ovld atomic_compare_exchange_weak_explicit(
5687+ volatile atomic_float __global *object, float __global *expected,
5688+ float desired, memory_order success, memory_order failure,
5689+ memory_scope scope);
5690+bool __ovld atomic_compare_exchange_weak_explicit(
5691+ volatile atomic_float __local *object, float __global *expected,
5692+ float desired, memory_order success, memory_order failure,
5693+ memory_scope scope);
5694+bool __ovld atomic_compare_exchange_weak_explicit(
5695+ volatile atomic_float __global *object, float __local *expected,
5696+ float desired, memory_order success, memory_order failure,
5697+ memory_scope scope);
5698+bool __ovld atomic_compare_exchange_weak_explicit(
5699+ volatile atomic_float __local *object, float __local *expected,
5700+ float desired, memory_order success, memory_order failure,
5701+ memory_scope scope);
5702+bool __ovld atomic_compare_exchange_weak_explicit(
5703+ volatile atomic_float __global *object, float __private *expected,
5704+ float desired, memory_order success, memory_order failure,
5705+ memory_scope scope);
5706+bool __ovld atomic_compare_exchange_weak_explicit(
5707+ volatile atomic_float __local *object, float __private *expected,
5708+ float desired, memory_order success, memory_order failure,
5709+ memory_scope scope);
5710+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
5711+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
5712+#ifdef __opencl_c_atomic_scope_device
5713+bool __ovld atomic_compare_exchange_strong_explicit(
5714+ volatile atomic_double __global *object, double __global *expected,
5715+ double desired, memory_order success, memory_order failure);
5716+bool __ovld atomic_compare_exchange_strong_explicit(
5717+ volatile atomic_double __local *object, double __global *expected,
5718+ double desired, memory_order success, memory_order failure);
5719+bool __ovld atomic_compare_exchange_strong_explicit(
5720+ volatile atomic_double __global *object, double __local *expected,
5721+ double desired, memory_order success, memory_order failure);
5722+bool __ovld atomic_compare_exchange_strong_explicit(
5723+ volatile atomic_double __local *object, double __local *expected,
5724+ double desired, memory_order success, memory_order failure);
5725+bool __ovld atomic_compare_exchange_strong_explicit(
5726+ volatile atomic_double __global *object, double __private *expected,
5727+ double desired, memory_order success, memory_order failure);
5728+bool __ovld atomic_compare_exchange_strong_explicit(
5729+ volatile atomic_double __local *object, double __private *expected,
5730+ double desired, memory_order success, memory_order failure);
5731+bool __ovld atomic_compare_exchange_weak_explicit(
5732+ volatile atomic_double __global *object, double __global *expected,
5733+ double desired, memory_order success, memory_order failure);
5734+bool __ovld atomic_compare_exchange_weak_explicit(
5735+ volatile atomic_double __local *object, double __global *expected,
5736+ double desired, memory_order success, memory_order failure);
5737+bool __ovld atomic_compare_exchange_weak_explicit(
5738+ volatile atomic_double __global *object, double __local *expected,
5739+ double desired, memory_order success, memory_order failure);
5740+bool __ovld atomic_compare_exchange_weak_explicit(
5741+ volatile atomic_double __local *object, double __local *expected,
5742+ double desired, memory_order success, memory_order failure);
5743+bool __ovld atomic_compare_exchange_weak_explicit(
5744+ volatile atomic_double __global *object, double __private *expected,
5745+ double desired, memory_order success, memory_order failure);
5746+bool __ovld atomic_compare_exchange_weak_explicit(
5747+ volatile atomic_double __local *object, double __private *expected,
5748+ double desired, memory_order success, memory_order failure);
5749+#endif // __opencl_c_atomic_scope_device
5750+bool __ovld atomic_compare_exchange_strong_explicit(
5751+ volatile atomic_double __global *object, double __global *expected,
5752+ double desired, memory_order success, memory_order failure,
5753+ memory_scope scope);
5754+bool __ovld atomic_compare_exchange_strong_explicit(
5755+ volatile atomic_double __local *object, double __global *expected,
5756+ double desired, memory_order success, memory_order failure,
5757+ memory_scope scope);
5758+bool __ovld atomic_compare_exchange_strong_explicit(
5759+ volatile atomic_double __global *object, double __local *expected,
5760+ double desired, memory_order success, memory_order failure,
5761+ memory_scope scope);
5762+bool __ovld atomic_compare_exchange_strong_explicit(
5763+ volatile atomic_double __local *object, double __local *expected,
5764+ double desired, memory_order success, memory_order failure,
5765+ memory_scope scope);
5766+bool __ovld atomic_compare_exchange_strong_explicit(
5767+ volatile atomic_double __global *object, double __private *expected,
5768+ double desired, memory_order success, memory_order failure,
5769+ memory_scope scope);
5770+bool __ovld atomic_compare_exchange_strong_explicit(
5771+ volatile atomic_double __local *object, double __private *expected,
5772+ double desired, memory_order success, memory_order failure,
5773+ memory_scope scope);
5774+bool __ovld atomic_compare_exchange_weak_explicit(
5775+ volatile atomic_double __global *object, double __global *expected,
5776+ double desired, memory_order success, memory_order failure,
5777+ memory_scope scope);
5778+bool __ovld atomic_compare_exchange_weak_explicit(
5779+ volatile atomic_double __local *object, double __global *expected,
5780+ double desired, memory_order success, memory_order failure,
5781+ memory_scope scope);
5782+bool __ovld atomic_compare_exchange_weak_explicit(
5783+ volatile atomic_double __global *object, double __local *expected,
5784+ double desired, memory_order success, memory_order failure,
5785+ memory_scope scope);
5786+bool __ovld atomic_compare_exchange_weak_explicit(
5787+ volatile atomic_double __local *object, double __local *expected,
5788+ double desired, memory_order success, memory_order failure,
5789+ memory_scope scope);
5790+bool __ovld atomic_compare_exchange_weak_explicit(
5791+ volatile atomic_double __global *object, double __private *expected,
5792+ double desired, memory_order success, memory_order failure,
5793+ memory_scope scope);
5794+bool __ovld atomic_compare_exchange_weak_explicit(
5795+ volatile atomic_double __local *object, double __private *expected,
5796+ double desired, memory_order success, memory_order failure,
5797+ memory_scope scope);
5798+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
5799+#ifdef __opencl_c_atomic_scope_device
5800+bool __ovld atomic_compare_exchange_strong_explicit(
5801+ volatile atomic_long __global *object, long __global *expected,
5802+ long desired, memory_order success, memory_order failure);
5803+bool __ovld atomic_compare_exchange_strong_explicit(
5804+ volatile atomic_long __local *object, long __global *expected, long desired,
5805+ memory_order success, memory_order failure);
5806+bool __ovld atomic_compare_exchange_strong_explicit(
5807+ volatile atomic_long __global *object, long __local *expected, long desired,
5808+ memory_order success, memory_order failure);
5809+bool __ovld atomic_compare_exchange_strong_explicit(
5810+ volatile atomic_long __local *object, long __local *expected, long desired,
5811+ memory_order success, memory_order failure);
5812+bool __ovld atomic_compare_exchange_strong_explicit(
5813+ volatile atomic_long __global *object, long __private *expected,
5814+ long desired, memory_order success, memory_order failure);
5815+bool __ovld atomic_compare_exchange_strong_explicit(
5816+ volatile atomic_long __local *object, long __private *expected,
5817+ long desired, memory_order success, memory_order failure);
5818+bool __ovld atomic_compare_exchange_weak_explicit(
5819+ volatile atomic_long __global *object, long __global *expected,
5820+ long desired, memory_order success, memory_order failure);
5821+bool __ovld atomic_compare_exchange_weak_explicit(
5822+ volatile atomic_long __local *object, long __global *expected, long desired,
5823+ memory_order success, memory_order failure);
5824+bool __ovld atomic_compare_exchange_weak_explicit(
5825+ volatile atomic_long __global *object, long __local *expected, long desired,
5826+ memory_order success, memory_order failure);
5827+bool __ovld atomic_compare_exchange_weak_explicit(
5828+ volatile atomic_long __local *object, long __local *expected, long desired,
5829+ memory_order success, memory_order failure);
5830+bool __ovld atomic_compare_exchange_weak_explicit(
5831+ volatile atomic_long __global *object, long __private *expected,
5832+ long desired, memory_order success, memory_order failure);
5833+bool __ovld atomic_compare_exchange_weak_explicit(
5834+ volatile atomic_long __local *object, long __private *expected,
5835+ long desired, memory_order success, memory_order failure);
5836+bool __ovld atomic_compare_exchange_strong_explicit(
5837+ volatile atomic_ulong __global *object, ulong __global *expected,
5838+ ulong desired, memory_order success, memory_order failure);
5839+bool __ovld atomic_compare_exchange_strong_explicit(
5840+ volatile atomic_ulong __local *object, ulong __global *expected,
5841+ ulong desired, memory_order success, memory_order failure);
5842+bool __ovld atomic_compare_exchange_strong_explicit(
5843+ volatile atomic_ulong __global *object, ulong __local *expected,
5844+ ulong desired, memory_order success, memory_order failure);
5845+bool __ovld atomic_compare_exchange_strong_explicit(
5846+ volatile atomic_ulong __local *object, ulong __local *expected,
5847+ ulong desired, memory_order success, memory_order failure);
5848+bool __ovld atomic_compare_exchange_strong_explicit(
5849+ volatile atomic_ulong __global *object, ulong __private *expected,
5850+ ulong desired, memory_order success, memory_order failure);
5851+bool __ovld atomic_compare_exchange_strong_explicit(
5852+ volatile atomic_ulong __local *object, ulong __private *expected,
5853+ ulong desired, memory_order success, memory_order failure);
5854+bool __ovld atomic_compare_exchange_weak_explicit(
5855+ volatile atomic_ulong __global *object, ulong __global *expected,
5856+ ulong desired, memory_order success, memory_order failure);
5857+bool __ovld atomic_compare_exchange_weak_explicit(
5858+ volatile atomic_ulong __local *object, ulong __global *expected,
5859+ ulong desired, memory_order success, memory_order failure);
5860+bool __ovld atomic_compare_exchange_weak_explicit(
5861+ volatile atomic_ulong __global *object, ulong __local *expected,
5862+ ulong desired, memory_order success, memory_order failure);
5863+bool __ovld atomic_compare_exchange_weak_explicit(
5864+ volatile atomic_ulong __local *object, ulong __local *expected,
5865+ ulong desired, memory_order success, memory_order failure);
5866+bool __ovld atomic_compare_exchange_weak_explicit(
5867+ volatile atomic_ulong __global *object, ulong __private *expected,
5868+ ulong desired, memory_order success, memory_order failure);
5869+bool __ovld atomic_compare_exchange_weak_explicit(
5870+ volatile atomic_ulong __local *object, ulong __private *expected,
5871+ ulong desired, memory_order success, memory_order failure);
5872+#endif // __opencl_c_atomic_scope_device
5873+bool __ovld atomic_compare_exchange_strong_explicit(
5874+ volatile atomic_long __global *object, long __global *expected,
5875+ long desired, memory_order success, memory_order failure,
5876+ memory_scope scope);
5877+bool __ovld atomic_compare_exchange_strong_explicit(
5878+ volatile atomic_long __local *object, long __global *expected, long desired,
5879+ memory_order success, memory_order failure, memory_scope scope);
5880+bool __ovld atomic_compare_exchange_strong_explicit(
5881+ volatile atomic_long __global *object, long __local *expected, long desired,
5882+ memory_order success, memory_order failure, memory_scope scope);
5883+bool __ovld atomic_compare_exchange_strong_explicit(
5884+ volatile atomic_long __local *object, long __local *expected, long desired,
5885+ memory_order success, memory_order failure, memory_scope scope);
5886+bool __ovld atomic_compare_exchange_strong_explicit(
5887+ volatile atomic_long __global *object, long __private *expected,
5888+ long desired, memory_order success, memory_order failure,
5889+ memory_scope scope);
5890+bool __ovld atomic_compare_exchange_strong_explicit(
5891+ volatile atomic_long __local *object, long __private *expected,
5892+ long desired, memory_order success, memory_order failure,
5893+ memory_scope scope);
5894+bool __ovld atomic_compare_exchange_weak_explicit(
5895+ volatile atomic_long __global *object, long __global *expected,
5896+ long desired, memory_order success, memory_order failure,
5897+ memory_scope scope);
5898+bool __ovld atomic_compare_exchange_weak_explicit(
5899+ volatile atomic_long __local *object, long __global *expected, long desired,
5900+ memory_order success, memory_order failure, memory_scope scope);
5901+bool __ovld atomic_compare_exchange_weak_explicit(
5902+ volatile atomic_long __global *object, long __local *expected, long desired,
5903+ memory_order success, memory_order failure, memory_scope scope);
5904+bool __ovld atomic_compare_exchange_weak_explicit(
5905+ volatile atomic_long __local *object, long __local *expected, long desired,
5906+ memory_order success, memory_order failure, memory_scope scope);
5907+bool __ovld atomic_compare_exchange_weak_explicit(
5908+ volatile atomic_long __global *object, long __private *expected,
5909+ long desired, memory_order success, memory_order failure,
5910+ memory_scope scope);
5911+bool __ovld atomic_compare_exchange_weak_explicit(
5912+ volatile atomic_long __local *object, long __private *expected,
5913+ long desired, memory_order success, memory_order failure,
5914+ memory_scope scope);
5915+bool __ovld atomic_compare_exchange_strong_explicit(
5916+ volatile atomic_ulong __global *object, ulong __global *expected,
5917+ ulong desired, memory_order success, memory_order failure,
5918+ memory_scope scope);
5919+bool __ovld atomic_compare_exchange_strong_explicit(
5920+ volatile atomic_ulong __local *object, ulong __global *expected,
5921+ ulong desired, memory_order success, memory_order failure,
5922+ memory_scope scope);
5923+bool __ovld atomic_compare_exchange_strong_explicit(
5924+ volatile atomic_ulong __global *object, ulong __local *expected,
5925+ ulong desired, memory_order success, memory_order failure,
5926+ memory_scope scope);
5927+bool __ovld atomic_compare_exchange_strong_explicit(
5928+ volatile atomic_ulong __local *object, ulong __local *expected,
5929+ ulong desired, memory_order success, memory_order failure,
5930+ memory_scope scope);
5931+bool __ovld atomic_compare_exchange_strong_explicit(
5932+ volatile atomic_ulong __global *object, ulong __private *expected,
5933+ ulong desired, memory_order success, memory_order failure,
5934+ memory_scope scope);
5935+bool __ovld atomic_compare_exchange_strong_explicit(
5936+ volatile atomic_ulong __local *object, ulong __private *expected,
5937+ ulong desired, memory_order success, memory_order failure,
5938+ memory_scope scope);
5939+bool __ovld atomic_compare_exchange_weak_explicit(
5940+ volatile atomic_ulong __global *object, ulong __global *expected,
5941+ ulong desired, memory_order success, memory_order failure,
5942+ memory_scope scope);
5943+bool __ovld atomic_compare_exchange_weak_explicit(
5944+ volatile atomic_ulong __local *object, ulong __global *expected,
5945+ ulong desired, memory_order success, memory_order failure,
5946+ memory_scope scope);
5947+bool __ovld atomic_compare_exchange_weak_explicit(
5948+ volatile atomic_ulong __global *object, ulong __local *expected,
5949+ ulong desired, memory_order success, memory_order failure,
5950+ memory_scope scope);
5951+bool __ovld atomic_compare_exchange_weak_explicit(
5952+ volatile atomic_ulong __local *object, ulong __local *expected,
5953+ ulong desired, memory_order success, memory_order failure,
5954+ memory_scope scope);
5955+bool __ovld atomic_compare_exchange_weak_explicit(
5956+ volatile atomic_ulong __global *object, ulong __private *expected,
5957+ ulong desired, memory_order success, memory_order failure,
5958+ memory_scope scope);
5959+bool __ovld atomic_compare_exchange_weak_explicit(
5960+ volatile atomic_ulong __local *object, ulong __private *expected,
5961+ ulong desired, memory_order success, memory_order failure,
5962+ memory_scope scope);
5963+#endif // defined(cl_khr_int64_base_atomics) &&
5964+ // defined(cl_khr_int64_extended_atomics)
5965+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
5966
5967 // atomic_flag_test_and_set() and atomic_flag_clear()
5968-
5969+#if defined(__opencl_c_atomic_scope_device) && \
5970+ defined(__opencl_c_atomic_order_seq_cst)
5971+#ifdef __opencl_c_generic_address_space
5972 bool __ovld atomic_flag_test_and_set(volatile atomic_flag *object);
5973-bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object, memory_order order);
5974-bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object, memory_order order, memory_scope scope);
5975 void __ovld atomic_flag_clear(volatile atomic_flag *object);
5976-void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object, memory_order order);
5977-void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object, memory_order order, memory_scope scope);
5978+#endif // __opencl_c_generic_address_space
5979+
5980+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
5981+bool __ovld atomic_flag_test_and_set(volatile atomic_flag __global *object);
5982+bool __ovld atomic_flag_test_and_set(volatile atomic_flag __local *object);
5983+void __ovld atomic_flag_clear(volatile atomic_flag __global *object);
5984+void __ovld atomic_flag_clear(volatile atomic_flag __local *object);
5985+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
5986+#endif // defined(__opencl_c_atomic_scope_device) &&
5987+ // defined(__opencl_c_atomic_order_seq_cst)
5988+
5989+#ifdef __opencl_c_generic_address_space
5990+#ifdef __opencl_c_atomic_scope_device
5991+bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object,
5992+ memory_order order);
5993+void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object,
5994+ memory_order order);
5995+#endif // __opencl_c_atomic_scope_device
5996+bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object,
5997+ memory_order order,
5998+ memory_scope scope);
5999+void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object,
6000+ memory_order order, memory_scope scope);
6001+#endif // __opencl_c_generic_address_space
6002+
6003+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
6004+#ifdef __opencl_c_atomic_scope_device
6005+bool __ovld atomic_flag_test_and_set_explicit(
6006+ volatile atomic_flag __global *object, memory_order order);
6007+bool __ovld atomic_flag_test_and_set_explicit(
6008+ volatile atomic_flag __local *object, memory_order order);
6009+void __ovld atomic_flag_clear_explicit(volatile atomic_flag __global *object,
6010+ memory_order order);
6011+void __ovld atomic_flag_clear_explicit(volatile atomic_flag __local *object,
6012+ memory_order order);
6013+#endif // __opencl_c_atomic_scope_device
6014+bool __ovld
6015+atomic_flag_test_and_set_explicit(volatile atomic_flag __global *object,
6016+ memory_order order, memory_scope scope);
6017+bool __ovld
6018+atomic_flag_test_and_set_explicit(volatile atomic_flag __local *object,
6019+ memory_order order, memory_scope scope);
6020+void __ovld atomic_flag_clear_explicit(volatile atomic_flag __global *object,
6021+ memory_order order, memory_scope scope);
6022+void __ovld atomic_flag_clear_explicit(volatile atomic_flag __local *object,
6023+ memory_order order, memory_scope scope);
6024+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
6025
6026 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6027
6028@@ -13918,7 +15943,7 @@ float16 __ovld __cnfn shuffle(float4 x, uint16 mask);
6029 float16 __ovld __cnfn shuffle(float8 x, uint16 mask);
6030 float16 __ovld __cnfn shuffle(float16 x, uint16 mask);
6031
6032-#ifdef cl_khr_fp64
6033+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6034 double2 __ovld __cnfn shuffle(double2 x, ulong2 mask);
6035 double2 __ovld __cnfn shuffle(double4 x, ulong2 mask);
6036 double2 __ovld __cnfn shuffle(double8 x, ulong2 mask);
6037@@ -13938,7 +15963,7 @@ double16 __ovld __cnfn shuffle(double2 x, ulong16 mask);
6038 double16 __ovld __cnfn shuffle(double4 x, ulong16 mask);
6039 double16 __ovld __cnfn shuffle(double8 x, ulong16 mask);
6040 double16 __ovld __cnfn shuffle(double16 x, ulong16 mask);
6041-#endif //cl_khr_fp64
6042+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6043
6044 #ifdef cl_khr_fp16
6045 half2 __ovld __cnfn shuffle(half2 x, ushort2 mask);
6046@@ -14142,7 +16167,7 @@ float16 __ovld __cnfn shuffle2(float4 x, float4 y, uint16 mask);
6047 float16 __ovld __cnfn shuffle2(float8 x, float8 y, uint16 mask);
6048 float16 __ovld __cnfn shuffle2(float16 x, float16 y, uint16 mask);
6049
6050-#ifdef cl_khr_fp64
6051+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6052 double2 __ovld __cnfn shuffle2(double2 x, double2 y, ulong2 mask);
6053 double2 __ovld __cnfn shuffle2(double4 x, double4 y, ulong2 mask);
6054 double2 __ovld __cnfn shuffle2(double8 x, double8 y, ulong2 mask);
6055@@ -14162,7 +16187,7 @@ double16 __ovld __cnfn shuffle2(double2 x, double2 y, ulong16 mask);
6056 double16 __ovld __cnfn shuffle2(double4 x, double4 y, ulong16 mask);
6057 double16 __ovld __cnfn shuffle2(double8 x, double8 y, ulong16 mask);
6058 double16 __ovld __cnfn shuffle2(double16 x, double16 y, ulong16 mask);
6059-#endif //cl_khr_fp64
6060+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6061
6062 #ifdef cl_khr_fp16
6063 half2 __ovld __cnfn shuffle2(half2 x, half2 y, ushort2 mask);
6064@@ -14198,6 +16223,7 @@ int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2)))
6065 #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable
6066 #endif //cl_khr_gl_msaa_sharing
6067
6068+#ifdef __opencl_c_images
6069 /**
6070 * Use the coordinate (coord.xy) to do an element lookup in
6071 * the 2D image object specified by image.
6072@@ -14476,6 +16502,7 @@ half4 __purefn __ovld read_imageh(read_only image1d_buffer_t image, int coord);
6073
6074 // Image read functions for read_write images
6075 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6076+#ifdef __opencl_c_read_write_images
6077 float4 __purefn __ovld read_imagef(read_write image1d_t image, int coord);
6078 int4 __purefn __ovld read_imagei(read_write image1d_t image, int coord);
6079 uint4 __purefn __ovld read_imageui(read_write image1d_t image, int coord);
6080@@ -14519,6 +16546,7 @@ float __purefn __ovld read_imagef(read_write image2d_array_msaa_depth_t image, i
6081 #endif //cl_khr_gl_msaa_sharing
6082
6083 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6084+#ifdef __opencl_c_read_write_images
6085 #ifdef cl_khr_mipmap_image
6086 float4 __purefn __ovld read_imagef(read_write image1d_t image, sampler_t sampler, float coord, float lod);
6087 int4 __purefn __ovld read_imagei(read_write image1d_t image, sampler_t sampler, float coord, float lod);
6088@@ -14569,6 +16597,7 @@ int4 __purefn __ovld read_imagei(read_write image3d_t image, sampler_t sampler,
6089 uint4 __purefn __ovld read_imageui(read_write image3d_t image, sampler_t sampler, float4 coord, float4 gradientX, float4 gradientY);
6090
6091 #endif //cl_khr_mipmap_image
6092+#endif //__opencl_c_read_write_images
6093 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6094
6095 // Image read functions returning half4 type
6096@@ -14580,6 +16609,7 @@ half4 __purefn __ovld read_imageh(read_write image1d_array_t image, int2 coord);
6097 half4 __purefn __ovld read_imageh(read_write image2d_array_t image, int4 coord);
6098 half4 __purefn __ovld read_imageh(read_write image1d_buffer_t image, int coord);
6099 #endif //cl_khr_fp16
6100+#endif //__opencl_c_read_write_images
6101 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6102
6103 /**
6104@@ -14669,7 +16699,7 @@ void __ovld write_imagef(write_only image1d_array_t image_array, int2 coord, flo
6105 void __ovld write_imagei(write_only image1d_array_t image_array, int2 coord, int4 color);
6106 void __ovld write_imageui(write_only image1d_array_t image_array, int2 coord, uint4 color);
6107
6108-#ifdef cl_khr_3d_image_writes
6109+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6110 void __ovld write_imagef(write_only image3d_t image, int4 coord, float4 color);
6111 void __ovld write_imagei(write_only image3d_t image, int4 coord, int4 color);
6112 void __ovld write_imageui(write_only image3d_t image, int4 coord, uint4 color);
6113@@ -14702,7 +16732,7 @@ void __ovld write_imageui(write_only image2d_array_t image_array, int4 coord, in
6114 void __ovld write_imagef(write_only image2d_depth_t image, int2 coord, int lod, float depth);
6115 void __ovld write_imagef(write_only image2d_array_depth_t image, int4 coord, int lod, float depth);
6116
6117-#ifdef cl_khr_3d_image_writes
6118+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6119 void __ovld write_imagef(write_only image3d_t image, int4 coord, int lod, float4 color);
6120 void __ovld write_imagei(write_only image3d_t image, int4 coord, int lod, int4 color);
6121 void __ovld write_imageui(write_only image3d_t image, int4 coord, int lod, uint4 color);
6122@@ -14715,7 +16745,7 @@ void __ovld write_imageui(write_only image3d_t image, int4 coord, int lod, uint4
6123 #ifdef cl_khr_fp16
6124 void __ovld write_imageh(write_only image1d_t image, int coord, half4 color);
6125 void __ovld write_imageh(write_only image2d_t image, int2 coord, half4 color);
6126-#ifdef cl_khr_3d_image_writes
6127+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6128 void __ovld write_imageh(write_only image3d_t image, int4 coord, half4 color);
6129 #endif
6130 void __ovld write_imageh(write_only image1d_array_t image, int2 coord, half4 color);
6131@@ -14725,6 +16755,7 @@ void __ovld write_imageh(write_only image1d_buffer_t image, int coord, half4 col
6132
6133 // Image write functions for read_write images
6134 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6135+#ifdef __opencl_c_read_write_images
6136 void __ovld write_imagef(read_write image2d_t image, int2 coord, float4 color);
6137 void __ovld write_imagei(read_write image2d_t image, int2 coord, int4 color);
6138 void __ovld write_imageui(read_write image2d_t image, int2 coord, uint4 color);
6139@@ -14745,7 +16776,7 @@ void __ovld write_imagef(read_write image1d_array_t image_array, int2 coord, flo
6140 void __ovld write_imagei(read_write image1d_array_t image_array, int2 coord, int4 color);
6141 void __ovld write_imageui(read_write image1d_array_t image_array, int2 coord, uint4 color);
6142
6143-#ifdef cl_khr_3d_image_writes
6144+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6145 void __ovld write_imagef(read_write image3d_t image, int4 coord, float4 color);
6146 void __ovld write_imagei(read_write image3d_t image, int4 coord, int4 color);
6147 void __ovld write_imageui(read_write image3d_t image, int4 coord, uint4 color);
6148@@ -14777,7 +16808,7 @@ void __ovld write_imageui(read_write image2d_array_t image_array, int4 coord, in
6149 void __ovld write_imagef(read_write image2d_depth_t image, int2 coord, int lod, float color);
6150 void __ovld write_imagef(read_write image2d_array_depth_t image, int4 coord, int lod, float color);
6151
6152-#ifdef cl_khr_3d_image_writes
6153+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6154 void __ovld write_imagef(read_write image3d_t image, int4 coord, int lod, float4 color);
6155 void __ovld write_imagei(read_write image3d_t image, int4 coord, int lod, int4 color);
6156 void __ovld write_imageui(read_write image3d_t image, int4 coord, int lod, uint4 color);
6157@@ -14790,13 +16821,14 @@ void __ovld write_imageui(read_write image3d_t image, int4 coord, int lod, uint4
6158 #ifdef cl_khr_fp16
6159 void __ovld write_imageh(read_write image1d_t image, int coord, half4 color);
6160 void __ovld write_imageh(read_write image2d_t image, int2 coord, half4 color);
6161-#ifdef cl_khr_3d_image_writes
6162+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6163 void __ovld write_imageh(read_write image3d_t image, int4 coord, half4 color);
6164 #endif
6165 void __ovld write_imageh(read_write image1d_array_t image, int2 coord, half4 color);
6166 void __ovld write_imageh(read_write image2d_array_t image, int4 coord, half4 color);
6167 void __ovld write_imageh(read_write image1d_buffer_t image, int coord, half4 color);
6168 #endif //cl_khr_fp16
6169+#endif //__opencl_c_read_write_images
6170 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6171
6172 // Note: In OpenCL v1.0/1.1/1.2, image argument of image query builtin functions does not have
6173@@ -14810,7 +16842,7 @@ void __ovld write_imageh(read_write image1d_buffer_t image, int coord, half4 col
6174 int __ovld __cnfn get_image_width(read_only image1d_t image);
6175 int __ovld __cnfn get_image_width(read_only image1d_buffer_t image);
6176 int __ovld __cnfn get_image_width(read_only image2d_t image);
6177-#ifdef cl_khr_3d_image_writes
6178+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6179 int __ovld __cnfn get_image_width(read_only image3d_t image);
6180 #endif
6181 int __ovld __cnfn get_image_width(read_only image1d_array_t image);
6182@@ -14829,7 +16861,7 @@ int __ovld __cnfn get_image_width(read_only image2d_array_msaa_depth_t image);
6183 int __ovld __cnfn get_image_width(write_only image1d_t image);
6184 int __ovld __cnfn get_image_width(write_only image1d_buffer_t image);
6185 int __ovld __cnfn get_image_width(write_only image2d_t image);
6186-#ifdef cl_khr_3d_image_writes
6187+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6188 int __ovld __cnfn get_image_width(write_only image3d_t image);
6189 #endif
6190 int __ovld __cnfn get_image_width(write_only image1d_array_t image);
6191@@ -14846,6 +16878,7 @@ int __ovld __cnfn get_image_width(write_only image2d_array_msaa_depth_t image);
6192 #endif //cl_khr_gl_msaa_sharing
6193
6194 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6195+#ifdef __opencl_c_read_write_images
6196 int __ovld __cnfn get_image_width(read_write image1d_t image);
6197 int __ovld __cnfn get_image_width(read_write image1d_buffer_t image);
6198 int __ovld __cnfn get_image_width(read_write image2d_t image);
6199@@ -14862,6 +16895,7 @@ int __ovld __cnfn get_image_width(read_write image2d_msaa_depth_t image);
6200 int __ovld __cnfn get_image_width(read_write image2d_array_msaa_t image);
6201 int __ovld __cnfn get_image_width(read_write image2d_array_msaa_depth_t image);
6202 #endif //cl_khr_gl_msaa_sharing
6203+#endif //__opencl_c_read_write_images
6204 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6205
6206 /**
6207@@ -14882,7 +16916,7 @@ int __ovld __cnfn get_image_height(read_only image2d_array_msaa_depth_t image);
6208 #endif //cl_khr_gl_msaa_sharing
6209
6210 int __ovld __cnfn get_image_height(write_only image2d_t image);
6211-#ifdef cl_khr_3d_image_writes
6212+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6213 int __ovld __cnfn get_image_height(write_only image3d_t image);
6214 #endif
6215 int __ovld __cnfn get_image_height(write_only image2d_array_t image);
6216@@ -14898,6 +16932,7 @@ int __ovld __cnfn get_image_height(write_only image2d_array_msaa_depth_t image);
6217 #endif //cl_khr_gl_msaa_sharing
6218
6219 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6220+#ifdef __opencl_c_read_write_images
6221 int __ovld __cnfn get_image_height(read_write image2d_t image);
6222 int __ovld __cnfn get_image_height(read_write image3d_t image);
6223 int __ovld __cnfn get_image_height(read_write image2d_array_t image);
6224@@ -14911,6 +16946,7 @@ int __ovld __cnfn get_image_height(read_write image2d_msaa_depth_t image);
6225 int __ovld __cnfn get_image_height(read_write image2d_array_msaa_t image);
6226 int __ovld __cnfn get_image_height(read_write image2d_array_msaa_depth_t image);
6227 #endif //cl_khr_gl_msaa_sharing
6228+#endif //__opencl_c_read_write_images
6229 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6230
6231 /**
6232@@ -14918,12 +16954,14 @@ int __ovld __cnfn get_image_height(read_write image2d_array_msaa_depth_t image);
6233 */
6234 int __ovld __cnfn get_image_depth(read_only image3d_t image);
6235
6236-#ifdef cl_khr_3d_image_writes
6237+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6238 int __ovld __cnfn get_image_depth(write_only image3d_t image);
6239 #endif
6240
6241 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6242+#ifdef __opencl_c_read_write_images
6243 int __ovld __cnfn get_image_depth(read_write image3d_t image);
6244+#endif //__opencl_c_read_write_images
6245 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6246
6247 // OpenCL Extension v2.0 s9.18 - Mipmaps
6248@@ -14939,13 +16977,15 @@ int __ovld get_image_num_mip_levels(read_only image3d_t image);
6249
6250 int __ovld get_image_num_mip_levels(write_only image1d_t image);
6251 int __ovld get_image_num_mip_levels(write_only image2d_t image);
6252-#ifdef cl_khr_3d_image_writes
6253+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6254 int __ovld get_image_num_mip_levels(write_only image3d_t image);
6255 #endif
6256
6257+#ifdef __opencl_c_read_write_images
6258 int __ovld get_image_num_mip_levels(read_write image1d_t image);
6259 int __ovld get_image_num_mip_levels(read_write image2d_t image);
6260 int __ovld get_image_num_mip_levels(read_write image3d_t image);
6261+#endif //__opencl_c_read_write_images
6262
6263 int __ovld get_image_num_mip_levels(read_only image1d_array_t image);
6264 int __ovld get_image_num_mip_levels(read_only image2d_array_t image);
6265@@ -14957,10 +16997,12 @@ int __ovld get_image_num_mip_levels(write_only image2d_array_t image);
6266 int __ovld get_image_num_mip_levels(write_only image2d_array_depth_t image);
6267 int __ovld get_image_num_mip_levels(write_only image2d_depth_t image);
6268
6269+#ifdef __opencl_c_read_write_images
6270 int __ovld get_image_num_mip_levels(read_write image1d_array_t image);
6271 int __ovld get_image_num_mip_levels(read_write image2d_array_t image);
6272 int __ovld get_image_num_mip_levels(read_write image2d_array_depth_t image);
6273 int __ovld get_image_num_mip_levels(read_write image2d_depth_t image);
6274+#endif //__opencl_c_read_write_images
6275
6276 #endif //cl_khr_mipmap_image
6277 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6278@@ -15004,7 +17046,7 @@ int __ovld __cnfn get_image_channel_data_type(read_only image2d_array_msaa_depth
6279 int __ovld __cnfn get_image_channel_data_type(write_only image1d_t image);
6280 int __ovld __cnfn get_image_channel_data_type(write_only image1d_buffer_t image);
6281 int __ovld __cnfn get_image_channel_data_type(write_only image2d_t image);
6282-#ifdef cl_khr_3d_image_writes
6283+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6284 int __ovld __cnfn get_image_channel_data_type(write_only image3d_t image);
6285 #endif
6286 int __ovld __cnfn get_image_channel_data_type(write_only image1d_array_t image);
6287@@ -15021,6 +17063,7 @@ int __ovld __cnfn get_image_channel_data_type(write_only image2d_array_msaa_dept
6288 #endif //cl_khr_gl_msaa_sharing
6289
6290 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6291+#ifdef __opencl_c_read_write_images
6292 int __ovld __cnfn get_image_channel_data_type(read_write image1d_t image);
6293 int __ovld __cnfn get_image_channel_data_type(read_write image1d_buffer_t image);
6294 int __ovld __cnfn get_image_channel_data_type(read_write image2d_t image);
6295@@ -15037,6 +17080,7 @@ int __ovld __cnfn get_image_channel_data_type(read_write image2d_msaa_depth_t im
6296 int __ovld __cnfn get_image_channel_data_type(read_write image2d_array_msaa_t image);
6297 int __ovld __cnfn get_image_channel_data_type(read_write image2d_array_msaa_depth_t image);
6298 #endif //cl_khr_gl_msaa_sharing
6299+#endif //__opencl_c_read_write_images
6300 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6301
6302 /**
6303@@ -15076,7 +17120,7 @@ int __ovld __cnfn get_image_channel_order(read_only image2d_array_msaa_depth_t i
6304 int __ovld __cnfn get_image_channel_order(write_only image1d_t image);
6305 int __ovld __cnfn get_image_channel_order(write_only image1d_buffer_t image);
6306 int __ovld __cnfn get_image_channel_order(write_only image2d_t image);
6307-#ifdef cl_khr_3d_image_writes
6308+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6309 int __ovld __cnfn get_image_channel_order(write_only image3d_t image);
6310 #endif
6311 int __ovld __cnfn get_image_channel_order(write_only image1d_array_t image);
6312@@ -15093,6 +17137,7 @@ int __ovld __cnfn get_image_channel_order(write_only image2d_array_msaa_depth_t
6313 #endif //cl_khr_gl_msaa_sharing
6314
6315 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6316+#ifdef __opencl_c_read_write_images
6317 int __ovld __cnfn get_image_channel_order(read_write image1d_t image);
6318 int __ovld __cnfn get_image_channel_order(read_write image1d_buffer_t image);
6319 int __ovld __cnfn get_image_channel_order(read_write image2d_t image);
6320@@ -15109,6 +17154,7 @@ int __ovld __cnfn get_image_channel_order(read_write image2d_msaa_depth_t image)
6321 int __ovld __cnfn get_image_channel_order(read_write image2d_array_msaa_t image);
6322 int __ovld __cnfn get_image_channel_order(read_write image2d_array_msaa_depth_t image);
6323 #endif //cl_khr_gl_msaa_sharing
6324+#endif //__opencl_c_read_write_images
6325 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6326
6327 /**
6328@@ -15143,6 +17189,7 @@ int2 __ovld __cnfn get_image_dim(write_only image2d_array_msaa_depth_t image);
6329 #endif //cl_khr_gl_msaa_sharing
6330
6331 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6332+#ifdef __opencl_c_read_write_images
6333 int2 __ovld __cnfn get_image_dim(read_write image2d_t image);
6334 int2 __ovld __cnfn get_image_dim(read_write image2d_array_t image);
6335 #ifdef cl_khr_depth_images
6336@@ -15155,6 +17202,7 @@ int2 __ovld __cnfn get_image_dim(read_write image2d_msaa_depth_t image);
6337 int2 __ovld __cnfn get_image_dim(read_write image2d_array_msaa_t image);
6338 int2 __ovld __cnfn get_image_dim(read_write image2d_array_msaa_depth_t image);
6339 #endif //cl_khr_gl_msaa_sharing
6340+#endif //__opencl_c_read_write_images
6341 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6342
6343 /**
6344@@ -15164,11 +17212,13 @@ int2 __ovld __cnfn get_image_dim(read_write image2d_array_msaa_depth_t image);
6345 * component and the w component is 0.
6346 */
6347 int4 __ovld __cnfn get_image_dim(read_only image3d_t image);
6348-#ifdef cl_khr_3d_image_writes
6349+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6350 int4 __ovld __cnfn get_image_dim(write_only image3d_t image);
6351 #endif
6352 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6353+#ifdef __opencl_c_read_write_images
6354 int4 __ovld __cnfn get_image_dim(read_write image3d_t image);
6355+#endif //__opencl_c_read_write_images
6356 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6357
6358 /**
6359@@ -15196,6 +17246,7 @@ size_t __ovld __cnfn get_image_array_size(write_only image2d_array_msaa_depth_t
6360 #endif //cl_khr_gl_msaa_sharing
6361
6362 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6363+#ifdef __opencl_c_read_write_images
6364 size_t __ovld __cnfn get_image_array_size(read_write image1d_array_t image_array);
6365 size_t __ovld __cnfn get_image_array_size(read_write image2d_array_t image_array);
6366 #ifdef cl_khr_depth_images
6367@@ -15205,6 +17256,7 @@ size_t __ovld __cnfn get_image_array_size(read_write image2d_array_depth_t image
6368 size_t __ovld __cnfn get_image_array_size(read_write image2d_array_msaa_t image_array);
6369 size_t __ovld __cnfn get_image_array_size(read_write image2d_array_msaa_depth_t image_array);
6370 #endif //cl_khr_gl_msaa_sharing
6371+#endif //__opencl_c_read_write_images
6372 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6373
6374 /**
6375@@ -15222,16 +17274,21 @@ int __ovld get_image_num_samples(write_only image2d_array_msaa_t image);
6376 int __ovld get_image_num_samples(write_only image2d_array_msaa_depth_t image);
6377
6378 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6379+#ifdef __opencl_c_read_write_images
6380 int __ovld get_image_num_samples(read_write image2d_msaa_t image);
6381 int __ovld get_image_num_samples(read_write image2d_msaa_depth_t image);
6382 int __ovld get_image_num_samples(read_write image2d_array_msaa_t image);
6383 int __ovld get_image_num_samples(read_write image2d_array_msaa_depth_t image);
6384+#endif //__opencl_c_read_write_images
6385 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6386 #endif
6387
6388+#endif //__opencl_c_images
6389+
6390 // OpenCL v2.0 s6.13.15 - Work-group Functions
6391
6392 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6393+#ifdef __opencl_c_work_group_collective_functions
6394 int __ovld __conv work_group_all(int predicate);
6395 int __ovld __conv work_group_any(int predicate);
6396
6397@@ -15255,11 +17312,11 @@ ulong __ovld __conv work_group_broadcast(ulong a, size_t x, size_t y, size_t z);
6398 float __ovld __conv work_group_broadcast(float a, size_t local_id);
6399 float __ovld __conv work_group_broadcast(float a, size_t x, size_t y);
6400 float __ovld __conv work_group_broadcast(float a, size_t x, size_t y, size_t z);
6401-#ifdef cl_khr_fp64
6402+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6403 double __ovld __conv work_group_broadcast(double a, size_t local_id);
6404 double __ovld __conv work_group_broadcast(double a, size_t x, size_t y);
6405 double __ovld __conv work_group_broadcast(double a, size_t x, size_t y, size_t z);
6406-#endif //cl_khr_fp64
6407+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6408
6409 #ifdef cl_khr_fp16
6410 half __ovld __conv work_group_reduce_add(half x);
6411@@ -15317,7 +17374,7 @@ float __ovld __conv work_group_scan_exclusive_max(float x);
6412 float __ovld __conv work_group_scan_inclusive_add(float x);
6413 float __ovld __conv work_group_scan_inclusive_min(float x);
6414 float __ovld __conv work_group_scan_inclusive_max(float x);
6415-#ifdef cl_khr_fp64
6416+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6417 double __ovld __conv work_group_reduce_add(double x);
6418 double __ovld __conv work_group_reduce_min(double x);
6419 double __ovld __conv work_group_reduce_max(double x);
6420@@ -15327,19 +17384,18 @@ double __ovld __conv work_group_scan_exclusive_max(double x);
6421 double __ovld __conv work_group_scan_inclusive_add(double x);
6422 double __ovld __conv work_group_scan_inclusive_min(double x);
6423 double __ovld __conv work_group_scan_inclusive_max(double x);
6424-#endif //cl_khr_fp64
6425-
6426+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6427+#endif //__opencl_c_work_group_collective_functions
6428 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6429
6430 // OpenCL v2.0 s6.13.16 - Pipe Functions
6431-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6432+#ifdef __opencl_c_pipes
6433 bool __ovld is_valid_reserve_id(reserve_id_t reserve_id);
6434-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6435-
6436+#endif //__opencl_c_pipes
6437
6438 // OpenCL v2.0 s6.13.17 - Enqueue Kernels
6439 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6440-
6441+#ifdef __opencl_c_device_enqueue
6442 ndrange_t __ovld ndrange_1D(size_t);
6443 ndrange_t __ovld ndrange_1D(size_t, size_t);
6444 ndrange_t __ovld ndrange_1D(size_t, size_t, size_t);
6445@@ -15367,11 +17423,13 @@ bool __ovld is_valid_event (clk_event_t event);
6446 void __ovld capture_event_profiling_info(clk_event_t, clk_profiling_info, __global void* value);
6447
6448 queue_t __ovld get_default_queue(void);
6449+#endif //__opencl_c_device_enqueue
6450 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6451
6452 // OpenCL Extension v2.0 s9.17 - Sub-groups
6453
6454-#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups)
6455+#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups) || \
6456+ defined(__opencl_c_subgroups)
6457 // Shared Sub Group Functions
6458 uint __ovld get_sub_group_size(void);
6459 uint __ovld get_max_sub_group_size(void);
6460@@ -15457,7 +17515,7 @@ half __ovld __conv sub_group_scan_inclusive_min(half x);
6461 half __ovld __conv sub_group_scan_inclusive_max(half x);
6462 #endif //cl_khr_fp16
6463
6464-#ifdef cl_khr_fp64
6465+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6466 double __ovld __conv sub_group_broadcast(double x, uint sub_group_local_id);
6467 double __ovld __conv sub_group_reduce_add(double x);
6468 double __ovld __conv sub_group_reduce_min(double x);
6469@@ -15468,7 +17526,7 @@ double __ovld __conv sub_group_scan_exclusive_max(double x);
6470 double __ovld __conv sub_group_scan_inclusive_add(double x);
6471 double __ovld __conv sub_group_scan_inclusive_min(double x);
6472 double __ovld __conv sub_group_scan_inclusive_max(double x);
6473-#endif //cl_khr_fp64
6474+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6475
6476 #endif //cl_khr_subgroups cl_intel_subgroups
6477
6478@@ -15570,16 +17628,22 @@ uint16 __ovld __conv intel_sub_group_shuffle_xor( uint16 x, uint c );
6479 long __ovld __conv intel_sub_group_shuffle_xor( long x, uint c );
6480 ulong __ovld __conv intel_sub_group_shuffle_xor( ulong x, uint c );
6481
6482+#ifdef __opencl_c_images
6483 uint __ovld __conv intel_sub_group_block_read( read_only image2d_t image, int2 coord );
6484 uint2 __ovld __conv intel_sub_group_block_read2( read_only image2d_t image, int2 coord );
6485 uint4 __ovld __conv intel_sub_group_block_read4( read_only image2d_t image, int2 coord );
6486 uint8 __ovld __conv intel_sub_group_block_read8( read_only image2d_t image, int2 coord );
6487+#endif //__opencl_c_images
6488
6489 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6490+#ifdef __opencl_c_images
6491+#ifdef __opencl_c_read_write_images
6492 uint __ovld __conv intel_sub_group_block_read(read_write image2d_t image, int2 coord);
6493 uint2 __ovld __conv intel_sub_group_block_read2(read_write image2d_t image, int2 coord);
6494 uint4 __ovld __conv intel_sub_group_block_read4(read_write image2d_t image, int2 coord);
6495 uint8 __ovld __conv intel_sub_group_block_read8(read_write image2d_t image, int2 coord);
6496+#endif //__opencl_c_read_write_images
6497+#endif //__opencl_c_images
6498 #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6499
6500 uint __ovld __conv intel_sub_group_block_read( const __global uint* p );
6501@@ -15587,16 +17651,22 @@ uint2 __ovld __conv intel_sub_group_block_read2( const __global uint* p );
6502 uint4 __ovld __conv intel_sub_group_block_read4( const __global uint* p );
6503 uint8 __ovld __conv intel_sub_group_block_read8( const __global uint* p );
6504
6505+#ifdef __opencl_c_images
6506 void __ovld __conv intel_sub_group_block_write(write_only image2d_t image, int2 coord, uint data);
6507 void __ovld __conv intel_sub_group_block_write2(write_only image2d_t image, int2 coord, uint2 data);
6508 void __ovld __conv intel_sub_group_block_write4(write_only image2d_t image, int2 coord, uint4 data);
6509 void __ovld __conv intel_sub_group_block_write8(write_only image2d_t image, int2 coord, uint8 data);
6510+#endif //__opencl_c_images
6511
6512 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6513+#ifdef __opencl_c_images
6514+#ifdef __opencl_c_read_write_images
6515 void __ovld __conv intel_sub_group_block_write(read_write image2d_t image, int2 coord, uint data);
6516 void __ovld __conv intel_sub_group_block_write2(read_write image2d_t image, int2 coord, uint2 data);
6517 void __ovld __conv intel_sub_group_block_write4(read_write image2d_t image, int2 coord, uint4 data);
6518 void __ovld __conv intel_sub_group_block_write8(read_write image2d_t image, int2 coord, uint8 data);
6519+#endif // __opencl_c_read_write_images
6520+#endif // __opencl_c_images
6521 #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6522
6523 void __ovld __conv intel_sub_group_block_write( __global uint* p, uint data );
6524@@ -15611,7 +17681,7 @@ half __ovld __conv intel_sub_group_shuffle_up( half prev, half cur, uint c );
6525 half __ovld __conv intel_sub_group_shuffle_xor( half x, uint c );
6526 #endif
6527
6528-#if defined(cl_khr_fp64)
6529+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6530 double __ovld __conv intel_sub_group_shuffle( double x, uint c );
6531 double __ovld __conv intel_sub_group_shuffle_down( double prev, double cur, uint c );
6532 double __ovld __conv intel_sub_group_shuffle_up( double prev, double cur, uint c );
6533@@ -15710,16 +17780,22 @@ ushort __ovld __conv intel_sub_group_scan_inclusive_min( ushort x );
6534 short __ovld __conv intel_sub_group_scan_inclusive_max( short x );
6535 ushort __ovld __conv intel_sub_group_scan_inclusive_max( ushort x );
6536
6537+#ifdef __opencl_c_images
6538 uint __ovld __conv intel_sub_group_block_read_ui( read_only image2d_t image, int2 byte_coord );
6539 uint2 __ovld __conv intel_sub_group_block_read_ui2( read_only image2d_t image, int2 byte_coord );
6540 uint4 __ovld __conv intel_sub_group_block_read_ui4( read_only image2d_t image, int2 byte_coord );
6541 uint8 __ovld __conv intel_sub_group_block_read_ui8( read_only image2d_t image, int2 byte_coord );
6542+#endif //__opencl_c_images
6543
6544 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6545+#ifdef __opencl_c_images
6546+#ifdef __opencl_c_read_write_images
6547 uint __ovld __conv intel_sub_group_block_read_ui( read_write image2d_t image, int2 byte_coord );
6548 uint2 __ovld __conv intel_sub_group_block_read_ui2( read_write image2d_t image, int2 byte_coord );
6549 uint4 __ovld __conv intel_sub_group_block_read_ui4( read_write image2d_t image, int2 byte_coord );
6550 uint8 __ovld __conv intel_sub_group_block_read_ui8( read_write image2d_t image, int2 byte_coord );
6551+#endif //__opencl_c_read_write_images
6552+#endif //__opencl_c_images
6553 #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6554
6555 uint __ovld __conv intel_sub_group_block_read_ui( const __global uint* p );
6556@@ -15727,16 +17803,22 @@ uint2 __ovld __conv intel_sub_group_block_read_ui2( const __global uint* p
6557 uint4 __ovld __conv intel_sub_group_block_read_ui4( const __global uint* p );
6558 uint8 __ovld __conv intel_sub_group_block_read_ui8( const __global uint* p );
6559
6560+#ifdef __opencl_c_images
6561 void __ovld __conv intel_sub_group_block_write_ui( read_only image2d_t image, int2 byte_coord, uint data );
6562 void __ovld __conv intel_sub_group_block_write_ui2( read_only image2d_t image, int2 byte_coord, uint2 data );
6563 void __ovld __conv intel_sub_group_block_write_ui4( read_only image2d_t image, int2 byte_coord, uint4 data );
6564 void __ovld __conv intel_sub_group_block_write_ui8( read_only image2d_t image, int2 byte_coord, uint8 data );
6565+#endif //__opencl_c_images
6566
6567 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6568+#ifdef __opencl_c_images
6569+#ifdef __opencl_c_read_write_images
6570 void __ovld __conv intel_sub_group_block_write_ui( read_write image2d_t image, int2 byte_coord, uint data );
6571 void __ovld __conv intel_sub_group_block_write_ui2( read_write image2d_t image, int2 byte_coord, uint2 data );
6572 void __ovld __conv intel_sub_group_block_write_ui4( read_write image2d_t image, int2 byte_coord, uint4 data );
6573 void __ovld __conv intel_sub_group_block_write_ui8( read_write image2d_t image, int2 byte_coord, uint8 data );
6574+#endif //__opencl_c_read_write_images
6575+#endif //__opencl_c_images
6576 #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6577
6578 void __ovld __conv intel_sub_group_block_write_ui( __global uint* p, uint data );
6579@@ -15744,16 +17826,22 @@ void __ovld __conv intel_sub_group_block_write_ui2( __global uint* p, uint
6580 void __ovld __conv intel_sub_group_block_write_ui4( __global uint* p, uint4 data );
6581 void __ovld __conv intel_sub_group_block_write_ui8( __global uint* p, uint8 data );
6582
6583+#ifdef __opencl_c_images
6584 ushort __ovld __conv intel_sub_group_block_read_us( read_only image2d_t image, int2 coord );
6585 ushort2 __ovld __conv intel_sub_group_block_read_us2( read_only image2d_t image, int2 coord );
6586 ushort4 __ovld __conv intel_sub_group_block_read_us4( read_only image2d_t image, int2 coord );
6587 ushort8 __ovld __conv intel_sub_group_block_read_us8( read_only image2d_t image, int2 coord );
6588+#endif //__opencl_c_images
6589
6590 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6591+#ifdef __opencl_c_images
6592+#ifdef __opencl_c_read_write_images
6593 ushort __ovld __conv intel_sub_group_block_read_us(read_write image2d_t image, int2 coord);
6594 ushort2 __ovld __conv intel_sub_group_block_read_us2(read_write image2d_t image, int2 coord);
6595 ushort4 __ovld __conv intel_sub_group_block_read_us4(read_write image2d_t image, int2 coord);
6596 ushort8 __ovld __conv intel_sub_group_block_read_us8(read_write image2d_t image, int2 coord);
6597+#endif //__opencl_c_read_write_images
6598+#endif //__opencl_c_images
6599 #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6600
6601 ushort __ovld __conv intel_sub_group_block_read_us( const __global ushort* p );
6602@@ -15761,16 +17849,22 @@ ushort2 __ovld __conv intel_sub_group_block_read_us2( const __global ushort*
6603 ushort4 __ovld __conv intel_sub_group_block_read_us4( const __global ushort* p );
6604 ushort8 __ovld __conv intel_sub_group_block_read_us8( const __global ushort* p );
6605
6606+#ifdef __opencl_c_images
6607 void __ovld __conv intel_sub_group_block_write_us(write_only image2d_t image, int2 coord, ushort data);
6608 void __ovld __conv intel_sub_group_block_write_us2(write_only image2d_t image, int2 coord, ushort2 data);
6609 void __ovld __conv intel_sub_group_block_write_us4(write_only image2d_t image, int2 coord, ushort4 data);
6610 void __ovld __conv intel_sub_group_block_write_us8(write_only image2d_t image, int2 coord, ushort8 data);
6611+#endif //__opencl_c_images
6612
6613 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6614+#ifdef __opencl_c_images
6615+#ifdef __opencl_c_read_write_images
6616 void __ovld __conv intel_sub_group_block_write_us(read_write image2d_t image, int2 coord, ushort data);
6617 void __ovld __conv intel_sub_group_block_write_us2(read_write image2d_t image, int2 coord, ushort2 data);
6618 void __ovld __conv intel_sub_group_block_write_us4(read_write image2d_t image, int2 coord, ushort4 data);
6619 void __ovld __conv intel_sub_group_block_write_us8(read_write image2d_t image, int2 coord, ushort8 data);
6620+#endif //__opencl_c_read_write_images
6621+#endif //__opencl_c_images
6622 #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6623
6624 void __ovld __conv intel_sub_group_block_write_us( __global ushort* p, ushort data );
6625@@ -15889,6 +17983,7 @@ short2 __ovld intel_sub_group_avc_ime_adjust_ref_offset(
6626 short2 ref_offset, ushort2 src_coord, ushort2 ref_window_size,
6627 ushort2 image_size);
6628
6629+#ifdef __opencl_c_images
6630 intel_sub_group_avc_ime_result_t __ovld
6631 intel_sub_group_avc_ime_evaluate_with_single_reference(
6632 read_only image2d_t src_image, read_only image2d_t ref_image,
6633@@ -15929,6 +18024,7 @@ intel_sub_group_avc_ime_evaluate_with_dual_reference_streaminout(
6634 read_only image2d_t bwd_ref_image, sampler_t vme_media_sampler,
6635 intel_sub_group_avc_ime_payload_t payload,
6636 intel_sub_group_avc_ime_dual_reference_streamin_t streamin_components);
6637+#endif //__opencl_c_images
6638
6639 intel_sub_group_avc_ime_single_reference_streamin_t __ovld
6640 intel_sub_group_avc_ime_get_single_reference_streamin(
6641@@ -15993,6 +18089,7 @@ intel_sub_group_avc_ref_payload_t __ovld
6642 intel_sub_group_avc_ref_set_bilinear_filter_enable(
6643 intel_sub_group_avc_ref_payload_t payload);
6644
6645+#ifdef __opencl_c_images
6646 intel_sub_group_avc_ref_result_t __ovld
6647 intel_sub_group_avc_ref_evaluate_with_single_reference(
6648 read_only image2d_t src_image, read_only image2d_t ref_image,
6649@@ -16011,6 +18108,7 @@ intel_sub_group_avc_ref_evaluate_with_multi_reference(
6650 read_only image2d_t src_image, uint packed_reference_ids,
6651 uchar packed_reference_field_polarities, sampler_t vme_media_sampler,
6652 intel_sub_group_avc_ref_payload_t payload);
6653+#endif //__opencl_c_images
6654
6655 // SIC built-in functions
6656 intel_sub_group_avc_sic_payload_t __ovld
6657@@ -16061,6 +18159,7 @@ intel_sub_group_avc_sic_set_block_based_raw_skip_sad(
6658 uchar block_based_skip_type,
6659 intel_sub_group_avc_sic_payload_t payload);
6660
6661+#ifdef __opencl_c_images
6662 intel_sub_group_avc_sic_result_t __ovld
6663 intel_sub_group_avc_sic_evaluate_ipe(
6664 read_only image2d_t src_image, sampler_t vme_media_sampler,
6665@@ -16083,6 +18182,7 @@ intel_sub_group_avc_sic_evaluate_with_multi_reference(
6666 read_only image2d_t src_image, uint packed_reference_ids,
6667 uchar packed_reference_field_polarities, sampler_t vme_media_sampler,
6668 intel_sub_group_avc_sic_payload_t payload);
6669+#endif //__opencl_c_images
6670
6671 uchar __ovld intel_sub_group_avc_sic_get_ipe_luma_shape(
6672 intel_sub_group_avc_sic_result_t result);
6673diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
6674index 6353e14bc41a..a8c216de6e04 100644
6675--- a/clang/lib/Parse/ParseDecl.cpp
6676+++ b/clang/lib/Parse/ParseDecl.cpp
6677@@ -3904,8 +3904,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
6678 isInvalid = DS.SetTypeAltiVecBool(true, Loc, PrevSpec, DiagID, Policy);
6679 break;
6680 case tok::kw_pipe:
6681- if (!getLangOpts().OpenCL || (getLangOpts().OpenCLVersion < 200 &&
6682- !getLangOpts().OpenCLCPlusPlus)) {
6683+ if (!getLangOpts().OpenCLPipeKeyword) {
6684 // OpenCL 2.0 defined this keyword. OpenCL 1.2 and earlier should
6685 // support the "pipe" word as identifier.
6686 Tok.getIdentifierInfo()->revertTokenIDToIdentifier();
6687@@ -4027,8 +4026,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
6688 case tok::kw___generic:
6689 // generic address space is introduced only in OpenCL v2.0
6690 // see OpenCL C Spec v2.0 s6.5.5
6691- if (Actions.getLangOpts().OpenCLVersion < 200 &&
6692- !Actions.getLangOpts().OpenCLCPlusPlus) {
6693+ if (!Actions.getLangOpts().OpenCLGenericKeyword) {
6694 DiagID = diag::err_opencl_unknown_type_specifier;
6695 PrevSpec = Tok.getIdentifierInfo()->getNameStart();
6696 isInvalid = true;
6697@@ -5050,8 +5048,7 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) {
6698 default: return false;
6699
6700 case tok::kw_pipe:
6701- return (getLangOpts().OpenCL && getLangOpts().OpenCLVersion >= 200) ||
6702- getLangOpts().OpenCLCPlusPlus;
6703+ return getLangOpts().OpenCLPipeKeyword;
6704
6705 case tok::identifier: // foo::bar
6706 // Unfortunate hack to support "Class.factoryMethod" notation.
6707@@ -5557,8 +5554,7 @@ static bool isPtrOperatorToken(tok::TokenKind Kind, const LangOptions &Lang,
6708 if (Kind == tok::star || Kind == tok::caret)
6709 return true;
6710
6711- if (Kind == tok::kw_pipe &&
6712- ((Lang.OpenCL && Lang.OpenCLVersion >= 200) || Lang.OpenCLCPlusPlus))
6713+ if (Kind == tok::kw_pipe && Lang.OpenCLPipeKeyword)
6714 return true;
6715
6716 if (!Lang.CPlusPlus)
6717diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp
6718index df411e1928d6..9a40ce888695 100644
6719--- a/clang/lib/Parse/ParsePragma.cpp
6720+++ b/clang/lib/Parse/ParsePragma.cpp
6721@@ -697,12 +697,14 @@ void Parser::HandlePragmaOpenCLExtension() {
6722 if (Name == "all") {
6723 if (State == Disable) {
6724 Opt.disableAll();
6725- Opt.enableSupportedCore(getLangOpts());
6726+ Opt.enableSupportedCore();
6727 } else {
6728 PP.Diag(NameLoc, diag::warn_pragma_expected_predicate) << 1;
6729 }
6730+ } else if (Opt.isFeature(Name)) {
6731+ PP.Diag(NameLoc, diag::warn_opencl_pragma_feature_ignore) << Ident;
6732 } else if (State == Begin) {
6733- if (!Opt.isKnown(Name) || !Opt.isSupported(Name, getLangOpts())) {
6734+ if (!Opt.isKnown(Name) || !Opt.isSupported(Name)) {
6735 Opt.support(Name);
6736 }
6737 Actions.setCurrentOpenCLExtension(Name);
6738@@ -712,9 +714,9 @@ void Parser::HandlePragmaOpenCLExtension() {
6739 Actions.setCurrentOpenCLExtension("");
6740 } else if (!Opt.isKnown(Name))
6741 PP.Diag(NameLoc, diag::warn_pragma_unknown_extension) << Ident;
6742- else if (Opt.isSupportedExtension(Name, getLangOpts()))
6743+ else if (Opt.isSupportedExtension(Name))
6744 Opt.enable(Name, State == Enable);
6745- else if (Opt.isSupportedCore(Name, getLangOpts()))
6746+ else if (Opt.isSupportedCore(Name))
6747 PP.Diag(NameLoc, diag::warn_pragma_extension_is_core) << Ident;
6748 else
6749 PP.Diag(NameLoc, diag::warn_pragma_unsupported_extension) << Ident;
6750diff --git a/clang/lib/Sema/OpenCLBuiltins.td b/clang/lib/Sema/OpenCLBuiltins.td
6751index 9d6bb411eff8..d352d35f1e46 100644
6752--- a/clang/lib/Sema/OpenCLBuiltins.td
6753+++ b/clang/lib/Sema/OpenCLBuiltins.td
6754@@ -22,11 +22,13 @@
6755 class Version<int _Version> {
6756 int ID = _Version;
6757 }
6758+
6759 def CLAll : Version< 0>;
6760 def CL10 : Version<100>;
6761 def CL11 : Version<110>;
6762 def CL12 : Version<120>;
6763 def CL20 : Version<200>;
6764+def CL30 : Version<300>;
6765
6766 // Address spaces
6767 // Pointer types need to be assigned an address space.
6768@@ -65,6 +67,14 @@ def FuncExtKhrGlMsaaSharing : FunctionExtension<"cl_khr_gl_msaa_sha
6769 // Multiple extensions
6770 def FuncExtKhrMipmapAndWrite3d : FunctionExtension<"cl_khr_mipmap_image cl_khr_3d_image_writes">;
6771
6772+// Features
6773+def FuncExtGenericAddressSpace : FunctionExtension<"__opencl_c_generic_address_space">;
6774+def FuncExtWorkGroupCollective : FunctionExtension<"__opencl_c_work_group_collective_functions">;
6775+def FuncExtPipes : FunctionExtension<"__opencl_c_pipes">;
6776+def FuncExtDeviceSidEenqueue : FunctionExtension<"__opencl_c_device_enqueue">;
6777+def FuncNonExplicitAtomicFeatures : FunctionExtension<"__opencl_c_atomic_order_seq_cst __opencl_c_atomic_scope_device">;
6778+def FuncNonExplicitAtomicFeaturesAndGenericAS : FunctionExtension<"__opencl_c_atomic_order_seq_cst __opencl_c_atomic_scope_device __opencl_c_generic_address_space">;
6779+
6780 // Qualified Type. These map to ASTContext::QualType.
6781 class QualType<string _Name, bit _IsAbstract=0> {
6782 // Name of the field or function in a clang::ASTContext
6783@@ -230,13 +240,9 @@ class Builtin<string _Name, list<Type> _Signature, list<bit> _Attributes = Attr.
6784 bit IsConv = _Attributes[2];
6785 // OpenCL extensions to which the function belongs.
6786 FunctionExtension Extension = FuncExtNone;
6787- // Version of OpenCL from which the function is available (e.g.: CL10).
6788- // MinVersion is inclusive.
6789- Version MinVersion = CL10;
6790- // Version of OpenCL from which the function is not supported anymore.
6791- // MaxVersion is exclusive.
6792+ // List of OpenCL version in which this function available.
6793 // CLAll makes the function available for all versions.
6794- Version MaxVersion = CLAll;
6795+ list<Version> Versions = [CLAll];
6796 }
6797
6798 //===----------------------------------------------------------------------===//
6799@@ -398,7 +404,7 @@ foreach name = ["get_global_size", "get_global_id", "get_local_size",
6800 def : Builtin<name, [Size, UInt], Attr.Const>;
6801 }
6802
6803-let MinVersion = CL20 in {
6804+let Versions = [CL20, CL30] in {
6805 def : Builtin<"get_enqueued_local_size", [Size, UInt]>;
6806 foreach name = ["get_global_linear_id", "get_local_linear_id"] in {
6807 def : Builtin<name, [Size]>;
6808@@ -471,7 +477,7 @@ foreach name = ["fma", "mad"] in {
6809 }
6810
6811 // --- Version dependent ---
6812-let MaxVersion = CL20 in {
6813+let Versions = [CL10, CL11, CL12, CL30] in {
6814 foreach AS = [GlobalAS, LocalAS, PrivateAS] in {
6815 foreach name = ["fract", "modf", "sincos"] in {
6816 def : Builtin<name, [FGenTypeN, FGenTypeN, PointerType<FGenTypeN, AS>]>;
6817@@ -488,7 +494,9 @@ let MaxVersion = CL20 in {
6818 }
6819 }
6820 }
6821-let MinVersion = CL20 in {
6822+
6823+let Versions = [CL20, CL30] in {
6824+ let Extension = FuncExtGenericAddressSpace in {
6825 foreach name = ["fract", "modf", "sincos"] in {
6826 def : Builtin<name, [FGenTypeN, FGenTypeN, PointerType<FGenTypeN, GenericAS>]>;
6827 }
6828@@ -501,6 +509,7 @@ let MinVersion = CL20 in {
6829 def : Builtin<name, [Type, Type, Type, PointerType<GenTypeIntVecAndScalar, GenericAS>]>;
6830 }
6831 }
6832+ }
6833 }
6834
6835 // --- Table 9 ---
6836@@ -531,7 +540,7 @@ foreach name = ["abs"] in {
6837 foreach name = ["clz", "popcount"] in {
6838 def : Builtin<name, [AIGenTypeN, AIGenTypeN], Attr.Const>;
6839 }
6840-let MinVersion = CL20 in {
6841+let Versions = [CL20, CL30] in {
6842 foreach name = ["ctz"] in {
6843 def : Builtin<name, [AIGenTypeN, AIGenTypeN]>;
6844 }
6845@@ -705,7 +714,7 @@ foreach name = ["select"] in {
6846 // --- Table 15 ---
6847 // Variants for OpenCL versions below 2.0, using pointers to the global, local
6848 // and private address spaces.
6849-let MaxVersion = CL20 in {
6850+let Versions = [CL10, CL11, CL12, CL30] in {
6851 foreach AS = [GlobalAS, LocalAS, PrivateAS] in {
6852 foreach VSize = [2, 3, 4, 8, 16] in {
6853 foreach name = ["vload" # VSize] in {
6854@@ -748,7 +757,8 @@ let MaxVersion = CL20 in {
6855 }
6856 // Variants for OpenCL versions above 2.0, using pointers to the generic
6857 // address space.
6858-let MinVersion = CL20 in {
6859+let Versions = [CL20, CL30] in {
6860+ let Extension = FuncExtGenericAddressSpace in {
6861 foreach VSize = [2, 3, 4, 8, 16] in {
6862 foreach name = ["vload" # VSize] in {
6863 def : Builtin<name, [VectorType<Char, VSize>, Size, PointerType<ConstType<Char>, GenericAS>]>;
6864@@ -786,6 +796,7 @@ let MinVersion = CL20 in {
6865 }
6866 }
6867 }
6868+ }
6869 }
6870 // Variants using pointers to the constant address space.
6871 foreach VSize = [2, 3, 4, 8, 16] in {
6872@@ -812,7 +823,7 @@ foreach VSize = [2, 3, 4, 8, 16] in {
6873 }
6874 }
6875 }
6876-let MaxVersion = CL20 in {
6877+let Versions = [CL10, CL11, CL12, CL30] in {
6878 foreach AS = [GlobalAS, LocalAS, PrivateAS] in {
6879 def : Builtin<"vload_half", [Float, Size, PointerType<ConstType<Half>, AS>]>;
6880 foreach VSize = [2, 3, 4, 8, 16] in {
6881@@ -832,7 +843,8 @@ let MaxVersion = CL20 in {
6882 }
6883 }
6884 }
6885-let MinVersion = CL20 in {
6886+let Versions = [CL20, CL30] in {
6887+ let Extension = FuncExtGenericAddressSpace in {
6888 foreach AS = [GenericAS] in {
6889 def : Builtin<"vload_half", [Float, Size, PointerType<ConstType<Half>, AS>]>;
6890 foreach VSize = [2, 3, 4, 8, 16] in {
6891@@ -851,6 +863,7 @@ let MinVersion = CL20 in {
6892 }
6893 }
6894 }
6895+ }
6896 }
6897
6898 foreach AS = [ConstantAS] in {
6899@@ -875,7 +888,9 @@ foreach name = ["async_work_group_strided_copy"] in {
6900 def : Builtin<name, [Event, PointerType<AGenTypeN, GlobalAS>, PointerType<ConstType<AGenTypeN>, LocalAS>, Size, Size, Event]>;
6901 }
6902 foreach name = ["wait_group_events"] in {
6903+ let Extension = FuncExtGenericAddressSpace in {
6904 def : Builtin<name, [Void, Int, PointerType<Event, GenericAS>]>;
6905+ }
6906 }
6907 foreach name = ["prefetch"] in {
6908 def : Builtin<name, [Void, PointerType<ConstType<AGenTypeN>, GlobalAS>, Size]>;
6909@@ -1154,7 +1169,8 @@ foreach aQual = ["WO", "RW"] in {
6910 //--------------------------------------------------------------------
6911 // OpenCL v2.0 s6.13.15 - Work-group Functions
6912 // --- Table 26 ---
6913-let MinVersion = CL20 in {
6914+let Versions = [CL20, CL30] in {
6915+ let Extension = FuncExtWorkGroupCollective in {
6916 foreach name = ["work_group_all", "work_group_any"] in {
6917 def : Builtin<name, [Int, Int], Attr.Convergent>;
6918 }
6919@@ -1169,11 +1185,12 @@ let MinVersion = CL20 in {
6920 def : Builtin<name # op, [IntLongFloatGenType1, IntLongFloatGenType1], Attr.Convergent>;
6921 }
6922 }
6923+ }
6924 }
6925
6926
6927 // OpenCL v2.0 s9.17.3: Additions to section 6.13.1: Work-Item Functions
6928-let MinVersion = CL20 in {
6929+let Versions = [CL20] in {
6930 let Extension = FuncExtKhrSubgroups in {
6931 def get_sub_group_size : Builtin<"get_sub_group_size", [UInt]>;
6932 def get_max_sub_group_size : Builtin<"get_max_sub_group_size", [UInt]>;
6933diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
6934index 9cfce5a63b1d..c26f45f62668 100644
6935--- a/clang/lib/Sema/Sema.cpp
6936+++ b/clang/lib/Sema/Sema.cpp
6937@@ -286,9 +286,10 @@ void Sema::Initialize() {
6938 // Initialize predefined OpenCL types and supported extensions and (optional)
6939 // core features.
6940 if (getLangOpts().OpenCL) {
6941+ getOpenCLOptions().setOpenCLVersion(getLangOpts());
6942 getOpenCLOptions().addSupport(
6943 Context.getTargetInfo().getSupportedOpenCLOpts());
6944- getOpenCLOptions().enableSupportedCore(getLangOpts());
6945+ getOpenCLOptions().enableSupportedCore();
6946 addImplicitTypedef("sampler_t", Context.OCLSamplerTy);
6947 addImplicitTypedef("event_t", Context.OCLEventTy);
6948 if (getLangOpts().OpenCLCPlusPlus || getLangOpts().OpenCLVersion >= 200) {
6949@@ -344,12 +345,18 @@ void Sema::Initialize() {
6950 "cl_khr_int64_base_atomics cl_khr_int64_extended_atomics");
6951
6952 setOpenCLExtensionForType(AtomicDoubleT, "cl_khr_fp64");
6953+ setOpenCLExtensionForType(Context.OCLReserveIDTy, "__opencl_c_pipes");
6954+ setOpenCLExtensionForType(Context.OCLClkEventTy,
6955+ "__opencl_c_device_enqueue");
6956+ setOpenCLExtensionForType(Context.OCLQueueTy,
6957+ "__opencl_c_device_enqueue");
6958 }
6959
6960 setOpenCLExtensionForType(Context.DoubleTy, "cl_khr_fp64");
6961
6962-#define GENERIC_IMAGE_TYPE_EXT(Type, Id, Ext) \
6963- setOpenCLExtensionForType(Context.Id, Ext);
6964+#define GENERIC_IMAGE_TYPE_EXT(Type, Id, Ext) \
6965+ setOpenCLExtensionForType(Context.Id, Ext); \
6966+ setOpenCLExtensionForType(Context.Id, "__opencl_c_images");
6967 #include "clang/Basic/OpenCLImageTypes.def"
6968 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
6969 addImplicitTypedef(#ExtType, Context.Id##Ty); \
6970@@ -2293,6 +2300,27 @@ bool Sema::isOpenCLDisabledDecl(Decl *FD) {
6971 return false;
6972 }
6973
6974+template <typename DiagLocT, typename DiagInfoT>
6975+void Sema::DiagnoseOpenCLRequiresOption(llvm::StringRef OpenCLOptName,
6976+ DiagLocT DiagLoc, DiagInfoT DiagInfo,
6977+ unsigned Selector,
6978+ SourceRange SrcRange) {
6979+ const auto &LO = getLangOpts();
6980+ auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
6981+ // For versions higher that 3.0 diagnosing feature
6982+ if (CLVer >= 300) {
6983+ OpenCLOptName =
6984+ llvm::StringSwitch<llvm::StringRef>(OpenCLOptName)
6985+ .Case("cl_khr_3d_image_writes", "__opencl_c_3d_image_writes")
6986+ .Case("cl_khr_subgroups", "__opencl_c_subgroups")
6987+ .Case("cl_khr_fp64", "__opencl_c_fp64")
6988+ .Default(OpenCLOptName);
6989+ }
6990+
6991+ Diag(DiagLoc, diag::err_opencl_requires_extension)
6992+ << Selector << DiagInfo << OpenCLOptName << SrcRange;
6993+}
6994+
6995 template <typename T, typename DiagLocT, typename DiagInfoT, typename MapT>
6996 bool Sema::checkOpenCLDisabledTypeOrDecl(T D, DiagLocT DiagLoc,
6997 DiagInfoT DiagInfo, MapT &Map,
6998@@ -2304,8 +2332,7 @@ bool Sema::checkOpenCLDisabledTypeOrDecl(T D, DiagLocT DiagLoc,
6999 bool Disabled = false;
7000 for (auto &I : Loc->second) {
7001 if (I != CurrOpenCLExtension && !getOpenCLOptions().isEnabled(I)) {
7002- Diag(DiagLoc, diag::err_opencl_requires_extension) << Selector << DiagInfo
7003- << I << SrcRange;
7004+ DiagnoseOpenCLRequiresOption(I, DiagLoc, DiagInfo, Selector, SrcRange);
7005 Disabled = true;
7006 }
7007 }
7008@@ -2341,3 +2368,13 @@ bool Sema::checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E) {
7009 return checkOpenCLDisabledTypeOrDecl(&D, E.getBeginLoc(), FnName,
7010 OpenCLDeclExtMap, 1, D.getSourceRange());
7011 }
7012+
7013+bool Sema::checkOpenCLSubgroupExtForCallExpr(CallExpr *Call) {
7014+ if (!getOpenCLOptions().isEnabled("cl_khr_subgroups")) {
7015+ DiagnoseOpenCLRequiresOption("cl_khr_subgroups", Call->getBeginLoc(),
7016+ Call->getDirectCallee(), 1,
7017+ Call->getSourceRange());
7018+ return true;
7019+ }
7020+ return false;
7021+}
7022diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
7023index 74742023d1b3..efa3b6ab0eb6 100644
7024--- a/clang/lib/Sema/SemaChecking.cpp
7025+++ b/clang/lib/Sema/SemaChecking.cpp
7026@@ -597,20 +597,11 @@ static bool checkOpenCLBlockArgs(Sema &S, Expr *BlockArg) {
7027 return IllegalParams;
7028 }
7029
7030-static bool checkOpenCLSubgroupExt(Sema &S, CallExpr *Call) {
7031- if (!S.getOpenCLOptions().isEnabled("cl_khr_subgroups")) {
7032- S.Diag(Call->getBeginLoc(), diag::err_opencl_requires_extension)
7033- << 1 << Call->getDirectCallee() << "cl_khr_subgroups";
7034- return true;
7035- }
7036- return false;
7037-}
7038-
7039 static bool SemaOpenCLBuiltinNDRangeAndBlock(Sema &S, CallExpr *TheCall) {
7040 if (checkArgCount(S, TheCall, 2))
7041 return true;
7042
7043- if (checkOpenCLSubgroupExt(S, TheCall))
7044+ if (S.checkOpenCLSubgroupExtForCallExpr(TheCall))
7045 return true;
7046
7047 // First argument is an ndrange_t type.
7048@@ -1564,7 +1555,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
7049 break;
7050 case Builtin::BIsub_group_reserve_read_pipe:
7051 case Builtin::BIsub_group_reserve_write_pipe:
7052- if (checkOpenCLSubgroupExt(*this, TheCall) ||
7053+ if (checkOpenCLSubgroupExtForCallExpr(TheCall) ||
7054 SemaBuiltinReserveRWPipe(*this, TheCall))
7055 return ExprError();
7056 break;
7057@@ -1577,7 +1568,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
7058 break;
7059 case Builtin::BIsub_group_commit_read_pipe:
7060 case Builtin::BIsub_group_commit_write_pipe:
7061- if (checkOpenCLSubgroupExt(*this, TheCall) ||
7062+ if (checkOpenCLSubgroupExtForCallExpr(TheCall) ||
7063 SemaBuiltinCommitRWPipe(*this, TheCall))
7064 return ExprError();
7065 break;
7066@@ -4314,6 +4305,20 @@ DiagnoseCStringFormatDirectiveInCFAPI(Sema &S,
7067 }
7068 }
7069
7070+bool Sema::isSupportedOpenCLOMemoryOrdering(int64_t Ordering) const {
7071+ assert(llvm::isValidAtomicOrderingCABI(Ordering));
7072+ auto OrderingCABI = (llvm::AtomicOrderingCABI)Ordering;
7073+ switch (OrderingCABI) {
7074+ case llvm::AtomicOrderingCABI::acquire:
7075+ case llvm::AtomicOrderingCABI::release:
7076+ case llvm::AtomicOrderingCABI::acq_rel:
7077+ return OpenCLFeatures.isEnabled("__opencl_c_atomic_order_acq_rel");
7078+
7079+ default:
7080+ return true;
7081+ }
7082+}
7083+
7084 /// Determine whether the given type has a non-null nullability annotation.
7085 static bool isNonNullType(ASTContext &ctx, QualType type) {
7086 if (auto nullability = type->getNullability(ctx))
7087@@ -5067,10 +5072,17 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
7088 if (SubExprs.size() >= 2 && Form != Init) {
7089 llvm::APSInt Result(32);
7090 if (SubExprs[1]->isIntegerConstantExpr(Result, Context) &&
7091- !isValidOrderingForOp(Result.getSExtValue(), Op))
7092+ !isValidOrderingForOp(Result.getSExtValue(), Op)) {
7093 Diag(SubExprs[1]->getBeginLoc(),
7094 diag::warn_atomic_op_has_invalid_memory_order)
7095 << SubExprs[1]->getSourceRange();
7096+ } else if (IsOpenCL &&
7097+ !isSupportedOpenCLOMemoryOrdering(Result.getSExtValue())) {
7098+ Diag(SubExprs[1]->getBeginLoc(),
7099+ diag::err_opencl_memory_ordering_require_feat)
7100+ << SubExprs[1]->getSourceRange();
7101+ return ExprError();
7102+ }
7103 }
7104
7105 if (auto ScopeModel = AtomicExpr::getScopeModel(Op)) {
7106diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
7107index 64146f4a912f..c1e629b5dc76 100644
7108--- a/clang/lib/Sema/SemaDecl.cpp
7109+++ b/clang/lib/Sema/SemaDecl.cpp
7110@@ -6152,7 +6152,9 @@ void Sema::deduceOpenCLAddressSpace(ValueDecl *Decl) {
7111 if (Type->isSamplerT() || Type->isVoidType())
7112 return;
7113 LangAS ImplAS = LangAS::opencl_private;
7114- if ((getLangOpts().OpenCLCPlusPlus || getLangOpts().OpenCLVersion >= 200) &&
7115+ if ((getLangOpts().OpenCLCPlusPlus ||
7116+ getOpenCLOptions().isEnabled(
7117+ "__opencl_c_program_scope_global_variables")) &&
7118 Var->hasGlobalStorage())
7119 ImplAS = LangAS::opencl_global;
7120 // If the original type from a decayed type is an array type and that array
7121@@ -7682,6 +7684,10 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {
7122 // OpenCL C v2.0 s6.5.1 - Variables defined at program scope and static
7123 // variables inside a function can also be declared in the global
7124 // address space.
7125+ // OpenCL C v3.0 s5.5 - For OpenCL C 2.0, or with the
7126+ // __opencl_c_program_scope_global_variables feature macro, the
7127+ // address space for a variable at program scope or a static variable
7128+ // also be __global
7129 // C++ for OpenCL inherits rule from OpenCL C v2.0.
7130 // FIXME: Adding local AS in C++ for OpenCL might make sense.
7131 if (NewVD->isFileVarDecl() || NewVD->isStaticLocal() ||
7132@@ -7689,10 +7695,11 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {
7133 if (!T->isSamplerT() &&
7134 !(T.getAddressSpace() == LangAS::opencl_constant ||
7135 (T.getAddressSpace() == LangAS::opencl_global &&
7136- (getLangOpts().OpenCLVersion == 200 ||
7137- getLangOpts().OpenCLCPlusPlus)))) {
7138+ (OpenCLFeatures.isEnabled(
7139+ "__opencl_c_program_scope_global_variables"))))) {
7140 int Scope = NewVD->isStaticLocal() | NewVD->hasExternalStorage() << 1;
7141- if (getLangOpts().OpenCLVersion == 200 || getLangOpts().OpenCLCPlusPlus)
7142+ if (OpenCLFeatures.isEnabled(
7143+ "__opencl_c_program_scope_global_variables"))
7144 Diag(NewVD->getLocation(), diag::err_opencl_global_invalid_addr_space)
7145 << Scope << "global or constant";
7146 else
7147diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
7148index 849bc09063b3..c963b95b131a 100644
7149--- a/clang/lib/Sema/SemaDeclAttr.cpp
7150+++ b/clang/lib/Sema/SemaDeclAttr.cpp
7151@@ -6362,7 +6362,7 @@ static void handleInternalLinkageAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
7152 }
7153
7154 static void handleOpenCLNoSVMAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
7155- if (S.LangOpts.OpenCLVersion != 200)
7156+ if (S.LangOpts.OpenCLVersion < 200)
7157 S.Diag(AL.getLoc(), diag::err_attribute_requires_opencl_version)
7158 << AL << "2.0" << 0;
7159 else
7160@@ -6446,6 +6446,13 @@ static void handleOpenCLAccessAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
7161 << AL << PDecl->getType() << DeclTy->isImageType();
7162 D->setInvalidDecl(true);
7163 return;
7164+ } else if ((!S.getLangOpts().OpenCLCPlusPlus &&
7165+ S.getLangOpts().OpenCLVersion >= 200) &&
7166+ !S.getOpenCLOptions().isEnabled(
7167+ "__opencl_c_read_write_images")) {
7168+ S.Diag(AL.getLoc(), diag::err_opencl_requires_extension)
7169+ << 0 << PDecl->getType() << "__opencl_c_read_write_images";
7170+ return;
7171 }
7172 }
7173 }
7174diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
7175index 831e55046e80..4481a59b4517 100644
7176--- a/clang/lib/Sema/SemaDeclCXX.cpp
7177+++ b/clang/lib/Sema/SemaDeclCXX.cpp
7178@@ -14906,6 +14906,11 @@ CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl,
7179 if (auto *PtrTy = ResultType->getAs<PointerType>()) {
7180 ResultType = RemoveAddressSpaceFromPtr(SemaRef, PtrTy);
7181 }
7182+ if (CanQual<PointerType> ExpectedPtrTy =
7183+ ExpectedResultType->getAs<PointerType>()) {
7184+ ExpectedResultType = SemaRef.Context.getCanonicalType(
7185+ RemoveAddressSpaceFromPtr(SemaRef, ExpectedPtrTy->getTypePtr()));
7186+ }
7187 }
7188
7189 // Check that the result type is what we expect.
7190@@ -14939,6 +14944,11 @@ CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl,
7191 FnDecl->getParamDecl(0)->getType()->getAs<PointerType>()) {
7192 FirstParamType = RemoveAddressSpaceFromPtr(SemaRef, PtrTy);
7193 }
7194+ if (CanQual<PointerType> ExpectedPtrTy =
7195+ ExpectedFirstParamType->getAs<PointerType>()) {
7196+ ExpectedFirstParamType = SemaRef.Context.getCanonicalType(
7197+ RemoveAddressSpaceFromPtr(SemaRef, ExpectedPtrTy->getTypePtr()));
7198+ }
7199 }
7200 if (SemaRef.Context.getCanonicalType(FirstParamType).getUnqualifiedType() !=
7201 ExpectedFirstParamType)
7202diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
7203index 8d96404a5c27..8f21203b9508 100644
7204--- a/clang/lib/Sema/SemaLookup.cpp
7205+++ b/clang/lib/Sema/SemaLookup.cpp
7206@@ -771,19 +771,20 @@ static void InsertOCLBuiltinDeclarationsFromTable(Sema &S, LookupResult &LR,
7207 // as argument. Only meaningful for generic types, otherwise equals 1.
7208 unsigned GenTypeMaxCnt;
7209
7210+ ASTContext &Context = S.Context;
7211+
7212+ // Ignore this BIF if its version does not match the language options.
7213+ unsigned OpenCLVersion = Context.getLangOpts().OpenCLVersion;
7214+ if (Context.getLangOpts().OpenCLCPlusPlus)
7215+ OpenCLVersion = 200;
7216+
7217+ unsigned short VersionCode = OpenCLOptions::EncodeVersion(OpenCLVersion);
7218+
7219 for (unsigned SignatureIndex = 0; SignatureIndex < Len; SignatureIndex++) {
7220 const OpenCLBuiltinStruct &OpenCLBuiltin =
7221 BuiltinTable[FctIndex + SignatureIndex];
7222- ASTContext &Context = S.Context;
7223
7224- // Ignore this BIF if its version does not match the language options.
7225- unsigned OpenCLVersion = Context.getLangOpts().OpenCLVersion;
7226- if (Context.getLangOpts().OpenCLCPlusPlus)
7227- OpenCLVersion = 200;
7228- if (OpenCLVersion < OpenCLBuiltin.MinVersion)
7229- continue;
7230- if ((OpenCLBuiltin.MaxVersion != 0) &&
7231- (OpenCLVersion >= OpenCLBuiltin.MaxVersion))
7232+ if (!(OpenCLBuiltin.AllVersions & VersionCode))
7233 continue;
7234
7235 SmallVector<QualType, 1> RetTypes;
7236diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
7237index 93ddd047e09b..93211b801f8d 100644
7238--- a/clang/lib/Sema/SemaType.cpp
7239+++ b/clang/lib/Sema/SemaType.cpp
7240@@ -2016,7 +2016,7 @@ static QualType deduceOpenCLPointeeAddrSpace(Sema &S, QualType PointeeType) {
7241 !PointeeType.hasAddressSpace())
7242 PointeeType = S.getASTContext().getAddrSpaceQualType(
7243 PointeeType,
7244- S.getLangOpts().OpenCLCPlusPlus || S.getLangOpts().OpenCLVersion == 200
7245+ S.getOpenCLOptions().isEnabled("__opencl_c_generic_address_space")
7246 ? LangAS::opencl_generic
7247 : LangAS::opencl_private);
7248 return PointeeType;
7249@@ -5160,9 +5160,15 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
7250 }
7251
7252 case DeclaratorChunk::Pipe: {
7253- T = S.BuildReadPipeType(T, DeclType.Loc);
7254- processTypeAttrs(state, T, TAL_DeclSpec,
7255- D.getMutableDeclSpec().getAttributes());
7256+ if (S.getOpenCLOptions().isEnabled("__opencl_c_pipes")) {
7257+ T = S.BuildReadPipeType(T, DeclType.Loc);
7258+ processTypeAttrs(state, T, TAL_DeclSpec,
7259+ D.getMutableDeclSpec().getAttributes());
7260+ } else {
7261+ D.setInvalidType(true);
7262+ T = Context.IntTy;
7263+ S.Diag(D.getIdentifierLoc(), diag::err_opencl_pipes_require_feat);
7264+ }
7265 break;
7266 }
7267 }
7268diff --git a/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl b/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
7269index cdbf28bbcad8..0bedff5ef0f3 100644
7270--- a/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
7271+++ b/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
7272@@ -2,7 +2,8 @@
7273 // RUN: %clang_cc1 %s -emit-llvm -o - -O0 -triple amdgcn | FileCheck -enable-var-scope -check-prefixes=COM,AMDGCN %s
7274 // RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL2.0 -O0 -triple amdgcn | FileCheck -enable-var-scope -check-prefixes=COM,AMDGCN,AMDGCN20 %s
7275 // 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
7276-
7277+// 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
7278+// 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
7279 typedef int int2 __attribute__((ext_vector_type(2)));
7280
7281 typedef struct {
7282@@ -39,7 +40,7 @@ struct LargeStructTwoMember {
7283 int2 y[20];
7284 };
7285
7286-#if __OPENCL_C_VERSION__ >= 200
7287+#ifdef __opencl_c_program_scope_global_variables
7288 struct LargeStructOneMember g_s;
7289 #endif
7290
7291@@ -98,7 +99,7 @@ void FuncOneLargeMember(struct LargeStructOneMember u) {
7292 // AMDGCN20: %[[r0:.*]] = bitcast %struct.LargeStructOneMember addrspace(5)* %[[byval_temp]] to i8 addrspace(5)*
7293 // 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)
7294 // AMDGCN20: call void @FuncOneLargeMember(%struct.LargeStructOneMember addrspace(5)* byval(%struct.LargeStructOneMember) align 8 %[[byval_temp]])
7295-#if __OPENCL_C_VERSION__ >= 200
7296+#ifdef __opencl_c_program_scope_global_variables
7297 void test_indirect_arg_globl(void) {
7298 FuncOneLargeMember(g_s);
7299 }
7300diff --git a/clang/test/CodeGenOpenCL/address-spaces-conversions.cl b/clang/test/CodeGenOpenCL/address-spaces-conversions.cl
7301index 52feccc540bb..9ecffcca5ee9 100644
7302--- a/clang/test/CodeGenOpenCL/address-spaces-conversions.cl
7303+++ b/clang/test/CodeGenOpenCL/address-spaces-conversions.cl
7304@@ -1,5 +1,7 @@
7305 // RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -O0 -ffake-address-space-map -cl-std=CL2.0 -emit-llvm -o - | FileCheck %s
7306+// 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
7307 // RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -O0 -cl-std=CL2.0 -emit-llvm -o - | FileCheck --check-prefix=CHECK-NOFAKE %s
7308+// 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
7309 // When -ffake-address-space-map is not used, all addr space mapped to 0 for x86_64.
7310
7311 // test that we generate address space casts everywhere we need conversions of
7312diff --git a/clang/test/CodeGenOpenCL/address-spaces-mangling.cl b/clang/test/CodeGenOpenCL/address-spaces-mangling.cl
7313index 50622f099143..e19ec8451d0d 100644
7314--- a/clang/test/CodeGenOpenCL/address-spaces-mangling.cl
7315+++ b/clang/test/CodeGenOpenCL/address-spaces-mangling.cl
7316@@ -6,6 +6,7 @@
7317 // We check that the address spaces are mangled the same in both version of OpenCL
7318 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL2.0 -emit-llvm -o - | FileCheck -check-prefix=OCL-20 %s
7319 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -emit-llvm -o - | FileCheck -check-prefix=OCL-12 %s
7320+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL3.0 -emit-llvm -o - | FileCheck -check-prefix=OCL-12 %s
7321
7322 // We can't name this f as private is equivalent to default
7323 // no specifier given address space so we get multiple definition
7324@@ -47,7 +48,7 @@ void f(constant int *arg) { }
7325 // OCL-20-DAG: @_Z1fPU3AS2i
7326 // OCL-12-DAG: @_Z1fPU3AS2i
7327
7328-#if __OPENCL_C_VERSION__ >= 200
7329+#if __OPENCL_C_VERSION__ == 200
7330 __attribute__((overloadable))
7331 void f(generic int *arg) { }
7332 // ASMANG20: @_Z1fPU3AS4i
7333diff --git a/clang/test/CodeGenOpenCL/address-spaces.cl b/clang/test/CodeGenOpenCL/address-spaces.cl
7334index 3c8fea2a80bc..26a741338b3a 100644
7335--- a/clang/test/CodeGenOpenCL/address-spaces.cl
7336+++ b/clang/test/CodeGenOpenCL/address-spaces.cl
7337@@ -1,9 +1,13 @@
7338 // RUN: %clang_cc1 %s -O0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,SPIR
7339+// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,SPIR
7340 // RUN: %clang_cc1 %s -O0 -DCL20 -cl-std=CL2.0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CL20,CL20SPIR
7341 // RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
7342+// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -triple amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
7343 // RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -DCL20 -cl-std=CL2.0 -emit-llvm -o - | FileCheck %s --check-prefixes=CL20,CL20AMDGCN
7344 // RUN: %clang_cc1 %s -O0 -triple amdgcn-mesa-mesa3d -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
7345+// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -triple amdgcn-mesa-mesa3d -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
7346 // RUN: %clang_cc1 %s -O0 -triple r600-- -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
7347+// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -triple r600-- -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
7348
7349 // SPIR: %struct.S = type { i32, i32, i32* }
7350 // CL20SPIR: %struct.S = type { i32, i32, i32 addrspace(4)* }
7351diff --git a/clang/test/CodeGenOpenCL/amdgcn-automatic-variable.cl b/clang/test/CodeGenOpenCL/amdgcn-automatic-variable.cl
7352index 7216cb517495..8d3b30fe8074 100644
7353--- a/clang/test/CodeGenOpenCL/amdgcn-automatic-variable.cl
7354+++ b/clang/test/CodeGenOpenCL/amdgcn-automatic-variable.cl
7355@@ -1,4 +1,5 @@
7356 // RUN: %clang_cc1 -O0 -cl-std=CL1.2 -triple amdgcn---amdgizcl -emit-llvm %s -o - | FileCheck -check-prefixes=CHECK,CL12 %s
7357+// RUN: %clang_cc1 -O0 -cl-std=CL3.0 -triple amdgcn---amdgizcl -emit-llvm %s -o - | FileCheck -check-prefixes=CHECK,CL12 %s
7358 // RUN: %clang_cc1 -O0 -cl-std=CL2.0 -triple amdgcn---amdgizcl -emit-llvm %s -o - | FileCheck -check-prefixes=CHECK,CL20 %s
7359
7360 // CL12-LABEL: define void @func1(i32 addrspace(5)* %x)
7361diff --git a/clang/test/CodeGenOpenCL/amdgpu-sizeof-alignof.cl b/clang/test/CodeGenOpenCL/amdgpu-sizeof-alignof.cl
7362index a5d438933fa4..8073c7756eb6 100644
7363--- a/clang/test/CodeGenOpenCL/amdgpu-sizeof-alignof.cl
7364+++ b/clang/test/CodeGenOpenCL/amdgpu-sizeof-alignof.cl
7365@@ -4,6 +4,17 @@
7366 // RUN: %clang_cc1 -triple amdgcn---opencl -cl-std=CL2.0 %s -emit-llvm -o - | FileCheck %s
7367 // RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-std=CL1.2 %s -emit-llvm -o - | FileCheck %s
7368 // RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-std=CL2.0 %s -emit-llvm -o - | FileCheck %s
7369+// RUN: %clang_cc1 -triple r600 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7370+// RUN: %clang_cc1 -triple amdgcn-mesa-mesa3d -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7371+// RUN: %clang_cc1 -triple amdgcn---opencl -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7372+// RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7373+// RUN: %clang_cc1 -triple amdgcn-mesa-mesa3d -cl-ext=__opencl_c_generic_address_space -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7374+// RUN: %clang_cc1 -triple amdgcn---opencl -cl-ext=__opencl_c_generic_address_space -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7375+// RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-ext=__opencl_c_generic_address_space -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7376+// RUN: %clang_cc1 -triple r600 -cl-ext=__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7377+// RUN: %clang_cc1 -triple amdgcn-mesa-mesa3d -cl-ext=__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7378+// RUN: %clang_cc1 -triple amdgcn---opencl -cl-ext=__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7379+// RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-ext=__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7380
7381 #ifdef __AMDGCN__
7382 #define PTSIZE 8
7383@@ -11,7 +22,7 @@
7384 #define PTSIZE 4
7385 #endif
7386
7387-#ifdef cl_khr_fp64
7388+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
7389 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
7390 #endif
7391 #ifdef cl_khr_fp16
7392@@ -59,8 +70,12 @@ void test() {
7393 check(__alignof__(double) == 8);
7394 #endif
7395
7396- check(sizeof(void*) == (__OPENCL_C_VERSION__ >= 200 ? 8 : 4));
7397- check(__alignof__(void*) == (__OPENCL_C_VERSION__ >= 200 ? 8 : 4));
7398+ check(sizeof(private void*) == 4);
7399+ check(__alignof__(private void*) == 4);
7400+#ifdef __opencl_c_generic_address_space
7401+ check(sizeof(generic void*) == 8);
7402+ check(__alignof__(generic void*) == 8);
7403+#endif
7404 check(sizeof(global_ptr_t) == PTSIZE);
7405 check(__alignof__(global_ptr_t) == PTSIZE);
7406 check(sizeof(constant_ptr_t) == PTSIZE);
7407diff --git a/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl b/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl
7408index d1ab6aceac5c..70c5bace023b 100644
7409--- a/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl
7410+++ b/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl
7411@@ -1,4 +1,5 @@
7412 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -finclude-default-header -cl-std=CL1.2 -emit-llvm -o - -O0 | FileCheck %s
7413+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -finclude-default-header -cl-std=CL3.0 -emit-llvm -o - -O0 | FileCheck %s
7414
7415 #pragma OPENCL EXTENSION cl_arm_integer_dot_product_int8 : enable
7416 void test_int8(uchar4 ua, uchar4 ub, char4 sa, char4 sb) {
7417diff --git a/clang/test/CodeGenOpenCL/cl-uniform-wg-size.cl b/clang/test/CodeGenOpenCL/cl-uniform-wg-size.cl
7418index 76ace5dca21e..5dc43e222f75 100644
7419--- a/clang/test/CodeGenOpenCL/cl-uniform-wg-size.cl
7420+++ b/clang/test/CodeGenOpenCL/cl-uniform-wg-size.cl
7421@@ -1,6 +1,8 @@
7422 // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL1.2 -o - %s 2>&1 | FileCheck %s -check-prefixes CHECK,CHECK-UNIFORM
7423 // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s 2>&1 | FileCheck %s -check-prefixes CHECK,CHECK-NONUNIFORM
7424 // 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
7425+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL3.0 -o - %s 2>&1 | FileCheck %s -check-prefixes CHECK,CHECK-NONUNIFORM
7426+// 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
7427
7428 kernel void ker() {};
7429 // CHECK: define{{.*}}@ker() #0
7430diff --git a/clang/test/CodeGenOpenCL/fpmath.cl b/clang/test/CodeGenOpenCL/fpmath.cl
7431index 0108d909c94e..b28392739c71 100644
7432--- a/clang/test/CodeGenOpenCL/fpmath.cl
7433+++ b/clang/test/CodeGenOpenCL/fpmath.cl
7434@@ -2,6 +2,8 @@
7435 // 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
7436 // 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
7437 // RUN: %clang_cc1 %s -emit-llvm -o - -DFP64 -cl-std=CL1.2 -triple spir-unknown-unknown -pedantic | FileCheck --check-prefix=CHECK-DBL %s
7438+// 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
7439+// 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
7440
7441 typedef __attribute__(( ext_vector_type(4) )) float float4;
7442
7443diff --git a/clang/test/CodeGenOpenCL/generic-address-space-feature.cl b/clang/test/CodeGenOpenCL/generic-address-space-feature.cl
7444new file mode 100644
7445index 000000000000..890860abe4d9
7446--- /dev/null
7447+++ b/clang/test/CodeGenOpenCL/generic-address-space-feature.cl
7448@@ -0,0 +1,28 @@
7449+// 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
7450+// 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
7451+// 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
7452+// 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
7453+// 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
7454+// 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
7455+// 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
7456+// 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
7457+
7458+void test(global float* src1, local float *src2, private float *src3, float *src4, float tmp) {
7459+ // CL20: %{{.+}} = addrspacecast float addrspace(1)* %{{.+}} to float addrspace(4)*
7460+ // CL12-NOT: addrspacecast
7461+ // CL30-NOT: addrspacecast
7462+ // CL30-GENERIC-NOT: addrspacecast
7463+ tmp = sincos(tmp, src1);
7464+ // CL20: %{{.+}} = addrspacecast float addrspace(3)* %{{.+}} to float addrspace(4)*
7465+ // CL12-NOT: addrspacecast
7466+ // CL30-NOT: addrspacecast
7467+ // CL30-GENERIC-NOT: addrspacecast
7468+ tmp = sincos(tmp, src2);
7469+
7470+ // CL12: %{{.+}} = call {{(spir_func )?}}float [[FUNCNAME:@.*sincos.*]](float %{{.+}}, float* {{.+}})
7471+ // CL20: %{{.+}} = call {{(spir_func )?}}float [[FUNCNAME:@.*sincos.*]](float %{{.+}}, float addrspace(4)* {{.+}})
7472+ // CL30: %{{.+}} = call {{(spir_func )?}}float [[FUNCNAME:@.*sincos.*]](float %{{.+}}, float* {{.+}})
7473+ // CL30-GENERIC: %{{.+}} = call {{(spir_func )?}}float [[FUNCNAME:@.*sincos.*]](float %{{.+}}, float addrspace(4)* {{.+}})
7474+ // CHECK: addrspacecast
7475+ tmp = sincos(tmp, src4);
7476+}
7477diff --git a/clang/test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl b/clang/test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl
7478index 515f13f6e768..5aa31ac6f345 100644
7479--- a/clang/test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl
7480+++ b/clang/test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl
7481@@ -1,4 +1,5 @@
7482 // 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
7483+// 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
7484
7485 // CHECK: %opencl.intel_sub_group_avc_mce_payload_t = type opaque
7486 // CHECK: %opencl.intel_sub_group_avc_ime_payload_t = type opaque
7487diff --git a/clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl b/clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl
7488index e89237623478..3d6708ac361f 100644
7489--- a/clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl
7490+++ b/clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl
7491@@ -1,5 +1,8 @@
7492 // RUN: %clang_cc1 %s -cl-std=CL1.2 -emit-llvm -triple x86_64-unknown-unknown -o - | FileCheck %s
7493 // RUN: %clang_cc1 %s -cl-std=CL1.2 -emit-llvm -triple amdgcn-unknown-unknown -o - | FileCheck -check-prefixes=AMDGCN %s
7494+// RUN: %clang_cc1 %s -cl-std=CL3.0 -cl-ext=__opencl_c_fp64 -emit-llvm -triple x86_64-unknown-unknown -o - | FileCheck %s
7495+// 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
7496+
7497 // Test that the kernels always use the SPIR calling convention
7498 // to have unambiguous mapping of arguments to feasibly implement
7499 // clSetKernelArg().
7500diff --git a/clang/test/CodeGenOpenCL/logical-ops.cl b/clang/test/CodeGenOpenCL/logical-ops.cl
7501index f083a8580ee7..499eab65039b 100644
7502--- a/clang/test/CodeGenOpenCL/logical-ops.cl
7503+++ b/clang/test/CodeGenOpenCL/logical-ops.cl
7504@@ -1,4 +1,5 @@
7505 // RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL1.2 -O1 -triple x86_64-unknown-linux-gnu | FileCheck %s
7506+// 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
7507 // RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=clc++ -O1 -triple x86_64-unknown-linux-gnu | FileCheck %s
7508
7509 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
7510diff --git a/clang/test/CodeGenOpenCL/no-half.cl b/clang/test/CodeGenOpenCL/no-half.cl
7511index aee8f678f01a..46da7fa339e8 100644
7512--- a/clang/test/CodeGenOpenCL/no-half.cl
7513+++ b/clang/test/CodeGenOpenCL/no-half.cl
7514@@ -1,6 +1,7 @@
7515 // RUN: %clang_cc1 %s -cl-std=cl2.0 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
7516 // RUN: %clang_cc1 %s -cl-std=cl1.2 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
7517 // RUN: %clang_cc1 %s -cl-std=cl1.1 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
7518+// RUN: %clang_cc1 %s -cl-std=cl3.0 -cl-ext=__opencl_c_fp64 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
7519
7520 #pragma OPENCL EXTENSION cl_khr_fp64:enable
7521
7522diff --git a/clang/test/CodeGenOpenCL/pipe_builtin.cl b/clang/test/CodeGenOpenCL/pipe_builtin.cl
7523index 02b9669b7ab1..0bf35c336199 100644
7524--- a/clang/test/CodeGenOpenCL/pipe_builtin.cl
7525+++ b/clang/test/CodeGenOpenCL/pipe_builtin.cl
7526@@ -1,4 +1,7 @@
7527 // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -cl-ext=+cl_khr_subgroups -O0 -cl-std=clc++ -o - %s | FileCheck %s
7528+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -cl-ext=+cl_khr_subgroups -O0 -cl-std=cl2.0 -o - %s | FileCheck %s
7529+// 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
7530+
7531 // FIXME: Add MS ABI manglings of OpenCL things and remove %itanium_abi_triple
7532 // above to support OpenCL in the MS C++ ABI.
7533
7534diff --git a/clang/test/CodeGenOpenCL/pipe_types.cl b/clang/test/CodeGenOpenCL/pipe_types.cl
7535index ba064c6d7557..b7a523d4f084 100644
7536--- a/clang/test/CodeGenOpenCL/pipe_types.cl
7537+++ b/clang/test/CodeGenOpenCL/pipe_types.cl
7538@@ -1,4 +1,5 @@
7539 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
7540+// 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
7541
7542 // CHECK: %opencl.pipe_ro_t = type opaque
7543 // CHECK: %opencl.pipe_wo_t = type opaque
7544diff --git a/clang/test/CodeGenOpenCL/printf.cl b/clang/test/CodeGenOpenCL/printf.cl
7545index fc139d776db6..0133c5595d81 100644
7546--- a/clang/test/CodeGenOpenCL/printf.cl
7547+++ b/clang/test/CodeGenOpenCL/printf.cl
7548@@ -1,5 +1,7 @@
7549 // 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
7550 // 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
7551+// 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
7552+// RUN: %clang_cc1 -cl-std=CL3.0 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=NOFP64,ALL %s
7553
7554 typedef __attribute__((ext_vector_type(2))) float float2;
7555 typedef __attribute__((ext_vector_type(2))) half half2;
7556diff --git a/clang/test/CodeGenOpenCL/unroll-hint.cl b/clang/test/CodeGenOpenCL/unroll-hint.cl
7557index 0f84450a1ae6..9347c935869b 100644
7558--- a/clang/test/CodeGenOpenCL/unroll-hint.cl
7559+++ b/clang/test/CodeGenOpenCL/unroll-hint.cl
7560@@ -1,5 +1,6 @@
7561 // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
7562 // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL1.2 -o - %s | FileCheck %s
7563+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL3.0 -o - %s | FileCheck %s
7564
7565 /*** for ***/
7566 void for_count()
7567diff --git a/clang/test/Driver/autocomplete.c b/clang/test/Driver/autocomplete.c
7568index 5c0bfb69f9a3..eabdf0b5938d 100644
7569--- a/clang/test/Driver/autocomplete.c
7570+++ b/clang/test/Driver/autocomplete.c
7571@@ -43,6 +43,8 @@
7572 // CLSTDALL-NEXT: CL1.2
7573 // CLSTDALL-NEXT: cl2.0
7574 // CLSTDALL-NEXT: CL2.0
7575+// CLSTDALL-NEXT: cl3.0
7576+// CLSTDALL-NEXT: CL3.0
7577 // CLSTDALL-NEXT: clc++
7578 // CLSTDALL-NEXT: CLC++
7579 // RUN: %clang --autocomplete=-fno-sanitize-coverage=,f | FileCheck %s -check-prefix=FNOSANICOVER
7580diff --git a/clang/test/Driver/opencl.cl b/clang/test/Driver/opencl.cl
7581index 63b04bc1af41..ffdd4f7d65bb 100644
7582--- a/clang/test/Driver/opencl.cl
7583+++ b/clang/test/Driver/opencl.cl
7584@@ -2,6 +2,7 @@
7585 // RUN: %clang -S -### -cl-std=CL1.1 %s 2>&1 | FileCheck --check-prefix=CHECK-CL11 %s
7586 // RUN: %clang -S -### -cl-std=CL1.2 %s 2>&1 | FileCheck --check-prefix=CHECK-CL12 %s
7587 // RUN: %clang -S -### -cl-std=CL2.0 %s 2>&1 | FileCheck --check-prefix=CHECK-CL20 %s
7588+// RUN: %clang -S -### -cl-std=CL3.0 %s 2>&1 | FileCheck --check-prefix=CHECK-CL30 %s
7589 // RUN: %clang -S -### -cl-std=clc++ %s 2>&1 | FileCheck --check-prefix=CHECK-CLCPP %s
7590 // RUN: %clang -S -### -cl-opt-disable %s 2>&1 | FileCheck --check-prefix=CHECK-OPT-DISABLE %s
7591 // RUN: %clang -S -### -cl-strict-aliasing %s 2>&1 | FileCheck --check-prefix=CHECK-STRICT-ALIASING %s
7592@@ -22,6 +23,7 @@
7593 // CHECK-CL11: "-cc1" {{.*}} "-cl-std=CL1.1"
7594 // CHECK-CL12: "-cc1" {{.*}} "-cl-std=CL1.2"
7595 // CHECK-CL20: "-cc1" {{.*}} "-cl-std=CL2.0"
7596+// CHECK-CL30: "-cc1" {{.*}} "-cl-std=CL3.0"
7597 // CHECK-CLCPP: "-cc1" {{.*}} "-cl-std=clc++"
7598 // CHECK-OPT-DISABLE: "-cc1" {{.*}} "-cl-opt-disable"
7599 // CHECK-STRICT-ALIASING: "-cc1" {{.*}} "-cl-strict-aliasing"
7600diff --git a/clang/test/Driver/unknown-std.cl b/clang/test/Driver/unknown-std.cl
7601index 6f371bac13ac..00209fb62556 100644
7602--- a/clang/test/Driver/unknown-std.cl
7603+++ b/clang/test/Driver/unknown-std.cl
7604@@ -10,6 +10,7 @@
7605 // CHECK-NEXT: note: use 'cl1.1' for 'OpenCL 1.1' standard
7606 // CHECK-NEXT: note: use 'cl1.2' for 'OpenCL 1.2' standard
7607 // CHECK-NEXT: note: use 'cl2.0' for 'OpenCL 2.0' standard
7608+// CHECK-NEXT: note: use 'cl3.0' for 'OpenCL 3.0' standard
7609 // CHECK-NEXT: note: use 'clc++' for 'C++ for OpenCL' standard
7610
7611 // Make sure that no other output is present.
7612diff --git a/clang/test/Frontend/stdlang.c b/clang/test/Frontend/stdlang.c
7613index 51484999e37a..eac4632fbdd6 100644
7614--- a/clang/test/Frontend/stdlang.c
7615+++ b/clang/test/Frontend/stdlang.c
7616@@ -9,6 +9,7 @@
7617 // RUN: %clang_cc1 -x cl -cl-std=CL1.1 -DOPENCL %s
7618 // RUN: %clang_cc1 -x cl -cl-std=CL1.2 -DOPENCL %s
7619 // RUN: %clang_cc1 -x cl -cl-std=CL2.0 -DOPENCL %s
7620+// RUN: %clang_cc1 -x cl -cl-std=CL3.0 -DOPENCL %s
7621 // RUN: %clang_cc1 -x cl -cl-std=CLC++ -DOPENCL %s
7622 // RUN: not %clang_cc1 -x cl -std=c99 -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-C99 %s
7623 // RUN: not %clang_cc1 -x cl -cl-std=invalid -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID %s
7624diff --git a/clang/test/Headers/opencl-c-header.cl b/clang/test/Headers/opencl-c-header.cl
7625index 1b151ffdd16a..2716076acdcf 100644
7626--- a/clang/test/Headers/opencl-c-header.cl
7627+++ b/clang/test/Headers/opencl-c-header.cl
7628@@ -1,6 +1,7 @@
7629 // RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -verify | FileCheck %s
7630 // 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
7631 // 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
7632+// 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
7633 // 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
7634
7635 // Test including the default header as a module.
7636@@ -39,9 +40,11 @@
7637 // RUN: rm -rf %t
7638 // RUN: mkdir -p %t
7639 // 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
7640+// 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
7641 // 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
7642 // RUN: chmod u-w %t
7643 // 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
7644+// 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
7645 // 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
7646 // RUN: chmod u+w %t
7647
7648@@ -67,7 +70,7 @@ char f(char x) {
7649 // from OpenCL 2.0 onwards.
7650
7651 // CHECK20: _Z12write_imagef14ocl_image3d_wo
7652-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
7653+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
7654 void test_image3dwo(write_only image3d_t img) {
7655 write_imagef(img, (0), (0.0f));
7656 }
7657@@ -81,7 +84,7 @@ void test_atomics(__generic volatile unsigned int* a) {
7658 #endif
7659
7660 // Verify that ATOMIC_VAR_INIT is defined.
7661-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
7662+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
7663 global atomic_int z = ATOMIC_VAR_INIT(99);
7664 #endif //__OPENCL_C_VERSION__
7665
7666diff --git a/clang/test/Index/pipe-size.cl b/clang/test/Index/pipe-size.cl
7667index 94a1255f0a48..59b76051eda1 100644
7668--- a/clang/test/Index/pipe-size.cl
7669+++ b/clang/test/Index/pipe-size.cl
7670@@ -2,6 +2,13 @@
7671 // RUN: %clang_cc1 -x cl -O0 -cl-std=CL2.0 -emit-llvm -triple spir-unknown-unknown %s -o - | FileCheck %s --check-prefix=SPIR
7672 // RUN: %clang_cc1 -x cl -O0 -cl-std=CL2.0 -emit-llvm -triple spir64-unknown-unknown %s -o - | FileCheck %s --check-prefix=SPIR64
7673 // RUN: %clang_cc1 -x cl -O0 -cl-std=CL2.0 -emit-llvm -triple amdgcn-amd-amdhsa %s -o - | FileCheck %s --check-prefix=AMDGCN
7674+// 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
7675+// 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
7676+// 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
7677+// 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
7678+
7679+
7680+
7681 __kernel void testPipe( pipe int test )
7682 {
7683 int s = sizeof(test);
7684diff --git a/clang/test/Preprocessor/predefined-macros.c b/clang/test/Preprocessor/predefined-macros.c
7685index def105f4c52e..b088a37ba665 100644
7686--- a/clang/test/Preprocessor/predefined-macros.c
7687+++ b/clang/test/Preprocessor/predefined-macros.c
7688@@ -129,6 +129,8 @@
7689 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL12
7690 // RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=CL2.0 \
7691 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL20
7692+// RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=CL3.0 \
7693+// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL30
7694 // RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-fast-relaxed-math \
7695 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-FRM
7696 // RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=clc++ \
7697@@ -137,26 +139,37 @@
7698 // CHECK-CL10: #define CL_VERSION_1_1 110
7699 // CHECK-CL10: #define CL_VERSION_1_2 120
7700 // CHECK-CL10: #define CL_VERSION_2_0 200
7701+// CHECK-CL10: #define CL_VERSION_3_0 300
7702 // CHECK-CL10: #define __OPENCL_C_VERSION__ 100
7703 // CHECK-CL10-NOT: #define __FAST_RELAXED_MATH__ 1
7704 // CHECK-CL11: #define CL_VERSION_1_0 100
7705 // CHECK-CL11: #define CL_VERSION_1_1 110
7706 // CHECK-CL11: #define CL_VERSION_1_2 120
7707 // CHECK-CL11: #define CL_VERSION_2_0 200
7708+// CHECK-CL11: #define CL_VERSION_3_0 300
7709 // CHECK-CL11: #define __OPENCL_C_VERSION__ 110
7710 // CHECK-CL11-NOT: #define __FAST_RELAXED_MATH__ 1
7711 // CHECK-CL12: #define CL_VERSION_1_0 100
7712 // CHECK-CL12: #define CL_VERSION_1_1 110
7713 // CHECK-CL12: #define CL_VERSION_1_2 120
7714 // CHECK-CL12: #define CL_VERSION_2_0 200
7715+// CHECK-CL12: #define CL_VERSION_3_0 300
7716 // CHECK-CL12: #define __OPENCL_C_VERSION__ 120
7717 // CHECK-CL12-NOT: #define __FAST_RELAXED_MATH__ 1
7718 // CHECK-CL20: #define CL_VERSION_1_0 100
7719 // CHECK-CL20: #define CL_VERSION_1_1 110
7720 // CHECK-CL20: #define CL_VERSION_1_2 120
7721 // CHECK-CL20: #define CL_VERSION_2_0 200
7722+// CHECK-CL20: #define CL_VERSION_3_0 300
7723 // CHECK-CL20: #define __OPENCL_C_VERSION__ 200
7724 // CHECK-CL20-NOT: #define __FAST_RELAXED_MATH__ 1
7725+// CHECK-CL30: #define CL_VERSION_1_0 100
7726+// CHECK-CL30: #define CL_VERSION_1_1 110
7727+// CHECK-CL30: #define CL_VERSION_1_2 120
7728+// CHECK-CL30: #define CL_VERSION_2_0 200
7729+// CHECK-CL30: #define CL_VERSION_3_0 300
7730+// CHECK-CL30: #define __OPENCL_C_VERSION__ 300
7731+// CHECK-CL30-NOT: #define __FAST_RELAXED_MATH__ 1
7732 // CHECK-FRM: #define __FAST_RELAXED_MATH__ 1
7733 // CHECK-CLCPP10: #define __CL_CPP_VERSION_1_0__ 100
7734 // CHECK-CLCPP10: #define __OPENCL_CPP_VERSION__ 100
7735diff --git a/clang/test/Sema/feature-extensions-simult-support.cl b/clang/test/Sema/feature-extensions-simult-support.cl
7736new file mode 100644
7737index 000000000000..0789105002b2
7738--- /dev/null
7739+++ b/clang/test/Sema/feature-extensions-simult-support.cl
7740@@ -0,0 +1,75 @@
7741+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=-cl_khr_fp64
7742+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=+cl_khr_fp64
7743+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=-cl_khr_3d_image_writes
7744+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=+cl_khr_3d_image_writes
7745+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=-cl_khr_subgroups
7746+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=+cl_khr_subgroups
7747+
7748+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=-cl_khr_fp64
7749+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_fp64
7750+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=-cl_khr_3d_image_writes
7751+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_3d_image_writes
7752+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=-cl_khr_subgroups
7753+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_subgroups
7754+
7755+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_fp64
7756+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_3d_image_writes
7757+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_subgroups
7758+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_pipes
7759+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_device_enqueue
7760+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_read_write_images
7761+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_fp64,-cl_khr_fp64
7762+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_3d_image_writes,-cl_khr_3d_image_writes
7763+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_subgroups,-cl_khr_subgroups
7764+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+cl_khr_fp64
7765+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+cl_khr_3d_image_writes
7766+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+cl_khr_subgroups
7767+
7768+// expected-no-diagnostics
7769+
7770+#ifdef cl_khr_fp64
7771+ #ifndef __opencl_c_fp64
7772+ #error macros were not properly set up
7773+ #endif
7774+#endif
7775+#ifdef __opencl_c_fp64
7776+ #ifndef cl_khr_fp64
7777+ #error macros were not properly set up
7778+ #endif
7779+#endif
7780+
7781+#ifdef cl_khr_3d_image_writes
7782+ #ifndef __opencl_c_3d_image_writes
7783+ #error macros were not properly set up
7784+ #endif
7785+#endif
7786+#ifdef __opencl_c_3d_image_writes
7787+ #ifndef cl_khr_3d_image_writes
7788+ #error macros were not properly set up
7789+ #endif
7790+#endif
7791+
7792+#ifdef cl_khr_subgroups
7793+ #ifndef __opencl_c_subgroups
7794+ #error macros were not properly set up
7795+ #endif
7796+#endif
7797+#ifdef __opencl_c_subgroups
7798+ #ifndef cl_khr_subgroups
7799+ #error macros were not properly set up
7800+ #endif
7801+#endif
7802+
7803+#if defined(__opencl_c_pipes) || defined(__opencl_c_device_enqueue)
7804+ #ifndef __opencl_c_generic_address_space
7805+ #error macros were not properly set up
7806+ #endif
7807+#endif
7808+
7809+#if defined(__opencl_c_3d_image_writes) || defined(__opencl_c_read_write_images)
7810+ #ifndef __opencl_c_images
7811+ #error macros were not properly set up
7812+ #endif
7813+#endif
7814+
7815+kernel void test(){}
7816diff --git a/clang/test/Sema/features-ignore-pragma.cl b/clang/test/Sema/features-ignore-pragma.cl
7817new file mode 100644
7818index 000000000000..046ce5390754
7819--- /dev/null
7820+++ b/clang/test/Sema/features-ignore-pragma.cl
7821@@ -0,0 +1,24 @@
7822+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0
7823+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_fp64
7824+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_subgroups
7825+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_3d_image_writes
7826+
7827+#pragma OPENCL EXTENSION __opencl_c_fp64 : enable
7828+// expected-warning@-1 {{OpenCL feature support can't be controlled via pragma, ignoring}}
7829+
7830+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
7831+#ifndef __opencl_c_fp64
7832+// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_fp64' - ignoring}}
7833+#endif
7834+
7835+#pragma OPENCL EXTENSION cl_khr_subgroups : enable
7836+#ifndef __opencl_c_subgroups
7837+// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_subgroups' - ignoring}}
7838+#endif
7839+
7840+#pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable
7841+#ifndef __opencl_c_3d_image_writes
7842+// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_3d_image_writes' - ignoring}}
7843+#endif
7844+
7845+kernel void foo() {}
7846diff --git a/clang/test/Sema/opencl-features-pipes.cl b/clang/test/Sema/opencl-features-pipes.cl
7847new file mode 100644
7848index 000000000000..c0ac778f24a6
7849--- /dev/null
7850+++ b/clang/test/Sema/opencl-features-pipes.cl
7851@@ -0,0 +1,18 @@
7852+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.1
7853+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2
7854+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -DHAS
7855+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0
7856+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -DHAS
7857+// expected-no-diagnostics
7858+
7859+#ifdef HAS
7860+ #ifndef __opencl_c_pipes
7861+ #error Feature should be defined
7862+ #endif
7863+#else
7864+ #ifdef __opencl_c_pipes
7865+ #error Feature should not be defined
7866+ #endif
7867+#endif
7868+
7869+kernel void foo() {}
7870diff --git a/clang/test/Sema/opencl-features.cl b/clang/test/Sema/opencl-features.cl
7871new file mode 100644
7872index 000000000000..aa432f6b60bf
7873--- /dev/null
7874+++ b/clang/test/Sema/opencl-features.cl
7875@@ -0,0 +1,128 @@
7876+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
7877+// 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
7878+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CLC++
7879+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0
7880+// expected-no-diagnostics
7881+
7882+#ifndef __opencl_c_int64
7883+ #error Feature __opencl_c_int64 shouldn't be defined
7884+#endif
7885+
7886+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
7887+ #ifndef __opencl_c_3d_image_writes
7888+ #error Feature __opencl_c_3d_image_writes should be defined
7889+ #endif
7890+
7891+ #ifndef __opencl_c_atomic_order_acq_rel
7892+ #error Feature __opencl_c_atomic_order_acq_rel should be defined
7893+ #endif
7894+
7895+ #ifndef __opencl_c_atomic_order_seq_cst
7896+ #error Feature __opencl_c_atomic_order_seq_cst should be defined
7897+ #endif
7898+
7899+ #ifndef __opencl_c_atomic_scope_device
7900+ #error Feature __opencl_c_atomic_scope_device should be defined
7901+ #endif
7902+
7903+ #ifndef __opencl_c_atomic_scope_all_devices
7904+ #error Feature __opencl_c_atomic_scope_all_devices should be defined
7905+ #endif
7906+
7907+ #ifndef __opencl_c_device_enqueue
7908+ #error Feature __opencl_c_device_enqueue should be defined
7909+ #endif
7910+
7911+ #ifndef __opencl_c_generic_address_space
7912+ #error Feature __opencl_c_generic_address_space should be defined
7913+ #endif
7914+
7915+ #ifndef __opencl_c_pipes
7916+ #error Feature __opencl_c_pipes should be defined
7917+ #endif
7918+
7919+ #ifndef __opencl_c_program_scope_global_variables
7920+ #error Feature __opencl_c_program_scope_global_variables should be defined
7921+ #endif
7922+
7923+ #ifndef __opencl_c_read_write_images
7924+ #error Feature __opencl_c_read_write_images should be defined
7925+ #endif
7926+
7927+ #ifndef __opencl_c_subgroups
7928+ #error Feature __opencl_c_subgroups should be defined
7929+ #endif
7930+
7931+ #ifndef __opencl_c_work_group_collective_functions
7932+ #error Feature __opencl_c_work_group_collective_functions should be defined
7933+ #endif
7934+
7935+ #ifndef __opencl_c_fp64
7936+ #error Feature __opencl_c_fp64 should be defined
7937+ #endif
7938+
7939+ #ifndef __opencl_c_images
7940+ #error Feature __opencl_c_images should be defined
7941+ #endif
7942+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
7943+
7944+
7945+#if __OPENCL_C_VERSION__ == CL_VERSION_3_0
7946+ #ifdef __opencl_c_3d_image_writes
7947+ #error Feature __opencl_c_3d_image_writes shouldn't be defined
7948+ #endif
7949+
7950+ #ifdef __opencl_c_atomic_order_acq_rel
7951+ #error Feature __opencl_c_atomic_order_acq_rel shouldn't be defined
7952+ #endif
7953+
7954+ #ifdef __opencl_c_atomic_order_seq_cst
7955+ #error Feature __opencl_c_atomic_order_seq_cst shouldn't be defined
7956+ #endif
7957+
7958+ #ifdef __opencl_c_atomic_scope_device
7959+ #error Feature __opencl_c_atomic_scope_device shouldn't be defined
7960+ #endif
7961+
7962+ #ifdef __opencl_c_atomic_scope_all_devices
7963+ #error Feature __opencl_c_atomic_scope_all_devices shouldn't be defined
7964+ #endif
7965+
7966+ #ifdef __opencl_c_device_enqueue
7967+ #error Feature __opencl_c_device_enqueue shouldn't be defined
7968+ #endif
7969+
7970+ #ifdef __opencl_c_generic_address_space
7971+ #error Feature __opencl_c_generic_address_space shouldn't be defined
7972+ #endif
7973+
7974+ #ifdef __opencl_c_pipes
7975+ #error Feature __opencl_c_pipes shouldn't be defined
7976+ #endif
7977+
7978+ #ifdef __opencl_c_program_scope_global_variables
7979+ #error Feature __opencl_c_program_scope_global_variables shouldn't be defined
7980+ #endif
7981+
7982+ #ifdef __opencl_c_read_write_images
7983+ #error Feature __opencl_c_read_write_images shouldn't be defined
7984+ #endif
7985+
7986+ #ifdef __opencl_c_subgroups
7987+ #error Feature __opencl_c_subgroups shouldn't be defined
7988+ #endif
7989+
7990+ #ifdef __opencl_c_work_group_collective_functions
7991+ #error Feature __opencl_c_work_group_collective_functions shouldn't be defined
7992+ #endif
7993+
7994+ #ifdef __opencl_c_fp64
7995+ #error Feature __opencl_c_fp64 shouldn't be defined
7996+ #endif
7997+
7998+ #ifdef __opencl_c_images
7999+ #error Feature __opencl_c_images shouldn't be defined
8000+ #endif
8001+#endif // __OPENCL_C_VERSION__ == CL_VERSION_3_0
8002+
8003+kernel void foo() {}
8004diff --git a/clang/test/Sema/pipe_builtins_feature.cl b/clang/test/Sema/pipe_builtins_feature.cl
8005new file mode 100644
8006index 000000000000..56fa94fc7705
8007--- /dev/null
8008+++ b/clang/test/Sema/pipe_builtins_feature.cl
8009@@ -0,0 +1,21 @@
8010+// RUN: %clang_cc1 -cl-std=CL2.0 -fsyntax-only -verify %s
8011+// RUN: %clang_cc1 -cl-std=CL3.0 -fsyntax-only -verify %s
8012+// RUN: %clang_cc1 -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -fsyntax-only -verify %s
8013+
8014+#ifdef __opencl_c_pipes
8015+ #ifndef __opencl_c_generic_address_space
8016+ #error Generic address space feature must also be defined
8017+ #endif
8018+// CHECK: expected-no-diagnostics
8019+// check that pragma disable all doesn't touch feature support
8020+ #pragma OPENCL EXTENSION all : disable
8021+#endif
8022+
8023+void test(read_only pipe int p, global int *ptr) {
8024+ reserve_id_t rid;
8025+}
8026+
8027+#ifndef __opencl_c_pipes
8028+// expected-error@-5 {{expected parameter declarator}} expected-error@-5 {{expected ')'}} expected-note@-5 {{to match this '('}}
8029+// expected-error@-5 {{use of type 'reserve_id_t' requires __opencl_c_pipes extension to be enabled}}
8030+#endif
8031diff --git a/clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl b/clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
8032index 5efea216346a..09aea27ae6de 100644
8033--- a/clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
8034+++ b/clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
8035@@ -1,6 +1,9 @@
8036 // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std=CL2.0
8037 // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std=CL2.0
8038 // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std=CL2.0
8039+// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space
8040+// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space
8041+// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space
8042 // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std=clc++
8043 // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std=clc++
8044 // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std=clc++
8045diff --git a/clang/test/SemaOpenCL/address-spaces.cl b/clang/test/SemaOpenCL/address-spaces.cl
8046index 07547ea19680..e367a7c57292 100644
8047--- a/clang/test/SemaOpenCL/address-spaces.cl
8048+++ b/clang/test/SemaOpenCL/address-spaces.cl
8049@@ -1,5 +1,6 @@
8050 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
8051 // RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only
8052+// RUN: %clang_cc1 %s -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space -verify -pedantic -fsyntax-only
8053 // RUN: %clang_cc1 %s -cl-std=clc++ -verify -pedantic -fsyntax-only
8054
8055 __constant int ci = 1;
8056diff --git a/clang/test/SemaOpenCL/cl20-device-side-enqueue.cl b/clang/test/SemaOpenCL/cl20-device-side-enqueue.cl
8057index f63e2913c749..727141190a0b 100644
8058--- a/clang/test/SemaOpenCL/cl20-device-side-enqueue.cl
8059+++ b/clang/test/SemaOpenCL/cl20-device-side-enqueue.cl
8060@@ -2,6 +2,12 @@
8061 // RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir-unknown-unknown" -verify -pedantic -fsyntax-only -DB32 -DQUALS="const volatile"
8062 // RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS=
8063 // RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS="const volatile"
8064+// 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=
8065+// 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"
8066+// 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=
8067+// 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"
8068+
8069+
8070
8071 typedef struct {int a;} ndrange_t;
8072 // Diagnostic tests for different overloads of enqueue_kernel from Table 6.13.17.1 of OpenCL 2.0 Spec.
8073@@ -235,11 +241,17 @@ kernel void bar(global unsigned int *buf)
8074 kernel void foo1(global unsigned int *buf)
8075 {
8076 ndrange_t n;
8077- 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}}
8078+ buf[0] = get_kernel_max_sub_group_size_for_ndrange(n, ^(){});
8079+#if __OPENCL_C_VERSION__ < 300
8080+// expected-error@-2 {{use of declaration 'get_kernel_max_sub_group_size_for_ndrange' requires cl_khr_subgroups extension to be enabled}}
8081+#endif
8082 }
8083
8084 kernel void bar1(global unsigned int *buf)
8085 {
8086 ndrange_t n;
8087- 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}}
8088+ buf[0] = get_kernel_sub_group_count_for_ndrange(n, ^(){});
8089+#if __OPENCL_C_VERSION__ < 300
8090+// expected-error@-2 {{use of declaration 'get_kernel_sub_group_count_for_ndrange' requires cl_khr_subgroups extension to be enabled}}
8091+#endif
8092 }
8093diff --git a/clang/test/SemaOpenCL/forget-unsupported-builtins.cl b/clang/test/SemaOpenCL/forget-unsupported-builtins.cl
8094new file mode 100644
8095index 000000000000..14dd03e2c7db
8096--- /dev/null
8097+++ b/clang/test/SemaOpenCL/forget-unsupported-builtins.cl
8098@@ -0,0 +1,22 @@
8099+// RUN: %clang_cc1 -cl-std=cl3.0 -fsyntax-only -verify %s -triple spir-unknown-unknown
8100+// 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
8101+
8102+#ifndef FEATURES
8103+ // expected-no-diagnostics
8104+#else
8105+ // expected-error@+10 {{cannot redeclare builtin function 'get_pipe_max_packets'}}
8106+ // expected-note@+9 {{'get_pipe_max_packets' is a builtin with type 'unsigned int ()'}}
8107+ // expected-error@+9 {{cannot redeclare builtin function 'to_local'}}
8108+ // expected-note@+8 {{'to_local' is a builtin with type 'void *(void *)'}}
8109+ // expected-error@+8 {{cannot redeclare builtin function 'to_global'}}
8110+ // expected-note@+7 {{'to_global' is a builtin with type 'void *(void *)'}}
8111+ // expected-error@+7 {{cannot redeclare builtin function 'get_kernel_work_group_size'}}
8112+ // expected-note@+6 {{'get_kernel_work_group_size' is a builtin with type 'unsigned int ()'}}
8113+#endif
8114+
8115+int get_pipe_max_packets(int);
8116+int to_local(int);
8117+int to_global(int);
8118+int get_kernel_work_group_size(int);
8119+
8120+kernel void test(global int *dst) {}
8121diff --git a/clang/test/SemaOpenCL/image-features.cl b/clang/test/SemaOpenCL/image-features.cl
8122new file mode 100644
8123index 000000000000..ace6913bb31e
8124--- /dev/null
8125+++ b/clang/test/SemaOpenCL/image-features.cl
8126@@ -0,0 +1,20 @@
8127+// RUN: %clang_cc1 -cl-std=cl2.0 -fsyntax-only -verify %s -triple spir-unknown-unknown
8128+// RUN: %clang_cc1 -cl-std=cl3.0 -cl-ext=__opencl_c_images -fsyntax-only -verify %s -triple spir-unknown-unknown
8129+// RUN: %clang_cc1 -cl-std=cl3.0 -cl-ext=__opencl_c_3d_image_writes -fsyntax-only -verify %s -triple spir-unknown-unknown
8130+// RUN: %clang_cc1 -cl-std=cl3.0 -cl-ext=__opencl_c_read_write_images -fsyntax-only -verify %s -triple spir-unknown-unknown
8131+
8132+#if defined(__opencl_c_read_write_images) && defined(__opencl_c_3d_image_writes)
8133+ // expected-no-diagnostics
8134+#endif
8135+
8136+__kernel void write_3d_image(__write_only image3d_t i) {}
8137+
8138+#ifndef __opencl_c_3d_image_writes
8139+ // expected-error@-3 {{use of type '__write_only image3d_t' requires __opencl_c_3d_image_writes extension to be enabled}}
8140+#endif
8141+
8142+__kernel void read_write_3d_image(__read_write image3d_t i) { }
8143+
8144+#ifndef __opencl_c_read_write_images
8145+ // expected-error@-3 {{use of type '__read_write image3d_t' requires __opencl_c_read_write_images extension to be enabled}}
8146+#endif
8147diff --git a/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl b/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
8148index 36e76621d24a..38b0a04726e3 100644
8149--- a/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
8150+++ b/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
8151@@ -1,4 +1,5 @@
8152 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_subgroups
8153+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_subgroups,__opencl_c_pipes
8154
8155 #pragma OPENCL EXTENSION cl_khr_subgroups : enable
8156
8157diff --git a/clang/test/SemaOpenCL/storageclass-cl20.cl b/clang/test/SemaOpenCL/storageclass-cl20.cl
8158index 581701d2a6a5..469c526ebc30 100644
8159--- a/clang/test/SemaOpenCL/storageclass-cl20.cl
8160+++ b/clang/test/SemaOpenCL/storageclass-cl20.cl
8161@@ -1,4 +1,5 @@
8162 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
8163+// 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
8164
8165 int G2 = 0;
8166 global int G3 = 0;
8167diff --git a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
8168index 41d33b550680..f50652493e5e 100644
8169--- a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
8170+++ b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
8171@@ -56,6 +56,7 @@
8172 //===----------------------------------------------------------------------===//
8173
8174 #include "TableGenBackends.h"
8175+#include "clang/Basic/OpenCLOptions.h"
8176 #include "llvm/ADT/MapVector.h"
8177 #include "llvm/ADT/STLExtras.h"
8178 #include "llvm/ADT/SmallString.h"
8179@@ -69,6 +70,7 @@
8180 #include "llvm/TableGen/Record.h"
8181 #include "llvm/TableGen/StringMatcher.h"
8182 #include "llvm/TableGen/TableGenBackend.h"
8183+#include <numeric>
8184 #include <set>
8185
8186 using namespace llvm;
8187@@ -228,6 +230,10 @@ private:
8188 // The function "tan", having the same signatures, would be mapped to the
8189 // same entry (<I1, I2, I3>).
8190 MapVector<BuiltinIndexListTy *, BuiltinTableEntries> SignatureListMap;
8191+
8192+ // Encode all versions
8193+ unsigned short
8194+ EncodeBuiltinVersions(std::vector<Record *> BuiltinVersionsRecords) const;
8195 };
8196 } // namespace
8197
8198@@ -338,12 +344,10 @@ struct OpenCLBuiltinStruct {
8199 const bool IsConst;
8200 // Function attribute __attribute__((convergent))
8201 const bool IsConv;
8202+ // All opencl versions encoded
8203+ const unsigned char AllVersions : 5;
8204 // OpenCL extension(s) required for this overload.
8205 const unsigned short Extension;
8206- // First OpenCL version in which this overload was introduced (e.g. CL20).
8207- const unsigned short MinVersion;
8208- // First OpenCL version in which this overload was removed (e.g. CL20).
8209- const unsigned short MaxVersion;
8210 };
8211
8212 )";
8213@@ -503,11 +507,9 @@ void BuiltinNameEmitter::EmitBuiltinTable() {
8214 << (Overload.first->getValueAsBit("IsPure")) << ", "
8215 << (Overload.first->getValueAsBit("IsConst")) << ", "
8216 << (Overload.first->getValueAsBit("IsConv")) << ", "
8217- << FunctionExtensionIndex[ExtName] << ", "
8218- << Overload.first->getValueAsDef("MinVersion")->getValueAsInt("ID")
8219- << ", "
8220- << Overload.first->getValueAsDef("MaxVersion")->getValueAsInt("ID")
8221- << " },\n";
8222+ << EncodeBuiltinVersions(
8223+ Overload.first->getValueAsListOfDefs("Versions"))
8224+ << ", " << FunctionExtensionIndex[ExtName] << " },\n";
8225 Index++;
8226 }
8227 }
8228@@ -528,10 +530,8 @@ bool BuiltinNameEmitter::CanReuseSignature(
8229 if (Rec->getValueAsBit("IsPure") == Rec2->getValueAsBit("IsPure") &&
8230 Rec->getValueAsBit("IsConst") == Rec2->getValueAsBit("IsConst") &&
8231 Rec->getValueAsBit("IsConv") == Rec2->getValueAsBit("IsConv") &&
8232- Rec->getValueAsDef("MinVersion")->getValueAsInt("ID") ==
8233- Rec2->getValueAsDef("MinVersion")->getValueAsInt("ID") &&
8234- Rec->getValueAsDef("MaxVersion")->getValueAsInt("ID") ==
8235- Rec2->getValueAsDef("MaxVersion")->getValueAsInt("ID") &&
8236+ EncodeBuiltinVersions(Rec->getValueAsListOfDefs("Versions")) ==
8237+ EncodeBuiltinVersions(Rec2->getValueAsListOfDefs("Versions")) &&
8238 Rec->getValueAsDef("Extension")->getName() ==
8239 Rec2->getValueAsDef("Extension")->getName()) {
8240 return true;
8241@@ -806,6 +806,15 @@ static void OCL2Qual(ASTContext &Context, const OpenCLTypeStruct &Ty,
8242 OS << "\n} // OCL2Qual\n";
8243 }
8244
8245+unsigned short BuiltinNameEmitter::EncodeBuiltinVersions(
8246+ std::vector<Record *> BuiltinVersionsRecords) const {
8247+ return std::accumulate(
8248+ BuiltinVersionsRecords.begin(), BuiltinVersionsRecords.end(),
8249+ (unsigned short)0, [](unsigned short C, Record *R) {
8250+ return C |= clang::OpenCLOptions::EncodeVersion(R->getValueAsInt("ID"));
8251+ });
8252+}
8253+
8254 void clang::EmitClangOpenCLBuiltins(RecordKeeper &Records, raw_ostream &OS) {
8255 BuiltinNameEmitter NameChecker(Records, OS);
8256 NameChecker.Emit();
8257--
82582.17.1
8259
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 @@
1From b53fd86ffdeacb9b13624bdb110fd25e8c35cb92 Mon Sep 17 00:00:00 2001
2From: Feng Zou <feng.zou@intel.com>
3Date: Mon, 19 Oct 2020 14:43:38 +0800
4Subject: [PATCH] Remove repo name in LLVM IR
5
6Upstream-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]
7Signed-off-by: Feng Zou <feng.zou@intel.com>
8Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
9
10---
11 llvm/cmake/modules/VersionFromVCS.cmake | 23 ++++++++++++-----------
12 1 file changed, 12 insertions(+), 11 deletions(-)
13
14diff --git a/llvm/cmake/modules/VersionFromVCS.cmake b/llvm/cmake/modules/VersionFromVCS.cmake
15index 1b6519b4b7c..8fd6b23bb34 100644
16--- a/llvm/cmake/modules/VersionFromVCS.cmake
17+++ b/llvm/cmake/modules/VersionFromVCS.cmake
18@@ -33,17 +33,18 @@ function(get_source_info path revision repository)
19 else()
20 set(remote "origin")
21 endif()
22- execute_process(COMMAND ${GIT_EXECUTABLE} remote get-url ${remote}
23- WORKING_DIRECTORY ${path}
24- RESULT_VARIABLE git_result
25- OUTPUT_VARIABLE git_output
26- ERROR_QUIET)
27- if(git_result EQUAL 0)
28- string(STRIP "${git_output}" git_output)
29- set(${repository} ${git_output} PARENT_SCOPE)
30- else()
31- set(${repository} ${path} PARENT_SCOPE)
32- endif()
33+ # Do not show repo name in IR
34+ # execute_process(COMMAND ${GIT_EXECUTABLE} remote get-url ${remote}
35+ # WORKING_DIRECTORY ${path}
36+ # RESULT_VARIABLE git_result
37+ # OUTPUT_VARIABLE git_output
38+ # ERROR_QUIET)
39+ # if(git_result EQUAL 0)
40+ # string(STRIP "${git_output}" git_output)
41+ # set(${repository} ${git_output} PARENT_SCOPE)
42+ # else()
43+ # set(${repository} ${path} PARENT_SCOPE)
44+ # endif()
45 endif()
46 endif()
47 endfunction()
48--
492.18.1
50
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 @@
1From 455ce9c25df5313f4a6649cc27075bdfbe25af18 Mon Sep 17 00:00:00 2001
2From: Naveen Saini <naveen.kumar.saini@intel.com>
3Date: Wed, 21 Aug 2019 14:35:31 +0800
4Subject: [PATCH] llvm-spirv: skip building tests
5
6Some of these need clang to be built and since we're building this in-tree,
7that leads to problems when compiling libcxx, compiler-rt which aren't built
8in-tree.
9
10Instead of using SPIRV_SKIP_CLANG_BUILD to skip clang build and adding this to
11all components, disable the building of tests altogether.
12
13Upstream-Status: Inappropriate
14
15Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
16Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
17---
18 CMakeLists.txt | 10 ----------
19 1 file changed, 10 deletions(-)
20
21diff --git a/CMakeLists.txt b/CMakeLists.txt
22index b718c00..9805140 100644
23--- a/CMakeLists.txt
24+++ b/CMakeLists.txt
25@@ -24,13 +24,6 @@ if(LLVM_SPIRV_BUILD_EXTERNAL)
26 set(CMAKE_CXX_STANDARD 14)
27 set(CMAKE_CXX_STANDARD_REQUIRED ON)
28
29- if(LLVM_SPIRV_INCLUDE_TESTS)
30- set(LLVM_TEST_COMPONENTS
31- llvm-as
32- llvm-dis
33- )
34- endif(LLVM_SPIRV_INCLUDE_TESTS)
35-
36 find_package(LLVM 10.0.0 REQUIRED
37 COMPONENTS
38 Analysis
39@@ -61,9 +54,6 @@ set(LLVM_SPIRV_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
40
41 add_subdirectory(lib/SPIRV)
42 add_subdirectory(tools/llvm-spirv)
43-if(LLVM_SPIRV_INCLUDE_TESTS)
44- add_subdirectory(test)
45-endif(LLVM_SPIRV_INCLUDE_TESTS)
46
47 install(
48 FILES
49--
502.7.4
51
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 @@
1From d767afa79d1c8153081eac1ef33e348cadbea5bb Mon Sep 17 00:00:00 2001
2From: Anton Zabaznov <anton.zabaznov@intel.com>
3Date: Tue, 22 Sep 2020 19:03:50 +0300
4Subject: [PATCH] OpenCL 3.0 support
5
6Upstream-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]
7Signed-off-by: Anton Zabaznov <anton.zabaznov@intel.com>
8Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
9
10
11---
12 clang/include/clang/Basic/Builtins.def | 65 +-
13 clang/include/clang/Basic/Builtins.h | 13 +-
14 .../clang/Basic/DiagnosticParseKinds.td | 2 +
15 .../clang/Basic/DiagnosticSemaKinds.td | 7 +
16 clang/include/clang/Basic/LangOptions.def | 2 +
17 clang/include/clang/Basic/LangStandards.def | 4 +
18 .../include/clang/Basic/OpenCLExtensions.def | 15 +
19 clang/include/clang/Basic/OpenCLOptions.h | 174 +-
20 clang/include/clang/Driver/Options.td | 2 +-
21 clang/include/clang/Sema/Sema.h | 9 +
22 clang/lib/AST/ASTContext.cpp | 3 +-
23 clang/lib/Basic/Builtins.cpp | 28 +-
24 clang/lib/Basic/TargetInfo.cpp | 11 +
25 clang/lib/Basic/Targets.cpp | 1 -
26 clang/lib/CodeGen/CodeGenFunction.cpp | 6 +-
27 clang/lib/Frontend/CompilerInvocation.cpp | 22 +-
28 clang/lib/Frontend/InitPreprocessor.cpp | 6 +-
29 clang/lib/Headers/opencl-c-base.h | 75 +-
30 clang/lib/Headers/opencl-c.h | 3216 ++++++++++++++---
31 clang/lib/Parse/ParseDecl.cpp | 12 +-
32 clang/lib/Parse/ParsePragma.cpp | 10 +-
33 clang/lib/Sema/OpenCLBuiltins.td | 153 +-
34 clang/lib/Sema/Sema.cpp | 47 +-
35 clang/lib/Sema/SemaChecking.cpp | 38 +-
36 clang/lib/Sema/SemaDecl.cpp | 18 +-
37 clang/lib/Sema/SemaDeclAttr.cpp | 9 +-
38 clang/lib/Sema/SemaDeclCXX.cpp | 12 +-
39 clang/lib/Sema/SemaLookup.cpp | 19 +-
40 clang/lib/Sema/SemaType.cpp | 14 +-
41 .../CodeGenOpenCL/addr-space-struct-arg.cl | 7 +-
42 .../address-spaces-conversions.cl | 2 +
43 .../CodeGenOpenCL/address-spaces-mangling.cl | 3 +-
44 clang/test/CodeGenOpenCL/address-spaces.cl | 4 +
45 .../amdgcn-automatic-variable.cl | 1 +
46 .../CodeGenOpenCL/amdgpu-sizeof-alignof.cl | 21 +-
47 .../CodeGenOpenCL/arm-integer-dot-product.cl | 1 +
48 .../test/CodeGenOpenCL/cl-uniform-wg-size.cl | 2 +
49 clang/test/CodeGenOpenCL/fpmath.cl | 2 +
50 .../generic-address-space-feature.cl | 28 +
51 .../intel-subgroups-avc-ext-types.cl | 1 +
52 .../kernels-have-spir-cc-by-default.cl | 3 +
53 clang/test/CodeGenOpenCL/logical-ops.cl | 1 +
54 clang/test/CodeGenOpenCL/no-half.cl | 1 +
55 clang/test/CodeGenOpenCL/pipe_builtin.cl | 3 +
56 clang/test/CodeGenOpenCL/pipe_types.cl | 1 +
57 clang/test/CodeGenOpenCL/printf.cl | 2 +
58 clang/test/CodeGenOpenCL/unroll-hint.cl | 1 +
59 clang/test/Driver/autocomplete.c | 2 +
60 clang/test/Driver/opencl.cl | 2 +
61 clang/test/Driver/unknown-std.cl | 1 +
62 clang/test/Frontend/stdlang.c | 1 +
63 clang/test/Headers/opencl-c-header.cl | 7 +-
64 clang/test/Index/pipe-size.cl | 7 +
65 clang/test/Preprocessor/init-aarch64.c | 12 +-
66 clang/test/Preprocessor/predefined-macros.c | 13 +
67 .../Sema/feature-extensions-simult-support.cl | 75 +
68 clang/test/Sema/features-ignore-pragma.cl | 24 +
69 clang/test/Sema/opencl-features-pipes.cl | 18 +
70 clang/test/Sema/opencl-features.cl | 128 +
71 clang/test/Sema/pipe_builtins_feature.cl | 21 +
72 .../address-spaces-conversions-cl2.0.cl | 3 +
73 clang/test/SemaOpenCL/address-spaces.cl | 1 +
74 .../SemaOpenCL/cl20-device-side-enqueue.cl | 16 +-
75 .../SemaOpenCL/forget-unsupported-builtins.cl | 22 +
76 clang/test/SemaOpenCL/image-features.cl | 20 +
77 .../SemaOpenCL/invalid-pipe-builtin-cl2.0.cl | 1 +
78 clang/test/SemaOpenCL/storageclass-cl20.cl | 1 +
79 .../TableGen/ClangOpenCLBuiltinEmitter.cpp | 35 +-
80 68 files changed, 3749 insertions(+), 738 deletions(-)
81 create mode 100644 clang/test/CodeGenOpenCL/generic-address-space-feature.cl
82 create mode 100644 clang/test/Sema/feature-extensions-simult-support.cl
83 create mode 100644 clang/test/Sema/features-ignore-pragma.cl
84 create mode 100644 clang/test/Sema/opencl-features-pipes.cl
85 create mode 100644 clang/test/Sema/opencl-features.cl
86 create mode 100644 clang/test/Sema/pipe_builtins_feature.cl
87 create mode 100644 clang/test/SemaOpenCL/forget-unsupported-builtins.cl
88 create mode 100644 clang/test/SemaOpenCL/image-features.cl
89
90diff --git a/clang/include/clang/Basic/Builtins.def b/clang/include/clang/Basic/Builtins.def
91index 5463b7dfc18c..e094beab9a6c 100644
92--- a/clang/include/clang/Basic/Builtins.def
93+++ b/clang/include/clang/Basic/Builtins.def
94@@ -111,6 +111,10 @@
95 # define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
96 #endif
97
98+#if defined(BUILTIN) && !defined(OPENCLBUILTIN)
99+# define OPENCLBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG, FEATURE) BUILTIN(ID, TYPE, ATTRS)
100+#endif
101+
102 // Standard libc/libm functions:
103 BUILTIN(__builtin_atan2 , "ddd" , "Fne")
104 BUILTIN(__builtin_atan2f, "fff" , "Fne")
105@@ -1529,50 +1533,54 @@ BUILTIN(__builtin_coro_param, "bv*v*", "n")
106
107 // OpenCL v2.0 s6.13.16, s9.17.3.5 - Pipe functions.
108 // We need the generic prototype, since the packet type could be anything.
109-LANGBUILTIN(read_pipe, "i.", "tn", OCLC20_LANG)
110-LANGBUILTIN(write_pipe, "i.", "tn", OCLC20_LANG)
111+OPENCLBUILTIN(read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
112+OPENCLBUILTIN(write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
113
114-LANGBUILTIN(reserve_read_pipe, "i.", "tn", OCLC20_LANG)
115-LANGBUILTIN(reserve_write_pipe, "i.", "tn", OCLC20_LANG)
116+OPENCLBUILTIN(reserve_read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
117+OPENCLBUILTIN(reserve_write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
118
119-LANGBUILTIN(commit_write_pipe, "v.", "tn", OCLC20_LANG)
120-LANGBUILTIN(commit_read_pipe, "v.", "tn", OCLC20_LANG)
121+OPENCLBUILTIN(commit_write_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
122+OPENCLBUILTIN(commit_read_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
123
124-LANGBUILTIN(sub_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG)
125-LANGBUILTIN(sub_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG)
126+OPENCLBUILTIN(sub_group_reserve_read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
127+OPENCLBUILTIN(sub_group_reserve_write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
128
129-LANGBUILTIN(sub_group_commit_read_pipe, "v.", "tn", OCLC20_LANG)
130-LANGBUILTIN(sub_group_commit_write_pipe, "v.", "tn", OCLC20_LANG)
131+OPENCLBUILTIN(sub_group_commit_read_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
132+OPENCLBUILTIN(sub_group_commit_write_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
133
134-LANGBUILTIN(work_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG)
135-LANGBUILTIN(work_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG)
136+OPENCLBUILTIN(work_group_reserve_read_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
137+OPENCLBUILTIN(work_group_reserve_write_pipe, "i.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
138
139-LANGBUILTIN(work_group_commit_read_pipe, "v.", "tn", OCLC20_LANG)
140-LANGBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCLC20_LANG)
141+OPENCLBUILTIN(work_group_commit_read_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
142+OPENCLBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
143
144-LANGBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC20_LANG)
145-LANGBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC20_LANG)
146+OPENCLBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
147+OPENCLBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC2P_LANG, "__opencl_c_pipes")
148
149 // OpenCL v2.0 s6.13.17 - Enqueue kernel functions.
150 // Custom builtin check allows to perform special check of passed block arguments.
151-LANGBUILTIN(enqueue_kernel, "i.", "tn", OCLC20_LANG)
152-LANGBUILTIN(get_kernel_work_group_size, "Ui.", "tn", OCLC20_LANG)
153-LANGBUILTIN(get_kernel_preferred_work_group_size_multiple, "Ui.", "tn", OCLC20_LANG)
154-LANGBUILTIN(get_kernel_max_sub_group_size_for_ndrange, "Ui.", "tn", OCLC20_LANG)
155-LANGBUILTIN(get_kernel_sub_group_count_for_ndrange, "Ui.", "tn", OCLC20_LANG)
156+OPENCLBUILTIN(enqueue_kernel, "i.", "tn", OCLC2P_LANG,
157+ "__opencl_c_device_enqueue")
158+OPENCLBUILTIN(get_kernel_work_group_size, "Ui.", "tn", OCLC2P_LANG,
159+ "__opencl_c_device_enqueue")
160+OPENCLBUILTIN(get_kernel_preferred_work_group_size_multiple, "Ui.", "tn",
161+ OCLC2P_LANG, "__opencl_c_device_enqueue")
162+OPENCLBUILTIN(get_kernel_max_sub_group_size_for_ndrange, "Ui.", "tn",
163+ OCLC2P_LANG, "__opencl_c_device_enqueue")
164+OPENCLBUILTIN(get_kernel_sub_group_count_for_ndrange, "Ui.", "tn", OCLC2P_LANG, "__opencl_c_device_enqueue")
165
166 // OpenCL v2.0 s6.13.9 - Address space qualifier functions.
167 // FIXME: Pointer parameters of OpenCL builtins should have their address space
168 // requirement defined.
169-LANGBUILTIN(to_global, "v*v*", "tn", OCLC20_LANG)
170-LANGBUILTIN(to_local, "v*v*", "tn", OCLC20_LANG)
171-LANGBUILTIN(to_private, "v*v*", "tn", OCLC20_LANG)
172+OPENCLBUILTIN(to_global, "v*v*", "tn", OCLC2P_LANG, "__opencl_c_generic_address_space")
173+OPENCLBUILTIN(to_local, "v*v*", "tn", OCLC2P_LANG, "__opencl_c_generic_address_space")
174+OPENCLBUILTIN(to_private, "v*v*", "tn", OCLC2P_LANG, "__opencl_c_generic_address_space")
175
176 // OpenCL half load/store builtin
177-LANGBUILTIN(__builtin_store_half, "vdh*", "n", ALL_OCLC_LANGUAGES)
178-LANGBUILTIN(__builtin_store_halff, "vfh*", "n", ALL_OCLC_LANGUAGES)
179-LANGBUILTIN(__builtin_load_half, "dhC*", "nc", ALL_OCLC_LANGUAGES)
180-LANGBUILTIN(__builtin_load_halff, "fhC*", "nc", ALL_OCLC_LANGUAGES)
181+OPENCLBUILTIN(__builtin_store_half, "vdh*", "n", ALL_OCLC_LANGUAGES, "")
182+OPENCLBUILTIN(__builtin_store_halff, "vfh*", "n", ALL_OCLC_LANGUAGES, "")
183+OPENCLBUILTIN(__builtin_load_half, "dhC*", "nc", ALL_OCLC_LANGUAGES, "")
184+OPENCLBUILTIN(__builtin_load_halff, "fhC*", "nc", ALL_OCLC_LANGUAGES, "")
185
186 // Builtins for os_log/os_trace
187 BUILTIN(__builtin_os_log_format_buffer_size, "zcC*.", "p:0:nut")
188@@ -1593,3 +1601,4 @@ BUILTIN(__builtin_ms_va_copy, "vc*&c*&", "n")
189 #undef BUILTIN
190 #undef LIBBUILTIN
191 #undef LANGBUILTIN
192+#undef OPENCLBUILTIN
193diff --git a/clang/include/clang/Basic/Builtins.h b/clang/include/clang/Basic/Builtins.h
194index 15bfcf797917..ba3e7853444c 100644
195--- a/clang/include/clang/Basic/Builtins.h
196+++ b/clang/include/clang/Basic/Builtins.h
197@@ -33,13 +33,13 @@ enum LanguageID {
198 CXX_LANG = 0x4, // builtin for cplusplus only.
199 OBJC_LANG = 0x8, // builtin for objective-c and objective-c++
200 MS_LANG = 0x10, // builtin requires MS mode.
201- OCLC20_LANG = 0x20, // builtin for OpenCL C 2.0 only.
202+ OCLC2P_LANG = 0x20, // builtin for OpenCL C 2.0+ versions.
203 OCLC1X_LANG = 0x40, // builtin for OpenCL C 1.x only.
204 OMP_LANG = 0x80, // builtin requires OpenMP.
205 ALL_LANGUAGES = C_LANG | CXX_LANG | OBJC_LANG, // builtin for all languages.
206 ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG, // builtin requires GNU mode.
207 ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG, // builtin requires MS mode.
208- ALL_OCLC_LANGUAGES = OCLC1X_LANG | OCLC20_LANG // builtin for OCLC languages.
209+ ALL_OCLC_LANGUAGES = OCLC1X_LANG | OCLC2P_LANG // builtin for OCLC languages.
210 };
211
212 namespace Builtin {
213@@ -235,6 +235,10 @@ public:
214 /// for non-builtins.
215 bool canBeRedeclared(unsigned ID) const;
216
217+ bool requiresFeatures(unsigned ID) const {
218+ return requiresFeatures(getRecord(ID));
219+ }
220+
221 private:
222 const Info &getRecord(unsigned ID) const;
223
224@@ -242,6 +246,11 @@ private:
225 bool builtinIsSupported(const Builtin::Info &BuiltinInfo,
226 const LangOptions &LangOpts);
227
228+ bool OclBuiltinIsSupported(const Builtin::Info &BuiltinInfo,
229+ const LangOptions &LangOpts) const;
230+
231+ bool requiresFeatures(const Builtin::Info &BuiltinInfo) const;
232+
233 /// Helper function for isPrintfLike and isScanfLike.
234 bool isLike(unsigned ID, unsigned &FormatIdx, bool &HasVAListArg,
235 const char *Fmt) const;
236diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
237index 1038a4119d4c..ba1b1b67a131 100644
238--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
239+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
240@@ -1206,6 +1206,8 @@ def warn_pragma_unsupported_extension : Warning<
241 "unsupported OpenCL extension %0 - ignoring">, InGroup<IgnoredPragmas>;
242 def warn_pragma_extension_is_core : Warning<
243 "OpenCL extension %0 is core feature or supported optional core feature - ignoring">, InGroup<DiagGroup<"pedantic-core-features">>, DefaultIgnore;
244+def warn_opencl_pragma_feature_ignore : Warning<
245+ "OpenCL feature support can't be controlled via pragma, ignoring">, InGroup<IgnoredPragmas>;
246
247 // OpenCL errors.
248 def err_opencl_taking_function_address_parser : Error<
249diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
250index 941f2cafc372..aa9e8b7b011b 100644
251--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
252+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
253@@ -9741,6 +9741,13 @@ def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
254 def err_openclcxx_placement_new : Error<
255 "use of placement new requires explicit declaration">;
256
257+def err_opencl_pipes_require_feat : Error<
258+ "usage of OpenCL pipes requires feature support">;
259+def err_opencl_memory_scope_require_feat : Error<
260+ "usage of memory scope requires feature support">;
261+def err_opencl_memory_ordering_require_feat : Error<
262+ "usage of memory ordering requires feature support">;
263+
264 // MIG routine annotations.
265 def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
266 "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
267diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def
268index 70f68d664bb7..e683f5956975 100644
269--- a/clang/include/clang/Basic/LangOptions.def
270+++ b/clang/include/clang/Basic/LangOptions.def
271@@ -215,6 +215,8 @@ LANGOPT(OpenCL , 1, 0, "OpenCL")
272 LANGOPT(OpenCLVersion , 32, 0, "OpenCL C version")
273 LANGOPT(OpenCLCPlusPlus , 1, 0, "C++ for OpenCL")
274 LANGOPT(OpenCLCPlusPlusVersion , 32, 0, "C++ for OpenCL version")
275+LANGOPT(OpenCLGenericKeyword , 1, 0, "OpenCL generic keyword")
276+LANGOPT(OpenCLPipeKeyword , 1, 0, "OpenCL pipe keyword")
277 LANGOPT(NativeHalfType , 1, 0, "Native half type support")
278 LANGOPT(NativeHalfArgsAndReturns, 1, 0, "Native half args and returns")
279 LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns")
280diff --git a/clang/include/clang/Basic/LangStandards.def b/clang/include/clang/Basic/LangStandards.def
281index b09568e8b3e8..7b915c312746 100644
282--- a/clang/include/clang/Basic/LangStandards.def
283+++ b/clang/include/clang/Basic/LangStandards.def
284@@ -167,6 +167,9 @@ LANGSTANDARD(opencl12, "cl1.2",
285 LANGSTANDARD(opencl20, "cl2.0",
286 OpenCL, "OpenCL 2.0",
287 LineComment | C99 | Digraphs | HexFloat | OpenCL)
288+LANGSTANDARD(opencl30, "cl3.0",
289+ OpenCL, "OpenCL 3.0",
290+ LineComment | C99 | Digraphs | HexFloat | OpenCL)
291 LANGSTANDARD(openclcpp, "clc++",
292 OpenCL, "C++ for OpenCL",
293 LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
294@@ -176,6 +179,7 @@ LANGSTANDARD_ALIAS_DEPR(opencl10, "CL")
295 LANGSTANDARD_ALIAS_DEPR(opencl11, "CL1.1")
296 LANGSTANDARD_ALIAS_DEPR(opencl12, "CL1.2")
297 LANGSTANDARD_ALIAS_DEPR(opencl20, "CL2.0")
298+LANGSTANDARD_ALIAS_DEPR(opencl30, "CL3.0")
299 LANGSTANDARD_ALIAS_DEPR(openclcpp, "CLC++")
300
301 // CUDA
302diff --git a/clang/include/clang/Basic/OpenCLExtensions.def b/clang/include/clang/Basic/OpenCLExtensions.def
303index 1ae36b32fb0a..d1574164f9b2 100644
304--- a/clang/include/clang/Basic/OpenCLExtensions.def
305+++ b/clang/include/clang/Basic/OpenCLExtensions.def
306@@ -100,6 +100,21 @@ OPENCLEXT_INTERNAL(cl_intel_subgroups, 120, ~0U)
307 OPENCLEXT_INTERNAL(cl_intel_subgroups_short, 120, ~0U)
308 OPENCLEXT_INTERNAL(cl_intel_device_side_avc_motion_estimation, 120, ~0U)
309
310+OPENCLEXT_INTERNAL(__opencl_c_pipes, 200, ~0U)
311+OPENCLEXT_INTERNAL(__opencl_c_generic_address_space, 200, ~0U)
312+OPENCLEXT_INTERNAL(__opencl_c_work_group_collective_functions, 200, ~0U)
313+OPENCLEXT_INTERNAL(__opencl_c_atomic_order_acq_rel, 200, ~0U)
314+OPENCLEXT_INTERNAL(__opencl_c_atomic_order_seq_cst, 200, ~0U)
315+OPENCLEXT_INTERNAL(__opencl_c_atomic_scope_device, 200, ~0U)
316+OPENCLEXT_INTERNAL(__opencl_c_atomic_scope_all_devices, 200, ~0U)
317+OPENCLEXT_INTERNAL(__opencl_c_subgroups, 200, ~0U)
318+OPENCLEXT_INTERNAL(__opencl_c_3d_image_writes, 100, ~0U)
319+OPENCLEXT_INTERNAL(__opencl_c_device_enqueue, 200, ~0U)
320+OPENCLEXT_INTERNAL(__opencl_c_read_write_images, 200, ~0U)
321+OPENCLEXT_INTERNAL(__opencl_c_program_scope_global_variables, 200, ~0U)
322+OPENCLEXT_INTERNAL(__opencl_c_fp64, 120, ~0U)
323+OPENCLEXT_INTERNAL(__opencl_c_int64, 100, ~0U)
324+OPENCLEXT_INTERNAL(__opencl_c_images, 100, ~0U)
325 #undef OPENCLEXT_INTERNAL
326
327 #ifdef OPENCLEXT
328diff --git a/clang/include/clang/Basic/OpenCLOptions.h b/clang/include/clang/Basic/OpenCLOptions.h
329index 15661154eab5..d5800f5611c6 100644
330--- a/clang/include/clang/Basic/OpenCLOptions.h
331+++ b/clang/include/clang/Basic/OpenCLOptions.h
332@@ -21,6 +21,10 @@ namespace clang {
333
334 /// OpenCL supported extensions and optional core features
335 class OpenCLOptions {
336+ // OpenCL Version
337+ unsigned CLVer = 120;
338+ bool IsOpenCLCPlusPlus = false;
339+
340 struct Info {
341 bool Supported; // Is this option supported
342 bool Enabled; // Is this option enabled
343@@ -31,7 +35,38 @@ class OpenCLOptions {
344 :Supported(S), Enabled(E), Avail(A), Core(C){}
345 };
346 llvm::StringMap<Info> OptMap;
347+
348 public:
349+ void setOpenCLVersion(const LangOptions &LO) {
350+ IsOpenCLCPlusPlus = LO.OpenCLCPlusPlus;
351+ CLVer = IsOpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
352+ }
353+
354+ // Get extension which is semantically equivalent to a given feature
355+ // if exists (e.g. __opencl_c_subgroups -> cl_khr_subgroups)
356+ llvm::Optional<StringRef> getEquivalentExtension(StringRef Feature) const {
357+ return llvm::StringSwitch<llvm::Optional<StringRef>>(Feature)
358+ .Case("__opencl_c_3d_image_writes",
359+ Optional<StringRef>("cl_khr_3d_image_writes"))
360+ .Case("__opencl_c_subgroups", Optional<StringRef>("cl_khr_subgroups"))
361+ .Case("__opencl_c_fp64", Optional<StringRef>("cl_khr_fp64"))
362+ .Default(Optional<StringRef>());
363+ }
364+
365+ // Same as above but for extensions
366+ llvm::Optional<StringRef> getEquivalentFeature(StringRef Extension) const {
367+ return llvm::StringSwitch<llvm::Optional<StringRef>>(Extension)
368+ .Case("cl_khr_3d_image_writes",
369+ Optional<StringRef>("__opencl_c_3d_image_writes"))
370+ .Case("cl_khr_subgroups", Optional<StringRef>("__opencl_c_subgroups"))
371+ .Case("cl_khr_fp64", Optional<StringRef>("__opencl_c_fp64"))
372+ .Default(Optional<StringRef>());
373+ }
374+
375+ bool isFeature(llvm::StringRef Ext) const {
376+ return Ext.startswith("__opencl_c");
377+ }
378+
379 bool isKnown(llvm::StringRef Ext) const {
380 return OptMap.find(Ext) != OptMap.end();
381 }
382@@ -42,32 +77,88 @@ public:
383
384 // Is supported as either an extension or an (optional) core feature for
385 // OpenCL version \p CLVer.
386- bool isSupported(llvm::StringRef Ext, const LangOptions &LO) const {
387+ bool isSupported(llvm::StringRef Ext) const {
388 // In C++ mode all extensions should work at least as in v2.0.
389- auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
390 auto I = OptMap.find(Ext)->getValue();
391 return I.Supported && I.Avail <= CLVer;
392 }
393
394 // Is supported (optional) OpenCL core features for OpenCL version \p CLVer.
395 // For supported extension, return false.
396- bool isSupportedCore(llvm::StringRef Ext, const LangOptions &LO) const {
397+ bool isSupportedCore(llvm::StringRef Ext) const {
398 // In C++ mode all extensions should work at least as in v2.0.
399- auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
400 auto I = OptMap.find(Ext)->getValue();
401 return I.Supported && I.Avail <= CLVer && I.Core != ~0U && CLVer >= I.Core;
402 }
403
404 // Is supported OpenCL extension for OpenCL version \p CLVer.
405 // For supported (optional) core feature, return false.
406- bool isSupportedExtension(llvm::StringRef Ext, const LangOptions &LO) const {
407+ bool isSupportedExtension(llvm::StringRef Ext) const {
408 // In C++ mode all extensions should work at least as in v2.0.
409- auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
410 auto I = OptMap.find(Ext)->getValue();
411 return I.Supported && I.Avail <= CLVer && (I.Core == ~0U || CLVer < I.Core);
412 }
413
414+ // Support features whose support is directly related to the
415+ // specific OpenCL version. For example, OpenCL 2.0 supports
416+ // all features that are optional in 3.0
417+ void adjustFeatures() {
418+ // Support int64 by default (assume compiling for FULL profile)
419+ OptMap["__opencl_c_int64"].Supported = true;
420+
421+ if (CLVer >= 300) {
422+ // Simultaneously support extension and corresponding feature
423+ for (llvm::StringRef F :
424+ {"__opencl_c_subgroups", "__opencl_c_3d_image_writes",
425+ "__opencl_c_fp64"}) {
426+ auto Ext = getEquivalentExtension(F);
427+ OptMap[*Ext].Supported = OptMap[F].Supported;
428+ }
429+
430+ // OpenCL C compilers that define the feature macro __opencl_c_pipes or
431+ // or __opencl_c_device_enqueue must also define the
432+ // feature macro __opencl_c_generic_address_space.
433+ if (OptMap["__opencl_c_pipes"].Supported ||
434+ OptMap["__opencl_c_device_enqueue"].Supported)
435+ OptMap["__opencl_c_generic_address_space"].Supported = true;
436+
437+ // OpenCL C compilers that define the feature macro
438+ // __opencl_c_3d_image_writes or __opencl_c_read_write_images must also
439+ // define the feature macro __opencl_c_images
440+ if (OptMap["__opencl_c_3d_image_writes"].Supported ||
441+ OptMap["__opencl_c_read_write_images"].Supported)
442+ OptMap["__opencl_c_images"].Supported = true;
443+
444+ // All other features are already supported with options
445+ // or in target settings
446+ return;
447+ }
448+
449+ auto FeaturesRange = llvm::make_filter_range(
450+ OptMap, [&](llvm::StringMapEntry<Info> &OptVal) {
451+ auto Opt = OptVal.getKey();
452+ return isFeature(Opt);
453+ });
454+
455+ for (auto &It : FeaturesRange) {
456+ auto &Info = It.getValue();
457+ // For OpenCL version less then 3.0 some
458+ // features should be supported simulateneously
459+ // with specific extension
460+ if (Optional<llvm::StringRef> Ext = getEquivalentExtension(It.getKey()))
461+ Info.Supported = Info.Enabled = OptMap[*Ext].Supported;
462+ else if (Info.Avail <= CLVer)
463+ Info.Supported = Info.Enabled = true;
464+ }
465+ }
466+
467 void enable(llvm::StringRef Ext, bool V = true) {
468+ // Ignore disabling extensions if corresponding features
469+ // already supported for OpenCL version higher then 3.0
470+ if (CLVer >= 300)
471+ if (Optional<llvm::StringRef> F = getEquivalentFeature(Ext))
472+ if (V != OptMap[*F].Enabled)
473+ return;
474 OptMap[Ext].Enabled = V;
475 }
476
477@@ -96,7 +187,7 @@ public:
478 OptMap[Ext].Supported = V;
479 }
480
481- OpenCLOptions(){
482+ OpenCLOptions() {
483 #define OPENCLEXT_INTERNAL(Ext, AvailVer, CoreVer) \
484 OptMap[#Ext].Avail = AvailVer; \
485 OptMap[#Ext].Core = CoreVer;
486@@ -104,35 +195,86 @@ public:
487 }
488
489 void addSupport(const OpenCLOptions &Opts) {
490+ assert(IsOpenCLCPlusPlus == Opts.IsOpenCLCPlusPlus && CLVer == Opts.CLVer);
491 for (auto &I:Opts.OptMap)
492- if (I.second.Supported)
493+ if (I.second.Supported) {
494 OptMap[I.getKey()].Supported = true;
495+ // All features are enabled as they are supported
496+ if (isFeature(I.getKey()))
497+ OptMap[I.getKey()].Enabled = true;
498+ }
499+ if (CLVer >= 300) {
500+ // Enabling extensions with respect to features
501+ for (llvm::StringRef Ext :
502+ {"cl_khr_3d_image_writes", "cl_khr_subgroups", "cl_khr_fp64"}) {
503+ auto Feature = getEquivalentFeature(Ext);
504+ enable(Ext, OptMap[*Feature].Enabled);
505+ }
506+ }
507 }
508
509 void copy(const OpenCLOptions &Opts) {
510+ CLVer = Opts.CLVer;
511+ IsOpenCLCPlusPlus = Opts.IsOpenCLCPlusPlus;
512 OptMap = Opts.OptMap;
513 }
514
515 // Turn on or off support of all options.
516 void supportAll(bool On = true) {
517- for (llvm::StringMap<Info>::iterator I = OptMap.begin(),
518- E = OptMap.end(); I != E; ++I)
519- I->second.Supported = On;
520+ for (llvm::StringMap<Info>::iterator I = OptMap.begin(), E = OptMap.end();
521+ I != E; ++I)
522+ if (!isFeature(I->getKey()))
523+ I->second.Supported = On;
524 }
525
526 void disableAll() {
527- for (llvm::StringMap<Info>::iterator I = OptMap.begin(),
528- E = OptMap.end(); I != E; ++I)
529- I->second.Enabled = false;
530+ for (llvm::StringMap<Info>::iterator I = OptMap.begin(), E = OptMap.end();
531+ I != E; ++I) {
532+ auto Ext = I->getKey();
533+ if (!isFeature(Ext))
534+ enable(Ext, false);
535+ }
536 }
537
538- void enableSupportedCore(LangOptions LO) {
539+ void enableSupportedCore() {
540 for (llvm::StringMap<Info>::iterator I = OptMap.begin(), E = OptMap.end();
541 I != E; ++I)
542- if (isSupportedCore(I->getKey(), LO))
543+ if (isSupportedCore(I->getKey()))
544 I->second.Enabled = true;
545 }
546
547+ // This enum specifies how OpenCL versions map into values
548+ // for encoding. This is used when generating built-ins
549+ // from tablegen
550+ enum OpenCLVersionsEncodings : unsigned short {
551+ OPENCL_C_100_CODE = 0x1,
552+ OPENCL_C_110_CODE = 0x2,
553+ OPENCL_C_120_CODE = 0x4,
554+ OPENCL_C_200_CODE = 0x8,
555+ OPENCL_C_300_CODE = 0x10,
556+ OPENCL_C_ALL_CODE = 0x1f
557+ };
558+
559+ // Encode version into single integer
560+ static unsigned short EncodeVersion(unsigned OpenCLVersion) {
561+ switch (OpenCLVersion) {
562+ default:
563+ llvm_unreachable("Unknown OpenCL version");
564+ case 0:
565+ return OpenCLVersionsEncodings::OPENCL_C_ALL_CODE;
566+ case 100:
567+ return OpenCLVersionsEncodings::OPENCL_C_100_CODE;
568+ case 110:
569+ return OpenCLVersionsEncodings::OPENCL_C_110_CODE;
570+ case 120:
571+ return OpenCLVersionsEncodings::OPENCL_C_120_CODE;
572+ case 200:
573+ return OpenCLVersionsEncodings::OPENCL_C_200_CODE;
574+ case 300:
575+ return OpenCLVersionsEncodings::OPENCL_C_300_CODE;
576+ }
577+ }
578+
579 friend class ASTWriter;
580 friend class ASTReader;
581 };
582diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
583index 966cb907b7e2..62536f2470c2 100644
584--- a/clang/include/clang/Driver/Options.td
585+++ b/clang/include/clang/Driver/Options.td
586@@ -557,7 +557,7 @@ def cl_mad_enable : Flag<["-"], "cl-mad-enable">, Group<opencl_Group>, Flags<[CC
587 def cl_no_signed_zeros : Flag<["-"], "cl-no-signed-zeros">, Group<opencl_Group>, Flags<[CC1Option]>,
588 HelpText<"OpenCL only. Allow use of less precise no signed zeros computations in the generated binary.">;
589 def cl_std_EQ : Joined<["-"], "cl-std=">, Group<opencl_Group>, Flags<[CC1Option]>,
590- HelpText<"OpenCL language standard to compile for.">, Values<"cl,CL,cl1.1,CL1.1,cl1.2,CL1.2,cl2.0,CL2.0,clc++,CLC++">;
591+ 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++">;
592 def cl_denorms_are_zero : Flag<["-"], "cl-denorms-are-zero">, Group<opencl_Group>,
593 HelpText<"OpenCL only. Allow denormals to be flushed to zero.">;
594 def cl_fp32_correctly_rounded_divide_sqrt : Flag<["-"], "cl-fp32-correctly-rounded-divide-sqrt">, Group<opencl_Group>, Flags<[CC1Option]>,
595diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
596index 16a7084f6b08..5920c27229d8 100644
597--- a/clang/include/clang/Sema/Sema.h
598+++ b/clang/include/clang/Sema/Sema.h
599@@ -9930,6 +9930,10 @@ public:
600 /// \return true if type is disabled.
601 bool checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E);
602
603+ bool checkOpenCLSubgroupExtForCallExpr(CallExpr *Call);
604+
605+ bool isSupportedOpenCLOMemoryOrdering(int64_t Ordering) const;
606+
607 //===--------------------------------------------------------------------===//
608 // OpenMP directives and clauses.
609 //
610@@ -11527,6 +11531,11 @@ public:
611 /// that the user intended an assignment used as condition.
612 void DiagnoseEqualityWithExtraParens(ParenExpr *ParenE);
613
614+ template <typename DiagLocT, typename DiagInfoT>
615+ void DiagnoseOpenCLRequiresOption(llvm::StringRef OpenCLOptName,
616+ DiagLocT DiagLoc, DiagInfoT DiagInfo,
617+ unsigned Selector, SourceRange SrcRange);
618+
619 /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
620 ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr = false);
621
622diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
623index bf51d35d9693..a54ea8475d7d 100644
624--- a/clang/lib/AST/ASTContext.cpp
625+++ b/clang/lib/AST/ASTContext.cpp
626@@ -1433,7 +1433,8 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target,
627 ObjCSuperType = QualType();
628
629 // void * type
630- if (LangOpts.OpenCLVersion >= 200) {
631+ if (Target.getSupportedOpenCLOpts().isEnabled(
632+ "__opencl_c_generic_address_space")) {
633 auto Q = VoidTy.getQualifiers();
634 Q.setAddressSpace(LangAS::opencl_generic);
635 VoidPtrTy = getPointerType(getCanonicalType(
636diff --git a/clang/lib/Basic/Builtins.cpp b/clang/lib/Basic/Builtins.cpp
637index 0cd89df41b67..7a3067345098 100644
638--- a/clang/lib/Basic/Builtins.cpp
639+++ b/clang/lib/Basic/Builtins.cpp
640@@ -23,6 +23,8 @@ static const Builtin::Info BuiltinInfo[] = {
641 { #ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr },
642 #define LANGBUILTIN(ID, TYPE, ATTRS, LANGS) \
643 { #ID, TYPE, ATTRS, nullptr, LANGS, nullptr },
644+#define OPENCLBUILTIN(ID, TYPE, ATTRS, LANGS, FEATURE) \
645+ {#ID, TYPE, ATTRS, nullptr, LANGS, FEATURE},
646 #define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, LANGS) \
647 { #ID, TYPE, ATTRS, HEADER, LANGS, nullptr },
648 #include "clang/Basic/Builtins.def"
649@@ -69,16 +71,17 @@ bool Builtin::Context::builtinIsSupported(const Builtin::Info &BuiltinInfo,
650 bool ObjCUnsupported = !LangOpts.ObjC && BuiltinInfo.Langs == OBJC_LANG;
651 bool OclC1Unsupported = (LangOpts.OpenCLVersion / 100) != 1 &&
652 (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES ) == OCLC1X_LANG;
653- bool OclC2Unsupported =
654- (LangOpts.OpenCLVersion != 200 && !LangOpts.OpenCLCPlusPlus) &&
655- (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES) == OCLC20_LANG;
656+ bool OclC2PUnsupported =
657+ (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES) == OCLC2P_LANG &&
658+ ((LangOpts.OpenCLVersion < 200 && !LangOpts.OpenCLCPlusPlus) ||
659+ !OclBuiltinIsSupported(BuiltinInfo, LangOpts));
660 bool OclCUnsupported = !LangOpts.OpenCL &&
661 (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES);
662 bool OpenMPUnsupported = !LangOpts.OpenMP && BuiltinInfo.Langs == OMP_LANG;
663 bool CPlusPlusUnsupported =
664 !LangOpts.CPlusPlus && BuiltinInfo.Langs == CXX_LANG;
665 return !BuiltinsUnsupported && !MathBuiltinsUnsupported && !OclCUnsupported &&
666- !OclC1Unsupported && !OclC2Unsupported && !OpenMPUnsupported &&
667+ !OclC1Unsupported && !OclC2PUnsupported && !OpenMPUnsupported &&
668 !GnuModeUnsupported && !MSModeUnsupported && !ObjCUnsupported &&
669 !CPlusPlusUnsupported;
670 }
671@@ -191,3 +194,20 @@ bool Builtin::Context::canBeRedeclared(unsigned ID) const {
672 (!hasReferenceArgsOrResult(ID) &&
673 !hasCustomTypechecking(ID));
674 }
675+
676+bool Builtin::Context::OclBuiltinIsSupported(
677+ const Builtin::Info &BuiltinInfo, const LangOptions &LangOpts) const {
678+ if (!requiresFeatures(BuiltinInfo))
679+ return true;
680+
681+ return llvm::StringSwitch<bool>(BuiltinInfo.Features)
682+ .Case("__opencl_c_device_enqueue", LangOpts.Blocks)
683+ .Case("__opencl_c_generic_address_space", LangOpts.OpenCLGenericKeyword)
684+ .Case("__opencl_c_pipes", LangOpts.OpenCLPipeKeyword)
685+ .Default(false);
686+}
687+
688+bool Builtin::Context::requiresFeatures(
689+ const Builtin::Info &BuiltinInfo) const {
690+ return BuiltinInfo.Features && llvm::StringRef(BuiltinInfo.Features) != "";
691+}
692diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
693index eccdc21d724a..6b4f524d5271 100644
694--- a/clang/lib/Basic/TargetInfo.cpp
695+++ b/clang/lib/Basic/TargetInfo.cpp
696@@ -387,6 +387,17 @@ void TargetInfo::adjust(LangOptions &Opts) {
697 HalfFormat = &llvm::APFloat::IEEEhalf();
698 FloatFormat = &llvm::APFloat::IEEEsingle();
699 LongDoubleFormat = &llvm::APFloat::IEEEquad();
700+
701+ auto &SupportedOCLOpts = getTargetOpts().SupportedOpenCLOptions;
702+
703+ SupportedOCLOpts.setOpenCLVersion(Opts);
704+ SupportedOCLOpts.adjustFeatures();
705+
706+ if (!Opts.OpenCLCPlusPlus && Opts.OpenCLVersion >= 200)
707+ Opts.Blocks = SupportedOCLOpts.isSupported("__opencl_c_device_enqueue");
708+ Opts.OpenCLGenericKeyword =
709+ SupportedOCLOpts.isSupported("__opencl_c_generic_address_space");
710+ Opts.OpenCLPipeKeyword = SupportedOCLOpts.isSupported("__opencl_c_pipes");
711 }
712
713 if (Opts.DoubleSize) {
714diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
715index 965f273892bd..046d7c15f835 100644
716--- a/clang/lib/Basic/Targets.cpp
717+++ b/clang/lib/Basic/Targets.cpp
718@@ -40,7 +40,6 @@
719 #include "clang/Basic/Diagnostic.h"
720 #include "llvm/ADT/StringExtras.h"
721 #include "llvm/ADT/Triple.h"
722-
723 using namespace clang;
724
725 namespace clang {
726diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
727index 8ce488f35dd3..ca4cb0fbf018 100644
728--- a/clang/lib/CodeGen/CodeGenFunction.cpp
729+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
730@@ -2306,11 +2306,11 @@ void CodeGenFunction::checkTargetFeatures(SourceLocation Loc,
731 std::string MissingFeature;
732 if (BuiltinID) {
733 SmallVector<StringRef, 1> ReqFeatures;
734- const char *FeatureList =
735- CGM.getContext().BuiltinInfo.getRequiredFeatures(BuiltinID);
736 // Return if the builtin doesn't have any required features.
737- if (!FeatureList || StringRef(FeatureList) == "")
738+ if (!CGM.getContext().BuiltinInfo.requiresFeatures(BuiltinID))
739 return;
740+ const char *FeatureList =
741+ CGM.getContext().BuiltinInfo.getRequiredFeatures(BuiltinID);
742 StringRef(FeatureList).split(ReqFeatures, ',');
743 if (!hasRequiredFeatures(ReqFeatures, CGM, FD, MissingFeature))
744 CGM.getDiags().Report(Loc, diag::err_builtin_needs_feature)
745diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
746index 73114c6d76cb..bc54d231b97a 100644
747--- a/clang/lib/Frontend/CompilerInvocation.cpp
748+++ b/clang/lib/Frontend/CompilerInvocation.cpp
749@@ -2344,6 +2344,8 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
750 Opts.OpenCLVersion = 120;
751 else if (LangStd == LangStandard::lang_opencl20)
752 Opts.OpenCLVersion = 200;
753+ else if (LangStd == LangStandard::lang_opencl30)
754+ Opts.OpenCLVersion = 300;
755 else if (LangStd == LangStandard::lang_openclcpp)
756 Opts.OpenCLCPlusPlusVersion = 100;
757
758@@ -2544,14 +2546,15 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
759 // -cl-std only applies for OpenCL language standards.
760 // Override the -std option in this case.
761 if (const Arg *A = Args.getLastArg(OPT_cl_std_EQ)) {
762- LangStandard::Kind OpenCLLangStd
763- = llvm::StringSwitch<LangStandard::Kind>(A->getValue())
764- .Cases("cl", "CL", LangStandard::lang_opencl10)
765- .Cases("cl1.1", "CL1.1", LangStandard::lang_opencl11)
766- .Cases("cl1.2", "CL1.2", LangStandard::lang_opencl12)
767- .Cases("cl2.0", "CL2.0", LangStandard::lang_opencl20)
768- .Cases("clc++", "CLC++", LangStandard::lang_openclcpp)
769- .Default(LangStandard::lang_unspecified);
770+ LangStandard::Kind OpenCLLangStd =
771+ llvm::StringSwitch<LangStandard::Kind>(A->getValue())
772+ .Cases("cl", "CL", LangStandard::lang_opencl10)
773+ .Cases("cl1.1", "CL1.1", LangStandard::lang_opencl11)
774+ .Cases("cl1.2", "CL1.2", LangStandard::lang_opencl12)
775+ .Cases("cl2.0", "CL2.0", LangStandard::lang_opencl20)
776+ .Cases("cl3.0", "CL3.0", LangStandard::lang_opencl30)
777+ .Cases("clc++", "CLC++", LangStandard::lang_openclcpp)
778+ .Default(LangStandard::lang_unspecified);
779
780 if (OpenCLLangStd == LangStandard::lang_unspecified) {
781 Diags.Report(diag::err_drv_invalid_value)
782@@ -2852,8 +2855,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
783
784 Opts.RTTI = Opts.CPlusPlus && !Args.hasArg(OPT_fno_rtti);
785 Opts.RTTIData = Opts.RTTI && !Args.hasArg(OPT_fno_rtti_data);
786- Opts.Blocks = Args.hasArg(OPT_fblocks) || (Opts.OpenCL
787- && Opts.OpenCLVersion == 200);
788+ Opts.Blocks = Args.hasArg(OPT_fblocks);
789 Opts.BlocksRuntimeOptional = Args.hasArg(OPT_fblocks_runtime_optional);
790 Opts.Coroutines = Opts.CPlusPlus20 || Args.hasArg(OPT_fcoroutines_ts);
791
792diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
793index 6eef1e2376f6..5bb489c11909 100644
794--- a/clang/lib/Frontend/InitPreprocessor.cpp
795+++ b/clang/lib/Frontend/InitPreprocessor.cpp
796@@ -445,6 +445,9 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
797 case 200:
798 Builder.defineMacro("__OPENCL_C_VERSION__", "200");
799 break;
800+ case 300:
801+ Builder.defineMacro("__OPENCL_C_VERSION__", "300");
802+ break;
803 default:
804 llvm_unreachable("Unsupported OpenCL version");
805 }
806@@ -453,6 +456,7 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
807 Builder.defineMacro("CL_VERSION_1_1", "110");
808 Builder.defineMacro("CL_VERSION_1_2", "120");
809 Builder.defineMacro("CL_VERSION_2_0", "200");
810+ Builder.defineMacro("CL_VERSION_3_0", "300");
811
812 if (TI.isLittleEndian())
813 Builder.defineMacro("__ENDIAN_LITTLE__");
814@@ -1108,7 +1112,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
815 // OpenCL definitions.
816 if (LangOpts.OpenCL) {
817 #define OPENCLEXT(Ext) \
818- if (TI.getSupportedOpenCLOpts().isSupported(#Ext, LangOpts)) \
819+ if (TI.getSupportedOpenCLOpts().isSupported(#Ext)) \
820 Builder.defineMacro(#Ext);
821 #include "clang/Basic/OpenCLExtensions.def"
822
823diff --git a/clang/lib/Headers/opencl-c-base.h b/clang/lib/Headers/opencl-c-base.h
824index 430e07d36f62..afa900ab24d9 100644
825--- a/clang/lib/Headers/opencl-c-base.h
826+++ b/clang/lib/Headers/opencl-c-base.h
827@@ -9,6 +9,59 @@
828 #ifndef _OPENCL_BASE_H_
829 #define _OPENCL_BASE_H_
830
831+// Add predefined macros to build headers with standalone executable
832+#ifndef CL_VERSION_3_0
833+ #define CL_VERSION_3_0 300
834+#endif
835+
836+// Define features for 2.0 for header backward compatibility
837+#ifndef __opencl_c_int64
838+ #define __opencl_c_int64 1
839+#endif
840+#if __OPENCL_C_VERSION__ != CL_VERSION_3_0
841+ #ifndef __opencl_c_images
842+ #define __opencl_c_images 1
843+ #endif
844+#endif
845+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
846+#ifndef __opencl_c_pipes
847+ #define __opencl_c_pipes 1
848+#endif
849+#ifndef __opencl_c_generic_address_space
850+ #define __opencl_c_generic_address_space 1
851+#endif
852+#ifndef __opencl_c_work_group_collective_functions
853+ #define __opencl_c_work_group_collective_functions 1
854+#endif
855+#ifndef __opencl_c_atomic_order_acq_rel
856+ #define __opencl_c_atomic_order_acq_rel 1
857+#endif
858+#ifndef __opencl_c_atomic_order_seq_cst
859+ #define __opencl_c_atomic_order_seq_cst 1
860+#endif
861+#ifndef __opencl_c_atomic_scope_device
862+ #define __opencl_c_atomic_scope_device 1
863+#endif
864+#ifndef __opencl_c_atomic_scope_all_devices
865+ #define __opencl_c_atomic_scope_all_devices 1
866+#endif
867+#ifndef __opencl_c_subgroups
868+ #define __opencl_c_subgroups 1
869+#endif
870+#ifndef __opencl_c_3d_image_writes
871+ #define __opencl_c_3d_image_writes 1
872+#endif
873+#ifndef __opencl_c_device_enqueue
874+ #define __opencl_c_device_enqueue 1
875+#endif
876+#ifndef __opencl_c_read_write_images
877+ #define __opencl_c_read_write_images 1
878+#endif
879+#ifndef __opencl_c_program_scope_global_variables
880+ #define __opencl_c_program_scope_global_variables 1
881+#endif
882+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
883+
884 // built-in scalar data types:
885
886 /**
887@@ -115,7 +168,12 @@ typedef half half4 __attribute__((ext_vector_type(4)));
888 typedef half half8 __attribute__((ext_vector_type(8)));
889 typedef half half16 __attribute__((ext_vector_type(16)));
890 #endif
891-#ifdef cl_khr_fp64
892+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
893+
894+#ifndef __opencl_c_fp64
895+ #define __opencl_c_fp64 1
896+#endif
897+
898 #if __OPENCL_C_VERSION__ < CL_VERSION_1_2
899 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
900 #endif
901@@ -281,9 +339,17 @@ typedef uint cl_mem_fence_flags;
902 typedef enum memory_scope {
903 memory_scope_work_item = __OPENCL_MEMORY_SCOPE_WORK_ITEM,
904 memory_scope_work_group = __OPENCL_MEMORY_SCOPE_WORK_GROUP,
905+#ifdef __opencl_c_atomic_scope_device
906 memory_scope_device = __OPENCL_MEMORY_SCOPE_DEVICE,
907+#endif
908+#ifdef __opencl_c_atomic_scope_all_devices
909+ #if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
910+ memory_scope_all_devices = __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES,
911+ #endif //(__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
912 memory_scope_all_svm_devices = __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES,
913-#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups)
914+#endif // __opencl_c_atomic_scope_all_devices
915+#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups) || \
916+ defined(__opencl_c_subgroups)
917 memory_scope_sub_group = __OPENCL_MEMORY_SCOPE_SUB_GROUP
918 #endif
919 } memory_scope;
920@@ -301,13 +367,14 @@ typedef enum memory_scope {
921 #define ATOMIC_FLAG_INIT 0
922
923 // enum values aligned with what clang uses in EmitAtomicExpr()
924-typedef enum memory_order
925-{
926+typedef enum memory_order {
927 memory_order_relaxed = __ATOMIC_RELAXED,
928 memory_order_acquire = __ATOMIC_ACQUIRE,
929 memory_order_release = __ATOMIC_RELEASE,
930 memory_order_acq_rel = __ATOMIC_ACQ_REL,
931+#ifdef __opencl_c_atomic_order_seq_cst
932 memory_order_seq_cst = __ATOMIC_SEQ_CST
933+#endif //__opencl_c_atomic_order_seq_cst
934 } memory_order;
935
936 #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
937diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
938index 66e18bdd47bb..67d900eb1c3d 100644
939--- a/clang/lib/Headers/opencl-c.h
940+++ b/clang/lib/Headers/opencl-c.h
941@@ -35,7 +35,6 @@
942 #define __purefn __attribute__((pure))
943 #define __cnfn __attribute__((const))
944
945-
946 // OpenCL v1.1/1.2/2.0 s6.2.3 - Explicit conversions
947
948 char __ovld __cnfn convert_char_rte(char);
949@@ -4632,7 +4631,7 @@ float16 __ovld __cnfn convert_float16(float16);
950
951 // Conversions with double data type parameters or return value.
952
953-#ifdef cl_khr_fp64
954+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
955 char __ovld __cnfn convert_char(double);
956 char __ovld __cnfn convert_char_rte(double);
957 char __ovld __cnfn convert_char_rtn(double);
958@@ -5452,7 +5451,7 @@ double16 __ovld __cnfn convert_double16_rtz(uchar16);
959 double16 __ovld __cnfn convert_double16_rtz(uint16);
960 double16 __ovld __cnfn convert_double16_rtz(ulong16);
961 double16 __ovld __cnfn convert_double16_rtz(ushort16);
962-#endif //cl_khr_fp64
963+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
964
965 #ifdef cl_khr_fp16
966 // Convert half types to non-double types.
967@@ -6270,7 +6269,7 @@ half16 __ovld __cnfn convert_half16_rtz(float16);
968 half16 __ovld __cnfn convert_half16_rtz(half16);
969
970 // Convert half types to double types.
971-#ifdef cl_khr_fp64
972+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
973 double __ovld __cnfn convert_double(half);
974 double __ovld __cnfn convert_double_rte(half);
975 double __ovld __cnfn convert_double_rtp(half);
976@@ -6333,7 +6332,7 @@ half16 __ovld __cnfn convert_half16_rte(double16);
977 half16 __ovld __cnfn convert_half16_rtp(double16);
978 half16 __ovld __cnfn convert_half16_rtn(double16);
979 half16 __ovld __cnfn convert_half16_rtz(double16);
980-#endif //cl_khr_fp64
981+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
982
983 #endif // cl_khr_fp16
984
985@@ -6404,14 +6403,14 @@ half16 __ovld __cnfn convert_half16_rtz(double16);
986 #define as_float8(x) __builtin_astype((x), float8)
987 #define as_float16(x) __builtin_astype((x), float16)
988
989-#ifdef cl_khr_fp64
990+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
991 #define as_double(x) __builtin_astype((x), double)
992 #define as_double2(x) __builtin_astype((x), double2)
993 #define as_double3(x) __builtin_astype((x), double3)
994 #define as_double4(x) __builtin_astype((x), double4)
995 #define as_double8(x) __builtin_astype((x), double8)
996 #define as_double16(x) __builtin_astype((x), double16)
997-#endif //cl_khr_fp64
998+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
999
1000 #ifdef cl_khr_fp16
1001 #define as_half(x) __builtin_astype((x), half)
1002@@ -6534,14 +6533,14 @@ float3 __ovld __cnfn acos(float3);
1003 float4 __ovld __cnfn acos(float4);
1004 float8 __ovld __cnfn acos(float8);
1005 float16 __ovld __cnfn acos(float16);
1006-#ifdef cl_khr_fp64
1007+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1008 double __ovld __cnfn acos(double);
1009 double2 __ovld __cnfn acos(double2);
1010 double3 __ovld __cnfn acos(double3);
1011 double4 __ovld __cnfn acos(double4);
1012 double8 __ovld __cnfn acos(double8);
1013 double16 __ovld __cnfn acos(double16);
1014-#endif //cl_khr_fp64
1015+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1016 #ifdef cl_khr_fp16
1017 half __ovld __cnfn acos(half);
1018 half2 __ovld __cnfn acos(half2);
1019@@ -6560,14 +6559,14 @@ float3 __ovld __cnfn acosh(float3);
1020 float4 __ovld __cnfn acosh(float4);
1021 float8 __ovld __cnfn acosh(float8);
1022 float16 __ovld __cnfn acosh(float16);
1023-#ifdef cl_khr_fp64
1024+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1025 double __ovld __cnfn acosh(double);
1026 double2 __ovld __cnfn acosh(double2);
1027 double3 __ovld __cnfn acosh(double3);
1028 double4 __ovld __cnfn acosh(double4);
1029 double8 __ovld __cnfn acosh(double8);
1030 double16 __ovld __cnfn acosh(double16);
1031-#endif //cl_khr_fp64
1032+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1033 #ifdef cl_khr_fp16
1034 half __ovld __cnfn acosh(half);
1035 half2 __ovld __cnfn acosh(half2);
1036@@ -6586,14 +6585,14 @@ float3 __ovld __cnfn acospi(float3 x);
1037 float4 __ovld __cnfn acospi(float4 x);
1038 float8 __ovld __cnfn acospi(float8 x);
1039 float16 __ovld __cnfn acospi(float16 x);
1040-#ifdef cl_khr_fp64
1041+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1042 double __ovld __cnfn acospi(double x);
1043 double2 __ovld __cnfn acospi(double2 x);
1044 double3 __ovld __cnfn acospi(double3 x);
1045 double4 __ovld __cnfn acospi(double4 x);
1046 double8 __ovld __cnfn acospi(double8 x);
1047 double16 __ovld __cnfn acospi(double16 x);
1048-#endif //cl_khr_fp64
1049+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1050 #ifdef cl_khr_fp16
1051 half __ovld __cnfn acospi(half x);
1052 half2 __ovld __cnfn acospi(half2 x);
1053@@ -6612,14 +6611,14 @@ float3 __ovld __cnfn asin(float3);
1054 float4 __ovld __cnfn asin(float4);
1055 float8 __ovld __cnfn asin(float8);
1056 float16 __ovld __cnfn asin(float16);
1057-#ifdef cl_khr_fp64
1058+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1059 double __ovld __cnfn asin(double);
1060 double2 __ovld __cnfn asin(double2);
1061 double3 __ovld __cnfn asin(double3);
1062 double4 __ovld __cnfn asin(double4);
1063 double8 __ovld __cnfn asin(double8);
1064 double16 __ovld __cnfn asin(double16);
1065-#endif //cl_khr_fp64
1066+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1067 #ifdef cl_khr_fp16
1068 half __ovld __cnfn asin(half);
1069 half2 __ovld __cnfn asin(half2);
1070@@ -6638,14 +6637,14 @@ float3 __ovld __cnfn asinh(float3);
1071 float4 __ovld __cnfn asinh(float4);
1072 float8 __ovld __cnfn asinh(float8);
1073 float16 __ovld __cnfn asinh(float16);
1074-#ifdef cl_khr_fp64
1075+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1076 double __ovld __cnfn asinh(double);
1077 double2 __ovld __cnfn asinh(double2);
1078 double3 __ovld __cnfn asinh(double3);
1079 double4 __ovld __cnfn asinh(double4);
1080 double8 __ovld __cnfn asinh(double8);
1081 double16 __ovld __cnfn asinh(double16);
1082-#endif //cl_khr_fp64
1083+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1084 #ifdef cl_khr_fp16
1085 half __ovld __cnfn asinh(half);
1086 half2 __ovld __cnfn asinh(half2);
1087@@ -6664,14 +6663,14 @@ float3 __ovld __cnfn asinpi(float3 x);
1088 float4 __ovld __cnfn asinpi(float4 x);
1089 float8 __ovld __cnfn asinpi(float8 x);
1090 float16 __ovld __cnfn asinpi(float16 x);
1091-#ifdef cl_khr_fp64
1092+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1093 double __ovld __cnfn asinpi(double x);
1094 double2 __ovld __cnfn asinpi(double2 x);
1095 double3 __ovld __cnfn asinpi(double3 x);
1096 double4 __ovld __cnfn asinpi(double4 x);
1097 double8 __ovld __cnfn asinpi(double8 x);
1098 double16 __ovld __cnfn asinpi(double16 x);
1099-#endif //cl_khr_fp64
1100+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1101 #ifdef cl_khr_fp16
1102 half __ovld __cnfn asinpi(half x);
1103 half2 __ovld __cnfn asinpi(half2 x);
1104@@ -6690,14 +6689,14 @@ float3 __ovld __cnfn atan(float3 y_over_x);
1105 float4 __ovld __cnfn atan(float4 y_over_x);
1106 float8 __ovld __cnfn atan(float8 y_over_x);
1107 float16 __ovld __cnfn atan(float16 y_over_x);
1108-#ifdef cl_khr_fp64
1109+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1110 double __ovld __cnfn atan(double y_over_x);
1111 double2 __ovld __cnfn atan(double2 y_over_x);
1112 double3 __ovld __cnfn atan(double3 y_over_x);
1113 double4 __ovld __cnfn atan(double4 y_over_x);
1114 double8 __ovld __cnfn atan(double8 y_over_x);
1115 double16 __ovld __cnfn atan(double16 y_over_x);
1116-#endif //cl_khr_fp64
1117+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1118 #ifdef cl_khr_fp16
1119 half __ovld __cnfn atan(half y_over_x);
1120 half2 __ovld __cnfn atan(half2 y_over_x);
1121@@ -6716,14 +6715,14 @@ float3 __ovld __cnfn atan2(float3 y, float3 x);
1122 float4 __ovld __cnfn atan2(float4 y, float4 x);
1123 float8 __ovld __cnfn atan2(float8 y, float8 x);
1124 float16 __ovld __cnfn atan2(float16 y, float16 x);
1125-#ifdef cl_khr_fp64
1126+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1127 double __ovld __cnfn atan2(double y, double x);
1128 double2 __ovld __cnfn atan2(double2 y, double2 x);
1129 double3 __ovld __cnfn atan2(double3 y, double3 x);
1130 double4 __ovld __cnfn atan2(double4 y, double4 x);
1131 double8 __ovld __cnfn atan2(double8 y, double8 x);
1132 double16 __ovld __cnfn atan2(double16 y, double16 x);
1133-#endif //cl_khr_fp64
1134+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1135 #ifdef cl_khr_fp16
1136 half __ovld __cnfn atan2(half y, half x);
1137 half2 __ovld __cnfn atan2(half2 y, half2 x);
1138@@ -6742,14 +6741,14 @@ float3 __ovld __cnfn atanh(float3);
1139 float4 __ovld __cnfn atanh(float4);
1140 float8 __ovld __cnfn atanh(float8);
1141 float16 __ovld __cnfn atanh(float16);
1142-#ifdef cl_khr_fp64
1143+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1144 double __ovld __cnfn atanh(double);
1145 double2 __ovld __cnfn atanh(double2);
1146 double3 __ovld __cnfn atanh(double3);
1147 double4 __ovld __cnfn atanh(double4);
1148 double8 __ovld __cnfn atanh(double8);
1149 double16 __ovld __cnfn atanh(double16);
1150-#endif //cl_khr_fp64
1151+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1152 #ifdef cl_khr_fp16
1153 half __ovld __cnfn atanh(half);
1154 half2 __ovld __cnfn atanh(half2);
1155@@ -6768,14 +6767,14 @@ float3 __ovld __cnfn atanpi(float3 x);
1156 float4 __ovld __cnfn atanpi(float4 x);
1157 float8 __ovld __cnfn atanpi(float8 x);
1158 float16 __ovld __cnfn atanpi(float16 x);
1159-#ifdef cl_khr_fp64
1160+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1161 double __ovld __cnfn atanpi(double x);
1162 double2 __ovld __cnfn atanpi(double2 x);
1163 double3 __ovld __cnfn atanpi(double3 x);
1164 double4 __ovld __cnfn atanpi(double4 x);
1165 double8 __ovld __cnfn atanpi(double8 x);
1166 double16 __ovld __cnfn atanpi(double16 x);
1167-#endif //cl_khr_fp64
1168+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1169 #ifdef cl_khr_fp16
1170 half __ovld __cnfn atanpi(half x);
1171 half2 __ovld __cnfn atanpi(half2 x);
1172@@ -6794,14 +6793,14 @@ float3 __ovld __cnfn atan2pi(float3 y, float3 x);
1173 float4 __ovld __cnfn atan2pi(float4 y, float4 x);
1174 float8 __ovld __cnfn atan2pi(float8 y, float8 x);
1175 float16 __ovld __cnfn atan2pi(float16 y, float16 x);
1176-#ifdef cl_khr_fp64
1177+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1178 double __ovld __cnfn atan2pi(double y, double x);
1179 double2 __ovld __cnfn atan2pi(double2 y, double2 x);
1180 double3 __ovld __cnfn atan2pi(double3 y, double3 x);
1181 double4 __ovld __cnfn atan2pi(double4 y, double4 x);
1182 double8 __ovld __cnfn atan2pi(double8 y, double8 x);
1183 double16 __ovld __cnfn atan2pi(double16 y, double16 x);
1184-#endif //cl_khr_fp64
1185+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1186 #ifdef cl_khr_fp16
1187 half __ovld __cnfn atan2pi(half y, half x);
1188 half2 __ovld __cnfn atan2pi(half2 y, half2 x);
1189@@ -6820,14 +6819,14 @@ float3 __ovld __cnfn cbrt(float3);
1190 float4 __ovld __cnfn cbrt(float4);
1191 float8 __ovld __cnfn cbrt(float8);
1192 float16 __ovld __cnfn cbrt(float16);
1193-#ifdef cl_khr_fp64
1194+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1195 double __ovld __cnfn cbrt(double);
1196 double2 __ovld __cnfn cbrt(double2);
1197 double3 __ovld __cnfn cbrt(double3);
1198 double4 __ovld __cnfn cbrt(double4);
1199 double8 __ovld __cnfn cbrt(double8);
1200 double16 __ovld __cnfn cbrt(double16);
1201-#endif //cl_khr_fp64
1202+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1203 #ifdef cl_khr_fp16
1204 half __ovld __cnfn cbrt(half);
1205 half2 __ovld __cnfn cbrt(half2);
1206@@ -6847,14 +6846,14 @@ float3 __ovld __cnfn ceil(float3);
1207 float4 __ovld __cnfn ceil(float4);
1208 float8 __ovld __cnfn ceil(float8);
1209 float16 __ovld __cnfn ceil(float16);
1210-#ifdef cl_khr_fp64
1211+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1212 double __ovld __cnfn ceil(double);
1213 double2 __ovld __cnfn ceil(double2);
1214 double3 __ovld __cnfn ceil(double3);
1215 double4 __ovld __cnfn ceil(double4);
1216 double8 __ovld __cnfn ceil(double8);
1217 double16 __ovld __cnfn ceil(double16);
1218-#endif //cl_khr_fp64
1219+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1220 #ifdef cl_khr_fp16
1221 half __ovld __cnfn ceil(half);
1222 half2 __ovld __cnfn ceil(half2);
1223@@ -6873,14 +6872,14 @@ float3 __ovld __cnfn copysign(float3 x, float3 y);
1224 float4 __ovld __cnfn copysign(float4 x, float4 y);
1225 float8 __ovld __cnfn copysign(float8 x, float8 y);
1226 float16 __ovld __cnfn copysign(float16 x, float16 y);
1227-#ifdef cl_khr_fp64
1228+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1229 double __ovld __cnfn copysign(double x, double y);
1230 double2 __ovld __cnfn copysign(double2 x, double2 y);
1231 double3 __ovld __cnfn copysign(double3 x, double3 y);
1232 double4 __ovld __cnfn copysign(double4 x, double4 y);
1233 double8 __ovld __cnfn copysign(double8 x, double8 y);
1234 double16 __ovld __cnfn copysign(double16 x, double16 y);
1235-#endif //cl_khr_fp64
1236+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1237 #ifdef cl_khr_fp16
1238 half __ovld __cnfn copysign(half x, half y);
1239 half2 __ovld __cnfn copysign(half2 x, half2 y);
1240@@ -6899,14 +6898,14 @@ float3 __ovld __cnfn cos(float3);
1241 float4 __ovld __cnfn cos(float4);
1242 float8 __ovld __cnfn cos(float8);
1243 float16 __ovld __cnfn cos(float16);
1244-#ifdef cl_khr_fp64
1245+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1246 double __ovld __cnfn cos(double);
1247 double2 __ovld __cnfn cos(double2);
1248 double3 __ovld __cnfn cos(double3);
1249 double4 __ovld __cnfn cos(double4);
1250 double8 __ovld __cnfn cos(double8);
1251 double16 __ovld __cnfn cos(double16);
1252-#endif //cl_khr_fp64
1253+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1254 #ifdef cl_khr_fp16
1255 half __ovld __cnfn cos(half);
1256 half2 __ovld __cnfn cos(half2);
1257@@ -6925,14 +6924,14 @@ float3 __ovld __cnfn cosh(float3);
1258 float4 __ovld __cnfn cosh(float4);
1259 float8 __ovld __cnfn cosh(float8);
1260 float16 __ovld __cnfn cosh(float16);
1261-#ifdef cl_khr_fp64
1262+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1263 double __ovld __cnfn cosh(double);
1264 double2 __ovld __cnfn cosh(double2);
1265 double3 __ovld __cnfn cosh(double3);
1266 double4 __ovld __cnfn cosh(double4);
1267 double8 __ovld __cnfn cosh(double8);
1268 double16 __ovld __cnfn cosh(double16);
1269-#endif //cl_khr_fp64
1270+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1271 #ifdef cl_khr_fp16
1272 half __ovld __cnfn cosh(half);
1273 half2 __ovld __cnfn cosh(half2);
1274@@ -6951,14 +6950,14 @@ float3 __ovld __cnfn cospi(float3 x);
1275 float4 __ovld __cnfn cospi(float4 x);
1276 float8 __ovld __cnfn cospi(float8 x);
1277 float16 __ovld __cnfn cospi(float16 x);
1278-#ifdef cl_khr_fp64
1279+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1280 double __ovld __cnfn cospi(double x);
1281 double2 __ovld __cnfn cospi(double2 x);
1282 double3 __ovld __cnfn cospi(double3 x);
1283 double4 __ovld __cnfn cospi(double4 x);
1284 double8 __ovld __cnfn cospi(double8 x);
1285 double16 __ovld __cnfn cospi(double16 x);
1286-#endif //cl_khr_fp64
1287+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1288 #ifdef cl_khr_fp16
1289 half __ovld __cnfn cospi(half x);
1290 half2 __ovld __cnfn cospi(half2 x);
1291@@ -6977,14 +6976,14 @@ float3 __ovld __cnfn erfc(float3);
1292 float4 __ovld __cnfn erfc(float4);
1293 float8 __ovld __cnfn erfc(float8);
1294 float16 __ovld __cnfn erfc(float16);
1295-#ifdef cl_khr_fp64
1296+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1297 double __ovld __cnfn erfc(double);
1298 double2 __ovld __cnfn erfc(double2);
1299 double3 __ovld __cnfn erfc(double3);
1300 double4 __ovld __cnfn erfc(double4);
1301 double8 __ovld __cnfn erfc(double8);
1302 double16 __ovld __cnfn erfc(double16);
1303-#endif //cl_khr_fp64
1304+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1305 #ifdef cl_khr_fp16
1306 half __ovld __cnfn erfc(half);
1307 half2 __ovld __cnfn erfc(half2);
1308@@ -7004,14 +7003,14 @@ float3 __ovld __cnfn erf(float3);
1309 float4 __ovld __cnfn erf(float4);
1310 float8 __ovld __cnfn erf(float8);
1311 float16 __ovld __cnfn erf(float16);
1312-#ifdef cl_khr_fp64
1313+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1314 double __ovld __cnfn erf(double);
1315 double2 __ovld __cnfn erf(double2);
1316 double3 __ovld __cnfn erf(double3);
1317 double4 __ovld __cnfn erf(double4);
1318 double8 __ovld __cnfn erf(double8);
1319 double16 __ovld __cnfn erf(double16);
1320-#endif //cl_khr_fp64
1321+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1322 #ifdef cl_khr_fp16
1323 half __ovld __cnfn erf(half);
1324 half2 __ovld __cnfn erf(half2);
1325@@ -7030,14 +7029,14 @@ float3 __ovld __cnfn exp(float3 x);
1326 float4 __ovld __cnfn exp(float4 x);
1327 float8 __ovld __cnfn exp(float8 x);
1328 float16 __ovld __cnfn exp(float16 x);
1329-#ifdef cl_khr_fp64
1330+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1331 double __ovld __cnfn exp(double x);
1332 double2 __ovld __cnfn exp(double2 x);
1333 double3 __ovld __cnfn exp(double3 x);
1334 double4 __ovld __cnfn exp(double4 x);
1335 double8 __ovld __cnfn exp(double8 x);
1336 double16 __ovld __cnfn exp(double16 x);
1337-#endif //cl_khr_fp64
1338+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1339 #ifdef cl_khr_fp16
1340 half __ovld __cnfn exp(half x);
1341 half2 __ovld __cnfn exp(half2 x);
1342@@ -7056,14 +7055,14 @@ float3 __ovld __cnfn exp2(float3);
1343 float4 __ovld __cnfn exp2(float4);
1344 float8 __ovld __cnfn exp2(float8);
1345 float16 __ovld __cnfn exp2(float16);
1346-#ifdef cl_khr_fp64
1347+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1348 double __ovld __cnfn exp2(double);
1349 double2 __ovld __cnfn exp2(double2);
1350 double3 __ovld __cnfn exp2(double3);
1351 double4 __ovld __cnfn exp2(double4);
1352 double8 __ovld __cnfn exp2(double8);
1353 double16 __ovld __cnfn exp2(double16);
1354-#endif //cl_khr_fp64
1355+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1356 #ifdef cl_khr_fp16
1357 half __ovld __cnfn exp2(half);
1358 half2 __ovld __cnfn exp2(half2);
1359@@ -7082,14 +7081,14 @@ float3 __ovld __cnfn exp10(float3);
1360 float4 __ovld __cnfn exp10(float4);
1361 float8 __ovld __cnfn exp10(float8);
1362 float16 __ovld __cnfn exp10(float16);
1363-#ifdef cl_khr_fp64
1364+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1365 double __ovld __cnfn exp10(double);
1366 double2 __ovld __cnfn exp10(double2);
1367 double3 __ovld __cnfn exp10(double3);
1368 double4 __ovld __cnfn exp10(double4);
1369 double8 __ovld __cnfn exp10(double8);
1370 double16 __ovld __cnfn exp10(double16);
1371-#endif //cl_khr_fp64
1372+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1373 #ifdef cl_khr_fp16
1374 half __ovld __cnfn exp10(half);
1375 half2 __ovld __cnfn exp10(half2);
1376@@ -7108,14 +7107,14 @@ float3 __ovld __cnfn expm1(float3 x);
1377 float4 __ovld __cnfn expm1(float4 x);
1378 float8 __ovld __cnfn expm1(float8 x);
1379 float16 __ovld __cnfn expm1(float16 x);
1380-#ifdef cl_khr_fp64
1381+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1382 double __ovld __cnfn expm1(double x);
1383 double2 __ovld __cnfn expm1(double2 x);
1384 double3 __ovld __cnfn expm1(double3 x);
1385 double4 __ovld __cnfn expm1(double4 x);
1386 double8 __ovld __cnfn expm1(double8 x);
1387 double16 __ovld __cnfn expm1(double16 x);
1388-#endif //cl_khr_fp64
1389+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1390 #ifdef cl_khr_fp16
1391 half __ovld __cnfn expm1(half x);
1392 half2 __ovld __cnfn expm1(half2 x);
1393@@ -7134,14 +7133,14 @@ float3 __ovld __cnfn fabs(float3);
1394 float4 __ovld __cnfn fabs(float4);
1395 float8 __ovld __cnfn fabs(float8);
1396 float16 __ovld __cnfn fabs(float16);
1397-#ifdef cl_khr_fp64
1398+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1399 double __ovld __cnfn fabs(double);
1400 double2 __ovld __cnfn fabs(double2);
1401 double3 __ovld __cnfn fabs(double3);
1402 double4 __ovld __cnfn fabs(double4);
1403 double8 __ovld __cnfn fabs(double8);
1404 double16 __ovld __cnfn fabs(double16);
1405-#endif //cl_khr_fp64
1406+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1407 #ifdef cl_khr_fp16
1408 half __ovld __cnfn fabs(half);
1409 half2 __ovld __cnfn fabs(half2);
1410@@ -7160,14 +7159,14 @@ float3 __ovld __cnfn fdim(float3 x, float3 y);
1411 float4 __ovld __cnfn fdim(float4 x, float4 y);
1412 float8 __ovld __cnfn fdim(float8 x, float8 y);
1413 float16 __ovld __cnfn fdim(float16 x, float16 y);
1414-#ifdef cl_khr_fp64
1415+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1416 double __ovld __cnfn fdim(double x, double y);
1417 double2 __ovld __cnfn fdim(double2 x, double2 y);
1418 double3 __ovld __cnfn fdim(double3 x, double3 y);
1419 double4 __ovld __cnfn fdim(double4 x, double4 y);
1420 double8 __ovld __cnfn fdim(double8 x, double8 y);
1421 double16 __ovld __cnfn fdim(double16 x, double16 y);
1422-#endif //cl_khr_fp64
1423+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1424 #ifdef cl_khr_fp16
1425 half __ovld __cnfn fdim(half x, half y);
1426 half2 __ovld __cnfn fdim(half2 x, half2 y);
1427@@ -7187,14 +7186,14 @@ float3 __ovld __cnfn floor(float3);
1428 float4 __ovld __cnfn floor(float4);
1429 float8 __ovld __cnfn floor(float8);
1430 float16 __ovld __cnfn floor(float16);
1431-#ifdef cl_khr_fp64
1432+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1433 double __ovld __cnfn floor(double);
1434 double2 __ovld __cnfn floor(double2);
1435 double3 __ovld __cnfn floor(double3);
1436 double4 __ovld __cnfn floor(double4);
1437 double8 __ovld __cnfn floor(double8);
1438 double16 __ovld __cnfn floor(double16);
1439-#endif //cl_khr_fp64
1440+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1441 #ifdef cl_khr_fp16
1442 half __ovld __cnfn floor(half);
1443 half2 __ovld __cnfn floor(half2);
1444@@ -7217,14 +7216,14 @@ float3 __ovld __cnfn fma(float3 a, float3 b, float3 c);
1445 float4 __ovld __cnfn fma(float4 a, float4 b, float4 c);
1446 float8 __ovld __cnfn fma(float8 a, float8 b, float8 c);
1447 float16 __ovld __cnfn fma(float16 a, float16 b, float16 c);
1448-#ifdef cl_khr_fp64
1449+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1450 double __ovld __cnfn fma(double a, double b, double c);
1451 double2 __ovld __cnfn fma(double2 a, double2 b, double2 c);
1452 double3 __ovld __cnfn fma(double3 a, double3 b, double3 c);
1453 double4 __ovld __cnfn fma(double4 a, double4 b, double4 c);
1454 double8 __ovld __cnfn fma(double8 a, double8 b, double8 c);
1455 double16 __ovld __cnfn fma(double16 a, double16 b, double16 c);
1456-#endif //cl_khr_fp64
1457+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1458 #ifdef cl_khr_fp16
1459 half __ovld __cnfn fma(half a, half b, half c);
1460 half2 __ovld __cnfn fma(half2 a, half2 b, half2 c);
1461@@ -7251,7 +7250,7 @@ float3 __ovld __cnfn fmax(float3 x, float y);
1462 float4 __ovld __cnfn fmax(float4 x, float y);
1463 float8 __ovld __cnfn fmax(float8 x, float y);
1464 float16 __ovld __cnfn fmax(float16 x, float y);
1465-#ifdef cl_khr_fp64
1466+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1467 double __ovld __cnfn fmax(double x, double y);
1468 double2 __ovld __cnfn fmax(double2 x, double2 y);
1469 double3 __ovld __cnfn fmax(double3 x, double3 y);
1470@@ -7263,7 +7262,7 @@ double3 __ovld __cnfn fmax(double3 x, double y);
1471 double4 __ovld __cnfn fmax(double4 x, double y);
1472 double8 __ovld __cnfn fmax(double8 x, double y);
1473 double16 __ovld __cnfn fmax(double16 x, double y);
1474-#endif //cl_khr_fp64
1475+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1476 #ifdef cl_khr_fp16
1477 half __ovld __cnfn fmax(half x, half y);
1478 half2 __ovld __cnfn fmax(half2 x, half2 y);
1479@@ -7295,7 +7294,7 @@ float3 __ovld __cnfn fmin(float3 x, float y);
1480 float4 __ovld __cnfn fmin(float4 x, float y);
1481 float8 __ovld __cnfn fmin(float8 x, float y);
1482 float16 __ovld __cnfn fmin(float16 x, float y);
1483-#ifdef cl_khr_fp64
1484+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1485 double __ovld __cnfn fmin(double x, double y);
1486 double2 __ovld __cnfn fmin(double2 x, double2 y);
1487 double3 __ovld __cnfn fmin(double3 x, double3 y);
1488@@ -7307,7 +7306,7 @@ double3 __ovld __cnfn fmin(double3 x, double y);
1489 double4 __ovld __cnfn fmin(double4 x, double y);
1490 double8 __ovld __cnfn fmin(double8 x, double y);
1491 double16 __ovld __cnfn fmin(double16 x, double y);
1492-#endif //cl_khr_fp64
1493+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1494 #ifdef cl_khr_fp16
1495 half __ovld __cnfn fmin(half x, half y);
1496 half2 __ovld __cnfn fmin(half2 x, half2 y);
1497@@ -7331,14 +7330,14 @@ float3 __ovld __cnfn fmod(float3 x, float3 y);
1498 float4 __ovld __cnfn fmod(float4 x, float4 y);
1499 float8 __ovld __cnfn fmod(float8 x, float8 y);
1500 float16 __ovld __cnfn fmod(float16 x, float16 y);
1501-#ifdef cl_khr_fp64
1502+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1503 double __ovld __cnfn fmod(double x, double y);
1504 double2 __ovld __cnfn fmod(double2 x, double2 y);
1505 double3 __ovld __cnfn fmod(double3 x, double3 y);
1506 double4 __ovld __cnfn fmod(double4 x, double4 y);
1507 double8 __ovld __cnfn fmod(double8 x, double8 y);
1508 double16 __ovld __cnfn fmod(double16 x, double16 y);
1509-#endif //cl_khr_fp64
1510+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1511 #ifdef cl_khr_fp16
1512 half __ovld __cnfn fmod(half x, half y);
1513 half2 __ovld __cnfn fmod(half2 x, half2 y);
1514@@ -7352,21 +7351,21 @@ half16 __ovld __cnfn fmod(half16 x, half16 y);
1515 * Returns fmin(x - floor (x), 0x1.fffffep-1f ).
1516 * floor(x) is returned in iptr.
1517 */
1518-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1519+#ifdef __opencl_c_generic_address_space
1520 float __ovld fract(float x, float *iptr);
1521 float2 __ovld fract(float2 x, float2 *iptr);
1522 float3 __ovld fract(float3 x, float3 *iptr);
1523 float4 __ovld fract(float4 x, float4 *iptr);
1524 float8 __ovld fract(float8 x, float8 *iptr);
1525 float16 __ovld fract(float16 x, float16 *iptr);
1526-#ifdef cl_khr_fp64
1527+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1528 double __ovld fract(double x, double *iptr);
1529 double2 __ovld fract(double2 x, double2 *iptr);
1530 double3 __ovld fract(double3 x, double3 *iptr);
1531 double4 __ovld fract(double4 x, double4 *iptr);
1532 double8 __ovld fract(double8 x, double8 *iptr);
1533 double16 __ovld fract(double16 x, double16 *iptr);
1534-#endif //cl_khr_fp64
1535+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1536 #ifdef cl_khr_fp16
1537 half __ovld fract(half x, half *iptr);
1538 half2 __ovld fract(half2 x, half2 *iptr);
1539@@ -7375,7 +7374,9 @@ half4 __ovld fract(half4 x, half4 *iptr);
1540 half8 __ovld fract(half8 x, half8 *iptr);
1541 half16 __ovld fract(half16 x, half16 *iptr);
1542 #endif //cl_khr_fp16
1543-#else
1544+#endif //__opencl_c_generic_address_space
1545+
1546+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
1547 float __ovld fract(float x, __global float *iptr);
1548 float2 __ovld fract(float2 x, __global float2 *iptr);
1549 float3 __ovld fract(float3 x, __global float3 *iptr);
1550@@ -7394,7 +7395,7 @@ float3 __ovld fract(float3 x, __private float3 *iptr);
1551 float4 __ovld fract(float4 x, __private float4 *iptr);
1552 float8 __ovld fract(float8 x, __private float8 *iptr);
1553 float16 __ovld fract(float16 x, __private float16 *iptr);
1554-#ifdef cl_khr_fp64
1555+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1556 double __ovld fract(double x, __global double *iptr);
1557 double2 __ovld fract(double2 x, __global double2 *iptr);
1558 double3 __ovld fract(double3 x, __global double3 *iptr);
1559@@ -7413,7 +7414,7 @@ double3 __ovld fract(double3 x, __private double3 *iptr);
1560 double4 __ovld fract(double4 x, __private double4 *iptr);
1561 double8 __ovld fract(double8 x, __private double8 *iptr);
1562 double16 __ovld fract(double16 x, __private double16 *iptr);
1563-#endif //cl_khr_fp64
1564+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1565 #ifdef cl_khr_fp16
1566 half __ovld fract(half x, __global half *iptr);
1567 half2 __ovld fract(half2 x, __global half2 *iptr);
1568@@ -7434,29 +7435,29 @@ half4 __ovld fract(half4 x, __private half4 *iptr);
1569 half8 __ovld fract(half8 x, __private half8 *iptr);
1570 half16 __ovld fract(half16 x, __private half16 *iptr);
1571 #endif //cl_khr_fp16
1572-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1573-
1574+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
1575+ //! CL_VERSION_2_0)
1576 /**
1577 * Extract mantissa and exponent from x. For each
1578 * component the mantissa returned is a float with
1579 * magnitude in the interval [1/2, 1) or 0. Each
1580 * component of x equals mantissa returned * 2^exp.
1581 */
1582-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1583+#ifdef __opencl_c_generic_address_space
1584 float __ovld frexp(float x, int *exp);
1585 float2 __ovld frexp(float2 x, int2 *exp);
1586 float3 __ovld frexp(float3 x, int3 *exp);
1587 float4 __ovld frexp(float4 x, int4 *exp);
1588 float8 __ovld frexp(float8 x, int8 *exp);
1589 float16 __ovld frexp(float16 x, int16 *exp);
1590-#ifdef cl_khr_fp64
1591+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1592 double __ovld frexp(double x, int *exp);
1593 double2 __ovld frexp(double2 x, int2 *exp);
1594 double3 __ovld frexp(double3 x, int3 *exp);
1595 double4 __ovld frexp(double4 x, int4 *exp);
1596 double8 __ovld frexp(double8 x, int8 *exp);
1597 double16 __ovld frexp(double16 x, int16 *exp);
1598-#endif //cl_khr_fp64
1599+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1600 #ifdef cl_khr_fp16
1601 half __ovld frexp(half x, int *exp);
1602 half2 __ovld frexp(half2 x, int2 *exp);
1603@@ -7465,7 +7466,9 @@ half4 __ovld frexp(half4 x, int4 *exp);
1604 half8 __ovld frexp(half8 x, int8 *exp);
1605 half16 __ovld frexp(half16 x, int16 *exp);
1606 #endif //cl_khr_fp16
1607-#else
1608+#endif //__opencl_c_generic_address_space
1609+
1610+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
1611 float __ovld frexp(float x, __global int *exp);
1612 float2 __ovld frexp(float2 x, __global int2 *exp);
1613 float3 __ovld frexp(float3 x, __global int3 *exp);
1614@@ -7484,7 +7487,7 @@ float3 __ovld frexp(float3 x, __private int3 *exp);
1615 float4 __ovld frexp(float4 x, __private int4 *exp);
1616 float8 __ovld frexp(float8 x, __private int8 *exp);
1617 float16 __ovld frexp(float16 x, __private int16 *exp);
1618-#ifdef cl_khr_fp64
1619+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1620 double __ovld frexp(double x, __global int *exp);
1621 double2 __ovld frexp(double2 x, __global int2 *exp);
1622 double3 __ovld frexp(double3 x, __global int3 *exp);
1623@@ -7503,7 +7506,7 @@ double3 __ovld frexp(double3 x, __private int3 *exp);
1624 double4 __ovld frexp(double4 x, __private int4 *exp);
1625 double8 __ovld frexp(double8 x, __private int8 *exp);
1626 double16 __ovld frexp(double16 x, __private int16 *exp);
1627-#endif //cl_khr_fp64
1628+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1629 #ifdef cl_khr_fp16
1630 half __ovld frexp(half x, __global int *exp);
1631 half2 __ovld frexp(half2 x, __global int2 *exp);
1632@@ -7524,7 +7527,8 @@ half4 __ovld frexp(half4 x, __private int4 *exp);
1633 half8 __ovld frexp(half8 x, __private int8 *exp);
1634 half16 __ovld frexp(half16 x, __private int16 *exp);
1635 #endif //cl_khr_fp16
1636-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1637+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
1638+ //! CL_VERSION_2_0)
1639
1640 /**
1641 * Compute the value of the square root of x^2 + y^2
1642@@ -7536,14 +7540,14 @@ float3 __ovld __cnfn hypot(float3 x, float3 y);
1643 float4 __ovld __cnfn hypot(float4 x, float4 y);
1644 float8 __ovld __cnfn hypot(float8 x, float8 y);
1645 float16 __ovld __cnfn hypot(float16 x, float16 y);
1646-#ifdef cl_khr_fp64
1647+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1648 double __ovld __cnfn hypot(double x, double y);
1649 double2 __ovld __cnfn hypot(double2 x, double2 y);
1650 double3 __ovld __cnfn hypot(double3 x, double3 y);
1651 double4 __ovld __cnfn hypot(double4 x, double4 y);
1652 double8 __ovld __cnfn hypot(double8 x, double8 y);
1653 double16 __ovld __cnfn hypot(double16 x, double16 y);
1654-#endif //cl_khr_fp64
1655+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1656 #ifdef cl_khr_fp16
1657 half __ovld __cnfn hypot(half x, half y);
1658 half2 __ovld __cnfn hypot(half2 x, half2 y);
1659@@ -7562,14 +7566,14 @@ int3 __ovld __cnfn ilogb(float3 x);
1660 int4 __ovld __cnfn ilogb(float4 x);
1661 int8 __ovld __cnfn ilogb(float8 x);
1662 int16 __ovld __cnfn ilogb(float16 x);
1663-#ifdef cl_khr_fp64
1664+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1665 int __ovld __cnfn ilogb(double x);
1666 int2 __ovld __cnfn ilogb(double2 x);
1667 int3 __ovld __cnfn ilogb(double3 x);
1668 int4 __ovld __cnfn ilogb(double4 x);
1669 int8 __ovld __cnfn ilogb(double8 x);
1670 int16 __ovld __cnfn ilogb(double16 x);
1671-#endif //cl_khr_fp64
1672+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1673 #ifdef cl_khr_fp16
1674 int __ovld __cnfn ilogb(half x);
1675 int2 __ovld __cnfn ilogb(half2 x);
1676@@ -7593,7 +7597,7 @@ float3 __ovld __cnfn ldexp(float3 x, int n);
1677 float4 __ovld __cnfn ldexp(float4 x, int n);
1678 float8 __ovld __cnfn ldexp(float8 x, int n);
1679 float16 __ovld __cnfn ldexp(float16 x, int n);
1680-#ifdef cl_khr_fp64
1681+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1682 double __ovld __cnfn ldexp(double x, int n);
1683 double2 __ovld __cnfn ldexp(double2 x, int2 n);
1684 double3 __ovld __cnfn ldexp(double3 x, int3 n);
1685@@ -7605,7 +7609,7 @@ double3 __ovld __cnfn ldexp(double3 x, int n);
1686 double4 __ovld __cnfn ldexp(double4 x, int n);
1687 double8 __ovld __cnfn ldexp(double8 x, int n);
1688 double16 __ovld __cnfn ldexp(double16 x, int n);
1689-#endif //cl_khr_fp64
1690+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1691 #ifdef cl_khr_fp16
1692 half __ovld __cnfn ldexp(half x, int n);
1693 half2 __ovld __cnfn ldexp(half2 x, int2 n);
1694@@ -7632,14 +7636,14 @@ float3 __ovld __cnfn lgamma(float3 x);
1695 float4 __ovld __cnfn lgamma(float4 x);
1696 float8 __ovld __cnfn lgamma(float8 x);
1697 float16 __ovld __cnfn lgamma(float16 x);
1698-#ifdef cl_khr_fp64
1699+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1700 double __ovld __cnfn lgamma(double x);
1701 double2 __ovld __cnfn lgamma(double2 x);
1702 double3 __ovld __cnfn lgamma(double3 x);
1703 double4 __ovld __cnfn lgamma(double4 x);
1704 double8 __ovld __cnfn lgamma(double8 x);
1705 double16 __ovld __cnfn lgamma(double16 x);
1706-#endif //cl_khr_fp64
1707+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1708 #ifdef cl_khr_fp16
1709 half __ovld __cnfn lgamma(half x);
1710 half2 __ovld __cnfn lgamma(half2 x);
1711@@ -7649,21 +7653,21 @@ half8 __ovld __cnfn lgamma(half8 x);
1712 half16 __ovld __cnfn lgamma(half16 x);
1713 #endif //cl_khr_fp16
1714
1715-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1716+#ifdef __opencl_c_generic_address_space
1717 float __ovld lgamma_r(float x, int *signp);
1718 float2 __ovld lgamma_r(float2 x, int2 *signp);
1719 float3 __ovld lgamma_r(float3 x, int3 *signp);
1720 float4 __ovld lgamma_r(float4 x, int4 *signp);
1721 float8 __ovld lgamma_r(float8 x, int8 *signp);
1722 float16 __ovld lgamma_r(float16 x, int16 *signp);
1723-#ifdef cl_khr_fp64
1724+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1725 double __ovld lgamma_r(double x, int *signp);
1726 double2 __ovld lgamma_r(double2 x, int2 *signp);
1727 double3 __ovld lgamma_r(double3 x, int3 *signp);
1728 double4 __ovld lgamma_r(double4 x, int4 *signp);
1729 double8 __ovld lgamma_r(double8 x, int8 *signp);
1730 double16 __ovld lgamma_r(double16 x, int16 *signp);
1731-#endif //cl_khr_fp64
1732+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1733 #ifdef cl_khr_fp16
1734 half __ovld lgamma_r(half x, int *signp);
1735 half2 __ovld lgamma_r(half2 x, int2 *signp);
1736@@ -7672,7 +7676,9 @@ half4 __ovld lgamma_r(half4 x, int4 *signp);
1737 half8 __ovld lgamma_r(half8 x, int8 *signp);
1738 half16 __ovld lgamma_r(half16 x, int16 *signp);
1739 #endif //cl_khr_fp16
1740-#else
1741+#endif //__opencl_c_generic_address_space
1742+
1743+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
1744 float __ovld lgamma_r(float x, __global int *signp);
1745 float2 __ovld lgamma_r(float2 x, __global int2 *signp);
1746 float3 __ovld lgamma_r(float3 x, __global int3 *signp);
1747@@ -7691,7 +7697,7 @@ float3 __ovld lgamma_r(float3 x, __private int3 *signp);
1748 float4 __ovld lgamma_r(float4 x, __private int4 *signp);
1749 float8 __ovld lgamma_r(float8 x, __private int8 *signp);
1750 float16 __ovld lgamma_r(float16 x, __private int16 *signp);
1751-#ifdef cl_khr_fp64
1752+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1753 double __ovld lgamma_r(double x, __global int *signp);
1754 double2 __ovld lgamma_r(double2 x, __global int2 *signp);
1755 double3 __ovld lgamma_r(double3 x, __global int3 *signp);
1756@@ -7710,7 +7716,7 @@ double3 __ovld lgamma_r(double3 x, __private int3 *signp);
1757 double4 __ovld lgamma_r(double4 x, __private int4 *signp);
1758 double8 __ovld lgamma_r(double8 x, __private int8 *signp);
1759 double16 __ovld lgamma_r(double16 x, __private int16 *signp);
1760-#endif //cl_khr_fp64
1761+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1762 #ifdef cl_khr_fp16
1763 half __ovld lgamma_r(half x, __global int *signp);
1764 half2 __ovld lgamma_r(half2 x, __global int2 *signp);
1765@@ -7731,8 +7737,8 @@ half4 __ovld lgamma_r(half4 x, __private int4 *signp);
1766 half8 __ovld lgamma_r(half8 x, __private int8 *signp);
1767 half16 __ovld lgamma_r(half16 x, __private int16 *signp);
1768 #endif //cl_khr_fp16
1769-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1770-
1771+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
1772+ //! CL_VERSION_2_0)
1773 /**
1774 * Compute natural logarithm.
1775 */
1776@@ -7742,14 +7748,14 @@ float3 __ovld __cnfn log(float3);
1777 float4 __ovld __cnfn log(float4);
1778 float8 __ovld __cnfn log(float8);
1779 float16 __ovld __cnfn log(float16);
1780-#ifdef cl_khr_fp64
1781+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1782 double __ovld __cnfn log(double);
1783 double2 __ovld __cnfn log(double2);
1784 double3 __ovld __cnfn log(double3);
1785 double4 __ovld __cnfn log(double4);
1786 double8 __ovld __cnfn log(double8);
1787 double16 __ovld __cnfn log(double16);
1788-#endif //cl_khr_fp64
1789+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1790 #ifdef cl_khr_fp16
1791 half __ovld __cnfn log(half);
1792 half2 __ovld __cnfn log(half2);
1793@@ -7760,7 +7766,7 @@ half16 __ovld __cnfn log(half16);
1794 #endif //cl_khr_fp16
1795
1796 /**
1797- * Compute a base 2 logarithm.
1798+ * Compute a base 2 logarithm
1799 */
1800 float __ovld __cnfn log2(float);
1801 float2 __ovld __cnfn log2(float2);
1802@@ -7768,14 +7774,14 @@ float3 __ovld __cnfn log2(float3);
1803 float4 __ovld __cnfn log2(float4);
1804 float8 __ovld __cnfn log2(float8);
1805 float16 __ovld __cnfn log2(float16);
1806-#ifdef cl_khr_fp64
1807+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1808 double __ovld __cnfn log2(double);
1809 double2 __ovld __cnfn log2(double2);
1810 double3 __ovld __cnfn log2(double3);
1811 double4 __ovld __cnfn log2(double4);
1812 double8 __ovld __cnfn log2(double8);
1813 double16 __ovld __cnfn log2(double16);
1814-#endif //cl_khr_fp64
1815+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1816 #ifdef cl_khr_fp16
1817 half __ovld __cnfn log2(half);
1818 half2 __ovld __cnfn log2(half2);
1819@@ -7794,14 +7800,14 @@ float3 __ovld __cnfn log10(float3);
1820 float4 __ovld __cnfn log10(float4);
1821 float8 __ovld __cnfn log10(float8);
1822 float16 __ovld __cnfn log10(float16);
1823-#ifdef cl_khr_fp64
1824+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1825 double __ovld __cnfn log10(double);
1826 double2 __ovld __cnfn log10(double2);
1827 double3 __ovld __cnfn log10(double3);
1828 double4 __ovld __cnfn log10(double4);
1829 double8 __ovld __cnfn log10(double8);
1830 double16 __ovld __cnfn log10(double16);
1831-#endif //cl_khr_fp64
1832+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1833 #ifdef cl_khr_fp16
1834 half __ovld __cnfn log10(half);
1835 half2 __ovld __cnfn log10(half2);
1836@@ -7820,14 +7826,14 @@ float3 __ovld __cnfn log1p(float3 x);
1837 float4 __ovld __cnfn log1p(float4 x);
1838 float8 __ovld __cnfn log1p(float8 x);
1839 float16 __ovld __cnfn log1p(float16 x);
1840-#ifdef cl_khr_fp64
1841+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1842 double __ovld __cnfn log1p(double x);
1843 double2 __ovld __cnfn log1p(double2 x);
1844 double3 __ovld __cnfn log1p(double3 x);
1845 double4 __ovld __cnfn log1p(double4 x);
1846 double8 __ovld __cnfn log1p(double8 x);
1847 double16 __ovld __cnfn log1p(double16 x);
1848-#endif //cl_khr_fp64
1849+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1850 #ifdef cl_khr_fp16
1851 half __ovld __cnfn log1p(half x);
1852 half2 __ovld __cnfn log1p(half2 x);
1853@@ -7847,14 +7853,14 @@ float3 __ovld __cnfn logb(float3 x);
1854 float4 __ovld __cnfn logb(float4 x);
1855 float8 __ovld __cnfn logb(float8 x);
1856 float16 __ovld __cnfn logb(float16 x);
1857-#ifdef cl_khr_fp64
1858+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1859 double __ovld __cnfn logb(double x);
1860 double2 __ovld __cnfn logb(double2 x);
1861 double3 __ovld __cnfn logb(double3 x);
1862 double4 __ovld __cnfn logb(double4 x);
1863 double8 __ovld __cnfn logb(double8 x);
1864 double16 __ovld __cnfn logb(double16 x);
1865-#endif //cl_khr_fp64
1866+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1867 #ifdef cl_khr_fp16
1868 half __ovld __cnfn logb(half x);
1869 half2 __ovld __cnfn logb(half2 x);
1870@@ -7877,14 +7883,14 @@ float3 __ovld __cnfn mad(float3 a, float3 b, float3 c);
1871 float4 __ovld __cnfn mad(float4 a, float4 b, float4 c);
1872 float8 __ovld __cnfn mad(float8 a, float8 b, float8 c);
1873 float16 __ovld __cnfn mad(float16 a, float16 b, float16 c);
1874-#ifdef cl_khr_fp64
1875+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1876 double __ovld __cnfn mad(double a, double b, double c);
1877 double2 __ovld __cnfn mad(double2 a, double2 b, double2 c);
1878 double3 __ovld __cnfn mad(double3 a, double3 b, double3 c);
1879 double4 __ovld __cnfn mad(double4 a, double4 b, double4 c);
1880 double8 __ovld __cnfn mad(double8 a, double8 b, double8 c);
1881 double16 __ovld __cnfn mad(double16 a, double16 b, double16 c);
1882-#endif //cl_khr_fp64
1883+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1884 #ifdef cl_khr_fp16
1885 half __ovld __cnfn mad(half a, half b, half c);
1886 half2 __ovld __cnfn mad(half2 a, half2 b, half2 c);
1887@@ -7904,14 +7910,14 @@ float3 __ovld __cnfn maxmag(float3 x, float3 y);
1888 float4 __ovld __cnfn maxmag(float4 x, float4 y);
1889 float8 __ovld __cnfn maxmag(float8 x, float8 y);
1890 float16 __ovld __cnfn maxmag(float16 x, float16 y);
1891-#ifdef cl_khr_fp64
1892+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1893 double __ovld __cnfn maxmag(double x, double y);
1894 double2 __ovld __cnfn maxmag(double2 x, double2 y);
1895 double3 __ovld __cnfn maxmag(double3 x, double3 y);
1896 double4 __ovld __cnfn maxmag(double4 x, double4 y);
1897 double8 __ovld __cnfn maxmag(double8 x, double8 y);
1898 double16 __ovld __cnfn maxmag(double16 x, double16 y);
1899-#endif //cl_khr_fp64
1900+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1901 #ifdef cl_khr_fp16
1902 half __ovld __cnfn maxmag(half x, half y);
1903 half2 __ovld __cnfn maxmag(half2 x, half2 y);
1904@@ -7931,14 +7937,14 @@ float3 __ovld __cnfn minmag(float3 x, float3 y);
1905 float4 __ovld __cnfn minmag(float4 x, float4 y);
1906 float8 __ovld __cnfn minmag(float8 x, float8 y);
1907 float16 __ovld __cnfn minmag(float16 x, float16 y);
1908-#ifdef cl_khr_fp64
1909+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1910 double __ovld __cnfn minmag(double x, double y);
1911 double2 __ovld __cnfn minmag(double2 x, double2 y);
1912 double3 __ovld __cnfn minmag(double3 x, double3 y);
1913 double4 __ovld __cnfn minmag(double4 x, double4 y);
1914 double8 __ovld __cnfn minmag(double8 x, double8 y);
1915 double16 __ovld __cnfn minmag(double16 x, double16 y);
1916-#endif //cl_khr_fp64
1917+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1918 #ifdef cl_khr_fp16
1919 half __ovld __cnfn minmag(half x, half y);
1920 half2 __ovld __cnfn minmag(half2 x, half2 y);
1921@@ -7955,21 +7961,21 @@ half16 __ovld __cnfn minmag(half16 x, half16 y);
1922 * the argument. It stores the integral part in the object
1923 * pointed to by iptr.
1924 */
1925-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1926+#ifdef __opencl_c_generic_address_space
1927 float __ovld modf(float x, float *iptr);
1928 float2 __ovld modf(float2 x, float2 *iptr);
1929 float3 __ovld modf(float3 x, float3 *iptr);
1930 float4 __ovld modf(float4 x, float4 *iptr);
1931 float8 __ovld modf(float8 x, float8 *iptr);
1932 float16 __ovld modf(float16 x, float16 *iptr);
1933-#ifdef cl_khr_fp64
1934+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1935 double __ovld modf(double x, double *iptr);
1936 double2 __ovld modf(double2 x, double2 *iptr);
1937 double3 __ovld modf(double3 x, double3 *iptr);
1938 double4 __ovld modf(double4 x, double4 *iptr);
1939 double8 __ovld modf(double8 x, double8 *iptr);
1940 double16 __ovld modf(double16 x, double16 *iptr);
1941-#endif //cl_khr_fp64
1942+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1943 #ifdef cl_khr_fp16
1944 half __ovld modf(half x, half *iptr);
1945 half2 __ovld modf(half2 x, half2 *iptr);
1946@@ -7978,7 +7984,9 @@ half4 __ovld modf(half4 x, half4 *iptr);
1947 half8 __ovld modf(half8 x, half8 *iptr);
1948 half16 __ovld modf(half16 x, half16 *iptr);
1949 #endif //cl_khr_fp16
1950-#else
1951+#endif //__opencl_c_generic_address_space
1952+
1953+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
1954 float __ovld modf(float x, __global float *iptr);
1955 float2 __ovld modf(float2 x, __global float2 *iptr);
1956 float3 __ovld modf(float3 x, __global float3 *iptr);
1957@@ -7997,7 +8005,7 @@ float3 __ovld modf(float3 x, __private float3 *iptr);
1958 float4 __ovld modf(float4 x, __private float4 *iptr);
1959 float8 __ovld modf(float8 x, __private float8 *iptr);
1960 float16 __ovld modf(float16 x, __private float16 *iptr);
1961-#ifdef cl_khr_fp64
1962+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1963 double __ovld modf(double x, __global double *iptr);
1964 double2 __ovld modf(double2 x, __global double2 *iptr);
1965 double3 __ovld modf(double3 x, __global double3 *iptr);
1966@@ -8016,7 +8024,7 @@ double3 __ovld modf(double3 x, __private double3 *iptr);
1967 double4 __ovld modf(double4 x, __private double4 *iptr);
1968 double8 __ovld modf(double8 x, __private double8 *iptr);
1969 double16 __ovld modf(double16 x, __private double16 *iptr);
1970-#endif //cl_khr_fp64
1971+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1972 #ifdef cl_khr_fp16
1973 half __ovld modf(half x, __global half *iptr);
1974 half2 __ovld modf(half2 x, __global half2 *iptr);
1975@@ -8037,7 +8045,8 @@ half4 __ovld modf(half4 x, __private half4 *iptr);
1976 half8 __ovld modf(half8 x, __private half8 *iptr);
1977 half16 __ovld modf(half16 x, __private half16 *iptr);
1978 #endif //cl_khr_fp16
1979-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
1980+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
1981+ //! CL_VERSION_2_0)
1982
1983 /**
1984 * Returns a quiet NaN. The nancode may be placed
1985@@ -8049,14 +8058,14 @@ float3 __ovld __cnfn nan(uint3 nancode);
1986 float4 __ovld __cnfn nan(uint4 nancode);
1987 float8 __ovld __cnfn nan(uint8 nancode);
1988 float16 __ovld __cnfn nan(uint16 nancode);
1989-#ifdef cl_khr_fp64
1990+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1991 double __ovld __cnfn nan(ulong nancode);
1992 double2 __ovld __cnfn nan(ulong2 nancode);
1993 double3 __ovld __cnfn nan(ulong3 nancode);
1994 double4 __ovld __cnfn nan(ulong4 nancode);
1995 double8 __ovld __cnfn nan(ulong8 nancode);
1996 double16 __ovld __cnfn nan(ulong16 nancode);
1997-#endif //cl_khr_fp64
1998+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
1999 #ifdef cl_khr_fp16
2000 half __ovld __cnfn nan(ushort nancode);
2001 half2 __ovld __cnfn nan(ushort2 nancode);
2002@@ -8079,14 +8088,14 @@ float3 __ovld __cnfn nextafter(float3 x, float3 y);
2003 float4 __ovld __cnfn nextafter(float4 x, float4 y);
2004 float8 __ovld __cnfn nextafter(float8 x, float8 y);
2005 float16 __ovld __cnfn nextafter(float16 x, float16 y);
2006-#ifdef cl_khr_fp64
2007+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2008 double __ovld __cnfn nextafter(double x, double y);
2009 double2 __ovld __cnfn nextafter(double2 x, double2 y);
2010 double3 __ovld __cnfn nextafter(double3 x, double3 y);
2011 double4 __ovld __cnfn nextafter(double4 x, double4 y);
2012 double8 __ovld __cnfn nextafter(double8 x, double8 y);
2013 double16 __ovld __cnfn nextafter(double16 x, double16 y);
2014-#endif //cl_khr_fp64
2015+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2016 #ifdef cl_khr_fp16
2017 half __ovld __cnfn nextafter(half x, half y);
2018 half2 __ovld __cnfn nextafter(half2 x, half2 y);
2019@@ -8105,14 +8114,14 @@ float3 __ovld __cnfn pow(float3 x, float3 y);
2020 float4 __ovld __cnfn pow(float4 x, float4 y);
2021 float8 __ovld __cnfn pow(float8 x, float8 y);
2022 float16 __ovld __cnfn pow(float16 x, float16 y);
2023-#ifdef cl_khr_fp64
2024+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2025 double __ovld __cnfn pow(double x, double y);
2026 double2 __ovld __cnfn pow(double2 x, double2 y);
2027 double3 __ovld __cnfn pow(double3 x, double3 y);
2028 double4 __ovld __cnfn pow(double4 x, double4 y);
2029 double8 __ovld __cnfn pow(double8 x, double8 y);
2030 double16 __ovld __cnfn pow(double16 x, double16 y);
2031-#endif //cl_khr_fp64
2032+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2033 #ifdef cl_khr_fp16
2034 half __ovld __cnfn pow(half x, half y);
2035 half2 __ovld __cnfn pow(half2 x, half2 y);
2036@@ -8131,14 +8140,14 @@ float3 __ovld __cnfn pown(float3 x, int3 y);
2037 float4 __ovld __cnfn pown(float4 x, int4 y);
2038 float8 __ovld __cnfn pown(float8 x, int8 y);
2039 float16 __ovld __cnfn pown(float16 x, int16 y);
2040-#ifdef cl_khr_fp64
2041+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2042 double __ovld __cnfn pown(double x, int y);
2043 double2 __ovld __cnfn pown(double2 x, int2 y);
2044 double3 __ovld __cnfn pown(double3 x, int3 y);
2045 double4 __ovld __cnfn pown(double4 x, int4 y);
2046 double8 __ovld __cnfn pown(double8 x, int8 y);
2047 double16 __ovld __cnfn pown(double16 x, int16 y);
2048-#endif //cl_khr_fp64
2049+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2050 #ifdef cl_khr_fp16
2051 half __ovld __cnfn pown(half x, int y);
2052 half2 __ovld __cnfn pown(half2 x, int2 y);
2053@@ -8157,14 +8166,14 @@ float3 __ovld __cnfn powr(float3 x, float3 y);
2054 float4 __ovld __cnfn powr(float4 x, float4 y);
2055 float8 __ovld __cnfn powr(float8 x, float8 y);
2056 float16 __ovld __cnfn powr(float16 x, float16 y);
2057-#ifdef cl_khr_fp64
2058+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2059 double __ovld __cnfn powr(double x, double y);
2060 double2 __ovld __cnfn powr(double2 x, double2 y);
2061 double3 __ovld __cnfn powr(double3 x, double3 y);
2062 double4 __ovld __cnfn powr(double4 x, double4 y);
2063 double8 __ovld __cnfn powr(double8 x, double8 y);
2064 double16 __ovld __cnfn powr(double16 x, double16 y);
2065-#endif //cl_khr_fp64
2066+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2067 #ifdef cl_khr_fp16
2068 half __ovld __cnfn powr(half x, half y);
2069 half2 __ovld __cnfn powr(half2 x, half2 y);
2070@@ -8186,14 +8195,14 @@ float3 __ovld __cnfn remainder(float3 x, float3 y);
2071 float4 __ovld __cnfn remainder(float4 x, float4 y);
2072 float8 __ovld __cnfn remainder(float8 x, float8 y);
2073 float16 __ovld __cnfn remainder(float16 x, float16 y);
2074-#ifdef cl_khr_fp64
2075+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2076 double __ovld __cnfn remainder(double x, double y);
2077 double2 __ovld __cnfn remainder(double2 x, double2 y);
2078 double3 __ovld __cnfn remainder(double3 x, double3 y);
2079 double4 __ovld __cnfn remainder(double4 x, double4 y);
2080 double8 __ovld __cnfn remainder(double8 x, double8 y);
2081 double16 __ovld __cnfn remainder(double16 x, double16 y);
2082-#endif //cl_khr_fp64
2083+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2084 #ifdef cl_khr_fp16
2085 half __ovld __cnfn remainder(half x, half y);
2086 half2 __ovld __cnfn remainder(half2 x, half2 y);
2087@@ -8215,21 +8224,21 @@ half16 __ovld __cnfn remainder(half16 x, half16 y);
2088 * sign as x/y. It stores this signed value in the object
2089 * pointed to by quo.
2090 */
2091-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
2092+#ifdef __opencl_c_generic_address_space
2093 float __ovld remquo(float x, float y, int *quo);
2094 float2 __ovld remquo(float2 x, float2 y, int2 *quo);
2095 float3 __ovld remquo(float3 x, float3 y, int3 *quo);
2096 float4 __ovld remquo(float4 x, float4 y, int4 *quo);
2097 float8 __ovld remquo(float8 x, float8 y, int8 *quo);
2098 float16 __ovld remquo(float16 x, float16 y, int16 *quo);
2099-#ifdef cl_khr_fp64
2100+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2101 double __ovld remquo(double x, double y, int *quo);
2102 double2 __ovld remquo(double2 x, double2 y, int2 *quo);
2103 double3 __ovld remquo(double3 x, double3 y, int3 *quo);
2104 double4 __ovld remquo(double4 x, double4 y, int4 *quo);
2105 double8 __ovld remquo(double8 x, double8 y, int8 *quo);
2106 double16 __ovld remquo(double16 x, double16 y, int16 *quo);
2107-#endif //cl_khr_fp64
2108+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2109 #ifdef cl_khr_fp16
2110 half __ovld remquo(half x, half y, int *quo);
2111 half2 __ovld remquo(half2 x, half2 y, int2 *quo);
2112@@ -8237,9 +8246,10 @@ half3 __ovld remquo(half3 x, half3 y, int3 *quo);
2113 half4 __ovld remquo(half4 x, half4 y, int4 *quo);
2114 half8 __ovld remquo(half8 x, half8 y, int8 *quo);
2115 half16 __ovld remquo(half16 x, half16 y, int16 *quo);
2116-
2117 #endif //cl_khr_fp16
2118-#else
2119+#endif //__opencl_c_generic_address_space
2120+
2121+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
2122 float __ovld remquo(float x, float y, __global int *quo);
2123 float2 __ovld remquo(float2 x, float2 y, __global int2 *quo);
2124 float3 __ovld remquo(float3 x, float3 y, __global int3 *quo);
2125@@ -8258,7 +8268,7 @@ float3 __ovld remquo(float3 x, float3 y, __private int3 *quo);
2126 float4 __ovld remquo(float4 x, float4 y, __private int4 *quo);
2127 float8 __ovld remquo(float8 x, float8 y, __private int8 *quo);
2128 float16 __ovld remquo(float16 x, float16 y, __private int16 *quo);
2129-#ifdef cl_khr_fp64
2130+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2131 double __ovld remquo(double x, double y, __global int *quo);
2132 double2 __ovld remquo(double2 x, double2 y, __global int2 *quo);
2133 double3 __ovld remquo(double3 x, double3 y, __global int3 *quo);
2134@@ -8277,7 +8287,7 @@ double3 __ovld remquo(double3 x, double3 y, __private int3 *quo);
2135 double4 __ovld remquo(double4 x, double4 y, __private int4 *quo);
2136 double8 __ovld remquo(double8 x, double8 y, __private int8 *quo);
2137 double16 __ovld remquo(double16 x, double16 y, __private int16 *quo);
2138-#endif //cl_khr_fp64
2139+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2140 #ifdef cl_khr_fp16
2141 half __ovld remquo(half x, half y, __global int *quo);
2142 half2 __ovld remquo(half2 x, half2 y, __global int2 *quo);
2143@@ -8298,7 +8308,8 @@ half4 __ovld remquo(half4 x, half4 y, __private int4 *quo);
2144 half8 __ovld remquo(half8 x, half8 y, __private int8 *quo);
2145 half16 __ovld remquo(half16 x, half16 y, __private int16 *quo);
2146 #endif //cl_khr_fp16
2147-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
2148+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
2149+ //! CL_VERSION_2_0)
2150 /**
2151 * Round to integral value (using round to nearest
2152 * even rounding mode) in floating-point format.
2153@@ -8311,14 +8322,14 @@ float3 __ovld __cnfn rint(float3);
2154 float4 __ovld __cnfn rint(float4);
2155 float8 __ovld __cnfn rint(float8);
2156 float16 __ovld __cnfn rint(float16);
2157-#ifdef cl_khr_fp64
2158+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2159 double __ovld __cnfn rint(double);
2160 double2 __ovld __cnfn rint(double2);
2161 double3 __ovld __cnfn rint(double3);
2162 double4 __ovld __cnfn rint(double4);
2163 double8 __ovld __cnfn rint(double8);
2164 double16 __ovld __cnfn rint(double16);
2165-#endif //cl_khr_fp64
2166+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2167 #ifdef cl_khr_fp16
2168 half __ovld __cnfn rint(half);
2169 half2 __ovld __cnfn rint(half2);
2170@@ -8337,14 +8348,14 @@ float3 __ovld __cnfn rootn(float3 x, int3 y);
2171 float4 __ovld __cnfn rootn(float4 x, int4 y);
2172 float8 __ovld __cnfn rootn(float8 x, int8 y);
2173 float16 __ovld __cnfn rootn(float16 x, int16 y);
2174-#ifdef cl_khr_fp64
2175+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2176 double __ovld __cnfn rootn(double x, int y);
2177 double2 __ovld __cnfn rootn(double2 x, int2 y);
2178 double3 __ovld __cnfn rootn(double3 x, int3 y);
2179 double4 __ovld __cnfn rootn(double4 x, int4 y);
2180 double8 __ovld __cnfn rootn(double8 x, int8 y);
2181 double16 __ovld __cnfn rootn(double16 x, int16 y);
2182-#endif //cl_khr_fp64
2183+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2184 #ifdef cl_khr_fp16
2185 half __ovld __cnfn rootn(half x, int y);
2186 half2 __ovld __cnfn rootn(half2 x, int2 y);
2187@@ -8365,14 +8376,14 @@ float3 __ovld __cnfn round(float3 x);
2188 float4 __ovld __cnfn round(float4 x);
2189 float8 __ovld __cnfn round(float8 x);
2190 float16 __ovld __cnfn round(float16 x);
2191-#ifdef cl_khr_fp64
2192+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2193 double __ovld __cnfn round(double x);
2194 double2 __ovld __cnfn round(double2 x);
2195 double3 __ovld __cnfn round(double3 x);
2196 double4 __ovld __cnfn round(double4 x);
2197 double8 __ovld __cnfn round(double8 x);
2198 double16 __ovld __cnfn round(double16 x);
2199-#endif //cl_khr_fp64
2200+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2201 #ifdef cl_khr_fp16
2202 half __ovld __cnfn round(half x);
2203 half2 __ovld __cnfn round(half2 x);
2204@@ -8391,14 +8402,14 @@ float3 __ovld __cnfn rsqrt(float3);
2205 float4 __ovld __cnfn rsqrt(float4);
2206 float8 __ovld __cnfn rsqrt(float8);
2207 float16 __ovld __cnfn rsqrt(float16);
2208-#ifdef cl_khr_fp64
2209+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2210 double __ovld __cnfn rsqrt(double);
2211 double2 __ovld __cnfn rsqrt(double2);
2212 double3 __ovld __cnfn rsqrt(double3);
2213 double4 __ovld __cnfn rsqrt(double4);
2214 double8 __ovld __cnfn rsqrt(double8);
2215 double16 __ovld __cnfn rsqrt(double16);
2216-#endif //cl_khr_fp64
2217+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2218 #ifdef cl_khr_fp16
2219 half __ovld __cnfn rsqrt(half);
2220 half2 __ovld __cnfn rsqrt(half2);
2221@@ -8417,14 +8428,14 @@ float3 __ovld __cnfn sin(float3);
2222 float4 __ovld __cnfn sin(float4);
2223 float8 __ovld __cnfn sin(float8);
2224 float16 __ovld __cnfn sin(float16);
2225-#ifdef cl_khr_fp64
2226+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2227 double __ovld __cnfn sin(double);
2228 double2 __ovld __cnfn sin(double2);
2229 double3 __ovld __cnfn sin(double3);
2230 double4 __ovld __cnfn sin(double4);
2231 double8 __ovld __cnfn sin(double8);
2232 double16 __ovld __cnfn sin(double16);
2233-#endif //cl_khr_fp64
2234+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2235 #ifdef cl_khr_fp16
2236 half __ovld __cnfn sin(half);
2237 half2 __ovld __cnfn sin(half2);
2238@@ -8439,21 +8450,21 @@ half16 __ovld __cnfn sin(half16);
2239 * is the return value and computed cosine is returned
2240 * in cosval.
2241 */
2242-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
2243+#ifdef __opencl_c_generic_address_space
2244 float __ovld sincos(float x, float *cosval);
2245 float2 __ovld sincos(float2 x, float2 *cosval);
2246 float3 __ovld sincos(float3 x, float3 *cosval);
2247 float4 __ovld sincos(float4 x, float4 *cosval);
2248 float8 __ovld sincos(float8 x, float8 *cosval);
2249 float16 __ovld sincos(float16 x, float16 *cosval);
2250-#ifdef cl_khr_fp64
2251+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2252 double __ovld sincos(double x, double *cosval);
2253 double2 __ovld sincos(double2 x, double2 *cosval);
2254 double3 __ovld sincos(double3 x, double3 *cosval);
2255 double4 __ovld sincos(double4 x, double4 *cosval);
2256 double8 __ovld sincos(double8 x, double8 *cosval);
2257 double16 __ovld sincos(double16 x, double16 *cosval);
2258-#endif //cl_khr_fp64
2259+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2260 #ifdef cl_khr_fp16
2261 half __ovld sincos(half x, half *cosval);
2262 half2 __ovld sincos(half2 x, half2 *cosval);
2263@@ -8462,7 +8473,9 @@ half4 __ovld sincos(half4 x, half4 *cosval);
2264 half8 __ovld sincos(half8 x, half8 *cosval);
2265 half16 __ovld sincos(half16 x, half16 *cosval);
2266 #endif //cl_khr_fp16
2267-#else
2268+#endif //__opencl_c_generic_address_space
2269+
2270+#if !defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ != CL_VERSION_2_0)
2271 float __ovld sincos(float x, __global float *cosval);
2272 float2 __ovld sincos(float2 x, __global float2 *cosval);
2273 float3 __ovld sincos(float3 x, __global float3 *cosval);
2274@@ -8481,7 +8494,7 @@ float3 __ovld sincos(float3 x, __private float3 *cosval);
2275 float4 __ovld sincos(float4 x, __private float4 *cosval);
2276 float8 __ovld sincos(float8 x, __private float8 *cosval);
2277 float16 __ovld sincos(float16 x, __private float16 *cosval);
2278-#ifdef cl_khr_fp64
2279+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2280 double __ovld sincos(double x, __global double *cosval);
2281 double2 __ovld sincos(double2 x, __global double2 *cosval);
2282 double3 __ovld sincos(double3 x, __global double3 *cosval);
2283@@ -8500,7 +8513,7 @@ double3 __ovld sincos(double3 x, __private double3 *cosval);
2284 double4 __ovld sincos(double4 x, __private double4 *cosval);
2285 double8 __ovld sincos(double8 x, __private double8 *cosval);
2286 double16 __ovld sincos(double16 x, __private double16 *cosval);
2287-#endif //cl_khr_fp64
2288+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2289 #ifdef cl_khr_fp16
2290 half __ovld sincos(half x, __global half *cosval);
2291 half2 __ovld sincos(half2 x, __global half2 *cosval);
2292@@ -8521,8 +8534,8 @@ half4 __ovld sincos(half4 x, __private half4 *cosval);
2293 half8 __ovld sincos(half8 x, __private half8 *cosval);
2294 half16 __ovld sincos(half16 x, __private half16 *cosval);
2295 #endif //cl_khr_fp16
2296-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
2297-
2298+#endif //! defined(__OPENCL_CPP_VERSION__) && (__OPENCL_C_VERSION__ !=
2299+ //! CL_VERSION_2_0)
2300 /**
2301 * Compute hyperbolic sine.
2302 */
2303@@ -8532,14 +8545,14 @@ float3 __ovld __cnfn sinh(float3);
2304 float4 __ovld __cnfn sinh(float4);
2305 float8 __ovld __cnfn sinh(float8);
2306 float16 __ovld __cnfn sinh(float16);
2307-#ifdef cl_khr_fp64
2308+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2309 double __ovld __cnfn sinh(double);
2310 double2 __ovld __cnfn sinh(double2);
2311 double3 __ovld __cnfn sinh(double3);
2312 double4 __ovld __cnfn sinh(double4);
2313 double8 __ovld __cnfn sinh(double8);
2314 double16 __ovld __cnfn sinh(double16);
2315-#endif //cl_khr_fp64
2316+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2317 #ifdef cl_khr_fp16
2318 half __ovld __cnfn sinh(half);
2319 half2 __ovld __cnfn sinh(half2);
2320@@ -8558,14 +8571,14 @@ float3 __ovld __cnfn sinpi(float3 x);
2321 float4 __ovld __cnfn sinpi(float4 x);
2322 float8 __ovld __cnfn sinpi(float8 x);
2323 float16 __ovld __cnfn sinpi(float16 x);
2324-#ifdef cl_khr_fp64
2325+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2326 double __ovld __cnfn sinpi(double x);
2327 double2 __ovld __cnfn sinpi(double2 x);
2328 double3 __ovld __cnfn sinpi(double3 x);
2329 double4 __ovld __cnfn sinpi(double4 x);
2330 double8 __ovld __cnfn sinpi(double8 x);
2331 double16 __ovld __cnfn sinpi(double16 x);
2332-#endif //cl_khr_fp64
2333+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2334 #ifdef cl_khr_fp16
2335 half __ovld __cnfn sinpi(half x);
2336 half2 __ovld __cnfn sinpi(half2 x);
2337@@ -8584,14 +8597,14 @@ float3 __ovld __cnfn sqrt(float3);
2338 float4 __ovld __cnfn sqrt(float4);
2339 float8 __ovld __cnfn sqrt(float8);
2340 float16 __ovld __cnfn sqrt(float16);
2341-#ifdef cl_khr_fp64
2342+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2343 double __ovld __cnfn sqrt(double);
2344 double2 __ovld __cnfn sqrt(double2);
2345 double3 __ovld __cnfn sqrt(double3);
2346 double4 __ovld __cnfn sqrt(double4);
2347 double8 __ovld __cnfn sqrt(double8);
2348 double16 __ovld __cnfn sqrt(double16);
2349-#endif //cl_khr_fp64
2350+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2351 #ifdef cl_khr_fp16
2352 half __ovld __cnfn sqrt(half);
2353 half2 __ovld __cnfn sqrt(half2);
2354@@ -8610,14 +8623,14 @@ float3 __ovld __cnfn tan(float3);
2355 float4 __ovld __cnfn tan(float4);
2356 float8 __ovld __cnfn tan(float8);
2357 float16 __ovld __cnfn tan(float16);
2358-#ifdef cl_khr_fp64
2359+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2360 double __ovld __cnfn tan(double);
2361 double2 __ovld __cnfn tan(double2);
2362 double3 __ovld __cnfn tan(double3);
2363 double4 __ovld __cnfn tan(double4);
2364 double8 __ovld __cnfn tan(double8);
2365 double16 __ovld __cnfn tan(double16);
2366-#endif //cl_khr_fp64
2367+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2368 #ifdef cl_khr_fp16
2369 half __ovld __cnfn tan(half);
2370 half2 __ovld __cnfn tan(half2);
2371@@ -8636,14 +8649,14 @@ float3 __ovld __cnfn tanh(float3);
2372 float4 __ovld __cnfn tanh(float4);
2373 float8 __ovld __cnfn tanh(float8);
2374 float16 __ovld __cnfn tanh(float16);
2375-#ifdef cl_khr_fp64
2376+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2377 double __ovld __cnfn tanh(double);
2378 double2 __ovld __cnfn tanh(double2);
2379 double3 __ovld __cnfn tanh(double3);
2380 double4 __ovld __cnfn tanh(double4);
2381 double8 __ovld __cnfn tanh(double8);
2382 double16 __ovld __cnfn tanh(double16);
2383-#endif //cl_khr_fp64
2384+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2385 #ifdef cl_khr_fp16
2386 half __ovld __cnfn tanh(half);
2387 half2 __ovld __cnfn tanh(half2);
2388@@ -8662,14 +8675,14 @@ float3 __ovld __cnfn tanpi(float3 x);
2389 float4 __ovld __cnfn tanpi(float4 x);
2390 float8 __ovld __cnfn tanpi(float8 x);
2391 float16 __ovld __cnfn tanpi(float16 x);
2392-#ifdef cl_khr_fp64
2393+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2394 double __ovld __cnfn tanpi(double x);
2395 double2 __ovld __cnfn tanpi(double2 x);
2396 double3 __ovld __cnfn tanpi(double3 x);
2397 double4 __ovld __cnfn tanpi(double4 x);
2398 double8 __ovld __cnfn tanpi(double8 x);
2399 double16 __ovld __cnfn tanpi(double16 x);
2400-#endif //cl_khr_fp64
2401+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2402 #ifdef cl_khr_fp16
2403 half __ovld __cnfn tanpi(half x);
2404 half2 __ovld __cnfn tanpi(half2 x);
2405@@ -8688,14 +8701,14 @@ float3 __ovld __cnfn tgamma(float3);
2406 float4 __ovld __cnfn tgamma(float4);
2407 float8 __ovld __cnfn tgamma(float8);
2408 float16 __ovld __cnfn tgamma(float16);
2409-#ifdef cl_khr_fp64
2410+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2411 double __ovld __cnfn tgamma(double);
2412 double2 __ovld __cnfn tgamma(double2);
2413 double3 __ovld __cnfn tgamma(double3);
2414 double4 __ovld __cnfn tgamma(double4);
2415 double8 __ovld __cnfn tgamma(double8);
2416 double16 __ovld __cnfn tgamma(double16);
2417-#endif //cl_khr_fp64
2418+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2419 #ifdef cl_khr_fp16
2420 half __ovld __cnfn tgamma(half);
2421 half2 __ovld __cnfn tgamma(half2);
2422@@ -8715,14 +8728,14 @@ float3 __ovld __cnfn trunc(float3);
2423 float4 __ovld __cnfn trunc(float4);
2424 float8 __ovld __cnfn trunc(float8);
2425 float16 __ovld __cnfn trunc(float16);
2426-#ifdef cl_khr_fp64
2427+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2428 double __ovld __cnfn trunc(double);
2429 double2 __ovld __cnfn trunc(double2);
2430 double3 __ovld __cnfn trunc(double3);
2431 double4 __ovld __cnfn trunc(double4);
2432 double8 __ovld __cnfn trunc(double8);
2433 double16 __ovld __cnfn trunc(double16);
2434-#endif //cl_khr_fp64
2435+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2436 #ifdef cl_khr_fp16
2437 half __ovld __cnfn trunc(half);
2438 half2 __ovld __cnfn trunc(half2);
2439@@ -10108,7 +10121,7 @@ float3 __ovld __cnfn clamp(float3 x, float minval, float maxval);
2440 float4 __ovld __cnfn clamp(float4 x, float minval, float maxval);
2441 float8 __ovld __cnfn clamp(float8 x, float minval, float maxval);
2442 float16 __ovld __cnfn clamp(float16 x, float minval, float maxval);
2443-#ifdef cl_khr_fp64
2444+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2445 double __ovld __cnfn clamp(double x, double minval, double maxval);
2446 double2 __ovld __cnfn clamp(double2 x, double2 minval, double2 maxval);
2447 double3 __ovld __cnfn clamp(double3 x, double3 minval, double3 maxval);
2448@@ -10120,7 +10133,7 @@ double3 __ovld __cnfn clamp(double3 x, double minval, double maxval);
2449 double4 __ovld __cnfn clamp(double4 x, double minval, double maxval);
2450 double8 __ovld __cnfn clamp(double8 x, double minval, double maxval);
2451 double16 __ovld __cnfn clamp(double16 x, double minval, double maxval);
2452-#endif //cl_khr_fp64
2453+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2454 #ifdef cl_khr_fp16
2455 half __ovld __cnfn clamp(half x, half minval, half maxval);
2456 half2 __ovld __cnfn clamp(half2 x, half2 minval, half2 maxval);
2457@@ -10145,14 +10158,14 @@ float3 __ovld __cnfn degrees(float3 radians);
2458 float4 __ovld __cnfn degrees(float4 radians);
2459 float8 __ovld __cnfn degrees(float8 radians);
2460 float16 __ovld __cnfn degrees(float16 radians);
2461-#ifdef cl_khr_fp64
2462+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2463 double __ovld __cnfn degrees(double radians);
2464 double2 __ovld __cnfn degrees(double2 radians);
2465 double3 __ovld __cnfn degrees(double3 radians);
2466 double4 __ovld __cnfn degrees(double4 radians);
2467 double8 __ovld __cnfn degrees(double8 radians);
2468 double16 __ovld __cnfn degrees(double16 radians);
2469-#endif //cl_khr_fp64
2470+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2471 #ifdef cl_khr_fp16
2472 half __ovld __cnfn degrees(half radians);
2473 half2 __ovld __cnfn degrees(half2 radians);
2474@@ -10177,7 +10190,7 @@ float3 __ovld __cnfn max(float3 x, float y);
2475 float4 __ovld __cnfn max(float4 x, float y);
2476 float8 __ovld __cnfn max(float8 x, float y);
2477 float16 __ovld __cnfn max(float16 x, float y);
2478-#ifdef cl_khr_fp64
2479+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2480 double __ovld __cnfn max(double x, double y);
2481 double2 __ovld __cnfn max(double2 x, double2 y);
2482 double3 __ovld __cnfn max(double3 x, double3 y);
2483@@ -10189,7 +10202,7 @@ double3 __ovld __cnfn max(double3 x, double y);
2484 double4 __ovld __cnfn max(double4 x, double y);
2485 double8 __ovld __cnfn max(double8 x, double y);
2486 double16 __ovld __cnfn max(double16 x, double y);
2487-#endif //cl_khr_fp64
2488+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2489 #ifdef cl_khr_fp16
2490 half __ovld __cnfn max(half x, half y);
2491 half2 __ovld __cnfn max(half2 x, half2 y);
2492@@ -10219,7 +10232,7 @@ float3 __ovld __cnfn min(float3 x, float y);
2493 float4 __ovld __cnfn min(float4 x, float y);
2494 float8 __ovld __cnfn min(float8 x, float y);
2495 float16 __ovld __cnfn min(float16 x, float y);
2496-#ifdef cl_khr_fp64
2497+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2498 double __ovld __cnfn min(double x, double y);
2499 double2 __ovld __cnfn min(double2 x, double2 y);
2500 double3 __ovld __cnfn min(double3 x, double3 y);
2501@@ -10231,7 +10244,7 @@ double3 __ovld __cnfn min(double3 x, double y);
2502 double4 __ovld __cnfn min(double4 x, double y);
2503 double8 __ovld __cnfn min(double8 x, double y);
2504 double16 __ovld __cnfn min(double16 x, double y);
2505-#endif //cl_khr_fp64
2506+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2507 #ifdef cl_khr_fp16
2508 half __ovld __cnfn min(half x, half y);
2509 half2 __ovld __cnfn min(half2 x, half2 y);
2510@@ -10264,7 +10277,7 @@ float3 __ovld __cnfn mix(float3 x, float3 y, float a);
2511 float4 __ovld __cnfn mix(float4 x, float4 y, float a);
2512 float8 __ovld __cnfn mix(float8 x, float8 y, float a);
2513 float16 __ovld __cnfn mix(float16 x, float16 y, float a);
2514-#ifdef cl_khr_fp64
2515+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2516 double __ovld __cnfn mix(double x, double y, double a);
2517 double2 __ovld __cnfn mix(double2 x, double2 y, double2 a);
2518 double3 __ovld __cnfn mix(double3 x, double3 y, double3 a);
2519@@ -10276,7 +10289,7 @@ double3 __ovld __cnfn mix(double3 x, double3 y, double a);
2520 double4 __ovld __cnfn mix(double4 x, double4 y, double a);
2521 double8 __ovld __cnfn mix(double8 x, double8 y, double a);
2522 double16 __ovld __cnfn mix(double16 x, double16 y, double a);
2523-#endif //cl_khr_fp64
2524+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2525 #ifdef cl_khr_fp16
2526 half __ovld __cnfn mix(half x, half y, half a);
2527 half2 __ovld __cnfn mix(half2 x, half2 y, half2 a);
2528@@ -10301,14 +10314,14 @@ float3 __ovld __cnfn radians(float3 degrees);
2529 float4 __ovld __cnfn radians(float4 degrees);
2530 float8 __ovld __cnfn radians(float8 degrees);
2531 float16 __ovld __cnfn radians(float16 degrees);
2532-#ifdef cl_khr_fp64
2533+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2534 double __ovld __cnfn radians(double degrees);
2535 double2 __ovld __cnfn radians(double2 degrees);
2536 double3 __ovld __cnfn radians(double3 degrees);
2537 double4 __ovld __cnfn radians(double4 degrees);
2538 double8 __ovld __cnfn radians(double8 degrees);
2539 double16 __ovld __cnfn radians(double16 degrees);
2540-#endif //cl_khr_fp64
2541+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2542 #ifdef cl_khr_fp16
2543 half __ovld __cnfn radians(half degrees);
2544 half2 __ovld __cnfn radians(half2 degrees);
2545@@ -10332,7 +10345,7 @@ float3 __ovld __cnfn step(float edge, float3 x);
2546 float4 __ovld __cnfn step(float edge, float4 x);
2547 float8 __ovld __cnfn step(float edge, float8 x);
2548 float16 __ovld __cnfn step(float edge, float16 x);
2549-#ifdef cl_khr_fp64
2550+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2551 double __ovld __cnfn step(double edge, double x);
2552 double2 __ovld __cnfn step(double2 edge, double2 x);
2553 double3 __ovld __cnfn step(double3 edge, double3 x);
2554@@ -10344,7 +10357,7 @@ double3 __ovld __cnfn step(double edge, double3 x);
2555 double4 __ovld __cnfn step(double edge, double4 x);
2556 double8 __ovld __cnfn step(double edge, double8 x);
2557 double16 __ovld __cnfn step(double edge, double16 x);
2558-#endif //cl_khr_fp64
2559+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2560 #ifdef cl_khr_fp16
2561 half __ovld __cnfn step(half edge, half x);
2562 half2 __ovld __cnfn step(half2 edge, half2 x);
2563@@ -10383,7 +10396,7 @@ float3 __ovld __cnfn smoothstep(float edge0, float edge1, float3 x);
2564 float4 __ovld __cnfn smoothstep(float edge0, float edge1, float4 x);
2565 float8 __ovld __cnfn smoothstep(float edge0, float edge1, float8 x);
2566 float16 __ovld __cnfn smoothstep(float edge0, float edge1, float16 x);
2567-#ifdef cl_khr_fp64
2568+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2569 double __ovld __cnfn smoothstep(double edge0, double edge1, double x);
2570 double2 __ovld __cnfn smoothstep(double2 edge0, double2 edge1, double2 x);
2571 double3 __ovld __cnfn smoothstep(double3 edge0, double3 edge1, double3 x);
2572@@ -10395,7 +10408,7 @@ double3 __ovld __cnfn smoothstep(double edge0, double edge1, double3 x);
2573 double4 __ovld __cnfn smoothstep(double edge0, double edge1, double4 x);
2574 double8 __ovld __cnfn smoothstep(double edge0, double edge1, double8 x);
2575 double16 __ovld __cnfn smoothstep(double edge0, double edge1, double16 x);
2576-#endif //cl_khr_fp64
2577+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2578 #ifdef cl_khr_fp16
2579 half __ovld __cnfn smoothstep(half edge0, half edge1, half x);
2580 half2 __ovld __cnfn smoothstep(half2 edge0, half2 edge1, half2 x);
2581@@ -10420,14 +10433,14 @@ float3 __ovld __cnfn sign(float3 x);
2582 float4 __ovld __cnfn sign(float4 x);
2583 float8 __ovld __cnfn sign(float8 x);
2584 float16 __ovld __cnfn sign(float16 x);
2585-#ifdef cl_khr_fp64
2586+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2587 double __ovld __cnfn sign(double x);
2588 double2 __ovld __cnfn sign(double2 x);
2589 double3 __ovld __cnfn sign(double3 x);
2590 double4 __ovld __cnfn sign(double4 x);
2591 double8 __ovld __cnfn sign(double8 x);
2592 double16 __ovld __cnfn sign(double16 x);
2593-#endif //cl_khr_fp64
2594+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2595 #ifdef cl_khr_fp16
2596 half __ovld __cnfn sign(half x);
2597 half2 __ovld __cnfn sign(half2 x);
2598@@ -10445,10 +10458,10 @@ half16 __ovld __cnfn sign(half16 x);
2599 */
2600 float4 __ovld __cnfn cross(float4 p0, float4 p1);
2601 float3 __ovld __cnfn cross(float3 p0, float3 p1);
2602-#ifdef cl_khr_fp64
2603+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2604 double4 __ovld __cnfn cross(double4 p0, double4 p1);
2605 double3 __ovld __cnfn cross(double3 p0, double3 p1);
2606-#endif //cl_khr_fp64
2607+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2608 #ifdef cl_khr_fp16
2609 half4 __ovld __cnfn cross(half4 p0, half4 p1);
2610 half3 __ovld __cnfn cross(half3 p0, half3 p1);
2611@@ -10461,12 +10474,12 @@ float __ovld __cnfn dot(float p0, float p1);
2612 float __ovld __cnfn dot(float2 p0, float2 p1);
2613 float __ovld __cnfn dot(float3 p0, float3 p1);
2614 float __ovld __cnfn dot(float4 p0, float4 p1);
2615-#ifdef cl_khr_fp64
2616+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2617 double __ovld __cnfn dot(double p0, double p1);
2618 double __ovld __cnfn dot(double2 p0, double2 p1);
2619 double __ovld __cnfn dot(double3 p0, double3 p1);
2620 double __ovld __cnfn dot(double4 p0, double4 p1);
2621-#endif //cl_khr_fp64
2622+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2623 #ifdef cl_khr_fp16
2624 half __ovld __cnfn dot(half p0, half p1);
2625 half __ovld __cnfn dot(half2 p0, half2 p1);
2626@@ -10482,12 +10495,12 @@ float __ovld __cnfn distance(float p0, float p1);
2627 float __ovld __cnfn distance(float2 p0, float2 p1);
2628 float __ovld __cnfn distance(float3 p0, float3 p1);
2629 float __ovld __cnfn distance(float4 p0, float4 p1);
2630-#ifdef cl_khr_fp64
2631+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2632 double __ovld __cnfn distance(double p0, double p1);
2633 double __ovld __cnfn distance(double2 p0, double2 p1);
2634 double __ovld __cnfn distance(double3 p0, double3 p1);
2635 double __ovld __cnfn distance(double4 p0, double4 p1);
2636-#endif //cl_khr_fp64
2637+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2638 #ifdef cl_khr_fp16
2639 half __ovld __cnfn distance(half p0, half p1);
2640 half __ovld __cnfn distance(half2 p0, half2 p1);
2641@@ -10503,12 +10516,12 @@ float __ovld __cnfn length(float p);
2642 float __ovld __cnfn length(float2 p);
2643 float __ovld __cnfn length(float3 p);
2644 float __ovld __cnfn length(float4 p);
2645-#ifdef cl_khr_fp64
2646+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2647 double __ovld __cnfn length(double p);
2648 double __ovld __cnfn length(double2 p);
2649 double __ovld __cnfn length(double3 p);
2650 double __ovld __cnfn length(double4 p);
2651-#endif //cl_khr_fp64
2652+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2653 #ifdef cl_khr_fp16
2654 half __ovld __cnfn length(half p);
2655 half __ovld __cnfn length(half2 p);
2656@@ -10524,12 +10537,12 @@ float __ovld __cnfn normalize(float p);
2657 float2 __ovld __cnfn normalize(float2 p);
2658 float3 __ovld __cnfn normalize(float3 p);
2659 float4 __ovld __cnfn normalize(float4 p);
2660-#ifdef cl_khr_fp64
2661+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2662 double __ovld __cnfn normalize(double p);
2663 double2 __ovld __cnfn normalize(double2 p);
2664 double3 __ovld __cnfn normalize(double3 p);
2665 double4 __ovld __cnfn normalize(double4 p);
2666-#endif //cl_khr_fp64
2667+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2668 #ifdef cl_khr_fp16
2669 half __ovld __cnfn normalize(half p);
2670 half2 __ovld __cnfn normalize(half2 p);
2671@@ -10610,14 +10623,14 @@ int3 __ovld __cnfn isequal(float3 x, float3 y);
2672 int4 __ovld __cnfn isequal(float4 x, float4 y);
2673 int8 __ovld __cnfn isequal(float8 x, float8 y);
2674 int16 __ovld __cnfn isequal(float16 x, float16 y);
2675-#ifdef cl_khr_fp64
2676+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2677 int __ovld __cnfn isequal(double x, double y);
2678 long2 __ovld __cnfn isequal(double2 x, double2 y);
2679 long3 __ovld __cnfn isequal(double3 x, double3 y);
2680 long4 __ovld __cnfn isequal(double4 x, double4 y);
2681 long8 __ovld __cnfn isequal(double8 x, double8 y);
2682 long16 __ovld __cnfn isequal(double16 x, double16 y);
2683-#endif //cl_khr_fp64
2684+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2685 #ifdef cl_khr_fp16
2686 int __ovld __cnfn isequal(half x, half y);
2687 short2 __ovld __cnfn isequal(half2 x, half2 y);
2688@@ -10636,14 +10649,14 @@ int3 __ovld __cnfn isnotequal(float3 x, float3 y);
2689 int4 __ovld __cnfn isnotequal(float4 x, float4 y);
2690 int8 __ovld __cnfn isnotequal(float8 x, float8 y);
2691 int16 __ovld __cnfn isnotequal(float16 x, float16 y);
2692-#ifdef cl_khr_fp64
2693+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2694 int __ovld __cnfn isnotequal(double x, double y);
2695 long2 __ovld __cnfn isnotequal(double2 x, double2 y);
2696 long3 __ovld __cnfn isnotequal(double3 x, double3 y);
2697 long4 __ovld __cnfn isnotequal(double4 x, double4 y);
2698 long8 __ovld __cnfn isnotequal(double8 x, double8 y);
2699 long16 __ovld __cnfn isnotequal(double16 x, double16 y);
2700-#endif //cl_khr_fp64
2701+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2702 #ifdef cl_khr_fp16
2703 int __ovld __cnfn isnotequal(half x, half y);
2704 short2 __ovld __cnfn isnotequal(half2 x, half2 y);
2705@@ -10662,14 +10675,14 @@ int3 __ovld __cnfn isgreater(float3 x, float3 y);
2706 int4 __ovld __cnfn isgreater(float4 x, float4 y);
2707 int8 __ovld __cnfn isgreater(float8 x, float8 y);
2708 int16 __ovld __cnfn isgreater(float16 x, float16 y);
2709-#ifdef cl_khr_fp64
2710+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2711 int __ovld __cnfn isgreater(double x, double y);
2712 long2 __ovld __cnfn isgreater(double2 x, double2 y);
2713 long3 __ovld __cnfn isgreater(double3 x, double3 y);
2714 long4 __ovld __cnfn isgreater(double4 x, double4 y);
2715 long8 __ovld __cnfn isgreater(double8 x, double8 y);
2716 long16 __ovld __cnfn isgreater(double16 x, double16 y);
2717-#endif //cl_khr_fp64
2718+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2719 #ifdef cl_khr_fp16
2720 int __ovld __cnfn isgreater(half x, half y);
2721 short2 __ovld __cnfn isgreater(half2 x, half2 y);
2722@@ -10688,14 +10701,14 @@ int3 __ovld __cnfn isgreaterequal(float3 x, float3 y);
2723 int4 __ovld __cnfn isgreaterequal(float4 x, float4 y);
2724 int8 __ovld __cnfn isgreaterequal(float8 x, float8 y);
2725 int16 __ovld __cnfn isgreaterequal(float16 x, float16 y);
2726-#ifdef cl_khr_fp64
2727+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2728 int __ovld __cnfn isgreaterequal(double x, double y);
2729 long2 __ovld __cnfn isgreaterequal(double2 x, double2 y);
2730 long3 __ovld __cnfn isgreaterequal(double3 x, double3 y);
2731 long4 __ovld __cnfn isgreaterequal(double4 x, double4 y);
2732 long8 __ovld __cnfn isgreaterequal(double8 x, double8 y);
2733 long16 __ovld __cnfn isgreaterequal(double16 x, double16 y);
2734-#endif //cl_khr_fp64
2735+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2736 #ifdef cl_khr_fp16
2737 int __ovld __cnfn isgreaterequal(half x, half y);
2738 short2 __ovld __cnfn isgreaterequal(half2 x, half2 y);
2739@@ -10714,14 +10727,14 @@ int3 __ovld __cnfn isless(float3 x, float3 y);
2740 int4 __ovld __cnfn isless(float4 x, float4 y);
2741 int8 __ovld __cnfn isless(float8 x, float8 y);
2742 int16 __ovld __cnfn isless(float16 x, float16 y);
2743-#ifdef cl_khr_fp64
2744+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2745 int __ovld __cnfn isless(double x, double y);
2746 long2 __ovld __cnfn isless(double2 x, double2 y);
2747 long3 __ovld __cnfn isless(double3 x, double3 y);
2748 long4 __ovld __cnfn isless(double4 x, double4 y);
2749 long8 __ovld __cnfn isless(double8 x, double8 y);
2750 long16 __ovld __cnfn isless(double16 x, double16 y);
2751-#endif //cl_khr_fp64
2752+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2753 #ifdef cl_khr_fp16
2754 int __ovld __cnfn isless(half x, half y);
2755 short2 __ovld __cnfn isless(half2 x, half2 y);
2756@@ -10740,14 +10753,14 @@ int3 __ovld __cnfn islessequal(float3 x, float3 y);
2757 int4 __ovld __cnfn islessequal(float4 x, float4 y);
2758 int8 __ovld __cnfn islessequal(float8 x, float8 y);
2759 int16 __ovld __cnfn islessequal(float16 x, float16 y);
2760-#ifdef cl_khr_fp64
2761+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2762 int __ovld __cnfn islessequal(double x, double y);
2763 long2 __ovld __cnfn islessequal(double2 x, double2 y);
2764 long3 __ovld __cnfn islessequal(double3 x, double3 y);
2765 long4 __ovld __cnfn islessequal(double4 x, double4 y);
2766 long8 __ovld __cnfn islessequal(double8 x, double8 y);
2767 long16 __ovld __cnfn islessequal(double16 x, double16 y);
2768-#endif //cl_khr_fp64
2769+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2770 #ifdef cl_khr_fp16
2771 int __ovld __cnfn islessequal(half x, half y);
2772 short2 __ovld __cnfn islessequal(half2 x, half2 y);
2773@@ -10767,14 +10780,14 @@ int3 __ovld __cnfn islessgreater(float3 x, float3 y);
2774 int4 __ovld __cnfn islessgreater(float4 x, float4 y);
2775 int8 __ovld __cnfn islessgreater(float8 x, float8 y);
2776 int16 __ovld __cnfn islessgreater(float16 x, float16 y);
2777-#ifdef cl_khr_fp64
2778+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2779 int __ovld __cnfn islessgreater(double x, double y);
2780 long2 __ovld __cnfn islessgreater(double2 x, double2 y);
2781 long3 __ovld __cnfn islessgreater(double3 x, double3 y);
2782 long4 __ovld __cnfn islessgreater(double4 x, double4 y);
2783 long8 __ovld __cnfn islessgreater(double8 x, double8 y);
2784 long16 __ovld __cnfn islessgreater(double16 x, double16 y);
2785-#endif //cl_khr_fp64
2786+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2787 #ifdef cl_khr_fp16
2788 int __ovld __cnfn islessgreater(half x, half y);
2789 short2 __ovld __cnfn islessgreater(half2 x, half2 y);
2790@@ -10793,14 +10806,14 @@ int3 __ovld __cnfn isfinite(float3);
2791 int4 __ovld __cnfn isfinite(float4);
2792 int8 __ovld __cnfn isfinite(float8);
2793 int16 __ovld __cnfn isfinite(float16);
2794-#ifdef cl_khr_fp64
2795+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2796 int __ovld __cnfn isfinite(double);
2797 long2 __ovld __cnfn isfinite(double2);
2798 long3 __ovld __cnfn isfinite(double3);
2799 long4 __ovld __cnfn isfinite(double4);
2800 long8 __ovld __cnfn isfinite(double8);
2801 long16 __ovld __cnfn isfinite(double16);
2802-#endif //cl_khr_fp64
2803+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2804 #ifdef cl_khr_fp16
2805 int __ovld __cnfn isfinite(half);
2806 short2 __ovld __cnfn isfinite(half2);
2807@@ -10819,14 +10832,14 @@ int3 __ovld __cnfn isinf(float3);
2808 int4 __ovld __cnfn isinf(float4);
2809 int8 __ovld __cnfn isinf(float8);
2810 int16 __ovld __cnfn isinf(float16);
2811-#ifdef cl_khr_fp64
2812+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2813 int __ovld __cnfn isinf(double);
2814 long2 __ovld __cnfn isinf(double2);
2815 long3 __ovld __cnfn isinf(double3);
2816 long4 __ovld __cnfn isinf(double4);
2817 long8 __ovld __cnfn isinf(double8);
2818 long16 __ovld __cnfn isinf(double16);
2819-#endif //cl_khr_fp64
2820+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2821 #ifdef cl_khr_fp16
2822 int __ovld __cnfn isinf(half);
2823 short2 __ovld __cnfn isinf(half2);
2824@@ -10845,14 +10858,14 @@ int3 __ovld __cnfn isnan(float3);
2825 int4 __ovld __cnfn isnan(float4);
2826 int8 __ovld __cnfn isnan(float8);
2827 int16 __ovld __cnfn isnan(float16);
2828-#ifdef cl_khr_fp64
2829+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2830 int __ovld __cnfn isnan(double);
2831 long2 __ovld __cnfn isnan(double2);
2832 long3 __ovld __cnfn isnan(double3);
2833 long4 __ovld __cnfn isnan(double4);
2834 long8 __ovld __cnfn isnan(double8);
2835 long16 __ovld __cnfn isnan(double16);
2836-#endif //cl_khr_fp64
2837+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2838 #ifdef cl_khr_fp16
2839 int __ovld __cnfn isnan(half);
2840 short2 __ovld __cnfn isnan(half2);
2841@@ -10871,14 +10884,14 @@ int3 __ovld __cnfn isnormal(float3);
2842 int4 __ovld __cnfn isnormal(float4);
2843 int8 __ovld __cnfn isnormal(float8);
2844 int16 __ovld __cnfn isnormal(float16);
2845-#ifdef cl_khr_fp64
2846+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2847 int __ovld __cnfn isnormal(double);
2848 long2 __ovld __cnfn isnormal(double2);
2849 long3 __ovld __cnfn isnormal(double3);
2850 long4 __ovld __cnfn isnormal(double4);
2851 long8 __ovld __cnfn isnormal(double8);
2852 long16 __ovld __cnfn isnormal(double16);
2853-#endif //cl_khr_fp64
2854+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2855 #ifdef cl_khr_fp16
2856 int __ovld __cnfn isnormal(half);
2857 short2 __ovld __cnfn isnormal(half2);
2858@@ -10899,14 +10912,14 @@ int3 __ovld __cnfn isordered(float3 x, float3 y);
2859 int4 __ovld __cnfn isordered(float4 x, float4 y);
2860 int8 __ovld __cnfn isordered(float8 x, float8 y);
2861 int16 __ovld __cnfn isordered(float16 x, float16 y);
2862-#ifdef cl_khr_fp64
2863+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2864 int __ovld __cnfn isordered(double x, double y);
2865 long2 __ovld __cnfn isordered(double2 x, double2 y);
2866 long3 __ovld __cnfn isordered(double3 x, double3 y);
2867 long4 __ovld __cnfn isordered(double4 x, double4 y);
2868 long8 __ovld __cnfn isordered(double8 x, double8 y);
2869 long16 __ovld __cnfn isordered(double16 x, double16 y);
2870-#endif //cl_khr_fp64
2871+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2872 #ifdef cl_khr_fp16
2873 int __ovld __cnfn isordered(half x, half y);
2874 short2 __ovld __cnfn isordered(half2 x, half2 y);
2875@@ -10927,14 +10940,14 @@ int3 __ovld __cnfn isunordered(float3 x, float3 y);
2876 int4 __ovld __cnfn isunordered(float4 x, float4 y);
2877 int8 __ovld __cnfn isunordered(float8 x, float8 y);
2878 int16 __ovld __cnfn isunordered(float16 x, float16 y);
2879-#ifdef cl_khr_fp64
2880+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2881 int __ovld __cnfn isunordered(double x, double y);
2882 long2 __ovld __cnfn isunordered(double2 x, double2 y);
2883 long3 __ovld __cnfn isunordered(double3 x, double3 y);
2884 long4 __ovld __cnfn isunordered(double4 x, double4 y);
2885 long8 __ovld __cnfn isunordered(double8 x, double8 y);
2886 long16 __ovld __cnfn isunordered(double16 x, double16 y);
2887-#endif //cl_khr_fp64
2888+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2889 #ifdef cl_khr_fp16
2890 int __ovld __cnfn isunordered(half x, half y);
2891 short2 __ovld __cnfn isunordered(half2 x, half2 y);
2892@@ -10957,14 +10970,14 @@ int3 __ovld __cnfn signbit(float3);
2893 int4 __ovld __cnfn signbit(float4);
2894 int8 __ovld __cnfn signbit(float8);
2895 int16 __ovld __cnfn signbit(float16);
2896-#ifdef cl_khr_fp64
2897+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2898 int __ovld __cnfn signbit(double);
2899 long2 __ovld __cnfn signbit(double2);
2900 long3 __ovld __cnfn signbit(double3);
2901 long4 __ovld __cnfn signbit(double4);
2902 long8 __ovld __cnfn signbit(double8);
2903 long16 __ovld __cnfn signbit(double16);
2904-#endif //cl_khr_fp64
2905+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2906 #ifdef cl_khr_fp16
2907 int __ovld __cnfn signbit(half);
2908 short2 __ovld __cnfn signbit(half2);
2909@@ -11091,14 +11104,14 @@ float3 __ovld __cnfn bitselect(float3 a, float3 b, float3 c);
2910 float4 __ovld __cnfn bitselect(float4 a, float4 b, float4 c);
2911 float8 __ovld __cnfn bitselect(float8 a, float8 b, float8 c);
2912 float16 __ovld __cnfn bitselect(float16 a, float16 b, float16 c);
2913-#ifdef cl_khr_fp64
2914+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2915 double __ovld __cnfn bitselect(double a, double b, double c);
2916 double2 __ovld __cnfn bitselect(double2 a, double2 b, double2 c);
2917 double3 __ovld __cnfn bitselect(double3 a, double3 b, double3 c);
2918 double4 __ovld __cnfn bitselect(double4 a, double4 b, double4 c);
2919 double8 __ovld __cnfn bitselect(double8 a, double8 b, double8 c);
2920 double16 __ovld __cnfn bitselect(double16 a, double16 b, double16 c);
2921-#endif //cl_khr_fp64
2922+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2923 #ifdef cl_khr_fp16
2924 half __ovld __cnfn bitselect(half a, half b, half c);
2925 half2 __ovld __cnfn bitselect(half2 a, half2 b, half2 c);
2926@@ -11231,7 +11244,7 @@ ulong8 __ovld __cnfn select(ulong8 a, ulong8 b, ulong8 c);
2927 long16 __ovld __cnfn select(long16 a, long16 b, ulong16 c);
2928 ulong16 __ovld __cnfn select(ulong16 a, ulong16 b, ulong16 c);
2929
2930-#ifdef cl_khr_fp64
2931+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2932 double __ovld __cnfn select(double a, double b, long c);
2933 double2 __ovld __cnfn select(double2 a, double2 b, long2 c);
2934 double3 __ovld __cnfn select(double3 a, double3 b, long3 c);
2935@@ -11244,7 +11257,7 @@ double3 __ovld __cnfn select(double3 a, double3 b, ulong3 c);
2936 double4 __ovld __cnfn select(double4 a, double4 b, ulong4 c);
2937 double8 __ovld __cnfn select(double8 a, double8 b, ulong8 c);
2938 double16 __ovld __cnfn select(double16 a, double16 b, ulong16 c);
2939-#endif //cl_khr_fp64
2940+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2941 #ifdef cl_khr_fp16
2942 half __ovld __cnfn select(half a, half b, short c);
2943 half2 __ovld __cnfn select(half2 a, half2 b, short2 c);
2944@@ -11323,13 +11336,13 @@ uint16 __ovld vload16(size_t offset, const __constant uint *p);
2945 long16 __ovld vload16(size_t offset, const __constant long *p);
2946 ulong16 __ovld vload16(size_t offset, const __constant ulong *p);
2947 float16 __ovld vload16(size_t offset, const __constant float *p);
2948-#ifdef cl_khr_fp64
2949+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2950 double2 __ovld vload2(size_t offset, const __constant double *p);
2951 double3 __ovld vload3(size_t offset, const __constant double *p);
2952 double4 __ovld vload4(size_t offset, const __constant double *p);
2953 double8 __ovld vload8(size_t offset, const __constant double *p);
2954 double16 __ovld vload16(size_t offset, const __constant double *p);
2955-#endif //cl_khr_fp64
2956+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2957
2958 #ifdef cl_khr_fp16
2959 half __ovld vload(size_t offset, const __constant half *p);
2960@@ -11340,7 +11353,7 @@ half8 __ovld vload8(size_t offset, const __constant half *p);
2961 half16 __ovld vload16(size_t offset, const __constant half *p);
2962 #endif //cl_khr_fp16
2963
2964-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
2965+#ifdef __opencl_c_generic_address_space
2966 char2 __ovld vload2(size_t offset, const char *p);
2967 uchar2 __ovld vload2(size_t offset, const uchar *p);
2968 short2 __ovld vload2(size_t offset, const short *p);
2969@@ -11387,13 +11400,13 @@ long16 __ovld vload16(size_t offset, const long *p);
2970 ulong16 __ovld vload16(size_t offset, const ulong *p);
2971 float16 __ovld vload16(size_t offset, const float *p);
2972
2973-#ifdef cl_khr_fp64
2974+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2975 double2 __ovld vload2(size_t offset, const double *p);
2976 double3 __ovld vload3(size_t offset, const double *p);
2977 double4 __ovld vload4(size_t offset, const double *p);
2978 double8 __ovld vload8(size_t offset, const double *p);
2979 double16 __ovld vload16(size_t offset, const double *p);
2980-#endif //cl_khr_fp64
2981+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
2982
2983 #ifdef cl_khr_fp16
2984 half __ovld vload(size_t offset, const half *p);
2985@@ -11403,7 +11416,7 @@ half4 __ovld vload4(size_t offset, const half *p);
2986 half8 __ovld vload8(size_t offset, const half *p);
2987 half16 __ovld vload16(size_t offset, const half *p);
2988 #endif //cl_khr_fp16
2989-#else
2990+#endif //__opencl_c_generic_address_space
2991 char2 __ovld vload2(size_t offset, const __global char *p);
2992 uchar2 __ovld vload2(size_t offset, const __global uchar *p);
2993 short2 __ovld vload2(size_t offset, const __global short *p);
2994@@ -11540,7 +11553,7 @@ long16 __ovld vload16(size_t offset, const __private long *p);
2995 ulong16 __ovld vload16(size_t offset, const __private ulong *p);
2996 float16 __ovld vload16(size_t offset, const __private float *p);
2997
2998-#ifdef cl_khr_fp64
2999+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3000 double2 __ovld vload2(size_t offset, const __global double *p);
3001 double3 __ovld vload3(size_t offset, const __global double *p);
3002 double4 __ovld vload4(size_t offset, const __global double *p);
3003@@ -11556,7 +11569,7 @@ double3 __ovld vload3(size_t offset, const __private double *p);
3004 double4 __ovld vload4(size_t offset, const __private double *p);
3005 double8 __ovld vload8(size_t offset, const __private double *p);
3006 double16 __ovld vload16(size_t offset, const __private double *p);
3007-#endif //cl_khr_fp64
3008+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3009
3010 #ifdef cl_khr_fp16
3011 half __ovld vload(size_t offset, const __global half *p);
3012@@ -11578,9 +11591,8 @@ half4 __ovld vload4(size_t offset, const __private half *p);
3013 half8 __ovld vload8(size_t offset, const __private half *p);
3014 half16 __ovld vload16(size_t offset, const __private half *p);
3015 #endif //cl_khr_fp16
3016-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3017
3018-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3019+#ifdef __opencl_c_generic_address_space
3020 void __ovld vstore2(char2 data, size_t offset, char *p);
3021 void __ovld vstore2(uchar2 data, size_t offset, uchar *p);
3022 void __ovld vstore2(short2 data, size_t offset, short *p);
3023@@ -11626,13 +11638,13 @@ void __ovld vstore16(uint16 data, size_t offset, uint *p);
3024 void __ovld vstore16(long16 data, size_t offset, long *p);
3025 void __ovld vstore16(ulong16 data, size_t offset, ulong *p);
3026 void __ovld vstore16(float16 data, size_t offset, float *p);
3027-#ifdef cl_khr_fp64
3028+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3029 void __ovld vstore2(double2 data, size_t offset, double *p);
3030 void __ovld vstore3(double3 data, size_t offset, double *p);
3031 void __ovld vstore4(double4 data, size_t offset, double *p);
3032 void __ovld vstore8(double8 data, size_t offset, double *p);
3033 void __ovld vstore16(double16 data, size_t offset, double *p);
3034-#endif //cl_khr_fp64
3035+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3036 #ifdef cl_khr_fp16
3037 void __ovld vstore(half data, size_t offset, half *p);
3038 void __ovld vstore2(half2 data, size_t offset, half *p);
3039@@ -11641,7 +11653,7 @@ void __ovld vstore4(half4 data, size_t offset, half *p);
3040 void __ovld vstore8(half8 data, size_t offset, half *p);
3041 void __ovld vstore16(half16 data, size_t offset, half *p);
3042 #endif //cl_khr_fp16
3043-#else
3044+#endif //__opencl_c_generic_address_space
3045 void __ovld vstore2(char2 data, size_t offset, __global char *p);
3046 void __ovld vstore2(uchar2 data, size_t offset, __global uchar *p);
3047 void __ovld vstore2(short2 data, size_t offset, __global short *p);
3048@@ -11777,7 +11789,7 @@ void __ovld vstore16(uint16 data, size_t offset, __private uint *p);
3049 void __ovld vstore16(long16 data, size_t offset, __private long *p);
3050 void __ovld vstore16(ulong16 data, size_t offset, __private ulong *p);
3051 void __ovld vstore16(float16 data, size_t offset, __private float *p);
3052-#ifdef cl_khr_fp64
3053+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3054 void __ovld vstore2(double2 data, size_t offset, __global double *p);
3055 void __ovld vstore3(double3 data, size_t offset, __global double *p);
3056 void __ovld vstore4(double4 data, size_t offset, __global double *p);
3057@@ -11793,7 +11805,7 @@ void __ovld vstore3(double3 data, size_t offset, __private double *p);
3058 void __ovld vstore4(double4 data, size_t offset, __private double *p);
3059 void __ovld vstore8(double8 data, size_t offset, __private double *p);
3060 void __ovld vstore16(double16 data, size_t offset, __private double *p);
3061-#endif //cl_khr_fp64
3062+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3063 #ifdef cl_khr_fp16
3064 void __ovld vstore(half data, size_t offset, __global half *p);
3065 void __ovld vstore2(half2 data, size_t offset, __global half *p);
3066@@ -11814,7 +11826,6 @@ void __ovld vstore4(half4 data, size_t offset, __private half *p);
3067 void __ovld vstore8(half8 data, size_t offset, __private half *p);
3068 void __ovld vstore16(half16 data, size_t offset, __private half *p);
3069 #endif //cl_khr_fp16
3070-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3071
3072 /**
3073 * Read sizeof (half) bytes of data from address
3074@@ -11825,13 +11836,12 @@ void __ovld vstore16(half16 data, size_t offset, __private half *p);
3075 * must be 16-bit aligned.
3076 */
3077 float __ovld vload_half(size_t offset, const __constant half *p);
3078-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3079+#ifdef __opencl_c_generic_address_space
3080 float __ovld vload_half(size_t offset, const half *p);
3081-#else
3082+#endif //__opencl_c_generic_address_space
3083 float __ovld vload_half(size_t offset, const __global half *p);
3084 float __ovld vload_half(size_t offset, const __local half *p);
3085 float __ovld vload_half(size_t offset, const __private half *p);
3086-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3087
3088 /**
3089 * Read sizeof (halfn) bytes of data from address
3090@@ -11846,13 +11856,13 @@ float3 __ovld vload_half3(size_t offset, const __constant half *p);
3091 float4 __ovld vload_half4(size_t offset, const __constant half *p);
3092 float8 __ovld vload_half8(size_t offset, const __constant half *p);
3093 float16 __ovld vload_half16(size_t offset, const __constant half *p);
3094-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3095+#ifdef __opencl_c_generic_address_space
3096 float2 __ovld vload_half2(size_t offset, const half *p);
3097 float3 __ovld vload_half3(size_t offset, const half *p);
3098 float4 __ovld vload_half4(size_t offset, const half *p);
3099 float8 __ovld vload_half8(size_t offset, const half *p);
3100 float16 __ovld vload_half16(size_t offset, const half *p);
3101-#else
3102+#endif //__opencl_c_generic_address_space
3103 float2 __ovld vload_half2(size_t offset, const __global half *p);
3104 float3 __ovld vload_half3(size_t offset, const __global half *p);
3105 float4 __ovld vload_half4(size_t offset, const __global half *p);
3106@@ -11868,7 +11878,6 @@ float3 __ovld vload_half3(size_t offset, const __private half *p);
3107 float4 __ovld vload_half4(size_t offset, const __private half *p);
3108 float8 __ovld vload_half8(size_t offset, const __private half *p);
3109 float16 __ovld vload_half16(size_t offset, const __private half *p);
3110-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3111
3112 /**
3113 * The float value given by data is first
3114@@ -11881,20 +11890,20 @@ float16 __ovld vload_half16(size_t offset, const __private half *p);
3115 * The default current rounding mode is round to
3116 * nearest even.
3117 */
3118-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3119+#ifdef __opencl_c_generic_address_space
3120 void __ovld vstore_half(float data, size_t offset, half *p);
3121 void __ovld vstore_half_rte(float data, size_t offset, half *p);
3122 void __ovld vstore_half_rtz(float data, size_t offset, half *p);
3123 void __ovld vstore_half_rtp(float data, size_t offset, half *p);
3124 void __ovld vstore_half_rtn(float data, size_t offset, half *p);
3125-#ifdef cl_khr_fp64
3126+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3127 void __ovld vstore_half(double data, size_t offset, half *p);
3128 void __ovld vstore_half_rte(double data, size_t offset, half *p);
3129 void __ovld vstore_half_rtz(double data, size_t offset, half *p);
3130 void __ovld vstore_half_rtp(double data, size_t offset, half *p);
3131 void __ovld vstore_half_rtn(double data, size_t offset, half *p);
3132-#endif //cl_khr_fp64
3133-#else
3134+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3135+#endif //__opencl_c_generic_address_space
3136 void __ovld vstore_half(float data, size_t offset, __global half *p);
3137 void __ovld vstore_half_rte(float data, size_t offset, __global half *p);
3138 void __ovld vstore_half_rtz(float data, size_t offset, __global half *p);
3139@@ -11910,7 +11919,7 @@ void __ovld vstore_half_rte(float data, size_t offset, __private half *p);
3140 void __ovld vstore_half_rtz(float data, size_t offset, __private half *p);
3141 void __ovld vstore_half_rtp(float data, size_t offset, __private half *p);
3142 void __ovld vstore_half_rtn(float data, size_t offset, __private half *p);
3143-#ifdef cl_khr_fp64
3144+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3145 void __ovld vstore_half(double data, size_t offset, __global half *p);
3146 void __ovld vstore_half_rte(double data, size_t offset, __global half *p);
3147 void __ovld vstore_half_rtz(double data, size_t offset, __global half *p);
3148@@ -11926,8 +11935,7 @@ void __ovld vstore_half_rte(double data, size_t offset, __private half *p);
3149 void __ovld vstore_half_rtz(double data, size_t offset, __private half *p);
3150 void __ovld vstore_half_rtp(double data, size_t offset, __private half *p);
3151 void __ovld vstore_half_rtn(double data, size_t offset, __private half *p);
3152-#endif //cl_khr_fp64
3153-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3154+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3155
3156 /**
3157 * The floatn value given by data is converted to
3158@@ -11940,7 +11948,7 @@ void __ovld vstore_half_rtn(double data, size_t offset, __private half *p);
3159 * The default current rounding mode is round to
3160 * nearest even.
3161 */
3162-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3163+#ifdef __opencl_c_generic_address_space
3164 void __ovld vstore_half2(float2 data, size_t offset, half *p);
3165 void __ovld vstore_half3(float3 data, size_t offset, half *p);
3166 void __ovld vstore_half4(float4 data, size_t offset, half *p);
3167@@ -11966,7 +11974,7 @@ void __ovld vstore_half3_rtn(float3 data, size_t offset, half *p);
3168 void __ovld vstore_half4_rtn(float4 data, size_t offset, half *p);
3169 void __ovld vstore_half8_rtn(float8 data, size_t offset, half *p);
3170 void __ovld vstore_half16_rtn(float16 data, size_t offset, half *p);
3171-#ifdef cl_khr_fp64
3172+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3173 void __ovld vstore_half2(double2 data, size_t offset, half *p);
3174 void __ovld vstore_half3(double3 data, size_t offset, half *p);
3175 void __ovld vstore_half4(double4 data, size_t offset, half *p);
3176@@ -11992,8 +12000,8 @@ void __ovld vstore_half3_rtn(double3 data, size_t offset, half *p);
3177 void __ovld vstore_half4_rtn(double4 data, size_t offset, half *p);
3178 void __ovld vstore_half8_rtn(double8 data, size_t offset, half *p);
3179 void __ovld vstore_half16_rtn(double16 data, size_t offset, half *p);
3180-#endif //cl_khr_fp64
3181-#else
3182+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3183+#endif //__opencl_c_generic_address_space
3184 void __ovld vstore_half2(float2 data, size_t offset, __global half *p);
3185 void __ovld vstore_half3(float3 data, size_t offset, __global half *p);
3186 void __ovld vstore_half4(float4 data, size_t offset, __global half *p);
3187@@ -12069,7 +12077,7 @@ void __ovld vstore_half3_rtn(float3 data, size_t offset, __private half *p);
3188 void __ovld vstore_half4_rtn(float4 data, size_t offset, __private half *p);
3189 void __ovld vstore_half8_rtn(float8 data, size_t offset, __private half *p);
3190 void __ovld vstore_half16_rtn(float16 data, size_t offset, __private half *p);
3191-#ifdef cl_khr_fp64
3192+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3193 void __ovld vstore_half2(double2 data, size_t offset, __global half *p);
3194 void __ovld vstore_half3(double3 data, size_t offset, __global half *p);
3195 void __ovld vstore_half4(double4 data, size_t offset, __global half *p);
3196@@ -12145,8 +12153,7 @@ void __ovld vstore_half3_rtn(double3 data, size_t offset, __private half *p);
3197 void __ovld vstore_half4_rtn(double4 data, size_t offset, __private half *p);
3198 void __ovld vstore_half8_rtn(double8 data, size_t offset, __private half *p);
3199 void __ovld vstore_half16_rtn(double16 data, size_t offset, __private half *p);
3200-#endif //cl_khr_fp64
3201-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3202+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3203
3204 /**
3205 * For n = 1, 2, 4, 8 and 16 read sizeof (halfn)
3206@@ -12167,14 +12174,14 @@ float3 __ovld vloada_half3(size_t offset, const __constant half *p);
3207 float4 __ovld vloada_half4(size_t offset, const __constant half *p);
3208 float8 __ovld vloada_half8(size_t offset, const __constant half *p);
3209 float16 __ovld vloada_half16(size_t offset, const __constant half *p);
3210-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3211+#ifdef __opencl_c_generic_address_space
3212 float __ovld vloada_half(size_t offset, const half *p);
3213 float2 __ovld vloada_half2(size_t offset, const half *p);
3214 float3 __ovld vloada_half3(size_t offset, const half *p);
3215 float4 __ovld vloada_half4(size_t offset, const half *p);
3216 float8 __ovld vloada_half8(size_t offset, const half *p);
3217 float16 __ovld vloada_half16(size_t offset, const half *p);
3218-#else
3219+#endif //__opencl_c_generic_address_space
3220 float __ovld vloada_half(size_t offset, const __global half *p);
3221 float2 __ovld vloada_half2(size_t offset, const __global half *p);
3222 float3 __ovld vloada_half3(size_t offset, const __global half *p);
3223@@ -12193,7 +12200,6 @@ float3 __ovld vloada_half3(size_t offset, const __private half *p);
3224 float4 __ovld vloada_half4(size_t offset, const __private half *p);
3225 float8 __ovld vloada_half8(size_t offset, const __private half *p);
3226 float16 __ovld vloada_half16(size_t offset, const __private half *p);
3227-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3228
3229 /**
3230 * The floatn value given by data is converted to
3231@@ -12211,7 +12217,7 @@ float16 __ovld vloada_half16(size_t offset, const __private half *p);
3232 * mode. The default current rounding mode is
3233 * round to nearest even.
3234 */
3235-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3236+#ifdef __opencl_c_generic_address_space
3237 void __ovld vstorea_half(float data, size_t offset, half *p);
3238 void __ovld vstorea_half2(float2 data, size_t offset, half *p);
3239 void __ovld vstorea_half3(float3 data, size_t offset, half *p);
3240@@ -12247,7 +12253,7 @@ void __ovld vstorea_half4_rtn(float4 data, size_t offset, half *p);
3241 void __ovld vstorea_half8_rtn(float8 data, size_t offset, half *p);
3242 void __ovld vstorea_half16_rtn(float16 data, size_t offset, half *p);
3243
3244-#ifdef cl_khr_fp64
3245+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3246 void __ovld vstorea_half(double data, size_t offset, half *p);
3247 void __ovld vstorea_half2(double2 data, size_t offset, half *p);
3248 void __ovld vstorea_half3(double3 data, size_t offset, half *p);
3249@@ -12282,9 +12288,9 @@ void __ovld vstorea_half3_rtn(double3 data, size_t offset, half *p);
3250 void __ovld vstorea_half4_rtn(double4 data, size_t offset, half *p);
3251 void __ovld vstorea_half8_rtn(double8 data, size_t offset, half *p);
3252 void __ovld vstorea_half16_rtn(double16 data, size_t offset, half *p);
3253-#endif //cl_khr_fp64
3254+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3255+#endif //__opencl_c_generic_address_space
3256
3257-#else
3258 void __ovld vstorea_half(float data, size_t offset, __global half *p);
3259 void __ovld vstorea_half2(float2 data, size_t offset, __global half *p);
3260 void __ovld vstorea_half3(float3 data, size_t offset, __global half *p);
3261@@ -12390,7 +12396,7 @@ void __ovld vstorea_half4_rtn(float4 data, size_t offset, __private half *p);
3262 void __ovld vstorea_half8_rtn(float8 data, size_t offset, __private half *p);
3263 void __ovld vstorea_half16_rtn(float16 data, size_t offset, __private half *p);
3264
3265-#ifdef cl_khr_fp64
3266+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3267 void __ovld vstorea_half(double data, size_t offset, __global half *p);
3268 void __ovld vstorea_half2(double2 data, size_t offset, __global half *p);
3269 void __ovld vstorea_half3(double3 data, size_t offset, __global half *p);
3270@@ -12495,8 +12501,7 @@ void __ovld vstorea_half3_rtn(double3 data,size_t offset, __private half *p);
3271 void __ovld vstorea_half4_rtn(double4 data,size_t offset, __private half *p);
3272 void __ovld vstorea_half8_rtn(double8 data,size_t offset, __private half *p);
3273 void __ovld vstorea_half16_rtn(double16 data,size_t offset, __private half *p);
3274-#endif //cl_khr_fp64
3275-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3276+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3277
3278 // OpenCL v1.1 s6.11.8, v1.2 s6.12.8, v2.0 s6.13.8 - Synchronization Functions
3279
3280@@ -12580,7 +12585,7 @@ void __ovld write_mem_fence(cl_mem_fence_flags flags);
3281
3282 // OpenCL v2.0 s6.13.9 - Address Space Qualifier Functions
3283
3284-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3285+#ifdef __opencl_c_generic_address_space
3286 cl_mem_fence_flags __ovld get_fence(const void *ptr);
3287 cl_mem_fence_flags __ovld get_fence(void *ptr);
3288
3289@@ -12591,7 +12596,7 @@ cl_mem_fence_flags __ovld get_fence(void *ptr);
3290 * where gentype is builtin type or user defined type.
3291 */
3292
3293-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
3294+#endif //__opencl_c_generic_address_space
3295
3296 // 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
3297
3298@@ -12730,7 +12735,7 @@ event_t __ovld async_work_group_copy(__global uint16 *dst, const __local uint16
3299 event_t __ovld async_work_group_copy(__global long16 *dst, const __local long16 *src, size_t num_elements, event_t event);
3300 event_t __ovld async_work_group_copy(__global ulong16 *dst, const __local ulong16 *src, size_t num_elements, event_t event);
3301 event_t __ovld async_work_group_copy(__global float16 *dst, const __local float16 *src, size_t num_elements, event_t event);
3302-#ifdef cl_khr_fp64
3303+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3304 event_t __ovld async_work_group_copy(__local double *dst, const __global double *src, size_t num_elements, event_t event);
3305 event_t __ovld async_work_group_copy(__local double2 *dst, const __global double2 *src, size_t num_elements, event_t event);
3306 event_t __ovld async_work_group_copy(__local double3 *dst, const __global double3 *src, size_t num_elements, event_t event);
3307@@ -12743,7 +12748,7 @@ event_t __ovld async_work_group_copy(__global double3 *dst, const __local double
3308 event_t __ovld async_work_group_copy(__global double4 *dst, const __local double4 *src, size_t num_elements, event_t event);
3309 event_t __ovld async_work_group_copy(__global double8 *dst, const __local double8 *src, size_t num_elements, event_t event);
3310 event_t __ovld async_work_group_copy(__global double16 *dst, const __local double16 *src, size_t num_elements, event_t event);
3311-#endif //cl_khr_fp64
3312+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3313 #ifdef cl_khr_fp16
3314 event_t __ovld async_work_group_copy(__local half *dst, const __global half *src, size_t num_elements, event_t event);
3315 event_t __ovld async_work_group_copy(__local half2 *dst, const __global half2 *src, size_t num_elements, event_t event);
3316@@ -12893,7 +12898,7 @@ event_t __ovld async_work_group_strided_copy(__global uint16 *dst, const __local
3317 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);
3318 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);
3319 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);
3320-#ifdef cl_khr_fp64
3321+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3322 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);
3323 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);
3324 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);
3325@@ -12906,7 +12911,7 @@ event_t __ovld async_work_group_strided_copy(__global double3 *dst, const __loca
3326 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);
3327 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);
3328 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);
3329-#endif //cl_khr_fp64
3330+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3331 #ifdef cl_khr_fp16
3332 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);
3333 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);
3334@@ -12996,14 +13001,14 @@ void __ovld prefetch(const __global uint16 *p, size_t num_elements);
3335 void __ovld prefetch(const __global long16 *p, size_t num_elements);
3336 void __ovld prefetch(const __global ulong16 *p, size_t num_elements);
3337 void __ovld prefetch(const __global float16 *p, size_t num_elements);
3338-#ifdef cl_khr_fp64
3339+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3340 void __ovld prefetch(const __global double *p, size_t num_elements);
3341 void __ovld prefetch(const __global double2 *p, size_t num_elements);
3342 void __ovld prefetch(const __global double3 *p, size_t num_elements);
3343 void __ovld prefetch(const __global double4 *p, size_t num_elements);
3344 void __ovld prefetch(const __global double8 *p, size_t num_elements);
3345 void __ovld prefetch(const __global double16 *p, size_t num_elements);
3346-#endif //cl_khr_fp64
3347+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3348 #ifdef cl_khr_fp16
3349 void __ovld prefetch(const __global half *p, size_t num_elements);
3350 void __ovld prefetch(const __global half2 *p, size_t num_elements);
3351@@ -13026,9 +13031,11 @@ void __ovld prefetch(const __global half16 *p, size_t num_elements);
3352 * pointed by p. The function returns old.
3353 */
3354 int __ovld atomic_add(volatile __global int *p, int val);
3355-unsigned int __ovld atomic_add(volatile __global unsigned int *p, unsigned int val);
3356+unsigned int __ovld atomic_add(volatile __global unsigned int *p,
3357+ unsigned int val);
3358 int __ovld atomic_add(volatile __local int *p, int val);
3359-unsigned int __ovld atomic_add(volatile __local unsigned int *p, unsigned int val);
3360+unsigned int __ovld atomic_add(volatile __local unsigned int *p,
3361+ unsigned int val);
3362 #ifdef __OPENCL_CPP_VERSION__
3363 int __ovld atomic_add(volatile int *p, int val);
3364 unsigned int __ovld atomic_add(volatile unsigned int *p, unsigned int val);
3365@@ -13056,9 +13063,11 @@ unsigned long __ovld atom_add(volatile __local unsigned long *p, unsigned long v
3366 * returns old.
3367 */
3368 int __ovld atomic_sub(volatile __global int *p, int val);
3369-unsigned int __ovld atomic_sub(volatile __global unsigned int *p, unsigned int val);
3370+unsigned int __ovld atomic_sub(volatile __global unsigned int *p,
3371+ unsigned int val);
3372 int __ovld atomic_sub(volatile __local int *p, int val);
3373-unsigned int __ovld atomic_sub(volatile __local unsigned int *p, unsigned int val);
3374+unsigned int __ovld atomic_sub(volatile __local unsigned int *p,
3375+ unsigned int val);
3376 #ifdef __OPENCL_CPP_VERSION__
3377 int __ovld atomic_sub(volatile int *p, int val);
3378 unsigned int __ovld atomic_sub(volatile unsigned int *p, unsigned int val);
3379@@ -13086,9 +13095,11 @@ unsigned long __ovld atom_sub(volatile __local unsigned long *p, unsigned long v
3380 * value.
3381 */
3382 int __ovld atomic_xchg(volatile __global int *p, int val);
3383-unsigned int __ovld atomic_xchg(volatile __global unsigned int *p, unsigned int val);
3384+unsigned int __ovld atomic_xchg(volatile __global unsigned int *p,
3385+ unsigned int val);
3386 int __ovld atomic_xchg(volatile __local int *p, int val);
3387-unsigned int __ovld atomic_xchg(volatile __local unsigned int *p, unsigned int val);
3388+unsigned int __ovld atomic_xchg(volatile __local unsigned int *p,
3389+ unsigned int val);
3390 float __ovld atomic_xchg(volatile __global float *p, float val);
3391 float __ovld atomic_xchg(volatile __local float *p, float val);
3392 #ifdef __OPENCL_CPP_VERSION__
3393@@ -13183,12 +13194,15 @@ unsigned long __ovld atom_dec(volatile __local unsigned long *p);
3394 * returns old.
3395 */
3396 int __ovld atomic_cmpxchg(volatile __global int *p, int cmp, int val);
3397-unsigned int __ovld atomic_cmpxchg(volatile __global unsigned int *p, unsigned int cmp, unsigned int val);
3398+unsigned int __ovld atomic_cmpxchg(volatile __global unsigned int *p,
3399+ unsigned int cmp, unsigned int val);
3400 int __ovld atomic_cmpxchg(volatile __local int *p, int cmp, int val);
3401-unsigned int __ovld atomic_cmpxchg(volatile __local unsigned int *p, unsigned int cmp, unsigned int val);
3402+unsigned int __ovld atomic_cmpxchg(volatile __local unsigned int *p,
3403+ unsigned int cmp, unsigned int val);
3404 #ifdef __OPENCL_CPP_VERSION__
3405 int __ovld atomic_cmpxchg(volatile int *p, int cmp, int val);
3406-unsigned int __ovld atomic_cmpxchg(volatile unsigned int *p, unsigned int cmp, unsigned int val);
3407+unsigned int __ovld atomic_cmpxchg(volatile unsigned int *p, unsigned int cmp,
3408+ unsigned int val);
3409 #endif
3410
3411 #if defined(cl_khr_global_int32_base_atomics)
3412@@ -13215,9 +13229,11 @@ unsigned long __ovld atom_cmpxchg(volatile __local unsigned long *p, unsigned lo
3413 * returns old.
3414 */
3415 int __ovld atomic_min(volatile __global int *p, int val);
3416-unsigned int __ovld atomic_min(volatile __global unsigned int *p, unsigned int val);
3417+unsigned int __ovld atomic_min(volatile __global unsigned int *p,
3418+ unsigned int val);
3419 int __ovld atomic_min(volatile __local int *p, int val);
3420-unsigned int __ovld atomic_min(volatile __local unsigned int *p, unsigned int val);
3421+unsigned int __ovld atomic_min(volatile __local unsigned int *p,
3422+ unsigned int val);
3423 #ifdef __OPENCL_CPP_VERSION__
3424 int __ovld atomic_min(volatile int *p, int val);
3425 unsigned int __ovld atomic_min(volatile unsigned int *p, unsigned int val);
3426@@ -13247,9 +13263,11 @@ unsigned long __ovld atom_min(volatile __local unsigned long *p, unsigned long v
3427 * returns old.
3428 */
3429 int __ovld atomic_max(volatile __global int *p, int val);
3430-unsigned int __ovld atomic_max(volatile __global unsigned int *p, unsigned int val);
3431+unsigned int __ovld atomic_max(volatile __global unsigned int *p,
3432+ unsigned int val);
3433 int __ovld atomic_max(volatile __local int *p, int val);
3434-unsigned int __ovld atomic_max(volatile __local unsigned int *p, unsigned int val);
3435+unsigned int __ovld atomic_max(volatile __local unsigned int *p,
3436+ unsigned int val);
3437 #ifdef __OPENCL_CPP_VERSION__
3438 int __ovld atomic_max(volatile int *p, int val);
3439 unsigned int __ovld atomic_max(volatile unsigned int *p, unsigned int val);
3440@@ -13278,9 +13296,11 @@ unsigned long __ovld atom_max(volatile __local unsigned long *p, unsigned long v
3441 * pointed by p. The function returns old.
3442 */
3443 int __ovld atomic_and(volatile __global int *p, int val);
3444-unsigned int __ovld atomic_and(volatile __global unsigned int *p, unsigned int val);
3445+unsigned int __ovld atomic_and(volatile __global unsigned int *p,
3446+ unsigned int val);
3447 int __ovld atomic_and(volatile __local int *p, int val);
3448-unsigned int __ovld atomic_and(volatile __local unsigned int *p, unsigned int val);
3449+unsigned int __ovld atomic_and(volatile __local unsigned int *p,
3450+ unsigned int val);
3451 #ifdef __OPENCL_CPP_VERSION__
3452 int __ovld atomic_and(volatile int *p, int val);
3453 unsigned int __ovld atomic_and(volatile unsigned int *p, unsigned int val);
3454@@ -13309,9 +13329,11 @@ unsigned long __ovld atom_and(volatile __local unsigned long *p, unsigned long v
3455 * pointed by p. The function returns old.
3456 */
3457 int __ovld atomic_or(volatile __global int *p, int val);
3458-unsigned int __ovld atomic_or(volatile __global unsigned int *p, unsigned int val);
3459+unsigned int __ovld atomic_or(volatile __global unsigned int *p,
3460+ unsigned int val);
3461 int __ovld atomic_or(volatile __local int *p, int val);
3462-unsigned int __ovld atomic_or(volatile __local unsigned int *p, unsigned int val);
3463+unsigned int __ovld atomic_or(volatile __local unsigned int *p,
3464+ unsigned int val);
3465 #ifdef __OPENCL_CPP_VERSION__
3466 int __ovld atomic_or(volatile int *p, int val);
3467 unsigned int __ovld atomic_or(volatile unsigned int *p, unsigned int val);
3468@@ -13340,9 +13362,11 @@ unsigned long __ovld atom_or(volatile __local unsigned long *p, unsigned long va
3469 * pointed by p. The function returns old.
3470 */
3471 int __ovld atomic_xor(volatile __global int *p, int val);
3472-unsigned int __ovld atomic_xor(volatile __global unsigned int *p, unsigned int val);
3473+unsigned int __ovld atomic_xor(volatile __global unsigned int *p,
3474+ unsigned int val);
3475 int __ovld atomic_xor(volatile __local int *p, int val);
3476-unsigned int __ovld atomic_xor(volatile __local unsigned int *p, unsigned int val);
3477+unsigned int __ovld atomic_xor(volatile __local unsigned int *p,
3478+ unsigned int val);
3479 #ifdef __OPENCL_CPP_VERSION__
3480 int __ovld atomic_xor(volatile int *p, int val);
3481 unsigned int __ovld atomic_xor(volatile unsigned int *p, unsigned int val);
3482@@ -13380,108 +13404,78 @@ unsigned long __ovld atom_xor(volatile __local unsigned long *p, unsigned long v
3483 #endif
3484
3485 // atomic_init()
3486+#ifdef __opencl_c_generic_address_space
3487 void __ovld atomic_init(volatile atomic_int *object, int value);
3488 void __ovld atomic_init(volatile atomic_uint *object, uint value);
3489 void __ovld atomic_init(volatile atomic_float *object, float value);
3490 #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
3491 void __ovld atomic_init(volatile atomic_long *object, long value);
3492 void __ovld atomic_init(volatile atomic_ulong *object, ulong value);
3493-#ifdef cl_khr_fp64
3494+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3495 void __ovld atomic_init(volatile atomic_double *object, double value);
3496-#endif //cl_khr_fp64
3497-#endif
3498+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3499+#endif // defined(cl_khr_int64_base_atomics) &&
3500+ // defined(cl_khr_int64_extended_atomics)
3501+#endif // __opencl_c_generic_address_space
3502+
3503+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
3504+void __ovld atomic_init(volatile atomic_int __global *object, int value);
3505+void __ovld atomic_init(volatile atomic_int __local *object, int value);
3506+void __ovld atomic_init(volatile atomic_uint __global *object, uint value);
3507+void __ovld atomic_init(volatile atomic_uint __local *object, uint value);
3508+void __ovld atomic_init(volatile atomic_float __global *object, float value);
3509+void __ovld atomic_init(volatile atomic_float __local *object, float value);
3510+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
3511+void __ovld atomic_init(volatile atomic_long __global *object, long value);
3512+void __ovld atomic_init(volatile atomic_long __local *object, long value);
3513+void __ovld atomic_init(volatile atomic_ulong __global *object, ulong value);
3514+void __ovld atomic_init(volatile atomic_ulong __local *object, ulong value);
3515+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
3516+void __ovld atomic_init(volatile atomic_double __global *object, double value);
3517+void __ovld atomic_init(volatile atomic_double __local *object, double value);
3518+#endif // cl_khr_fp64
3519+#endif // defined(cl_khr_int64_base_atomics) &&
3520+ // defined(cl_khr_int64_extended_atomics)
3521+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
3522
3523 // atomic_work_item_fence()
3524-void __ovld atomic_work_item_fence(cl_mem_fence_flags flags, memory_order order, memory_scope scope);
3525+void __ovld atomic_work_item_fence(cl_mem_fence_flags flags, memory_order order,
3526+ memory_scope scope);
3527
3528 // atomic_fetch()
3529-
3530+#if defined(__opencl_c_atomic_scope_device) && \
3531+ defined(__opencl_c_atomic_order_seq_cst)
3532+#ifdef __opencl_c_generic_address_space
3533 int __ovld atomic_fetch_add(volatile atomic_int *object, int operand);
3534-int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand, memory_order order);
3535-int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
3536 uint __ovld atomic_fetch_add(volatile atomic_uint *object, uint operand);
3537-uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object, uint operand, memory_order order);
3538-uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
3539 int __ovld atomic_fetch_sub(volatile atomic_int *object, int operand);
3540-int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand, memory_order order);
3541-int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
3542 uint __ovld atomic_fetch_sub(volatile atomic_uint *object, uint operand);
3543-uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object, uint operand, memory_order order);
3544-uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
3545 int __ovld atomic_fetch_or(volatile atomic_int *object, int operand);
3546-int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand, memory_order order);
3547-int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
3548 uint __ovld atomic_fetch_or(volatile atomic_uint *object, uint operand);
3549-uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand, memory_order order);
3550-uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
3551 int __ovld atomic_fetch_xor(volatile atomic_int *object, int operand);
3552-int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand, memory_order order);
3553-int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
3554 uint __ovld atomic_fetch_xor(volatile atomic_uint *object, uint operand);
3555-uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object, uint operand, memory_order order);
3556-uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
3557 int __ovld atomic_fetch_and(volatile atomic_int *object, int operand);
3558-int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand, memory_order order);
3559-int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
3560 uint __ovld atomic_fetch_and(volatile atomic_uint *object, uint operand);
3561-uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object, uint operand, memory_order order);
3562-uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
3563 int __ovld atomic_fetch_min(volatile atomic_int *object, int operand);
3564-int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand, memory_order order);
3565-int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
3566 uint __ovld atomic_fetch_min(volatile atomic_uint *object, uint operand);
3567-uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object, uint operand, memory_order order);
3568-uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
3569 int __ovld atomic_fetch_max(volatile atomic_int *object, int operand);
3570-int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand, memory_order order);
3571-int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand, memory_order order, memory_scope scope);
3572 uint __ovld atomic_fetch_max(volatile atomic_uint *object, uint operand);
3573-uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object, uint operand, memory_order order);
3574-uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object, uint operand, memory_order order, memory_scope scope);
3575
3576 #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
3577 long __ovld atomic_fetch_add(volatile atomic_long *object, long operand);
3578-long __ovld atomic_fetch_add_explicit(volatile atomic_long *object, long operand, memory_order order);
3579-long __ovld atomic_fetch_add_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
3580 ulong __ovld atomic_fetch_add(volatile atomic_ulong *object, ulong operand);
3581-ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
3582-ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
3583 long __ovld atomic_fetch_sub(volatile atomic_long *object, long operand);
3584-long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object, long operand, memory_order order);
3585-long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
3586 ulong __ovld atomic_fetch_sub(volatile atomic_ulong *object, ulong operand);
3587-ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
3588-ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
3589 long __ovld atomic_fetch_or(volatile atomic_long *object, long operand);
3590-long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand, memory_order order);
3591-long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
3592 ulong __ovld atomic_fetch_or(volatile atomic_ulong *object, ulong operand);
3593-ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
3594-ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
3595 long __ovld atomic_fetch_xor(volatile atomic_long *object, long operand);
3596-long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object, long operand, memory_order order);
3597-long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
3598 ulong __ovld atomic_fetch_xor(volatile atomic_ulong *object, ulong operand);
3599-ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
3600-ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
3601 long __ovld atomic_fetch_and(volatile atomic_long *object, long operand);
3602-long __ovld atomic_fetch_and_explicit(volatile atomic_long *object, long operand, memory_order order);
3603-long __ovld atomic_fetch_and_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
3604 ulong __ovld atomic_fetch_and(volatile atomic_ulong *object, ulong operand);
3605-ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
3606-ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
3607 long __ovld atomic_fetch_min(volatile atomic_long *object, long operand);
3608-long __ovld atomic_fetch_min_explicit(volatile atomic_long *object, long operand, memory_order order);
3609-long __ovld atomic_fetch_min_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
3610 ulong __ovld atomic_fetch_min(volatile atomic_ulong *object, ulong operand);
3611-ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
3612-ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
3613 long __ovld atomic_fetch_max(volatile atomic_long *object, long operand);
3614-long __ovld atomic_fetch_max_explicit(volatile atomic_long *object, long operand, memory_order order);
3615-long __ovld atomic_fetch_max_explicit(volatile atomic_long *object, long operand, memory_order order, memory_scope scope);
3616 ulong __ovld atomic_fetch_max(volatile atomic_ulong *object, ulong operand);
3617-ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, ulong operand, memory_order order);
3618-ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, ulong operand, memory_order order, memory_scope scope);
3619 #endif //defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
3620
3621 // OpenCL v2.0 s6.13.11.7.5:
3622@@ -13489,196 +13483,2239 @@ ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object, ulong oper
3623 // or/xor/and/min/max: atomic type argument can be intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t.
3624
3625 #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
3626-uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t *object, ptrdiff_t operand);
3627-uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order);
3628-uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order, memory_scope scope);
3629-uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t *object, ptrdiff_t operand);
3630-uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order);
3631-uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object, ptrdiff_t operand, memory_order order, memory_scope scope);
3632-
3633-uintptr_t __ovld atomic_fetch_or(volatile atomic_uintptr_t *object, intptr_t operand);
3634-uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order);
3635-uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order, memory_scope scope);
3636-uintptr_t __ovld atomic_fetch_xor(volatile atomic_uintptr_t *object, intptr_t operand);
3637-uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order);
3638-uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order, memory_scope scope);
3639-uintptr_t __ovld atomic_fetch_and(volatile atomic_uintptr_t *object, intptr_t operand);
3640-uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order);
3641-uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object, intptr_t operand, memory_order order, memory_scope scope);
3642-uintptr_t __ovld atomic_fetch_min(volatile atomic_uintptr_t *object, intptr_t opermax);
3643-uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder);
3644-uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder, memory_scope scope);
3645-uintptr_t __ovld atomic_fetch_max(volatile atomic_uintptr_t *object, intptr_t opermax);
3646-uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder);
3647-uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object, intptr_t opermax, memory_order minder, memory_scope scope);
3648-
3649-intptr_t __ovld atomic_fetch_or(volatile atomic_intptr_t *object, uintptr_t operand);
3650-intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order);
3651-intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order, memory_scope scope);
3652-intptr_t __ovld atomic_fetch_xor(volatile atomic_intptr_t *object, uintptr_t operand);
3653-intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order);
3654-intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order, memory_scope scope);
3655-intptr_t __ovld atomic_fetch_and(volatile atomic_intptr_t *object, uintptr_t operand);
3656-intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order);
3657-intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object, uintptr_t operand, memory_order order, memory_scope scope);
3658-intptr_t __ovld atomic_fetch_min(volatile atomic_intptr_t *object, uintptr_t opermax);
3659-intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder);
3660-intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder, memory_scope scope);
3661-intptr_t __ovld atomic_fetch_max(volatile atomic_intptr_t *object, uintptr_t opermax);
3662-intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder);
3663-intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object, uintptr_t opermax, memory_order minder, memory_scope scope);
3664+uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t *object,
3665+ ptrdiff_t operand);
3666+uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t *object,
3667+ ptrdiff_t operand);
3668+
3669+uintptr_t __ovld atomic_fetch_or(volatile atomic_uintptr_t *object,
3670+ intptr_t operand);
3671+uintptr_t __ovld atomic_fetch_xor(volatile atomic_uintptr_t *object,
3672+ intptr_t operand);
3673+uintptr_t __ovld atomic_fetch_and(volatile atomic_uintptr_t *object,
3674+ intptr_t operand);
3675+uintptr_t __ovld atomic_fetch_min(volatile atomic_uintptr_t *object,
3676+ intptr_t opermax);
3677+uintptr_t __ovld atomic_fetch_max(volatile atomic_uintptr_t *object,
3678+ intptr_t opermax);
3679+
3680+intptr_t __ovld atomic_fetch_or(volatile atomic_intptr_t *object,
3681+ uintptr_t operand);
3682+intptr_t __ovld atomic_fetch_xor(volatile atomic_intptr_t *object,
3683+ uintptr_t operand);
3684+intptr_t __ovld atomic_fetch_and(volatile atomic_intptr_t *object,
3685+ uintptr_t operand);
3686+intptr_t __ovld atomic_fetch_min(volatile atomic_intptr_t *object,
3687+ uintptr_t opermax);
3688+intptr_t __ovld atomic_fetch_max(volatile atomic_intptr_t *object,
3689+ uintptr_t opermax);
3690+#endif // defined(cl_khr_int64_base_atomics) &&
3691+ // defined(cl_khr_int64_extended_atomics)
3692+#endif // __opencl_c_generic_address_space
3693+
3694+#if(__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
3695+int __ovld atomic_fetch_add(volatile atomic_int __global *object, int operand);
3696+uint __ovld atomic_fetch_add(volatile atomic_uint __local *object,
3697+ uint operand);
3698+int __ovld atomic_fetch_sub(volatile atomic_int __global *object, int operand);
3699+int __ovld atomic_fetch_sub(volatile atomic_int __local *object, int operand);
3700+uint __ovld atomic_fetch_sub(volatile atomic_uint __local *object,
3701+ uint operand);
3702+uint __ovld atomic_fetch_sub(volatile atomic_uint __global *object,
3703+ uint operand);
3704+int __ovld atomic_fetch_or(volatile atomic_int __global *object, int operand);
3705+uint __ovld atomic_fetch_sub(volatile atomic_uint __local *object,
3706+ uint operand);
3707+uint __ovld atomic_fetch_or(volatile atomic_uint __global *object,
3708+ uint operand);
3709+uint __ovld atomic_fetch_or(volatile atomic_uint __local *object, uint operand);
3710+int __ovld atomic_fetch_xor(volatile atomic_int __global *object, int operand);
3711+int __ovld atomic_fetch_xor(volatile atomic_int __local *object, int operand);
3712+uint __ovld atomic_fetch_xor(volatile atomic_uint __global *object,
3713+ uint operand);
3714+uint __ovld atomic_fetch_xor(volatile atomic_uint __local *object,
3715+ uint operand);
3716+int __ovld atomic_fetch_and(volatile atomic_int __global *object, int operand);
3717+int __ovld atomic_fetch_and(volatile atomic_int __local *object, int operand);
3718+uint __ovld atomic_fetch_and(volatile atomic_uint __global *object,
3719+ uint operand);
3720+uint __ovld atomic_fetch_and(volatile atomic_uint __local *object,
3721+ uint operand);
3722+int __ovld atomic_fetch_min(volatile atomic_int __global *object, int operand);
3723+int __ovld atomic_fetch_min(volatile atomic_int __local *object, int operand);
3724+uint __ovld atomic_fetch_min(volatile atomic_uint __global *object,
3725+ uint operand);
3726+uint __ovld atomic_fetch_min(volatile atomic_uint __local *object,
3727+ uint operand);
3728+int __ovld atomic_fetch_max(volatile atomic_int __global *object, int operand);
3729+int __ovld atomic_fetch_max(volatile atomic_int __local *object, int operand);
3730+uint __ovld atomic_fetch_max(volatile atomic_uint __global *object,
3731+ uint operand);
3732+uint __ovld atomic_fetch_max(volatile atomic_uint __local *object,
3733+ uint operand);
3734+
3735+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
3736+long __ovld atomic_fetch_add(volatile atomic_long __global *object,
3737+ long operand);
3738+long __ovld atomic_fetch_add(volatile atomic_long __local *object,
3739+ long operand);
3740+ulong __ovld atomic_fetch_add(volatile atomic_ulong __global *object,
3741+ ulong operand);
3742+ulong __ovld atomic_fetch_add(volatile atomic_ulong __local *object,
3743+ ulong operand);
3744+long __ovld atomic_fetch_sub(volatile atomic_long __global *object,
3745+ long operand);
3746+long __ovld atomic_fetch_sub(volatile atomic_long __local *object,
3747+ long operand);
3748+ulong __ovld atomic_fetch_sub(volatile atomic_ulong __global *object,
3749+ ulong operand);
3750+ulong __ovld atomic_fetch_sub(volatile atomic_ulong __local *object,
3751+ ulong operand);
3752+long __ovld atomic_fetch_or(volatile atomic_long __global *object,
3753+ long operand);
3754+long __ovld atomic_fetch_or(volatile atomic_long __local *object, long operand);
3755+ulong __ovld atomic_fetch_or(volatile atomic_ulong __global *object,
3756+ ulong operand);
3757+ulong __ovld atomic_fetch_or(volatile atomic_ulong __local *object,
3758+ ulong operand);
3759+long __ovld atomic_fetch_xor(volatile atomic_long __global *object,
3760+ long operand);
3761+long __ovld atomic_fetch_xor(volatile atomic_long __local *object,
3762+ long operand);
3763+ulong __ovld atomic_fetch_xor(volatile atomic_ulong __global *object,
3764+ ulong operand);
3765+ulong __ovld atomic_fetch_xor(volatile atomic_ulong __local *object,
3766+ ulong operand);
3767+long __ovld atomic_fetch_and(volatile atomic_long __global *object,
3768+ long operand);
3769+long __ovld atomic_fetch_and(volatile atomic_long __local *object,
3770+ long operand);
3771+ulong __ovld atomic_fetch_and(volatile atomic_ulong __global *object,
3772+ ulong operand);
3773+ulong __ovld atomic_fetch_and(volatile atomic_ulong __local *object,
3774+ ulong operand);
3775+long __ovld atomic_fetch_min(volatile atomic_long __global *object,
3776+ long operand);
3777+long __ovld atomic_fetch_min(volatile atomic_long __local *object,
3778+ long operand);
3779+ulong __ovld atomic_fetch_min(volatile atomic_ulong __global *object,
3780+ ulong operand);
3781+ulong __ovld atomic_fetch_min(volatile atomic_ulong __local *object,
3782+ ulong operand);
3783+long __ovld atomic_fetch_max(volatile atomic_long __global *object,
3784+ long operand);
3785+long __ovld atomic_fetch_max(volatile atomic_long __local *object,
3786+ long operand);
3787+ulong __ovld atomic_fetch_max(volatile atomic_ulong __global *object,
3788+ ulong operand);
3789+ulong __ovld atomic_fetch_max(volatile atomic_ulong __local *object,
3790+ ulong operand);
3791+#endif // defined(cl_khr_int64_base_atomics) &&
3792+ // defined(cl_khr_int64_extended_atomics)
3793+
3794+// OpenCL v2.0 s6.13.11.7.5:
3795+// add/sub: atomic type argument can be uintptr_t/intptr_t, value type argument
3796+// can be ptrdiff_t. or/xor/and/min/max: atomic type argument can be
3797+// intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t.
3798+
3799+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
3800+uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t __global *object,
3801+ ptrdiff_t operand);
3802+uintptr_t __ovld atomic_fetch_add(volatile atomic_uintptr_t __local *object,
3803+ ptrdiff_t operand);
3804+uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t __global *object,
3805+ ptrdiff_t operand);
3806+uintptr_t __ovld atomic_fetch_sub(volatile atomic_uintptr_t __local *object,
3807+ ptrdiff_t operand);
3808+
3809+uintptr_t __ovld atomic_fetch_or(volatile atomic_uintptr_t __global *object,
3810+ intptr_t operand);
3811+uintptr_t __ovld atomic_fetch_or(volatile atomic_uintptr_t __local *object,
3812+ intptr_t operand);
3813+uintptr_t __ovld atomic_fetch_xor(volatile atomic_uintptr_t __global *object,
3814+ intptr_t operand);
3815+uintptr_t __ovld atomic_fetch_xor(volatile atomic_uintptr_t __local *object,
3816+ intptr_t operand);
3817+uintptr_t __ovld atomic_fetch_and(volatile atomic_uintptr_t __global *object,
3818+ intptr_t operand);
3819+uintptr_t __ovld atomic_fetch_and(volatile atomic_uintptr_t __local *object,
3820+ intptr_t operand);
3821+uintptr_t __ovld atomic_fetch_min(volatile atomic_uintptr_t __global *object,
3822+ intptr_t opermax);
3823+uintptr_t __ovld atomic_fetch_min(volatile atomic_uintptr_t __local *object,
3824+ intptr_t opermax);
3825+uintptr_t __ovld atomic_fetch_max(volatile atomic_uintptr_t __global *object,
3826+ intptr_t opermax);
3827+uintptr_t __ovld atomic_fetch_max(volatile atomic_uintptr_t __local *object,
3828+ intptr_t opermax);
3829+
3830+intptr_t __ovld atomic_fetch_or(volatile atomic_intptr_t __global *object,
3831+ uintptr_t operand);
3832+intptr_t __ovld atomic_fetch_or(volatile atomic_intptr_t __local *object,
3833+ uintptr_t operand);
3834+intptr_t __ovld atomic_fetch_xor(volatile atomic_intptr_t __global *object,
3835+ uintptr_t operand);
3836+intptr_t __ovld atomic_fetch_xor(volatile atomic_intptr_t __local *object,
3837+ uintptr_t operand);
3838+intptr_t __ovld atomic_fetch_and(volatile atomic_intptr_t __global *object,
3839+ uintptr_t operand);
3840+intptr_t __ovld atomic_fetch_and(volatile atomic_intptr_t __local *object,
3841+ uintptr_t operand);
3842+intptr_t __ovld atomic_fetch_min(volatile atomic_intptr_t __global *object,
3843+ uintptr_t opermax);
3844+intptr_t __ovld atomic_fetch_min(volatile atomic_intptr_t __local *object,
3845+ uintptr_t opermax);
3846+intptr_t __ovld atomic_fetch_max(volatile atomic_intptr_t __global *object,
3847+ uintptr_t opermax);
3848+intptr_t __ovld atomic_fetch_max(volatile atomic_intptr_t __local *object,
3849+ uintptr_t opermax);
3850+#endif // defined(cl_khr_int64_base_atomics) &&
3851+ // defined(cl_khr_int64_extended_atomics)
3852+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
3853+
3854+#endif // defined(__opencl_c_atomic_scope_device) &&
3855+ // defined(__opencl_c_atomic_order_seq_cst)
3856+
3857+#ifdef __opencl_c_generic_address_space
3858+#ifdef __opencl_c_atomic_scope_device
3859+int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand,
3860+ memory_order order);
3861+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object,
3862+ uint operand, memory_order order);
3863+int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand,
3864+ memory_order order);
3865+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object,
3866+ uint operand, memory_order order);
3867+int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand,
3868+ memory_order order);
3869+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand,
3870+ memory_order order);
3871+int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand,
3872+ memory_order order);
3873+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object,
3874+ uint operand, memory_order order);
3875+int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand,
3876+ memory_order order);
3877+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object,
3878+ uint operand, memory_order order);
3879+int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand,
3880+ memory_order order);
3881+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object,
3882+ uint operand, memory_order order);
3883+int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand,
3884+ memory_order order);
3885+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object,
3886+ uint operand, memory_order order);
3887+#endif // __opencl_c_atomic_scope_device
3888+int __ovld atomic_fetch_add_explicit(volatile atomic_int *object, int operand,
3889+ memory_order order, memory_scope scope);
3890+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint *object,
3891+ uint operand, memory_order order,
3892+ memory_scope scope);
3893+int __ovld atomic_fetch_sub_explicit(volatile atomic_int *object, int operand,
3894+ memory_order order, memory_scope scope);
3895+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint *object,
3896+ uint operand, memory_order order,
3897+ memory_scope scope);
3898+int __ovld atomic_fetch_or_explicit(volatile atomic_int *object, int operand,
3899+ memory_order order, memory_scope scope);
3900+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint *object, uint operand,
3901+ memory_order order, memory_scope scope);
3902+int __ovld atomic_fetch_xor_explicit(volatile atomic_int *object, int operand,
3903+ memory_order order, memory_scope scope);
3904+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint *object,
3905+ uint operand, memory_order order,
3906+ memory_scope scope);
3907+int __ovld atomic_fetch_and_explicit(volatile atomic_int *object, int operand,
3908+ memory_order order, memory_scope scope);
3909+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint *object,
3910+ uint operand, memory_order order,
3911+ memory_scope scope);
3912+int __ovld atomic_fetch_min_explicit(volatile atomic_int *object, int operand,
3913+ memory_order order, memory_scope scope);
3914+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint *object,
3915+ uint operand, memory_order order,
3916+ memory_scope scope);
3917+int __ovld atomic_fetch_max_explicit(volatile atomic_int *object, int operand,
3918+ memory_order order, memory_scope scope);
3919+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint *object,
3920+ uint operand, memory_order order,
3921+ memory_scope scope);
3922+
3923+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
3924+#ifdef __opencl_c_atomic_scope_device
3925+long __ovld atomic_fetch_add_explicit(volatile atomic_long *object,
3926+ long operand, memory_order order);
3927+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object,
3928+ ulong operand, memory_order order);
3929+long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object,
3930+ long operand, memory_order order);
3931+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object,
3932+ ulong operand, memory_order order);
3933+long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand,
3934+ memory_order order);
3935+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object,
3936+ ulong operand, memory_order order);
3937+long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object,
3938+ long operand, memory_order order);
3939+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object,
3940+ ulong operand, memory_order order);
3941+long __ovld atomic_fetch_and_explicit(volatile atomic_long *object,
3942+ long operand, memory_order order);
3943+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object,
3944+ ulong operand, memory_order order);
3945+long __ovld atomic_fetch_min_explicit(volatile atomic_long *object,
3946+ long operand, memory_order order);
3947+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object,
3948+ ulong operand, memory_order order);
3949+long __ovld atomic_fetch_max_explicit(volatile atomic_long *object,
3950+ long operand, memory_order order);
3951+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object,
3952+ ulong operand, memory_order order);
3953+#endif // __opencl_c_atomic_scope_device
3954+long __ovld atomic_fetch_add_explicit(volatile atomic_long *object,
3955+ long operand, memory_order order,
3956+ memory_scope scope);
3957+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong *object,
3958+ ulong operand, memory_order order,
3959+ memory_scope scope);
3960+long __ovld atomic_fetch_sub_explicit(volatile atomic_long *object,
3961+ long operand, memory_order order,
3962+ memory_scope scope);
3963+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong *object,
3964+ ulong operand, memory_order order,
3965+ memory_scope scope);
3966+long __ovld atomic_fetch_or_explicit(volatile atomic_long *object, long operand,
3967+ memory_order order, memory_scope scope);
3968+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong *object,
3969+ ulong operand, memory_order order,
3970+ memory_scope scope);
3971+long __ovld atomic_fetch_xor_explicit(volatile atomic_long *object,
3972+ long operand, memory_order order,
3973+ memory_scope scope);
3974+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong *object,
3975+ ulong operand, memory_order order,
3976+ memory_scope scope);
3977+long __ovld atomic_fetch_and_explicit(volatile atomic_long *object,
3978+ long operand, memory_order order,
3979+ memory_scope scope);
3980+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong *object,
3981+ ulong operand, memory_order order,
3982+ memory_scope scope);
3983+long __ovld atomic_fetch_min_explicit(volatile atomic_long *object,
3984+ long operand, memory_order order,
3985+ memory_scope scope);
3986+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong *object,
3987+ ulong operand, memory_order order,
3988+ memory_scope scope);
3989+long __ovld atomic_fetch_max_explicit(volatile atomic_long *object,
3990+ long operand, memory_order order,
3991+ memory_scope scope);
3992+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong *object,
3993+ ulong operand, memory_order order,
3994+ memory_scope scope);
3995+#endif // defined(cl_khr_int64_base_atomics) &&
3996+ // defined(cl_khr_int64_extended_atomics)
3997+
3998+// OpenCL v2.0 s6.13.11.7.5:
3999+// add/sub: atomic type argument can be uintptr_t/intptr_t, value type argument
4000+// can be ptrdiff_t. or/xor/and/min/max: atomic type argument can be
4001+// intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t.
4002+
4003+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4004+#ifdef __opencl_c_atomic_scope_device
4005+uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object,
4006+ ptrdiff_t operand,
4007+ memory_order order);
4008+uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object,
4009+ ptrdiff_t operand,
4010+ memory_order order);
4011+uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object,
4012+ intptr_t operand, memory_order order);
4013+uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object,
4014+ intptr_t operand,
4015+ memory_order order);
4016+uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object,
4017+ intptr_t operand,
4018+ memory_order order);
4019+uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object,
4020+ intptr_t opermax,
4021+ memory_order minder);
4022+uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object,
4023+ intptr_t opermax,
4024+ memory_order minder);
4025+intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object,
4026+ uintptr_t operand, memory_order order);
4027+intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object,
4028+ uintptr_t operand,
4029+ memory_order order);
4030+intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object,
4031+ uintptr_t operand,
4032+ memory_order order);
4033+intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object,
4034+ uintptr_t opermax,
4035+ memory_order minder);
4036+intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object,
4037+ uintptr_t opermax,
4038+ memory_order minder);
4039+#endif // __opencl_c_atomic_scope_device
4040+uintptr_t __ovld atomic_fetch_add_explicit(volatile atomic_uintptr_t *object,
4041+ ptrdiff_t operand,
4042+ memory_order order,
4043+ memory_scope scope);
4044+uintptr_t __ovld atomic_fetch_sub_explicit(volatile atomic_uintptr_t *object,
4045+ ptrdiff_t operand,
4046+ memory_order order,
4047+ memory_scope scope);
4048+
4049+uintptr_t __ovld atomic_fetch_or_explicit(volatile atomic_uintptr_t *object,
4050+ intptr_t operand, memory_order order,
4051+ memory_scope scope);
4052+uintptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_uintptr_t *object,
4053+ intptr_t operand, memory_order order,
4054+ memory_scope scope);
4055+uintptr_t __ovld atomic_fetch_and_explicit(volatile atomic_uintptr_t *object,
4056+ intptr_t operand, memory_order order,
4057+ memory_scope scope);
4058+uintptr_t __ovld atomic_fetch_min_explicit(volatile atomic_uintptr_t *object,
4059+ intptr_t opermax,
4060+ memory_order minder,
4061+ memory_scope scope);
4062+uintptr_t __ovld atomic_fetch_max_explicit(volatile atomic_uintptr_t *object,
4063+ intptr_t opermax,
4064+ memory_order minder,
4065+ memory_scope scope);
4066+
4067+intptr_t __ovld atomic_fetch_or_explicit(volatile atomic_intptr_t *object,
4068+ uintptr_t operand, memory_order order,
4069+ memory_scope scope);
4070+intptr_t __ovld atomic_fetch_xor_explicit(volatile atomic_intptr_t *object,
4071+ uintptr_t operand, memory_order order,
4072+ memory_scope scope);
4073+intptr_t __ovld atomic_fetch_and_explicit(volatile atomic_intptr_t *object,
4074+ uintptr_t operand, memory_order order,
4075+ memory_scope scope);
4076+intptr_t __ovld atomic_fetch_min_explicit(volatile atomic_intptr_t *object,
4077+ uintptr_t opermax,
4078+ memory_order minder,
4079+ memory_scope scope);
4080+intptr_t __ovld atomic_fetch_max_explicit(volatile atomic_intptr_t *object,
4081+ uintptr_t opermax,
4082+ memory_order minder,
4083+ memory_scope scope);
4084 #endif
4085+#endif // __opencl_c_generic_address_space
4086+
4087+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4088+#ifdef __opencl_c_atomic_scope_device
4089+int __ovld atomic_fetch_add_explicit(volatile atomic_int __global *object,
4090+ int operand, memory_order order);
4091+int __ovld atomic_fetch_add_explicit(volatile atomic_int __local *object,
4092+ int operand, memory_order order);
4093+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint __global *object,
4094+ uint operand, memory_order order);
4095+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint __local *object,
4096+ uint operand, memory_order order);
4097+int __ovld atomic_fetch_sub_explicit(volatile atomic_int __global *object,
4098+ int operand, memory_order order);
4099+int __ovld atomic_fetch_sub_explicit(volatile atomic_int __local *object,
4100+ int operand, memory_order order);
4101+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint __global *object,
4102+ uint operand, memory_order order);
4103+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint __local *object,
4104+ uint operand, memory_order order);
4105+int __ovld atomic_fetch_or_explicit(volatile atomic_int __global *object,
4106+ int operand, memory_order order);
4107+int __ovld atomic_fetch_or_explicit(volatile atomic_int __local *object,
4108+ int operand, memory_order order);
4109+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint __global *object,
4110+ uint operand, memory_order order);
4111+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint __local *object,
4112+ uint operand, memory_order order);
4113+int __ovld atomic_fetch_xor_explicit(volatile atomic_int __global *object,
4114+ int operand, memory_order order);
4115+int __ovld atomic_fetch_xor_explicit(volatile atomic_int __local *object,
4116+ int operand, memory_order order);
4117+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint __global *object,
4118+ uint operand, memory_order order);
4119+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint __local *object,
4120+ uint operand, memory_order order);
4121+int __ovld atomic_fetch_and_explicit(volatile atomic_int __global *object,
4122+ int operand, memory_order order);
4123+int __ovld atomic_fetch_and_explicit(volatile atomic_int __local *object,
4124+ int operand, memory_order order);
4125+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint __global *object,
4126+ uint operand, memory_order order);
4127+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint __local *object,
4128+ uint operand, memory_order order);
4129+int __ovld atomic_fetch_min_explicit(volatile atomic_int __global *object,
4130+ int operand, memory_order order);
4131+int __ovld atomic_fetch_min_explicit(volatile atomic_int __local *object,
4132+ int operand, memory_order order);
4133+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint __global *object,
4134+ uint operand, memory_order order);
4135+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint __local *object,
4136+ uint operand, memory_order order);
4137+int __ovld atomic_fetch_max_explicit(volatile atomic_int __global *object,
4138+ int operand, memory_order order);
4139+int __ovld atomic_fetch_max_explicit(volatile atomic_int __local *object,
4140+ int operand, memory_order order);
4141+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint __global *object,
4142+ uint operand, memory_order order);
4143+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint __local *object,
4144+ uint operand, memory_order order);
4145+#endif // __opencl_c_atomic_scope_device
4146+int __ovld atomic_fetch_add_explicit(volatile atomic_int __global *object,
4147+ int operand, memory_order order,
4148+ memory_scope scope);
4149+int __ovld atomic_fetch_add_explicit(volatile atomic_int __local *object,
4150+ int operand, memory_order order,
4151+ memory_scope scope);
4152+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint __global *object,
4153+ uint operand, memory_order order,
4154+ memory_scope scope);
4155+uint __ovld atomic_fetch_add_explicit(volatile atomic_uint __local *object,
4156+ uint operand, memory_order order,
4157+ memory_scope scope);
4158+int __ovld atomic_fetch_sub_explicit(volatile atomic_int __global *object,
4159+ int operand, memory_order order,
4160+ memory_scope scope);
4161+int __ovld atomic_fetch_sub_explicit(volatile atomic_int __local *object,
4162+ int operand, memory_order order,
4163+ memory_scope scope);
4164+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint __global *object,
4165+ uint operand, memory_order order,
4166+ memory_scope scope);
4167+uint __ovld atomic_fetch_sub_explicit(volatile atomic_uint __local *object,
4168+ uint operand, memory_order order,
4169+ memory_scope scope);
4170+int __ovld atomic_fetch_or_explicit(volatile atomic_int __global *object,
4171+ int operand, memory_order order,
4172+ memory_scope scope);
4173+int __ovld atomic_fetch_or_explicit(volatile atomic_int __local *object,
4174+ int operand, memory_order order,
4175+ memory_scope scope);
4176+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint __global *object,
4177+ uint operand, memory_order order,
4178+ memory_scope scope);
4179+uint __ovld atomic_fetch_or_explicit(volatile atomic_uint __local *object,
4180+ uint operand, memory_order order,
4181+ memory_scope scope);
4182+int __ovld atomic_fetch_xor_explicit(volatile atomic_int __global *object,
4183+ int operand, memory_order order,
4184+ memory_scope scope);
4185+int __ovld atomic_fetch_xor_explicit(volatile atomic_int __local *object,
4186+ int operand, memory_order order,
4187+ memory_scope scope);
4188+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint __global *object,
4189+ uint operand, memory_order order,
4190+ memory_scope scope);
4191+uint __ovld atomic_fetch_xor_explicit(volatile atomic_uint __local *object,
4192+ uint operand, memory_order order,
4193+ memory_scope scope);
4194+int __ovld atomic_fetch_and_explicit(volatile atomic_int __global *object,
4195+ int operand, memory_order order,
4196+ memory_scope scope);
4197+int __ovld atomic_fetch_and_explicit(volatile atomic_int __local *object,
4198+ int operand, memory_order order,
4199+ memory_scope scope);
4200+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint __global *object,
4201+ uint operand, memory_order order,
4202+ memory_scope scope);
4203+uint __ovld atomic_fetch_and_explicit(volatile atomic_uint __local *object,
4204+ uint operand, memory_order order,
4205+ memory_scope scope);
4206+int __ovld atomic_fetch_min_explicit(volatile atomic_int __global *object,
4207+ int operand, memory_order order,
4208+ memory_scope scope);
4209+int __ovld atomic_fetch_min_explicit(volatile atomic_int __local *object,
4210+ int operand, memory_order order,
4211+ memory_scope scope);
4212+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint __global *object,
4213+ uint operand, memory_order order,
4214+ memory_scope scope);
4215+uint __ovld atomic_fetch_min_explicit(volatile atomic_uint __local *object,
4216+ uint operand, memory_order order,
4217+ memory_scope scope);
4218+int __ovld atomic_fetch_max_explicit(volatile atomic_int __global *object,
4219+ int operand, memory_order order,
4220+ memory_scope scope);
4221+int __ovld atomic_fetch_max_explicit(volatile atomic_int __local *object,
4222+ int operand, memory_order order,
4223+ memory_scope scope);
4224+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint __global *object,
4225+ uint operand, memory_order order,
4226+ memory_scope scope);
4227+uint __ovld atomic_fetch_max_explicit(volatile atomic_uint __local *object,
4228+ uint operand, memory_order order,
4229+ memory_scope scope);
4230+
4231+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4232+#ifdef __opencl_c_atomic_scope_device
4233+long __ovld atomic_fetch_add_explicit(volatile atomic_long __global *object,
4234+ long operand, memory_order order);
4235+long __ovld atomic_fetch_add_explicit(volatile atomic_long __local *object,
4236+ long operand, memory_order order);
4237+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong __global *object,
4238+ ulong operand, memory_order order);
4239+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong __local *object,
4240+ ulong operand, memory_order order);
4241+long __ovld atomic_fetch_sub_explicit(volatile atomic_long __global *object,
4242+ long operand, memory_order order);
4243+long __ovld atomic_fetch_sub_explicit(volatile atomic_long __local *object,
4244+ long operand, memory_order order);
4245+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong __global *object,
4246+ ulong operand, memory_order order);
4247+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong __local *object,
4248+ ulong operand, memory_order order);
4249+long __ovld atomic_fetch_or_explicit(volatile atomic_long __global *object,
4250+ long operand, memory_order order);
4251+long __ovld atomic_fetch_or_explicit(volatile atomic_long __local *object,
4252+ long operand, memory_order order);
4253+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong __global *object,
4254+ ulong operand, memory_order order);
4255+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong __local *object,
4256+ ulong operand, memory_order order);
4257+long __ovld atomic_fetch_xor_explicit(volatile atomic_long __global *object,
4258+ long operand, memory_order order);
4259+long __ovld atomic_fetch_xor_explicit(volatile atomic_long __local *object,
4260+ long operand, memory_order order);
4261+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong __global *object,
4262+ ulong operand, memory_order order);
4263+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong __local *object,
4264+ ulong operand, memory_order order);
4265+long __ovld atomic_fetch_and_explicit(volatile atomic_long __global *object,
4266+ long operand, memory_order order);
4267+long __ovld atomic_fetch_and_explicit(volatile atomic_long __local *object,
4268+ long operand, memory_order order);
4269+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong __global *object,
4270+ ulong operand, memory_order order);
4271+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong __local *object,
4272+ ulong operand, memory_order order);
4273+long __ovld atomic_fetch_min_explicit(volatile atomic_long __global *object,
4274+ long operand, memory_order order);
4275+long __ovld atomic_fetch_min_explicit(volatile atomic_long __local *object,
4276+ long operand, memory_order order);
4277+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong __global *object,
4278+ ulong operand, memory_order order);
4279+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong __local *object,
4280+ ulong operand, memory_order order);
4281+long __ovld atomic_fetch_max_explicit(volatile atomic_long __global *object,
4282+ long operand, memory_order order);
4283+long __ovld atomic_fetch_max_explicit(volatile atomic_long __local *object,
4284+ long operand, memory_order order);
4285+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong __global *object,
4286+ ulong operand, memory_order order);
4287+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong __local *object,
4288+ ulong operand, memory_order order);
4289+#endif // __opencl_c_atomic_scope_device
4290+long __ovld atomic_fetch_add_explicit(volatile atomic_long __global *object,
4291+ long operand, memory_order order,
4292+ memory_scope scope);
4293+long __ovld atomic_fetch_add_explicit(volatile atomic_long __local *object,
4294+ long operand, memory_order order,
4295+ memory_scope scope);
4296+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong __global *object,
4297+ ulong operand, memory_order order,
4298+ memory_scope scope);
4299+ulong __ovld atomic_fetch_add_explicit(volatile atomic_ulong __local *object,
4300+ ulong operand, memory_order order,
4301+ memory_scope scope);
4302+long __ovld atomic_fetch_sub_explicit(volatile atomic_long __global *object,
4303+ long operand, memory_order order,
4304+ memory_scope scope);
4305+long __ovld atomic_fetch_sub_explicit(volatile atomic_long __local *object,
4306+ long operand, memory_order order,
4307+ memory_scope scope);
4308+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong __global *object,
4309+ ulong operand, memory_order order,
4310+ memory_scope scope);
4311+ulong __ovld atomic_fetch_sub_explicit(volatile atomic_ulong __local *object,
4312+ ulong operand, memory_order order,
4313+ memory_scope scope);
4314+long __ovld atomic_fetch_or_explicit(volatile atomic_long __global *object,
4315+ long operand, memory_order order,
4316+ memory_scope scope);
4317+long __ovld atomic_fetch_or_explicit(volatile atomic_long __local *object,
4318+ long operand, memory_order order,
4319+ memory_scope scope);
4320+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong __global *object,
4321+ ulong operand, memory_order order,
4322+ memory_scope scope);
4323+ulong __ovld atomic_fetch_or_explicit(volatile atomic_ulong __local *object,
4324+ ulong operand, memory_order order,
4325+ memory_scope scope);
4326+long __ovld atomic_fetch_xor_explicit(volatile atomic_long __global *object,
4327+ long operand, memory_order order,
4328+ memory_scope scope);
4329+long __ovld atomic_fetch_xor_explicit(volatile atomic_long __local *object,
4330+ long operand, memory_order order,
4331+ memory_scope scope);
4332+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong __global *object,
4333+ ulong operand, memory_order order,
4334+ memory_scope scope);
4335+ulong __ovld atomic_fetch_xor_explicit(volatile atomic_ulong __local *object,
4336+ ulong operand, memory_order order,
4337+ memory_scope scope);
4338+long __ovld atomic_fetch_and_explicit(volatile atomic_long __global *object,
4339+ long operand, memory_order order,
4340+ memory_scope scope);
4341+long __ovld atomic_fetch_and_explicit(volatile atomic_long __local *object,
4342+ long operand, memory_order order,
4343+ memory_scope scope);
4344+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong __global *object,
4345+ ulong operand, memory_order order,
4346+ memory_scope scope);
4347+ulong __ovld atomic_fetch_and_explicit(volatile atomic_ulong __local *object,
4348+ ulong operand, memory_order order,
4349+ memory_scope scope);
4350+long __ovld atomic_fetch_min_explicit(volatile atomic_long __global *object,
4351+ long operand, memory_order order,
4352+ memory_scope scope);
4353+long __ovld atomic_fetch_min_explicit(volatile atomic_long __local *object,
4354+ long operand, memory_order order,
4355+ memory_scope scope);
4356+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong __global *object,
4357+ ulong operand, memory_order order,
4358+ memory_scope scope);
4359+ulong __ovld atomic_fetch_min_explicit(volatile atomic_ulong __local *object,
4360+ ulong operand, memory_order order,
4361+ memory_scope scope);
4362+long __ovld atomic_fetch_max_explicit(volatile atomic_long __global *object,
4363+ long operand, memory_order order,
4364+ memory_scope scope);
4365+long __ovld atomic_fetch_max_explicit(volatile atomic_long __local *object,
4366+ long operand, memory_order order,
4367+ memory_scope scope);
4368+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong __global *object,
4369+ ulong operand, memory_order order,
4370+ memory_scope scope);
4371+ulong __ovld atomic_fetch_max_explicit(volatile atomic_ulong __local *object,
4372+ ulong operand, memory_order order,
4373+ memory_scope scope);
4374+#endif // defined(cl_khr_int64_base_atomics) &&
4375+ // defined(cl_khr_int64_extended_atomics)
4376+
4377+// OpenCL v2.0 s6.13.11.7.5:
4378+// add/sub: atomic type argument can be uintptr_t/intptr_t, value type argument
4379+// can be ptrdiff_t. or/xor/and/min/max: atomic type argument can be
4380+// intptr_t/uintptr_t, value type argument can be intptr_t/uintptr_t.
4381+
4382+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4383+#ifdef __opencl_c_atomic_scope_device
4384+uintptr_t __ovld
4385+atomic_fetch_add_explicit(volatile atomic_uintptr_t __global *object,
4386+ ptrdiff_t operand, memory_order order);
4387+uintptr_t __ovld
4388+atomic_fetch_add_explicit(volatile atomic_uintptr_t __local *object,
4389+ ptrdiff_t operand, memory_order order);
4390+uintptr_t __ovld
4391+atomic_fetch_sub_explicit(volatile atomic_uintptr_t __global *object,
4392+ ptrdiff_t operand, memory_order order);
4393+uintptr_t __ovld
4394+atomic_fetch_sub_explicit(volatile atomic_uintptr_t __local *object,
4395+ ptrdiff_t operand, memory_order order);
4396+uintptr_t __ovld
4397+atomic_fetch_or_explicit(volatile atomic_uintptr_t __global *object,
4398+ intptr_t operand, memory_order order);
4399+uintptr_t __ovld
4400+atomic_fetch_or_explicit(volatile atomic_uintptr_t __local *object,
4401+ intptr_t operand, memory_order order);
4402+uintptr_t __ovld
4403+atomic_fetch_xor_explicit(volatile atomic_uintptr_t __global *object,
4404+ intptr_t operand, memory_order order);
4405+uintptr_t __ovld
4406+atomic_fetch_xor_explicit(volatile atomic_uintptr_t __local *object,
4407+ intptr_t operand, memory_order order);
4408+uintptr_t __ovld
4409+atomic_fetch_and_explicit(volatile atomic_uintptr_t __global *object,
4410+ intptr_t operand, memory_order order);
4411+uintptr_t __ovld
4412+atomic_fetch_and_explicit(volatile atomic_uintptr_t __local *object,
4413+ intptr_t operand, memory_order order);
4414+uintptr_t __ovld
4415+atomic_fetch_min_explicit(volatile atomic_uintptr_t __global *object,
4416+ intptr_t opermax, memory_order minder);
4417+uintptr_t __ovld
4418+atomic_fetch_min_explicit(volatile atomic_uintptr_t __local *object,
4419+ intptr_t opermax, memory_order minder);
4420+uintptr_t __ovld
4421+atomic_fetch_max_explicit(volatile atomic_uintptr_t __global *object,
4422+ intptr_t opermax, memory_order minder);
4423+uintptr_t __ovld
4424+atomic_fetch_max_explicit(volatile atomic_uintptr_t __local *object,
4425+ intptr_t opermax, memory_order minder);
4426+intptr_t __ovld
4427+atomic_fetch_or_explicit(volatile atomic_intptr_t __global *object,
4428+ uintptr_t operand, memory_order order);
4429+intptr_t __ovld
4430+atomic_fetch_or_explicit(volatile atomic_intptr_t __local *object,
4431+ uintptr_t operand, memory_order order);
4432+intptr_t __ovld
4433+atomic_fetch_xor_explicit(volatile atomic_intptr_t __global *object,
4434+ uintptr_t operand, memory_order order);
4435+intptr_t __ovld
4436+atomic_fetch_xor_explicit(volatile atomic_intptr_t __local *object,
4437+ uintptr_t operand, memory_order order);
4438+intptr_t __ovld
4439+atomic_fetch_and_explicit(volatile atomic_intptr_t __global *object,
4440+ uintptr_t operand, memory_order order);
4441+intptr_t __ovld
4442+atomic_fetch_and_explicit(volatile atomic_intptr_t __local *object,
4443+ uintptr_t operand, memory_order order);
4444+intptr_t __ovld
4445+atomic_fetch_min_explicit(volatile atomic_intptr_t __global *object,
4446+ uintptr_t opermax, memory_order minder);
4447+intptr_t __ovld
4448+atomic_fetch_min_explicit(volatile atomic_intptr_t __local *object,
4449+ uintptr_t opermax, memory_order minder);
4450+intptr_t __ovld
4451+atomic_fetch_max_explicit(volatile atomic_intptr_t __global *object,
4452+ uintptr_t opermax, memory_order minder);
4453+intptr_t __ovld
4454+atomic_fetch_max_explicit(volatile atomic_intptr_t __local *object,
4455+ uintptr_t opermax, memory_order minder);
4456+#endif // __opencl_c_atomic_scope_device
4457+uintptr_t __ovld atomic_fetch_add_explicit(
4458+ volatile atomic_uintptr_t __global *object, ptrdiff_t operand,
4459+ memory_order order, memory_scope scope);
4460+uintptr_t __ovld atomic_fetch_add_explicit(
4461+ volatile atomic_uintptr_t __local *object, ptrdiff_t operand,
4462+ memory_order order, memory_scope scope);
4463+uintptr_t __ovld atomic_fetch_sub_explicit(
4464+ volatile atomic_uintptr_t __global *object, ptrdiff_t operand,
4465+ memory_order order, memory_scope scope);
4466+uintptr_t __ovld atomic_fetch_sub_explicit(
4467+ volatile atomic_uintptr_t __local *object, ptrdiff_t operand,
4468+ memory_order order, memory_scope scope);
4469+
4470+uintptr_t __ovld atomic_fetch_or_explicit(
4471+ volatile atomic_uintptr_t __global *object, intptr_t operand,
4472+ memory_order order, memory_scope scope);
4473+uintptr_t __ovld atomic_fetch_or_explicit(
4474+ volatile atomic_uintptr_t __local *object, intptr_t operand,
4475+ memory_order order, memory_scope scope);
4476+uintptr_t __ovld atomic_fetch_xor_explicit(
4477+ volatile atomic_uintptr_t __global *object, intptr_t operand,
4478+ memory_order order, memory_scope scope);
4479+uintptr_t __ovld atomic_fetch_xor_explicit(
4480+ volatile atomic_uintptr_t __local *object, intptr_t operand,
4481+ memory_order order, memory_scope scope);
4482+uintptr_t __ovld atomic_fetch_and_explicit(
4483+ volatile atomic_uintptr_t __global *object, intptr_t operand,
4484+ memory_order order, memory_scope scope);
4485+uintptr_t __ovld atomic_fetch_and_explicit(
4486+ volatile atomic_uintptr_t __local *object, intptr_t operand,
4487+ memory_order order, memory_scope scope);
4488+uintptr_t __ovld atomic_fetch_min_explicit(
4489+ volatile atomic_uintptr_t __global *object, intptr_t opermax,
4490+ memory_order minder, memory_scope scope);
4491+uintptr_t __ovld atomic_fetch_min_explicit(
4492+ volatile atomic_uintptr_t __local *object, intptr_t opermax,
4493+ memory_order minder, memory_scope scope);
4494+uintptr_t __ovld atomic_fetch_max_explicit(
4495+ volatile atomic_uintptr_t __global *object, intptr_t opermax,
4496+ memory_order minder, memory_scope scope);
4497+uintptr_t __ovld atomic_fetch_max_explicit(
4498+ volatile atomic_uintptr_t __local *object, intptr_t opermax,
4499+ memory_order minder, memory_scope scope);
4500+
4501+intptr_t __ovld atomic_fetch_or_explicit(
4502+ volatile atomic_intptr_t __global *object, uintptr_t operand,
4503+ memory_order order, memory_scope scope);
4504+intptr_t __ovld atomic_fetch_or_explicit(
4505+ volatile atomic_intptr_t __local *object, uintptr_t operand,
4506+ memory_order order, memory_scope scope);
4507+intptr_t __ovld atomic_fetch_xor_explicit(
4508+ volatile atomic_intptr_t __global *object, uintptr_t operand,
4509+ memory_order order, memory_scope scope);
4510+intptr_t __ovld atomic_fetch_xor_explicit(
4511+ volatile atomic_intptr_t __local *object, uintptr_t operand,
4512+ memory_order order, memory_scope scope);
4513+intptr_t __ovld atomic_fetch_and_explicit(
4514+ volatile atomic_intptr_t __global *object, uintptr_t operand,
4515+ memory_order order, memory_scope scope);
4516+intptr_t __ovld atomic_fetch_and_explicit(
4517+ volatile atomic_intptr_t __local *object, uintptr_t operand,
4518+ memory_order order, memory_scope scope);
4519+intptr_t __ovld atomic_fetch_min_explicit(
4520+ volatile atomic_intptr_t __global *object, uintptr_t opermax,
4521+ memory_order minder, memory_scope scope);
4522+intptr_t __ovld atomic_fetch_min_explicit(
4523+ volatile atomic_intptr_t __local *object, uintptr_t opermax,
4524+ memory_order minder, memory_scope scope);
4525+intptr_t __ovld atomic_fetch_max_explicit(
4526+ volatile atomic_intptr_t __global *object, uintptr_t opermax,
4527+ memory_order minder, memory_scope scope);
4528+intptr_t __ovld atomic_fetch_max_explicit(
4529+ volatile atomic_intptr_t __local *object, uintptr_t opermax,
4530+ memory_order minder, memory_scope scope);
4531+#endif // defined(cl_khr_int64_base_atomics) &&
4532+ // defined(cl_khr_int64_extended_atomics)
4533+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4534
4535 // atomic_store()
4536
4537+#if defined(__opencl_c_atomic_scope_device) && \
4538+ defined(__opencl_c_atomic_order_seq_cst)
4539+
4540+#ifdef __opencl_c_generic_address_space
4541 void __ovld atomic_store(volatile atomic_int *object, int desired);
4542-void __ovld atomic_store_explicit(volatile atomic_int *object, int desired, memory_order order);
4543-void __ovld atomic_store_explicit(volatile atomic_int *object, int desired, memory_order order, memory_scope scope);
4544 void __ovld atomic_store(volatile atomic_uint *object, uint desired);
4545-void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired, memory_order order);
4546-void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired, memory_order order, memory_scope scope);
4547 void __ovld atomic_store(volatile atomic_float *object, float desired);
4548-void __ovld atomic_store_explicit(volatile atomic_float *object, float desired, memory_order order);
4549-void __ovld atomic_store_explicit(volatile atomic_float *object, float desired, memory_order order, memory_scope scope);
4550 #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4551-#ifdef cl_khr_fp64
4552+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4553 void __ovld atomic_store(volatile atomic_double *object, double desired);
4554-void __ovld atomic_store_explicit(volatile atomic_double *object, double desired, memory_order order);
4555-void __ovld atomic_store_explicit(volatile atomic_double *object, double desired, memory_order order, memory_scope scope);
4556-#endif //cl_khr_fp64
4557+#endif
4558 void __ovld atomic_store(volatile atomic_long *object, long desired);
4559-void __ovld atomic_store_explicit(volatile atomic_long *object, long desired, memory_order order);
4560-void __ovld atomic_store_explicit(volatile atomic_long *object, long desired, memory_order order, memory_scope scope);
4561 void __ovld atomic_store(volatile atomic_ulong *object, ulong desired);
4562-void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired, memory_order order);
4563-void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired, memory_order order, memory_scope scope);
4564+#endif // defined(cl_khr_int64_base_atomics) &&
4565+ // defined(cl_khr_int64_extended_atomics)
4566+#endif // __opencl_c_generic_address_space
4567+
4568+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4569+void __ovld atomic_store(volatile atomic_int __global *object, int desired);
4570+void __ovld atomic_store(volatile atomic_int __local *object, int desired);
4571+void __ovld atomic_store(volatile atomic_uint __global *object, uint desired);
4572+void __ovld atomic_store(volatile atomic_uint __local *object, uint desired);
4573+void __ovld atomic_store(volatile atomic_float __global *object, float desired);
4574+void __ovld atomic_store(volatile atomic_float __local *object, float desired);
4575+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4576+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4577+void __ovld atomic_store(volatile atomic_double __global *object,
4578+ double desired);
4579+void __ovld atomic_store(volatile atomic_double __local *object,
4580+ double desired);
4581 #endif
4582+void __ovld atomic_store(volatile atomic_long __global *object, long desired);
4583+void __ovld atomic_store(volatile atomic_long __local *object, long desired);
4584+void __ovld atomic_store(volatile atomic_ulong __global *object, ulong desired);
4585+void __ovld atomic_store(volatile atomic_ulong __local *object, ulong desired);
4586+#endif // defined(cl_khr_int64_base_atomics) &&
4587+ // defined(cl_khr_int64_extended_atomics)
4588+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4589+
4590+#endif // defined(__opencl_c_atomic_scope_device) &&
4591+ // defined(__opencl_c_atomic_order_seq_cst)
4592+
4593+#ifdef __opencl_c_generic_address_space
4594+#ifdef __opencl_c_atomic_scope_device
4595+void __ovld atomic_store_explicit(volatile atomic_int *object, int desired,
4596+ memory_order order);
4597+void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired,
4598+ memory_order order);
4599+void __ovld atomic_store_explicit(volatile atomic_float *object, float desired,
4600+ memory_order order);
4601+#endif // __opencl_c_atomic_scope_device
4602+void __ovld atomic_store_explicit(volatile atomic_int *object, int desired,
4603+ memory_order order, memory_scope scope);
4604+void __ovld atomic_store_explicit(volatile atomic_uint *object, uint desired,
4605+ memory_order order, memory_scope scope);
4606+void __ovld atomic_store_explicit(volatile atomic_float *object, float desired,
4607+ memory_order order, memory_scope scope);
4608+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4609+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4610+#ifdef __opencl_c_atomic_scope_device
4611+void __ovld atomic_store_explicit(volatile atomic_double *object,
4612+ double desired, memory_order order);
4613+#endif //__opencl_c_atomic_scope_device
4614+void __ovld atomic_store_explicit(volatile atomic_double *object,
4615+ double desired, memory_order order,
4616+ memory_scope scope);
4617+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4618+#ifdef __opencl_c_atomic_scope_device
4619+void __ovld atomic_store_explicit(volatile atomic_long *object, long desired,
4620+ memory_order order);
4621+void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired,
4622+ memory_order order);
4623+#endif //__opencl_c_atomic_scope_device
4624+void __ovld atomic_store_explicit(volatile atomic_long *object, long desired,
4625+ memory_order order, memory_scope scope);
4626+void __ovld atomic_store_explicit(volatile atomic_ulong *object, ulong desired,
4627+ memory_order order, memory_scope scope);
4628+#endif // defined(cl_khr_int64_base_atomics) &&
4629+ // defined(cl_khr_int64_extended_atomics)
4630+#endif // __opencl_c_generic_address_space
4631+
4632+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4633+#ifdef __opencl_c_atomic_scope_device
4634+void __ovld atomic_store_explicit(volatile atomic_int __global *object,
4635+ int desired, memory_order order);
4636+void __ovld atomic_store_explicit(volatile atomic_int __local *object,
4637+ int desired, memory_order order);
4638+void __ovld atomic_store_explicit(volatile atomic_uint __global *object,
4639+ uint desired, memory_order order);
4640+void __ovld atomic_store_explicit(volatile atomic_uint __local *object,
4641+ uint desired, memory_order order);
4642+void __ovld atomic_store_explicit(volatile atomic_float __global *object,
4643+ float desired, memory_order order);
4644+void __ovld atomic_store_explicit(volatile atomic_float __local *object,
4645+ float desired, memory_order order);
4646+#endif // __opencl_c_atomic_scope_device
4647+void __ovld atomic_store_explicit(volatile atomic_int __global *object,
4648+ int desired, memory_order order,
4649+ memory_scope scope);
4650+void __ovld atomic_store_explicit(volatile atomic_int __local *object,
4651+ int desired, memory_order order,
4652+ memory_scope scope);
4653+void __ovld atomic_store_explicit(volatile atomic_uint __global *object,
4654+ uint desired, memory_order order,
4655+ memory_scope scope);
4656+void __ovld atomic_store_explicit(volatile atomic_uint __local *object,
4657+ uint desired, memory_order order,
4658+ memory_scope scope);
4659+void __ovld atomic_store_explicit(volatile atomic_float __global *object,
4660+ float desired, memory_order order,
4661+ memory_scope scope);
4662+void __ovld atomic_store_explicit(volatile atomic_float __local *object,
4663+ float desired, memory_order order,
4664+ memory_scope scope);
4665+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4666+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4667+#ifdef __opencl_c_atomic_scope_device
4668+void __ovld atomic_store_explicit(volatile atomic_double __global *object,
4669+ double desired, memory_order order);
4670+void __ovld atomic_store_explicit(volatile atomic_double __local *object,
4671+ double desired, memory_order order);
4672+#endif //__opencl_c_atomic_scope_device
4673+void __ovld atomic_store_explicit(volatile atomic_double __global *object,
4674+ double desired, memory_order order,
4675+ memory_scope scope);
4676+void __ovld atomic_store_explicit(volatile atomic_double __local *object,
4677+ double desired, memory_order order,
4678+ memory_scope scope);
4679+#endif // cl_khr_fp64
4680+#ifdef __opencl_c_atomic_scope_device
4681+void __ovld atomic_store_explicit(volatile atomic_long __global *object,
4682+ long desired, memory_order order);
4683+void __ovld atomic_store_explicit(volatile atomic_long __local *object,
4684+ long desired, memory_order order);
4685+void __ovld atomic_store_explicit(volatile atomic_ulong __global *object,
4686+ ulong desired, memory_order order);
4687+void __ovld atomic_store_explicit(volatile atomic_ulong __local *object,
4688+ ulong desired, memory_order order);
4689+#endif // __opencl_c_atomic_scope_device
4690+void __ovld atomic_store_explicit(volatile atomic_long __global *object,
4691+ long desired, memory_order order,
4692+ memory_scope scope);
4693+void __ovld atomic_store_explicit(volatile atomic_long __local *object,
4694+ long desired, memory_order order,
4695+ memory_scope scope);
4696+void __ovld atomic_store_explicit(volatile atomic_ulong __global *object,
4697+ ulong desired, memory_order order,
4698+ memory_scope scope);
4699+void __ovld atomic_store_explicit(volatile atomic_ulong __local *object,
4700+ ulong desired, memory_order order,
4701+ memory_scope scope);
4702+#endif // defined(cl_khr_int64_base_atomics) &&
4703+ // defined(cl_khr_int64_extended_atomics)
4704+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4705
4706 // atomic_load()
4707-
4708+#ifdef __opencl_c_generic_address_space
4709+#if defined(__opencl_c_atomic_scope_device) && \
4710+ defined(__opencl_c_atomic_order_seq_cst)
4711 int __ovld atomic_load(volatile atomic_int *object);
4712-int __ovld atomic_load_explicit(volatile atomic_int *object, memory_order order);
4713-int __ovld atomic_load_explicit(volatile atomic_int *object, memory_order order, memory_scope scope);
4714 uint __ovld atomic_load(volatile atomic_uint *object);
4715-uint __ovld atomic_load_explicit(volatile atomic_uint *object, memory_order order);
4716-uint __ovld atomic_load_explicit(volatile atomic_uint *object, memory_order order, memory_scope scope);
4717 float __ovld atomic_load(volatile atomic_float *object);
4718-float __ovld atomic_load_explicit(volatile atomic_float *object, memory_order order);
4719-float __ovld atomic_load_explicit(volatile atomic_float *object, memory_order order, memory_scope scope);
4720 #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4721-#ifdef cl_khr_fp64
4722+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4723 double __ovld atomic_load(volatile atomic_double *object);
4724-double __ovld atomic_load_explicit(volatile atomic_double *object, memory_order order);
4725-double __ovld atomic_load_explicit(volatile atomic_double *object, memory_order order, memory_scope scope);
4726-#endif //cl_khr_fp64
4727+#endif // cl_khr_fp64
4728 long __ovld atomic_load(volatile atomic_long *object);
4729-long __ovld atomic_load_explicit(volatile atomic_long *object, memory_order order);
4730-long __ovld atomic_load_explicit(volatile atomic_long *object, memory_order order, memory_scope scope);
4731 ulong __ovld atomic_load(volatile atomic_ulong *object);
4732-ulong __ovld atomic_load_explicit(volatile atomic_ulong *object, memory_order order);
4733-ulong __ovld atomic_load_explicit(volatile atomic_ulong *object, memory_order order, memory_scope scope);
4734-#endif
4735+#endif // defined(cl_khr_int64_base_atomics) &&
4736+ // defined(cl_khr_int64_extended_atomics)
4737+#endif // defined(__opencl_c_atomic_scope_device) &&
4738+ // defined(__opencl_c_atomic_order_seq_cst)
4739+#endif //__opencl_c_generic_address_space
4740+
4741+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4742+#if defined(__opencl_c_atomic_scope_device) && \
4743+ defined(__opencl_c_atomic_order_seq_cst)
4744+int __ovld atomic_load(volatile atomic_int __global *object);
4745+int __ovld atomic_load(volatile atomic_int __local *object);
4746+uint __ovld atomic_load(volatile atomic_uint __global *object);
4747+uint __ovld atomic_load(volatile atomic_uint __local *object);
4748+float __ovld atomic_load(volatile atomic_float __global *object);
4749+float __ovld atomic_load(volatile atomic_float __local *object);
4750+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4751+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4752+double __ovld atomic_load(volatile atomic_double __global *object);
4753+double __ovld atomic_load(volatile atomic_double __local *object);
4754+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4755+long __ovld atomic_load(volatile atomic_long __global *object);
4756+long __ovld atomic_load(volatile atomic_long __local *object);
4757+ulong __ovld atomic_load(volatile atomic_ulong __global *object);
4758+ulong __ovld atomic_load(volatile atomic_ulong __local *object);
4759+#endif // defined(cl_khr_int64_base_atomics) &&
4760+ // defined(cl_khr_int64_extended_atomics)
4761+#endif // defined(__opencl_c_atomic_scope_device) &&
4762+ // defined(__opencl_c_atomic_order_seq_cst)
4763+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4764+
4765+#ifdef __opencl_c_generic_address_space
4766+#ifdef __opencl_c_atomic_scope_device
4767+int __ovld atomic_load_explicit(volatile atomic_int *object,
4768+ memory_order order);
4769+uint __ovld atomic_load_explicit(volatile atomic_uint *object,
4770+ memory_order order);
4771+float __ovld atomic_load_explicit(volatile atomic_float *object,
4772+ memory_order order);
4773+#endif // __opencl_c_atomic_scope_device
4774+int __ovld atomic_load_explicit(volatile atomic_int *object, memory_order order,
4775+ memory_scope scope);
4776+uint __ovld atomic_load_explicit(volatile atomic_uint *object,
4777+ memory_order order, memory_scope scope);
4778+float __ovld atomic_load_explicit(volatile atomic_float *object,
4779+ memory_order order, memory_scope scope);
4780+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4781+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4782+#ifdef __opencl_c_atomic_scope_device
4783+double __ovld atomic_load_explicit(volatile atomic_double *object,
4784+ memory_order order);
4785+#endif // __opencl_c_atomic_scope_device
4786+double __ovld atomic_load_explicit(volatile atomic_double *object,
4787+ memory_order order, memory_scope scope);
4788+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4789+#ifdef __opencl_c_atomic_scope_device
4790+long __ovld atomic_load_explicit(volatile atomic_long *object,
4791+ memory_order order);
4792+ulong __ovld atomic_load_explicit(volatile atomic_ulong *object,
4793+ memory_order order);
4794+#endif //__opencl_c_atomic_scope_device
4795+long __ovld atomic_load_explicit(volatile atomic_long *object,
4796+ memory_order order, memory_scope scope);
4797+ulong __ovld atomic_load_explicit(volatile atomic_ulong *object,
4798+ memory_order order, memory_scope scope);
4799+#endif // defined(cl_khr_int64_base_atomics) &&
4800+ // defined(cl_khr_int64_extended_atomics)
4801+#endif // __opencl_c_generic_address_space
4802+
4803+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4804+#ifdef __opencl_c_atomic_scope_device
4805+int __ovld atomic_load_explicit(volatile atomic_int __global *object,
4806+ memory_order order);
4807+int __ovld atomic_load_explicit(volatile atomic_int __local *object,
4808+ memory_order order);
4809+uint __ovld atomic_load_explicit(volatile atomic_uint __global *object,
4810+ memory_order order);
4811+uint __ovld atomic_load_explicit(volatile atomic_uint __local *object,
4812+ memory_order order);
4813+float __ovld atomic_load_explicit(volatile atomic_float __global *object,
4814+ memory_order order);
4815+float __ovld atomic_load_explicit(volatile atomic_float __local *object,
4816+ memory_order order);
4817+#endif // __opencl_c_atomic_scope_device
4818+int __ovld atomic_load_explicit(volatile atomic_int __global *object,
4819+ memory_order order, memory_scope scope);
4820+int __ovld atomic_load_explicit(volatile atomic_int __local *object,
4821+ memory_order order, memory_scope scope);
4822+uint __ovld atomic_load_explicit(volatile atomic_uint __global *object,
4823+ memory_order order, memory_scope scope);
4824+uint __ovld atomic_load_explicit(volatile atomic_uint __local *object,
4825+ memory_order order, memory_scope scope);
4826+float __ovld atomic_load_explicit(volatile atomic_float __global *object,
4827+ memory_order order, memory_scope scope);
4828+float __ovld atomic_load_explicit(volatile atomic_float __local *object,
4829+ memory_order order, memory_scope scope);
4830+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4831+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4832+#ifdef __opencl_c_atomic_scope_device
4833+double __ovld atomic_load_explicit(volatile atomic_double __global *object,
4834+ memory_order order);
4835+double __ovld atomic_load_explicit(volatile atomic_double __local *object,
4836+ memory_order order);
4837+#endif // __opencl_c_atomic_scope_device
4838+double __ovld atomic_load_explicit(volatile atomic_double __global *object,
4839+ memory_order order, memory_scope scope);
4840+double __ovld atomic_load_explicit(volatile atomic_double __local *object,
4841+ memory_order order, memory_scope scope);
4842+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4843+#ifdef __opencl_c_atomic_scope_device
4844+long __ovld atomic_load_explicit(volatile atomic_long __global *object,
4845+ memory_order order);
4846+long __ovld atomic_load_explicit(volatile atomic_long __local *object,
4847+ memory_order order);
4848+ulong __ovld atomic_load_explicit(volatile atomic_ulong __global *object,
4849+ memory_order order);
4850+ulong __ovld atomic_load_explicit(volatile atomic_ulong __local *object,
4851+ memory_order order);
4852+#endif // __opencl_c_atomic_scope_device
4853+long __ovld atomic_load_explicit(volatile atomic_long __global *object,
4854+ memory_order order, memory_scope scope);
4855+long __ovld atomic_load_explicit(volatile atomic_long __local *object,
4856+ memory_order order, memory_scope scope);
4857+ulong __ovld atomic_load_explicit(volatile atomic_ulong __global *object,
4858+ memory_order order, memory_scope scope);
4859+ulong __ovld atomic_load_explicit(volatile atomic_ulong __local *object,
4860+ memory_order order, memory_scope scope);
4861+#endif // defined(cl_khr_int64_base_atomics) &&
4862+ // defined(cl_khr_int64_extended_atomics)
4863+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4864
4865 // atomic_exchange()
4866-
4867+#ifdef __opencl_c_generic_address_space
4868+#if defined(__opencl_c_atomic_scope_device) && \
4869+ defined(__opencl_c_atomic_order_seq_cst)
4870 int __ovld atomic_exchange(volatile atomic_int *object, int desired);
4871-int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired, memory_order order);
4872-int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired, memory_order order, memory_scope scope);
4873 uint __ovld atomic_exchange(volatile atomic_uint *object, uint desired);
4874-uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired, memory_order order);
4875-uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired, memory_order order, memory_scope scope);
4876 float __ovld atomic_exchange(volatile atomic_float *object, float desired);
4877-float __ovld atomic_exchange_explicit(volatile atomic_float *object, float desired, memory_order order);
4878-float __ovld atomic_exchange_explicit(volatile atomic_float *object, float desired, memory_order order, memory_scope scope);
4879 #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4880-#ifdef cl_khr_fp64
4881+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4882 double __ovld atomic_exchange(volatile atomic_double *object, double desired);
4883-double __ovld atomic_exchange_explicit(volatile atomic_double *object, double desired, memory_order order);
4884-double __ovld atomic_exchange_explicit(volatile atomic_double *object, double desired, memory_order order, memory_scope scope);
4885-#endif //cl_khr_fp64
4886+#endif
4887 long __ovld atomic_exchange(volatile atomic_long *object, long desired);
4888-long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired, memory_order order);
4889-long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired, memory_order order, memory_scope scope);
4890 ulong __ovld atomic_exchange(volatile atomic_ulong *object, ulong desired);
4891-ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object, ulong desired, memory_order order);
4892-ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object, ulong desired, memory_order order, memory_scope scope);
4893+#endif // defined(cl_khr_int64_base_atomics) &&
4894+ // defined(cl_khr_int64_extended_atomics)
4895+#endif // defined(__opencl_c_atomic_scope_device) &&
4896+ // defined(__opencl_c_atomic_order_seq_cst)
4897+#endif // __opencl_c_generic_address_space
4898+
4899+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4900+#if defined(__opencl_c_atomic_scope_device) && \
4901+ defined(__opencl_c_atomic_order_seq_cst)
4902+int __ovld atomic_exchange(volatile atomic_int __global *object, int desired);
4903+int __ovld atomic_exchange(volatile atomic_int __local *object, int desired);
4904+uint __ovld atomic_exchange(volatile atomic_uint __global *object,
4905+ uint desired);
4906+uint __ovld atomic_exchange(volatile atomic_uint __local *object, uint desired);
4907+float __ovld atomic_exchange(volatile atomic_float __global *object,
4908+ float desired);
4909+float __ovld atomic_exchange(volatile atomic_float __local *object,
4910+ float desired);
4911+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4912+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4913+double __ovld atomic_exchange(volatile atomic_double __global *object,
4914+ double desired);
4915+double __ovld atomic_exchange(volatile atomic_double __local *object,
4916+ double desired);
4917 #endif
4918+long __ovld atomic_exchange(volatile atomic_long __global *object,
4919+ long desired);
4920+long __ovld atomic_exchange(volatile atomic_long __local *object, long desired);
4921+ulong __ovld atomic_exchange(volatile atomic_ulong __global *object,
4922+ ulong desired);
4923+ulong __ovld atomic_exchange(volatile atomic_ulong __local *object,
4924+ ulong desired);
4925+#endif // defined(cl_khr_int64_base_atomics) &&
4926+ // defined(cl_khr_int64_extended_atomics)
4927+#endif // defined(__opencl_c_atomic_scope_device) &&
4928+ // defined(__opencl_c_atomic_order_seq_cst)
4929+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4930+
4931+#ifdef __opencl_c_generic_address_space
4932+#ifdef __opencl_c_atomic_scope_device
4933+int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired,
4934+ memory_order order);
4935+uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired,
4936+ memory_order order);
4937+float __ovld atomic_exchange_explicit(volatile atomic_float *object,
4938+ float desired, memory_order order);
4939+#endif // __opencl_c_atomic_scope_device
4940+int __ovld atomic_exchange_explicit(volatile atomic_int *object, int desired,
4941+ memory_order order, memory_scope scope);
4942+uint __ovld atomic_exchange_explicit(volatile atomic_uint *object, uint desired,
4943+ memory_order order, memory_scope scope);
4944+float __ovld atomic_exchange_explicit(volatile atomic_float *object,
4945+ float desired, memory_order order,
4946+ memory_scope scope);
4947+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
4948+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4949+#ifdef __opencl_c_atomic_scope_device
4950+double __ovld atomic_exchange_explicit(volatile atomic_double *object,
4951+ double desired, memory_order order);
4952+#endif // __opencl_c_atomic_scope_device
4953+double __ovld atomic_exchange_explicit(volatile atomic_double *object,
4954+ double desired, memory_order order,
4955+ memory_scope scope);
4956+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
4957+#ifdef __opencl_c_atomic_scope_device
4958+long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired,
4959+ memory_order order);
4960+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object,
4961+ ulong desired, memory_order order);
4962+#endif // __opencl_c_atomic_scope_device
4963+long __ovld atomic_exchange_explicit(volatile atomic_long *object, long desired,
4964+ memory_order order, memory_scope scope);
4965+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong *object,
4966+ ulong desired, memory_order order,
4967+ memory_scope scope);
4968+#endif // defined(cl_khr_int64_base_atomics) &&
4969+ // defined(cl_khr_int64_extended_atomics)
4970+#endif // __opencl_c_generic_address_space
4971+
4972+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
4973+#ifdef __opencl_c_atomic_scope_device
4974+int __ovld atomic_exchange_explicit(volatile atomic_int __global *object,
4975+ int desired, memory_order order);
4976+int __ovld atomic_exchange_explicit(volatile atomic_int __local *object,
4977+ int desired, memory_order order);
4978+uint __ovld atomic_exchange_explicit(volatile atomic_uint __global *object,
4979+ uint desired, memory_order order);
4980+uint __ovld atomic_exchange_explicit(volatile atomic_uint __local *object,
4981+ uint desired, memory_order order);
4982+float __ovld atomic_exchange_explicit(volatile atomic_float __global *object,
4983+ float desired, memory_order order);
4984+float __ovld atomic_exchange_explicit(volatile atomic_float __local *object,
4985+ float desired, memory_order order);
4986+#endif // __opencl_c_atomic_scope_device
4987+int __ovld atomic_exchange_explicit(volatile atomic_int __global *object,
4988+ int desired, memory_order order,
4989+ memory_scope scope);
4990+int __ovld atomic_exchange_explicit(volatile atomic_int __local *object,
4991+ int desired, memory_order order,
4992+ memory_scope scope);
4993+uint __ovld atomic_exchange_explicit(volatile atomic_uint __global *object,
4994+ uint desired, memory_order order,
4995+ memory_scope scope);
4996+uint __ovld atomic_exchange_explicit(volatile atomic_uint __local *object,
4997+ uint desired, memory_order order,
4998+ memory_scope scope);
4999+float __ovld atomic_exchange_explicit(volatile atomic_float __global *object,
5000+ float desired, memory_order order,
5001+ memory_scope scope);
5002+float __ovld atomic_exchange_explicit(volatile atomic_float __local *object,
5003+ float desired, memory_order order,
5004+ memory_scope scope);
5005+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
5006+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
5007+#ifdef __opencl_c_atomic_scope_device
5008+double __ovld atomic_exchange_explicit(volatile atomic_double __global *object,
5009+ double desired, memory_order order);
5010+double __ovld atomic_exchange_explicit(volatile atomic_double __local *object,
5011+ double desired, memory_order order);
5012+#endif // __opencl_c_atomic_scope_device
5013+double __ovld atomic_exchange_explicit(volatile atomic_double __global *object,
5014+ double desired, memory_order order,
5015+ memory_scope scope);
5016+double __ovld atomic_exchange_explicit(volatile atomic_double __local *object,
5017+ double desired, memory_order order,
5018+ memory_scope scope);
5019+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
5020+#ifdef __opencl_c_atomic_scope_device
5021+long __ovld atomic_exchange_explicit(volatile atomic_long __global *object,
5022+ long desired, memory_order order);
5023+long __ovld atomic_exchange_explicit(volatile atomic_long __local *object,
5024+ long desired, memory_order order);
5025+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong __global *object,
5026+ ulong desired, memory_order order);
5027+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong __local *object,
5028+ ulong desired, memory_order order);
5029+#endif // __opencl_c_atomic_scope_device
5030+long __ovld atomic_exchange_explicit(volatile atomic_long __global *object,
5031+ long desired, memory_order order,
5032+ memory_scope scope);
5033+long __ovld atomic_exchange_explicit(volatile atomic_long __local *object,
5034+ long desired, memory_order order,
5035+ memory_scope scope);
5036+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong __global *object,
5037+ ulong desired, memory_order order,
5038+ memory_scope scope);
5039+ulong __ovld atomic_exchange_explicit(volatile atomic_ulong __local *object,
5040+ ulong desired, memory_order order,
5041+ memory_scope scope);
5042+#endif // defined(cl_khr_int64_base_atomics) &&
5043+ // defined(cl_khr_int64_extended_atomics)
5044+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
5045
5046 // atomic_compare_exchange_strong() and atomic_compare_exchange_weak()
5047-
5048-bool __ovld atomic_compare_exchange_strong(volatile atomic_int *object, int *expected, int desired);
5049-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object, int *expected,
5050- int desired, memory_order success, memory_order failure);
5051-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object, int *expected,
5052- int desired, memory_order success, memory_order failure, memory_scope scope);
5053-bool __ovld atomic_compare_exchange_strong(volatile atomic_uint *object, uint *expected, uint desired);
5054-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_uint *object, uint *expected,
5055- uint desired, memory_order success, memory_order failure);
5056-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_uint *object, uint *expected,
5057- uint desired, memory_order success, memory_order failure, memory_scope scope);
5058-bool __ovld atomic_compare_exchange_weak(volatile atomic_int *object, int *expected, int desired);
5059-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object, int *expected,
5060- int desired, memory_order success, memory_order failure);
5061-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object, int *expected,
5062- int desired, memory_order success, memory_order failure, memory_scope scope);
5063-bool __ovld atomic_compare_exchange_weak(volatile atomic_uint *object, uint *expected, uint desired);
5064-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object, uint *expected,
5065- uint desired, memory_order success, memory_order failure);
5066-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object, uint *expected,
5067- uint desired, memory_order success, memory_order failure, memory_scope scope);
5068-bool __ovld atomic_compare_exchange_strong(volatile atomic_float *object, float *expected, float desired);
5069-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_float *object, float *expected,
5070- float desired, memory_order success, memory_order failure);
5071-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_float *object, float *expected,
5072- float desired, memory_order success, memory_order failure, memory_scope scope);
5073-bool __ovld atomic_compare_exchange_weak(volatile atomic_float *object, float *expected, float desired);
5074-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_float *object, float *expected,
5075- float desired, memory_order success, memory_order failure);
5076-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_float *object, float *expected,
5077- float desired, memory_order success, memory_order failure, memory_scope scope);
5078+#ifdef __opencl_c_generic_address_space
5079+#if defined(__opencl_c_atomic_scope_device) && \
5080+ defined(__opencl_c_atomic_order_seq_cst)
5081+bool __ovld atomic_compare_exchange_strong(volatile atomic_int *object,
5082+ int *expected, int desired);
5083+bool __ovld atomic_compare_exchange_strong(volatile atomic_uint *object,
5084+ uint *expected, uint desired);
5085+bool __ovld atomic_compare_exchange_weak(volatile atomic_int *object,
5086+ int *expected, int desired);
5087+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint *object,
5088+ uint *expected, uint desired);
5089+bool __ovld atomic_compare_exchange_strong(volatile atomic_float *object,
5090+ float *expected, float desired);
5091+bool __ovld atomic_compare_exchange_weak(volatile atomic_float *object,
5092+ float *expected, float desired);
5093+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
5094+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
5095+bool __ovld atomic_compare_exchange_strong(volatile atomic_double *object,
5096+ double *expected, double desired);
5097+bool __ovld atomic_compare_exchange_weak(volatile atomic_double *object,
5098+ double *expected, double desired);
5099+#endif
5100+bool __ovld atomic_compare_exchange_strong(volatile atomic_long *object,
5101+ long *expected, long desired);
5102+bool __ovld atomic_compare_exchange_weak(volatile atomic_long *object,
5103+ long *expected, long desired);
5104+bool __ovld atomic_compare_exchange_strong(volatile atomic_ulong *object,
5105+ ulong *expected, ulong desired);
5106+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong *object,
5107+ ulong *expected, ulong desired);
5108+#endif // defined(cl_khr_int64_base_atomics) &&
5109+ // defined(cl_khr_int64_extended_atomics)
5110+#endif // defined(__opencl_c_atomic_scope_device) &&
5111+ // defined(__opencl_c_atomic_order_seq_cst)
5112+#endif // __opencl_c_generic_address_space
5113+
5114+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
5115+#if defined(__opencl_c_atomic_scope_device) && \
5116+ defined(__opencl_c_atomic_order_seq_cst)
5117+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __global *object,
5118+ int __global *expected, int desired);
5119+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __local *object,
5120+ int __global *expected, int desired);
5121+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __global *object,
5122+ int __local *expected, int desired);
5123+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __local *object,
5124+ int __local *expected, int desired);
5125+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __global *object,
5126+ int __private *expected,
5127+ int desired);
5128+bool __ovld atomic_compare_exchange_strong(volatile atomic_int __local *object,
5129+ int __private *expected,
5130+ int desired);
5131+bool __ovld
5132+atomic_compare_exchange_strong(volatile atomic_uint __global *object,
5133+ uint __global *expected, uint desired);
5134+bool __ovld atomic_compare_exchange_strong(volatile atomic_uint __local *object,
5135+ uint __global *expected,
5136+ uint desired);
5137+bool __ovld
5138+atomic_compare_exchange_strong(volatile atomic_uint __global *object,
5139+ uint __local *expected, uint desired);
5140+bool __ovld atomic_compare_exchange_strong(volatile atomic_uint __local *object,
5141+ uint __local *expected,
5142+ uint desired);
5143+bool __ovld
5144+atomic_compare_exchange_strong(volatile atomic_uint __global *object,
5145+ uint __private *expected, uint desired);
5146+bool __ovld atomic_compare_exchange_strong(volatile atomic_uint __local *object,
5147+ uint __private *expected,
5148+ uint desired);
5149+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __global *object,
5150+ int __global *expected, int desired);
5151+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __local *object,
5152+ int __global *expected, int desired);
5153+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __global *object,
5154+ int __local *expected, int desired);
5155+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __local *object,
5156+ int __local *expected, int desired);
5157+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __global *object,
5158+ int __private *expected, int desired);
5159+bool __ovld atomic_compare_exchange_weak(volatile atomic_int __local *object,
5160+ int __private *expected, int desired);
5161+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __global *object,
5162+ uint __global *expected, uint desired);
5163+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __local *object,
5164+ uint __global *expected, uint desired);
5165+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __global *object,
5166+ uint __local *expected, uint desired);
5167+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __local *object,
5168+ uint __local *expected, uint desired);
5169+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __global *object,
5170+ uint __private *expected,
5171+ uint desired);
5172+bool __ovld atomic_compare_exchange_weak(volatile atomic_uint __local *object,
5173+ uint __private *expected,
5174+ uint desired);
5175+bool __ovld
5176+atomic_compare_exchange_strong(volatile atomic_float __global *object,
5177+ float __global *expected, float desired);
5178+bool __ovld
5179+atomic_compare_exchange_strong(volatile atomic_float __local *object,
5180+ float __global *expected, float desired);
5181+bool __ovld
5182+atomic_compare_exchange_strong(volatile atomic_float __global *object,
5183+ float __local *expected, float desired);
5184+bool __ovld
5185+atomic_compare_exchange_strong(volatile atomic_float __local *object,
5186+ float __local *expected, float desired);
5187+bool __ovld
5188+atomic_compare_exchange_strong(volatile atomic_float __global *object,
5189+ float __private *expected, float desired);
5190+bool __ovld
5191+atomic_compare_exchange_strong(volatile atomic_float __local *object,
5192+ float __private *expected, float desired);
5193+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __global *object,
5194+ float __global *expected,
5195+ float desired);
5196+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __local *object,
5197+ float __global *expected,
5198+ float desired);
5199+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __global *object,
5200+ float __local *expected,
5201+ float desired);
5202+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __local *object,
5203+ float __local *expected,
5204+ float desired);
5205+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __global *object,
5206+ float __private *expected,
5207+ float desired);
5208+bool __ovld atomic_compare_exchange_weak(volatile atomic_float __local *object,
5209+ float __private *expected,
5210+ float desired);
5211 #if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
5212-#ifdef cl_khr_fp64
5213-bool __ovld atomic_compare_exchange_strong(volatile atomic_double *object, double *expected, double desired);
5214-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_double *object, double *expected,
5215- double desired, memory_order success, memory_order failure);
5216-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_double *object, double *expected,
5217- double desired, memory_order success, memory_order failure, memory_scope scope);
5218-bool __ovld atomic_compare_exchange_weak(volatile atomic_double *object, double *expected, double desired);
5219-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_double *object, double *expected,
5220- double desired, memory_order success, memory_order failure);
5221-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_double *object, double *expected,
5222- double desired, memory_order success, memory_order failure, memory_scope scope);
5223-#endif //cl_khr_fp64
5224-bool __ovld atomic_compare_exchange_strong(volatile atomic_long *object, long *expected, long desired);
5225-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_long *object, long *expected,
5226- long desired, memory_order success, memory_order failure);
5227-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_long *object, long *expected,
5228- long desired, memory_order success, memory_order failure, memory_scope scope);
5229-bool __ovld atomic_compare_exchange_weak(volatile atomic_long *object, long *expected, long desired);
5230-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object, long *expected,
5231- long desired, memory_order success, memory_order failure);
5232-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object, long *expected,
5233- long desired, memory_order success, memory_order failure, memory_scope scope);
5234-bool __ovld atomic_compare_exchange_strong(volatile atomic_ulong *object, ulong *expected, ulong desired);
5235-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_ulong *object, ulong *expected,
5236- ulong desired, memory_order success, memory_order failure);
5237-bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_ulong *object, ulong *expected,
5238- ulong desired, memory_order success, memory_order failure, memory_scope scope);
5239-bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong *object, ulong *expected, ulong desired);
5240-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_ulong *object, ulong *expected,
5241- ulong desired, memory_order success, memory_order failure);
5242-bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_ulong *object, ulong *expected,
5243- ulong desired, memory_order success, memory_order failure, memory_scope scope);
5244+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
5245+bool __ovld
5246+atomic_compare_exchange_strong(volatile atomic_double __global *object,
5247+ double __global *expected, double desired);
5248+bool __ovld
5249+atomic_compare_exchange_strong(volatile atomic_double __local *object,
5250+ double __global *expected, double desired);
5251+bool __ovld
5252+atomic_compare_exchange_strong(volatile atomic_double __global *object,
5253+ double __local *expected, double desired);
5254+bool __ovld
5255+atomic_compare_exchange_strong(volatile atomic_double __local *object,
5256+ double __local *expected, double desired);
5257+bool __ovld
5258+atomic_compare_exchange_strong(volatile atomic_double __global *object,
5259+ double __private *expected, double desired);
5260+bool __ovld
5261+atomic_compare_exchange_strong(volatile atomic_double __local *object,
5262+ double __private *expected, double desired);
5263+bool __ovld
5264+atomic_compare_exchange_weak(volatile atomic_double __global *object,
5265+ double __global *expected, double desired);
5266+bool __ovld atomic_compare_exchange_weak(volatile atomic_double __local *object,
5267+ double __global *expected,
5268+ double desired);
5269+bool __ovld
5270+atomic_compare_exchange_weak(volatile atomic_double __global *object,
5271+ double __local *expected, double desired);
5272+bool __ovld atomic_compare_exchange_weak(volatile atomic_double __local *object,
5273+ double __local *expected,
5274+ double desired);
5275+bool __ovld
5276+atomic_compare_exchange_weak(volatile atomic_double __global *object,
5277+ double __private *expected, double desired);
5278+bool __ovld atomic_compare_exchange_weak(volatile atomic_double __local *object,
5279+ double __private *expected,
5280+ double desired);
5281 #endif
5282+bool __ovld
5283+atomic_compare_exchange_strong(volatile atomic_long __global *object,
5284+ long __global *expected, long desired);
5285+bool __ovld atomic_compare_exchange_strong(volatile atomic_long __local *object,
5286+ long __global *expected,
5287+ long desired);
5288+bool __ovld
5289+atomic_compare_exchange_strong(volatile atomic_long __global *object,
5290+ long __local *expected, long desired);
5291+bool __ovld atomic_compare_exchange_strong(volatile atomic_long __local *object,
5292+ long __local *expected,
5293+ long desired);
5294+bool __ovld
5295+atomic_compare_exchange_strong(volatile atomic_long __global *object,
5296+ long __private *expected, long desired);
5297+bool __ovld atomic_compare_exchange_strong(volatile atomic_long __local *object,
5298+ long __private *expected,
5299+ long desired);
5300+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __global *object,
5301+ long __global *expected, long desired);
5302+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __local *object,
5303+ long __global *expected, long desired);
5304+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __global *object,
5305+ long __local *expected, long desired);
5306+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __local *object,
5307+ long __local *expected, long desired);
5308+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __global *object,
5309+ long __private *expected,
5310+ long desired);
5311+bool __ovld atomic_compare_exchange_weak(volatile atomic_long __local *object,
5312+ long __private *expected,
5313+ long desired);
5314+bool __ovld
5315+atomic_compare_exchange_strong(volatile atomic_ulong __global *object,
5316+ ulong __global *expected, ulong desired);
5317+bool __ovld
5318+atomic_compare_exchange_strong(volatile atomic_ulong __local *object,
5319+ ulong __global *expected, ulong desired);
5320+bool __ovld
5321+atomic_compare_exchange_strong(volatile atomic_ulong __global *object,
5322+ ulong __local *expected, ulong desired);
5323+bool __ovld
5324+atomic_compare_exchange_strong(volatile atomic_ulong __local *object,
5325+ ulong __local *expected, ulong desired);
5326+bool __ovld
5327+atomic_compare_exchange_strong(volatile atomic_ulong __global *object,
5328+ ulong __private *expected, ulong desired);
5329+bool __ovld
5330+atomic_compare_exchange_strong(volatile atomic_ulong __local *object,
5331+ ulong __private *expected, ulong desired);
5332+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __global *object,
5333+ ulong __global *expected,
5334+ ulong desired);
5335+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __local *object,
5336+ ulong __global *expected,
5337+ ulong desired);
5338+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __global *object,
5339+ ulong __local *expected,
5340+ ulong desired);
5341+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __local *object,
5342+ ulong __local *expected,
5343+ ulong desired);
5344+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __global *object,
5345+ ulong __private *expected,
5346+ ulong desired);
5347+bool __ovld atomic_compare_exchange_weak(volatile atomic_ulong __local *object,
5348+ ulong __private *expected,
5349+ ulong desired);
5350+#endif // defined(cl_khr_int64_base_atomics) &&
5351+ // defined(cl_khr_int64_extended_atomics)
5352+#endif // defined(__opencl_c_atomic_scope_device) &&
5353+ // defined(__opencl_c_atomic_order_seq_cst)
5354+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
5355+
5356+#ifdef __opencl_c_generic_address_space
5357+#ifdef __opencl_c_atomic_scope_device
5358+bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object,
5359+ int *expected, int desired,
5360+ memory_order success,
5361+ memory_order failure);
5362+bool __ovld atomic_compare_exchange_strong_explicit(
5363+ volatile atomic_uint *object, uint *expected, uint desired,
5364+ memory_order success, memory_order failure);
5365+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object,
5366+ int *expected, int desired,
5367+ memory_order success,
5368+ memory_order failure);
5369+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object,
5370+ uint *expected, uint desired,
5371+ memory_order success,
5372+ memory_order failure);
5373+bool __ovld atomic_compare_exchange_strong_explicit(
5374+ volatile atomic_float *object, float *expected, float desired,
5375+ memory_order success, memory_order failure);
5376+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_float *object,
5377+ float *expected,
5378+ float desired,
5379+ memory_order success,
5380+ memory_order failure);
5381+#endif // __opencl_c_atomic_scope_device
5382+bool __ovld atomic_compare_exchange_strong_explicit(volatile atomic_int *object,
5383+ int *expected, int desired,
5384+ memory_order success,
5385+ memory_order failure,
5386+ memory_scope scope);
5387+bool __ovld atomic_compare_exchange_strong_explicit(
5388+ volatile atomic_uint *object, uint *expected, uint desired,
5389+ memory_order success, memory_order failure, memory_scope scope);
5390+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_int *object,
5391+ int *expected, int desired,
5392+ memory_order success,
5393+ memory_order failure,
5394+ memory_scope scope);
5395+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_uint *object,
5396+ uint *expected, uint desired,
5397+ memory_order success,
5398+ memory_order failure,
5399+ memory_scope scope);
5400+bool __ovld atomic_compare_exchange_strong_explicit(
5401+ volatile atomic_float *object, float *expected, float desired,
5402+ memory_order success, memory_order failure, memory_scope scope);
5403+bool __ovld atomic_compare_exchange_weak_explicit(
5404+ volatile atomic_float *object, float *expected, float desired,
5405+ memory_order success, memory_order failure, memory_scope scope);
5406+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
5407+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
5408+#ifdef __opencl_c_atomic_scope_device
5409+bool __ovld atomic_compare_exchange_strong_explicit(
5410+ volatile atomic_double *object, double *expected, double desired,
5411+ memory_order success, memory_order failure);
5412+bool __ovld atomic_compare_exchange_weak_explicit(
5413+ volatile atomic_double *object, double *expected, double desired,
5414+ memory_order success, memory_order failure);
5415+#endif // __opencl_c_atomic_scope_device
5416+bool __ovld atomic_compare_exchange_strong_explicit(
5417+ volatile atomic_double *object, double *expected, double desired,
5418+ memory_order success, memory_order failure, memory_scope scope);
5419+bool __ovld atomic_compare_exchange_weak_explicit(
5420+ volatile atomic_double *object, double *expected, double desired,
5421+ memory_order success, memory_order failure, memory_scope scope);
5422+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
5423+#ifdef __opencl_c_atomic_scope_device
5424+bool __ovld atomic_compare_exchange_strong_explicit(
5425+ volatile atomic_long *object, long *expected, long desired,
5426+ memory_order success, memory_order failure);
5427+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object,
5428+ long *expected, long desired,
5429+ memory_order success,
5430+ memory_order failure);
5431+bool __ovld atomic_compare_exchange_strong_explicit(
5432+ volatile atomic_ulong *object, ulong *expected, ulong desired,
5433+ memory_order success, memory_order failure);
5434+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_ulong *object,
5435+ ulong *expected,
5436+ ulong desired,
5437+ memory_order success,
5438+ memory_order failure);
5439+#endif // __opencl_c_atomic_scope_device
5440+bool __ovld atomic_compare_exchange_strong_explicit(
5441+ volatile atomic_long *object, long *expected, long desired,
5442+ memory_order success, memory_order failure, memory_scope scope);
5443+bool __ovld atomic_compare_exchange_weak_explicit(volatile atomic_long *object,
5444+ long *expected, long desired,
5445+ memory_order success,
5446+ memory_order failure,
5447+ memory_scope scope);
5448+bool __ovld atomic_compare_exchange_strong_explicit(
5449+ volatile atomic_ulong *object, ulong *expected, ulong desired,
5450+ memory_order success, memory_order failure, memory_scope scope);
5451+bool __ovld atomic_compare_exchange_weak_explicit(
5452+ volatile atomic_ulong *object, ulong *expected, ulong desired,
5453+ memory_order success, memory_order failure, memory_scope scope);
5454+#endif // defined(cl_khr_int64_base_atomics) &&
5455+ // defined(cl_khr_int64_extended_atomics)
5456+#endif // __opencl_c_generic_address_space
5457+
5458+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
5459+#ifdef __opencl_c_atomic_scope_device
5460+bool __ovld atomic_compare_exchange_strong_explicit(
5461+ volatile atomic_int __global *object, int __global *expected, int desired,
5462+ memory_order success, memory_order failure);
5463+bool __ovld atomic_compare_exchange_strong_explicit(
5464+ volatile atomic_int __local *object, int __global *expected, int desired,
5465+ memory_order success, memory_order failure);
5466+bool __ovld atomic_compare_exchange_strong_explicit(
5467+ volatile atomic_int __global *object, int __local *expected, int desired,
5468+ memory_order success, memory_order failure);
5469+bool __ovld atomic_compare_exchange_strong_explicit(
5470+ volatile atomic_int __local *object, int __local *expected, int desired,
5471+ memory_order success, memory_order failure);
5472+bool __ovld atomic_compare_exchange_strong_explicit(
5473+ volatile atomic_int __global *object, int __private *expected, int desired,
5474+ memory_order success, memory_order failure);
5475+bool __ovld atomic_compare_exchange_strong_explicit(
5476+ volatile atomic_int __local *object, int __private *expected, int desired,
5477+ memory_order success, memory_order failure);
5478+bool __ovld atomic_compare_exchange_strong_explicit(
5479+ volatile atomic_uint __global *object, uint __global *expected,
5480+ uint desired, memory_order success, memory_order failure);
5481+bool __ovld atomic_compare_exchange_strong_explicit(
5482+ volatile atomic_uint __local *object, uint __global *expected, uint desired,
5483+ memory_order success, memory_order failure);
5484+bool __ovld atomic_compare_exchange_strong_explicit(
5485+ volatile atomic_uint __global *object, uint __local *expected, uint desired,
5486+ memory_order success, memory_order failure);
5487+bool __ovld atomic_compare_exchange_strong_explicit(
5488+ volatile atomic_uint __local *object, uint __local *expected, uint desired,
5489+ memory_order success, memory_order failure);
5490+bool __ovld atomic_compare_exchange_strong_explicit(
5491+ volatile atomic_uint __global *object, uint __private *expected,
5492+ uint desired, memory_order success, memory_order failure);
5493+bool __ovld atomic_compare_exchange_strong_explicit(
5494+ volatile atomic_uint __local *object, uint __private *expected,
5495+ uint desired, memory_order success, memory_order failure);
5496+bool __ovld atomic_compare_exchange_weak_explicit(
5497+ volatile atomic_int __global *object, int __global *expected, int desired,
5498+ memory_order success, memory_order failure);
5499+bool __ovld atomic_compare_exchange_weak_explicit(
5500+ volatile atomic_int __local *object, int __global *expected, int desired,
5501+ memory_order success, memory_order failure);
5502+bool __ovld atomic_compare_exchange_weak_explicit(
5503+ volatile atomic_int __global *object, int __local *expected, int desired,
5504+ memory_order success, memory_order failure);
5505+bool __ovld atomic_compare_exchange_weak_explicit(
5506+ volatile atomic_int __local *object, int __local *expected, int desired,
5507+ memory_order success, memory_order failure);
5508+bool __ovld atomic_compare_exchange_weak_explicit(
5509+ volatile atomic_int __global *object, int __private *expected, int desired,
5510+ memory_order success, memory_order failure);
5511+bool __ovld atomic_compare_exchange_weak_explicit(
5512+ volatile atomic_int __local *object, int __private *expected, int desired,
5513+ memory_order success, memory_order failure);
5514+bool __ovld atomic_compare_exchange_weak_explicit(
5515+ volatile atomic_uint __global *object, uint __global *expected,
5516+ uint desired, memory_order success, memory_order failure);
5517+bool __ovld atomic_compare_exchange_weak_explicit(
5518+ volatile atomic_uint __local *object, uint __global *expected, uint desired,
5519+ memory_order success, memory_order failure);
5520+bool __ovld atomic_compare_exchange_weak_explicit(
5521+ volatile atomic_uint __global *object, uint __local *expected, uint desired,
5522+ memory_order success, memory_order failure);
5523+bool __ovld atomic_compare_exchange_weak_explicit(
5524+ volatile atomic_uint __local *object, uint __local *expected, uint desired,
5525+ memory_order success, memory_order failure);
5526+bool __ovld atomic_compare_exchange_weak_explicit(
5527+ volatile atomic_uint __global *object, uint __private *expected,
5528+ uint desired, memory_order success, memory_order failure);
5529+bool __ovld atomic_compare_exchange_weak_explicit(
5530+ volatile atomic_uint __local *object, uint __private *expected,
5531+ uint desired, memory_order success, memory_order failure);
5532+bool __ovld atomic_compare_exchange_strong_explicit(
5533+ volatile atomic_float __global *object, float __global *expected,
5534+ float desired, memory_order success, memory_order failure);
5535+bool __ovld atomic_compare_exchange_strong_explicit(
5536+ volatile atomic_float __local *object, float __global *expected,
5537+ float desired, memory_order success, memory_order failure);
5538+bool __ovld atomic_compare_exchange_strong_explicit(
5539+ volatile atomic_float __global *object, float __local *expected,
5540+ float desired, memory_order success, memory_order failure);
5541+bool __ovld atomic_compare_exchange_strong_explicit(
5542+ volatile atomic_float __local *object, float __local *expected,
5543+ float desired, memory_order success, memory_order failure);
5544+bool __ovld atomic_compare_exchange_strong_explicit(
5545+ volatile atomic_float __global *object, float __private *expected,
5546+ float desired, memory_order success, memory_order failure);
5547+bool __ovld atomic_compare_exchange_strong_explicit(
5548+ volatile atomic_float __local *object, float __private *expected,
5549+ float desired, memory_order success, memory_order failure);
5550+bool __ovld atomic_compare_exchange_weak_explicit(
5551+ volatile atomic_float __global *object, float __global *expected,
5552+ float desired, memory_order success, memory_order failure);
5553+bool __ovld atomic_compare_exchange_weak_explicit(
5554+ volatile atomic_float __local *object, float __global *expected,
5555+ float desired, memory_order success, memory_order failure);
5556+bool __ovld atomic_compare_exchange_weak_explicit(
5557+ volatile atomic_float __global *object, float __local *expected,
5558+ float desired, memory_order success, memory_order failure);
5559+bool __ovld atomic_compare_exchange_weak_explicit(
5560+ volatile atomic_float __local *object, float __local *expected,
5561+ float desired, memory_order success, memory_order failure);
5562+bool __ovld atomic_compare_exchange_weak_explicit(
5563+ volatile atomic_float __global *object, float __private *expected,
5564+ float desired, memory_order success, memory_order failure);
5565+bool __ovld atomic_compare_exchange_weak_explicit(
5566+ volatile atomic_float __local *object, float __private *expected,
5567+ float desired, memory_order success, memory_order failure);
5568+#endif // __opencl_c_atomic_scope_device
5569+bool __ovld atomic_compare_exchange_strong_explicit(
5570+ volatile atomic_int __global *object, int __global *expected, int desired,
5571+ memory_order success, memory_order failure, memory_scope scope);
5572+bool __ovld atomic_compare_exchange_strong_explicit(
5573+ volatile atomic_int __local *object, int __global *expected, int desired,
5574+ memory_order success, memory_order failure, memory_scope scope);
5575+bool __ovld atomic_compare_exchange_strong_explicit(
5576+ volatile atomic_int __global *object, int __local *expected, int desired,
5577+ memory_order success, memory_order failure, memory_scope scope);
5578+bool __ovld atomic_compare_exchange_strong_explicit(
5579+ volatile atomic_int __local *object, int __local *expected, int desired,
5580+ memory_order success, memory_order failure, memory_scope scope);
5581+bool __ovld atomic_compare_exchange_strong_explicit(
5582+ volatile atomic_int __global *object, int __private *expected, int desired,
5583+ memory_order success, memory_order failure, memory_scope scope);
5584+bool __ovld atomic_compare_exchange_strong_explicit(
5585+ volatile atomic_int __local *object, int __private *expected, int desired,
5586+ memory_order success, memory_order failure, memory_scope scope);
5587+bool __ovld atomic_compare_exchange_strong_explicit(
5588+ volatile atomic_uint __global *object, uint __global *expected,
5589+ uint desired, memory_order success, memory_order failure,
5590+ memory_scope scope);
5591+bool __ovld atomic_compare_exchange_strong_explicit(
5592+ volatile atomic_uint __local *object, uint __global *expected, uint desired,
5593+ memory_order success, memory_order failure, memory_scope scope);
5594+bool __ovld atomic_compare_exchange_strong_explicit(
5595+ volatile atomic_uint __global *object, uint __local *expected, uint desired,
5596+ memory_order success, memory_order failure, memory_scope scope);
5597+bool __ovld atomic_compare_exchange_strong_explicit(
5598+ volatile atomic_uint __local *object, uint __local *expected, uint desired,
5599+ memory_order success, memory_order failure, memory_scope scope);
5600+bool __ovld atomic_compare_exchange_strong_explicit(
5601+ volatile atomic_uint __global *object, uint __private *expected,
5602+ uint desired, memory_order success, memory_order failure,
5603+ memory_scope scope);
5604+bool __ovld atomic_compare_exchange_strong_explicit(
5605+ volatile atomic_uint __local *object, uint __private *expected,
5606+ uint desired, memory_order success, memory_order failure,
5607+ memory_scope scope);
5608+bool __ovld atomic_compare_exchange_weak_explicit(
5609+ volatile atomic_int __global *object, int __global *expected, int desired,
5610+ memory_order success, memory_order failure, memory_scope scope);
5611+bool __ovld atomic_compare_exchange_weak_explicit(
5612+ volatile atomic_int __local *object, int __global *expected, int desired,
5613+ memory_order success, memory_order failure, memory_scope scope);
5614+bool __ovld atomic_compare_exchange_weak_explicit(
5615+ volatile atomic_int __global *object, int __local *expected, int desired,
5616+ memory_order success, memory_order failure, memory_scope scope);
5617+bool __ovld atomic_compare_exchange_weak_explicit(
5618+ volatile atomic_int __local *object, int __local *expected, int desired,
5619+ memory_order success, memory_order failure, memory_scope scope);
5620+bool __ovld atomic_compare_exchange_weak_explicit(
5621+ volatile atomic_int __global *object, int __private *expected, int desired,
5622+ memory_order success, memory_order failure, memory_scope scope);
5623+bool __ovld atomic_compare_exchange_weak_explicit(
5624+ volatile atomic_int __local *object, int __private *expected, int desired,
5625+ memory_order success, memory_order failure, memory_scope scope);
5626+bool __ovld atomic_compare_exchange_weak_explicit(
5627+ volatile atomic_uint __global *object, uint __global *expected,
5628+ uint desired, memory_order success, memory_order failure,
5629+ memory_scope scope);
5630+bool __ovld atomic_compare_exchange_weak_explicit(
5631+ volatile atomic_uint __local *object, uint __global *expected, uint desired,
5632+ memory_order success, memory_order failure, memory_scope scope);
5633+bool __ovld atomic_compare_exchange_weak_explicit(
5634+ volatile atomic_uint __global *object, uint __local *expected, uint desired,
5635+ memory_order success, memory_order failure, memory_scope scope);
5636+bool __ovld atomic_compare_exchange_weak_explicit(
5637+ volatile atomic_uint __local *object, uint __local *expected, uint desired,
5638+ memory_order success, memory_order failure, memory_scope scope);
5639+bool __ovld atomic_compare_exchange_weak_explicit(
5640+ volatile atomic_uint __global *object, uint __private *expected,
5641+ uint desired, memory_order success, memory_order failure,
5642+ memory_scope scope);
5643+bool __ovld atomic_compare_exchange_weak_explicit(
5644+ volatile atomic_uint __local *object, uint __private *expected,
5645+ uint desired, memory_order success, memory_order failure,
5646+ memory_scope scope);
5647+bool __ovld atomic_compare_exchange_strong_explicit(
5648+ volatile atomic_float __global *object, float __global *expected,
5649+ float desired, memory_order success, memory_order failure,
5650+ memory_scope scope);
5651+bool __ovld atomic_compare_exchange_strong_explicit(
5652+ volatile atomic_float __local *object, float __global *expected,
5653+ float desired, memory_order success, memory_order failure,
5654+ memory_scope scope);
5655+bool __ovld atomic_compare_exchange_strong_explicit(
5656+ volatile atomic_float __global *object, float __local *expected,
5657+ float desired, memory_order success, memory_order failure,
5658+ memory_scope scope);
5659+bool __ovld atomic_compare_exchange_strong_explicit(
5660+ volatile atomic_float __local *object, float __local *expected,
5661+ float desired, memory_order success, memory_order failure,
5662+ memory_scope scope);
5663+bool __ovld atomic_compare_exchange_strong_explicit(
5664+ volatile atomic_float __global *object, float __private *expected,
5665+ float desired, memory_order success, memory_order failure,
5666+ memory_scope scope);
5667+bool __ovld atomic_compare_exchange_strong_explicit(
5668+ volatile atomic_float __local *object, float __private *expected,
5669+ float desired, memory_order success, memory_order failure,
5670+ memory_scope scope);
5671+bool __ovld atomic_compare_exchange_weak_explicit(
5672+ volatile atomic_float __global *object, float __global *expected,
5673+ float desired, memory_order success, memory_order failure,
5674+ memory_scope scope);
5675+bool __ovld atomic_compare_exchange_weak_explicit(
5676+ volatile atomic_float __local *object, float __global *expected,
5677+ float desired, memory_order success, memory_order failure,
5678+ memory_scope scope);
5679+bool __ovld atomic_compare_exchange_weak_explicit(
5680+ volatile atomic_float __global *object, float __local *expected,
5681+ float desired, memory_order success, memory_order failure,
5682+ memory_scope scope);
5683+bool __ovld atomic_compare_exchange_weak_explicit(
5684+ volatile atomic_float __local *object, float __local *expected,
5685+ float desired, memory_order success, memory_order failure,
5686+ memory_scope scope);
5687+bool __ovld atomic_compare_exchange_weak_explicit(
5688+ volatile atomic_float __global *object, float __private *expected,
5689+ float desired, memory_order success, memory_order failure,
5690+ memory_scope scope);
5691+bool __ovld atomic_compare_exchange_weak_explicit(
5692+ volatile atomic_float __local *object, float __private *expected,
5693+ float desired, memory_order success, memory_order failure,
5694+ memory_scope scope);
5695+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
5696+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
5697+#ifdef __opencl_c_atomic_scope_device
5698+bool __ovld atomic_compare_exchange_strong_explicit(
5699+ volatile atomic_double __global *object, double __global *expected,
5700+ double desired, memory_order success, memory_order failure);
5701+bool __ovld atomic_compare_exchange_strong_explicit(
5702+ volatile atomic_double __local *object, double __global *expected,
5703+ double desired, memory_order success, memory_order failure);
5704+bool __ovld atomic_compare_exchange_strong_explicit(
5705+ volatile atomic_double __global *object, double __local *expected,
5706+ double desired, memory_order success, memory_order failure);
5707+bool __ovld atomic_compare_exchange_strong_explicit(
5708+ volatile atomic_double __local *object, double __local *expected,
5709+ double desired, memory_order success, memory_order failure);
5710+bool __ovld atomic_compare_exchange_strong_explicit(
5711+ volatile atomic_double __global *object, double __private *expected,
5712+ double desired, memory_order success, memory_order failure);
5713+bool __ovld atomic_compare_exchange_strong_explicit(
5714+ volatile atomic_double __local *object, double __private *expected,
5715+ double desired, memory_order success, memory_order failure);
5716+bool __ovld atomic_compare_exchange_weak_explicit(
5717+ volatile atomic_double __global *object, double __global *expected,
5718+ double desired, memory_order success, memory_order failure);
5719+bool __ovld atomic_compare_exchange_weak_explicit(
5720+ volatile atomic_double __local *object, double __global *expected,
5721+ double desired, memory_order success, memory_order failure);
5722+bool __ovld atomic_compare_exchange_weak_explicit(
5723+ volatile atomic_double __global *object, double __local *expected,
5724+ double desired, memory_order success, memory_order failure);
5725+bool __ovld atomic_compare_exchange_weak_explicit(
5726+ volatile atomic_double __local *object, double __local *expected,
5727+ double desired, memory_order success, memory_order failure);
5728+bool __ovld atomic_compare_exchange_weak_explicit(
5729+ volatile atomic_double __global *object, double __private *expected,
5730+ double desired, memory_order success, memory_order failure);
5731+bool __ovld atomic_compare_exchange_weak_explicit(
5732+ volatile atomic_double __local *object, double __private *expected,
5733+ double desired, memory_order success, memory_order failure);
5734+#endif // __opencl_c_atomic_scope_device
5735+bool __ovld atomic_compare_exchange_strong_explicit(
5736+ volatile atomic_double __global *object, double __global *expected,
5737+ double desired, memory_order success, memory_order failure,
5738+ memory_scope scope);
5739+bool __ovld atomic_compare_exchange_strong_explicit(
5740+ volatile atomic_double __local *object, double __global *expected,
5741+ double desired, memory_order success, memory_order failure,
5742+ memory_scope scope);
5743+bool __ovld atomic_compare_exchange_strong_explicit(
5744+ volatile atomic_double __global *object, double __local *expected,
5745+ double desired, memory_order success, memory_order failure,
5746+ memory_scope scope);
5747+bool __ovld atomic_compare_exchange_strong_explicit(
5748+ volatile atomic_double __local *object, double __local *expected,
5749+ double desired, memory_order success, memory_order failure,
5750+ memory_scope scope);
5751+bool __ovld atomic_compare_exchange_strong_explicit(
5752+ volatile atomic_double __global *object, double __private *expected,
5753+ double desired, memory_order success, memory_order failure,
5754+ memory_scope scope);
5755+bool __ovld atomic_compare_exchange_strong_explicit(
5756+ volatile atomic_double __local *object, double __private *expected,
5757+ double desired, memory_order success, memory_order failure,
5758+ memory_scope scope);
5759+bool __ovld atomic_compare_exchange_weak_explicit(
5760+ volatile atomic_double __global *object, double __global *expected,
5761+ double desired, memory_order success, memory_order failure,
5762+ memory_scope scope);
5763+bool __ovld atomic_compare_exchange_weak_explicit(
5764+ volatile atomic_double __local *object, double __global *expected,
5765+ double desired, memory_order success, memory_order failure,
5766+ memory_scope scope);
5767+bool __ovld atomic_compare_exchange_weak_explicit(
5768+ volatile atomic_double __global *object, double __local *expected,
5769+ double desired, memory_order success, memory_order failure,
5770+ memory_scope scope);
5771+bool __ovld atomic_compare_exchange_weak_explicit(
5772+ volatile atomic_double __local *object, double __local *expected,
5773+ double desired, memory_order success, memory_order failure,
5774+ memory_scope scope);
5775+bool __ovld atomic_compare_exchange_weak_explicit(
5776+ volatile atomic_double __global *object, double __private *expected,
5777+ double desired, memory_order success, memory_order failure,
5778+ memory_scope scope);
5779+bool __ovld atomic_compare_exchange_weak_explicit(
5780+ volatile atomic_double __local *object, double __private *expected,
5781+ double desired, memory_order success, memory_order failure,
5782+ memory_scope scope);
5783+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
5784+#ifdef __opencl_c_atomic_scope_device
5785+bool __ovld atomic_compare_exchange_strong_explicit(
5786+ volatile atomic_long __global *object, long __global *expected,
5787+ long desired, memory_order success, memory_order failure);
5788+bool __ovld atomic_compare_exchange_strong_explicit(
5789+ volatile atomic_long __local *object, long __global *expected, long desired,
5790+ memory_order success, memory_order failure);
5791+bool __ovld atomic_compare_exchange_strong_explicit(
5792+ volatile atomic_long __global *object, long __local *expected, long desired,
5793+ memory_order success, memory_order failure);
5794+bool __ovld atomic_compare_exchange_strong_explicit(
5795+ volatile atomic_long __local *object, long __local *expected, long desired,
5796+ memory_order success, memory_order failure);
5797+bool __ovld atomic_compare_exchange_strong_explicit(
5798+ volatile atomic_long __global *object, long __private *expected,
5799+ long desired, memory_order success, memory_order failure);
5800+bool __ovld atomic_compare_exchange_strong_explicit(
5801+ volatile atomic_long __local *object, long __private *expected,
5802+ long desired, memory_order success, memory_order failure);
5803+bool __ovld atomic_compare_exchange_weak_explicit(
5804+ volatile atomic_long __global *object, long __global *expected,
5805+ long desired, memory_order success, memory_order failure);
5806+bool __ovld atomic_compare_exchange_weak_explicit(
5807+ volatile atomic_long __local *object, long __global *expected, long desired,
5808+ memory_order success, memory_order failure);
5809+bool __ovld atomic_compare_exchange_weak_explicit(
5810+ volatile atomic_long __global *object, long __local *expected, long desired,
5811+ memory_order success, memory_order failure);
5812+bool __ovld atomic_compare_exchange_weak_explicit(
5813+ volatile atomic_long __local *object, long __local *expected, long desired,
5814+ memory_order success, memory_order failure);
5815+bool __ovld atomic_compare_exchange_weak_explicit(
5816+ volatile atomic_long __global *object, long __private *expected,
5817+ long desired, memory_order success, memory_order failure);
5818+bool __ovld atomic_compare_exchange_weak_explicit(
5819+ volatile atomic_long __local *object, long __private *expected,
5820+ long desired, memory_order success, memory_order failure);
5821+bool __ovld atomic_compare_exchange_strong_explicit(
5822+ volatile atomic_ulong __global *object, ulong __global *expected,
5823+ ulong desired, memory_order success, memory_order failure);
5824+bool __ovld atomic_compare_exchange_strong_explicit(
5825+ volatile atomic_ulong __local *object, ulong __global *expected,
5826+ ulong desired, memory_order success, memory_order failure);
5827+bool __ovld atomic_compare_exchange_strong_explicit(
5828+ volatile atomic_ulong __global *object, ulong __local *expected,
5829+ ulong desired, memory_order success, memory_order failure);
5830+bool __ovld atomic_compare_exchange_strong_explicit(
5831+ volatile atomic_ulong __local *object, ulong __local *expected,
5832+ ulong desired, memory_order success, memory_order failure);
5833+bool __ovld atomic_compare_exchange_strong_explicit(
5834+ volatile atomic_ulong __global *object, ulong __private *expected,
5835+ ulong desired, memory_order success, memory_order failure);
5836+bool __ovld atomic_compare_exchange_strong_explicit(
5837+ volatile atomic_ulong __local *object, ulong __private *expected,
5838+ ulong desired, memory_order success, memory_order failure);
5839+bool __ovld atomic_compare_exchange_weak_explicit(
5840+ volatile atomic_ulong __global *object, ulong __global *expected,
5841+ ulong desired, memory_order success, memory_order failure);
5842+bool __ovld atomic_compare_exchange_weak_explicit(
5843+ volatile atomic_ulong __local *object, ulong __global *expected,
5844+ ulong desired, memory_order success, memory_order failure);
5845+bool __ovld atomic_compare_exchange_weak_explicit(
5846+ volatile atomic_ulong __global *object, ulong __local *expected,
5847+ ulong desired, memory_order success, memory_order failure);
5848+bool __ovld atomic_compare_exchange_weak_explicit(
5849+ volatile atomic_ulong __local *object, ulong __local *expected,
5850+ ulong desired, memory_order success, memory_order failure);
5851+bool __ovld atomic_compare_exchange_weak_explicit(
5852+ volatile atomic_ulong __global *object, ulong __private *expected,
5853+ ulong desired, memory_order success, memory_order failure);
5854+bool __ovld atomic_compare_exchange_weak_explicit(
5855+ volatile atomic_ulong __local *object, ulong __private *expected,
5856+ ulong desired, memory_order success, memory_order failure);
5857+#endif // __opencl_c_atomic_scope_device
5858+bool __ovld atomic_compare_exchange_strong_explicit(
5859+ volatile atomic_long __global *object, long __global *expected,
5860+ long desired, memory_order success, memory_order failure,
5861+ memory_scope scope);
5862+bool __ovld atomic_compare_exchange_strong_explicit(
5863+ volatile atomic_long __local *object, long __global *expected, long desired,
5864+ memory_order success, memory_order failure, memory_scope scope);
5865+bool __ovld atomic_compare_exchange_strong_explicit(
5866+ volatile atomic_long __global *object, long __local *expected, long desired,
5867+ memory_order success, memory_order failure, memory_scope scope);
5868+bool __ovld atomic_compare_exchange_strong_explicit(
5869+ volatile atomic_long __local *object, long __local *expected, long desired,
5870+ memory_order success, memory_order failure, memory_scope scope);
5871+bool __ovld atomic_compare_exchange_strong_explicit(
5872+ volatile atomic_long __global *object, long __private *expected,
5873+ long desired, memory_order success, memory_order failure,
5874+ memory_scope scope);
5875+bool __ovld atomic_compare_exchange_strong_explicit(
5876+ volatile atomic_long __local *object, long __private *expected,
5877+ long desired, memory_order success, memory_order failure,
5878+ memory_scope scope);
5879+bool __ovld atomic_compare_exchange_weak_explicit(
5880+ volatile atomic_long __global *object, long __global *expected,
5881+ long desired, memory_order success, memory_order failure,
5882+ memory_scope scope);
5883+bool __ovld atomic_compare_exchange_weak_explicit(
5884+ volatile atomic_long __local *object, long __global *expected, long desired,
5885+ memory_order success, memory_order failure, memory_scope scope);
5886+bool __ovld atomic_compare_exchange_weak_explicit(
5887+ volatile atomic_long __global *object, long __local *expected, long desired,
5888+ memory_order success, memory_order failure, memory_scope scope);
5889+bool __ovld atomic_compare_exchange_weak_explicit(
5890+ volatile atomic_long __local *object, long __local *expected, long desired,
5891+ memory_order success, memory_order failure, memory_scope scope);
5892+bool __ovld atomic_compare_exchange_weak_explicit(
5893+ volatile atomic_long __global *object, long __private *expected,
5894+ long desired, memory_order success, memory_order failure,
5895+ memory_scope scope);
5896+bool __ovld atomic_compare_exchange_weak_explicit(
5897+ volatile atomic_long __local *object, long __private *expected,
5898+ long desired, memory_order success, memory_order failure,
5899+ memory_scope scope);
5900+bool __ovld atomic_compare_exchange_strong_explicit(
5901+ volatile atomic_ulong __global *object, ulong __global *expected,
5902+ ulong desired, memory_order success, memory_order failure,
5903+ memory_scope scope);
5904+bool __ovld atomic_compare_exchange_strong_explicit(
5905+ volatile atomic_ulong __local *object, ulong __global *expected,
5906+ ulong desired, memory_order success, memory_order failure,
5907+ memory_scope scope);
5908+bool __ovld atomic_compare_exchange_strong_explicit(
5909+ volatile atomic_ulong __global *object, ulong __local *expected,
5910+ ulong desired, memory_order success, memory_order failure,
5911+ memory_scope scope);
5912+bool __ovld atomic_compare_exchange_strong_explicit(
5913+ volatile atomic_ulong __local *object, ulong __local *expected,
5914+ ulong desired, memory_order success, memory_order failure,
5915+ memory_scope scope);
5916+bool __ovld atomic_compare_exchange_strong_explicit(
5917+ volatile atomic_ulong __global *object, ulong __private *expected,
5918+ ulong desired, memory_order success, memory_order failure,
5919+ memory_scope scope);
5920+bool __ovld atomic_compare_exchange_strong_explicit(
5921+ volatile atomic_ulong __local *object, ulong __private *expected,
5922+ ulong desired, memory_order success, memory_order failure,
5923+ memory_scope scope);
5924+bool __ovld atomic_compare_exchange_weak_explicit(
5925+ volatile atomic_ulong __global *object, ulong __global *expected,
5926+ ulong desired, memory_order success, memory_order failure,
5927+ memory_scope scope);
5928+bool __ovld atomic_compare_exchange_weak_explicit(
5929+ volatile atomic_ulong __local *object, ulong __global *expected,
5930+ ulong desired, memory_order success, memory_order failure,
5931+ memory_scope scope);
5932+bool __ovld atomic_compare_exchange_weak_explicit(
5933+ volatile atomic_ulong __global *object, ulong __local *expected,
5934+ ulong desired, memory_order success, memory_order failure,
5935+ memory_scope scope);
5936+bool __ovld atomic_compare_exchange_weak_explicit(
5937+ volatile atomic_ulong __local *object, ulong __local *expected,
5938+ ulong desired, memory_order success, memory_order failure,
5939+ memory_scope scope);
5940+bool __ovld atomic_compare_exchange_weak_explicit(
5941+ volatile atomic_ulong __global *object, ulong __private *expected,
5942+ ulong desired, memory_order success, memory_order failure,
5943+ memory_scope scope);
5944+bool __ovld atomic_compare_exchange_weak_explicit(
5945+ volatile atomic_ulong __local *object, ulong __private *expected,
5946+ ulong desired, memory_order success, memory_order failure,
5947+ memory_scope scope);
5948+#endif // defined(cl_khr_int64_base_atomics) &&
5949+ // defined(cl_khr_int64_extended_atomics)
5950+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
5951
5952 // atomic_flag_test_and_set() and atomic_flag_clear()
5953-
5954+#if defined(__opencl_c_atomic_scope_device) && \
5955+ defined(__opencl_c_atomic_order_seq_cst)
5956+#ifdef __opencl_c_generic_address_space
5957 bool __ovld atomic_flag_test_and_set(volatile atomic_flag *object);
5958-bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object, memory_order order);
5959-bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object, memory_order order, memory_scope scope);
5960 void __ovld atomic_flag_clear(volatile atomic_flag *object);
5961-void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object, memory_order order);
5962-void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object, memory_order order, memory_scope scope);
5963+#endif // __opencl_c_generic_address_space
5964+
5965+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
5966+bool __ovld atomic_flag_test_and_set(volatile atomic_flag __global *object);
5967+bool __ovld atomic_flag_test_and_set(volatile atomic_flag __local *object);
5968+void __ovld atomic_flag_clear(volatile atomic_flag __global *object);
5969+void __ovld atomic_flag_clear(volatile atomic_flag __local *object);
5970+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
5971+#endif // defined(__opencl_c_atomic_scope_device) &&
5972+ // defined(__opencl_c_atomic_order_seq_cst)
5973+
5974+#ifdef __opencl_c_generic_address_space
5975+#ifdef __opencl_c_atomic_scope_device
5976+bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object,
5977+ memory_order order);
5978+void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object,
5979+ memory_order order);
5980+#endif // __opencl_c_atomic_scope_device
5981+bool __ovld atomic_flag_test_and_set_explicit(volatile atomic_flag *object,
5982+ memory_order order,
5983+ memory_scope scope);
5984+void __ovld atomic_flag_clear_explicit(volatile atomic_flag *object,
5985+ memory_order order, memory_scope scope);
5986+#endif // __opencl_c_generic_address_space
5987+
5988+#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
5989+#ifdef __opencl_c_atomic_scope_device
5990+bool __ovld atomic_flag_test_and_set_explicit(
5991+ volatile atomic_flag __global *object, memory_order order);
5992+bool __ovld atomic_flag_test_and_set_explicit(
5993+ volatile atomic_flag __local *object, memory_order order);
5994+void __ovld atomic_flag_clear_explicit(volatile atomic_flag __global *object,
5995+ memory_order order);
5996+void __ovld atomic_flag_clear_explicit(volatile atomic_flag __local *object,
5997+ memory_order order);
5998+#endif // __opencl_c_atomic_scope_device
5999+bool __ovld
6000+atomic_flag_test_and_set_explicit(volatile atomic_flag __global *object,
6001+ memory_order order, memory_scope scope);
6002+bool __ovld
6003+atomic_flag_test_and_set_explicit(volatile atomic_flag __local *object,
6004+ memory_order order, memory_scope scope);
6005+void __ovld atomic_flag_clear_explicit(volatile atomic_flag __global *object,
6006+ memory_order order, memory_scope scope);
6007+void __ovld atomic_flag_clear_explicit(volatile atomic_flag __local *object,
6008+ memory_order order, memory_scope scope);
6009+#endif // (__OPENCL_C_VERSION__ >= CL_VERSION_3_0)
6010
6011 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6012
6013@@ -13906,7 +15943,7 @@ float16 __ovld __cnfn shuffle(float4 x, uint16 mask);
6014 float16 __ovld __cnfn shuffle(float8 x, uint16 mask);
6015 float16 __ovld __cnfn shuffle(float16 x, uint16 mask);
6016
6017-#ifdef cl_khr_fp64
6018+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6019 double2 __ovld __cnfn shuffle(double2 x, ulong2 mask);
6020 double2 __ovld __cnfn shuffle(double4 x, ulong2 mask);
6021 double2 __ovld __cnfn shuffle(double8 x, ulong2 mask);
6022@@ -13926,7 +15963,7 @@ double16 __ovld __cnfn shuffle(double2 x, ulong16 mask);
6023 double16 __ovld __cnfn shuffle(double4 x, ulong16 mask);
6024 double16 __ovld __cnfn shuffle(double8 x, ulong16 mask);
6025 double16 __ovld __cnfn shuffle(double16 x, ulong16 mask);
6026-#endif //cl_khr_fp64
6027+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6028
6029 #ifdef cl_khr_fp16
6030 half2 __ovld __cnfn shuffle(half2 x, ushort2 mask);
6031@@ -14130,7 +16167,7 @@ float16 __ovld __cnfn shuffle2(float4 x, float4 y, uint16 mask);
6032 float16 __ovld __cnfn shuffle2(float8 x, float8 y, uint16 mask);
6033 float16 __ovld __cnfn shuffle2(float16 x, float16 y, uint16 mask);
6034
6035-#ifdef cl_khr_fp64
6036+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6037 double2 __ovld __cnfn shuffle2(double2 x, double2 y, ulong2 mask);
6038 double2 __ovld __cnfn shuffle2(double4 x, double4 y, ulong2 mask);
6039 double2 __ovld __cnfn shuffle2(double8 x, double8 y, ulong2 mask);
6040@@ -14150,7 +16187,7 @@ double16 __ovld __cnfn shuffle2(double2 x, double2 y, ulong16 mask);
6041 double16 __ovld __cnfn shuffle2(double4 x, double4 y, ulong16 mask);
6042 double16 __ovld __cnfn shuffle2(double8 x, double8 y, ulong16 mask);
6043 double16 __ovld __cnfn shuffle2(double16 x, double16 y, ulong16 mask);
6044-#endif //cl_khr_fp64
6045+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6046
6047 #ifdef cl_khr_fp16
6048 half2 __ovld __cnfn shuffle2(half2 x, half2 y, ushort2 mask);
6049@@ -14186,6 +16223,7 @@ int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2)))
6050 #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable
6051 #endif //cl_khr_gl_msaa_sharing
6052
6053+#ifdef __opencl_c_images
6054 /**
6055 * Use the coordinate (coord.xy) to do an element lookup in
6056 * the 2D image object specified by image.
6057@@ -14464,6 +16502,7 @@ half4 __purefn __ovld read_imageh(read_only image1d_buffer_t image, int coord);
6058
6059 // Image read functions for read_write images
6060 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6061+#ifdef __opencl_c_read_write_images
6062 float4 __purefn __ovld read_imagef(read_write image1d_t image, int coord);
6063 int4 __purefn __ovld read_imagei(read_write image1d_t image, int coord);
6064 uint4 __purefn __ovld read_imageui(read_write image1d_t image, int coord);
6065@@ -14507,6 +16546,7 @@ float __purefn __ovld read_imagef(read_write image2d_array_msaa_depth_t image, i
6066 #endif //cl_khr_gl_msaa_sharing
6067
6068 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6069+#ifdef __opencl_c_read_write_images
6070 #ifdef cl_khr_mipmap_image
6071 float4 __purefn __ovld read_imagef(read_write image1d_t image, sampler_t sampler, float coord, float lod);
6072 int4 __purefn __ovld read_imagei(read_write image1d_t image, sampler_t sampler, float coord, float lod);
6073@@ -14557,6 +16597,7 @@ int4 __purefn __ovld read_imagei(read_write image3d_t image, sampler_t sampler,
6074 uint4 __purefn __ovld read_imageui(read_write image3d_t image, sampler_t sampler, float4 coord, float4 gradientX, float4 gradientY);
6075
6076 #endif //cl_khr_mipmap_image
6077+#endif //__opencl_c_read_write_images
6078 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6079
6080 // Image read functions returning half4 type
6081@@ -14568,6 +16609,7 @@ half4 __purefn __ovld read_imageh(read_write image1d_array_t image, int2 coord);
6082 half4 __purefn __ovld read_imageh(read_write image2d_array_t image, int4 coord);
6083 half4 __purefn __ovld read_imageh(read_write image1d_buffer_t image, int coord);
6084 #endif //cl_khr_fp16
6085+#endif //__opencl_c_read_write_images
6086 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6087
6088 /**
6089@@ -14657,7 +16699,7 @@ void __ovld write_imagef(write_only image1d_array_t image_array, int2 coord, flo
6090 void __ovld write_imagei(write_only image1d_array_t image_array, int2 coord, int4 color);
6091 void __ovld write_imageui(write_only image1d_array_t image_array, int2 coord, uint4 color);
6092
6093-#ifdef cl_khr_3d_image_writes
6094+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6095 void __ovld write_imagef(write_only image3d_t image, int4 coord, float4 color);
6096 void __ovld write_imagei(write_only image3d_t image, int4 coord, int4 color);
6097 void __ovld write_imageui(write_only image3d_t image, int4 coord, uint4 color);
6098@@ -14690,7 +16732,7 @@ void __ovld write_imageui(write_only image2d_array_t image_array, int4 coord, in
6099 void __ovld write_imagef(write_only image2d_depth_t image, int2 coord, int lod, float depth);
6100 void __ovld write_imagef(write_only image2d_array_depth_t image, int4 coord, int lod, float depth);
6101
6102-#ifdef cl_khr_3d_image_writes
6103+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6104 void __ovld write_imagef(write_only image3d_t image, int4 coord, int lod, float4 color);
6105 void __ovld write_imagei(write_only image3d_t image, int4 coord, int lod, int4 color);
6106 void __ovld write_imageui(write_only image3d_t image, int4 coord, int lod, uint4 color);
6107@@ -14703,7 +16745,7 @@ void __ovld write_imageui(write_only image3d_t image, int4 coord, int lod, uint4
6108 #ifdef cl_khr_fp16
6109 void __ovld write_imageh(write_only image1d_t image, int coord, half4 color);
6110 void __ovld write_imageh(write_only image2d_t image, int2 coord, half4 color);
6111-#ifdef cl_khr_3d_image_writes
6112+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6113 void __ovld write_imageh(write_only image3d_t image, int4 coord, half4 color);
6114 #endif
6115 void __ovld write_imageh(write_only image1d_array_t image, int2 coord, half4 color);
6116@@ -14713,6 +16755,7 @@ void __ovld write_imageh(write_only image1d_buffer_t image, int coord, half4 col
6117
6118 // Image write functions for read_write images
6119 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6120+#ifdef __opencl_c_read_write_images
6121 void __ovld write_imagef(read_write image2d_t image, int2 coord, float4 color);
6122 void __ovld write_imagei(read_write image2d_t image, int2 coord, int4 color);
6123 void __ovld write_imageui(read_write image2d_t image, int2 coord, uint4 color);
6124@@ -14733,7 +16776,7 @@ void __ovld write_imagef(read_write image1d_array_t image_array, int2 coord, flo
6125 void __ovld write_imagei(read_write image1d_array_t image_array, int2 coord, int4 color);
6126 void __ovld write_imageui(read_write image1d_array_t image_array, int2 coord, uint4 color);
6127
6128-#ifdef cl_khr_3d_image_writes
6129+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6130 void __ovld write_imagef(read_write image3d_t image, int4 coord, float4 color);
6131 void __ovld write_imagei(read_write image3d_t image, int4 coord, int4 color);
6132 void __ovld write_imageui(read_write image3d_t image, int4 coord, uint4 color);
6133@@ -14765,7 +16808,7 @@ void __ovld write_imageui(read_write image2d_array_t image_array, int4 coord, in
6134 void __ovld write_imagef(read_write image2d_depth_t image, int2 coord, int lod, float color);
6135 void __ovld write_imagef(read_write image2d_array_depth_t image, int4 coord, int lod, float color);
6136
6137-#ifdef cl_khr_3d_image_writes
6138+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6139 void __ovld write_imagef(read_write image3d_t image, int4 coord, int lod, float4 color);
6140 void __ovld write_imagei(read_write image3d_t image, int4 coord, int lod, int4 color);
6141 void __ovld write_imageui(read_write image3d_t image, int4 coord, int lod, uint4 color);
6142@@ -14778,13 +16821,14 @@ void __ovld write_imageui(read_write image3d_t image, int4 coord, int lod, uint4
6143 #ifdef cl_khr_fp16
6144 void __ovld write_imageh(read_write image1d_t image, int coord, half4 color);
6145 void __ovld write_imageh(read_write image2d_t image, int2 coord, half4 color);
6146-#ifdef cl_khr_3d_image_writes
6147+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6148 void __ovld write_imageh(read_write image3d_t image, int4 coord, half4 color);
6149 #endif
6150 void __ovld write_imageh(read_write image1d_array_t image, int2 coord, half4 color);
6151 void __ovld write_imageh(read_write image2d_array_t image, int4 coord, half4 color);
6152 void __ovld write_imageh(read_write image1d_buffer_t image, int coord, half4 color);
6153 #endif //cl_khr_fp16
6154+#endif //__opencl_c_read_write_images
6155 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6156
6157 // Note: In OpenCL v1.0/1.1/1.2, image argument of image query builtin functions does not have
6158@@ -14798,7 +16842,7 @@ void __ovld write_imageh(read_write image1d_buffer_t image, int coord, half4 col
6159 int __ovld __cnfn get_image_width(read_only image1d_t image);
6160 int __ovld __cnfn get_image_width(read_only image1d_buffer_t image);
6161 int __ovld __cnfn get_image_width(read_only image2d_t image);
6162-#ifdef cl_khr_3d_image_writes
6163+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6164 int __ovld __cnfn get_image_width(read_only image3d_t image);
6165 #endif
6166 int __ovld __cnfn get_image_width(read_only image1d_array_t image);
6167@@ -14817,7 +16861,7 @@ int __ovld __cnfn get_image_width(read_only image2d_array_msaa_depth_t image);
6168 int __ovld __cnfn get_image_width(write_only image1d_t image);
6169 int __ovld __cnfn get_image_width(write_only image1d_buffer_t image);
6170 int __ovld __cnfn get_image_width(write_only image2d_t image);
6171-#ifdef cl_khr_3d_image_writes
6172+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6173 int __ovld __cnfn get_image_width(write_only image3d_t image);
6174 #endif
6175 int __ovld __cnfn get_image_width(write_only image1d_array_t image);
6176@@ -14834,6 +16878,7 @@ int __ovld __cnfn get_image_width(write_only image2d_array_msaa_depth_t image);
6177 #endif //cl_khr_gl_msaa_sharing
6178
6179 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6180+#ifdef __opencl_c_read_write_images
6181 int __ovld __cnfn get_image_width(read_write image1d_t image);
6182 int __ovld __cnfn get_image_width(read_write image1d_buffer_t image);
6183 int __ovld __cnfn get_image_width(read_write image2d_t image);
6184@@ -14850,6 +16895,7 @@ int __ovld __cnfn get_image_width(read_write image2d_msaa_depth_t image);
6185 int __ovld __cnfn get_image_width(read_write image2d_array_msaa_t image);
6186 int __ovld __cnfn get_image_width(read_write image2d_array_msaa_depth_t image);
6187 #endif //cl_khr_gl_msaa_sharing
6188+#endif //__opencl_c_read_write_images
6189 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6190
6191 /**
6192@@ -14870,7 +16916,7 @@ int __ovld __cnfn get_image_height(read_only image2d_array_msaa_depth_t image);
6193 #endif //cl_khr_gl_msaa_sharing
6194
6195 int __ovld __cnfn get_image_height(write_only image2d_t image);
6196-#ifdef cl_khr_3d_image_writes
6197+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6198 int __ovld __cnfn get_image_height(write_only image3d_t image);
6199 #endif
6200 int __ovld __cnfn get_image_height(write_only image2d_array_t image);
6201@@ -14886,6 +16932,7 @@ int __ovld __cnfn get_image_height(write_only image2d_array_msaa_depth_t image);
6202 #endif //cl_khr_gl_msaa_sharing
6203
6204 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6205+#ifdef __opencl_c_read_write_images
6206 int __ovld __cnfn get_image_height(read_write image2d_t image);
6207 int __ovld __cnfn get_image_height(read_write image3d_t image);
6208 int __ovld __cnfn get_image_height(read_write image2d_array_t image);
6209@@ -14899,6 +16946,7 @@ int __ovld __cnfn get_image_height(read_write image2d_msaa_depth_t image);
6210 int __ovld __cnfn get_image_height(read_write image2d_array_msaa_t image);
6211 int __ovld __cnfn get_image_height(read_write image2d_array_msaa_depth_t image);
6212 #endif //cl_khr_gl_msaa_sharing
6213+#endif //__opencl_c_read_write_images
6214 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6215
6216 /**
6217@@ -14906,12 +16954,14 @@ int __ovld __cnfn get_image_height(read_write image2d_array_msaa_depth_t image);
6218 */
6219 int __ovld __cnfn get_image_depth(read_only image3d_t image);
6220
6221-#ifdef cl_khr_3d_image_writes
6222+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6223 int __ovld __cnfn get_image_depth(write_only image3d_t image);
6224 #endif
6225
6226 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6227+#ifdef __opencl_c_read_write_images
6228 int __ovld __cnfn get_image_depth(read_write image3d_t image);
6229+#endif //__opencl_c_read_write_images
6230 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6231
6232 // OpenCL Extension v2.0 s9.18 - Mipmaps
6233@@ -14927,13 +16977,15 @@ int __ovld get_image_num_mip_levels(read_only image3d_t image);
6234
6235 int __ovld get_image_num_mip_levels(write_only image1d_t image);
6236 int __ovld get_image_num_mip_levels(write_only image2d_t image);
6237-#ifdef cl_khr_3d_image_writes
6238+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6239 int __ovld get_image_num_mip_levels(write_only image3d_t image);
6240 #endif
6241
6242+#ifdef __opencl_c_read_write_images
6243 int __ovld get_image_num_mip_levels(read_write image1d_t image);
6244 int __ovld get_image_num_mip_levels(read_write image2d_t image);
6245 int __ovld get_image_num_mip_levels(read_write image3d_t image);
6246+#endif //__opencl_c_read_write_images
6247
6248 int __ovld get_image_num_mip_levels(read_only image1d_array_t image);
6249 int __ovld get_image_num_mip_levels(read_only image2d_array_t image);
6250@@ -14945,10 +16997,12 @@ int __ovld get_image_num_mip_levels(write_only image2d_array_t image);
6251 int __ovld get_image_num_mip_levels(write_only image2d_array_depth_t image);
6252 int __ovld get_image_num_mip_levels(write_only image2d_depth_t image);
6253
6254+#ifdef __opencl_c_read_write_images
6255 int __ovld get_image_num_mip_levels(read_write image1d_array_t image);
6256 int __ovld get_image_num_mip_levels(read_write image2d_array_t image);
6257 int __ovld get_image_num_mip_levels(read_write image2d_array_depth_t image);
6258 int __ovld get_image_num_mip_levels(read_write image2d_depth_t image);
6259+#endif //__opencl_c_read_write_images
6260
6261 #endif //cl_khr_mipmap_image
6262 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6263@@ -14992,7 +17046,7 @@ int __ovld __cnfn get_image_channel_data_type(read_only image2d_array_msaa_depth
6264 int __ovld __cnfn get_image_channel_data_type(write_only image1d_t image);
6265 int __ovld __cnfn get_image_channel_data_type(write_only image1d_buffer_t image);
6266 int __ovld __cnfn get_image_channel_data_type(write_only image2d_t image);
6267-#ifdef cl_khr_3d_image_writes
6268+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6269 int __ovld __cnfn get_image_channel_data_type(write_only image3d_t image);
6270 #endif
6271 int __ovld __cnfn get_image_channel_data_type(write_only image1d_array_t image);
6272@@ -15009,6 +17063,7 @@ int __ovld __cnfn get_image_channel_data_type(write_only image2d_array_msaa_dept
6273 #endif //cl_khr_gl_msaa_sharing
6274
6275 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6276+#ifdef __opencl_c_read_write_images
6277 int __ovld __cnfn get_image_channel_data_type(read_write image1d_t image);
6278 int __ovld __cnfn get_image_channel_data_type(read_write image1d_buffer_t image);
6279 int __ovld __cnfn get_image_channel_data_type(read_write image2d_t image);
6280@@ -15025,6 +17080,7 @@ int __ovld __cnfn get_image_channel_data_type(read_write image2d_msaa_depth_t im
6281 int __ovld __cnfn get_image_channel_data_type(read_write image2d_array_msaa_t image);
6282 int __ovld __cnfn get_image_channel_data_type(read_write image2d_array_msaa_depth_t image);
6283 #endif //cl_khr_gl_msaa_sharing
6284+#endif //__opencl_c_read_write_images
6285 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6286
6287 /**
6288@@ -15064,7 +17120,7 @@ int __ovld __cnfn get_image_channel_order(read_only image2d_array_msaa_depth_t i
6289 int __ovld __cnfn get_image_channel_order(write_only image1d_t image);
6290 int __ovld __cnfn get_image_channel_order(write_only image1d_buffer_t image);
6291 int __ovld __cnfn get_image_channel_order(write_only image2d_t image);
6292-#ifdef cl_khr_3d_image_writes
6293+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6294 int __ovld __cnfn get_image_channel_order(write_only image3d_t image);
6295 #endif
6296 int __ovld __cnfn get_image_channel_order(write_only image1d_array_t image);
6297@@ -15081,6 +17137,7 @@ int __ovld __cnfn get_image_channel_order(write_only image2d_array_msaa_depth_t
6298 #endif //cl_khr_gl_msaa_sharing
6299
6300 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6301+#ifdef __opencl_c_read_write_images
6302 int __ovld __cnfn get_image_channel_order(read_write image1d_t image);
6303 int __ovld __cnfn get_image_channel_order(read_write image1d_buffer_t image);
6304 int __ovld __cnfn get_image_channel_order(read_write image2d_t image);
6305@@ -15097,6 +17154,7 @@ int __ovld __cnfn get_image_channel_order(read_write image2d_msaa_depth_t image)
6306 int __ovld __cnfn get_image_channel_order(read_write image2d_array_msaa_t image);
6307 int __ovld __cnfn get_image_channel_order(read_write image2d_array_msaa_depth_t image);
6308 #endif //cl_khr_gl_msaa_sharing
6309+#endif //__opencl_c_read_write_images
6310 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6311
6312 /**
6313@@ -15131,6 +17189,7 @@ int2 __ovld __cnfn get_image_dim(write_only image2d_array_msaa_depth_t image);
6314 #endif //cl_khr_gl_msaa_sharing
6315
6316 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6317+#ifdef __opencl_c_read_write_images
6318 int2 __ovld __cnfn get_image_dim(read_write image2d_t image);
6319 int2 __ovld __cnfn get_image_dim(read_write image2d_array_t image);
6320 #ifdef cl_khr_depth_images
6321@@ -15143,6 +17202,7 @@ int2 __ovld __cnfn get_image_dim(read_write image2d_msaa_depth_t image);
6322 int2 __ovld __cnfn get_image_dim(read_write image2d_array_msaa_t image);
6323 int2 __ovld __cnfn get_image_dim(read_write image2d_array_msaa_depth_t image);
6324 #endif //cl_khr_gl_msaa_sharing
6325+#endif //__opencl_c_read_write_images
6326 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6327
6328 /**
6329@@ -15152,11 +17212,13 @@ int2 __ovld __cnfn get_image_dim(read_write image2d_array_msaa_depth_t image);
6330 * component and the w component is 0.
6331 */
6332 int4 __ovld __cnfn get_image_dim(read_only image3d_t image);
6333-#ifdef cl_khr_3d_image_writes
6334+#if defined(cl_khr_3d_image_writes) || defined(__opencl_c_3d_image_writes)
6335 int4 __ovld __cnfn get_image_dim(write_only image3d_t image);
6336 #endif
6337 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6338+#ifdef __opencl_c_read_write_images
6339 int4 __ovld __cnfn get_image_dim(read_write image3d_t image);
6340+#endif //__opencl_c_read_write_images
6341 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6342
6343 /**
6344@@ -15184,6 +17246,7 @@ size_t __ovld __cnfn get_image_array_size(write_only image2d_array_msaa_depth_t
6345 #endif //cl_khr_gl_msaa_sharing
6346
6347 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6348+#ifdef __opencl_c_read_write_images
6349 size_t __ovld __cnfn get_image_array_size(read_write image1d_array_t image_array);
6350 size_t __ovld __cnfn get_image_array_size(read_write image2d_array_t image_array);
6351 #ifdef cl_khr_depth_images
6352@@ -15193,6 +17256,7 @@ size_t __ovld __cnfn get_image_array_size(read_write image2d_array_depth_t image
6353 size_t __ovld __cnfn get_image_array_size(read_write image2d_array_msaa_t image_array);
6354 size_t __ovld __cnfn get_image_array_size(read_write image2d_array_msaa_depth_t image_array);
6355 #endif //cl_khr_gl_msaa_sharing
6356+#endif //__opencl_c_read_write_images
6357 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6358
6359 /**
6360@@ -15210,16 +17274,21 @@ int __ovld get_image_num_samples(write_only image2d_array_msaa_t image);
6361 int __ovld get_image_num_samples(write_only image2d_array_msaa_depth_t image);
6362
6363 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6364+#ifdef __opencl_c_read_write_images
6365 int __ovld get_image_num_samples(read_write image2d_msaa_t image);
6366 int __ovld get_image_num_samples(read_write image2d_msaa_depth_t image);
6367 int __ovld get_image_num_samples(read_write image2d_array_msaa_t image);
6368 int __ovld get_image_num_samples(read_write image2d_array_msaa_depth_t image);
6369+#endif //__opencl_c_read_write_images
6370 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6371 #endif
6372
6373+#endif //__opencl_c_images
6374+
6375 // OpenCL v2.0 s6.13.15 - Work-group Functions
6376
6377 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6378+#ifdef __opencl_c_work_group_collective_functions
6379 int __ovld __conv work_group_all(int predicate);
6380 int __ovld __conv work_group_any(int predicate);
6381
6382@@ -15243,11 +17312,11 @@ ulong __ovld __conv work_group_broadcast(ulong a, size_t x, size_t y, size_t z);
6383 float __ovld __conv work_group_broadcast(float a, size_t local_id);
6384 float __ovld __conv work_group_broadcast(float a, size_t x, size_t y);
6385 float __ovld __conv work_group_broadcast(float a, size_t x, size_t y, size_t z);
6386-#ifdef cl_khr_fp64
6387+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6388 double __ovld __conv work_group_broadcast(double a, size_t local_id);
6389 double __ovld __conv work_group_broadcast(double a, size_t x, size_t y);
6390 double __ovld __conv work_group_broadcast(double a, size_t x, size_t y, size_t z);
6391-#endif //cl_khr_fp64
6392+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6393
6394 #ifdef cl_khr_fp16
6395 half __ovld __conv work_group_reduce_add(half x);
6396@@ -15305,7 +17374,7 @@ float __ovld __conv work_group_scan_exclusive_max(float x);
6397 float __ovld __conv work_group_scan_inclusive_add(float x);
6398 float __ovld __conv work_group_scan_inclusive_min(float x);
6399 float __ovld __conv work_group_scan_inclusive_max(float x);
6400-#ifdef cl_khr_fp64
6401+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6402 double __ovld __conv work_group_reduce_add(double x);
6403 double __ovld __conv work_group_reduce_min(double x);
6404 double __ovld __conv work_group_reduce_max(double x);
6405@@ -15315,19 +17384,18 @@ double __ovld __conv work_group_scan_exclusive_max(double x);
6406 double __ovld __conv work_group_scan_inclusive_add(double x);
6407 double __ovld __conv work_group_scan_inclusive_min(double x);
6408 double __ovld __conv work_group_scan_inclusive_max(double x);
6409-#endif //cl_khr_fp64
6410-
6411+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6412+#endif //__opencl_c_work_group_collective_functions
6413 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6414
6415 // OpenCL v2.0 s6.13.16 - Pipe Functions
6416-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6417+#ifdef __opencl_c_pipes
6418 bool __ovld is_valid_reserve_id(reserve_id_t reserve_id);
6419-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6420-
6421+#endif //__opencl_c_pipes
6422
6423 // OpenCL v2.0 s6.13.17 - Enqueue Kernels
6424 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6425-
6426+#ifdef __opencl_c_device_enqueue
6427 ndrange_t __ovld ndrange_1D(size_t);
6428 ndrange_t __ovld ndrange_1D(size_t, size_t);
6429 ndrange_t __ovld ndrange_1D(size_t, size_t, size_t);
6430@@ -15355,11 +17423,13 @@ bool __ovld is_valid_event (clk_event_t event);
6431 void __ovld capture_event_profiling_info(clk_event_t, clk_profiling_info, __global void* value);
6432
6433 queue_t __ovld get_default_queue(void);
6434+#endif //__opencl_c_device_enqueue
6435 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6436
6437 // OpenCL Extension v2.0 s9.17 - Sub-groups
6438
6439-#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups)
6440+#if defined(cl_intel_subgroups) || defined(cl_khr_subgroups) || \
6441+ defined(__opencl_c_subgroups)
6442 // Shared Sub Group Functions
6443 uint __ovld get_sub_group_size(void);
6444 uint __ovld get_max_sub_group_size(void);
6445@@ -15445,7 +17515,7 @@ half __ovld __conv sub_group_scan_inclusive_min(half x);
6446 half __ovld __conv sub_group_scan_inclusive_max(half x);
6447 #endif //cl_khr_fp16
6448
6449-#ifdef cl_khr_fp64
6450+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6451 double __ovld __conv sub_group_broadcast(double x, uint sub_group_local_id);
6452 double __ovld __conv sub_group_reduce_add(double x);
6453 double __ovld __conv sub_group_reduce_min(double x);
6454@@ -15456,7 +17526,7 @@ double __ovld __conv sub_group_scan_exclusive_max(double x);
6455 double __ovld __conv sub_group_scan_inclusive_add(double x);
6456 double __ovld __conv sub_group_scan_inclusive_min(double x);
6457 double __ovld __conv sub_group_scan_inclusive_max(double x);
6458-#endif //cl_khr_fp64
6459+#endif // defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6460
6461 #endif //cl_khr_subgroups cl_intel_subgroups
6462
6463@@ -16226,16 +18296,22 @@ uint16 __ovld __conv intel_sub_group_shuffle_xor( uint16 x, uint c );
6464 long __ovld __conv intel_sub_group_shuffle_xor( long x, uint c );
6465 ulong __ovld __conv intel_sub_group_shuffle_xor( ulong x, uint c );
6466
6467+#ifdef __opencl_c_images
6468 uint __ovld __conv intel_sub_group_block_read( read_only image2d_t image, int2 coord );
6469 uint2 __ovld __conv intel_sub_group_block_read2( read_only image2d_t image, int2 coord );
6470 uint4 __ovld __conv intel_sub_group_block_read4( read_only image2d_t image, int2 coord );
6471 uint8 __ovld __conv intel_sub_group_block_read8( read_only image2d_t image, int2 coord );
6472+#endif //__opencl_c_images
6473
6474 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6475+#ifdef __opencl_c_images
6476+#ifdef __opencl_c_read_write_images
6477 uint __ovld __conv intel_sub_group_block_read(read_write image2d_t image, int2 coord);
6478 uint2 __ovld __conv intel_sub_group_block_read2(read_write image2d_t image, int2 coord);
6479 uint4 __ovld __conv intel_sub_group_block_read4(read_write image2d_t image, int2 coord);
6480 uint8 __ovld __conv intel_sub_group_block_read8(read_write image2d_t image, int2 coord);
6481+#endif //__opencl_c_read_write_images
6482+#endif //__opencl_c_images
6483 #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6484
6485 uint __ovld __conv intel_sub_group_block_read( const __global uint* p );
6486@@ -16243,16 +18319,22 @@ uint2 __ovld __conv intel_sub_group_block_read2( const __global uint* p );
6487 uint4 __ovld __conv intel_sub_group_block_read4( const __global uint* p );
6488 uint8 __ovld __conv intel_sub_group_block_read8( const __global uint* p );
6489
6490+#ifdef __opencl_c_images
6491 void __ovld __conv intel_sub_group_block_write(write_only image2d_t image, int2 coord, uint data);
6492 void __ovld __conv intel_sub_group_block_write2(write_only image2d_t image, int2 coord, uint2 data);
6493 void __ovld __conv intel_sub_group_block_write4(write_only image2d_t image, int2 coord, uint4 data);
6494 void __ovld __conv intel_sub_group_block_write8(write_only image2d_t image, int2 coord, uint8 data);
6495+#endif //__opencl_c_images
6496
6497 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6498+#ifdef __opencl_c_images
6499+#ifdef __opencl_c_read_write_images
6500 void __ovld __conv intel_sub_group_block_write(read_write image2d_t image, int2 coord, uint data);
6501 void __ovld __conv intel_sub_group_block_write2(read_write image2d_t image, int2 coord, uint2 data);
6502 void __ovld __conv intel_sub_group_block_write4(read_write image2d_t image, int2 coord, uint4 data);
6503 void __ovld __conv intel_sub_group_block_write8(read_write image2d_t image, int2 coord, uint8 data);
6504+#endif // __opencl_c_read_write_images
6505+#endif // __opencl_c_images
6506 #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6507
6508 void __ovld __conv intel_sub_group_block_write( __global uint* p, uint data );
6509@@ -16267,7 +18349,7 @@ half __ovld __conv intel_sub_group_shuffle_up( half prev, half cur, uint c );
6510 half __ovld __conv intel_sub_group_shuffle_xor( half x, uint c );
6511 #endif
6512
6513-#if defined(cl_khr_fp64)
6514+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
6515 double __ovld __conv intel_sub_group_shuffle( double x, uint c );
6516 double __ovld __conv intel_sub_group_shuffle_down( double prev, double cur, uint c );
6517 double __ovld __conv intel_sub_group_shuffle_up( double prev, double cur, uint c );
6518@@ -16366,16 +18448,22 @@ ushort __ovld __conv intel_sub_group_scan_inclusive_min( ushort x );
6519 short __ovld __conv intel_sub_group_scan_inclusive_max( short x );
6520 ushort __ovld __conv intel_sub_group_scan_inclusive_max( ushort x );
6521
6522+#ifdef __opencl_c_images
6523 uint __ovld __conv intel_sub_group_block_read_ui( read_only image2d_t image, int2 byte_coord );
6524 uint2 __ovld __conv intel_sub_group_block_read_ui2( read_only image2d_t image, int2 byte_coord );
6525 uint4 __ovld __conv intel_sub_group_block_read_ui4( read_only image2d_t image, int2 byte_coord );
6526 uint8 __ovld __conv intel_sub_group_block_read_ui8( read_only image2d_t image, int2 byte_coord );
6527+#endif //__opencl_c_images
6528
6529 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6530+#ifdef __opencl_c_images
6531+#ifdef __opencl_c_read_write_images
6532 uint __ovld __conv intel_sub_group_block_read_ui( read_write image2d_t image, int2 byte_coord );
6533 uint2 __ovld __conv intel_sub_group_block_read_ui2( read_write image2d_t image, int2 byte_coord );
6534 uint4 __ovld __conv intel_sub_group_block_read_ui4( read_write image2d_t image, int2 byte_coord );
6535 uint8 __ovld __conv intel_sub_group_block_read_ui8( read_write image2d_t image, int2 byte_coord );
6536+#endif //__opencl_c_read_write_images
6537+#endif //__opencl_c_images
6538 #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6539
6540 uint __ovld __conv intel_sub_group_block_read_ui( const __global uint* p );
6541@@ -16383,16 +18471,22 @@ uint2 __ovld __conv intel_sub_group_block_read_ui2( const __global uint* p
6542 uint4 __ovld __conv intel_sub_group_block_read_ui4( const __global uint* p );
6543 uint8 __ovld __conv intel_sub_group_block_read_ui8( const __global uint* p );
6544
6545+#ifdef __opencl_c_images
6546 void __ovld __conv intel_sub_group_block_write_ui( read_only image2d_t image, int2 byte_coord, uint data );
6547 void __ovld __conv intel_sub_group_block_write_ui2( read_only image2d_t image, int2 byte_coord, uint2 data );
6548 void __ovld __conv intel_sub_group_block_write_ui4( read_only image2d_t image, int2 byte_coord, uint4 data );
6549 void __ovld __conv intel_sub_group_block_write_ui8( read_only image2d_t image, int2 byte_coord, uint8 data );
6550+#endif //__opencl_c_images
6551
6552 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6553+#ifdef __opencl_c_images
6554+#ifdef __opencl_c_read_write_images
6555 void __ovld __conv intel_sub_group_block_write_ui( read_write image2d_t image, int2 byte_coord, uint data );
6556 void __ovld __conv intel_sub_group_block_write_ui2( read_write image2d_t image, int2 byte_coord, uint2 data );
6557 void __ovld __conv intel_sub_group_block_write_ui4( read_write image2d_t image, int2 byte_coord, uint4 data );
6558 void __ovld __conv intel_sub_group_block_write_ui8( read_write image2d_t image, int2 byte_coord, uint8 data );
6559+#endif //__opencl_c_read_write_images
6560+#endif //__opencl_c_images
6561 #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6562
6563 void __ovld __conv intel_sub_group_block_write_ui( __global uint* p, uint data );
6564@@ -16400,16 +18494,22 @@ void __ovld __conv intel_sub_group_block_write_ui2( __global uint* p, uint
6565 void __ovld __conv intel_sub_group_block_write_ui4( __global uint* p, uint4 data );
6566 void __ovld __conv intel_sub_group_block_write_ui8( __global uint* p, uint8 data );
6567
6568+#ifdef __opencl_c_images
6569 ushort __ovld __conv intel_sub_group_block_read_us( read_only image2d_t image, int2 coord );
6570 ushort2 __ovld __conv intel_sub_group_block_read_us2( read_only image2d_t image, int2 coord );
6571 ushort4 __ovld __conv intel_sub_group_block_read_us4( read_only image2d_t image, int2 coord );
6572 ushort8 __ovld __conv intel_sub_group_block_read_us8( read_only image2d_t image, int2 coord );
6573+#endif //__opencl_c_images
6574
6575 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6576+#ifdef __opencl_c_images
6577+#ifdef __opencl_c_read_write_images
6578 ushort __ovld __conv intel_sub_group_block_read_us(read_write image2d_t image, int2 coord);
6579 ushort2 __ovld __conv intel_sub_group_block_read_us2(read_write image2d_t image, int2 coord);
6580 ushort4 __ovld __conv intel_sub_group_block_read_us4(read_write image2d_t image, int2 coord);
6581 ushort8 __ovld __conv intel_sub_group_block_read_us8(read_write image2d_t image, int2 coord);
6582+#endif //__opencl_c_read_write_images
6583+#endif //__opencl_c_images
6584 #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6585
6586 ushort __ovld __conv intel_sub_group_block_read_us( const __global ushort* p );
6587@@ -16417,16 +18517,22 @@ ushort2 __ovld __conv intel_sub_group_block_read_us2( const __global ushort*
6588 ushort4 __ovld __conv intel_sub_group_block_read_us4( const __global ushort* p );
6589 ushort8 __ovld __conv intel_sub_group_block_read_us8( const __global ushort* p );
6590
6591+#ifdef __opencl_c_images
6592 void __ovld __conv intel_sub_group_block_write_us(write_only image2d_t image, int2 coord, ushort data);
6593 void __ovld __conv intel_sub_group_block_write_us2(write_only image2d_t image, int2 coord, ushort2 data);
6594 void __ovld __conv intel_sub_group_block_write_us4(write_only image2d_t image, int2 coord, ushort4 data);
6595 void __ovld __conv intel_sub_group_block_write_us8(write_only image2d_t image, int2 coord, ushort8 data);
6596+#endif //__opencl_c_images
6597
6598 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6599+#ifdef __opencl_c_images
6600+#ifdef __opencl_c_read_write_images
6601 void __ovld __conv intel_sub_group_block_write_us(read_write image2d_t image, int2 coord, ushort data);
6602 void __ovld __conv intel_sub_group_block_write_us2(read_write image2d_t image, int2 coord, ushort2 data);
6603 void __ovld __conv intel_sub_group_block_write_us4(read_write image2d_t image, int2 coord, ushort4 data);
6604 void __ovld __conv intel_sub_group_block_write_us8(read_write image2d_t image, int2 coord, ushort8 data);
6605+#endif //__opencl_c_read_write_images
6606+#endif //__opencl_c_images
6607 #endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
6608
6609 void __ovld __conv intel_sub_group_block_write_us( __global ushort* p, ushort data );
6610@@ -16545,6 +18651,7 @@ short2 __ovld intel_sub_group_avc_ime_adjust_ref_offset(
6611 short2 ref_offset, ushort2 src_coord, ushort2 ref_window_size,
6612 ushort2 image_size);
6613
6614+#ifdef __opencl_c_images
6615 intel_sub_group_avc_ime_result_t __ovld
6616 intel_sub_group_avc_ime_evaluate_with_single_reference(
6617 read_only image2d_t src_image, read_only image2d_t ref_image,
6618@@ -16585,6 +18692,7 @@ intel_sub_group_avc_ime_evaluate_with_dual_reference_streaminout(
6619 read_only image2d_t bwd_ref_image, sampler_t vme_media_sampler,
6620 intel_sub_group_avc_ime_payload_t payload,
6621 intel_sub_group_avc_ime_dual_reference_streamin_t streamin_components);
6622+#endif //__opencl_c_images
6623
6624 intel_sub_group_avc_ime_single_reference_streamin_t __ovld
6625 intel_sub_group_avc_ime_get_single_reference_streamin(
6626@@ -16649,6 +18757,7 @@ intel_sub_group_avc_ref_payload_t __ovld
6627 intel_sub_group_avc_ref_set_bilinear_filter_enable(
6628 intel_sub_group_avc_ref_payload_t payload);
6629
6630+#ifdef __opencl_c_images
6631 intel_sub_group_avc_ref_result_t __ovld
6632 intel_sub_group_avc_ref_evaluate_with_single_reference(
6633 read_only image2d_t src_image, read_only image2d_t ref_image,
6634@@ -16667,6 +18776,7 @@ intel_sub_group_avc_ref_evaluate_with_multi_reference(
6635 read_only image2d_t src_image, uint packed_reference_ids,
6636 uchar packed_reference_field_polarities, sampler_t vme_media_sampler,
6637 intel_sub_group_avc_ref_payload_t payload);
6638+#endif //__opencl_c_images
6639
6640 // SIC built-in functions
6641 intel_sub_group_avc_sic_payload_t __ovld
6642@@ -16717,6 +18827,7 @@ intel_sub_group_avc_sic_set_block_based_raw_skip_sad(
6643 uchar block_based_skip_type,
6644 intel_sub_group_avc_sic_payload_t payload);
6645
6646+#ifdef __opencl_c_images
6647 intel_sub_group_avc_sic_result_t __ovld
6648 intel_sub_group_avc_sic_evaluate_ipe(
6649 read_only image2d_t src_image, sampler_t vme_media_sampler,
6650@@ -16739,6 +18850,7 @@ intel_sub_group_avc_sic_evaluate_with_multi_reference(
6651 read_only image2d_t src_image, uint packed_reference_ids,
6652 uchar packed_reference_field_polarities, sampler_t vme_media_sampler,
6653 intel_sub_group_avc_sic_payload_t payload);
6654+#endif //__opencl_c_images
6655
6656 uchar __ovld intel_sub_group_avc_sic_get_ipe_luma_shape(
6657 intel_sub_group_avc_sic_result_t result);
6658diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
6659index c87d240a8206..8c8f03bba0f3 100644
6660--- a/clang/lib/Parse/ParseDecl.cpp
6661+++ b/clang/lib/Parse/ParseDecl.cpp
6662@@ -3799,8 +3799,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
6663 isInvalid = DS.SetTypeAltiVecBool(true, Loc, PrevSpec, DiagID, Policy);
6664 break;
6665 case tok::kw_pipe:
6666- if (!getLangOpts().OpenCL || (getLangOpts().OpenCLVersion < 200 &&
6667- !getLangOpts().OpenCLCPlusPlus)) {
6668+ if (!getLangOpts().OpenCLPipeKeyword) {
6669 // OpenCL 2.0 defined this keyword. OpenCL 1.2 and earlier should
6670 // support the "pipe" word as identifier.
6671 Tok.getIdentifierInfo()->revertTokenIDToIdentifier();
6672@@ -3922,8 +3921,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
6673 case tok::kw___generic:
6674 // generic address space is introduced only in OpenCL v2.0
6675 // see OpenCL C Spec v2.0 s6.5.5
6676- if (Actions.getLangOpts().OpenCLVersion < 200 &&
6677- !Actions.getLangOpts().OpenCLCPlusPlus) {
6678+ if (!Actions.getLangOpts().OpenCLGenericKeyword) {
6679 DiagID = diag::err_opencl_unknown_type_specifier;
6680 PrevSpec = Tok.getIdentifierInfo()->getNameStart();
6681 isInvalid = true;
6682@@ -4973,8 +4971,7 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) {
6683 default: return false;
6684
6685 case tok::kw_pipe:
6686- return (getLangOpts().OpenCL && getLangOpts().OpenCLVersion >= 200) ||
6687- getLangOpts().OpenCLCPlusPlus;
6688+ return getLangOpts().OpenCLPipeKeyword;
6689
6690 case tok::identifier: // foo::bar
6691 // Unfortunate hack to support "Class.factoryMethod" notation.
6692@@ -5499,8 +5496,7 @@ static bool isPtrOperatorToken(tok::TokenKind Kind, const LangOptions &Lang,
6693 if (Kind == tok::star || Kind == tok::caret)
6694 return true;
6695
6696- if (Kind == tok::kw_pipe &&
6697- ((Lang.OpenCL && Lang.OpenCLVersion >= 200) || Lang.OpenCLCPlusPlus))
6698+ if (Kind == tok::kw_pipe && Lang.OpenCLPipeKeyword)
6699 return true;
6700
6701 if (!Lang.CPlusPlus)
6702diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp
6703index 6402b31d00b2..65f283ad556b 100644
6704--- a/clang/lib/Parse/ParsePragma.cpp
6705+++ b/clang/lib/Parse/ParsePragma.cpp
6706@@ -749,12 +749,14 @@ void Parser::HandlePragmaOpenCLExtension() {
6707 if (Name == "all") {
6708 if (State == Disable) {
6709 Opt.disableAll();
6710- Opt.enableSupportedCore(getLangOpts());
6711+ Opt.enableSupportedCore();
6712 } else {
6713 PP.Diag(NameLoc, diag::warn_pragma_expected_predicate) << 1;
6714 }
6715+ } else if (Opt.isFeature(Name)) {
6716+ PP.Diag(NameLoc, diag::warn_opencl_pragma_feature_ignore) << Ident;
6717 } else if (State == Begin) {
6718- if (!Opt.isKnown(Name) || !Opt.isSupported(Name, getLangOpts())) {
6719+ if (!Opt.isKnown(Name) || !Opt.isSupported(Name)) {
6720 Opt.support(Name);
6721 }
6722 Actions.setCurrentOpenCLExtension(Name);
6723@@ -764,9 +766,9 @@ void Parser::HandlePragmaOpenCLExtension() {
6724 Actions.setCurrentOpenCLExtension("");
6725 } else if (!Opt.isKnown(Name))
6726 PP.Diag(NameLoc, diag::warn_pragma_unknown_extension) << Ident;
6727- else if (Opt.isSupportedExtension(Name, getLangOpts()))
6728+ else if (Opt.isSupportedExtension(Name))
6729 Opt.enable(Name, State == Enable);
6730- else if (Opt.isSupportedCore(Name, getLangOpts()))
6731+ else if (Opt.isSupportedCore(Name))
6732 PP.Diag(NameLoc, diag::warn_pragma_extension_is_core) << Ident;
6733 else
6734 PP.Diag(NameLoc, diag::warn_pragma_unsupported_extension) << Ident;
6735diff --git a/clang/lib/Sema/OpenCLBuiltins.td b/clang/lib/Sema/OpenCLBuiltins.td
6736index 745363a6b43f..6a1fce567090 100644
6737--- a/clang/lib/Sema/OpenCLBuiltins.td
6738+++ b/clang/lib/Sema/OpenCLBuiltins.td
6739@@ -22,11 +22,13 @@
6740 class Version<int _Version> {
6741 int ID = _Version;
6742 }
6743+
6744 def CLAll : Version< 0>;
6745 def CL10 : Version<100>;
6746 def CL11 : Version<110>;
6747 def CL12 : Version<120>;
6748 def CL20 : Version<200>;
6749+def CL30 : Version<300>;
6750
6751 // Address spaces
6752 // Pointer types need to be assigned an address space.
6753@@ -72,6 +74,14 @@ def ArmIntegerDotProductAccumulateInt8 : FunctionExtension<"cl_arm_integ
6754 def ArmIntegerDotProductAccumulateInt16 : FunctionExtension<"cl_arm_integer_dot_product_accumulate_int16">;
6755 def ArmIntegerDotProductAccumulateSaturateInt8 : FunctionExtension<"cl_arm_integer_dot_product_accumulate_saturate_int8">;
6756
6757+// Features
6758+def FuncExtGenericAddressSpace : FunctionExtension<"__opencl_c_generic_address_space">;
6759+def FuncExtWorkGroupCollective : FunctionExtension<"__opencl_c_work_group_collective_functions">;
6760+def FuncExtPipes : FunctionExtension<"__opencl_c_pipes">;
6761+def FuncExtDeviceSidEenqueue : FunctionExtension<"__opencl_c_device_enqueue">;
6762+def FuncNonExplicitAtomicFeatures : FunctionExtension<"__opencl_c_atomic_order_seq_cst __opencl_c_atomic_scope_device">;
6763+def FuncNonExplicitAtomicFeaturesAndGenericAS : FunctionExtension<"__opencl_c_atomic_order_seq_cst __opencl_c_atomic_scope_device __opencl_c_generic_address_space">;
6764+
6765 // Qualified Type. These map to ASTContext::QualType.
6766 class QualType<string _Name, bit _IsAbstract=0> {
6767 // Name of the field or function in a clang::ASTContext
6768@@ -236,13 +246,9 @@ class Builtin<string _Name, list<Type> _Signature, list<bit> _Attributes = Attr.
6769 bit IsConv = _Attributes[2];
6770 // OpenCL extensions to which the function belongs.
6771 FunctionExtension Extension = FuncExtNone;
6772- // Version of OpenCL from which the function is available (e.g.: CL10).
6773- // MinVersion is inclusive.
6774- Version MinVersion = CL10;
6775- // Version of OpenCL from which the function is not supported anymore.
6776- // MaxVersion is exclusive.
6777+ // List of OpenCL version in which this function available.
6778 // CLAll makes the function available for all versions.
6779- Version MaxVersion = CLAll;
6780+ list<Version> Versions = [CLAll];
6781 }
6782
6783 //===----------------------------------------------------------------------===//
6784@@ -421,7 +427,7 @@ foreach name = ["get_global_size", "get_global_id", "get_local_size",
6785 def : Builtin<name, [Size, UInt], Attr.Const>;
6786 }
6787
6788-let MinVersion = CL20 in {
6789+let Versions = [CL20, CL30] in {
6790 def : Builtin<"get_enqueued_local_size", [Size, UInt]>;
6791 foreach name = ["get_global_linear_id", "get_local_linear_id"] in {
6792 def : Builtin<name, [Size]>;
6793@@ -494,7 +500,7 @@ foreach name = ["fma", "mad"] in {
6794 }
6795
6796 // --- Version dependent ---
6797-let MaxVersion = CL20 in {
6798+let Versions = [CL10, CL11, CL12, CL30] in {
6799 foreach AS = [GlobalAS, LocalAS, PrivateAS] in {
6800 foreach name = ["fract", "modf", "sincos"] in {
6801 def : Builtin<name, [FGenTypeN, FGenTypeN, PointerType<FGenTypeN, AS>]>;
6802@@ -511,7 +517,9 @@ let MaxVersion = CL20 in {
6803 }
6804 }
6805 }
6806-let MinVersion = CL20 in {
6807+
6808+let Versions = [CL20, CL30] in {
6809+ let Extension = FuncExtGenericAddressSpace in {
6810 foreach name = ["fract", "modf", "sincos"] in {
6811 def : Builtin<name, [FGenTypeN, FGenTypeN, PointerType<FGenTypeN, GenericAS>]>;
6812 }
6813@@ -524,6 +532,7 @@ let MinVersion = CL20 in {
6814 def : Builtin<name, [Type, Type, Type, PointerType<GenTypeIntVecAndScalar, GenericAS>]>;
6815 }
6816 }
6817+ }
6818 }
6819
6820 // --- Table 9 ---
6821@@ -554,7 +563,7 @@ foreach name = ["abs"] in {
6822 foreach name = ["clz", "popcount"] in {
6823 def : Builtin<name, [AIGenTypeN, AIGenTypeN], Attr.Const>;
6824 }
6825-let MinVersion = CL20 in {
6826+let Versions = [CL20, CL30] in {
6827 foreach name = ["ctz"] in {
6828 def : Builtin<name, [AIGenTypeN, AIGenTypeN]>;
6829 }
6830@@ -728,7 +737,7 @@ foreach name = ["select"] in {
6831 // --- Table 15 ---
6832 // Variants for OpenCL versions below 2.0, using pointers to the global, local
6833 // and private address spaces.
6834-let MaxVersion = CL20 in {
6835+let Versions = [CL10, CL11, CL12, CL30] in {
6836 foreach AS = [GlobalAS, LocalAS, PrivateAS] in {
6837 foreach VSize = [2, 3, 4, 8, 16] in {
6838 foreach name = ["vload" # VSize] in {
6839@@ -771,7 +780,8 @@ let MaxVersion = CL20 in {
6840 }
6841 // Variants for OpenCL versions above 2.0, using pointers to the generic
6842 // address space.
6843-let MinVersion = CL20 in {
6844+let Versions = [CL20, CL30] in {
6845+ let Extension = FuncExtGenericAddressSpace in {
6846 foreach VSize = [2, 3, 4, 8, 16] in {
6847 foreach name = ["vload" # VSize] in {
6848 def : Builtin<name, [VectorType<Char, VSize>, Size, PointerType<ConstType<Char>, GenericAS>]>;
6849@@ -809,6 +819,7 @@ let MinVersion = CL20 in {
6850 }
6851 }
6852 }
6853+ }
6854 }
6855 // Variants using pointers to the constant address space.
6856 foreach VSize = [2, 3, 4, 8, 16] in {
6857@@ -829,7 +840,7 @@ foreach VSize = [2, 3, 4, 8, 16] in {
6858 def : Builtin<name, [VectorType<Float, VSize>, Size, PointerType<ConstType<Half>, ConstantAS>]>;
6859 }
6860 }
6861-let MaxVersion = CL20 in {
6862+let Versions = [CL10, CL11, CL12, CL30] in {
6863 foreach AS = [GlobalAS, LocalAS, PrivateAS] in {
6864 def : Builtin<"vload_half", [Float, Size, PointerType<ConstType<Half>, AS>]>;
6865 def : Builtin<"vloada_half", [Float, Size, PointerType<ConstType<Half>, AS>]>;
6866@@ -852,7 +863,8 @@ let MaxVersion = CL20 in {
6867 }
6868 }
6869 }
6870-let MinVersion = CL20 in {
6871+let Versions = [CL20, CL30] in {
6872+ let Extension = FuncExtGenericAddressSpace in {
6873 foreach AS = [GenericAS] in {
6874 def : Builtin<"vload_half", [Float, Size, PointerType<ConstType<Half>, AS>]>;
6875 def : Builtin<"vloada_half", [Float, Size, PointerType<ConstType<Half>, AS>]>;
6876@@ -874,6 +886,7 @@ let MinVersion = CL20 in {
6877 }
6878 }
6879 }
6880+ }
6881 }
6882
6883 foreach AS = [ConstantAS] in {
6884@@ -899,7 +912,9 @@ foreach name = ["async_work_group_strided_copy"] in {
6885 def : Builtin<name, [Event, PointerType<AGenTypeN, GlobalAS>, PointerType<ConstType<AGenTypeN>, LocalAS>, Size, Size, Event]>;
6886 }
6887 foreach name = ["wait_group_events"] in {
6888+ let Extension = FuncExtGenericAddressSpace in {
6889 def : Builtin<name, [Void, Int, PointerType<Event, GenericAS>]>;
6890+ }
6891 }
6892 foreach name = ["prefetch"] in {
6893 def : Builtin<name, [Void, PointerType<ConstType<AGenTypeN>, GlobalAS>, Size]>;
6894@@ -1000,13 +1015,25 @@ foreach AS = [GlobalAS, LocalAS] in {
6895 }
6896 }
6897 }
6898+
6899 // OpenCL v2.0 s6.13.11 - Atomic Functions.
6900-let MinVersion = CL20 in {
6901+
6902+let Versions = [CL20, CL30] in {
6903+ let Extension = FuncExtGenericAddressSpace in {
6904+ foreach TypePair = [[AtomicInt, Int], [AtomicUInt, UInt],
6905+ [AtomicLong, Long], [AtomicULong, ULong],
6906+ [AtomicFloat, Float], [AtomicDouble, Double]] in {
6907+ def : Builtin<"atomic_init",
6908+ [Void, PointerType<VolatileType<TypePair[0]>, GenericAS>, TypePair[1]]>;
6909+ }
6910+ }
6911+}
6912+
6913+let Versions = [CL20, CL30] in {
6914+ let Extension = FuncNonExplicitAtomicFeaturesAndGenericAS in {
6915 foreach TypePair = [[AtomicInt, Int], [AtomicUInt, UInt],
6916 [AtomicLong, Long], [AtomicULong, ULong],
6917 [AtomicFloat, Float], [AtomicDouble, Double]] in {
6918- def : Builtin<"atomic_init",
6919- [Void, PointerType<VolatileType<TypePair[0]>, GenericAS>, TypePair[1]]>;
6920 def : Builtin<"atomic_store",
6921 [Void, PointerType<VolatileType<TypePair[0]>, GenericAS>, TypePair[1]]>;
6922 def : Builtin<"atomic_load",
6923@@ -1038,6 +1065,59 @@ let MinVersion = CL20 in {
6924 [TypePair[1], PointerType<VolatileType<TypePair[0]>, GenericAS>, TypePair[2]]>;
6925 }
6926 }
6927+ }
6928+}
6929+
6930+let Versions = [CL30] in {
6931+ foreach AS = [GlobalAS, LocalAS] in {
6932+ foreach TypePair = [[AtomicInt, Int], [AtomicUInt, UInt],
6933+ [AtomicLong, Long], [AtomicULong, ULong],
6934+ [AtomicFloat, Float], [AtomicDouble, Double]] in {
6935+ def : Builtin<"atomic_init",
6936+ [Void, PointerType<VolatileType<TypePair[0]>, AS>, TypePair[1]]>;
6937+ }
6938+ }
6939+}
6940+
6941+let Versions = [CL30] in {
6942+ let Extension = FuncNonExplicitAtomicFeatures in {
6943+ foreach AS = [GlobalAS, LocalAS] in {
6944+ foreach TypePair = [[AtomicInt, Int], [AtomicUInt, UInt],
6945+ [AtomicLong, Long], [AtomicULong, ULong],
6946+ [AtomicFloat, Float], [AtomicDouble, Double]] in {
6947+ def : Builtin<"atomic_store",
6948+ [Void, PointerType<VolatileType<TypePair[0]>, AS>, TypePair[1]]>;
6949+ def : Builtin<"atomic_load",
6950+ [TypePair[1], PointerType<VolatileType<TypePair[0]>, AS>]>;
6951+ def : Builtin<"atomic_exchange",
6952+ [TypePair[1], PointerType<VolatileType<TypePair[0]>, AS>, TypePair[1]]>;
6953+ foreach Variant = ["weak", "strong"] in {
6954+ def : Builtin<"atomic_compare_exchange_" # Variant,
6955+ [Bool, PointerType<VolatileType<TypePair[0]>, AS>,
6956+ PointerType<TypePair[1], AS>, TypePair[1]]>;
6957+ }
6958+ }
6959+
6960+ foreach TypePair = [[AtomicInt, Int, Int], [AtomicUInt, UInt, UInt],
6961+ [AtomicLong, Long, Long], [AtomicULong, ULong, ULong],
6962+ [AtomicIntPtr, IntPtr, PtrDiff],
6963+ [AtomicUIntPtr, UIntPtr, PtrDiff]] in {
6964+ foreach ModOp = ["add", "sub"] in {
6965+ def : Builtin<"atomic_fetch_" # ModOp,
6966+ [TypePair[1], PointerType<VolatileType<TypePair[0]>, AS>, TypePair[2]]>;
6967+ }
6968+ }
6969+ foreach TypePair = [[AtomicInt, Int, Int], [AtomicUInt, UInt, UInt],
6970+ [AtomicLong, Long, Long], [AtomicULong, ULong, ULong],
6971+ [AtomicIntPtr, IntPtr, IntPtr],
6972+ [AtomicUIntPtr, UIntPtr, UIntPtr]] in {
6973+ foreach ModOp = ["or", "xor", "and", "min", "max"] in {
6974+ def : Builtin<"atomic_fetch_" # ModOp,
6975+ [TypePair[1], PointerType<VolatileType<TypePair[0]>, AS>, TypePair[2]]>;
6976+ }
6977+ }
6978+ }
6979+ }
6980 }
6981
6982 //--------------------------------------------------------------------
6983@@ -1217,7 +1297,8 @@ foreach aQual = ["WO", "RW"] in {
6984 //--------------------------------------------------------------------
6985 // OpenCL v2.0 s6.13.15 - Work-group Functions
6986 // --- Table 26 ---
6987-let MinVersion = CL20 in {
6988+let Versions = [CL20, CL30] in {
6989+ let Extension = FuncExtWorkGroupCollective in {
6990 foreach name = ["work_group_all", "work_group_any"] in {
6991 def : Builtin<name, [Int, Int], Attr.Convergent>;
6992 }
6993@@ -1232,6 +1313,7 @@ let MinVersion = CL20 in {
6994 def : Builtin<name # op, [IntLongFloatGenType1, IntLongFloatGenType1], Attr.Convergent>;
6995 }
6996 }
6997+ }
6998 }
6999
7000
7001@@ -1241,8 +1323,10 @@ let MinVersion = CL20 in {
7002 // Defined in Builtins.def
7003
7004 // --- Table 28 ---
7005-// Builtins taking pipe arguments are defined in Builtins.def
7006-def : Builtin<"is_valid_reserve_id", [Bool, ReserveId]>;
7007+let Extension = FuncExtPipes in {
7008+ // Builtins taking pipe arguments are defined in Builtins.def
7009+ def : Builtin<"is_valid_reserve_id", [Bool, ReserveId]>;
7010+}
7011
7012 // --- Table 29 ---
7013 // Defined in Builtins.def
7014@@ -1257,21 +1341,22 @@ def : Builtin<"is_valid_reserve_id", [Bool, ReserveId]>;
7015 // Defined in Builtins.def
7016
7017 // --- Table 33 ---
7018-def : Builtin<"enqueue_marker",
7019- [Int, Queue, UInt, PointerType<ConstType<ClkEvent>, GenericAS>, PointerType<ClkEvent, GenericAS>]>;
7020+let Extension = FuncExtDeviceSidEenqueue in {
7021+ def : Builtin<"enqueue_marker",
7022+ [Int, Queue, UInt, PointerType<ConstType<ClkEvent>, GenericAS>, PointerType<ClkEvent, GenericAS>]>;
7023
7024-// --- Table 34 ---
7025-def : Builtin<"retain_event", [Void, ClkEvent]>;
7026-def : Builtin<"release_event", [Void, ClkEvent]>;
7027-def : Builtin<"create_user_event", [ClkEvent]>;
7028-def : Builtin<"is_valid_event", [Bool, ClkEvent]>;
7029-def : Builtin<"set_user_event_status", [Void, ClkEvent, Int]>;
7030-// TODO: capture_event_profiling_info
7031-
7032-// --- Table 35 ---
7033-def : Builtin<"get_default_queue", [Queue]>;
7034-// TODO: ndrange functions
7035+ // --- Table 34 ---
7036+ def : Builtin<"retain_event", [Void, ClkEvent]>;
7037+ def : Builtin<"release_event", [Void, ClkEvent]>;
7038+ def : Builtin<"create_user_event", [ClkEvent]>;
7039+ def : Builtin<"is_valid_event", [Bool, ClkEvent]>;
7040+ def : Builtin<"set_user_event_status", [Void, ClkEvent, Int]>;
7041+ // TODO: capture_event_profiling_info
7042
7043+ // --- Table 35 ---
7044+ def : Builtin<"get_default_queue", [Queue]>;
7045+ // TODO: ndrange functions
7046+}
7047
7048 //--------------------------------------------------------------------
7049 // End of the builtin functions defined in the OpenCL C specification.
7050@@ -1456,7 +1541,7 @@ let Extension = FuncExtKhrSubgroups in {
7051 "get_sub_group_local_id"] in {
7052 def : Builtin<name, [UInt]>;
7053 }
7054- let MinVersion = CL20 in {
7055+ let Versions = [CL20] in {
7056 foreach name = ["get_enqueued_num_sub_groups"] in {
7057 def : Builtin<name, [UInt]>;
7058 }
7059diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
7060index 2f2b52106f3d..5092a4691b9b 100644
7061--- a/clang/lib/Sema/Sema.cpp
7062+++ b/clang/lib/Sema/Sema.cpp
7063@@ -291,9 +291,10 @@ void Sema::Initialize() {
7064 // Initialize predefined OpenCL types and supported extensions and (optional)
7065 // core features.
7066 if (getLangOpts().OpenCL) {
7067+ getOpenCLOptions().setOpenCLVersion(getLangOpts());
7068 getOpenCLOptions().addSupport(
7069 Context.getTargetInfo().getSupportedOpenCLOpts());
7070- getOpenCLOptions().enableSupportedCore(getLangOpts());
7071+ getOpenCLOptions().enableSupportedCore();
7072 addImplicitTypedef("sampler_t", Context.OCLSamplerTy);
7073 addImplicitTypedef("event_t", Context.OCLEventTy);
7074 if (getLangOpts().OpenCLCPlusPlus || getLangOpts().OpenCLVersion >= 200) {
7075@@ -349,12 +350,18 @@ void Sema::Initialize() {
7076 "cl_khr_int64_base_atomics cl_khr_int64_extended_atomics");
7077
7078 setOpenCLExtensionForType(AtomicDoubleT, "cl_khr_fp64");
7079+ setOpenCLExtensionForType(Context.OCLReserveIDTy, "__opencl_c_pipes");
7080+ setOpenCLExtensionForType(Context.OCLClkEventTy,
7081+ "__opencl_c_device_enqueue");
7082+ setOpenCLExtensionForType(Context.OCLQueueTy,
7083+ "__opencl_c_device_enqueue");
7084 }
7085
7086 setOpenCLExtensionForType(Context.DoubleTy, "cl_khr_fp64");
7087
7088-#define GENERIC_IMAGE_TYPE_EXT(Type, Id, Ext) \
7089- setOpenCLExtensionForType(Context.Id, Ext);
7090+#define GENERIC_IMAGE_TYPE_EXT(Type, Id, Ext) \
7091+ setOpenCLExtensionForType(Context.Id, Ext); \
7092+ setOpenCLExtensionForType(Context.Id, "__opencl_c_images");
7093 #include "clang/Basic/OpenCLImageTypes.def"
7094 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
7095 addImplicitTypedef(#ExtType, Context.Id##Ty); \
7096@@ -2423,6 +2430,27 @@ bool Sema::isOpenCLDisabledDecl(Decl *FD) {
7097 return false;
7098 }
7099
7100+template <typename DiagLocT, typename DiagInfoT>
7101+void Sema::DiagnoseOpenCLRequiresOption(llvm::StringRef OpenCLOptName,
7102+ DiagLocT DiagLoc, DiagInfoT DiagInfo,
7103+ unsigned Selector,
7104+ SourceRange SrcRange) {
7105+ const auto &LO = getLangOpts();
7106+ auto CLVer = LO.OpenCLCPlusPlus ? 200 : LO.OpenCLVersion;
7107+ // For versions higher that 3.0 diagnosing feature
7108+ if (CLVer >= 300) {
7109+ OpenCLOptName =
7110+ llvm::StringSwitch<llvm::StringRef>(OpenCLOptName)
7111+ .Case("cl_khr_3d_image_writes", "__opencl_c_3d_image_writes")
7112+ .Case("cl_khr_subgroups", "__opencl_c_subgroups")
7113+ .Case("cl_khr_fp64", "__opencl_c_fp64")
7114+ .Default(OpenCLOptName);
7115+ }
7116+
7117+ Diag(DiagLoc, diag::err_opencl_requires_extension)
7118+ << Selector << DiagInfo << OpenCLOptName << SrcRange;
7119+}
7120+
7121 template <typename T, typename DiagLocT, typename DiagInfoT, typename MapT>
7122 bool Sema::checkOpenCLDisabledTypeOrDecl(T D, DiagLocT DiagLoc,
7123 DiagInfoT DiagInfo, MapT &Map,
7124@@ -2434,8 +2462,7 @@ bool Sema::checkOpenCLDisabledTypeOrDecl(T D, DiagLocT DiagLoc,
7125 bool Disabled = false;
7126 for (auto &I : Loc->second) {
7127 if (I != CurrOpenCLExtension && !getOpenCLOptions().isEnabled(I)) {
7128- Diag(DiagLoc, diag::err_opencl_requires_extension) << Selector << DiagInfo
7129- << I << SrcRange;
7130+ DiagnoseOpenCLRequiresOption(I, DiagLoc, DiagInfo, Selector, SrcRange);
7131 Disabled = true;
7132 }
7133 }
7134@@ -2471,3 +2498,13 @@ bool Sema::checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E) {
7135 return checkOpenCLDisabledTypeOrDecl(&D, E.getBeginLoc(), FnName,
7136 OpenCLDeclExtMap, 1, D.getSourceRange());
7137 }
7138+
7139+bool Sema::checkOpenCLSubgroupExtForCallExpr(CallExpr *Call) {
7140+ if (!getOpenCLOptions().isEnabled("cl_khr_subgroups")) {
7141+ DiagnoseOpenCLRequiresOption("cl_khr_subgroups", Call->getBeginLoc(),
7142+ Call->getDirectCallee(), 1,
7143+ Call->getSourceRange());
7144+ return true;
7145+ }
7146+ return false;
7147+}
7148diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
7149index 1bf04d9cb4f2..9dd63db0f420 100644
7150--- a/clang/lib/Sema/SemaChecking.cpp
7151+++ b/clang/lib/Sema/SemaChecking.cpp
7152@@ -835,20 +835,11 @@ static bool checkOpenCLBlockArgs(Sema &S, Expr *BlockArg) {
7153 return IllegalParams;
7154 }
7155
7156-static bool checkOpenCLSubgroupExt(Sema &S, CallExpr *Call) {
7157- if (!S.getOpenCLOptions().isEnabled("cl_khr_subgroups")) {
7158- S.Diag(Call->getBeginLoc(), diag::err_opencl_requires_extension)
7159- << 1 << Call->getDirectCallee() << "cl_khr_subgroups";
7160- return true;
7161- }
7162- return false;
7163-}
7164-
7165 static bool SemaOpenCLBuiltinNDRangeAndBlock(Sema &S, CallExpr *TheCall) {
7166 if (checkArgCount(S, TheCall, 2))
7167 return true;
7168
7169- if (checkOpenCLSubgroupExt(S, TheCall))
7170+ if (S.checkOpenCLSubgroupExtForCallExpr(TheCall))
7171 return true;
7172
7173 // First argument is an ndrange_t type.
7174@@ -1883,7 +1874,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
7175 break;
7176 case Builtin::BIsub_group_reserve_read_pipe:
7177 case Builtin::BIsub_group_reserve_write_pipe:
7178- if (checkOpenCLSubgroupExt(*this, TheCall) ||
7179+ if (checkOpenCLSubgroupExtForCallExpr(TheCall) ||
7180 SemaBuiltinReserveRWPipe(*this, TheCall))
7181 return ExprError();
7182 break;
7183@@ -1896,7 +1887,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
7184 break;
7185 case Builtin::BIsub_group_commit_read_pipe:
7186 case Builtin::BIsub_group_commit_write_pipe:
7187- if (checkOpenCLSubgroupExt(*this, TheCall) ||
7188+ if (checkOpenCLSubgroupExtForCallExpr(TheCall) ||
7189 SemaBuiltinCommitRWPipe(*this, TheCall))
7190 return ExprError();
7191 break;
7192@@ -4149,6 +4140,20 @@ DiagnoseCStringFormatDirectiveInCFAPI(Sema &S,
7193 }
7194 }
7195
7196+bool Sema::isSupportedOpenCLOMemoryOrdering(int64_t Ordering) const {
7197+ assert(llvm::isValidAtomicOrderingCABI(Ordering));
7198+ auto OrderingCABI = (llvm::AtomicOrderingCABI)Ordering;
7199+ switch (OrderingCABI) {
7200+ case llvm::AtomicOrderingCABI::acquire:
7201+ case llvm::AtomicOrderingCABI::release:
7202+ case llvm::AtomicOrderingCABI::acq_rel:
7203+ return OpenCLFeatures.isEnabled("__opencl_c_atomic_order_acq_rel");
7204+
7205+ default:
7206+ return true;
7207+ }
7208+}
7209+
7210 /// Determine whether the given type has a non-null nullability annotation.
7211 static bool isNonNullType(ASTContext &ctx, QualType type) {
7212 if (auto nullability = type->getNullability(ctx))
7213@@ -4920,10 +4925,17 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
7214 if (SubExprs.size() >= 2 && Form != Init) {
7215 llvm::APSInt Result(32);
7216 if (SubExprs[1]->isIntegerConstantExpr(Result, Context) &&
7217- !isValidOrderingForOp(Result.getSExtValue(), Op))
7218+ !isValidOrderingForOp(Result.getSExtValue(), Op)) {
7219 Diag(SubExprs[1]->getBeginLoc(),
7220 diag::warn_atomic_op_has_invalid_memory_order)
7221 << SubExprs[1]->getSourceRange();
7222+ } else if (IsOpenCL &&
7223+ !isSupportedOpenCLOMemoryOrdering(Result.getSExtValue())) {
7224+ Diag(SubExprs[1]->getBeginLoc(),
7225+ diag::err_opencl_memory_ordering_require_feat)
7226+ << SubExprs[1]->getSourceRange();
7227+ return ExprError();
7228+ }
7229 }
7230
7231 if (auto ScopeModel = AtomicExpr::getScopeModel(Op)) {
7232diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
7233index 5b0417fa8859..2dee60763d57 100644
7234--- a/clang/lib/Sema/SemaDecl.cpp
7235+++ b/clang/lib/Sema/SemaDecl.cpp
7236@@ -6290,7 +6290,9 @@ void Sema::deduceOpenCLAddressSpace(ValueDecl *Decl) {
7237 if (Type->isSamplerT() || Type->isVoidType())
7238 return;
7239 LangAS ImplAS = LangAS::opencl_private;
7240- if ((getLangOpts().OpenCLCPlusPlus || getLangOpts().OpenCLVersion >= 200) &&
7241+ if ((getLangOpts().OpenCLCPlusPlus ||
7242+ getOpenCLOptions().isEnabled(
7243+ "__opencl_c_program_scope_global_variables")) &&
7244 Var->hasGlobalStorage())
7245 ImplAS = LangAS::opencl_global;
7246 // If the original type from a decayed type is an array type and that array
7247@@ -7849,18 +7851,22 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {
7248 // OpenCL C v2.0 s6.5.1 - Variables defined at program scope and static
7249 // variables inside a function can also be declared in the global
7250 // address space.
7251+ // OpenCL C v3.0 s5.5 - For OpenCL C 2.0, or with the
7252+ // __opencl_c_program_scope_global_variables feature macro, the
7253+ // address space for a variable at program scope or a static variable
7254+ // also be __global
7255 // C++ for OpenCL inherits rule from OpenCL C v2.0.
7256 // FIXME: Adding local AS in C++ for OpenCL might make sense.
7257 if (NewVD->isFileVarDecl() || NewVD->isStaticLocal() ||
7258 NewVD->hasExternalStorage()) {
7259- if (!T->isSamplerT() &&
7260- !T->isDependentType() &&
7261+ if (!T->isSamplerT() && !T->isDependentType() &&
7262 !(T.getAddressSpace() == LangAS::opencl_constant ||
7263 (T.getAddressSpace() == LangAS::opencl_global &&
7264- (getLangOpts().OpenCLVersion == 200 ||
7265- getLangOpts().OpenCLCPlusPlus)))) {
7266+ (OpenCLFeatures.isEnabled(
7267+ "__opencl_c_program_scope_global_variables"))))) {
7268 int Scope = NewVD->isStaticLocal() | NewVD->hasExternalStorage() << 1;
7269- if (getLangOpts().OpenCLVersion == 200 || getLangOpts().OpenCLCPlusPlus)
7270+ if (OpenCLFeatures.isEnabled(
7271+ "__opencl_c_program_scope_global_variables"))
7272 Diag(NewVD->getLocation(), diag::err_opencl_global_invalid_addr_space)
7273 << Scope << "global or constant";
7274 else
7275diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
7276index a9a2a19b4797..73b35eae176a 100644
7277--- a/clang/lib/Sema/SemaDeclAttr.cpp
7278+++ b/clang/lib/Sema/SemaDeclAttr.cpp
7279@@ -6488,7 +6488,7 @@ static void handleInternalLinkageAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
7280 }
7281
7282 static void handleOpenCLNoSVMAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
7283- if (S.LangOpts.OpenCLVersion != 200)
7284+ if (S.LangOpts.OpenCLVersion < 200)
7285 S.Diag(AL.getLoc(), diag::err_attribute_requires_opencl_version)
7286 << AL << "2.0" << 0;
7287 else
7288@@ -6572,6 +6572,13 @@ static void handleOpenCLAccessAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
7289 << AL << PDecl->getType() << DeclTy->isImageType();
7290 D->setInvalidDecl(true);
7291 return;
7292+ } else if ((!S.getLangOpts().OpenCLCPlusPlus &&
7293+ S.getLangOpts().OpenCLVersion >= 200) &&
7294+ !S.getOpenCLOptions().isEnabled(
7295+ "__opencl_c_read_write_images")) {
7296+ S.Diag(AL.getLoc(), diag::err_opencl_requires_extension)
7297+ << 0 << PDecl->getType() << "__opencl_c_read_write_images";
7298+ return;
7299 }
7300 }
7301 }
7302diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
7303index 22bf35dbd0cb..b2081bb6b407 100644
7304--- a/clang/lib/Sema/SemaDeclCXX.cpp
7305+++ b/clang/lib/Sema/SemaDeclCXX.cpp
7306@@ -38,9 +38,9 @@
7307 #include "clang/Sema/ScopeInfo.h"
7308 #include "clang/Sema/SemaInternal.h"
7309 #include "clang/Sema/Template.h"
7310+#include "llvm/ADT/STLExtras.h"
7311 #include "llvm/ADT/ScopeExit.h"
7312 #include "llvm/ADT/SmallString.h"
7313-#include "llvm/ADT/STLExtras.h"
7314 #include "llvm/ADT/StringExtras.h"
7315 #include <map>
7316 #include <set>
7317@@ -15228,6 +15228,11 @@ CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl,
7318 if (auto *PtrTy = ResultType->getAs<PointerType>()) {
7319 ResultType = RemoveAddressSpaceFromPtr(SemaRef, PtrTy);
7320 }
7321+ if (CanQual<PointerType> ExpectedPtrTy =
7322+ ExpectedResultType->getAs<PointerType>()) {
7323+ ExpectedResultType = SemaRef.Context.getCanonicalType(
7324+ RemoveAddressSpaceFromPtr(SemaRef, ExpectedPtrTy->getTypePtr()));
7325+ }
7326 }
7327
7328 // Check that the result type is what we expect.
7329@@ -15261,6 +15266,11 @@ CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl,
7330 FnDecl->getParamDecl(0)->getType()->getAs<PointerType>()) {
7331 FirstParamType = RemoveAddressSpaceFromPtr(SemaRef, PtrTy);
7332 }
7333+ if (CanQual<PointerType> ExpectedPtrTy =
7334+ ExpectedFirstParamType->getAs<PointerType>()) {
7335+ ExpectedFirstParamType = SemaRef.Context.getCanonicalType(
7336+ RemoveAddressSpaceFromPtr(SemaRef, ExpectedPtrTy->getTypePtr()));
7337+ }
7338 }
7339
7340 // Check that the first parameter type is what we expect.
7341diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
7342index bcbecd545398..40eaebbc9495 100644
7343--- a/clang/lib/Sema/SemaLookup.cpp
7344+++ b/clang/lib/Sema/SemaLookup.cpp
7345@@ -775,19 +775,20 @@ static void InsertOCLBuiltinDeclarationsFromTable(Sema &S, LookupResult &LR,
7346 // as argument. Only meaningful for generic types, otherwise equals 1.
7347 unsigned GenTypeMaxCnt;
7348
7349+ ASTContext &Context = S.Context;
7350+
7351+ // Ignore this BIF if its version does not match the language options.
7352+ unsigned OpenCLVersion = Context.getLangOpts().OpenCLVersion;
7353+ if (Context.getLangOpts().OpenCLCPlusPlus)
7354+ OpenCLVersion = 200;
7355+
7356+ unsigned short VersionCode = OpenCLOptions::EncodeVersion(OpenCLVersion);
7357+
7358 for (unsigned SignatureIndex = 0; SignatureIndex < Len; SignatureIndex++) {
7359 const OpenCLBuiltinStruct &OpenCLBuiltin =
7360 BuiltinTable[FctIndex + SignatureIndex];
7361- ASTContext &Context = S.Context;
7362
7363- // Ignore this BIF if its version does not match the language options.
7364- unsigned OpenCLVersion = Context.getLangOpts().OpenCLVersion;
7365- if (Context.getLangOpts().OpenCLCPlusPlus)
7366- OpenCLVersion = 200;
7367- if (OpenCLVersion < OpenCLBuiltin.MinVersion)
7368- continue;
7369- if ((OpenCLBuiltin.MaxVersion != 0) &&
7370- (OpenCLVersion >= OpenCLBuiltin.MaxVersion))
7371+ if (!(OpenCLBuiltin.AllVersions & VersionCode))
7372 continue;
7373
7374 SmallVector<QualType, 1> RetTypes;
7375diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
7376index cc151a048b98..f380a5656a57 100644
7377--- a/clang/lib/Sema/SemaType.cpp
7378+++ b/clang/lib/Sema/SemaType.cpp
7379@@ -2042,7 +2042,7 @@ static QualType deduceOpenCLPointeeAddrSpace(Sema &S, QualType PointeeType) {
7380 !PointeeType.hasAddressSpace())
7381 PointeeType = S.getASTContext().getAddrSpaceQualType(
7382 PointeeType,
7383- S.getLangOpts().OpenCLCPlusPlus || S.getLangOpts().OpenCLVersion == 200
7384+ S.getOpenCLOptions().isEnabled("__opencl_c_generic_address_space")
7385 ? LangAS::opencl_generic
7386 : LangAS::opencl_private);
7387 return PointeeType;
7388@@ -5316,9 +5316,15 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
7389 }
7390
7391 case DeclaratorChunk::Pipe: {
7392- T = S.BuildReadPipeType(T, DeclType.Loc);
7393- processTypeAttrs(state, T, TAL_DeclSpec,
7394- D.getMutableDeclSpec().getAttributes());
7395+ if (S.getOpenCLOptions().isEnabled("__opencl_c_pipes")) {
7396+ T = S.BuildReadPipeType(T, DeclType.Loc);
7397+ processTypeAttrs(state, T, TAL_DeclSpec,
7398+ D.getMutableDeclSpec().getAttributes());
7399+ } else {
7400+ D.setInvalidType(true);
7401+ T = Context.IntTy;
7402+ S.Diag(D.getIdentifierLoc(), diag::err_opencl_pipes_require_feat);
7403+ }
7404 break;
7405 }
7406 }
7407diff --git a/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl b/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
7408index e1f3f6fe1419..b43d9df5935c 100644
7409--- a/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
7410+++ b/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
7411@@ -2,7 +2,8 @@
7412 // RUN: %clang_cc1 %s -emit-llvm -o - -O0 -triple amdgcn | FileCheck -enable-var-scope -check-prefixes=ALL,AMDGCN %s
7413 // RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL2.0 -O0 -triple amdgcn | FileCheck -enable-var-scope -check-prefixes=ALL,AMDGCN,AMDGCN20 %s
7414 // 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
7415-
7416+// 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
7417+// 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
7418 typedef int int2 __attribute__((ext_vector_type(2)));
7419
7420 typedef struct {
7421@@ -39,7 +40,7 @@ struct LargeStructTwoMember {
7422 int2 y[20];
7423 };
7424
7425-#if __OPENCL_C_VERSION__ >= 200
7426+#ifdef __opencl_c_program_scope_global_variables
7427 struct LargeStructOneMember g_s;
7428 #endif
7429
7430@@ -98,7 +99,7 @@ void FuncOneLargeMember(struct LargeStructOneMember u) {
7431 // AMDGCN20: %[[r0:.*]] = bitcast %struct.LargeStructOneMember addrspace(5)* %[[byval_temp]] to i8 addrspace(5)*
7432 // 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)
7433 // AMDGCN20: call void @FuncOneLargeMember(%struct.LargeStructOneMember addrspace(5)* byval(%struct.LargeStructOneMember) align 8 %[[byval_temp]])
7434-#if __OPENCL_C_VERSION__ >= 200
7435+#ifdef __opencl_c_program_scope_global_variables
7436 void test_indirect_arg_globl(void) {
7437 FuncOneLargeMember(g_s);
7438 }
7439diff --git a/clang/test/CodeGenOpenCL/address-spaces-conversions.cl b/clang/test/CodeGenOpenCL/address-spaces-conversions.cl
7440index 52feccc540bb..9ecffcca5ee9 100644
7441--- a/clang/test/CodeGenOpenCL/address-spaces-conversions.cl
7442+++ b/clang/test/CodeGenOpenCL/address-spaces-conversions.cl
7443@@ -1,5 +1,7 @@
7444 // RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -O0 -ffake-address-space-map -cl-std=CL2.0 -emit-llvm -o - | FileCheck %s
7445+// 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
7446 // RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -O0 -cl-std=CL2.0 -emit-llvm -o - | FileCheck --check-prefix=CHECK-NOFAKE %s
7447+// 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
7448 // When -ffake-address-space-map is not used, all addr space mapped to 0 for x86_64.
7449
7450 // test that we generate address space casts everywhere we need conversions of
7451diff --git a/clang/test/CodeGenOpenCL/address-spaces-mangling.cl b/clang/test/CodeGenOpenCL/address-spaces-mangling.cl
7452index 50622f099143..e19ec8451d0d 100644
7453--- a/clang/test/CodeGenOpenCL/address-spaces-mangling.cl
7454+++ b/clang/test/CodeGenOpenCL/address-spaces-mangling.cl
7455@@ -6,6 +6,7 @@
7456 // We check that the address spaces are mangled the same in both version of OpenCL
7457 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL2.0 -emit-llvm -o - | FileCheck -check-prefix=OCL-20 %s
7458 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -emit-llvm -o - | FileCheck -check-prefix=OCL-12 %s
7459+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL3.0 -emit-llvm -o - | FileCheck -check-prefix=OCL-12 %s
7460
7461 // We can't name this f as private is equivalent to default
7462 // no specifier given address space so we get multiple definition
7463@@ -47,7 +48,7 @@ void f(constant int *arg) { }
7464 // OCL-20-DAG: @_Z1fPU3AS2i
7465 // OCL-12-DAG: @_Z1fPU3AS2i
7466
7467-#if __OPENCL_C_VERSION__ >= 200
7468+#if __OPENCL_C_VERSION__ == 200
7469 __attribute__((overloadable))
7470 void f(generic int *arg) { }
7471 // ASMANG20: @_Z1fPU3AS4i
7472diff --git a/clang/test/CodeGenOpenCL/address-spaces.cl b/clang/test/CodeGenOpenCL/address-spaces.cl
7473index 144466a690b3..b150e1080b53 100644
7474--- a/clang/test/CodeGenOpenCL/address-spaces.cl
7475+++ b/clang/test/CodeGenOpenCL/address-spaces.cl
7476@@ -1,9 +1,13 @@
7477 // RUN: %clang_cc1 %s -O0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,SPIR
7478+// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,SPIR
7479 // RUN: %clang_cc1 %s -O0 -DCL20 -cl-std=CL2.0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s --check-prefixes=CL20,CL20SPIR
7480 // RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
7481+// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -triple amdgcn-amd-amdhsa -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
7482 // RUN: %clang_cc1 %s -O0 -triple amdgcn-amd-amdhsa -DCL20 -cl-std=CL2.0 -emit-llvm -o - | FileCheck %s --check-prefixes=CL20,CL20AMDGCN
7483 // RUN: %clang_cc1 %s -O0 -triple amdgcn-mesa-mesa3d -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
7484+// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -triple amdgcn-mesa-mesa3d -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
7485 // RUN: %clang_cc1 %s -O0 -triple r600-- -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
7486+// RUN: %clang_cc1 %s -O0 -cl-std=CL3.0 -triple r600-- -emit-llvm -o - | FileCheck --check-prefixes=CHECK,AMDGCN %s
7487
7488 // SPIR: %struct.S = type { i32, i32, i32* }
7489 // CL20SPIR: %struct.S = type { i32, i32, i32 addrspace(4)* }
7490diff --git a/clang/test/CodeGenOpenCL/amdgcn-automatic-variable.cl b/clang/test/CodeGenOpenCL/amdgcn-automatic-variable.cl
7491index 7216cb517495..8d3b30fe8074 100644
7492--- a/clang/test/CodeGenOpenCL/amdgcn-automatic-variable.cl
7493+++ b/clang/test/CodeGenOpenCL/amdgcn-automatic-variable.cl
7494@@ -1,4 +1,5 @@
7495 // RUN: %clang_cc1 -O0 -cl-std=CL1.2 -triple amdgcn---amdgizcl -emit-llvm %s -o - | FileCheck -check-prefixes=CHECK,CL12 %s
7496+// RUN: %clang_cc1 -O0 -cl-std=CL3.0 -triple amdgcn---amdgizcl -emit-llvm %s -o - | FileCheck -check-prefixes=CHECK,CL12 %s
7497 // RUN: %clang_cc1 -O0 -cl-std=CL2.0 -triple amdgcn---amdgizcl -emit-llvm %s -o - | FileCheck -check-prefixes=CHECK,CL20 %s
7498
7499 // CL12-LABEL: define void @func1(i32 addrspace(5)* %x)
7500diff --git a/clang/test/CodeGenOpenCL/amdgpu-sizeof-alignof.cl b/clang/test/CodeGenOpenCL/amdgpu-sizeof-alignof.cl
7501index a5d438933fa4..8073c7756eb6 100644
7502--- a/clang/test/CodeGenOpenCL/amdgpu-sizeof-alignof.cl
7503+++ b/clang/test/CodeGenOpenCL/amdgpu-sizeof-alignof.cl
7504@@ -4,6 +4,17 @@
7505 // RUN: %clang_cc1 -triple amdgcn---opencl -cl-std=CL2.0 %s -emit-llvm -o - | FileCheck %s
7506 // RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-std=CL1.2 %s -emit-llvm -o - | FileCheck %s
7507 // RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-std=CL2.0 %s -emit-llvm -o - | FileCheck %s
7508+// RUN: %clang_cc1 -triple r600 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7509+// RUN: %clang_cc1 -triple amdgcn-mesa-mesa3d -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7510+// RUN: %clang_cc1 -triple amdgcn---opencl -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7511+// RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7512+// RUN: %clang_cc1 -triple amdgcn-mesa-mesa3d -cl-ext=__opencl_c_generic_address_space -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7513+// RUN: %clang_cc1 -triple amdgcn---opencl -cl-ext=__opencl_c_generic_address_space -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7514+// RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-ext=__opencl_c_generic_address_space -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7515+// RUN: %clang_cc1 -triple r600 -cl-ext=__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7516+// RUN: %clang_cc1 -triple amdgcn-mesa-mesa3d -cl-ext=__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7517+// RUN: %clang_cc1 -triple amdgcn---opencl -cl-ext=__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7518+// RUN: %clang_cc1 -triple amdgcn---amdgizcl -cl-ext=__opencl_c_fp64 -cl-std=CL3.0 %s -emit-llvm -o - | FileCheck %s
7519
7520 #ifdef __AMDGCN__
7521 #define PTSIZE 8
7522@@ -11,7 +22,7 @@
7523 #define PTSIZE 4
7524 #endif
7525
7526-#ifdef cl_khr_fp64
7527+#if defined(cl_khr_fp64) || defined(__opencl_c_fp64)
7528 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
7529 #endif
7530 #ifdef cl_khr_fp16
7531@@ -59,8 +70,12 @@ void test() {
7532 check(__alignof__(double) == 8);
7533 #endif
7534
7535- check(sizeof(void*) == (__OPENCL_C_VERSION__ >= 200 ? 8 : 4));
7536- check(__alignof__(void*) == (__OPENCL_C_VERSION__ >= 200 ? 8 : 4));
7537+ check(sizeof(private void*) == 4);
7538+ check(__alignof__(private void*) == 4);
7539+#ifdef __opencl_c_generic_address_space
7540+ check(sizeof(generic void*) == 8);
7541+ check(__alignof__(generic void*) == 8);
7542+#endif
7543 check(sizeof(global_ptr_t) == PTSIZE);
7544 check(__alignof__(global_ptr_t) == PTSIZE);
7545 check(sizeof(constant_ptr_t) == PTSIZE);
7546diff --git a/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl b/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl
7547index d1ab6aceac5c..70c5bace023b 100644
7548--- a/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl
7549+++ b/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl
7550@@ -1,4 +1,5 @@
7551 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -finclude-default-header -cl-std=CL1.2 -emit-llvm -o - -O0 | FileCheck %s
7552+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -finclude-default-header -cl-std=CL3.0 -emit-llvm -o - -O0 | FileCheck %s
7553
7554 #pragma OPENCL EXTENSION cl_arm_integer_dot_product_int8 : enable
7555 void test_int8(uchar4 ua, uchar4 ub, char4 sa, char4 sb) {
7556diff --git a/clang/test/CodeGenOpenCL/cl-uniform-wg-size.cl b/clang/test/CodeGenOpenCL/cl-uniform-wg-size.cl
7557index 76ace5dca21e..5dc43e222f75 100644
7558--- a/clang/test/CodeGenOpenCL/cl-uniform-wg-size.cl
7559+++ b/clang/test/CodeGenOpenCL/cl-uniform-wg-size.cl
7560@@ -1,6 +1,8 @@
7561 // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL1.2 -o - %s 2>&1 | FileCheck %s -check-prefixes CHECK,CHECK-UNIFORM
7562 // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s 2>&1 | FileCheck %s -check-prefixes CHECK,CHECK-NONUNIFORM
7563 // 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
7564+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL3.0 -o - %s 2>&1 | FileCheck %s -check-prefixes CHECK,CHECK-NONUNIFORM
7565+// 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
7566
7567 kernel void ker() {};
7568 // CHECK: define{{.*}}@ker() #0
7569diff --git a/clang/test/CodeGenOpenCL/fpmath.cl b/clang/test/CodeGenOpenCL/fpmath.cl
7570index 0108d909c94e..b28392739c71 100644
7571--- a/clang/test/CodeGenOpenCL/fpmath.cl
7572+++ b/clang/test/CodeGenOpenCL/fpmath.cl
7573@@ -2,6 +2,8 @@
7574 // 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
7575 // 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
7576 // RUN: %clang_cc1 %s -emit-llvm -o - -DFP64 -cl-std=CL1.2 -triple spir-unknown-unknown -pedantic | FileCheck --check-prefix=CHECK-DBL %s
7577+// 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
7578+// 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
7579
7580 typedef __attribute__(( ext_vector_type(4) )) float float4;
7581
7582diff --git a/clang/test/CodeGenOpenCL/generic-address-space-feature.cl b/clang/test/CodeGenOpenCL/generic-address-space-feature.cl
7583new file mode 100644
7584index 000000000000..890860abe4d9
7585--- /dev/null
7586+++ b/clang/test/CodeGenOpenCL/generic-address-space-feature.cl
7587@@ -0,0 +1,28 @@
7588+// 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
7589+// 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
7590+// 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
7591+// 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
7592+// 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
7593+// 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
7594+// 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
7595+// 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
7596+
7597+void test(global float* src1, local float *src2, private float *src3, float *src4, float tmp) {
7598+ // CL20: %{{.+}} = addrspacecast float addrspace(1)* %{{.+}} to float addrspace(4)*
7599+ // CL12-NOT: addrspacecast
7600+ // CL30-NOT: addrspacecast
7601+ // CL30-GENERIC-NOT: addrspacecast
7602+ tmp = sincos(tmp, src1);
7603+ // CL20: %{{.+}} = addrspacecast float addrspace(3)* %{{.+}} to float addrspace(4)*
7604+ // CL12-NOT: addrspacecast
7605+ // CL30-NOT: addrspacecast
7606+ // CL30-GENERIC-NOT: addrspacecast
7607+ tmp = sincos(tmp, src2);
7608+
7609+ // CL12: %{{.+}} = call {{(spir_func )?}}float [[FUNCNAME:@.*sincos.*]](float %{{.+}}, float* {{.+}})
7610+ // CL20: %{{.+}} = call {{(spir_func )?}}float [[FUNCNAME:@.*sincos.*]](float %{{.+}}, float addrspace(4)* {{.+}})
7611+ // CL30: %{{.+}} = call {{(spir_func )?}}float [[FUNCNAME:@.*sincos.*]](float %{{.+}}, float* {{.+}})
7612+ // CL30-GENERIC: %{{.+}} = call {{(spir_func )?}}float [[FUNCNAME:@.*sincos.*]](float %{{.+}}, float addrspace(4)* {{.+}})
7613+ // CHECK: addrspacecast
7614+ tmp = sincos(tmp, src4);
7615+}
7616diff --git a/clang/test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl b/clang/test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl
7617index 515f13f6e768..5aa31ac6f345 100644
7618--- a/clang/test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl
7619+++ b/clang/test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl
7620@@ -1,4 +1,5 @@
7621 // 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
7622+// 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
7623
7624 // CHECK: %opencl.intel_sub_group_avc_mce_payload_t = type opaque
7625 // CHECK: %opencl.intel_sub_group_avc_ime_payload_t = type opaque
7626diff --git a/clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl b/clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl
7627index e89237623478..3d6708ac361f 100644
7628--- a/clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl
7629+++ b/clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl
7630@@ -1,5 +1,8 @@
7631 // RUN: %clang_cc1 %s -cl-std=CL1.2 -emit-llvm -triple x86_64-unknown-unknown -o - | FileCheck %s
7632 // RUN: %clang_cc1 %s -cl-std=CL1.2 -emit-llvm -triple amdgcn-unknown-unknown -o - | FileCheck -check-prefixes=AMDGCN %s
7633+// RUN: %clang_cc1 %s -cl-std=CL3.0 -cl-ext=__opencl_c_fp64 -emit-llvm -triple x86_64-unknown-unknown -o - | FileCheck %s
7634+// 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
7635+
7636 // Test that the kernels always use the SPIR calling convention
7637 // to have unambiguous mapping of arguments to feasibly implement
7638 // clSetKernelArg().
7639diff --git a/clang/test/CodeGenOpenCL/logical-ops.cl b/clang/test/CodeGenOpenCL/logical-ops.cl
7640index f083a8580ee7..499eab65039b 100644
7641--- a/clang/test/CodeGenOpenCL/logical-ops.cl
7642+++ b/clang/test/CodeGenOpenCL/logical-ops.cl
7643@@ -1,4 +1,5 @@
7644 // RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=CL1.2 -O1 -triple x86_64-unknown-linux-gnu | FileCheck %s
7645+// 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
7646 // RUN: %clang_cc1 %s -emit-llvm -o - -cl-std=clc++ -O1 -triple x86_64-unknown-linux-gnu | FileCheck %s
7647
7648 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
7649diff --git a/clang/test/CodeGenOpenCL/no-half.cl b/clang/test/CodeGenOpenCL/no-half.cl
7650index aee8f678f01a..46da7fa339e8 100644
7651--- a/clang/test/CodeGenOpenCL/no-half.cl
7652+++ b/clang/test/CodeGenOpenCL/no-half.cl
7653@@ -1,6 +1,7 @@
7654 // RUN: %clang_cc1 %s -cl-std=cl2.0 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
7655 // RUN: %clang_cc1 %s -cl-std=cl1.2 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
7656 // RUN: %clang_cc1 %s -cl-std=cl1.1 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
7657+// RUN: %clang_cc1 %s -cl-std=cl3.0 -cl-ext=__opencl_c_fp64 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
7658
7659 #pragma OPENCL EXTENSION cl_khr_fp64:enable
7660
7661diff --git a/clang/test/CodeGenOpenCL/pipe_builtin.cl b/clang/test/CodeGenOpenCL/pipe_builtin.cl
7662index 02b9669b7ab1..0bf35c336199 100644
7663--- a/clang/test/CodeGenOpenCL/pipe_builtin.cl
7664+++ b/clang/test/CodeGenOpenCL/pipe_builtin.cl
7665@@ -1,4 +1,7 @@
7666 // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -cl-ext=+cl_khr_subgroups -O0 -cl-std=clc++ -o - %s | FileCheck %s
7667+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -cl-ext=+cl_khr_subgroups -O0 -cl-std=cl2.0 -o - %s | FileCheck %s
7668+// 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
7669+
7670 // FIXME: Add MS ABI manglings of OpenCL things and remove %itanium_abi_triple
7671 // above to support OpenCL in the MS C++ ABI.
7672
7673diff --git a/clang/test/CodeGenOpenCL/pipe_types.cl b/clang/test/CodeGenOpenCL/pipe_types.cl
7674index ba064c6d7557..b7a523d4f084 100644
7675--- a/clang/test/CodeGenOpenCL/pipe_types.cl
7676+++ b/clang/test/CodeGenOpenCL/pipe_types.cl
7677@@ -1,4 +1,5 @@
7678 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
7679+// 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
7680
7681 // CHECK: %opencl.pipe_ro_t = type opaque
7682 // CHECK: %opencl.pipe_wo_t = type opaque
7683diff --git a/clang/test/CodeGenOpenCL/printf.cl b/clang/test/CodeGenOpenCL/printf.cl
7684index fc139d776db6..0133c5595d81 100644
7685--- a/clang/test/CodeGenOpenCL/printf.cl
7686+++ b/clang/test/CodeGenOpenCL/printf.cl
7687@@ -1,5 +1,7 @@
7688 // 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
7689 // 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
7690+// 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
7691+// RUN: %clang_cc1 -cl-std=CL3.0 -triple spir-unknown-unknown -disable-llvm-passes -emit-llvm -o - %s | FileCheck -check-prefixes=NOFP64,ALL %s
7692
7693 typedef __attribute__((ext_vector_type(2))) float float2;
7694 typedef __attribute__((ext_vector_type(2))) half half2;
7695diff --git a/clang/test/CodeGenOpenCL/unroll-hint.cl b/clang/test/CodeGenOpenCL/unroll-hint.cl
7696index 0f84450a1ae6..9347c935869b 100644
7697--- a/clang/test/CodeGenOpenCL/unroll-hint.cl
7698+++ b/clang/test/CodeGenOpenCL/unroll-hint.cl
7699@@ -1,5 +1,6 @@
7700 // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
7701 // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL1.2 -o - %s | FileCheck %s
7702+// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL3.0 -o - %s | FileCheck %s
7703
7704 /*** for ***/
7705 void for_count()
7706diff --git a/clang/test/Driver/autocomplete.c b/clang/test/Driver/autocomplete.c
7707index 18b31320ea80..a6e7be887c8c 100644
7708--- a/clang/test/Driver/autocomplete.c
7709+++ b/clang/test/Driver/autocomplete.c
7710@@ -43,6 +43,8 @@
7711 // CLSTDALL-NEXT: CL1.2
7712 // CLSTDALL-NEXT: cl2.0
7713 // CLSTDALL-NEXT: CL2.0
7714+// CLSTDALL-NEXT: cl3.0
7715+// CLSTDALL-NEXT: CL3.0
7716 // CLSTDALL-NEXT: clc++
7717 // CLSTDALL-NEXT: CLC++
7718 // RUN: %clang --autocomplete=-fno-sanitize-coverage=,f | FileCheck %s -check-prefix=FNOSANICOVER
7719diff --git a/clang/test/Driver/opencl.cl b/clang/test/Driver/opencl.cl
7720index 05588f2c8b81..cc0a9143ab37 100644
7721--- a/clang/test/Driver/opencl.cl
7722+++ b/clang/test/Driver/opencl.cl
7723@@ -2,6 +2,7 @@
7724 // RUN: %clang -S -### -cl-std=CL1.1 %s 2>&1 | FileCheck --check-prefix=CHECK-CL11 %s
7725 // RUN: %clang -S -### -cl-std=CL1.2 %s 2>&1 | FileCheck --check-prefix=CHECK-CL12 %s
7726 // RUN: %clang -S -### -cl-std=CL2.0 %s 2>&1 | FileCheck --check-prefix=CHECK-CL20 %s
7727+// RUN: %clang -S -### -cl-std=CL3.0 %s 2>&1 | FileCheck --check-prefix=CHECK-CL30 %s
7728 // RUN: %clang -S -### -cl-std=clc++ %s 2>&1 | FileCheck --check-prefix=CHECK-CLCPP %s
7729 // RUN: %clang -S -### -cl-opt-disable %s 2>&1 | FileCheck --check-prefix=CHECK-OPT-DISABLE %s
7730 // RUN: %clang -S -### -cl-strict-aliasing %s 2>&1 | FileCheck --check-prefix=CHECK-STRICT-ALIASING %s
7731@@ -22,6 +23,7 @@
7732 // CHECK-CL11: "-cc1" {{.*}} "-cl-std=CL1.1"
7733 // CHECK-CL12: "-cc1" {{.*}} "-cl-std=CL1.2"
7734 // CHECK-CL20: "-cc1" {{.*}} "-cl-std=CL2.0"
7735+// CHECK-CL30: "-cc1" {{.*}} "-cl-std=CL3.0"
7736 // CHECK-CLCPP: "-cc1" {{.*}} "-cl-std=clc++"
7737 // CHECK-OPT-DISABLE: "-cc1" {{.*}} "-cl-opt-disable"
7738 // CHECK-STRICT-ALIASING: "-cc1" {{.*}} "-cl-strict-aliasing"
7739diff --git a/clang/test/Driver/unknown-std.cl b/clang/test/Driver/unknown-std.cl
7740index 6f371bac13ac..00209fb62556 100644
7741--- a/clang/test/Driver/unknown-std.cl
7742+++ b/clang/test/Driver/unknown-std.cl
7743@@ -10,6 +10,7 @@
7744 // CHECK-NEXT: note: use 'cl1.1' for 'OpenCL 1.1' standard
7745 // CHECK-NEXT: note: use 'cl1.2' for 'OpenCL 1.2' standard
7746 // CHECK-NEXT: note: use 'cl2.0' for 'OpenCL 2.0' standard
7747+// CHECK-NEXT: note: use 'cl3.0' for 'OpenCL 3.0' standard
7748 // CHECK-NEXT: note: use 'clc++' for 'C++ for OpenCL' standard
7749
7750 // Make sure that no other output is present.
7751diff --git a/clang/test/Frontend/stdlang.c b/clang/test/Frontend/stdlang.c
7752index 51484999e37a..eac4632fbdd6 100644
7753--- a/clang/test/Frontend/stdlang.c
7754+++ b/clang/test/Frontend/stdlang.c
7755@@ -9,6 +9,7 @@
7756 // RUN: %clang_cc1 -x cl -cl-std=CL1.1 -DOPENCL %s
7757 // RUN: %clang_cc1 -x cl -cl-std=CL1.2 -DOPENCL %s
7758 // RUN: %clang_cc1 -x cl -cl-std=CL2.0 -DOPENCL %s
7759+// RUN: %clang_cc1 -x cl -cl-std=CL3.0 -DOPENCL %s
7760 // RUN: %clang_cc1 -x cl -cl-std=CLC++ -DOPENCL %s
7761 // RUN: not %clang_cc1 -x cl -std=c99 -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-C99 %s
7762 // RUN: not %clang_cc1 -x cl -cl-std=invalid -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID %s
7763diff --git a/clang/test/Headers/opencl-c-header.cl b/clang/test/Headers/opencl-c-header.cl
7764index 1b151ffdd16a..2716076acdcf 100644
7765--- a/clang/test/Headers/opencl-c-header.cl
7766+++ b/clang/test/Headers/opencl-c-header.cl
7767@@ -1,6 +1,7 @@
7768 // RUN: %clang_cc1 -O0 -triple spir-unknown-unknown -internal-isystem ../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -verify | FileCheck %s
7769 // 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
7770 // 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
7771+// 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
7772 // 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
7773
7774 // Test including the default header as a module.
7775@@ -39,9 +40,11 @@
7776 // RUN: rm -rf %t
7777 // RUN: mkdir -p %t
7778 // 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
7779+// 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
7780 // 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
7781 // RUN: chmod u-w %t
7782 // 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
7783+// 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
7784 // 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
7785 // RUN: chmod u+w %t
7786
7787@@ -67,7 +70,7 @@ char f(char x) {
7788 // from OpenCL 2.0 onwards.
7789
7790 // CHECK20: _Z12write_imagef14ocl_image3d_wo
7791-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
7792+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
7793 void test_image3dwo(write_only image3d_t img) {
7794 write_imagef(img, (0), (0.0f));
7795 }
7796@@ -81,7 +84,7 @@ void test_atomics(__generic volatile unsigned int* a) {
7797 #endif
7798
7799 // Verify that ATOMIC_VAR_INIT is defined.
7800-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
7801+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
7802 global atomic_int z = ATOMIC_VAR_INIT(99);
7803 #endif //__OPENCL_C_VERSION__
7804
7805diff --git a/clang/test/Index/pipe-size.cl b/clang/test/Index/pipe-size.cl
7806index 94a1255f0a48..59b76051eda1 100644
7807--- a/clang/test/Index/pipe-size.cl
7808+++ b/clang/test/Index/pipe-size.cl
7809@@ -2,6 +2,13 @@
7810 // RUN: %clang_cc1 -x cl -O0 -cl-std=CL2.0 -emit-llvm -triple spir-unknown-unknown %s -o - | FileCheck %s --check-prefix=SPIR
7811 // RUN: %clang_cc1 -x cl -O0 -cl-std=CL2.0 -emit-llvm -triple spir64-unknown-unknown %s -o - | FileCheck %s --check-prefix=SPIR64
7812 // RUN: %clang_cc1 -x cl -O0 -cl-std=CL2.0 -emit-llvm -triple amdgcn-amd-amdhsa %s -o - | FileCheck %s --check-prefix=AMDGCN
7813+// 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
7814+// 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
7815+// 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
7816+// 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
7817+
7818+
7819+
7820 __kernel void testPipe( pipe int test )
7821 {
7822 int s = sizeof(test);
7823diff --git a/clang/test/Preprocessor/init-aarch64.c b/clang/test/Preprocessor/init-aarch64.c
7824index df2a6128989b..cbb0995b48b0 100644
7825--- a/clang/test/Preprocessor/init-aarch64.c
7826+++ b/clang/test/Preprocessor/init-aarch64.c
7827@@ -109,12 +109,12 @@
7828 // AARCH64-NEXT: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
7829 // AARCH64_CXX-NEXT: #define __GLIBCXX_BITSIZE_INT_N_0 128
7830 // AARCH64_CXX-NEXT: #define __GLIBCXX_TYPE_INT_N_0 __int128
7831-// AARCH64-NEXT: #define __INT16_C_SUFFIX__
7832+// AARCH64-NEXT: #define __INT16_C_SUFFIX__
7833 // AARCH64-NEXT: #define __INT16_FMTd__ "hd"
7834 // AARCH64-NEXT: #define __INT16_FMTi__ "hi"
7835 // AARCH64-NEXT: #define __INT16_MAX__ 32767
7836 // AARCH64-NEXT: #define __INT16_TYPE__ short
7837-// AARCH64-NEXT: #define __INT32_C_SUFFIX__
7838+// AARCH64-NEXT: #define __INT32_C_SUFFIX__
7839 // AARCH64-NEXT: #define __INT32_FMTd__ "d"
7840 // AARCH64-NEXT: #define __INT32_FMTi__ "i"
7841 // AARCH64-NEXT: #define __INT32_MAX__ 2147483647
7842@@ -124,7 +124,7 @@
7843 // AARCH64-NEXT: #define __INT64_FMTi__ "li"
7844 // AARCH64-NEXT: #define __INT64_MAX__ 9223372036854775807L
7845 // AARCH64-NEXT: #define __INT64_TYPE__ long int
7846-// AARCH64-NEXT: #define __INT8_C_SUFFIX__
7847+// AARCH64-NEXT: #define __INT8_C_SUFFIX__
7848 // AARCH64-NEXT: #define __INT8_FMTd__ "hhd"
7849 // AARCH64-NEXT: #define __INT8_FMTi__ "hhi"
7850 // AARCH64-NEXT: #define __INT8_MAX__ 127
7851@@ -238,7 +238,7 @@
7852 // AARCH64-NEXT: #define __STDC_UTF_32__ 1
7853 // AARCH64_C: #define __STDC_VERSION__ 201710L
7854 // AARCH64-NEXT: #define __STDC__ 1
7855-// AARCH64-NEXT: #define __UINT16_C_SUFFIX__
7856+// AARCH64-NEXT: #define __UINT16_C_SUFFIX__
7857 // AARCH64-NEXT: #define __UINT16_FMTX__ "hX"
7858 // AARCH64-NEXT: #define __UINT16_FMTo__ "ho"
7859 // AARCH64-NEXT: #define __UINT16_FMTu__ "hu"
7860@@ -259,7 +259,7 @@
7861 // AARCH64-NEXT: #define __UINT64_FMTx__ "lx"
7862 // AARCH64-NEXT: #define __UINT64_MAX__ 18446744073709551615UL
7863 // AARCH64-NEXT: #define __UINT64_TYPE__ long unsigned int
7864-// AARCH64-NEXT: #define __UINT8_C_SUFFIX__
7865+// AARCH64-NEXT: #define __UINT8_C_SUFFIX__
7866 // AARCH64-NEXT: #define __UINT8_FMTX__ "hhX"
7867 // AARCH64-NEXT: #define __UINT8_FMTo__ "hho"
7868 // AARCH64-NEXT: #define __UINT8_FMTu__ "hhu"
7869@@ -329,7 +329,7 @@
7870 // AARCH64-NEXT: #define __UINT_LEAST8_FMTx__ "hhx"
7871 // AARCH64-NEXT: #define __UINT_LEAST8_MAX__ 255
7872 // AARCH64-NEXT: #define __UINT_LEAST8_TYPE__ unsigned char
7873-// AARCH64-NEXT: #define __USER_LABEL_PREFIX__
7874+// AARCH64-NEXT: #define __USER_LABEL_PREFIX__
7875 // AARCH64-NEXT: #define __VERSION__ "{{.*}}"
7876 // AARCH64-NEXT: #define __WCHAR_MAX__ 4294967295U
7877 // AARCH64-NEXT: #define __WCHAR_TYPE__ unsigned int
7878diff --git a/clang/test/Preprocessor/predefined-macros.c b/clang/test/Preprocessor/predefined-macros.c
7879index 083f0e539d88..6c80517ec4d4 100644
7880--- a/clang/test/Preprocessor/predefined-macros.c
7881+++ b/clang/test/Preprocessor/predefined-macros.c
7882@@ -129,6 +129,8 @@
7883 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL12
7884 // RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=CL2.0 \
7885 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL20
7886+// RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=CL3.0 \
7887+// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL30
7888 // RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-fast-relaxed-math \
7889 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-FRM
7890 // RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=clc++ \
7891@@ -137,26 +139,37 @@
7892 // CHECK-CL10: #define CL_VERSION_1_1 110
7893 // CHECK-CL10: #define CL_VERSION_1_2 120
7894 // CHECK-CL10: #define CL_VERSION_2_0 200
7895+// CHECK-CL10: #define CL_VERSION_3_0 300
7896 // CHECK-CL10: #define __OPENCL_C_VERSION__ 100
7897 // CHECK-CL10-NOT: #define __FAST_RELAXED_MATH__ 1
7898 // CHECK-CL11: #define CL_VERSION_1_0 100
7899 // CHECK-CL11: #define CL_VERSION_1_1 110
7900 // CHECK-CL11: #define CL_VERSION_1_2 120
7901 // CHECK-CL11: #define CL_VERSION_2_0 200
7902+// CHECK-CL11: #define CL_VERSION_3_0 300
7903 // CHECK-CL11: #define __OPENCL_C_VERSION__ 110
7904 // CHECK-CL11-NOT: #define __FAST_RELAXED_MATH__ 1
7905 // CHECK-CL12: #define CL_VERSION_1_0 100
7906 // CHECK-CL12: #define CL_VERSION_1_1 110
7907 // CHECK-CL12: #define CL_VERSION_1_2 120
7908 // CHECK-CL12: #define CL_VERSION_2_0 200
7909+// CHECK-CL12: #define CL_VERSION_3_0 300
7910 // CHECK-CL12: #define __OPENCL_C_VERSION__ 120
7911 // CHECK-CL12-NOT: #define __FAST_RELAXED_MATH__ 1
7912 // CHECK-CL20: #define CL_VERSION_1_0 100
7913 // CHECK-CL20: #define CL_VERSION_1_1 110
7914 // CHECK-CL20: #define CL_VERSION_1_2 120
7915 // CHECK-CL20: #define CL_VERSION_2_0 200
7916+// CHECK-CL20: #define CL_VERSION_3_0 300
7917 // CHECK-CL20: #define __OPENCL_C_VERSION__ 200
7918 // CHECK-CL20-NOT: #define __FAST_RELAXED_MATH__ 1
7919+// CHECK-CL30: #define CL_VERSION_1_0 100
7920+// CHECK-CL30: #define CL_VERSION_1_1 110
7921+// CHECK-CL30: #define CL_VERSION_1_2 120
7922+// CHECK-CL30: #define CL_VERSION_2_0 200
7923+// CHECK-CL30: #define CL_VERSION_3_0 300
7924+// CHECK-CL30: #define __OPENCL_C_VERSION__ 300
7925+// CHECK-CL30-NOT: #define __FAST_RELAXED_MATH__ 1
7926 // CHECK-FRM: #define __FAST_RELAXED_MATH__ 1
7927 // CHECK-CLCPP10: #define __CL_CPP_VERSION_1_0__ 100
7928 // CHECK-CLCPP10: #define __OPENCL_CPP_VERSION__ 100
7929diff --git a/clang/test/Sema/feature-extensions-simult-support.cl b/clang/test/Sema/feature-extensions-simult-support.cl
7930new file mode 100644
7931index 000000000000..0789105002b2
7932--- /dev/null
7933+++ b/clang/test/Sema/feature-extensions-simult-support.cl
7934@@ -0,0 +1,75 @@
7935+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=-cl_khr_fp64
7936+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=+cl_khr_fp64
7937+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=-cl_khr_3d_image_writes
7938+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=+cl_khr_3d_image_writes
7939+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=-cl_khr_subgroups
7940+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2 -cl-ext=+cl_khr_subgroups
7941+
7942+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=-cl_khr_fp64
7943+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_fp64
7944+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=-cl_khr_3d_image_writes
7945+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_3d_image_writes
7946+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=-cl_khr_subgroups
7947+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_subgroups
7948+
7949+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_fp64
7950+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_3d_image_writes
7951+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_subgroups
7952+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_pipes
7953+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_device_enqueue
7954+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_read_write_images
7955+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_fp64,-cl_khr_fp64
7956+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_3d_image_writes,-cl_khr_3d_image_writes
7957+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+__opencl_c_subgroups,-cl_khr_subgroups
7958+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+cl_khr_fp64
7959+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+cl_khr_3d_image_writes
7960+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=+cl_khr_subgroups
7961+
7962+// expected-no-diagnostics
7963+
7964+#ifdef cl_khr_fp64
7965+ #ifndef __opencl_c_fp64
7966+ #error macros were not properly set up
7967+ #endif
7968+#endif
7969+#ifdef __opencl_c_fp64
7970+ #ifndef cl_khr_fp64
7971+ #error macros were not properly set up
7972+ #endif
7973+#endif
7974+
7975+#ifdef cl_khr_3d_image_writes
7976+ #ifndef __opencl_c_3d_image_writes
7977+ #error macros were not properly set up
7978+ #endif
7979+#endif
7980+#ifdef __opencl_c_3d_image_writes
7981+ #ifndef cl_khr_3d_image_writes
7982+ #error macros were not properly set up
7983+ #endif
7984+#endif
7985+
7986+#ifdef cl_khr_subgroups
7987+ #ifndef __opencl_c_subgroups
7988+ #error macros were not properly set up
7989+ #endif
7990+#endif
7991+#ifdef __opencl_c_subgroups
7992+ #ifndef cl_khr_subgroups
7993+ #error macros were not properly set up
7994+ #endif
7995+#endif
7996+
7997+#if defined(__opencl_c_pipes) || defined(__opencl_c_device_enqueue)
7998+ #ifndef __opencl_c_generic_address_space
7999+ #error macros were not properly set up
8000+ #endif
8001+#endif
8002+
8003+#if defined(__opencl_c_3d_image_writes) || defined(__opencl_c_read_write_images)
8004+ #ifndef __opencl_c_images
8005+ #error macros were not properly set up
8006+ #endif
8007+#endif
8008+
8009+kernel void test(){}
8010diff --git a/clang/test/Sema/features-ignore-pragma.cl b/clang/test/Sema/features-ignore-pragma.cl
8011new file mode 100644
8012index 000000000000..046ce5390754
8013--- /dev/null
8014+++ b/clang/test/Sema/features-ignore-pragma.cl
8015@@ -0,0 +1,24 @@
8016+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0
8017+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_fp64
8018+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_subgroups
8019+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_3d_image_writes
8020+
8021+#pragma OPENCL EXTENSION __opencl_c_fp64 : enable
8022+// expected-warning@-1 {{OpenCL feature support can't be controlled via pragma, ignoring}}
8023+
8024+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
8025+#ifndef __opencl_c_fp64
8026+// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_fp64' - ignoring}}
8027+#endif
8028+
8029+#pragma OPENCL EXTENSION cl_khr_subgroups : enable
8030+#ifndef __opencl_c_subgroups
8031+// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_subgroups' - ignoring}}
8032+#endif
8033+
8034+#pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable
8035+#ifndef __opencl_c_3d_image_writes
8036+// expected-warning@-2{{unsupported OpenCL extension 'cl_khr_3d_image_writes' - ignoring}}
8037+#endif
8038+
8039+kernel void foo() {}
8040diff --git a/clang/test/Sema/opencl-features-pipes.cl b/clang/test/Sema/opencl-features-pipes.cl
8041new file mode 100644
8042index 000000000000..c0ac778f24a6
8043--- /dev/null
8044+++ b/clang/test/Sema/opencl-features-pipes.cl
8045@@ -0,0 +1,18 @@
8046+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.1
8047+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.2
8048+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -DHAS
8049+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0
8050+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -DHAS
8051+// expected-no-diagnostics
8052+
8053+#ifdef HAS
8054+ #ifndef __opencl_c_pipes
8055+ #error Feature should be defined
8056+ #endif
8057+#else
8058+ #ifdef __opencl_c_pipes
8059+ #error Feature should not be defined
8060+ #endif
8061+#endif
8062+
8063+kernel void foo() {}
8064diff --git a/clang/test/Sema/opencl-features.cl b/clang/test/Sema/opencl-features.cl
8065new file mode 100644
8066index 000000000000..aa432f6b60bf
8067--- /dev/null
8068+++ b/clang/test/Sema/opencl-features.cl
8069@@ -0,0 +1,128 @@
8070+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
8071+// 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
8072+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CLC++
8073+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0
8074+// expected-no-diagnostics
8075+
8076+#ifndef __opencl_c_int64
8077+ #error Feature __opencl_c_int64 shouldn't be defined
8078+#endif
8079+
8080+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ == CL_VERSION_2_0)
8081+ #ifndef __opencl_c_3d_image_writes
8082+ #error Feature __opencl_c_3d_image_writes should be defined
8083+ #endif
8084+
8085+ #ifndef __opencl_c_atomic_order_acq_rel
8086+ #error Feature __opencl_c_atomic_order_acq_rel should be defined
8087+ #endif
8088+
8089+ #ifndef __opencl_c_atomic_order_seq_cst
8090+ #error Feature __opencl_c_atomic_order_seq_cst should be defined
8091+ #endif
8092+
8093+ #ifndef __opencl_c_atomic_scope_device
8094+ #error Feature __opencl_c_atomic_scope_device should be defined
8095+ #endif
8096+
8097+ #ifndef __opencl_c_atomic_scope_all_devices
8098+ #error Feature __opencl_c_atomic_scope_all_devices should be defined
8099+ #endif
8100+
8101+ #ifndef __opencl_c_device_enqueue
8102+ #error Feature __opencl_c_device_enqueue should be defined
8103+ #endif
8104+
8105+ #ifndef __opencl_c_generic_address_space
8106+ #error Feature __opencl_c_generic_address_space should be defined
8107+ #endif
8108+
8109+ #ifndef __opencl_c_pipes
8110+ #error Feature __opencl_c_pipes should be defined
8111+ #endif
8112+
8113+ #ifndef __opencl_c_program_scope_global_variables
8114+ #error Feature __opencl_c_program_scope_global_variables should be defined
8115+ #endif
8116+
8117+ #ifndef __opencl_c_read_write_images
8118+ #error Feature __opencl_c_read_write_images should be defined
8119+ #endif
8120+
8121+ #ifndef __opencl_c_subgroups
8122+ #error Feature __opencl_c_subgroups should be defined
8123+ #endif
8124+
8125+ #ifndef __opencl_c_work_group_collective_functions
8126+ #error Feature __opencl_c_work_group_collective_functions should be defined
8127+ #endif
8128+
8129+ #ifndef __opencl_c_fp64
8130+ #error Feature __opencl_c_fp64 should be defined
8131+ #endif
8132+
8133+ #ifndef __opencl_c_images
8134+ #error Feature __opencl_c_images should be defined
8135+ #endif
8136+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
8137+
8138+
8139+#if __OPENCL_C_VERSION__ == CL_VERSION_3_0
8140+ #ifdef __opencl_c_3d_image_writes
8141+ #error Feature __opencl_c_3d_image_writes shouldn't be defined
8142+ #endif
8143+
8144+ #ifdef __opencl_c_atomic_order_acq_rel
8145+ #error Feature __opencl_c_atomic_order_acq_rel shouldn't be defined
8146+ #endif
8147+
8148+ #ifdef __opencl_c_atomic_order_seq_cst
8149+ #error Feature __opencl_c_atomic_order_seq_cst shouldn't be defined
8150+ #endif
8151+
8152+ #ifdef __opencl_c_atomic_scope_device
8153+ #error Feature __opencl_c_atomic_scope_device shouldn't be defined
8154+ #endif
8155+
8156+ #ifdef __opencl_c_atomic_scope_all_devices
8157+ #error Feature __opencl_c_atomic_scope_all_devices shouldn't be defined
8158+ #endif
8159+
8160+ #ifdef __opencl_c_device_enqueue
8161+ #error Feature __opencl_c_device_enqueue shouldn't be defined
8162+ #endif
8163+
8164+ #ifdef __opencl_c_generic_address_space
8165+ #error Feature __opencl_c_generic_address_space shouldn't be defined
8166+ #endif
8167+
8168+ #ifdef __opencl_c_pipes
8169+ #error Feature __opencl_c_pipes shouldn't be defined
8170+ #endif
8171+
8172+ #ifdef __opencl_c_program_scope_global_variables
8173+ #error Feature __opencl_c_program_scope_global_variables shouldn't be defined
8174+ #endif
8175+
8176+ #ifdef __opencl_c_read_write_images
8177+ #error Feature __opencl_c_read_write_images shouldn't be defined
8178+ #endif
8179+
8180+ #ifdef __opencl_c_subgroups
8181+ #error Feature __opencl_c_subgroups shouldn't be defined
8182+ #endif
8183+
8184+ #ifdef __opencl_c_work_group_collective_functions
8185+ #error Feature __opencl_c_work_group_collective_functions shouldn't be defined
8186+ #endif
8187+
8188+ #ifdef __opencl_c_fp64
8189+ #error Feature __opencl_c_fp64 shouldn't be defined
8190+ #endif
8191+
8192+ #ifdef __opencl_c_images
8193+ #error Feature __opencl_c_images shouldn't be defined
8194+ #endif
8195+#endif // __OPENCL_C_VERSION__ == CL_VERSION_3_0
8196+
8197+kernel void foo() {}
8198diff --git a/clang/test/Sema/pipe_builtins_feature.cl b/clang/test/Sema/pipe_builtins_feature.cl
8199new file mode 100644
8200index 000000000000..56fa94fc7705
8201--- /dev/null
8202+++ b/clang/test/Sema/pipe_builtins_feature.cl
8203@@ -0,0 +1,21 @@
8204+// RUN: %clang_cc1 -cl-std=CL2.0 -fsyntax-only -verify %s
8205+// RUN: %clang_cc1 -cl-std=CL3.0 -fsyntax-only -verify %s
8206+// RUN: %clang_cc1 -cl-std=CL3.0 -cl-ext=__opencl_c_pipes -fsyntax-only -verify %s
8207+
8208+#ifdef __opencl_c_pipes
8209+ #ifndef __opencl_c_generic_address_space
8210+ #error Generic address space feature must also be defined
8211+ #endif
8212+// CHECK: expected-no-diagnostics
8213+// check that pragma disable all doesn't touch feature support
8214+ #pragma OPENCL EXTENSION all : disable
8215+#endif
8216+
8217+void test(read_only pipe int p, global int *ptr) {
8218+ reserve_id_t rid;
8219+}
8220+
8221+#ifndef __opencl_c_pipes
8222+// expected-error@-5 {{expected parameter declarator}} expected-error@-5 {{expected ')'}} expected-note@-5 {{to match this '('}}
8223+// expected-error@-5 {{use of type 'reserve_id_t' requires __opencl_c_pipes extension to be enabled}}
8224+#endif
8225diff --git a/clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl b/clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
8226index a5a838241347..dbdc5cffd073 100644
8227--- a/clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
8228+++ b/clang/test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
8229@@ -1,6 +1,9 @@
8230 // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std=CL2.0
8231 // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std=CL2.0
8232 // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std=CL2.0
8233+// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space
8234+// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space
8235+// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space
8236 // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std=clc++
8237 // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std=clc++
8238 // RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std=clc++
8239diff --git a/clang/test/SemaOpenCL/address-spaces.cl b/clang/test/SemaOpenCL/address-spaces.cl
8240index e9825fd1682a..563f1e649a82 100644
8241--- a/clang/test/SemaOpenCL/address-spaces.cl
8242+++ b/clang/test/SemaOpenCL/address-spaces.cl
8243@@ -1,5 +1,6 @@
8244 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
8245 // RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only
8246+// RUN: %clang_cc1 %s -cl-std=CL3.0 -cl-ext=__opencl_c_generic_address_space -verify -pedantic -fsyntax-only
8247 // RUN: %clang_cc1 %s -cl-std=clc++ -verify -pedantic -fsyntax-only
8248
8249 __constant int ci = 1;
8250diff --git a/clang/test/SemaOpenCL/cl20-device-side-enqueue.cl b/clang/test/SemaOpenCL/cl20-device-side-enqueue.cl
8251index f63e2913c749..727141190a0b 100644
8252--- a/clang/test/SemaOpenCL/cl20-device-side-enqueue.cl
8253+++ b/clang/test/SemaOpenCL/cl20-device-side-enqueue.cl
8254@@ -2,6 +2,12 @@
8255 // RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir-unknown-unknown" -verify -pedantic -fsyntax-only -DB32 -DQUALS="const volatile"
8256 // RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS=
8257 // RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS="const volatile"
8258+// 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=
8259+// 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"
8260+// 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=
8261+// 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"
8262+
8263+
8264
8265 typedef struct {int a;} ndrange_t;
8266 // Diagnostic tests for different overloads of enqueue_kernel from Table 6.13.17.1 of OpenCL 2.0 Spec.
8267@@ -235,11 +241,17 @@ kernel void bar(global unsigned int *buf)
8268 kernel void foo1(global unsigned int *buf)
8269 {
8270 ndrange_t n;
8271- 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}}
8272+ buf[0] = get_kernel_max_sub_group_size_for_ndrange(n, ^(){});
8273+#if __OPENCL_C_VERSION__ < 300
8274+// expected-error@-2 {{use of declaration 'get_kernel_max_sub_group_size_for_ndrange' requires cl_khr_subgroups extension to be enabled}}
8275+#endif
8276 }
8277
8278 kernel void bar1(global unsigned int *buf)
8279 {
8280 ndrange_t n;
8281- 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}}
8282+ buf[0] = get_kernel_sub_group_count_for_ndrange(n, ^(){});
8283+#if __OPENCL_C_VERSION__ < 300
8284+// expected-error@-2 {{use of declaration 'get_kernel_sub_group_count_for_ndrange' requires cl_khr_subgroups extension to be enabled}}
8285+#endif
8286 }
8287diff --git a/clang/test/SemaOpenCL/forget-unsupported-builtins.cl b/clang/test/SemaOpenCL/forget-unsupported-builtins.cl
8288new file mode 100644
8289index 000000000000..14dd03e2c7db
8290--- /dev/null
8291+++ b/clang/test/SemaOpenCL/forget-unsupported-builtins.cl
8292@@ -0,0 +1,22 @@
8293+// RUN: %clang_cc1 -cl-std=cl3.0 -fsyntax-only -verify %s -triple spir-unknown-unknown
8294+// 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
8295+
8296+#ifndef FEATURES
8297+ // expected-no-diagnostics
8298+#else
8299+ // expected-error@+10 {{cannot redeclare builtin function 'get_pipe_max_packets'}}
8300+ // expected-note@+9 {{'get_pipe_max_packets' is a builtin with type 'unsigned int ()'}}
8301+ // expected-error@+9 {{cannot redeclare builtin function 'to_local'}}
8302+ // expected-note@+8 {{'to_local' is a builtin with type 'void *(void *)'}}
8303+ // expected-error@+8 {{cannot redeclare builtin function 'to_global'}}
8304+ // expected-note@+7 {{'to_global' is a builtin with type 'void *(void *)'}}
8305+ // expected-error@+7 {{cannot redeclare builtin function 'get_kernel_work_group_size'}}
8306+ // expected-note@+6 {{'get_kernel_work_group_size' is a builtin with type 'unsigned int ()'}}
8307+#endif
8308+
8309+int get_pipe_max_packets(int);
8310+int to_local(int);
8311+int to_global(int);
8312+int get_kernel_work_group_size(int);
8313+
8314+kernel void test(global int *dst) {}
8315diff --git a/clang/test/SemaOpenCL/image-features.cl b/clang/test/SemaOpenCL/image-features.cl
8316new file mode 100644
8317index 000000000000..ace6913bb31e
8318--- /dev/null
8319+++ b/clang/test/SemaOpenCL/image-features.cl
8320@@ -0,0 +1,20 @@
8321+// RUN: %clang_cc1 -cl-std=cl2.0 -fsyntax-only -verify %s -triple spir-unknown-unknown
8322+// RUN: %clang_cc1 -cl-std=cl3.0 -cl-ext=__opencl_c_images -fsyntax-only -verify %s -triple spir-unknown-unknown
8323+// RUN: %clang_cc1 -cl-std=cl3.0 -cl-ext=__opencl_c_3d_image_writes -fsyntax-only -verify %s -triple spir-unknown-unknown
8324+// RUN: %clang_cc1 -cl-std=cl3.0 -cl-ext=__opencl_c_read_write_images -fsyntax-only -verify %s -triple spir-unknown-unknown
8325+
8326+#if defined(__opencl_c_read_write_images) && defined(__opencl_c_3d_image_writes)
8327+ // expected-no-diagnostics
8328+#endif
8329+
8330+__kernel void write_3d_image(__write_only image3d_t i) {}
8331+
8332+#ifndef __opencl_c_3d_image_writes
8333+ // expected-error@-3 {{use of type '__write_only image3d_t' requires __opencl_c_3d_image_writes extension to be enabled}}
8334+#endif
8335+
8336+__kernel void read_write_3d_image(__read_write image3d_t i) { }
8337+
8338+#ifndef __opencl_c_read_write_images
8339+ // expected-error@-3 {{use of type '__read_write image3d_t' requires __opencl_c_read_write_images extension to be enabled}}
8340+#endif
8341diff --git a/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl b/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
8342index 36e76621d24a..38b0a04726e3 100644
8343--- a/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
8344+++ b/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl
8345@@ -1,4 +1,5 @@
8346 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -cl-ext=+cl_khr_subgroups
8347+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0 -cl-ext=__opencl_c_subgroups,__opencl_c_pipes
8348
8349 #pragma OPENCL EXTENSION cl_khr_subgroups : enable
8350
8351diff --git a/clang/test/SemaOpenCL/storageclass-cl20.cl b/clang/test/SemaOpenCL/storageclass-cl20.cl
8352index 581701d2a6a5..469c526ebc30 100644
8353--- a/clang/test/SemaOpenCL/storageclass-cl20.cl
8354+++ b/clang/test/SemaOpenCL/storageclass-cl20.cl
8355@@ -1,4 +1,5 @@
8356 // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
8357+// 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
8358
8359 int G2 = 0;
8360 global int G3 = 0;
8361diff --git a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
8362index 7c63cf51ecfa..785ff93aaf85 100644
8363--- a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
8364+++ b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
8365@@ -56,6 +56,7 @@
8366 //===----------------------------------------------------------------------===//
8367
8368 #include "TableGenBackends.h"
8369+#include "clang/Basic/OpenCLOptions.h"
8370 #include "llvm/ADT/MapVector.h"
8371 #include "llvm/ADT/STLExtras.h"
8372 #include "llvm/ADT/SmallString.h"
8373@@ -69,6 +70,7 @@
8374 #include "llvm/TableGen/Record.h"
8375 #include "llvm/TableGen/StringMatcher.h"
8376 #include "llvm/TableGen/TableGenBackend.h"
8377+#include <numeric>
8378 #include <set>
8379
8380 using namespace llvm;
8381@@ -228,6 +230,10 @@ private:
8382 // The function "tan", having the same signatures, would be mapped to the
8383 // same entry (<I1, I2, I3>).
8384 MapVector<BuiltinIndexListTy *, BuiltinTableEntries> SignatureListMap;
8385+
8386+ // Encode all versions
8387+ unsigned short
8388+ EncodeBuiltinVersions(std::vector<Record *> BuiltinVersionsRecords) const;
8389 };
8390 } // namespace
8391
8392@@ -338,12 +344,10 @@ struct OpenCLBuiltinStruct {
8393 const bool IsConst : 1;
8394 // Function attribute __attribute__((convergent))
8395 const bool IsConv : 1;
8396+ // All opencl versions encoded
8397+ const unsigned char AllVersions : 5;
8398 // OpenCL extension(s) required for this overload.
8399 const unsigned short Extension;
8400- // First OpenCL version in which this overload was introduced (e.g. CL20).
8401- const unsigned short MinVersion;
8402- // First OpenCL version in which this overload was removed (e.g. CL20).
8403- const unsigned short MaxVersion;
8404 };
8405
8406 )";
8407@@ -510,11 +514,9 @@ void BuiltinNameEmitter::EmitBuiltinTable() {
8408 << (Overload.first->getValueAsBit("IsPure")) << ", "
8409 << (Overload.first->getValueAsBit("IsConst")) << ", "
8410 << (Overload.first->getValueAsBit("IsConv")) << ", "
8411- << FunctionExtensionIndex[ExtName] << ", "
8412- << Overload.first->getValueAsDef("MinVersion")->getValueAsInt("ID")
8413- << ", "
8414- << Overload.first->getValueAsDef("MaxVersion")->getValueAsInt("ID")
8415- << " },\n";
8416+ << EncodeBuiltinVersions(
8417+ Overload.first->getValueAsListOfDefs("Versions"))
8418+ << ", " << FunctionExtensionIndex[ExtName] << " },\n";
8419 Index++;
8420 }
8421 }
8422@@ -535,10 +537,8 @@ bool BuiltinNameEmitter::CanReuseSignature(
8423 if (Rec->getValueAsBit("IsPure") == Rec2->getValueAsBit("IsPure") &&
8424 Rec->getValueAsBit("IsConst") == Rec2->getValueAsBit("IsConst") &&
8425 Rec->getValueAsBit("IsConv") == Rec2->getValueAsBit("IsConv") &&
8426- Rec->getValueAsDef("MinVersion")->getValueAsInt("ID") ==
8427- Rec2->getValueAsDef("MinVersion")->getValueAsInt("ID") &&
8428- Rec->getValueAsDef("MaxVersion")->getValueAsInt("ID") ==
8429- Rec2->getValueAsDef("MaxVersion")->getValueAsInt("ID") &&
8430+ EncodeBuiltinVersions(Rec->getValueAsListOfDefs("Versions")) ==
8431+ EncodeBuiltinVersions(Rec2->getValueAsListOfDefs("Versions")) &&
8432 Rec->getValueAsDef("Extension")->getName() ==
8433 Rec2->getValueAsDef("Extension")->getName()) {
8434 return true;
8435@@ -814,6 +814,15 @@ static void OCL2Qual(ASTContext &Context, const OpenCLTypeStruct &Ty,
8436 OS << "\n} // OCL2Qual\n";
8437 }
8438
8439+unsigned short BuiltinNameEmitter::EncodeBuiltinVersions(
8440+ std::vector<Record *> BuiltinVersionsRecords) const {
8441+ return std::accumulate(
8442+ BuiltinVersionsRecords.begin(), BuiltinVersionsRecords.end(),
8443+ (unsigned short)0, [](unsigned short C, Record *R) {
8444+ return C |= clang::OpenCLOptions::EncodeVersion(R->getValueAsInt("ID"));
8445+ });
8446+}
8447+
8448 void clang::EmitClangOpenCLBuiltins(RecordKeeper &Records, raw_ostream &OS) {
8449 BuiltinNameEmitter NameChecker(Records, OS);
8450 NameChecker.Emit();
8451--
84522.17.1
8453
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 @@
1From ff0a6da84b94c16c4519c649f1f7bed3cdf89bbb Mon Sep 17 00:00:00 2001
2From: Feng Zou <feng.zou@intel.com>
3Date: Tue, 20 Oct 2020 11:29:04 +0800
4Subject: [PATCH] Remove repo name in LLVM IR
5
6Upstream-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]
7Signed-off-by: Feng Zou <feng.zou@intel.com>
8Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
9
10---
11 llvm/cmake/modules/VersionFromVCS.cmake | 23 ++++++++++++-----------
12 1 file changed, 12 insertions(+), 11 deletions(-)
13
14diff --git a/llvm/cmake/modules/VersionFromVCS.cmake b/llvm/cmake/modules/VersionFromVCS.cmake
15index 18edbeabe3e..2d965263478 100644
16--- a/llvm/cmake/modules/VersionFromVCS.cmake
17+++ b/llvm/cmake/modules/VersionFromVCS.cmake
18@@ -33,17 +33,18 @@ function(get_source_info path revision repository)
19 else()
20 set(remote "origin")
21 endif()
22- execute_process(COMMAND ${GIT_EXECUTABLE} remote get-url ${remote}
23- WORKING_DIRECTORY ${path}
24- RESULT_VARIABLE git_result
25- OUTPUT_VARIABLE git_output
26- ERROR_QUIET)
27- if(git_result EQUAL 0)
28- string(STRIP "${git_output}" git_output)
29- set(${repository} ${git_output} PARENT_SCOPE)
30- else()
31- set(${repository} ${path} PARENT_SCOPE)
32- endif()
33+ # Do not show repo name in IR
34+ # execute_process(COMMAND ${GIT_EXECUTABLE} remote get-url ${remote}
35+ # WORKING_DIRECTORY ${path}
36+ # RESULT_VARIABLE git_result
37+ # OUTPUT_VARIABLE git_output
38+ # ERROR_QUIET)
39+ # if(git_result EQUAL 0)
40+ # string(STRIP "${git_output}" git_output)
41+ # set(${repository} ${git_output} PARENT_SCOPE)
42+ # else()
43+ # set(${repository} ${path} PARENT_SCOPE)
44+ # endif()
45 endif()
46 else()
47 message(WARNING "Git not found. Version cannot be determined.")
48--
492.18.1
50
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 @@
1From d362652617c5e840089273df0c6623a9745c92a2 Mon Sep 17 00:00:00 2001
2From: Naveen Saini <naveen.kumar.saini@intel.com>
3Date: Wed, 21 Aug 2019 14:35:31 +0800
4Subject: [PATCH] llvm-spirv: skip building tests
5
6Some of these need clang to be built and since we're building this in-tree,
7that leads to problems when compiling libcxx, compiler-rt which aren't built
8in-tree.
9
10Instead of using SPIRV_SKIP_CLANG_BUILD to skip clang build and adding this to
11all components, disable the building of tests altogether.
12
13Upstream-Status: Inappropriate
14
15Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
16Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
17---
18 CMakeLists.txt | 10 ----------
19 1 file changed, 10 deletions(-)
20
21diff --git a/CMakeLists.txt b/CMakeLists.txt
22index ecebb4cb..578ca602 100644
23--- a/CMakeLists.txt
24+++ b/CMakeLists.txt
25@@ -25,13 +25,6 @@ if(LLVM_SPIRV_BUILD_EXTERNAL)
26 set(CMAKE_CXX_STANDARD 14)
27 set(CMAKE_CXX_STANDARD_REQUIRED ON)
28
29- if(LLVM_SPIRV_INCLUDE_TESTS)
30- set(LLVM_TEST_COMPONENTS
31- llvm-as
32- llvm-dis
33- )
34- endif(LLVM_SPIRV_INCLUDE_TESTS)
35-
36 find_package(LLVM ${BASE_LLVM_VERSION} REQUIRED
37 COMPONENTS
38 Analysis
39@@ -62,9 +55,6 @@ set(LLVM_SPIRV_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
40
41 add_subdirectory(lib/SPIRV)
42 add_subdirectory(tools/llvm-spirv)
43-if(LLVM_SPIRV_INCLUDE_TESTS)
44- add_subdirectory(test)
45-endif(LLVM_SPIRV_INCLUDE_TESTS)
46
47 install(
48 FILES
49--
502.26.2
51
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 @@
1FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/files:"
2
3SPIRV_BRANCH = "${@bb.utils.contains('LLVMVERSION', '10.0.1', 'llvm_release_100', 'llvm_release_110', d)}"
4
5SPIRV10_SRCREV = "576abae62cecd171992017a4a786e3831221ab8d"
6SPIRV11_SRCREV = "2a8c1e6c9778deaa720a23e08c293006dc5d56fd"
7
8SPIRV_SRCREV = "${@bb.utils.contains('LLVMVERSION', '10.0.1', '${SPIRV10_SRCREV}', '${SPIRV11_SRCREV}', d)}"
9
10SRC_URI_LLVM10 = " \
11 file://llvm10-skip-building-tests.patch;patchdir=llvm/projects/llvm-spirv \
12 file://fix-shared-libs.patch;patchdir=llvm/projects/llvm-spirv \
13 file://BasicBlockUtils-Add-metadata-fixing-in-SplitBlockPre.patch;patchdir=llvm \
14 file://IndVarSimplify-Do-not-use-SCEV-expander-for-IVCount-.patch;patchdir=llvm \
15 file://llvm10-OpenCL-3.0-support.patch \
16 file://0002-Add-cl_khr_extended_subgroup-extensions.patch \
17 file://0001-Memory-leak-fix-for-Managed-Static-Mutex.patch \
18 file://llvm10-Remove-repo-name-in-LLVM-IR.patch \
19 file://0001-Fix-debug-info-of-work-item-builtin-translation-745.patch;patchdir=llvm/projects/llvm-spirv \
20 "
21
22SRC_URI_LLVM11 = " \
23 file://llvm11-skip-building-tests.patch;patchdir=llvm/projects/llvm-spirv \
24 file://llvm11-OpenCL-3.0-support.patch \
25 file://0001-Memory-leak-fix-for-Managed-Static-Mutex.patch \
26 file://llvm11-Remove-repo-name-in-LLVM-IR.patch \
27 "
28
29SPIRV_LLVM_SRC_URI = "git://github.com/KhronosGroup/SPIRV-LLVM-Translator.git;protocol=https;branch=${SPIRV_BRANCH};destsuffix=git/llvm/projects/llvm-spirv;name=spirv"
30
31SPIRV_LLVM_PATCHES = "${@bb.utils.contains('LLVMVERSION', '10.0.1', '${SRC_URI_LLVM10}', '${SRC_URI_LLVM11}', d)}"
32
33
34SRC_URI_append_intel-x86-common = "${@bb.utils.contains('LLVMVERSION', '12.0.0', '', ' ${SPIRV_LLVM_SRC_URI} ${SPIRV_LLVM_PATCHES} ', d)}"
35SRCREV_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 @@
1From 32851d269ac0c027730168c04d9ce32d0eb50905 Mon Sep 17 00:00:00 2001 1From a6361d635e5f3046853883f3ac06fb175116933c Mon Sep 17 00:00:00 2001
2From: Naveen Saini <naveen.kumar.saini@intel.com> 2From: Dongwon Kim <dongwon.kim@intel.com>
3Date: Wed, 27 May 2020 11:12:09 +0000 3Date: Sat, 21 Aug 2021 16:09:39 -0700
4Subject: [PATCH] intel-compute-runtime: allow to find cpp_generation_tool 4Subject: [PATCH] Build not able to locate cpp_generation_tool.
5
6Build not able to locate cpp_generation_tool.
7 5
8Upstream-Status: Inappropriate [oe specific] 6Upstream-Status: Inappropriate [oe specific]
7
9Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> 8Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
9Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
10--- 10---
11 shared/source/built_ins/kernels/CMakeLists.txt | 8 ++++---- 11 shared/source/built_ins/kernels/CMakeLists.txt | 10 +++++-----
12 1 file changed, 4 insertions(+), 4 deletions(-) 12 1 file changed, 5 insertions(+), 5 deletions(-)
13 13
14diff --git a/shared/source/built_ins/kernels/CMakeLists.txt b/shared/source/built_ins/kernels/CMakeLists.txt 14diff --git a/shared/source/built_ins/kernels/CMakeLists.txt b/shared/source/built_ins/kernels/CMakeLists.txt
15index 1b1225077..2e8148c25 100644 15index ed85a37c52..f7c9e79137 100644
16--- a/shared/source/built_ins/kernels/CMakeLists.txt 16--- a/shared/source/built_ins/kernels/CMakeLists.txt
17+++ b/shared/source/built_ins/kernels/CMakeLists.txt 17+++ b/shared/source/built_ins/kernels/CMakeLists.txt
18@@ -93,9 +93,9 @@ function(compile_builtin gen_type platform_type builtin bits builtin_options mod 18@@ -107,9 +107,9 @@ function(compile_builtin core_type platform_it builtin bits builtin_options mode
19 ) 19 )
20 add_custom_command( 20 add_custom_command(
21 OUTPUT ${OUTPUT_FILE_CPP} 21 OUTPUT ${OUTPUT_FILE_CPP}
22- COMMAND $<TARGET_FILE:cpp_generate_tool> --file ${OUTPUTPATH_BASE}.gen --output ${OUTPUT_FILE_CPP} --array ${mode}_${BASENAME} --platform ${family_name_with_type} 22- COMMAND $<TARGET_FILE:cpp_generate_tool> --file ${BINARY_OUTPUT}.bin --output ${OUTPUT_FILE_CPP} --array ${mode}_${BASENAME} --device ${RELEASE_FILENAME}
23+ COMMAND cpp_generate_tool --file ${OUTPUTPATH_BASE}.gen --output ${OUTPUT_FILE_CPP} --array ${mode}_${BASENAME} --platform ${family_name_with_type} 23+ COMMAND cpp_generate_tool --file ${BINARY_OUTPUT}.bin --output ${OUTPUT_FILE_CPP} --array ${mode}_${BASENAME} --device ${RELEASE_FILENAME}
24 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 24 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
25- DEPENDS ${OUTPUTPATH_BASE}.gen $<TARGET_FILE:cpp_generate_tool> 25- DEPENDS ${OUTPUT_FILES_BINARIES} $<TARGET_FILE:cpp_generate_tool>
26+ DEPENDS ${OUTPUTPATH_BASE}.gen cpp_generate_tool 26+ DEPENDS ${OUTPUT_FILES_BINARIES} cpp_generate_tool
27 ) 27 )
28 endfunction() 28 list(APPEND BUILTINS_COMMANDS "${OUTPUT_FILE_CPP}")
29 29 else()
30@@ -136,9 +136,9 @@ function(generate_cpp_spirv builtin) 30@@ -159,9 +159,9 @@ function(generate_cpp_spirv builtin)
31 ) 31 )
32 add_custom_command( 32 add_custom_command(
33 OUTPUT ${OUTPUT_FILE_CPP} 33 OUTPUT ${OUTPUT_FILE_CPP}
34- COMMAND $<TARGET_FILE:cpp_generate_tool> --file ${GENERATED_SPV_INPUT} --output ${OUTPUT_FILE_CPP} --array ${BASENAME} 34- COMMAND $<TARGET_FILE:cpp_generate_tool> --file ${GENERATED_SPV_INPUT} --output ${OUTPUT_FILE_CPP} --array ${BASENAME}
35+ COMMAND cpp_generate_tool --file ${GENERATED_SPV_INPUT} --output ${OUTPUT_FILE_CPP} --array ${BASENAME} 35+ COMMAND cpp_generate_tool --file ${GENERATED_SPV_INPUT} --output ${OUTPUT_FILE_CPP} --array ${BASENAME}
36 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 36 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
37- DEPENDS ${GENERATED_SPV_INPUT} $<TARGET_FILE:cpp_generate_tool> 37- DEPENDS ${GENERATED_SPV_INPUT} $<TARGET_FILE:cpp_generate_tool>
38+ DEPENDS ${GENERATED_SPV_INPUT} cpp_generate_tool 38+ DEPENDS ${GENERATED_SPV_INPUT} cpp_generate_tool
39 )
40 set(OUTPUT_LIST_CPP_FILES ${OUTPUT_LIST_CPP_FILES} ${OUTPUT_FILE_CPP} PARENT_SCOPE)
41 else()
42@@ -277,4 +277,4 @@ if(NOT "${OUTPUT_LIST_CPP_FILES}" STREQUAL "")
39 ) 43 )
40 endfunction() 44 endif()
41 45
46-apply_macro_for_each_core_type("SUPPORTED")
47\ No newline at end of file
48+apply_macro_for_each_core_type("SUPPORTED")
42-- 49--
432.28.0 502.43.2
44 51
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 @@
1Upstream-Status: Inappropriate
2Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
3
4diff --git a/CMakeLists.txt b/CMakeLists.txt
5index d52e089778..bc0cf35014 100644
6--- a/CMakeLists.txt
7+++ b/CMakeLists.txt
8@@ -727,7 +727,7 @@ if(NOT MSVC)
9 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-noexcept-type") # Added for gtest
10 endif()
11 endif()
12- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Werror=vla")
13+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=vla")
14
15 if(USE_SANITIZE_UB)
16 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 @@
1From 1f58c22992ddea4167b01b44448528de427f50d5 Mon Sep 17 00:00:00 2001
2From: Dongwon Kim <dongwon.kim@intel.com>
3Date: Wed, 2 Mar 2022 15:52:45 -0800
4Subject: [PATCH] external ocloc
5
6Upstream-Status: Inappropriate
7
8Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
9---
10 cmake/ocloc_cmd_prefix.cmake | 14 ++++++++------
11 1 file changed, 8 insertions(+), 6 deletions(-)
12
13diff --git a/cmake/ocloc_cmd_prefix.cmake b/cmake/ocloc_cmd_prefix.cmake
14index 2b44330831..03067c9df0 100644
15--- a/cmake/ocloc_cmd_prefix.cmake
16+++ b/cmake/ocloc_cmd_prefix.cmake
17@@ -4,12 +4,14 @@
18 # SPDX-License-Identifier: MIT
19 #
20
21-if(WIN32)
22- set(ocloc_cmd_prefix ocloc)
23-else()
24- if(DEFINED NEO__IGC_LIBRARY_PATH)
25- 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>)
26+if(NOT DEFINED ocloc_cmd_prefix)
27+ if(WIN32)
28+ set(ocloc_cmd_prefix ocloc)
29 else()
30- set(ocloc_cmd_prefix ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$<TARGET_FILE_DIR:ocloc_lib>" $<TARGET_FILE:ocloc>)
31+ if(DEFINED NEO__IGC_LIBRARY_PATH)
32+ set(ocloc_cmd_prefix LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${NEO__IGC_LIBRARY_PATH}:$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
33+ else()
34+ set(ocloc_cmd_prefix LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$<TARGET_FILE_DIR:ocloc_lib> $<TARGET_FILE:ocloc>)
35+ endif()
36 endif()
37 endif()
38--
392.37.3
40
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 @@
1SUMMARY = "The Intel(R) Graphics Compute Runtime for OpenCL(TM)"
2DESCRIPTION = "The Intel(R) Graphics Compute Runtime for OpenCL(TM) \
3is an open source project to converge Intel's development efforts \
4on OpenCL(TM) compute stacks supporting the GEN graphics hardware \
5architecture."
6
7LICENSE = "MIT"
8LIC_FILES_CHKSUM = "file://LICENSE;md5=ae27f47fd6755510247c19e547e4c804 \
9 file://third_party/opencl_headers/LICENSE;md5=dcefc90f4c3c689ec0c2489064e7273b"
10
11SRC_URI = "git://github.com/intel/compute-runtime.git;protocol=https \
12 "
13SRC_URI_append_class-target = " file://allow-to-find-cpp-generation-tool.patch"
14
15SRCREV = "5a05d7643c4d8cc14e281b686c78101a7a01e8e1"
16
17S = "${WORKDIR}/git"
18
19DEPENDS += " intel-graphics-compiler gmmlib"
20DEPENDS_append_class-target = " intel-compute-runtime-native libva"
21
22RDEPENDS_${PN} += " intel-graphics-compiler gmmlib"
23
24inherit cmake pkgconfig
25
26COMPATIBLE_HOST = '(x86_64).*-linux'
27COMPATIBLE_HOST_libc-musl = "null"
28
29EXTRA_OECMAKE = " \
30 -DIGC_DIR=${STAGING_INCDIR}/igc \
31 -DBUILD_TYPE=Release \
32 -DSKIP_UNIT_TESTS=1 \
33 -DCCACHE_ALLOWED=FALSE \
34 "
35EXTRA_OECMAKE_append_class-target = " \
36 -Dcloc_cmd_prefix=ocloc \
37 "
38
39PACKAGECONFIG ??= ""
40PACKAGECONFIG[levelzero] = "-DBUILD_WITH_L0=ON, -DBUILD_WITH_L0=OFF, level-zero"
41
42do_install_append_class-native() {
43 install -d ${D}${bindir}
44 install ${B}/bin/cpp_generate_tool ${D}${bindir}/
45}
46
47FILES_${PN} += " \
48 ${libdir}/intel-opencl/libigdrcl.so \
49 ${libdir}/libocloc.so \
50 "
51
52FILES_${PN}-dev = "${includedir}"
53
54BBCLASSEXTEND = "native nativesdk"
55
56UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)"
diff --git a/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime_24.05.28454.6.bb b/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime_24.05.28454.6.bb
new file mode 100644
index 00000000..60125171
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-opencl/compute-runtime/intel-compute-runtime_24.05.28454.6.bb
@@ -0,0 +1,64 @@
1SUMMARY = "The Intel(R) Graphics Compute Runtime for OpenCL(TM)"
2DESCRIPTION = "The Intel(R) Graphics Compute Runtime for OpenCL(TM) \
3is an open source project to converge Intel's development efforts \
4on OpenCL(TM) compute stacks supporting the GEN graphics hardware \
5architecture."
6
7LICENSE = "MIT & Apache-2.0"
8LIC_FILES_CHKSUM = "file://LICENSE.md;md5=eca6ec6997e18db166db7109cdbe611c \
9 file://third_party/opencl_headers/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
10
11SRC_URI = "git://github.com/intel/compute-runtime.git;protocol=https;branch=releases/24.05 \
12 file://disable-werror.patch \
13 file://allow-to-find-cpp-generation-tool.patch \
14 file://external-ocloc.patch \
15 "
16
17SRCREV = "23a9725e62c8181193c90e5e5207507a1f136587"
18
19S = "${WORKDIR}/git"
20
21DEPENDS += " intel-graphics-compiler gmmlib libva qemu-native"
22
23RDEPENDS:${PN} += " intel-graphics-compiler gmmlib"
24
25inherit cmake pkgconfig qemu
26
27COMPATIBLE_HOST = '(x86_64).*-linux'
28COMPATIBLE_HOST:libc-musl = "null"
29
30EXTRA_OECMAKE = " \
31 -DIGC_DIR=${STAGING_INCDIR}/igc \
32 -DBUILD_TYPE=Release \
33 -DSKIP_UNIT_TESTS=1 \
34 -DCCACHE_ALLOWED=FALSE \
35 -DNEO_DISABLE_LD_LLD=ON \
36 -DNEO_DISABLE_LD_GOLD=ON \
37 "
38
39EXTRA_OECMAKE:append:class-target = " \
40 -Docloc_cmd_prefix=ocloc \
41 -DCMAKE_CROSSCOMPILING_EMULATOR=${WORKDIR}/qemuwrapper \
42 "
43
44PACKAGECONFIG ??= ""
45PACKAGECONFIG[levelzero] = "-DBUILD_WITH_L0=ON, -DBUILD_WITH_L0=OFF, level-zero"
46
47do_configure:prepend:class-target () {
48 # Write out a qemu wrapper that will be used by cmake.
49 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}')])}"
50 cat > ${WORKDIR}/qemuwrapper << EOF
51#!/bin/sh
52$qemu_binary "\$@"
53EOF
54 chmod +x ${WORKDIR}/qemuwrapper
55}
56
57FILES:${PN} += " \
58 ${libdir}/intel-opencl/libigdrcl.so \
59 ${libdir}/libocloc.so \
60 "
61
62FILES:${PN}-dev = "${includedir}"
63
64UPSTREAM_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 @@
1From 3d71670f8ad5b54d434c2f5f71713bb1d5433ae4 Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Tue, 12 Oct 2021 23:46:42 +0800
4Subject: [PATCH] BiF/CMakeLists.txt: remove opt from DEPENDS
5
6Otherwise it starts failing with:
7
8| ninja: error: 'IGC/VectorCompiler/lib/BiF/opt', needed by 'IGC/VectorCompiler/lib/BiF/VCBiFPrintfOCL32.opt.bc', missing and no known rule to make it
9
10We don't need to explicitly make sure opt is built when
11using prebuilt binaries.
12
13Upstream-Status: Inappropriate
14
15Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
16---
17 IGC/VectorCompiler/lib/BiF/cmake/Functions.cmake | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20diff --git a/IGC/VectorCompiler/lib/BiF/cmake/Functions.cmake b/IGC/VectorCompiler/lib/BiF/cmake/Functions.cmake
21index d20d7f887..882e09fea 100644
22--- a/IGC/VectorCompiler/lib/BiF/cmake/Functions.cmake
23+++ b/IGC/VectorCompiler/lib/BiF/cmake/Functions.cmake
24@@ -109,7 +109,7 @@ function(vc_build_bif TARGET RES_FILE CMCL_SRC_PATH BIF_NAME PTR_BIT_SIZE)
25 COMMENT "vc_build_bif: Translating CMCL builtins: ${BIF_CLANG_BC_NAME_FINAL} -> ${BIF_OPT_BC_NAME}"
26 COMMAND CMCLTranslatorTool -o ${BIF_CMCL_BC_NAME} ${BIF_CLANG_BC_NAME_FINAL}
27 COMMAND ${LLVM_OPT_EXE} ${IGC_LLVM_DEPENDENT_OPT_FLAGS} --O2 -o ${BIF_OPT_BC_NAME} ${BIF_CMCL_BC_NAME}
28- DEPENDS CMCLTranslatorTool ${LLVM_OPT_EXE} ${BIF_CLANG_BC_PATH_FINAL}
29+ DEPENDS CMCLTranslatorTool ${BIF_CLANG_BC_PATH_FINAL}
30 BYPRODUCTS ${BIF_OPT_BC_PATH}
31 SOURCES ${CMCL_SRC_PATH})
32 set(${RES_FILE} ${BIF_OPT_BC_NAME} PARENT_SCOPE)
33--
342.43.2
35
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 @@
1From 869cdb784aa062bd08bd26465bf0b5651e8f112e Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= <zboszor@pr.hu>
3Date: Thu, 25 Feb 2021 10:39:27 +0100
4Subject: [PATCH 1/3] Fix build with LLVM 12
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Upstream-Status: Pending
10
11Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
12Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
13---
14 .../LegalizeFunctionSignatures.cpp | 2 +-
15 IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | 26 +++++++++-----
16 IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp | 6 +++-
17 IGC/Compiler/CISACodeGen/AdvMemOpt.cpp | 4 +++
18 IGC/Compiler/CISACodeGen/CShader.cpp | 14 ++++----
19 .../CISACodeGen/ConstantCoalescing.cpp | 14 ++++----
20 IGC/Compiler/CISACodeGen/DeSSA.cpp | 3 +-
21 IGC/Compiler/CISACodeGen/EmitVISAPass.cpp | 35 +++++++++---------
22 IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp | 4 +--
23 IGC/Compiler/CISACodeGen/GenIRLowering.cpp | 4 +--
24 .../CISACodeGen/GenSimplification.cpp | 5 +--
25 .../CISACodeGen/GeometryShaderLowering.cpp | 3 +-
26 IGC/Compiler/CISACodeGen/LdShrink.cpp | 10 ++++--
27 .../CISACodeGen/LowerGEPForPrivMem.cpp | 8 ++---
28 IGC/Compiler/CISACodeGen/MemOpt.cpp | 8 ++---
29 IGC/Compiler/CISACodeGen/MemOpt2.cpp | 5 +--
30 .../CISACodeGen/OpenCLKernelCodeGen.cpp | 2 +-
31 IGC/Compiler/CISACodeGen/PatternMatchPass.cpp | 4 +--
32 IGC/Compiler/CISACodeGen/PushAnalysis.cpp | 4 +--
33 .../CISACodeGen/RegisterEstimator.cpp | 3 +-
34 .../CISACodeGen/RegisterPressureEstimate.hpp | 3 +-
35 IGC/Compiler/CISACodeGen/SLMConstProp.cpp | 3 +-
36 .../CISACodeGen/ScalarizerCodeGen.cpp | 4 +--
37 IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp | 4 +++
38 .../CISACodeGen/Simd32Profitability.cpp | 11 ++++--
39 IGC/Compiler/CISACodeGen/SimplifyConstant.cpp | 12 +++----
40 IGC/Compiler/CISACodeGen/TypeDemote.cpp | 3 +-
41 .../CISACodeGen/VariableReuseAnalysis.cpp | 5 +--
42 .../CISACodeGen/VariableReuseAnalysis.hpp | 3 +-
43 IGC/Compiler/CISACodeGen/VectorPreProcess.cpp | 24 ++++++-------
44 IGC/Compiler/CISACodeGen/VectorProcess.cpp | 4 +--
45 IGC/Compiler/CISACodeGen/helper.cpp | 10 +++---
46 IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp | 15 ++++++--
47 IGC/Compiler/CustomSafeOptPass.cpp | 26 +++++++-------
48 IGC/Compiler/DebugInfo/ScalarVISAModule.cpp | 3 +-
49 IGC/Compiler/GenTTI.cpp | 8 ++++-
50 IGC/Compiler/GenUpdateCB.cpp | 3 +-
51 IGC/Compiler/HandleFRemInstructions.cpp | 3 +-
52 IGC/Compiler/HandleLoadStoreInstructions.cpp | 4 +--
53 IGC/Compiler/LegalizationPass.cpp | 28 +++++++--------
54 IGC/Compiler/Legalizer/InstPromoter.cpp | 11 ++++--
55 IGC/Compiler/Legalizer/InstScalarizer.cpp | 6 ++--
56 .../Legalizer/PeepholeTypeLegalizer.cpp | 6 ++--
57 IGC/Compiler/Legalizer/TypeLegalizer.cpp | 3 +-
58 IGC/Compiler/Legalizer/TypeLegalizer.h | 3 +-
59 IGC/Compiler/LowPrecisionOptPass.cpp | 2 +-
60 .../AddressSpaceAliasAnalysis.cpp | 9 ++---
61 .../AggregateArguments/AggregateArguments.cpp | 3 +-
62 .../CorrectlyRoundedDivSqrt.cpp | 3 +-
63 .../DeviceEnqueueFuncs/TransformBlocks.cpp | 6 +++-
64 .../Optimizer/OpenCLPasses/KernelArgs.cpp | 3 +-
65 .../OpenCLPrintf/OpenCLPrintfResolution.cpp | 4 +--
66 .../PrivateMemory/PrivateMemoryResolution.cpp | 11 ++++--
67 .../ReplaceUnsupportedIntrinsics.cpp | 4 +--
68 .../OpenCLPasses/WIFuncs/WIFuncResolution.cpp | 4 +++
69 .../Optimizer/PreCompiledFuncImport.cpp | 4 +--
70 IGC/Compiler/Optimizer/Scalarizer.cpp | 36 +++++++++----------
71 IGC/Compiler/Optimizer/ValueTracker.cpp | 2 +-
72 IGC/Compiler/VerificationPass.cpp | 2 +-
73 IGC/DebugInfo/DebugInfoUtils.hpp | 4 +++
74 IGC/DebugInfo/DwarfDebug.cpp | 8 +++++
75 IGC/GenISAIntrinsics/GenIntrinsics.cpp | 6 ++--
76 .../BuiltinsFrontendDefinitions.hpp | 2 +-
77 .../include/llvmWrapper/Support/TypeSize.h | 8 ++++-
78 .../include/llvmWrapper/Transforms/Scalar.h | 4 +--
79 IGC/common/igc_resourceDimTypes.h | 5 +++
80 66 files changed, 303 insertions(+), 196 deletions(-)
81
82diff --git a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp
83index 4046b4a6..8ed36089 100644
84--- a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp
85+++ b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp
86@@ -156,7 +156,7 @@ inline Type* LegalizedIntVectorType(Module& M, const Type* const oldTy)
87 else if (size <= 64) newSize = 64;
88 else IGC_ASSERT_MESSAGE(0, "Currently don't support upscaling int sizes > 64 bits");
89
90- return IGCLLVM::FixedVectorType::get(IntegerType::get(M.getContext(), newSize), (unsigned)cast<VectorType>(oldTy)->getNumElements());
91+ return IGCLLVM::FixedVectorType::get(IntegerType::get(M.getContext(), newSize), (unsigned)cast<IGCLLVM::FixedVectorType>(oldTy)->getNumElements());
92 }
93
94 void LegalizeFunctionSignatures::FixFunctionSignatures()
95diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
96index 41d1f2ea..725a1512 100644
97--- a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
98+++ b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
99@@ -1576,7 +1576,11 @@ void SPIRVToLLVMDbgTran::transDbgInfo(SPIRVValue *SV, Value *V) {
100 Line->getColumn(), scope, iat);
101
102 if(scope && !isa<DIFile>(scope))
103+#if LLVM_VERSION_MAJOR >= 12
104+ I->setDebugLoc(DILocation::get(scope->getContext(), Line->getLine(), Line->getColumn(),
105+#else
106 I->setDebugLoc(DebugLoc::get(Line->getLine(), Line->getColumn(),
107+#endif
108 scope, iat));
109 }
110 }
111@@ -1925,7 +1929,11 @@ SPIRVToLLVM::transType(SPIRVType *T) {
112 auto name = isSubgroupAvcINTELTypeOpCode(OC) ?
113 OCLSubgroupINTELTypeOpCodeMap::rmap(OC) :
114 BuiltinOpaqueGenericTypeOpCodeMap::rmap(OC);
115+#if LLVM_VERSION_MAJOR >= 12
116+ auto *pST = llvm::StructType::getTypeByName(M->getContext(), name);
117+#else
118 auto *pST = M->getTypeByName(name);
119+#endif
120 pST = pST ? pST : StructType::create(*Context, name);
121
122 return mapType(T, PointerType::get(pST, getOCLOpaqueTypeAddrSpace(OC)));
123@@ -2403,7 +2411,7 @@ Value *SPIRVToLLVM::promoteBool(Value *pVal, BasicBlock *BB)
124
125 auto *PromoType = isa<VectorType>(pVal->getType()) ?
126 cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt8Ty(pVal->getContext()),
127- (unsigned)cast<VectorType>(pVal->getType())->getNumElements())) :
128+ (unsigned)cast<IGCLLVM::FixedVectorType>(pVal->getType())->getNumElements())) :
129 Type::getInt8Ty(pVal->getContext());
130
131 if (auto *C = dyn_cast<Constant>(pVal))
132@@ -2445,7 +2453,7 @@ Value *SPIRVToLLVM::truncBool(Value *pVal, BasicBlock *BB)
133
134 auto *TruncType = isa<VectorType>(pVal->getType()) ?
135 cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt1Ty(pVal->getContext()),
136- (unsigned)cast<VectorType>(pVal->getType())->getNumElements())) :
137+ (unsigned)cast<IGCLLVM::FixedVectorType>(pVal->getType())->getNumElements())) :
138 Type::getInt1Ty(pVal->getContext());
139
140 if (auto *C = dyn_cast<Constant>(pVal))
141@@ -2491,7 +2499,7 @@ Type *SPIRVToLLVM::truncBoolType(SPIRVType *SPVType, Type *LLType)
142
143 return isa<VectorType>(LLType) ?
144 cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt1Ty(LLType->getContext()),
145- (unsigned)cast<VectorType>(LLType)->getNumElements())) :
146+ (unsigned)cast<IGCLLVM::FixedVectorType>(LLType)->getNumElements())) :
147 Type::getInt1Ty(LLType->getContext());
148 }
149
150@@ -2648,7 +2656,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
151 {
152 if(CV[i]->getType()->isVectorTy())
153 {
154- for(uint32_t j = 0; j < cast<VectorType>(CV[i]->getType())->getNumElements(); j++)
155+ for(uint32_t j = 0; j < cast<IGCLLVM::FixedVectorType>(CV[i]->getType())->getNumElements(); j++)
156 {
157 Value *v = ExtractElementInst::Create( CV[i],ConstantInt::get( *Context,APInt( 32,j ) ),BCC->getName(),BB );
158 elm1 = CreateCompositeConstruct( elm1,v,pos++ );
159@@ -3336,7 +3344,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
160 auto Vector = transValue(BI->getOperand(0), F, BB);
161 auto Scalar = transValue(BI->getOperand(1), F, BB);
162
163- auto VecType = cast<VectorType>(Vector->getType());
164+ auto VecType = cast<IGCLLVM::FixedVectorType>(Vector->getType());
165 auto Undef = UndefValue::get(VecType);
166
167 auto ScalarVec = InsertElementInst::Create(Undef, Scalar,
168@@ -3361,7 +3369,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
169 a->getType()->getScalarSizeInBits() - 1);
170 auto *ShiftOp = isa<VectorType>(a->getType()) ?
171 ConstantVector::getSplat(
172- IGCLLVM::getElementCount((unsigned)cast<VectorType>(a->getType())->getNumElements()), ShiftAmt) :
173+ IGCLLVM::getElementCount((unsigned)cast<IGCLLVM::FixedVectorType>(a->getType())->getNumElements()), ShiftAmt) :
174 ShiftAmt;
175
176 // OCL C:
177@@ -3705,15 +3713,15 @@ SPIRVToLLVM::transSPIRVBuiltinFromInst(SPIRVInstruction *BI, BasicBlock *BB) {
178 "",
179 BB);
180 }
181- else if (cast<VectorType>(coordType)->getNumElements() != 4)
182+ else if (cast<IGCLLVM::FixedVectorType>(coordType)->getNumElements() != 4)
183 {
184 Value *undef = UndefValue::get(coordType);
185
186 SmallVector<Constant*, 4> shuffleIdx;
187- for (unsigned i = 0; i < cast<VectorType>(coordType)->getNumElements(); i++)
188+ for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(coordType)->getNumElements(); i++)
189 shuffleIdx.push_back(ConstantInt::get(Type::getInt32Ty(*Context), i));
190
191- for (uint64_t i = (unsigned)cast<VectorType>(coordType)->getNumElements(); i < 4; i++)
192+ for (uint64_t i = (unsigned)cast<IGCLLVM::FixedVectorType>(coordType)->getNumElements(); i < 4; i++)
193 shuffleIdx.push_back(ConstantInt::get(Type::getInt32Ty(*Context), 0));
194
195 imageCoordinateWiden = new ShuffleVectorInst(
196diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
197index 57821556..91b4623c 100644
198--- a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
199+++ b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
200@@ -93,7 +93,11 @@ saveLLVMModule(Module *M, const std::string &OutputFile) {
201 PointerType*
202 getOrCreateOpaquePtrType(Module *M, const std::string &Name,
203 unsigned AddrSpace) {
204+#if LLVM_VERSION_MAJOR >= 12
205+ auto OpaqueType = llvm::StructType::getTypeByName(M->getContext(), Name);
206+#else
207 auto OpaqueType = M->getTypeByName(Name);
208+#endif
209 if (!OpaqueType)
210 OpaqueType = StructType::create(M->getContext(), Name);
211 return PointerType::get(OpaqueType, AddrSpace);
212@@ -159,7 +163,7 @@ std::string recursive_mangle(const Type* pType)
213 return "i" + utostr(pType->getIntegerBitWidth());
214 case IGCLLVM::VectorTyID:
215 {
216- unsigned vecLen = (unsigned)cast<VectorType>(pType)->getNumElements();
217+ unsigned vecLen = (unsigned)cast<IGCLLVM::FixedVectorType>(pType)->getNumElements();
218 Type* pEltType = cast<VectorType>(pType)->getElementType();
219 return "v" + utostr(vecLen) + recursive_mangle(pEltType);
220 }
221diff --git a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
222index 81acc6ce..fc45a510 100644
223--- a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
224+++ b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
225@@ -134,7 +134,11 @@ bool AdvMemOpt::runOnFunction(Function& F) {
226 for (auto I = LI->begin(), E = LI->end(); I != E; ++I)
227 for (auto DFI = df_begin(*I), DFE = df_end(*I); DFI != DFE; ++DFI) {
228 Loop* L = *DFI;
229+#if LLVM_VERSION_MAJOR >= 12
230+ if (L->isInnermost())
231+#else
232 if (L->empty())
233+#endif
234 InnermostLoops.push_back(L);
235 }
236
237diff --git a/IGC/Compiler/CISACodeGen/CShader.cpp b/IGC/Compiler/CISACodeGen/CShader.cpp
238index e3cb8153..ebc99615 100644
239--- a/IGC/Compiler/CISACodeGen/CShader.cpp
240+++ b/IGC/Compiler/CISACodeGen/CShader.cpp
241@@ -430,7 +430,7 @@ void CShader::CreateAliasVars()
242 continue;
243
244 Type* Ty = V->getType();
245- VectorType* VTy = dyn_cast<VectorType>(Ty);
246+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
247 Type* BTy = VTy ? VTy->getElementType() : Ty;
248 int nelts = (VTy ? (int)VTy->getNumElements() : 1);
249
250@@ -961,7 +961,7 @@ bool CShader::InsideDivergentCF(llvm::Instruction* inst)
251 uint CShader::GetNbVectorElementAndMask(llvm::Value* val, uint32_t& mask)
252 {
253 llvm::Type* type = val->getType();
254- uint nbElement = int_cast<uint>(cast<VectorType>(type)->getNumElements());
255+ uint nbElement = int_cast<uint>(cast<IGCLLVM::FixedVectorType>(type)->getNumElements());
256 mask = 0;
257 // we don't process vector bigger than 31 elements as the mask has only 32bits
258 // If we want to support longer vectors we need to extend the mask size
259@@ -1166,7 +1166,7 @@ uint32_t CShader::GetExtractMask(llvm::Value* vecVal)
260 {
261 return it->second;
262 }
263- const unsigned int numChannels = vecVal->getType()->isVectorTy() ? (unsigned)cast<VectorType>(vecVal->getType())->getNumElements() : 1;
264+ const unsigned int numChannels = vecVal->getType()->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(vecVal->getType())->getNumElements() : 1;
265 IGC_ASSERT_MESSAGE(numChannels <= 32, "Mask has 32 bits maximally!");
266 return (1ULL << numChannels) - 1;
267 }
268@@ -1174,7 +1174,7 @@ uint32_t CShader::GetExtractMask(llvm::Value* vecVal)
269 uint16_t CShader::AdjustExtractIndex(llvm::Value* vecVal, uint16_t index)
270 {
271 uint16_t result = index;
272- if (cast<VectorType>(vecVal->getType())->getNumElements() < 32)
273+ if (cast<IGCLLVM::FixedVectorType>(vecVal->getType())->getNumElements() < 32)
274 {
275 uint32_t mask = GetExtractMask(vecVal);
276 for (uint i = 0; i < index; ++i)
277@@ -1591,7 +1591,7 @@ auto sizeToSIMDMode = [](uint32_t size)
278
279 CVariable* CShader::GetConstant(llvm::Constant* C, CVariable* dstVar)
280 {
281- llvm::VectorType* VTy = llvm::dyn_cast<llvm::VectorType>(C->getType());
282+ IGCLLVM::FixedVectorType* VTy = llvm::dyn_cast<IGCLLVM::FixedVectorType>(C->getType());
283 if (C && VTy)
284 { // Vector constant
285 llvm::Type* eTy = VTy->getElementType();
286@@ -1816,7 +1816,7 @@ uint32_t CShader::GetNumElts(llvm::Type* type, bool isUniform)
287 {
288 IGC_ASSERT(type->getContainedType(0)->isIntegerTy() || type->getContainedType(0)->isFloatingPointTy());
289
290- auto VT = cast<VectorType>(type);
291+ auto VT = cast<IGCLLVM::FixedVectorType>(type);
292 numElts *= (uint16_t)VT->getNumElements();
293 }
294 return numElts;
295@@ -2516,7 +2516,7 @@ CVariable* CShader::GetSymbol(llvm::Value* value, bool fromConstantPool)
296 if (isVecType)
297 {
298 // Map the entire vector value to the CVar
299- unsigned numElements = (unsigned)cast<VectorType>(value->getType())->getNumElements();
300+ unsigned numElements = (unsigned)cast<IGCLLVM::FixedVectorType>(value->getType())->getNumElements();
301 var = GetNewVariable(numElements, ISA_TYPE_UQ, (GetContext()->platform.getGRFSize() == 64) ? EALIGN_32WORD : EALIGN_HWORD, true, 1, valName);
302 symbolMapping.insert(std::pair<llvm::Value*, CVariable*>(value, var));
303
304diff --git a/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp b/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp
305index 1efe116f..47b7c6c0 100644
306--- a/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp
307+++ b/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp
308@@ -224,7 +224,7 @@ static void checkInsertExtractMatch(InsertElementInst* insertInst, Value* base,
309
310 static bool canReplaceInsert(InsertElementInst* insertElt)
311 {
312- VectorType* VTy = cast<VectorType>(insertElt->getOperand(0)->getType());
313+ IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(insertElt->getOperand(0)->getType());
314 ConstantInt* index = dyn_cast<ConstantInt>(insertElt->getOperand(2));
315 if (!index || index->getZExtValue() != VTy->getNumElements() - 1)
316 {
317@@ -312,7 +312,7 @@ void ConstantCoalescing::VectorizePrep(llvm::BasicBlock* bb)
318 {
319 if (load->getType()->isVectorTy() && wiAns->isUniform(load))
320 {
321- srcNElts = (uint32_t)cast<VectorType>(load->getType())->getNumElements();
322+ srcNElts = (uint32_t)cast<IGCLLVM::FixedVectorType>(load->getType())->getNumElements();
323 DenseMap<uint64_t, Instruction*> extractElementMap;
324
325 for (auto iter = load->user_begin(); iter != load->user_end(); iter++)
326@@ -396,7 +396,7 @@ bool ConstantCoalescing::isProfitableLoad(
327 (isa<LoadInst>(I) && wiAns->isUniform(I)) ?
328 16 : 4;
329
330- if (cast<VectorType>(LoadTy)->getNumElements() > MaxVectorInput)
331+ if (cast<IGCLLVM::FixedVectorType>(LoadTy)->getNumElements() > MaxVectorInput)
332 return false;
333
334 MaxEltPlus = CheckVectorElementUses(I);
335@@ -1787,7 +1787,7 @@ void ConstantCoalescing::AdjustChunk(BufChunk* cov_chunk, uint start_adj, uint s
336 WIAnalysis::WIDependancy loadDep = wiAns->whichDepend(cov_chunk->chunkIO);
337 irBuilder->SetInsertPoint(cov_chunk->chunkIO->getNextNode());
338 Value* vec = UndefValue::get(originalType);
339- for (unsigned i = 0; i < cast<VectorType>(originalType)->getNumElements(); i++)
340+ for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(originalType)->getNumElements(); i++)
341 {
342 Value* channel = irBuilder->CreateExtractElement(
343 cov_chunk->chunkIO, irBuilder->getInt32(i + start_adj));
344@@ -1851,7 +1851,7 @@ void ConstantCoalescing::MoveExtracts(BufChunk* cov_chunk, Instruction* load, ui
345 irBuilder->SetInsertPoint(load->getNextNode());
346 Type* vecType = load->getType();
347 Value* vec = UndefValue::get(vecType);
348- for (unsigned i = 0; i < cast<VectorType>(vecType)->getNumElements(); i++)
349+ for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(vecType)->getNumElements(); i++)
350 {
351 Value* channel = irBuilder->CreateExtractElement(
352 cov_chunk->chunkIO, irBuilder->getInt32(i + start_adj));
353@@ -1915,7 +1915,7 @@ void ConstantCoalescing::EnlargeChunk(BufChunk* cov_chunk, uint size_adj)
354 WIAnalysis::WIDependancy loadDep = wiAns->whichDepend(cov_chunk->chunkIO);
355 irBuilder->SetInsertPoint(cov_chunk->chunkIO->getNextNode());
356 Value* vec = UndefValue::get(originalType);
357- for (unsigned i = 0; i < cast<VectorType>(originalType)->getNumElements(); i++)
358+ for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(originalType)->getNumElements(); i++)
359 {
360 Value* channel = irBuilder->CreateExtractElement(
361 cov_chunk->chunkIO, irBuilder->getInt32(i));
362@@ -2343,7 +2343,7 @@ void ConstantCoalescing::ReplaceLoadWithSamplerLoad(
363 if (dstTy->isVectorTy())
364 {
365 result = UndefValue::get(dstTy);
366- for (uint i = 0; i < cast<VectorType>(dstTy)->getNumElements(); i++)
367+ for (uint i = 0; i < cast<IGCLLVM::FixedVectorType>(dstTy)->getNumElements(); i++)
368 {
369 Value* tmpData = ExtractFromSamplerData(cast<VectorType>(dstTy)->getElementType(), i);
370 result = irBuilder->CreateInsertElement(result, tmpData, irBuilder->getInt32(i));
371diff --git a/IGC/Compiler/CISACodeGen/DeSSA.cpp b/IGC/Compiler/CISACodeGen/DeSSA.cpp
372index f540dc11..6fab0246 100644
373--- a/IGC/Compiler/CISACodeGen/DeSSA.cpp
374+++ b/IGC/Compiler/CISACodeGen/DeSSA.cpp
375@@ -83,6 +83,7 @@ IN THE SOFTWARE.
376 #include "Compiler/IGCPassSupport.h"
377 #include "common/LLVMWarningsPush.hpp"
378 #include <llvm/IR/InstIterator.h>
379+#include <llvmWrapper/IR/DerivedTypes.h>
380 #include "common/LLVMWarningsPop.hpp"
381 #include <algorithm>
382 #include "Probe/Assertion.h"
383@@ -1284,7 +1285,7 @@ int DeSSA::checkInsertElementAlias(
384 //
385 // If found, return the actual vector size;
386 // otherwise, return 0.
387- VectorType* VTy = cast<VectorType>(IEI->getType());
388+ IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(IEI->getType());
389 IGC_ASSERT(nullptr != VTy);
390 int nelts = (int)VTy->getNumElements();
391 AllIEIs.resize(nelts, nullptr);
392diff --git a/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp b/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp
393index 3ab1cc5f..4502ef62 100644
394--- a/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp
395+++ b/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp
396@@ -53,6 +53,7 @@ IN THE SOFTWARE.
397 #include "Compiler/IGCPassSupport.h"
398 #include "common/LLVMWarningsPush.hpp"
399 #include "llvmWrapper/IR/Instructions.h"
400+#include "llvmWrapper/IR/DerivedTypes.h"
401 #include "llvm/Support/Path.h"
402 #include "llvmWrapper/IR/Intrinsics.h"
403 #include "common/LLVMWarningsPop.hpp"
404@@ -1165,7 +1166,7 @@ bool EmitPass::canRelocatePhiMov(
405 if (dst != src)
406 {
407 int numElt = 1;
408- if (VectorType * vTy = dyn_cast<VectorType>(PN->getType()))
409+ if (IGCLLVM::FixedVectorType * vTy = dyn_cast<IGCLLVM::FixedVectorType>(PN->getType()))
410 {
411 numElt = int_cast<int>(vTy->getNumElements());
412 }
413@@ -1302,7 +1303,7 @@ void EmitPass::MovPhiSources(llvm::BasicBlock* aBB)
414 phiSrcDstList.push_back(phiInfo);
415
416 int numElt = 0;
417- if (VectorType * vTy = dyn_cast<VectorType>(PN->getType()))
418+ if (IGCLLVM::FixedVectorType * vTy = dyn_cast<IGCLLVM::FixedVectorType>(PN->getType()))
419 {
420 numElt = int_cast<int>(vTy->getNumElements());
421 }
422@@ -5375,7 +5376,7 @@ void EmitPass::emitLegacySimdBlockWrite(llvm::Instruction* inst, llvm::Value* pt
423 bool useA64 = isA64Ptr(ptrType, m_currShader->GetContext());
424
425 Type* Ty = dataPtr->getType();
426- VectorType* VTy = dyn_cast<VectorType>(Ty);
427+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
428 uint32_t nbElements = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
429
430 uint32_t typeSizeInBytes = Ty->getScalarSizeInBits() / 8;
431@@ -5621,7 +5622,7 @@ void EmitPass::emitLegacySimdBlockRead(llvm::Instruction* inst, llvm::Value* ptr
432 bool useA64 = isA64Ptr(ptrType, m_currShader->GetContext());
433
434 Type* Ty = inst->getType();
435- VectorType* VTy = dyn_cast<VectorType>(Ty);
436+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
437 uint32_t nbElements = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
438
439 uint32_t typeSizeInBytes = Ty->getScalarSizeInBits() / 8;
440@@ -5913,7 +5914,7 @@ void EmitPass::emitMediaBlockIO(const llvm::GenIntrinsicInst* inst, bool isRead)
441 };
442
443 uint nElts = isa<VectorType>(pDataType) ?
444- (uint)cast<VectorType>(pDataType)->getNumElements() :
445+ (uint)cast<IGCLLVM::FixedVectorType>(pDataType)->getNumElements() :
446 1;
447
448 // Now, do the copies.
449@@ -6003,7 +6004,7 @@ void EmitPass::emitSimdMediaBlockRead(llvm::Instruction* inst)
450 uint32_t nbElements = 1;
451 if (inst->getType()->isVectorTy())
452 {
453- nbElements = (uint32_t)cast<VectorType>(inst->getType())->getNumElements();
454+ nbElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements();
455 }
456 IGC_ASSERT_MESSAGE(nbElements <= 8, "InValid Vector Size");
457
458@@ -6247,7 +6248,7 @@ void EmitPass::emitSimdMediaBlockWrite(llvm::Instruction* inst)
459 uint32_t nbElements = 1;
460 if (dataPtr->getType()->isVectorTy())
461 {
462- nbElements = (uint32_t)cast<VectorType>(dataPtr->getType())->getNumElements();
463+ nbElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(dataPtr->getType())->getNumElements();
464 }
465 IGC_ASSERT_MESSAGE(nbElements <= 8, "InValid Vector Size");
466
467@@ -8993,8 +8994,8 @@ void EmitPass::emitBitCast(llvm::BitCastInst* btCst)
468 {
469 Type* srcType = btCst->getOperand(0)->getType();
470 Type* dstType = btCst->getType();
471- unsigned int numSrcElement = srcType->isVectorTy() ? (unsigned)cast<VectorType>(srcType)->getNumElements() : 1;
472- unsigned int numDstElement = dstType->isVectorTy() ? (unsigned)cast<VectorType>(dstType)->getNumElements() : 1;
473+ unsigned int numSrcElement = srcType->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(srcType)->getNumElements() : 1;
474+ unsigned int numDstElement = dstType->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(dstType)->getNumElements() : 1;
475
476 if (srcType->isPointerTy())
477 {
478@@ -9468,7 +9469,7 @@ void EmitPass::emitLoad3DInner(LdRawIntrinsic* inst, ResourceDescriptor& resourc
479 {
480 IGC_ASSERT_MESSAGE(predDefSurface != ESURFACE_STATELESS, "scratch cannot be uniform");
481 Type* loadType = inst->getType();
482- uint numElement = loadType->isVectorTy() ? (uint)cast<VectorType>(loadType)->getNumElements() : 1;
483+ uint numElement = loadType->isVectorTy() ? (uint)cast<IGCLLVM::FixedVectorType>(loadType)->getNumElements() : 1;
484 if (predDefSurface == ESURFACE_SLM)
485 {
486 IGC_ASSERT(numElement <= 4);
487@@ -10795,7 +10796,7 @@ void EmitPass::emitInsert(llvm::Instruction* inst)
488 pVecVar = GetSymbol(pVec);
489 if (pVecVar != pInstVar)
490 {
491- emitVectorCopy(pInstVar, pVecVar, int_cast<unsigned>(dyn_cast<VectorType>(pVecType)->getNumElements()));
492+ emitVectorCopy(pInstVar, pVecVar, int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(pVecType)->getNumElements()));
493 }
494 }
495 }
496@@ -14596,7 +14597,7 @@ bool EmitPass::isUniformStoreOCL(llvm::StoreInst* SI)
497
498 Value* storeVal = SI->getValueOperand();
499 Type* Ty = storeVal->getType();
500- VectorType* VTy = dyn_cast<VectorType>(Ty);
501+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
502 uint32_t elts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
503 Type* eltTy = VTy ? VTy->getElementType() : Ty;
504
505@@ -14626,7 +14627,7 @@ void EmitPass::emitVectorBitCast(llvm::BitCastInst* BCI)
506 if (srcTy->isVectorTy())
507 {
508 srcEltTy = cast<VectorType>(srcTy)->getElementType();
509- srcNElts = (uint32_t)cast<VectorType>(srcTy)->getNumElements();
510+ srcNElts = (uint32_t)cast<IGCLLVM::FixedVectorType>(srcTy)->getNumElements();
511 }
512 else
513 {
514@@ -14636,7 +14637,7 @@ void EmitPass::emitVectorBitCast(llvm::BitCastInst* BCI)
515 if (dstTy->isVectorTy())
516 {
517 dstEltTy = cast<VectorType>(dstTy)->getElementType();
518- dstNElts = (uint32_t)cast<VectorType>(dstTy)->getNumElements();
519+ dstNElts = (uint32_t)cast<IGCLLVM::FixedVectorType>(dstTy)->getNumElements();
520 }
521 else
522 {
523@@ -15215,7 +15216,7 @@ void EmitPass::emitVectorLoad(LoadInst* inst, Value* offset, ConstantInt* immOff
524 }
525
526 Type* Ty = inst->getType();
527- VectorType* VTy = dyn_cast<VectorType>(Ty);
528+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
529 Type* eltTy = VTy ? VTy->getElementType() : Ty;
530 uint32_t eltBytes = GetScalarTypeSizeInRegister(eltTy);
531 IGC_ASSERT_MESSAGE((eltBytes == 1) || (eltBytes == 2) || (eltBytes == 4) || (eltBytes == 8),
532@@ -15667,7 +15668,7 @@ void EmitPass::emitVectorStore(StoreInst* inst, Value* offset, ConstantInt* immO
533
534 Value* storedVal = inst->getValueOperand();
535 Type* Ty = storedVal->getType();
536- VectorType* VTy = dyn_cast<VectorType>(Ty);
537+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
538 Type* eltTy = VTy ? VTy->getElementType() : Ty;
539 uint32_t eltBytes = GetScalarTypeSizeInRegister(eltTy);
540
541@@ -16471,7 +16472,7 @@ void EmitPass::emitCopyAll(CVariable* Dst, CVariable* Src, llvm::Type* Ty)
542 }
543 else if (Ty->isVectorTy())
544 {
545- unsigned NElts = (unsigned)cast<VectorType>(Ty)->getNumElements();
546+ unsigned NElts = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements();
547 emitVectorCopy(Dst, Src, NElts);
548 }
549 else
550diff --git a/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp b/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp
551index 28248f30..767b477a 100644
552--- a/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp
553+++ b/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp
554@@ -1961,7 +1961,7 @@ bool InstExpander::visitExtractElement(ExtractElementInst& EEI) {
555 // later.
556
557 Value* V = EEI.getVectorOperand();
558- unsigned NumElts = (unsigned)cast<VectorType>(V->getType())->getNumElements();
559+ unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(V->getType())->getNumElements();
560 V = IRB->CreateBitCast(V, Emu->getV2Int32Ty(NumElts));
561 // Re-calculate indices to Lo and Hi parts.
562 Value* Idx = EEI.getIndexOperand();
563@@ -1998,7 +1998,7 @@ bool InstExpander::visitInsertElement(InsertElementInst& IEI) {
564
565 // Create the emulated vector.
566 Value* NewVal = IEI.getOperand(0);
567- unsigned NumElts = (unsigned)cast<VectorType>(NewVal->getType())->getNumElements();
568+ unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(NewVal->getType())->getNumElements();
569 NewVal = IRB->CreateBitCast(NewVal, Emu->getV2Int32Ty(NumElts));
570 // Re-calculate indices to Lo and Hi parts.
571 Value* Idx = IEI.getOperand(2);
572diff --git a/IGC/Compiler/CISACodeGen/GenIRLowering.cpp b/IGC/Compiler/CISACodeGen/GenIRLowering.cpp
573index c74a2ac6..78e8a4aa 100644
574--- a/IGC/Compiler/CISACodeGen/GenIRLowering.cpp
575+++ b/IGC/Compiler/CISACodeGen/GenIRLowering.cpp
576@@ -453,7 +453,7 @@ Value* GEPLowering::getSExtOrTrunc(Value* Val, Type* NewTy) const {
577
578 IGC_ASSERT_MESSAGE(OldTy->isIntOrIntVectorTy(), "Index should be Integer or vector of Integer!");
579
580- if (auto OldVecTy = dyn_cast<VectorType>(OldTy)) {
581+ if (auto OldVecTy = dyn_cast<IGCLLVM::FixedVectorType>(OldTy)) {
582 OldWidth = (unsigned)OldVecTy->getNumElements() * OldVecTy->getElementType()->getIntegerBitWidth();
583 NewWidth = (unsigned)OldVecTy->getNumElements() * NewTy->getIntegerBitWidth();
584 }
585@@ -805,7 +805,7 @@ bool GEPLowering::lowerGetElementPtrInst(GetElementPtrInst* GEP) const
586 }
587 else
588 {
589- if (auto NewIdxVT = dyn_cast<VectorType>(NewIdx->getType())) {
590+ if (auto NewIdxVT = dyn_cast<IGCLLVM::FixedVectorType>(NewIdx->getType())) {
591 Value* result = llvm::UndefValue::get(FixedVectorType::get(PtrMathTy, (unsigned)NewIdxVT->getNumElements()));
592 for (uint32_t j = 0; j < (uint32_t)NewIdxVT->getNumElements(); j++) {
593 result = Builder->CreateInsertElement(result, PointerValue, Builder->getInt32(j));
594diff --git a/IGC/Compiler/CISACodeGen/GenSimplification.cpp b/IGC/Compiler/CISACodeGen/GenSimplification.cpp
595index 8c38f229..f432061e 100644
596--- a/IGC/Compiler/CISACodeGen/GenSimplification.cpp
597+++ b/IGC/Compiler/CISACodeGen/GenSimplification.cpp
598@@ -35,6 +35,7 @@ IN THE SOFTWARE.
599 #include <llvm/IR/InstVisitor.h>
600 #include <llvm/IR/Instruction.h>
601 #include <llvm/Support/raw_ostream.h>
602+#include <llvmWrapper/IR/DerivedTypes.h>
603 #include "common/LLVMWarningsPop.hpp"
604 #include "Probe/Assertion.h"
605
606@@ -164,7 +165,7 @@ bool GenSimplification::simplifyVectorPHINodeCase2(PHINode& PN) const {
607
608 Type* Ty = PN.getType();
609 Type* EltTy = Ty->getScalarType();
610- unsigned NumElts = (unsigned)cast<VectorType>(Ty)->getNumElements();
611+ unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements();
612
613 SmallVector<Value*, 8> Lanes;
614 SmallVector<SmallVector<Value*, 8>, 4> Values;
615@@ -238,7 +239,7 @@ void GenSimplification::visitPHINode(PHINode& PN) {
616 void GenSimplification::visitExtractElement(ExtractElementInst& EEI) {
617 // Skip non-2-element vector.
618 Value* Vec = EEI.getVectorOperand();
619- VectorType* VTy = cast<VectorType>(Vec->getType());
620+ IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(Vec->getType());
621 if (VTy->getNumElements() != 2)
622 return;
623
624diff --git a/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp b/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp
625index e00e8469..a60b9892 100644
626--- a/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp
627+++ b/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp
628@@ -33,6 +33,7 @@ IN THE SOFTWARE.
629 #include <llvm/IR/PassManager.h>
630 #include <llvm/IR/IRBuilder.h>
631 #include <llvm/IR/Verifier.h>
632+#include <llvmWrapper/IR/DerivedTypes.h>
633 #include "common/LLVMWarningsPop.hpp"
634 #include "Compiler/InitializePasses.h"
635 #include "Probe/Assertion.h"
636@@ -507,7 +508,7 @@ void GeometryShaderLowering::AddURBRead(
637 {
638 Value* vec = UndefValue::get(inst->getType());
639 IRBuilder<> builder(inst);
640- for (unsigned int i = 0; i < cast<VectorType>(inst->getType())->getNumElements(); i++)
641+ for (unsigned int i = 0; i < cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements(); i++)
642 {
643 Value* vecElement = builder.CreateExtractElement(urbRead, builder.getInt32(i));
644 vec = builder.CreateInsertElement(vec, vecElement, builder.getInt32(i));
645diff --git a/IGC/Compiler/CISACodeGen/LdShrink.cpp b/IGC/Compiler/CISACodeGen/LdShrink.cpp
646index d89fbd0e..2df06df2 100644
647--- a/IGC/Compiler/CISACodeGen/LdShrink.cpp
648+++ b/IGC/Compiler/CISACodeGen/LdShrink.cpp
649@@ -30,6 +30,7 @@ IN THE SOFTWARE.
650 #include <llvm/Support/Debug.h>
651 #include <llvm/Support/MathExtras.h>
652 #include <llvm/Support/raw_ostream.h>
653+#include <llvmWrapper/IR/DerivedTypes.h>
654 #include "common/LLVMWarningsPop.hpp"
655 #include "Compiler/CISACodeGen/ShaderCodeGen.hpp"
656 #include "Compiler/IGCPassSupport.h"
657@@ -79,7 +80,7 @@ IGC_INITIALIZE_PASS_BEGIN(LdShrink, PASS_FLAG, PASS_DESC, PASS_CFG_ONLY, PASS_AN
658 IGC_INITIALIZE_PASS_END(LdShrink, PASS_FLAG, PASS_DESC, PASS_CFG_ONLY, PASS_ANALYSIS)
659
660 unsigned LdShrink::getExtractIndexMask(LoadInst* LI) const {
661- VectorType* VTy = dyn_cast<VectorType>(LI->getType());
662+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(LI->getType());
663 // Skip non-vector loads.
664 if (!VTy)
665 return 0;
666@@ -91,9 +92,12 @@ unsigned LdShrink::getExtractIndexMask(LoadInst* LI) const {
667 Type* Ty = VTy->getScalarType();
668 // Skip non-BYTE addressable data types. So far, check integer types
669 // only.
670- if (IntegerType * ITy = dyn_cast<IntegerType>(Ty))
671- if (!ITy->isPowerOf2ByteWidth())
672+ if (IntegerType * ITy = dyn_cast<IntegerType>(Ty)) {
673+ // Unroll isPowerOf2ByteWidth, it was removed in LLVM 12.
674+ unsigned BitWidth = ITy->getBitWidth();
675+ if (!((BitWidth > 7) && isPowerOf2_32(BitWidth)))
676 return 0;
677+ }
678
679 unsigned Mask = 0; // Maxmimally 32 elements.
680
681diff --git a/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp b/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp
682index c12b20d5..5245117d 100644
683--- a/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp
684+++ b/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp
685@@ -634,7 +634,7 @@ void TransposeHelper::handleGEPInst(
686 }
687 else
688 {
689- arr_sz = (unsigned)cast<VectorType>(T)->getNumElements();
690+ arr_sz = (unsigned)cast<IGCLLVM::FixedVectorType>(T)->getNumElements();
691 }
692 T = cast<VectorType>(T)->getElementType();
693 }
694@@ -656,7 +656,7 @@ void TransposeHelper::handleGEPInst(
695 }
696 else if (T->isVectorTy())
697 {
698- arr_sz = (unsigned)cast<VectorType>(T)->getNumElements();
699+ arr_sz = (unsigned)cast<IGCLLVM::FixedVectorType>(T)->getNumElements();
700 T = cast<VectorType>(T)->getElementType();
701 }
702 else
703@@ -716,7 +716,7 @@ void TransposeHelperPromote::handleLoadInst(
704 IRBuilder<> IRB(pLoad);
705 IGC_ASSERT(nullptr != pLoad->getType());
706 unsigned N = pLoad->getType()->isVectorTy()
707- ? (unsigned)cast<VectorType>(pLoad->getType())->getNumElements()
708+ ? (unsigned)cast<IGCLLVM::FixedVectorType>(pLoad->getType())->getNumElements()
709 : 1;
710 Value* Val = loadEltsFromVecAlloca(N, pVecAlloca, pScalarizedIdx, IRB, pLoad->getType()->getScalarType());
711 pLoad->replaceAllUsesWith(Val);
712@@ -748,7 +748,7 @@ void TransposeHelperPromote::handleStoreInst(
713 // %v1 = extractelement <2 x float> %v, i32 1
714 // %w1 = insertelement <32 x float> %w0, float %v1, i32 %idx+1
715 // store <32 x float> %w1, <32 x float>* %ptr1
716- for (unsigned i = 0, e = (unsigned)cast<VectorType>(pStoreVal->getType())->getNumElements(); i < e; ++i)
717+ for (unsigned i = 0, e = (unsigned)cast<IGCLLVM::FixedVectorType>(pStoreVal->getType())->getNumElements(); i < e; ++i)
718 {
719 Value* VectorIdx = ConstantInt::get(pScalarizedIdx->getType(), i);
720 auto Val = IRB.CreateExtractElement(pStoreVal, VectorIdx);
721diff --git a/IGC/Compiler/CISACodeGen/MemOpt.cpp b/IGC/Compiler/CISACodeGen/MemOpt.cpp
722index e4279cca..aa788b11 100644
723--- a/IGC/Compiler/CISACodeGen/MemOpt.cpp
724+++ b/IGC/Compiler/CISACodeGen/MemOpt.cpp
725@@ -125,7 +125,7 @@ namespace {
726 MemRefListTy& MemRefs, TrivialMemRefListTy& ToOpt);
727
728 unsigned getNumElements(Type* Ty) const {
729- return Ty->isVectorTy() ? (unsigned)cast<VectorType>(Ty)->getNumElements() : 1;
730+ return Ty->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements() : 1;
731 }
732
733 MemoryLocation getLocation(Instruction* I) const {
734@@ -797,7 +797,7 @@ bool MemOpt::mergeLoad(LoadInst* LeadingLoad,
735 Pos = unsigned((std::get<1>(I) - FirstOffset) / LdScalarSize);
736
737 if (Ty->isVectorTy()) {
738- if (Pos + cast<VectorType>(Ty)->getNumElements() > NumElts) {
739+ if (Pos + cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements() > NumElts) {
740 // This implies we're trying to extract an element from our new load
741 // with an index > the size of the new load. If this happens,
742 // we'll generate correct code if it does since we don't remove the
743@@ -805,7 +805,7 @@ bool MemOpt::mergeLoad(LoadInst* LeadingLoad,
744 continue;
745 }
746 Value* Val = UndefValue::get(Ty);
747- for (unsigned i = 0, e = (unsigned)cast<VectorType>(Ty)->getNumElements(); i != e; ++i) {
748+ for (unsigned i = 0, e = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements(); i != e; ++i) {
749 Value* Ex = Builder.CreateExtractElement(NewLoad, Builder.getInt32(Pos + i));
750 Ex = createBitOrPointerCast(Ex, ScalarTy, Builder);
751 Val = Builder.CreateInsertElement(Val, Ex, Builder.getInt32(i));
752@@ -1083,7 +1083,7 @@ bool MemOpt::mergeStore(StoreInst* LeadingStore,
753 IGC_ASSERT(hasSameSize(ScalarTy, LeadingStoreScalarType));
754
755 if (Ty->isVectorTy()) {
756- for (unsigned i = 0, e = (unsigned)cast<VectorType>(Ty)->getNumElements(); i != e; ++i) {
757+ for (unsigned i = 0, e = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements(); i != e; ++i) {
758 Value* Ex = Builder.CreateExtractElement(Val, Builder.getInt32(i));
759 Ex = createBitOrPointerCast(Ex, LeadingStoreScalarType, Builder);
760 NewStoreVal = Builder.CreateInsertElement(NewStoreVal, Ex,
761diff --git a/IGC/Compiler/CISACodeGen/MemOpt2.cpp b/IGC/Compiler/CISACodeGen/MemOpt2.cpp
762index 4b2628d2..20115c73 100644
763--- a/IGC/Compiler/CISACodeGen/MemOpt2.cpp
764+++ b/IGC/Compiler/CISACodeGen/MemOpt2.cpp
765@@ -32,6 +32,7 @@ IN THE SOFTWARE.
766 #include <llvm/Support/Debug.h>
767 #include <llvm/Support/raw_ostream.h>
768 #include <llvm/Transforms/Utils/Local.h>
769+#include <llvmWrapper/IR/DerivedTypes.h>
770 #include "common/LLVMWarningsPop.hpp"
771 #include "GenISAIntrinsics/GenIntrinsics.h"
772
773@@ -124,7 +125,7 @@ namespace {
774 if (!Ty->isSingleValueType())
775 return UINT_MAX;
776 // Simply return 1 so far for scalar types.
777- VectorType* VecTy = dyn_cast<VectorType>(Ty);
778+ IGCLLVM::FixedVectorType* VecTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
779 if (!VecTy)
780 return 1;
781 // Check how that vector is used.
782@@ -153,7 +154,7 @@ namespace {
783 return UINT_MAX;
784 unsigned EltByte = (Ty->getScalarSizeInBits() + 7) / 8;
785 // Simply return 1 so far for scalar types.
786- VectorType* VecTy = dyn_cast<VectorType>(Ty);
787+ IGCLLVM::FixedVectorType* VecTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
788 if (!VecTy)
789 return EltByte;
790 // Check how that vector is used.
791diff --git a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp
792index 5baff64f..032d127a 100644
793--- a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp
794+++ b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp
795@@ -410,7 +410,7 @@ namespace IGC
796 unsigned int numElements = 1;
797 if (baseType->isVectorTy())
798 {
799- numElements = (unsigned)cast<VectorType>(baseType)->getNumElements();
800+ numElements = (unsigned)cast<IGCLLVM::FixedVectorType>(baseType)->getNumElements();
801 baseType = cast<VectorType>(baseType)->getElementType();
802 }
803
804diff --git a/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp b/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp
805index 356f1141..52396304 100644
806--- a/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp
807+++ b/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp
808@@ -2916,8 +2916,8 @@ namespace IGC
809 llvm::Type* srcTy = bTInst->getOperand(0)->getType();
810 llvm::Type* dstTy = bTInst->getType();
811
812- srcNElts = (srcTy->isVectorTy()) ? (uint32_t)cast<VectorType>(srcTy)->getNumElements() : 1;
813- dstNElts = (dstTy->isVectorTy()) ? (uint32_t)cast<VectorType>(dstTy)->getNumElements() : 1;
814+ srcNElts = (srcTy->isVectorTy()) ? (uint32_t)cast<IGCLLVM::FixedVectorType>(srcTy)->getNumElements() : 1;
815+ dstNElts = (dstTy->isVectorTy()) ? (uint32_t)cast<IGCLLVM::FixedVectorType>(dstTy)->getNumElements() : 1;
816
817 if (srcNElts < dstNElts && srcTy->getScalarSizeInBits() < 64)
818 {
819diff --git a/IGC/Compiler/CISACodeGen/PushAnalysis.cpp b/IGC/Compiler/CISACodeGen/PushAnalysis.cpp
820index ba8c2770..8da82db0 100644
821--- a/IGC/Compiler/CISACodeGen/PushAnalysis.cpp
822+++ b/IGC/Compiler/CISACodeGen/PushAnalysis.cpp
823@@ -899,7 +899,7 @@ namespace IGC
824
825 if (pTypeToPush->isVectorTy())
826 {
827- num_elms = (unsigned)cast<VectorType>(pTypeToPush)->getNumElements();
828+ num_elms = (unsigned)cast<IGCLLVM::FixedVectorType>(pTypeToPush)->getNumElements();
829 pTypeToPush = cast<VectorType>(pTypeToPush)->getElementType();
830 llvm::Type* pVecTy = IGCLLVM::FixedVectorType::get(pTypeToPush, num_elms);
831 pReplacedInst = llvm::UndefValue::get(pVecTy);
832@@ -1102,7 +1102,7 @@ namespace IGC
833 }
834
835 unsigned num_elms =
836- inst->getType()->isVectorTy() ? (unsigned)cast<VectorType>(inst->getType())->getNumElements() : 1;
837+ inst->getType()->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements() : 1;
838 llvm::Type* pTypeToPush = inst->getType();
839 llvm::Value* replaceVector = nullptr;
840 unsigned int numberChannelReplaced = 0;
841diff --git a/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp b/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp
842index 95b937e7..1c6544a4 100644
843--- a/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp
844+++ b/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp
845@@ -41,6 +41,7 @@ IN THE SOFTWARE.
846 #include <llvm/IR/IRBuilder.h>
847 #include <llvm/IR/InstIterator.h>
848 #include <llvm/Support/MathExtras.h>
849+#include <llvmWrapper/IR/DerivedTypes.h>
850 #include "common/LLVMWarningsPop.hpp"
851 #include "Probe/Assertion.h"
852
853@@ -146,7 +147,7 @@ RegUse RegisterEstimator::estimateNumOfRegs(Value* V) const
854 Type* Ty = V->getType();
855 if (!Ty->isVoidTy())
856 {
857- VectorType* VTy = dyn_cast<VectorType>(Ty);
858+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
859 Type* eltTy = VTy ? VTy->getElementType() : Ty;
860 uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
861 uint32_t eltBits = (uint32_t)m_DL->getTypeSizeInBits(eltTy);
862diff --git a/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp b/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp
863index beac138d..ceeafa48 100644
864--- a/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp
865+++ b/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp
866@@ -42,6 +42,7 @@ See LRCENSE.TXT for details.
867 #include "llvm/Pass.h"
868 #include <llvm/IR/InstVisitor.h>
869 #include "llvm/Analysis/LoopInfo.h"
870+#include <llvmWrapper/IR/DerivedTypes.h>
871 #include "common/LLVMWarningsPop.hpp"
872 #include "Compiler/IGCPassSupport.h"
873 #include "Compiler/CISACodeGen/WIAnalysis.hpp"
874@@ -240,7 +241,7 @@ namespace IGC
875 auto Ty = V->getType();
876 if (Ty->isVoidTy())
877 return 0;
878- auto VTy = llvm::dyn_cast<llvm::VectorType>(Ty);
879+ auto VTy = llvm::dyn_cast<IGCLLVM::FixedVectorType>(Ty);
880 auto eltTy = VTy ? VTy->getElementType() : Ty;
881 uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
882 uint32_t eltBits = (uint32_t)m_DL->getTypeSizeInBits(eltTy);
883diff --git a/IGC/Compiler/CISACodeGen/SLMConstProp.cpp b/IGC/Compiler/CISACodeGen/SLMConstProp.cpp
884index 962083f4..26a7b8be 100644
885--- a/IGC/Compiler/CISACodeGen/SLMConstProp.cpp
886+++ b/IGC/Compiler/CISACodeGen/SLMConstProp.cpp
887@@ -39,6 +39,7 @@ IN THE SOFTWARE.
888 #include <llvm/IR/InstIterator.h>
889 #include <llvm/Support/Debug.h>
890 #include <llvm/Support/MathExtras.h>
891+#include "llvmWrapper/IR/DerivedTypes.h"
892 #include "common/LLVMWarningsPop.hpp"
893 #include <vector>
894 #include "Probe/Assertion.h"
895@@ -629,7 +630,7 @@ bool SLMConstProp::isEqual(Constant* C0, Constant* C1)
896
897 bool SLMConstProp::isFloatType(Type* Ty)
898 {
899- if (VectorType * vTy = dyn_cast<VectorType>(Ty))
900+ if (IGCLLVM::FixedVectorType * vTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty))
901 {
902 if (vTy->getNumElements() > 1)
903 {
904diff --git a/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp b/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp
905index ce816416..32ab79c1 100644
906--- a/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp
907+++ b/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp
908@@ -66,7 +66,7 @@ void ScalarizerCodeGen::visitBinaryOperator(llvm::BinaryOperator& I)
909 {
910 bool isNewTypeVector = false;
911
912- VectorType* instType = cast<VectorType>(I.getType());
913+ IGCLLVM::FixedVectorType* instType = cast<IGCLLVM::FixedVectorType>(I.getType());
914 unsigned numElements = int_cast<unsigned>(instType->getNumElements());
915 unsigned scalarSize = instType->getScalarSizeInBits();
916 unsigned newScalarBits = numElements * scalarSize;
917@@ -111,7 +111,7 @@ void ScalarizerCodeGen::visitBinaryOperator(llvm::BinaryOperator& I)
918 }
919 else
920 {
921- VectorType* newVecType = cast<VectorType>(newType);
922+ IGCLLVM::FixedVectorType* newVecType = cast<IGCLLVM::FixedVectorType>(newType);
923 unsigned newVecTypeNumEle = int_cast<unsigned>(newVecType->getNumElements());
924 Value* ieLogicOp = UndefValue::get(newType);
925 for (unsigned i = 0; i < newVecTypeNumEle; i++)
926diff --git a/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp b/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp
927index d7baf806..e6fbdf23 100644
928--- a/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp
929+++ b/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp
930@@ -589,12 +589,14 @@ static void AddLegalizationPasses(CodeGenContext& ctx, IGCPassManager& mpm, PSSi
931 {
932 mpm.add(createPruneUnusedArgumentsPass());
933
934+#if LLVM_VERSION_MAJOR < 12
935 if (IGC_GET_FLAG_VALUE(FunctionControl) == FLAG_FCALL_DEFAULT)
936 {
937 // Don't run IPConstantProp when debugging function calls, to avoid folding function arg/ret constants
938 mpm.add(createIPConstantPropagationPass());
939 }
940 mpm.add(createConstantPropagationPass());
941+#endif
942 mpm.add(createDeadCodeEliminationPass());
943 mpm.add(createCFGSimplificationPass());
944 }
945@@ -1475,8 +1477,10 @@ void OptimizeIR(CodeGenContext* const pContext)
946 // possible which potentially allows late stage code sinking of
947 // those calls by the instruction combiner.
948 mpm.add(createPostOrderFunctionAttrsLegacyPass());
949+#if LLVM_VERSION_MAJOR < 12
950 mpm.add(createConstantPropagationPass());
951 mpm.add(createIPConstantPropagationPass());
952+#endif
953 }
954
955 // enable this only when Pooled EU is not supported
956diff --git a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
957index 87ba2751..c1f4a419 100644
958--- a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
959+++ b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
960@@ -30,6 +30,7 @@ IN THE SOFTWARE.
961 #include <llvmWrapper/IR/DerivedTypes.h>
962 #include <llvm/IR/InstIterator.h>
963 #include <llvm/IR/Operator.h>
964+#include <llvmWrapper/IR/DerivedTypes.h>
965 #include "common/LLVMWarningsPop.hpp"
966 #include "GenISAIntrinsics/GenIntrinsics.h"
967 #include "GenISAIntrinsics/GenIntrinsicInst.h"
968@@ -577,7 +578,7 @@ static bool isPayloadHeader(Value* V) {
969 Argument* Arg = dyn_cast<Argument>(V);
970 if (!Arg || !Arg->hasName())
971 return false;
972- VectorType* VTy = dyn_cast<VectorType>(Arg->getType());
973+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Arg->getType());
974 if (!VTy || VTy->getNumElements() != 8 ||
975 !VTy->getElementType()->isIntegerTy(32))
976 return false;
977@@ -588,7 +589,7 @@ static bool isR0(Value* V) {
978 Argument* Arg = dyn_cast<Argument>(V);
979 if (!Arg || !Arg->hasName())
980 return false;
981- VectorType* VTy = dyn_cast<VectorType>(Arg->getType());
982+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Arg->getType());
983 if (!VTy || VTy->getNumElements() != 8 ||
984 !VTy->getElementType()->isIntegerTy(32))
985 return false;
986@@ -599,7 +600,7 @@ static bool isEnqueuedLocalSize(Value* V) {
987 Argument* Arg = dyn_cast<Argument>(V);
988 if (!Arg || !Arg->hasName())
989 return false;
990- VectorType* VTy = dyn_cast<VectorType>(Arg->getType());
991+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Arg->getType());
992 if (!VTy || VTy->getNumElements() != 3 ||
993 !VTy->getElementType()->isIntegerTy(32))
994 return false;
995@@ -994,7 +995,11 @@ static bool hasLongStridedLdStInLoop(Function* F, LoopInfo* LI, WIAnalysis* WI)
996 // Collect innermost simple loop.
997 for (auto I = LI->begin(), E = LI->end(); I != E; ++I) {
998 auto L = *I;
999+#if LLVM_VERSION_MAJOR >= 12
1000+ if (!L->isInnermost())
1001+#else
1002 if (!L->empty())
1003+#endif
1004 continue;
1005 if (L->getNumBlocks() != 2)
1006 continue;
1007diff --git a/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp b/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp
1008index 73f472b5..0069c4b1 100644
1009--- a/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp
1010+++ b/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp
1011@@ -352,7 +352,7 @@ static unsigned getLegalVectorSize(unsigned N) {
1012 // Check vector size. We may demote the data type if all values can fit into
1013 // smaller data type.
1014 //
1015-static bool checkSize(GlobalVariable* GV, VectorType*& DataType,
1016+static bool checkSize(GlobalVariable* GV, IGCLLVM::FixedVectorType*& DataType,
1017 bool& IsSigned) {
1018 Constant* Init = GV->getInitializer();
1019 IGC_ASSERT(isa<ArrayType>(Init->getType()));
1020@@ -360,7 +360,7 @@ static bool checkSize(GlobalVariable* GV, VectorType*& DataType,
1021 unsigned N = (unsigned)ArrayTy->getArrayNumElements();
1022 Type* BaseTy = ArrayTy->getArrayElementType();
1023 unsigned VectorSize = 1;
1024- if (auto VT = dyn_cast<VectorType>(BaseTy)) {
1025+ if (auto VT = dyn_cast<IGCLLVM::FixedVectorType>(BaseTy)) {
1026 BaseTy = VT->getElementType();
1027 VectorSize = int_cast<unsigned>(VT->getNumElements());
1028 N *= VectorSize;
1029@@ -483,7 +483,7 @@ static Constant* getConstantVal(Type* VEltTy, Constant* V, bool IsSigned) {
1030 return ConstantInt::get(VEltTy, IVal, IsSigned);
1031 }
1032
1033-static void promote(GlobalVariable* GV, VectorType* AllocaType, bool IsSigned,
1034+static void promote(GlobalVariable* GV, IGCLLVM::FixedVectorType* AllocaType, bool IsSigned,
1035 Function* F) {
1036 // Build the constant vector from constant array.
1037 unsigned VS = int_cast<unsigned>(AllocaType->getNumElements());
1038@@ -507,7 +507,7 @@ static void promote(GlobalVariable* GV, VectorType* AllocaType, bool IsSigned,
1039 Constant* const Elt = CA->getAggregateElement(i);
1040 IGC_ASSERT_MESSAGE(nullptr != Elt, "Null AggregateElement");
1041 if (auto EltTy = dyn_cast<VectorType>(Elt->getType())) {
1042- unsigned VectorSize = (unsigned)cast<VectorType>(EltTy)->getNumElements();
1043+ unsigned VectorSize = (unsigned)cast<IGCLLVM::FixedVectorType>(EltTy)->getNumElements();
1044 for (unsigned j = 0; j < VectorSize; ++j) {
1045 Constant* V = Elt->getAggregateElement(j);
1046 Vals[i * VectorSize + j] = getConstantVal(VEltTy, V, IsSigned);
1047@@ -549,7 +549,7 @@ static void promote(GlobalVariable* GV, VectorType* AllocaType, bool IsSigned,
1048 unsigned N = 1;
1049 Value* Offset = Index;
1050 if (Ty->isVectorTy()) {
1051- N = (unsigned)cast<VectorType>(Ty)->getNumElements();
1052+ N = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements();
1053 Offset = Builder.CreateMul(Offset, ConstantInt::get(Offset->getType(), N));
1054 }
1055 Value* Val = extractNElts(N, VectorData, Offset, Builder);
1056@@ -684,7 +684,7 @@ bool PromoteConstant::runOnFunction(Function& F) {
1057
1058 // If possible demote the data into smaller type. Uses of value will be
1059 // promoted back with ZExt or SExt.
1060- VectorType* AllocaType = nullptr;
1061+ IGCLLVM::FixedVectorType* AllocaType = nullptr;
1062 bool IsSigned = false;
1063 if (!checkSize(GV, AllocaType, IsSigned))
1064 continue;
1065diff --git a/IGC/Compiler/CISACodeGen/TypeDemote.cpp b/IGC/Compiler/CISACodeGen/TypeDemote.cpp
1066index eb7a7b64..b04a0f6e 100644
1067--- a/IGC/Compiler/CISACodeGen/TypeDemote.cpp
1068+++ b/IGC/Compiler/CISACodeGen/TypeDemote.cpp
1069@@ -32,6 +32,7 @@ IN THE SOFTWARE.
1070 #include <llvm/ADT/PostOrderIterator.h>
1071 #include <llvm/IR/IRBuilder.h>
1072 #include <llvm/Pass.h>
1073+#include <llvmWrapper/IR/DerivedTypes.h>
1074 #include "common/LLVMWarningsPop.hpp"
1075 #include "GenISAIntrinsics/GenIntrinsics.h"
1076 #include "Probe/Assertion.h"
1077@@ -288,7 +289,7 @@ bool TypeDemote::demoteOnBasicBlock(BasicBlock* BB) const {
1078 CastInst* CI = dyn_cast<CastInst>(Index);
1079 if (CI && (CI->getOpcode() == Instruction::ZExt ||
1080 CI->getOpcode() == Instruction::SExt)) {
1081- unsigned VS = (unsigned)cast<VectorType>(EEI->getVectorOperandType())->getNumElements();
1082+ unsigned VS = (unsigned)cast<IGCLLVM::FixedVectorType>(EEI->getVectorOperandType())->getNumElements();
1083 unsigned N = (unsigned int)CI->getSrcTy()->getPrimitiveSizeInBits();
1084 unsigned Bound = (N < 32) ? (1U << N) : UINT32_MAX;
1085 if (VS <= Bound) {
1086diff --git a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp
1087index 1cac7b12..12c4734e 100644
1088--- a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp
1089+++ b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp
1090@@ -28,6 +28,7 @@ IN THE SOFTWARE.
1091 #include "Compiler/CodeGenPublic.h"
1092 #include "common/LLVMWarningsPush.hpp"
1093 #include <llvm/Support/Debug.h>
1094+#include "llvmWrapper/IR/DerivedTypes.h"
1095 #include "common/LLVMWarningsPop.hpp"
1096 #include <algorithm>
1097 #include "Probe/Assertion.h"
1098@@ -40,13 +41,13 @@ namespace
1099 // If V is scalar, return 1.
1100 // if V is vector, return the number of elements.
1101 inline int getNumElts(Value* V) {
1102- VectorType* VTy = dyn_cast<VectorType>(V->getType());
1103+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(V->getType());
1104 return VTy ? (int)VTy->getNumElements() : 1;
1105 }
1106
1107 inline int getTypeSizeInBits(Type* Ty) {
1108 int scalarBits = Ty->getScalarSizeInBits();
1109- VectorType* VTy = dyn_cast<VectorType>(Ty);
1110+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
1111 return scalarBits * (VTy ? (int)VTy->getNumElements() : 1);
1112 }
1113 }
1114diff --git a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp
1115index 56dac17e..42081dca 100644
1116--- a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp
1117+++ b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp
1118@@ -37,6 +37,7 @@ IN THE SOFTWARE.
1119 #include <llvm/IR/InstIterator.h>
1120 #include <llvm/IR/InstVisitor.h>
1121 #include "llvm/Pass.h"
1122+#include "llvmWrapper/IR/DerivedTypes.h"
1123 #include "llvm/Support/raw_ostream.h"
1124 #include "common/LLVMWarningsPop.hpp"
1125 #include "Compiler/CISACodeGen/RegisterEstimator.hpp"
1126@@ -79,7 +80,7 @@ namespace IGC {
1127 SSubVecDesc(llvm::Value* V)
1128 : Aliaser(V), BaseVector(V), StartElementOffset(0)
1129 {
1130- llvm::VectorType* VTy = llvm::dyn_cast<llvm::VectorType>(V->getType());
1131+ IGCLLVM::FixedVectorType* VTy = llvm::dyn_cast<IGCLLVM::FixedVectorType>(V->getType());
1132 NumElts = VTy ? (short)VTy->getNumElements() : 1;
1133 }
1134
1135diff --git a/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp b/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp
1136index 4c2b0644..4cd6a2db 100644
1137--- a/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp
1138+++ b/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp
1139@@ -500,7 +500,7 @@ void VectorPreProcess::replaceAllVectorUsesWithScalars(Instruction* VI, ValVecto
1140 I = VI->getParent()->getFirstNonPHI();
1141 }
1142 IRBuilder<> Builder(I);
1143- VectorType* VTy = cast<VectorType>(VI->getType());
1144+ IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(VI->getType());
1145 Value* newVec = UndefValue::get(VTy);
1146 for (uint32_t i = 0, e = int_cast<uint32_t>(VTy->getNumElements()); i < e; ++i)
1147 {
1148@@ -619,7 +619,7 @@ bool VectorPreProcess::splitStore(
1149 {
1150 Instruction* SI = ASI.getInst();
1151 Value* StoredVal = ASI.getValueOperand();
1152- VectorType* VTy = cast<VectorType>(StoredVal->getType());
1153+ IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(StoredVal->getType());
1154 Type* ETy = VTy->getElementType();
1155 uint32_t nelts = int_cast<uint32_t>(VTy->getNumElements());
1156
1157@@ -705,7 +705,7 @@ bool VectorPreProcess::splitStore(
1158 {
1159 Type* Ty1 = splitInfo[i].first;
1160 uint32_t len1 = splitInfo[i].second;
1161- VectorType* VTy1 = dyn_cast<VectorType>(Ty1);
1162+ IGCLLVM::FixedVectorType* VTy1 = dyn_cast<IGCLLVM::FixedVectorType>(Ty1);
1163 for (uint32_t j = 0; j < len1; ++j)
1164 {
1165 Value* subVec;
1166@@ -742,7 +742,7 @@ bool VectorPreProcess::splitStore(
1167 {
1168 Type* Ty1 = splitInfo[i].first;
1169 uint32_t len1 = splitInfo[i].second;
1170- VectorType* VTy1 = dyn_cast<VectorType>(Ty1);
1171+ IGCLLVM::FixedVectorType* VTy1 = dyn_cast<IGCLLVM::FixedVectorType>(Ty1);
1172 for (uint32_t j = 0; j < len1; ++j)
1173 {
1174 uint32_t vAlign = (uint32_t)MinAlign(Align, (uint32_t)eOffset * EBytes);
1175@@ -786,7 +786,7 @@ bool VectorPreProcess::splitLoad(
1176 {
1177 Instruction* LI = ALI.getInst();
1178 bool isLdRaw = isa<LdRawIntrinsic>(LI);
1179- VectorType* VTy = cast<VectorType>(LI->getType());
1180+ IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(LI->getType());
1181 Type* ETy = VTy->getElementType();
1182 uint32_t nelts = int_cast<uint32_t>(VTy->getNumElements());
1183
1184@@ -848,7 +848,7 @@ bool VectorPreProcess::splitLoad(
1185 {
1186 Type* Ty1 = splitInfo[i].first;
1187 uint32_t len1 = splitInfo[i].second;
1188- VectorType* VTy1 = dyn_cast<VectorType>(Ty1);
1189+ IGCLLVM::FixedVectorType* VTy1 = dyn_cast<IGCLLVM::FixedVectorType>(Ty1);
1190 for (uint32_t j = 0; j < len1; ++j)
1191 {
1192 uint32_t vAlign = (uint32_t)MinAlign(Align, eOffset * EBytes);
1193@@ -916,7 +916,7 @@ bool VectorPreProcess::splitLoadStore(
1194 Optional<AbstractStoreInst> ASI = AbstractStoreInst::get(Inst);
1195 IGC_ASSERT_MESSAGE((ALI || ASI), "Inst should be either load or store");
1196 Type* Ty = ALI ? ALI->getInst()->getType() : ASI->getValueOperand()->getType();
1197- VectorType* VTy = dyn_cast<VectorType>(Ty);
1198+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
1199 if (!VTy)
1200 {
1201 return false;
1202@@ -1147,7 +1147,7 @@ void VectorPreProcess::getOrGenScalarValues(
1203 {
1204 availBeforeInst = nullptr;
1205
1206- VectorType* VTy = cast<VectorType>(VecVal->getType());
1207+ IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(VecVal->getType());
1208 if (!VTy)
1209 {
1210 scalars[0] = VecVal;
1211@@ -1298,7 +1298,7 @@ Instruction* VectorPreProcess::simplifyLoadStore(Instruction* Inst)
1212 //
1213 // TODO: further optimize this load into a message with channel masks
1214 // for cases in which use indices are sparse like {0, 2}.
1215- unsigned N = (unsigned)cast<VectorType>(Inst->getType())->getNumElements();
1216+ unsigned N = (unsigned)cast<IGCLLVM::FixedVectorType>(Inst->getType())->getNumElements();
1217 if (N == MaxIndex + 1)
1218 return Inst;
1219
1220@@ -1355,7 +1355,7 @@ Instruction* VectorPreProcess::simplifyLoadStore(Instruction* Inst)
1221 if (NBits < 32)
1222 return Inst;
1223
1224- unsigned N = (unsigned)cast<VectorType>(Val->getType())->getNumElements();
1225+ unsigned N = (unsigned)cast<IGCLLVM::FixedVectorType>(Val->getType())->getNumElements();
1226 if (auto CV = dyn_cast<ConstantVector>(Val))
1227 {
1228 unsigned MaxIndex = 0;
1229@@ -1524,7 +1524,7 @@ bool VectorPreProcess::runOnFunction(Function& F)
1230 for (uint32_t j = 0; j < svals.size(); ++j)
1231 {
1232 Type* Ty1 = svals[j]->getType();
1233- VectorType* VTy1 = dyn_cast<VectorType>(Ty1);
1234+ IGCLLVM::FixedVectorType* VTy1 = dyn_cast<IGCLLVM::FixedVectorType>(Ty1);
1235 if (VTy1) {
1236 for (uint32_t k = 0; k < VTy1->getNumElements(); ++k)
1237 {
1238@@ -1573,7 +1573,7 @@ bool VectorPreProcess::runOnFunction(Function& F)
1239 // If this is a 3-element vector load, remove it
1240 // from m_Vector3List as well.
1241 if (isAbstractLoadInst(tInst) && tInst->getType()->isVectorTy() &&
1242- cast<VectorType>(tInst->getType())->getNumElements() == 3)
1243+ cast<IGCLLVM::FixedVectorType>(tInst->getType())->getNumElements() == 3)
1244 {
1245 InstWorkVector::iterator
1246 tI = m_Vector3List.begin(),
1247diff --git a/IGC/Compiler/CISACodeGen/VectorProcess.cpp b/IGC/Compiler/CISACodeGen/VectorProcess.cpp
1248index 9f39cdc0..cfe45321 100644
1249--- a/IGC/Compiler/CISACodeGen/VectorProcess.cpp
1250+++ b/IGC/Compiler/CISACodeGen/VectorProcess.cpp
1251@@ -240,7 +240,7 @@ bool VectorProcess::reLayoutLoadStore(Instruction* Inst)
1252 IGC_ASSERT(nullptr != Ptr);
1253 IGC_ASSERT(nullptr != Ty);
1254
1255- VectorType* const VTy = dyn_cast<VectorType>(Ty);
1256+ IGCLLVM::FixedVectorType* const VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
1257
1258 // Treat a scalar as 1-element vector
1259 uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
1260@@ -654,7 +654,7 @@ void VectorMessage::getInfo(Type* Ty, uint32_t Align, bool useA32,
1261 VectorType* VTy = dyn_cast<VectorType>(Ty);
1262 Type* eTy = VTy ? cast<VectorType>(VTy)->getElementType() : Ty;
1263 unsigned eltSize = m_emitter->GetScalarTypeSizeInRegister(eTy);
1264- unsigned nElts = VTy ? (unsigned)cast<VectorType>(VTy)->getNumElements() : 1;
1265+ unsigned nElts = VTy ? (unsigned)cast<IGCLLVM::FixedVectorType>(VTy)->getNumElements() : 1;
1266 // total bytes
1267 const unsigned TBytes = nElts * eltSize;
1268
1269diff --git a/IGC/Compiler/CISACodeGen/helper.cpp b/IGC/Compiler/CISACodeGen/helper.cpp
1270index 784affaa..e5507283 100644
1271--- a/IGC/Compiler/CISACodeGen/helper.cpp
1272+++ b/IGC/Compiler/CISACodeGen/helper.cpp
1273@@ -1634,7 +1634,7 @@ namespace IGC
1274 {
1275 instList[i] = builder.CreateExtractElement(val, static_cast<uint64_t>(0));
1276 size_t iOld = i;
1277- for (unsigned j = 1; j < cast<VectorType>(val->getType())->getNumElements(); j++)
1278+ for (unsigned j = 1; j < cast<IGCLLVM::FixedVectorType>(val->getType())->getNumElements(); j++)
1279 {
1280 instList.insert(instList.begin()+ iOld +j, builder.CreateExtractElement(val, j));
1281 i++;
1282@@ -1667,7 +1667,7 @@ namespace IGC
1283 }
1284 break;
1285 case IGCLLVM::VectorTyID:
1286- num = (unsigned)cast<VectorType>(type)->getNumElements();
1287+ num = (unsigned)cast<IGCLLVM::FixedVectorType>(type)->getNumElements();
1288 for (unsigned i = 0; i < num; i++)
1289 {
1290 ScalarizeAggregateMembers(builder, builder.CreateExtractElement(val, i), instList);
1291@@ -1707,7 +1707,7 @@ namespace IGC
1292 }
1293 break;
1294 case IGCLLVM::VectorTyID:
1295- num = (unsigned)cast<VectorType>(type)->getNumElements();
1296+ num = (unsigned)cast<IGCLLVM::FixedVectorType>(type)->getNumElements();
1297 for (unsigned i = 0; i < num; i++)
1298 {
1299 indices.push_back(builder.getInt32(i));
1300@@ -1972,8 +1972,8 @@ namespace IGC
1301 return false;
1302 }
1303
1304- VectorType* dVTy = dyn_cast<VectorType>(dTy);
1305- VectorType* sVTy = dyn_cast<VectorType>(sTy);
1306+ IGCLLVM::FixedVectorType* dVTy = dyn_cast<IGCLLVM::FixedVectorType>(dTy);
1307+ IGCLLVM::FixedVectorType* sVTy = dyn_cast<IGCLLVM::FixedVectorType>(sTy);
1308 int d_nelts = dVTy ? (int)dVTy->getNumElements() : 1;
1309 int s_nelts = sVTy ? (int)sVTy->getNumElements() : 1;
1310 if (d_nelts != s_nelts) {
1311diff --git a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
1312index cd7fc66e..adf992cb 100644
1313--- a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
1314+++ b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
1315@@ -153,15 +153,24 @@ void ConvertMSAAPayloadTo16Bit::visitCallInst(CallInst& I)
1316 // In OGL there are uses of ldmcs other then ldms, using vec4float type.
1317 // Fix them to use newly created 16bit ldmcs.
1318 if (ldmcs->getType()->isVectorTy() &&
1319+#if LLVM_VERSION_MAJOR >= 12
1320+ ldmcs->getType()->getScalarType()->isFloatTy())
1321+#else
1322 ldmcs->getType()->getVectorElementType()->isFloatTy())
1323+#endif
1324 {
1325 m_builder->SetInsertPoint(ldmcs);
1326
1327+#if LLVM_VERSION_MAJOR >= 12
1328+ uint ldmcsNumOfElements = cast<IGCLLVM::FixedVectorType>(ldmcs->getType())->getNumElements();
1329+ uint new_mcs_callNumOfElements = cast<IGCLLVM::FixedVectorType>(new_mcs_call->getType())->getNumElements();
1330+#else
1331 uint ldmcsNumOfElements = ldmcs->getType()->getVectorNumElements();
1332 uint new_mcs_callNumOfElements = new_mcs_call->getType()->getVectorNumElements();
1333+#endif
1334
1335 // vec of 16bit ints to vec of 32bit ints
1336- Type* new_mcs_callVecType = VectorType::get(m_builder->getInt32Ty(), new_mcs_callNumOfElements);
1337+ Type* new_mcs_callVecType = IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), new_mcs_callNumOfElements);
1338 Value* ldmcsExtendedToInt32 = m_builder->CreateSExt(new_mcs_call, new_mcs_callVecType);
1339
1340 // if new ldmcs has fewer elements than ldmcs, extend vector
1341@@ -175,7 +184,7 @@ void ConvertMSAAPayloadTo16Bit::visitCallInst(CallInst& I)
1342 }
1343 auto* pMask = ConstantDataVector::get(I.getContext(), maskVals);
1344
1345- newLdmcsSizedVector = m_builder->CreateShuffleVector(ldmcsExtendedToInt32, UndefValue::get(VectorType::get(m_builder->getInt32Ty(), ldmcsNumOfElements)), pMask);
1346+ newLdmcsSizedVector = m_builder->CreateShuffleVector(ldmcsExtendedToInt32, UndefValue::get(IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), ldmcsNumOfElements)), pMask);
1347 }
1348 else
1349 {
1350@@ -183,7 +192,7 @@ void ConvertMSAAPayloadTo16Bit::visitCallInst(CallInst& I)
1351 }
1352 IGC_ASSERT(newLdmcsSizedVector);
1353
1354- Type* ldmcsFloatVecType = VectorType::get(m_builder->getFloatTy(), ldmcsNumOfElements);
1355+ Type* ldmcsFloatVecType = IGCLLVM::FixedVectorType::get(m_builder->getFloatTy(), ldmcsNumOfElements);
1356 Value* ldmcsBitcastedToFloat = m_builder->CreateBitCast(ldmcsExtendedToInt32, ldmcsFloatVecType);
1357 ldmcs->replaceAllUsesWith(ldmcsBitcastedToFloat);
1358 }
1359diff --git a/IGC/Compiler/CustomSafeOptPass.cpp b/IGC/Compiler/CustomSafeOptPass.cpp
1360index 707bbfbe..72859a91 100644
1361--- a/IGC/Compiler/CustomSafeOptPass.cpp
1362+++ b/IGC/Compiler/CustomSafeOptPass.cpp
1363@@ -1372,7 +1372,7 @@ void IGC::CustomSafeOptPass::visitSampleBptr(llvm::SampleIntrinsic* sampleInst)
1364 bool CustomSafeOptPass::isIdentityMatrix(ExtractElementInst& I)
1365 {
1366 bool found = false;
1367- auto extractType = cast<VectorType>(I.getVectorOperandType());
1368+ auto extractType = cast<IGCLLVM::FixedVectorType>(I.getVectorOperandType());
1369 auto extractTypeVecSize = (uint32_t)extractType->getNumElements();
1370 if (extractTypeVecSize == 20 ||
1371 extractTypeVecSize == 16)
1372@@ -1601,7 +1601,7 @@ void CustomSafeOptPass::visitExtractElementInst(ExtractElementInst& I)
1373 int elOffset = (int)(bitShift / eltSize);
1374 elOffset = rightShift ? elOffset : -elOffset;
1375 unsigned int newIndex = (unsigned int)((int)cstIndex->getZExtValue() + elOffset);
1376- if (newIndex < cast<VectorType>(vecType)->getNumElements())
1377+ if (newIndex < cast<IGCLLVM::FixedVectorType>(vecType)->getNumElements())
1378 {
1379 IRBuilder<> builder(&I);
1380 Value* newBitCast = builder.CreateBitCast(binOp->getOperand(0), vecType);
1381@@ -2001,7 +2001,7 @@ void GenSpecificPattern::createBitcastExtractInsertPattern(BinaryOperator& I, Va
1382 else if (auto IEIInst = dyn_cast<InsertElementInst>(Op))
1383 {
1384 auto opType = IEIInst->getType();
1385- if (opType->isVectorTy() && cast<VectorType>(opType)->getElementType()->isIntegerTy(32) && cast<VectorType>(opType)->getNumElements() == 2)
1386+ if (opType->isVectorTy() && cast<VectorType>(opType)->getElementType()->isIntegerTy(32) && cast<IGCLLVM::FixedVectorType>(opType)->getNumElements() == 2)
1387 {
1388 elem = IEIInst->getOperand(1);
1389 }
1390@@ -2064,7 +2064,7 @@ void GenSpecificPattern::visitBinaryOperator(BinaryOperator& I)
1391 else if (match(&I, pattern2) && AndOp2->getType()->isIntegerTy(64))
1392 {
1393 ConstantVector* cVec = dyn_cast<ConstantVector>(VecOp);
1394- VectorType* vector_type = dyn_cast<VectorType>(VecOp->getType());
1395+ IGCLLVM::FixedVectorType* vector_type = dyn_cast<IGCLLVM::FixedVectorType>(VecOp->getType());
1396 if (cVec && vector_type &&
1397 isa<ConstantInt>(cVec->getOperand(0)) &&
1398 cast<ConstantInt>(cVec->getOperand(0))->isZero() &&
1399@@ -2210,7 +2210,7 @@ void GenSpecificPattern::visitBinaryOperator(BinaryOperator& I)
1400 BitCastInst* opBC = cast<BitCastInst>(op);
1401
1402 auto opType = opBC->getType();
1403- if (!(opType->isVectorTy() && cast<VectorType>(opType)->getElementType()->isIntegerTy(32) && cast<VectorType>(opType)->getNumElements() == 2))
1404+ if (!(opType->isVectorTy() && cast<VectorType>(opType)->getElementType()->isIntegerTy(32) && cast<IGCLLVM::FixedVectorType>(opType)->getNumElements() == 2))
1405 return nullptr;
1406
1407 if (opBC->getSrcTy()->isDoubleTy())
1408@@ -2630,8 +2630,8 @@ void GenSpecificPattern::visitBitCastInst(BitCastInst& I)
1409 if (zExtInst->getOperand(0)->getType()->isIntegerTy(32) &&
1410 isa<InsertElementInst>(bitCastInst->getOperand(0)) &&
1411 bitCastInst->getOperand(0)->getType()->isVectorTy() &&
1412- cast<VectorType>(bitCastInst->getOperand(0)->getType())->getElementType()->isIntegerTy(32) &&
1413- cast<VectorType>(bitCastInst->getOperand(0)->getType())->getNumElements() == 2)
1414+ cast<IGCLLVM::FixedVectorType>(bitCastInst->getOperand(0)->getType())->getElementType()->isIntegerTy(32) &&
1415+ cast<IGCLLVM::FixedVectorType>(bitCastInst->getOperand(0)->getType())->getNumElements() == 2)
1416 {
1417 InsertElementInst* insertElementInst = cast<InsertElementInst>(bitCastInst->getOperand(0));
1418
1419@@ -2731,7 +2731,7 @@ void GenSpecificPattern::visitFNeg(llvm::UnaryOperator& I)
1420 }
1421 else
1422 {
1423- uint32_t vectorSize = cast<VectorType>(I.getType())->getNumElements();
1424+ uint32_t vectorSize = cast<IGCLLVM::FixedVectorType>(I.getType())->getNumElements();
1425 fsub = llvm::UndefValue::get(I.getType());
1426
1427 for (uint32_t i = 0; i < vectorSize; ++i)
1428@@ -2845,7 +2845,7 @@ Constant* IGCConstProp::replaceShaderConstant(LoadInst* inst)
1429 if (inst->getType()->isVectorTy())
1430 {
1431 Type* srcEltTy = cast<VectorType>(inst->getType())->getElementType();
1432- uint32_t srcNElts = (uint32_t)cast<VectorType>(inst->getType())->getNumElements();
1433+ uint32_t srcNElts = (uint32_t)cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements();
1434 uint32_t eltSize_in_bytes = (unsigned int)srcEltTy->getPrimitiveSizeInBits() / 8;
1435 IRBuilder<> builder(inst);
1436 Value* vectorValue = UndefValue::get(inst->getType());
1437@@ -3122,7 +3122,7 @@ Constant* IGCConstProp::ConstantFoldCmpInst(CmpInst* CI)
1438 {
1439 bool AllTrue = true, AllFalse = true;
1440 auto VecOpnd = cast<Constant>(EEI->getVectorOperand());
1441- unsigned N = (unsigned)cast<VectorType>(VecOpnd->getType())->getNumElements();
1442+ unsigned N = (unsigned)cast<IGCLLVM::FixedVectorType>(VecOpnd->getType())->getNumElements();
1443 for (unsigned i = 0; i < N; ++i)
1444 {
1445 Constant* const Opnd = VecOpnd->getAggregateElement(i);
1446@@ -3918,8 +3918,8 @@ namespace IGC
1447 BitCastInst* BC = dyn_cast<BitCastInst>(&*BI++);
1448 if (!BC) continue;
1449 // Skip non-element-wise bitcast.
1450- VectorType* DstVTy = dyn_cast<VectorType>(BC->getType());
1451- VectorType* SrcVTy = dyn_cast<VectorType>(BC->getOperand(0)->getType());
1452+ IGCLLVM::FixedVectorType* DstVTy = dyn_cast<IGCLLVM::FixedVectorType>(BC->getType());
1453+ IGCLLVM::FixedVectorType* SrcVTy = dyn_cast<IGCLLVM::FixedVectorType>(BC->getOperand(0)->getType());
1454 if (!DstVTy || !SrcVTy || DstVTy->getNumElements() != SrcVTy->getNumElements())
1455 continue;
1456 // Skip if it's not used only all extractelement.
1457@@ -4689,7 +4689,7 @@ void SplitIndirectEEtoSel::visitExtractElementInst(llvm::ExtractElementInst& I)
1458 {
1459 using namespace llvm::PatternMatch;
1460
1461- VectorType* vecTy = I.getVectorOperandType();
1462+ IGCLLVM::FixedVectorType* vecTy = dyn_cast<IGCLLVM::FixedVectorType>(I.getVectorOperandType());
1463 uint64_t num = vecTy->getNumElements();
1464 Type* eleType = vecTy->getElementType();
1465
1466diff --git a/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp b/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp
1467index 885ad65a..923f296e 100644
1468--- a/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp
1469+++ b/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp
1470@@ -32,6 +32,7 @@ IN THE SOFTWARE.
1471 #include "DebugInfo/DebugInfoUtils.hpp"
1472
1473 #include "common/LLVMWarningsPush.hpp"
1474+#include "llvmWrapper/IR/DerivedTypes.h"
1475 #include "llvm/IR/Function.h"
1476 #include "llvm/IR/Module.h"
1477 #include "common/LLVMWarningsPop.hpp"
1478@@ -581,7 +582,7 @@ ScalarVisaModule::GetVariableLocation(const llvm::Instruction* pInst) const
1479
1480 if (pType->isVectorTy())
1481 {
1482- vectorNumElements = (unsigned)cast<VectorType>(pType)->getNumElements();
1483+ vectorNumElements = (unsigned)cast<IGCLLVM::FixedVectorType>(pType)->getNumElements();
1484 }
1485 else if (!pVar->IsUniform())
1486 {
1487diff --git a/IGC/Compiler/GenTTI.cpp b/IGC/Compiler/GenTTI.cpp
1488index 34b21c73..9e4d2f26 100644
1489--- a/IGC/Compiler/GenTTI.cpp
1490+++ b/IGC/Compiler/GenTTI.cpp
1491@@ -216,7 +216,13 @@ namespace llvm {
1492
1493 // Skip non-simple loop.
1494 if (L->getNumBlocks() != 1) {
1495- if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) && L->empty()) {
1496+ if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) &&
1497+#if LLVM_VERSION_MAJOR >= 12
1498+ L->isInnermost()
1499+#else
1500+ L->empty()
1501+#endif
1502+ ) {
1503 auto countNonPHI = [](BasicBlock* BB) {
1504 unsigned Total = BB->size();
1505 unsigned PHIs = 0;
1506diff --git a/IGC/Compiler/GenUpdateCB.cpp b/IGC/Compiler/GenUpdateCB.cpp
1507index 89b414b6..9034066c 100644
1508--- a/IGC/Compiler/GenUpdateCB.cpp
1509+++ b/IGC/Compiler/GenUpdateCB.cpp
1510@@ -24,6 +24,7 @@ IN THE SOFTWARE.
1511
1512 #include "common/LLVMWarningsPush.hpp"
1513 #include "llvmWrapper/Bitcode/BitcodeWriter.h"
1514+#include "llvmWrapper/IR/DerivedTypes.h"
1515 #include <llvm/Support/ScaledNumber.h>
1516 #include <llvm/Bitcode/BitcodeReader.h>
1517 #include "llvm/IR/DebugInfo.h"
1518@@ -384,7 +385,7 @@ bool GenUpdateCB::runOnFunction(Function& F)
1519 isResInfo(dyn_cast<GenIntrinsicInst>(inst,
1520 GenISAIntrinsic::GenISA_resinfoptr), texId, lod, isUAV))
1521 {
1522- unsigned nelems = (unsigned)cast<VectorType>(inst->getType())->getNumElements();
1523+ unsigned nelems = (unsigned)cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements();
1524 SmallVector< SmallVector<ExtractElementInst*, 1>, 4> extracts(nelems);
1525 if (VectorUsedByConstExtractOnly(inst, extracts))
1526 {
1527diff --git a/IGC/Compiler/HandleFRemInstructions.cpp b/IGC/Compiler/HandleFRemInstructions.cpp
1528index 94995a56..4523f3f0 100644
1529--- a/IGC/Compiler/HandleFRemInstructions.cpp
1530+++ b/IGC/Compiler/HandleFRemInstructions.cpp
1531@@ -28,6 +28,7 @@ IN THE SOFTWARE.
1532 #include <llvm/IR/Instructions.h>
1533 #include <llvm/IR/InstIterator.h>
1534 #include <llvm/Transforms/Utils/BasicBlockUtils.h>
1535+#include "llvmWrapper/IR/DerivedTypes.h"
1536 #include "common/LLVMWarningsPop.hpp"
1537 #include "Compiler/IGCPassSupport.h"
1538 #include "Probe/Assertion.h"
1539@@ -77,7 +78,7 @@ void HandleFRemInstructions::visitFRem(llvm::BinaryOperator& I)
1540
1541 if (ValType->isVectorTy())
1542 {
1543- auto VecCount = cast<VectorType>(ValType)->getNumElements();
1544+ auto VecCount = cast<IGCLLVM::FixedVectorType>(ValType)->getNumElements();
1545 if (VecCount == 2 || VecCount == 3 || VecCount == 4 || VecCount == 8 || VecCount == 16)
1546 {
1547 VecStr = "v" + std::to_string(VecCount);
1548diff --git a/IGC/Compiler/HandleLoadStoreInstructions.cpp b/IGC/Compiler/HandleLoadStoreInstructions.cpp
1549index d18eec73..c5535701 100644
1550--- a/IGC/Compiler/HandleLoadStoreInstructions.cpp
1551+++ b/IGC/Compiler/HandleLoadStoreInstructions.cpp
1552@@ -77,7 +77,7 @@ void HandleLoadStoreInstructions::visitLoadInst(llvm::LoadInst& I)
1553
1554 if (I.getType()->isVectorTy())
1555 {
1556- numVectorElements = (uint32_t)cast<VectorType>(I.getType())->getNumElements();
1557+ numVectorElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(I.getType())->getNumElements();
1558 doubleDstType = IGCLLVM::FixedVectorType::get(builder.getDoubleTy(), numVectorElements);
1559 }
1560 uint as = ptrv->getType()->getPointerAddressSpace();
1561@@ -163,7 +163,7 @@ void HandleLoadStoreInstructions::visitStoreInst(llvm::StoreInst& I)
1562
1563 if (I.getValueOperand()->getType()->isVectorTy())
1564 {
1565- numVectorElements = (uint32_t)cast<VectorType>(I.getValueOperand()->getType())->getNumElements();
1566+ numVectorElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(I.getValueOperand()->getType())->getNumElements();
1567 }
1568
1569
1570diff --git a/IGC/Compiler/LegalizationPass.cpp b/IGC/Compiler/LegalizationPass.cpp
1571index b651350b..9524a495 100644
1572--- a/IGC/Compiler/LegalizationPass.cpp
1573+++ b/IGC/Compiler/LegalizationPass.cpp
1574@@ -670,7 +670,7 @@ void Legalization::visitBitCastInst(llvm::BitCastInst& I)
1575 if (!isa<TruncInst>(pZ->getOperand(0)))
1576 return;
1577
1578- auto* pVecTy = cast<VectorType>(pZ->getDestTy());
1579+ auto* pVecTy = cast<IGCLLVM::FixedVectorType>(pZ->getDestTy());
1580 if (pVecTy->getNumElements() != 3)
1581 return;
1582
1583@@ -765,7 +765,7 @@ void Legalization::visitSelectInst(SelectInst& I)
1584 }
1585 else if (I.getType()->isVectorTy())
1586 {
1587- unsigned int vecSize = (unsigned)cast<VectorType>(I.getType())->getNumElements();
1588+ unsigned int vecSize = (unsigned)cast<IGCLLVM::FixedVectorType>(I.getType())->getNumElements();
1589 Value* newVec = UndefValue::get(I.getType());
1590 m_builder->SetInsertPoint(&I);
1591 for (unsigned int i = 0; i < vecSize; i++)
1592@@ -1147,7 +1147,7 @@ void Legalization::visitStoreInst(StoreInst& I)
1593 if (ConstantDataVector * vec = dyn_cast<ConstantDataVector>(I.getOperand(0)))
1594 {
1595 Value* newVec = UndefValue::get(vec->getType());
1596- unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
1597+ unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
1598 for (unsigned int i = 0; i < nbElement; i++)
1599 {
1600 Constant* cst = vec->getElementAsConstant(i);
1601@@ -1168,7 +1168,7 @@ void Legalization::visitStoreInst(StoreInst& I)
1602 else if (ConstantVector * vec = dyn_cast<ConstantVector>(I.getOperand(0)))
1603 {
1604 Value* newVec = UndefValue::get(vec->getType());
1605- unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
1606+ unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
1607 for (unsigned int i = 0; i < nbElement; i++)
1608 {
1609 Constant* cst = vec->getOperand(i);
1610@@ -1189,7 +1189,7 @@ void Legalization::visitStoreInst(StoreInst& I)
1611 else if (ConstantAggregateZero * vec = dyn_cast<ConstantAggregateZero>(I.getOperand(0)))
1612 {
1613 Value* newVec = UndefValue::get(vec->getType());
1614- unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
1615+ unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
1616 for (unsigned int i = 0; i < nbElement; i++)
1617 {
1618 Constant* cst = vec->getElementValue(i);
1619@@ -1340,7 +1340,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I)
1620 if (ConstantDataVector * vec = dyn_cast<ConstantDataVector>(I.getOperand(0)))
1621 {
1622 Value* newVec = UndefValue::get(vec->getType());
1623- unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
1624+ unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
1625 for (unsigned int i = 0; i < nbElement; i++)
1626 {
1627 Constant* cst = vec->getElementAsConstant(i);
1628@@ -1360,7 +1360,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I)
1629 else if (ConstantVector * vec = dyn_cast<ConstantVector>(I.getOperand(0)))
1630 {
1631 Value* newVec = UndefValue::get(I.getType());
1632- unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
1633+ unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
1634 for (unsigned int i = 0; i < nbElement; i++)
1635 {
1636 Constant* cst = vec->getOperand(i);
1637@@ -1380,7 +1380,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I)
1638 else if (ConstantAggregateZero * vec = dyn_cast<ConstantAggregateZero>(I.getOperand(0)))
1639 {
1640 Value* newVec = UndefValue::get(I.getType());
1641- unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
1642+ unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
1643 for (unsigned int i = 0; i < nbElement; i++)
1644 {
1645 Constant* cst = vec->getElementValue(i);
1646@@ -1397,7 +1397,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I)
1647 else if (I.getOperand(1)->getType()->isIntegerTy(1))
1648 {
1649 // This promotes i1 insertelement to i32
1650- unsigned int nbElement = (unsigned)cast<VectorType>(I.getOperand(0)->getType())->getNumElements();
1651+ unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(I.getOperand(0)->getType())->getNumElements();
1652 Value* newVec = UndefValue::get(IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), nbElement));
1653 PromoteInsertElement(&I, newVec);
1654 }
1655@@ -1410,7 +1410,7 @@ void Legalization::visitShuffleVectorInst(ShuffleVectorInst& I)
1656 // If the original vector is a constant, just use the scalar constant,
1657 // otherwise extract from the original vector.
1658
1659- VectorType* resType = cast<VectorType>(I.getType());
1660+ IGCLLVM::FixedVectorType* resType = cast<IGCLLVM::FixedVectorType>(I.getType());
1661 Value* newVec = UndefValue::get(resType);
1662 Value* src0 = I.getOperand(0);
1663 Value* src1 = I.getOperand(1);
1664@@ -1421,7 +1421,7 @@ void Legalization::visitShuffleVectorInst(ShuffleVectorInst& I)
1665 Constant* mask = I.getShuffleMaskForBitcode();
1666 #endif
1667 // The two inputs are guaranteed to be of the same type
1668- VectorType* inType = cast<VectorType>(src0->getType());
1669+ IGCLLVM::FixedVectorType* inType = cast<IGCLLVM::FixedVectorType>(src0->getType());
1670 int inCount = int_cast<int>(inType->getNumElements());
1671 int inBase = 2; // 2 means using undef
1672 // if inType == resType, use src0/src1 as the input
1673@@ -1637,7 +1637,7 @@ Type* Legalization::LegalAllocaType(Type* type) const
1674 #endif
1675 legalType = IGCLLVM::FixedVectorType::get(
1676 LegalAllocaType(cast<VectorType>(type)->getElementType()),
1677- (unsigned)cast<VectorType>(type)->getNumElements());
1678+ (unsigned)cast<IGCLLVM::FixedVectorType>(type)->getNumElements());
1679 break;
1680 case Type::StructTyID:
1681 return LegalStructAllocaType(type);
1682@@ -1937,7 +1937,7 @@ void Legalization::visitIntrinsicInst(llvm::IntrinsicInst& I)
1683 Value* newValue = nullptr;
1684 if (srcType->isVectorTy())
1685 {
1686- auto sourceVT = cast<VectorType>(srcType);
1687+ auto sourceVT = cast<IGCLLVM::FixedVectorType>(srcType);
1688 const unsigned int numElements = (uint32_t)sourceVT->getNumElements();
1689 Value* dstVec = UndefValue::get(srcType);
1690 for (unsigned int i = 0; i < numElements; ++i)
1691@@ -2081,7 +2081,7 @@ void Legalization::visitTruncInst(llvm::TruncInst& I) {
1692 }
1693
1694 Src = BC->getOperand(0);
1695- VectorType* VTy = dyn_cast<VectorType>(Src->getType());
1696+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Src->getType());
1697 // Bail out if it's not bitcasted from <3 x i16>
1698 if (!VTy || VTy->getNumElements() != 3 || !VTy->getElementType()->isIntegerTy(16))
1699 return;
1700diff --git a/IGC/Compiler/Legalizer/InstPromoter.cpp b/IGC/Compiler/Legalizer/InstPromoter.cpp
1701index bba1d96d..8fadf89f 100644
1702--- a/IGC/Compiler/Legalizer/InstPromoter.cpp
1703+++ b/IGC/Compiler/Legalizer/InstPromoter.cpp
1704@@ -25,6 +25,7 @@ IN THE SOFTWARE.
1705 #define DEBUG_TYPE "type-legalizer"
1706 #include "TypeLegalizer.h"
1707 #include "InstPromoter.h"
1708+#include "llvmWrapper/IR/DerivedTypes.h"
1709 #include "common/LLVMWarningsPush.hpp"
1710 #include "llvm/Support/Debug.h"
1711 #include "llvm/Support/MathExtras.h"
1712@@ -394,10 +395,16 @@ bool InstPromoter::visitBitCastInst(BitCastInst& I) {
1713 unsigned N =
1714 Val->getType()->getScalarSizeInBits() / DestTy->getScalarSizeInBits();
1715 Value* BC =
1716- IRB->CreateBitCast(Val, VectorType::get(DestTy->getScalarType(), N));
1717+ IRB->CreateBitCast(Val, IGCLLVM::FixedVectorType::get(DestTy->getScalarType(), N));
1718
1719 std::vector<Constant*> Vals;
1720- for (unsigned i = 0; i < DestTy->getVectorNumElements(); i++)
1721+ for (unsigned i = 0;
1722+#if LLVM_VERSION_MAJOR >= 12
1723+ i < cast<IGCLLVM::FixedVectorType>(DestTy)->getNumElements();
1724+#else
1725+ i < DestTy->getVectorNumElements();
1726+#endif
1727+ i++)
1728 Vals.push_back(IRB->getInt32(i));
1729
1730 Value* Mask = ConstantVector::get(Vals);
1731diff --git a/IGC/Compiler/Legalizer/InstScalarizer.cpp b/IGC/Compiler/Legalizer/InstScalarizer.cpp
1732index 3902f740..c8e18cc5 100644
1733--- a/IGC/Compiler/Legalizer/InstScalarizer.cpp
1734+++ b/IGC/Compiler/Legalizer/InstScalarizer.cpp
1735@@ -130,7 +130,7 @@ bool InstScalarizer::visitLoadInst(LoadInst& I) {
1736 // otherwise, it's broken.
1737 IGC_ASSERT(TL->getTypeSizeInBits(EltTy) == TL->getTypeStoreSizeInBits(EltTy));
1738
1739- unsigned NumElts = (unsigned)cast<VectorType>(OrigTy)->getNumElements();
1740+ unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(OrigTy)->getNumElements();
1741 unsigned Elt = 0;
1742
1743 Type* NewPtrTy = PointerType::get(EltTy, AS);
1744@@ -268,7 +268,7 @@ bool InstScalarizer::visitStoreInst(StoreInst& I) {
1745 // otherwise, it's broken.
1746 IGC_ASSERT(TL->getTypeSizeInBits(EltTy) == TL->getTypeStoreSizeInBits(EltTy));
1747
1748- unsigned NumElts = (unsigned)cast<VectorType>(OrigTy)->getNumElements();
1749+ unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(OrigTy)->getNumElements();
1750 unsigned Elt = 0;
1751
1752 Type* NewPtrTy = PointerType::get(EltTy, AS);
1753@@ -498,7 +498,7 @@ bool InstScalarizer::visitInsertElementInst(InsertElementInst& I) {
1754 IGC_ASSERT(EltSeq->size());
1755 IGC_ASSERT(VecSeqCopy.size() % EltSeq->size() == 0);
1756
1757- unsigned NumElts = (unsigned)cast<VectorType>(I.getOperand(0)->getType())->getNumElements();
1758+ unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(I.getOperand(0)->getType())->getNumElements();
1759 unsigned i = 0;
1760 for (unsigned Elt = 0; Elt != NumElts; ++Elt) {
1761 if (Elt == Idx) {
1762diff --git a/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp b/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp
1763index 28f8ce84..778132c4 100644
1764--- a/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp
1765+++ b/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp
1766@@ -162,7 +162,7 @@ void PeepholeTypeLegalizer::legalizePhiInstruction(Instruction& I)
1767
1768 if (quotient > 1)
1769 {
1770- unsigned numElements = I.getType()->isVectorTy() ? (unsigned)cast<VectorType>(I.getType())->getNumElements() : 1;
1771+ unsigned numElements = I.getType()->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(I.getType())->getNumElements() : 1;
1772 Type* newType = IGCLLVM::FixedVectorType::get(Type::getIntNTy(I.getContext(), promoteToInt), quotient * numElements);
1773
1774 PHINode* newPhi = m_builder->CreatePHI(newType, oldPhi->getNumIncomingValues());
1775@@ -223,7 +223,7 @@ void PeepholeTypeLegalizer::legalizeExtractElement(Instruction& I)
1776 unsigned elementWidth = extract->getType()->getScalarSizeInBits();
1777 if (!isLegalInteger(elementWidth) && extract->getType()->isIntOrIntVectorTy())
1778 {
1779- unsigned numElements = (unsigned)cast<VectorType>(extract->getOperand(0)->getType())->getNumElements();
1780+ unsigned numElements = (unsigned)cast<IGCLLVM::FixedVectorType>(extract->getOperand(0)->getType())->getNumElements();
1781 unsigned quotient, promoteToInt;
1782 promoteInt(elementWidth, quotient, promoteToInt, DL->getLargestLegalIntTypeSizeInBits());
1783
1784@@ -850,7 +850,7 @@ void PeepholeTypeLegalizer::cleanupZExtInst(Instruction& I) {
1785 }
1786
1787 unsigned ipElmtSize = prevInst->getOperand(0)->getType()->getScalarSizeInBits();
1788- unsigned ipVecSize = (unsigned)cast<VectorType>(prevInst->getOperand(0)->getType())->getNumElements();
1789+ unsigned ipVecSize = (unsigned)cast<IGCLLVM::FixedVectorType>(prevInst->getOperand(0)->getType())->getNumElements();
1790 unsigned convFactor = promoteToInt / ipElmtSize;
1791
1792 Value* vecRes = UndefValue::get(IGCLLVM::FixedVectorType::get(llvm::Type::getIntNTy(I.getContext(), promoteToInt), quotient));
1793diff --git a/IGC/Compiler/Legalizer/TypeLegalizer.cpp b/IGC/Compiler/Legalizer/TypeLegalizer.cpp
1794index f8f71d71..a46f42bd 100644
1795--- a/IGC/Compiler/Legalizer/TypeLegalizer.cpp
1796+++ b/IGC/Compiler/Legalizer/TypeLegalizer.cpp
1797@@ -32,6 +32,7 @@ IN THE SOFTWARE.
1798 #include "InstScalarizer.h"
1799 #include "InstElementizer.h"
1800 #include "common/LLVMWarningsPush.hpp"
1801+#include "llvmWrapper/IR/DerivedTypes.h"
1802 #include "llvm/ADT/PostOrderIterator.h"
1803 #include "llvm/IR/CFG.h"
1804 #include "llvm/Support/Debug.h"
1805@@ -290,7 +291,7 @@ TypeSeq* TypeLegalizer::getScalarizedTypeSeq(Type* Ty) {
1806 }
1807
1808 Type* EltTy = cast<VectorType>(Ty)->getElementType();
1809- for (unsigned i = 0, e = (unsigned)cast<VectorType>(Ty)->getNumElements(); i != e; ++i)
1810+ for (unsigned i = 0, e = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements(); i != e; ++i)
1811 TMI->second.push_back(EltTy);
1812
1813 return &TMI->second;
1814diff --git a/IGC/Compiler/Legalizer/TypeLegalizer.h b/IGC/Compiler/Legalizer/TypeLegalizer.h
1815index f3ce264c..a6910d08 100644
1816--- a/IGC/Compiler/Legalizer/TypeLegalizer.h
1817+++ b/IGC/Compiler/Legalizer/TypeLegalizer.h
1818@@ -28,6 +28,7 @@ IN THE SOFTWARE.
1819 #include "llvmWrapper/IR/Instructions.h"
1820 #include "llvmWrapper/Analysis/InlineCost.h"
1821 #include "llvmWrapper/IR/InstrTypes.h"
1822+#include "llvmWrapper/IR/DerivedTypes.h"
1823 #include "llvmWrapper/Support/Alignment.h"
1824 #include "llvm/ADT/ArrayRef.h"
1825 #include "llvm/ADT/DenseMap.h"
1826@@ -287,7 +288,7 @@ namespace IGC {
1827 if (!Ty->isVectorTy())
1828 return false;
1829
1830- unsigned NumElts = (unsigned)cast<VectorType>(Ty)->getNumElements();
1831+ unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements();
1832 Type* EltTy = cast<VectorType>(Ty)->getElementType();
1833 const auto& ProfitLengths = getProfitLoadVectorLength(EltTy);
1834
1835diff --git a/IGC/Compiler/LowPrecisionOptPass.cpp b/IGC/Compiler/LowPrecisionOptPass.cpp
1836index 64912719..1d1db949 100644
1837--- a/IGC/Compiler/LowPrecisionOptPass.cpp
1838+++ b/IGC/Compiler/LowPrecisionOptPass.cpp
1839@@ -252,7 +252,7 @@ bool LowPrecisionOpt::propagateSamplerType(llvm::GenIntrinsicInst& I)
1840 return false;
1841 }
1842
1843- VectorType* oldTy = cast<VectorType>(I.getType());
1844+ IGCLLVM::FixedVectorType* oldTy = cast<IGCLLVM::FixedVectorType>(I.getType());
1845 llvm::SmallVector<llvm::Type*, 4> overloadTys;
1846 auto retTy = IGCLLVM::FixedVectorType::get(newDstType, int_cast<unsigned int>(oldTy->getNumElements()));
1847 overloadTys.push_back(retTy);
1848diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
1849index 393b4b0a..e9c07b34 100644
1850--- a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
1851+++ b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
1852@@ -23,6 +23,8 @@ IN THE SOFTWARE.
1853 ============================= end_copyright_notice ===========================*/
1854
1855 #include "llvm/Config/llvm-config.h"
1856+#include "llvmWrapper/IR/DerivedTypes.h"
1857+#include "llvmWrapper/Analysis/TargetLibraryInfo.h"
1858 #include "Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.h"
1859 #include "Compiler/CodeGenPublic.h"
1860 #include "Compiler/IGCPassSupport.h"
1861@@ -178,12 +180,11 @@ namespace {
1862 bool doInitialization(Module& M) override {
1863 if(M.size() > 0)
1864 {
1865- Result.reset(new AddressSpaceAAResult(
1866- getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(
1867 #if LLVM_VERSION_MAJOR >= 10
1868- *M.begin()
1869+ Function &F = *M.begin();
1870 #endif
1871- ),
1872+ Result.reset(new AddressSpaceAAResult(
1873+ getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(),
1874 *getAnalysis<CodeGenContextWrapper>().getCodeGenContext()));
1875 }
1876 return false;
1877diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp
1878index 67535cfc..3cdd2975 100644
1879--- a/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp
1880+++ b/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp
1881@@ -24,6 +24,7 @@ IN THE SOFTWARE.
1882
1883 #include "Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.hpp"
1884 #include "Compiler/IGCPassSupport.h"
1885+#include "llvmWrapper/IR/DerivedTypes.h"
1886 #include "common/LLVMWarningsPush.hpp"
1887 #include "llvm/IR/Function.h"
1888 #include "common/LLVMWarningsPop.hpp"
1889@@ -130,7 +131,7 @@ static uint64_t getNumElements(Type* type)
1890 {
1891 return arrayType->getNumElements();
1892 }
1893- if (VectorType * vectorType = dyn_cast<VectorType>(type))
1894+ if (IGCLLVM::FixedVectorType * vectorType = dyn_cast<IGCLLVM::FixedVectorType>(type))
1895 {
1896 return vectorType->getNumElements();
1897 }
1898diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp
1899index 2a9d7499..79ed0948 100644
1900--- a/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp
1901+++ b/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp
1902@@ -27,6 +27,7 @@ IN THE SOFTWARE.
1903 #include "Compiler/IGCPassSupport.h"
1904 #include "GenISAIntrinsics/GenIntrinsicInst.h"
1905
1906+#include "llvmWrapper/IR/DerivedTypes.h"
1907 #include "common/LLVMWarningsPush.hpp"
1908 #include <llvm/IR/Function.h>
1909 #include <llvm/IR/Instructions.h>
1910@@ -133,7 +134,7 @@ Value* CorrectlyRoundedDivSqrt::emitIEEEDivide(BinaryOperator* I, Value* Op0, Va
1911 }
1912 else
1913 {
1914- auto vType = dyn_cast<VectorType>(Ty);
1915+ auto vType = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
1916 unsigned VecLen = (uint32_t)vType->getNumElements();
1917 Divide = UndefValue::get(Ty);
1918 for (unsigned i = 0; i < VecLen; i++)
1919diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
1920index c5ff3ac0..119520ed 100644
1921--- a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
1922+++ b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
1923@@ -952,7 +952,11 @@ namespace //Anonymous
1924 {
1925 auto ndrangeStructName = "struct.ndrange_t";
1926 auto module = _deviceExecCall->getModule();
1927+#if LLVM_VERSION_MAJOR >= 12
1928+ auto ndrangeTy = llvm::StructType::getTypeByName(module->getContext(), ndrangeStructName);
1929+#else
1930 auto ndrangeTy = module->getTypeByName(ndrangeStructName);
1931+#endif
1932 if (ndrangeTy == nullptr)
1933 {
1934 //create struct type
1935@@ -1697,7 +1701,7 @@ namespace //Anonymous
1936 // this generates <element_type><num_elements> string. Ie for char2 element_type is char and num_elements is 2
1937 // that is done by callin BaseTypeName on vector element type, this recursive call has only a depth of one since
1938 // there are no compound vectors in OpenCL.
1939- auto vType = llvm::dyn_cast<VectorType>(type);
1940+ auto vType = llvm::dyn_cast<IGCLLVM::FixedVectorType>(type);
1941 return BaseTypeName(type->getContainedType(0), os) << vType->getNumElements();
1942 }
1943 default:
1944diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp
1945index 6448463d..7df71079 100644
1946--- a/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp
1947+++ b/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp
1948@@ -24,6 +24,7 @@ IN THE SOFTWARE.
1949
1950 #include "Compiler/Optimizer/OpenCLPasses/KernelArgs.hpp"
1951 #include "AdaptorCommon/ImplicitArgs.hpp"
1952+#include "llvmWrapper/IR/DerivedTypes.h"
1953 #include "common/LLVMWarningsPush.hpp"
1954 #include <llvm/IR/Argument.h>
1955 #include <llvm/IR/DataLayout.h>
1956@@ -388,7 +389,7 @@ unsigned int KernelArg::calcAssociatedArgNo(const ImplicitArg& implicitArg, cons
1957
1958 unsigned int KernelArg::getNumComponents() const
1959 {
1960- if (VectorType * vecType = dyn_cast<VectorType>(m_arg->getType()))
1961+ if (IGCLLVM::FixedVectorType * vecType = dyn_cast<IGCLLVM::FixedVectorType>(m_arg->getType()))
1962 {
1963 // Vector
1964 return int_cast<unsigned int>(vecType->getNumElements());
1965diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp
1966index c7414b8e..74964510 100644
1967--- a/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp
1968+++ b/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp
1969@@ -719,7 +719,7 @@ Value* OpenCLPrintfResolution::fixupPrintfArg(CallInst& printfCall, Value* arg,
1970 }
1971
1972 Type* newType = Type::getFloatTy(arg->getContext());
1973- if (auto argVT = dyn_cast<VectorType>(arg->getType()))
1974+ if (auto argVT = dyn_cast<IGCLLVM::FixedVectorType>(arg->getType()))
1975 {
1976 newType = IGCLLVM::FixedVectorType::get(newType, (unsigned)argVT->getNumElements());
1977 }
1978@@ -749,7 +749,7 @@ void OpenCLPrintfResolution::preprocessPrintfArgs(CallInst& printfCall)
1979 IGC::SHADER_PRINTF_TYPE argDataType = getPrintfArgDataType(arg);
1980 arg = fixupPrintfArg(printfCall, arg, argDataType);
1981 uint vecSize = 0;
1982- if (auto argVType = dyn_cast<VectorType>(argType)) {
1983+ if (auto argVType = dyn_cast<IGCLLVM::FixedVectorType>(argType)) {
1984 vecSize = (uint)argVType->getNumElements();
1985 }
1986 m_argDescriptors.push_back(SPrintfArgDescriptor(argDataType, arg, vecSize));
1987diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
1988index 2ed5a2b6..07f85f4c 100644
1989--- a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
1990+++ b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
1991@@ -29,6 +29,7 @@ IN THE SOFTWARE.
1992 #include "Compiler/IGCPassSupport.h"
1993 #include "Compiler/CISACodeGen/GenCodeGenModule.h"
1994 #include "Compiler/CISACodeGen/LowerGEPForPrivMem.hpp"
1995+#include "llvmWrapper/IR/DerivedTypes.h"
1996 #include "common/LLVMWarningsPush.hpp"
1997 #include "llvm/Transforms/Utils/Local.h"
1998 #include "llvm/IR/DataLayout.h"
1999@@ -604,7 +605,7 @@ public:
2000 Type* scalarptrTy = PointerType::get(scalarType, pLoad->getPointerAddressSpace());
2001 IGC_ASSERT(scalarType->getPrimitiveSizeInBits() / 8 == elementSize);
2002 Value* vec = UndefValue::get(pLoad->getType());
2003- auto pLoadVT = cast<VectorType>(pLoad->getType());
2004+ auto pLoadVT = cast<IGCLLVM::FixedVectorType>(pLoad->getType());
2005 for (unsigned i = 0, e = (unsigned)pLoadVT->getNumElements(); i < e; ++i)
2006 {
2007 Value* ptr = IRB.CreateIntToPtr(address, scalarptrTy);
2008@@ -643,7 +644,7 @@ public:
2009 IGC_ASSERT(scalarType->getPrimitiveSizeInBits() / 8 == elementSize);
2010 Value* vec = pStore->getValueOperand();
2011
2012- unsigned vecNumElts = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
2013+ unsigned vecNumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
2014 for (unsigned i = 0; i < vecNumElts; ++i)
2015 {
2016 Value* ptr = IRB.CreateIntToPtr(address, scalarptrTy);
2017@@ -707,7 +708,7 @@ bool PrivateMemoryResolution::testTransposedMemory(const Type* pTmpType, const T
2018 }
2019 else if(pTmpType->isVectorTy())
2020 {
2021- auto pTmpVType = cast<VectorType>(pTmpType);
2022+ auto pTmpVType = cast<IGCLLVM::FixedVectorType>(pTmpType);
2023 tmpAllocaSize *= pTmpVType->getNumElements();
2024 pTmpType = pTmpType->getContainedType(0);
2025 ok = (nullptr != pTmpType);
2026@@ -815,7 +816,11 @@ bool PrivateMemoryResolution::resolveAllocaInstructions(bool privateOnStack)
2027 // Construct an empty DebugLoc.
2028 IF_DEBUG_INFO(DebugLoc entryDebugLoc);
2029 // Assign with the function location if available.
2030+#if LLVM_VERSION_MAJOR >= 12
2031+ IF_DEBUG_INFO_IF(DISubprogram *subprogram = m_currFunction->getSubprogram(), entryDebugLoc = DILocation::get(subprogram->getContext(), subprogram->getLine(), 0, subprogram););
2032+#else
2033 IF_DEBUG_INFO_IF(DISubprogram *subprogram = m_currFunction->getSubprogram(), entryDebugLoc = DebugLoc::get(subprogram->getLine(), 0, subprogram););
2034+#endif
2035 IF_DEBUG_INFO(entryBuilder.SetCurrentDebugLocation(entryDebugLoc));
2036
2037 if (privateOnStack)
2038diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp
2039index c8414efa..68491d48 100644
2040--- a/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp
2041+++ b/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp
2042@@ -254,7 +254,7 @@ Instruction* ReplaceUnsupportedIntrinsics::insertLoop(Instruction* Loc, Value* L
2043 Value* ReplaceUnsupportedIntrinsics::replicateScalar(
2044 Value* ScalarVal, Type* Ty, Instruction* InsertBefore)
2045 {
2046- VectorType* VTy = dyn_cast<VectorType>(Ty);
2047+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
2048 Type* ETy = VTy ? VTy->getElementType() : Ty;
2049 uint32_t sBits = (unsigned int)ScalarVal->getType()->getPrimitiveSizeInBits();
2050 uint32_t nBits = (unsigned int)ETy->getPrimitiveSizeInBits();
2051@@ -868,7 +868,7 @@ void ReplaceUnsupportedIntrinsics::replaceFunnelShift(IntrinsicInst* I) {
2052 }
2053
2054 Value* numBits = Builder.getIntN(sizeInBits, sizeInBits);
2055- if (auto IVT = dyn_cast<VectorType>(I->getType())) {
2056+ if (auto IVT = dyn_cast<IGCLLVM::FixedVectorType>(I->getType())) {
2057 numBits = ConstantVector::getSplat(IGCLLVM::getElementCount((uint32_t)IVT->getNumElements()), cast<Constant>(numBits));
2058 }
2059 auto shiftModulo = Builder.CreateURem(I->getArgOperand(2), numBits);
2060diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
2061index 7188cc50..535d6268 100644
2062--- a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
2063+++ b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
2064@@ -303,7 +303,11 @@ static Value* BuildLoadInst(CallInst& CI, unsigned int Offset, Type* DataType)
2065 auto Size = ElemByteSize;
2066 if (DataType->isVectorTy())
2067 {
2068+#if LLVM_VERSION_MAJOR >= 12
2069+ Size *= cast<IGCLLVM::FixedVectorType>(DataType)->getNumElements();
2070+#else
2071 Size *= DataType->getVectorNumElements();
2072+#endif
2073 }
2074 unsigned int AlignedOffset = (Offset / ElemByteSize) * ElemByteSize;
2075 unsigned int LoadByteSize = (Offset == AlignedOffset) ? Size : Size * 2;
2076diff --git a/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp b/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp
2077index 1fda21d5..63a22864 100644
2078--- a/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp
2079+++ b/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp
2080@@ -340,7 +340,7 @@ bool PreCompiledFuncImport::preProcessDouble()
2081 }
2082 else
2083 {
2084- uint32_t vectorSize = cast<VectorType>(Inst->getType())->getNumElements();
2085+ uint32_t vectorSize = cast<IGCLLVM::FixedVectorType>(Inst->getType())->getNumElements();
2086 fsub = llvm::UndefValue::get(Inst->getType());
2087
2088 for (uint32_t i = 0; i < vectorSize; ++i)
2089@@ -936,7 +936,7 @@ void PreCompiledFuncImport::processDivide(BinaryOperator& inst, EmulatedFunction
2090
2091 Type* argumentType = inst.getOperand(0)->getType();
2092
2093- if (auto argumentVType = dyn_cast<VectorType>(argumentType))
2094+ if (auto argumentVType = dyn_cast<IGCLLVM::FixedVectorType>(argumentType))
2095 {
2096 numElements = (unsigned)argumentVType->getNumElements();
2097 }
2098diff --git a/IGC/Compiler/Optimizer/Scalarizer.cpp b/IGC/Compiler/Optimizer/Scalarizer.cpp
2099index 4f59eaf9..a4e73a6d 100644
2100--- a/IGC/Compiler/Optimizer/Scalarizer.cpp
2101+++ b/IGC/Compiler/Optimizer/Scalarizer.cpp
2102@@ -289,7 +289,7 @@ void ScalarizeFunction::scalarizeInstruction(BinaryOperator* BI)
2103 {
2104 V_PRINT(scalarizer, "\t\tBinary instruction\n");
2105 IGC_ASSERT_MESSAGE(BI, "instruction type dynamic cast failed");
2106- VectorType* instType = dyn_cast<VectorType>(BI->getType());
2107+ IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(BI->getType());
2108 // Only need handling for vector binary ops
2109 if (!instType) return;
2110
2111@@ -349,7 +349,7 @@ void ScalarizeFunction::scalarizeInstruction(CmpInst* CI)
2112 {
2113 V_PRINT(scalarizer, "\t\tCompare instruction\n");
2114 IGC_ASSERT_MESSAGE(CI, "instruction type dynamic cast failed");
2115- VectorType* instType = dyn_cast<VectorType>(CI->getType());
2116+ IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(CI->getType());
2117 // Only need handling for vector compares
2118 if (!instType) return;
2119
2120@@ -397,13 +397,13 @@ void ScalarizeFunction::scalarizeInstruction(CastInst* CI)
2121 {
2122 V_PRINT(scalarizer, "\t\tCast instruction\n");
2123 IGC_ASSERT_MESSAGE(CI, "instruction type dynamic cast failed");
2124- VectorType* instType = dyn_cast<VectorType>(CI->getType());
2125+ IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(CI->getType());
2126
2127 // For BitCast - we only scalarize if src and dst types have same vector length
2128 if (isa<BitCastInst>(CI))
2129 {
2130 if (!instType) return recoverNonScalarizableInst(CI);
2131- VectorType* srcType = dyn_cast<VectorType>(CI->getOperand(0)->getType());
2132+ IGCLLVM::FixedVectorType* srcType = dyn_cast<IGCLLVM::FixedVectorType>(CI->getOperand(0)->getType());
2133 if (!srcType || (instType->getNumElements() != srcType->getNumElements()))
2134 {
2135 return recoverNonScalarizableInst(CI);
2136@@ -458,7 +458,7 @@ void ScalarizeFunction::scalarizeInstruction(PHINode* PI)
2137 {
2138 V_PRINT(scalarizer, "\t\tPHI instruction\n");
2139 IGC_ASSERT_MESSAGE(PI, "instruction type dynamic cast failed");
2140- VectorType* instType = dyn_cast<VectorType>(PI->getType());
2141+ IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(PI->getType());
2142 // Only need handling for vector PHI
2143 if (!instType) return;
2144
2145@@ -569,7 +569,7 @@ void ScalarizeFunction::scalarizeInstruction(SelectInst* SI)
2146 {
2147 V_PRINT(scalarizer, "\t\tSelect instruction\n");
2148 IGC_ASSERT_MESSAGE(SI, "instruction type dynamic cast failed");
2149- VectorType* instType = dyn_cast<VectorType>(SI->getType());
2150+ IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(SI->getType());
2151 // Only need handling for vector select
2152 if (!instType) return;
2153
2154@@ -651,7 +651,7 @@ void ScalarizeFunction::scalarizeInstruction(ExtractElementInst* EI)
2155
2156 // Connect the "extracted" value to all its consumers
2157 uint64_t scalarIndex = cast<ConstantInt>(scalarIndexVal)->getZExtValue();
2158- auto valueVType = cast<VectorType>(vectorValue->getType());
2159+ auto valueVType = cast<IGCLLVM::FixedVectorType>(vectorValue->getType());
2160 if (static_cast<unsigned int>(scalarIndex) < (unsigned)valueVType->getNumElements())
2161 {
2162 IGC_ASSERT_MESSAGE(NULL != operand[static_cast<unsigned int>(scalarIndex)], "SCM error");
2163@@ -715,7 +715,7 @@ void ScalarizeFunction::scalarizeInstruction(InsertElementInst* II)
2164 if (isa<UndefValue>(sourceVectorValue))
2165 {
2166 // Scalarize the undef value (generate a scalar undef)
2167- VectorType* inputVectorType = dyn_cast<VectorType>(sourceVectorValue->getType());
2168+ IGCLLVM::FixedVectorType* inputVectorType = dyn_cast<IGCLLVM::FixedVectorType>(sourceVectorValue->getType());
2169 IGC_ASSERT_MESSAGE(inputVectorType, "expected vector argument");
2170
2171 UndefValue* undefVal = UndefValue::get(inputVectorType->getElementType());
2172@@ -756,7 +756,7 @@ void ScalarizeFunction::scalarizeInstruction(ShuffleVectorInst* SI)
2173 IGC_ASSERT(nullptr != sourceVector0Value);
2174 Value* sourceVector1Value = SI->getOperand(1);
2175 IGC_ASSERT(nullptr != sourceVector1Value);
2176- VectorType* const inputType = dyn_cast<VectorType>(sourceVector0Value->getType());
2177+ IGCLLVM::FixedVectorType* const inputType = dyn_cast<IGCLLVM::FixedVectorType>(sourceVector0Value->getType());
2178 IGC_ASSERT_MESSAGE(nullptr != inputType, "vector input error");
2179 IGC_ASSERT_MESSAGE(inputType == sourceVector1Value->getType(), "vector input error");
2180 unsigned sourceVectorWidth = int_cast<unsigned>(inputType->getNumElements());
2181@@ -778,7 +778,7 @@ void ScalarizeFunction::scalarizeInstruction(ShuffleVectorInst* SI)
2182
2183 // Generate array for shuffled scalar values
2184 SmallVector<Value*, MAX_INPUT_VECTOR_WIDTH>newVector;
2185- unsigned width = int_cast<unsigned>(SI->getType()->getNumElements());
2186+ unsigned width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(SI->getType())->getNumElements());
2187
2188 // Generate undef value, which may be needed as some scalar elements
2189 UndefValue* undef = UndefValue::get(inputType->getElementType());
2190@@ -847,7 +847,7 @@ void ScalarizeFunction::scalarizeInstruction(GetElementPtrInst* GI)
2191
2192 if (baseValue->getType()->isVectorTy())
2193 {
2194- width = int_cast<unsigned>(dyn_cast<VectorType>(baseValue->getType())->getNumElements());
2195+ width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(baseValue->getType())->getNumElements());
2196 // Obtain the scalarized operands
2197 obtainScalarizedValues(operand1, NULL, baseValue, GI);
2198 ptrTy = dyn_cast<VectorType>(baseValue->getType())->getElementType();
2199@@ -858,7 +858,7 @@ void ScalarizeFunction::scalarizeInstruction(GetElementPtrInst* GI)
2200 }
2201 if (indexValue->getType()->isVectorTy())
2202 {
2203- width = int_cast<unsigned>(dyn_cast<VectorType>(indexValue->getType())->getNumElements());
2204+ width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(indexValue->getType())->getNumElements());
2205 // Obtain the scalarized operands
2206 obtainScalarizedValues(operand2, NULL, indexValue, GI);
2207 }
2208@@ -897,7 +897,7 @@ void ScalarizeFunction::scalarizeInstruction(LoadInst* LI)
2209 V_PRINT(scalarizer, "\t\tLoad instruction\n");
2210 IGC_ASSERT_MESSAGE(LI, "instruction type dynamic cast failed");
2211
2212- VectorType* dataType = dyn_cast<VectorType>(LI->getType());
2213+ IGCLLVM::FixedVectorType* dataType = dyn_cast<IGCLLVM::FixedVectorType>(LI->getType());
2214 if (isScalarizableLoadStoreType(dataType) && m_pDL)
2215 {
2216 // Prepare empty SCM entry for the instruction
2217@@ -969,7 +969,7 @@ void ScalarizeFunction::scalarizeInstruction(StoreInst* SI)
2218
2219 int indexPtr = SI->getPointerOperandIndex();
2220 int indexData = 1 - indexPtr;
2221- VectorType* dataType = dyn_cast<VectorType>(SI->getOperand(indexData)->getType());
2222+ IGCLLVM::FixedVectorType* dataType = dyn_cast<IGCLLVM::FixedVectorType>(SI->getOperand(indexData)->getType());
2223 if (isScalarizableLoadStoreType(dataType) && m_pDL)
2224 {
2225 // Get additional info from instruction
2226@@ -1040,7 +1040,7 @@ void ScalarizeFunction::obtainScalarizedValues(SmallVectorImpl<Value*>& retValue
2227 {
2228 V_PRINT(scalarizer, "\t\t\tObtaining scalar value... " << *origValue << "\n");
2229
2230- VectorType* origType = dyn_cast<VectorType>(origValue->getType());
2231+ IGCLLVM::FixedVectorType* origType = dyn_cast<IGCLLVM::FixedVectorType>(origValue->getType());
2232 IGC_ASSERT_MESSAGE(origType, "Value must have a vector type!");
2233 unsigned width = int_cast<unsigned>(origType->getNumElements());
2234
2235@@ -1202,7 +1202,7 @@ void ScalarizeFunction::obtainVectorValueWhichMightBeScalarizedImpl(Value* vecto
2236 }
2237
2238 Value* assembledVector = UndefValue::get(vectorVal->getType());
2239- unsigned width = int_cast<unsigned>(dyn_cast<VectorType>(vectorVal->getType())->getNumElements());
2240+ unsigned width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(vectorVal->getType())->getNumElements());
2241 for (unsigned i = 0; i < width; i++)
2242 {
2243 IGC_ASSERT_MESSAGE(NULL != valueEntry->scalarValues[i], "SCM entry has NULL value");
2244@@ -1262,7 +1262,7 @@ void ScalarizeFunction::updateSCMEntryWithValues(ScalarizeFunction::SCMEntry* en
2245 bool matchDbgLoc)
2246 {
2247 IGC_ASSERT_MESSAGE((origValue->getType()->isArrayTy() || origValue->getType()->isVectorTy()), "only Vector values are supported");
2248- unsigned width = int_cast<unsigned>(dyn_cast<VectorType>(origValue->getType())->getNumElements());
2249+ unsigned width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(origValue->getType())->getNumElements());
2250
2251 entry->isOriginalVectorRemoved = isOrigValueRemoved;
2252
2253@@ -1326,7 +1326,7 @@ void ScalarizeFunction::resolveDeferredInstructions()
2254 Instruction* vectorInst = dyn_cast<Instruction>(current.unresolvedInst);
2255 IGC_ASSERT_MESSAGE(vectorInst, "DRL only handles unresolved instructions");
2256
2257- VectorType* currType = dyn_cast<VectorType>(vectorInst->getType());
2258+ IGCLLVM::FixedVectorType* currType = dyn_cast<IGCLLVM::FixedVectorType>(vectorInst->getType());
2259 IGC_ASSERT_MESSAGE(currType, "Cannot have DRL of non-vector value");
2260 unsigned width = int_cast<unsigned>(currType->getNumElements());
2261
2262diff --git a/IGC/Compiler/Optimizer/ValueTracker.cpp b/IGC/Compiler/Optimizer/ValueTracker.cpp
2263index c06f7312..d8f0d385 100644
2264--- a/IGC/Compiler/Optimizer/ValueTracker.cpp
2265+++ b/IGC/Compiler/Optimizer/ValueTracker.cpp
2266@@ -178,7 +178,7 @@ Value* ValueTracker::handleExtractElement(ExtractElementInst* E)
2267 {
2268 auto mask = I->getShuffleMask();
2269 uint shuffleidx = int_cast<uint>(mask[(uint)idx]);
2270- auto vType = dyn_cast<VectorType>(I->getOperand(0)->getType());
2271+ auto vType = dyn_cast<IGCLLVM::FixedVectorType>(I->getOperand(0)->getType());
2272 baseValue = (shuffleidx < vType->getNumElements()) ?
2273 I->getOperand(0) : I->getOperand(1);
2274 }
2275diff --git a/IGC/Compiler/VerificationPass.cpp b/IGC/Compiler/VerificationPass.cpp
2276index 98437d79..40d50f5a 100644
2277--- a/IGC/Compiler/VerificationPass.cpp
2278+++ b/IGC/Compiler/VerificationPass.cpp
2279@@ -302,7 +302,7 @@ bool VerificationPass::verifyType(Type* type, Value* val)
2280
2281 case IGCLLVM::VectorTyID:
2282 {
2283- auto VType = cast<VectorType>(type);
2284+ auto VType = cast<IGCLLVM::FixedVectorType>(type);
2285 unsigned typeSize = (unsigned)VType->getNumElements();
2286 if (!m_IGC_IR_spec.vectorTypeSizes.count(typeSize))
2287 {
2288diff --git a/IGC/DebugInfo/DebugInfoUtils.hpp b/IGC/DebugInfo/DebugInfoUtils.hpp
2289index 7f2e288a..b77a550d 100644
2290--- a/IGC/DebugInfo/DebugInfoUtils.hpp
2291+++ b/IGC/DebugInfo/DebugInfoUtils.hpp
2292@@ -108,7 +108,11 @@ namespace IGC
2293 IGCLLVM::DIBuilder Builder(M);
2294 llvm::DIGlobalVariable* GV = GVs[j]->getVariable();
2295 llvm::DIScope* scopeToUse = GV->getScope();
2296+#if LLVM_VERSION_MAJOR >= 12
2297+ llvm::DILocation* locToUse = llvm::DILocation::get(scopeToUse->getContext(), GV->getLine(), 0, scopeToUse, loc);
2298+#else
2299 llvm::DILocation* locToUse = llvm::DebugLoc::get(GV->getLine(), 0, scopeToUse, loc);
2300+#endif
2301 if (llvm::isa<llvm::DICompileUnit>(GV->getScope()))
2302 {
2303 // Function has no DebugLoc so it is either internal
2304diff --git a/IGC/DebugInfo/DwarfDebug.cpp b/IGC/DebugInfo/DwarfDebug.cpp
2305index 683b83f7..bd9f17b7 100644
2306--- a/IGC/DebugInfo/DwarfDebug.cpp
2307+++ b/IGC/DebugInfo/DwarfDebug.cpp
2308@@ -2102,9 +2102,17 @@ static DebugLoc getFnDebugLoc(DebugLoc DL, const LLVMContext& Ctx)
2309 // Check for number of operands since the compatibility is cheap here.
2310 if (SP->getNumOperands() > 19)
2311 {
2312+#if LLVM_VERSION_MAJOR >= 12
2313+ return DILocation::get(SP->getContext(), SP->getScopeLine(), 0, SP);
2314+#else
2315 return DebugLoc::get(SP->getScopeLine(), 0, SP);
2316+#endif
2317 }
2318+#if LLVM_VERSION_MAJOR >= 12
2319+ return DILocation::get(SP->getContext(), SP->getLine(), 0, SP);
2320+#else
2321 return DebugLoc::get(SP->getLine(), 0, SP);
2322+#endif
2323 }
2324
2325 return DebugLoc();
2326diff --git a/IGC/GenISAIntrinsics/GenIntrinsics.cpp b/IGC/GenISAIntrinsics/GenIntrinsics.cpp
2327index 708cfdaa..772155b2 100644
2328--- a/IGC/GenISAIntrinsics/GenIntrinsics.cpp
2329+++ b/IGC/GenISAIntrinsics/GenIntrinsics.cpp
2330@@ -204,7 +204,7 @@ static Type *DecodeFixedType(ArrayRef<GenISAIntrinsic::IITDescriptor> &Infos,
2331 case IITDescriptor::SameVecWidthArgument: {
2332 Type *EltTy = DecodeFixedType(Infos, Tys, Context);
2333 Type *Ty = Tys[D.getArgumentNumber()];
2334- if (VectorType *VTy = dyn_cast<VectorType>(Ty)) {
2335+ if (IGCLLVM::FixedVectorType *VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty)) {
2336 return IGCLLVM::FixedVectorType::get(EltTy, int_cast<unsigned int>(VTy->getNumElements()));
2337 }
2338 IGC_ASSERT_EXIT_MESSAGE(0, "unhandled");
2339@@ -215,7 +215,7 @@ static Type *DecodeFixedType(ArrayRef<GenISAIntrinsic::IITDescriptor> &Infos,
2340 }
2341 case IITDescriptor::VecOfPtrsToElt: {
2342 Type *Ty = Tys[D.getArgumentNumber()];
2343- VectorType *VTy = dyn_cast<VectorType>(Ty);
2344+ IGCLLVM::FixedVectorType *VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
2345 if (!VTy)
2346 IGC_ASSERT_EXIT_MESSAGE(0, "Expected an argument of Vector Type");
2347 Type *EltTy = cast<VectorType>(VTy)->getElementType();
2348@@ -434,7 +434,7 @@ static std::string getMangledTypeStr(Type* Ty) {
2349 Result += "f";
2350 }
2351 else if (isa<VectorType>(Ty))
2352- Result += "v" + utostr(cast<VectorType>(Ty)->getNumElements()) +
2353+ Result += "v" + utostr(cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements()) +
2354 getMangledTypeStr(cast<VectorType>(Ty)->getElementType());
2355 else if (Ty)
2356 Result += EVT::getEVT(Ty).getEVTString();
2357diff --git a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp
2358index a89d63b9..a1bc5d2c 100644
2359--- a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp
2360+++ b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp
2361@@ -4929,7 +4929,7 @@ void LLVM3DBuilder<preserveNames, T, Inserter>::VectorToScalars(
2362 IGC_ASSERT(nullptr != vector->getType());
2363 IGC_ASSERT(vector->getType()->isVectorTy());
2364
2365- const unsigned count = (unsigned)llvm::cast<llvm::VectorType>(vector->getType())->getNumElements();
2366+ const unsigned count = (unsigned)llvm::cast<IGCLLVM::FixedVectorType>(vector->getType())->getNumElements();
2367 IGC_ASSERT(1 < count);
2368 IGC_ASSERT(count <= 4);
2369 IGC_ASSERT(count <= maxSize);
2370diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
2371index 08e5d6cf..30e29720 100644
2372--- a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
2373+++ b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
2374@@ -35,10 +35,16 @@ using namespace llvm;
2375 namespace IGCLLVM {
2376 #if LLVM_VERSION_MAJOR < 11
2377 inline unsigned getElementCount(unsigned EC) { return EC; }
2378-#else
2379+#elif LLVM_VERSION_MAJOR == 11
2380 inline ElementCount getElementCount(unsigned EC) {
2381 return ElementCount(EC, false);
2382 }
2383+#elif LLVM_VERSION_MAJOR == 12
2384+inline ElementCount getElementCount(unsigned EC) {
2385+ return ElementCount::get(EC, false);
2386+}
2387+#else
2388+#error "unsupported LLVM version"
2389 #endif
2390 } // namespace IGCLLVM
2391
2392diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h
2393index f6e54fb1..5266ee87 100644
2394--- a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h
2395+++ b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h
2396@@ -44,7 +44,7 @@ namespace IGCLLVM
2397 {
2398 return llvm::createLoopUnrollPass(OptLevel, false, Threshold, Count, AllowPartial, Runtime, UpperBound, AllowPeeling);
2399 }
2400-#elif LLVM_VERSION_MAJOR == 9 || LLVM_VERSION_MAJOR == 10 || LLVM_VERSION_MAJOR == 11
2401+#elif LLVM_VERSION_MAJOR >= 9 && LLVM_VERSION_MAJOR <= 12
2402 inline static llvm::Pass * createLoopUnrollPass(
2403 int OptLevel = 2, int Threshold = -1, int Count = -1,
2404 int AllowPartial = -1, int Runtime = -1,
2405@@ -52,7 +52,7 @@ namespace IGCLLVM
2406 {
2407 return llvm::createLoopUnrollPass(OptLevel, false, false, Threshold, Count, AllowPartial, Runtime, UpperBound, AllowPeeling);
2408 }
2409-#elif LLVM_VERSION_MAJOR >= 12
2410+#else
2411 //DO NOT assume same function signature for all incoming llvm versions! Double check to upgrade!
2412 #error Not supported llvm version.
2413 #endif
2414diff --git a/IGC/common/igc_resourceDimTypes.h b/IGC/common/igc_resourceDimTypes.h
2415index 6831b06c..d790330f 100644
2416--- a/IGC/common/igc_resourceDimTypes.h
2417+++ b/IGC/common/igc_resourceDimTypes.h
2418@@ -66,6 +66,11 @@ namespace IGC
2419 resourceDimTypeId == DIM_2D_TYPE || resourceDimTypeId == DIM_2D_ARRAY_TYPE ||
2420 resourceDimTypeId == DIM_3D_TYPE || resourceDimTypeId == DIM_CUBE_TYPE || resourceDimTypeId == DIM_CUBE_ARRAY_TYPE));
2421
2422+#if LLVM_VERSION_MAJOR >= 12
2423+ llvm::LLVMContext& llvmCtx = module.getContext();
2424+ return llvm::StructType::getTypeByName(llvmCtx, ResourceDimensionTypeName[resourceDimTypeId]);
2425+#else
2426 return module.getTypeByName(ResourceDimensionTypeName[resourceDimTypeId]);
2427+#endif
2428 }
2429 }
2430\ No newline at end of file
2431--
24322.17.1
2433
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 @@
1From e69a3181482e5f442756a61c7b683914072884f1 Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Mon, 9 Jan 2023 11:43:05 +0800
4Subject: [PATCH] external/SPIRV-Tools: change path to tools and headers
5
6We clone the SPIRV headers and tools in a different directory to ensure
7file path substitutions take place.
8
9Upstream-Status: Inappropriate
10
11Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
12
13---
14 external/SPIRV-Tools/CMakeLists.txt | 4 ++--
15 1 file changed, 2 insertions(+), 2 deletions(-)
16
17diff --git a/external/SPIRV-Tools/CMakeLists.txt b/external/SPIRV-Tools/CMakeLists.txt
18index 9afa5746c..7ca24d5dc 100644
19--- a/external/SPIRV-Tools/CMakeLists.txt
20+++ b/external/SPIRV-Tools/CMakeLists.txt
21@@ -43,8 +43,8 @@ else() #By default use build from sources
22 message(STATUS "[SPIRV-Tools] : Building from source")
23 message(STATUS "[SPIRV-Tools] : Current source dir: ${CMAKE_CURRENT_SOURCE_DIR}")
24
25- set(SPIRV-Headers_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../SPIRV-Headers") # used in subdirectory
26- set(SPIRV-Tools_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../SPIRV-Tools")
27+ set(SPIRV-Headers_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../SPIRV-Headers") # used in subdirectory
28+ set(SPIRV-Tools_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../SPIRV-Tools")
29
30 set(SPIRV-Tools_OUTPUT_DIR "${IGC_OPTION__OUTPUT_DIR}/external/SPIRV-Tools/build")
31 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 @@
1From 5648568e597acd0fed82aac3e6aef0f95a1b78d1 Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Thu, 19 May 2022 22:50:09 +0800
4Subject: [PATCH] fix tblgen
5
6Upstream-Status: Inappropriate [OE specific]
7
8---
9 IGC/cmake/igc_llvm.cmake | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12diff --git a/IGC/cmake/igc_llvm.cmake b/IGC/cmake/igc_llvm.cmake
13index 10322533c..9020cb3c8 100644
14--- a/IGC/cmake/igc_llvm.cmake
15+++ b/IGC/cmake/igc_llvm.cmake
16@@ -52,7 +52,7 @@ else()
17 set(LLVM_OPT_EXE "opt" CACHE STRING "")
18
19 set(LLVM_TABLEGEN_EXE "llvm-tblgen")
20- if(CMAKE_CROSSCOMPILING)
21+ if(TRUE)
22 if(DEFINED LLVM_TABLEGEN)
23 set(LLVM_TABLEGEN_EXE ${LLVM_TABLEGEN})
24 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 @@
1From 5501fab763aa2b11437fbdb19e07a11157a7d3e6 Mon Sep 17 00:00:00 2001
2From: Naveen Saini <naveen.kumar.saini@intel.com>
3Date: Thu, 6 Feb 2020 14:56:56 +0800
4Subject: [PATCH] skip execution of ElfPackager
5
6ElfPackager adds the ability to convert llvm bitcode into elf files for
7easier partitioning. Skip for now until we start building a native
8version for this.
9
10Upstream-Status: Inappropriate [configuration specific]
11
12Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
13Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
14---
15 IGC/ElfPackager/CMakeLists.txt | 12 ++++++------
16 1 file changed, 6 insertions(+), 6 deletions(-)
17
18diff --git a/IGC/ElfPackager/CMakeLists.txt b/IGC/ElfPackager/CMakeLists.txt
19index 563ac9d6..c6c74ce9 100644
20--- a/IGC/ElfPackager/CMakeLists.txt
21+++ b/IGC/ElfPackager/CMakeLists.txt
22@@ -71,12 +71,12 @@ include_directories (
23 ${IGC_SOURCE_DIR}/AdaptorOCL/CLElfLib/
24 )
25
26-if(NOT ANDROID)
27- add_custom_command(TARGET ${IGC_BUILD__PROJ__ElfPackager}
28- POST_BUILD
29- 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
30- )
31-endif()
32+#if(NOT ANDROID)
33+# add_custom_command(TARGET ${IGC_BUILD__PROJ__ElfPackager}
34+# POST_BUILD
35+# 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
36+# )
37+#endif()
38
39
40 add_dependencies("${IGC_BUILD__PROJ__ElfPackager}" "${IGC_BUILD__PROJ__BiFModule_OCL}")
41--
422.17.1
43
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 @@
1From 60136b453bb3a109bfc88c4040b871af9d522ed5 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= <zboszor@pr.hu>
3Date: Thu, 25 Feb 2021 19:40:21 +0100
4Subject: [PATCH 2/3] Review fixes for LLVM 12 phase 1
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Upstream-Status: Pending
10
11Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
12Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
13---
14 IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | 6 +-----
15 IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp | 6 +-----
16 IGC/Compiler/CISACodeGen/AdvMemOpt.cpp | 7 ++-----
17 IGC/Compiler/CISACodeGen/Simd32Profitability.cpp | 7 ++-----
18 IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp | 11 +----------
19 IGC/Compiler/GenTTI.cpp | 9 ++-------
20 IGC/Compiler/Legalizer/InstPromoter.cpp | 8 +-------
21 .../DeviceEnqueueFuncs/TransformBlocks.cpp | 6 +-----
22 .../OpenCLPasses/WIFuncs/WIFuncResolution.cpp | 4 ----
23 IGC/Compiler/Optimizer/Scalarizer.cpp | 2 +-
24 IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h | 10 ++++++++++
25 .../include/llvmWrapper/Support/TypeSize.h | 4 +---
26 .../include/llvmWrapper/Transforms/Utils/LoopUtils.h | 8 ++++++++
27 IGC/common/igc_resourceDimTypes.h | 5 ++---
28 14 files changed, 33 insertions(+), 60 deletions(-)
29
30diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
31index 725a1512..12f42be8 100644
32--- a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
33+++ b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
34@@ -1929,11 +1929,7 @@ SPIRVToLLVM::transType(SPIRVType *T) {
35 auto name = isSubgroupAvcINTELTypeOpCode(OC) ?
36 OCLSubgroupINTELTypeOpCodeMap::rmap(OC) :
37 BuiltinOpaqueGenericTypeOpCodeMap::rmap(OC);
38-#if LLVM_VERSION_MAJOR >= 12
39- auto *pST = llvm::StructType::getTypeByName(M->getContext(), name);
40-#else
41- auto *pST = M->getTypeByName(name);
42-#endif
43+ auto *pST = IGCLLVM::getTypeByName(M, name);
44 pST = pST ? pST : StructType::create(*Context, name);
45
46 return mapType(T, PointerType::get(pST, getOCLOpaqueTypeAddrSpace(OC)));
47diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
48index 91b4623c..f4f0dee5 100644
49--- a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
50+++ b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
51@@ -93,11 +93,7 @@ saveLLVMModule(Module *M, const std::string &OutputFile) {
52 PointerType*
53 getOrCreateOpaquePtrType(Module *M, const std::string &Name,
54 unsigned AddrSpace) {
55-#if LLVM_VERSION_MAJOR >= 12
56- auto OpaqueType = llvm::StructType::getTypeByName(M->getContext(), Name);
57-#else
58- auto OpaqueType = M->getTypeByName(Name);
59-#endif
60+ auto OpaqueType = IGCLLVM::getTypeByName(M, Name);
61 if (!OpaqueType)
62 OpaqueType = StructType::create(M->getContext(), Name);
63 return PointerType::get(OpaqueType, AddrSpace);
64diff --git a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
65index fc45a510..a612a473 100644
66--- a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
67+++ b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
68@@ -33,6 +33,7 @@ IN THE SOFTWARE.
69 #include <llvm/Support/Debug.h>
70 #include <llvm/Support/raw_ostream.h>
71 #include <llvm/Transforms/Utils/Local.h>
72+#include "llvmWrapper/Transforms/Utils/LoopUtils.h"
73 #include "common/LLVMWarningsPop.hpp"
74 #include "GenISAIntrinsics/GenIntrinsics.h"
75 #include "Compiler/CISACodeGen/ShaderCodeGen.hpp"
76@@ -134,11 +135,7 @@ bool AdvMemOpt::runOnFunction(Function& F) {
77 for (auto I = LI->begin(), E = LI->end(); I != E; ++I)
78 for (auto DFI = df_begin(*I), DFE = df_end(*I); DFI != DFE; ++DFI) {
79 Loop* L = *DFI;
80-#if LLVM_VERSION_MAJOR >= 12
81- if (L->isInnermost())
82-#else
83- if (L->empty())
84-#endif
85+ if (IGCLLVM::isInnermost(L))
86 InnermostLoops.push_back(L);
87 }
88
89diff --git a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
90index c1f4a419..5393d4e8 100644
91--- a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
92+++ b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
93@@ -28,6 +28,7 @@ IN THE SOFTWARE.
94 #include "Compiler/CISACodeGen/Platform.hpp"
95 #include "common/LLVMWarningsPush.hpp"
96 #include <llvmWrapper/IR/DerivedTypes.h>
97+#include <llvmWrapper/Transforms/Utils/LoopUtils.h>
98 #include <llvm/IR/InstIterator.h>
99 #include <llvm/IR/Operator.h>
100 #include <llvmWrapper/IR/DerivedTypes.h>
101@@ -995,11 +996,7 @@ static bool hasLongStridedLdStInLoop(Function* F, LoopInfo* LI, WIAnalysis* WI)
102 // Collect innermost simple loop.
103 for (auto I = LI->begin(), E = LI->end(); I != E; ++I) {
104 auto L = *I;
105-#if LLVM_VERSION_MAJOR >= 12
106- if (!L->isInnermost())
107-#else
108- if (!L->empty())
109-#endif
110+ if (!IGCLLVM::isInnermost(L))
111 continue;
112 if (L->getNumBlocks() != 2)
113 continue;
114diff --git a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
115index adf992cb..33473c23 100644
116--- a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
117+++ b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
118@@ -153,21 +153,12 @@ void ConvertMSAAPayloadTo16Bit::visitCallInst(CallInst& I)
119 // In OGL there are uses of ldmcs other then ldms, using vec4float type.
120 // Fix them to use newly created 16bit ldmcs.
121 if (ldmcs->getType()->isVectorTy() &&
122-#if LLVM_VERSION_MAJOR >= 12
123- ldmcs->getType()->getScalarType()->isFloatTy())
124-#else
125- ldmcs->getType()->getVectorElementType()->isFloatTy())
126-#endif
127+ cast<IGCLLVM::FixedVectorType>(ldmcs->getType())->getElementType()->isFloatTy())
128 {
129 m_builder->SetInsertPoint(ldmcs);
130
131-#if LLVM_VERSION_MAJOR >= 12
132 uint ldmcsNumOfElements = cast<IGCLLVM::FixedVectorType>(ldmcs->getType())->getNumElements();
133 uint new_mcs_callNumOfElements = cast<IGCLLVM::FixedVectorType>(new_mcs_call->getType())->getNumElements();
134-#else
135- uint ldmcsNumOfElements = ldmcs->getType()->getVectorNumElements();
136- uint new_mcs_callNumOfElements = new_mcs_call->getType()->getVectorNumElements();
137-#endif
138
139 // vec of 16bit ints to vec of 32bit ints
140 Type* new_mcs_callVecType = IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), new_mcs_callNumOfElements);
141diff --git a/IGC/Compiler/GenTTI.cpp b/IGC/Compiler/GenTTI.cpp
142index 9e4d2f26..53e3ec9e 100644
143--- a/IGC/Compiler/GenTTI.cpp
144+++ b/IGC/Compiler/GenTTI.cpp
145@@ -37,6 +37,7 @@ IN THE SOFTWARE.
146 #include "llvm/Analysis/LoopInfo.h"
147 #include "llvm/Analysis/ScalarEvolution.h"
148 #include "llvm/Support/raw_ostream.h"
149+#include "llvmWrapper/Transforms/Utils/LoopUtils.h"
150 #include "common/LLVMWarningsPop.hpp"
151
152 using namespace llvm;
153@@ -216,13 +217,7 @@ namespace llvm {
154
155 // Skip non-simple loop.
156 if (L->getNumBlocks() != 1) {
157- if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) &&
158-#if LLVM_VERSION_MAJOR >= 12
159- L->isInnermost()
160-#else
161- L->empty()
162-#endif
163- ) {
164+ if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) && IGCLLVM::isInnermost(L)) {
165 auto countNonPHI = [](BasicBlock* BB) {
166 unsigned Total = BB->size();
167 unsigned PHIs = 0;
168diff --git a/IGC/Compiler/Legalizer/InstPromoter.cpp b/IGC/Compiler/Legalizer/InstPromoter.cpp
169index 8fadf89f..63cbccb5 100644
170--- a/IGC/Compiler/Legalizer/InstPromoter.cpp
171+++ b/IGC/Compiler/Legalizer/InstPromoter.cpp
172@@ -398,13 +398,7 @@ bool InstPromoter::visitBitCastInst(BitCastInst& I) {
173 IRB->CreateBitCast(Val, IGCLLVM::FixedVectorType::get(DestTy->getScalarType(), N));
174
175 std::vector<Constant*> Vals;
176- for (unsigned i = 0;
177-#if LLVM_VERSION_MAJOR >= 12
178- i < cast<IGCLLVM::FixedVectorType>(DestTy)->getNumElements();
179-#else
180- i < DestTy->getVectorNumElements();
181-#endif
182- i++)
183+ for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(DestTy)->getNumElements(); i++)
184 Vals.push_back(IRB->getInt32(i));
185
186 Value* Mask = ConstantVector::get(Vals);
187diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
188index 119520ed..a3681b79 100644
189--- a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
190+++ b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
191@@ -952,11 +952,7 @@ namespace //Anonymous
192 {
193 auto ndrangeStructName = "struct.ndrange_t";
194 auto module = _deviceExecCall->getModule();
195-#if LLVM_VERSION_MAJOR >= 12
196- auto ndrangeTy = llvm::StructType::getTypeByName(module->getContext(), ndrangeStructName);
197-#else
198- auto ndrangeTy = module->getTypeByName(ndrangeStructName);
199-#endif
200+ auto ndrangeTy = IGCLLVM::getTypeByName(module, ndrangeStructName);
201 if (ndrangeTy == nullptr)
202 {
203 //create struct type
204diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
205index 535d6268..c23c661d 100644
206--- a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
207+++ b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
208@@ -303,11 +303,7 @@ static Value* BuildLoadInst(CallInst& CI, unsigned int Offset, Type* DataType)
209 auto Size = ElemByteSize;
210 if (DataType->isVectorTy())
211 {
212-#if LLVM_VERSION_MAJOR >= 12
213 Size *= cast<IGCLLVM::FixedVectorType>(DataType)->getNumElements();
214-#else
215- Size *= DataType->getVectorNumElements();
216-#endif
217 }
218 unsigned int AlignedOffset = (Offset / ElemByteSize) * ElemByteSize;
219 unsigned int LoadByteSize = (Offset == AlignedOffset) ? Size : Size * 2;
220diff --git a/IGC/Compiler/Optimizer/Scalarizer.cpp b/IGC/Compiler/Optimizer/Scalarizer.cpp
221index a4e73a6d..38627553 100644
222--- a/IGC/Compiler/Optimizer/Scalarizer.cpp
223+++ b/IGC/Compiler/Optimizer/Scalarizer.cpp
224@@ -778,7 +778,7 @@ void ScalarizeFunction::scalarizeInstruction(ShuffleVectorInst* SI)
225
226 // Generate array for shuffled scalar values
227 SmallVector<Value*, MAX_INPUT_VECTOR_WIDTH>newVector;
228- unsigned width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(SI->getType())->getNumElements());
229+ unsigned width = int_cast<unsigned>(cast<IGCLLVM::FixedVectorType>(SI->getType())->getNumElements());
230
231 // Generate undef value, which may be needed as some scalar elements
232 UndefValue* undef = UndefValue::get(inputType->getElementType());
233diff --git a/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h b/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h
234index a3f5a0b8..6a5407bb 100644
235--- a/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h
236+++ b/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h
237@@ -29,6 +29,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
238
239 #include "llvm/Config/llvm-config.h"
240 #include "llvm/IR/DerivedTypes.h"
241+#include "llvm/IR/Module.h"
242
243 namespace IGCLLVM
244 {
245@@ -62,6 +63,15 @@ namespace IGCLLVM
246 return false;
247 #endif
248 }
249+
250+ inline llvm::StructType *getTypeByName(llvm::Module *M, llvm::StringRef Name) {
251+#if LLVM_VERSION_MAJOR >= 12
252+ return llvm::StructType::getTypeByName(M->getContext(), Name);
253+#else
254+ return M->getTypeByName(Name);
255+#endif
256+ }
257+
258 }
259
260 #endif
261diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
262index 30e29720..7021820c 100644
263--- a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
264+++ b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
265@@ -39,12 +39,10 @@ inline unsigned getElementCount(unsigned EC) { return EC; }
266 inline ElementCount getElementCount(unsigned EC) {
267 return ElementCount(EC, false);
268 }
269-#elif LLVM_VERSION_MAJOR == 12
270+#else
271 inline ElementCount getElementCount(unsigned EC) {
272 return ElementCount::get(EC, false);
273 }
274-#else
275-#error "unsupported LLVM version"
276 #endif
277 } // namespace IGCLLVM
278
279diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h
280index db47b00b..bce9cfc1 100644
281--- a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h
282+++ b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h
283@@ -41,6 +41,14 @@ namespace IGCLLVM
284 return llvm::InsertPreheaderForLoop(L, DT, LI, nullptr, PreserveLCSSA);
285 }
286 #endif
287+
288+ inline bool isInnermost(llvm::Loop *L) {
289+#if LLVM_VERSION_MAJOR >= 12
290+ return L->isInnermost();
291+#else
292+ return L->empty();
293+#endif
294+ }
295 }
296
297 #endif
298diff --git a/IGC/common/igc_resourceDimTypes.h b/IGC/common/igc_resourceDimTypes.h
299index d790330f..2d675969 100644
300--- a/IGC/common/igc_resourceDimTypes.h
301+++ b/IGC/common/igc_resourceDimTypes.h
302@@ -67,10 +67,9 @@ namespace IGC
303 resourceDimTypeId == DIM_3D_TYPE || resourceDimTypeId == DIM_CUBE_TYPE || resourceDimTypeId == DIM_CUBE_ARRAY_TYPE));
304
305 #if LLVM_VERSION_MAJOR >= 12
306- llvm::LLVMContext& llvmCtx = module.getContext();
307- return llvm::StructType::getTypeByName(llvmCtx, ResourceDimensionTypeName[resourceDimTypeId]);
308+ return llvm::StructType::getTypeByName(module.getContext(), ResourceDimensionTypeName[resourceDimTypeId]);
309 #else
310 return module.getTypeByName(ResourceDimensionTypeName[resourceDimTypeId]);
311 #endif
312 }
313-}
314\ No newline at end of file
315+}
316--
3172.17.1
318
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 @@
1From 2fa3f2da1179bd5b2eeac82839d386f0111e611c Mon Sep 17 00:00:00 2001 1From 0559332abd04b6c8bc70171d201f43d2e4735336 Mon Sep 17 00:00:00 2001
2From: Lee Chee Yang <chee.yang.lee@intel.com> 2From: Lee Chee Yang <chee.yang.lee@intel.com>
3Date: Wed, 2 Sep 2020 08:28:35 +0800 3Date: Wed, 2 Sep 2020 08:28:35 +0800
4Subject: [PATCH] Improve Reproducibility for src package 4Subject: [PATCH] Improve Reproducibility for src package
@@ -9,15 +9,16 @@ this only works on bison 3.7 onward, hence check for bison version
9before adding the flags. 9before adding the flags.
10Upstream-Status: Inappropriate [applying --file-prefix-map in such way does not work for upstream] 10Upstream-Status: Inappropriate [applying --file-prefix-map in such way does not work for upstream]
11Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com> 11Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
12
12--- 13---
13 visa/CMakeLists.txt | 7 +++++-- 14 visa/CMakeLists.txt | 7 +++++--
14 1 file changed, 5 insertions(+), 2 deletions(-) 15 1 file changed, 5 insertions(+), 2 deletions(-)
15 16
16diff --git a/visa/CMakeLists.txt b/visa/CMakeLists.txt 17diff --git a/visa/CMakeLists.txt b/visa/CMakeLists.txt
17index 981c35d2..d5944370 100644 18index 6be467587..930c386a6 100644
18--- a/visa/CMakeLists.txt 19--- a/visa/CMakeLists.txt
19+++ b/visa/CMakeLists.txt 20+++ b/visa/CMakeLists.txt
20@@ -109,8 +109,11 @@ endif() 21@@ -123,8 +123,11 @@ endif()
21 set(bison_output_file ${CMAKE_CURRENT_BINARY_DIR}/CISA.tab.cpp) 22 set(bison_output_file ${CMAKE_CURRENT_BINARY_DIR}/CISA.tab.cpp)
22 set(flex_output_file ${CMAKE_CURRENT_BINARY_DIR}/lex.CISA.cpp) 23 set(flex_output_file ${CMAKE_CURRENT_BINARY_DIR}/lex.CISA.cpp)
23 24
@@ -31,6 +32,3 @@ index 981c35d2..d5944370 100644
31 ADD_FLEX_BISON_DEPENDENCY(CISAScanner CISAParser) 32 ADD_FLEX_BISON_DEPENDENCY(CISAScanner CISAParser)
32 set(CISAScanner_dependencies) 33 set(CISAScanner_dependencies)
33 34
34--
352.28.0
36
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 @@
1From c6d333637537263930acb1b6c5dadb0467d745f6 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= <zboszor@pr.hu>
3Date: Fri, 26 Feb 2021 06:39:35 +0100
4Subject: [PATCH 3/3] Review fixes for LLVM 12 phase 2
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Upstream-Status: Pending
10
11Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
12Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
13---
14 IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | 4 ----
15 .../AddressSpaceAliasAnalysis.cpp | 10 +++++-----
16 .../PrivateMemory/PrivateMemoryResolution.cpp | 4 ----
17 IGC/DebugInfo/DebugInfoUtils.hpp | 4 ----
18 IGC/DebugInfo/DwarfDebug.cpp | 8 --------
19 5 files changed, 5 insertions(+), 25 deletions(-)
20
21diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
22index 12f42be8..c4f9d1ea 100644
23--- a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
24+++ b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
25@@ -1576,11 +1576,7 @@ void SPIRVToLLVMDbgTran::transDbgInfo(SPIRVValue *SV, Value *V) {
26 Line->getColumn(), scope, iat);
27
28 if(scope && !isa<DIFile>(scope))
29-#if LLVM_VERSION_MAJOR >= 12
30 I->setDebugLoc(DILocation::get(scope->getContext(), Line->getLine(), Line->getColumn(),
31-#else
32- I->setDebugLoc(DebugLoc::get(Line->getLine(), Line->getColumn(),
33-#endif
34 scope, iat));
35 }
36 }
37diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
38index e9c07b34..b6b779da 100644
39--- a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
40+++ b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
41@@ -23,8 +23,7 @@ IN THE SOFTWARE.
42 ============================= end_copyright_notice ===========================*/
43
44 #include "llvm/Config/llvm-config.h"
45-#include "llvmWrapper/IR/DerivedTypes.h"
46-#include "llvmWrapper/Analysis/TargetLibraryInfo.h"
47+#include <llvm/Analysis/TargetLibraryInfo.h>
48 #include "Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.h"
49 #include "Compiler/CodeGenPublic.h"
50 #include "Compiler/IGCPassSupport.h"
51@@ -180,11 +179,12 @@ namespace {
52 bool doInitialization(Module& M) override {
53 if(M.size() > 0)
54 {
55+ Result.reset(new AddressSpaceAAResult(
56+ getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(
57 #if LLVM_VERSION_MAJOR >= 10
58- Function &F = *M.begin();
59+ *M.begin()
60 #endif
61- Result.reset(new AddressSpaceAAResult(
62- getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(),
63+ ),
64 *getAnalysis<CodeGenContextWrapper>().getCodeGenContext()));
65 }
66 return false;
67diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
68index 07f85f4c..98ea616f 100644
69--- a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
70+++ b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
71@@ -816,11 +816,7 @@ bool PrivateMemoryResolution::resolveAllocaInstructions(bool privateOnStack)
72 // Construct an empty DebugLoc.
73 IF_DEBUG_INFO(DebugLoc entryDebugLoc);
74 // Assign with the function location if available.
75-#if LLVM_VERSION_MAJOR >= 12
76 IF_DEBUG_INFO_IF(DISubprogram *subprogram = m_currFunction->getSubprogram(), entryDebugLoc = DILocation::get(subprogram->getContext(), subprogram->getLine(), 0, subprogram););
77-#else
78- IF_DEBUG_INFO_IF(DISubprogram *subprogram = m_currFunction->getSubprogram(), entryDebugLoc = DebugLoc::get(subprogram->getLine(), 0, subprogram););
79-#endif
80 IF_DEBUG_INFO(entryBuilder.SetCurrentDebugLocation(entryDebugLoc));
81
82 if (privateOnStack)
83diff --git a/IGC/DebugInfo/DebugInfoUtils.hpp b/IGC/DebugInfo/DebugInfoUtils.hpp
84index b77a550d..88b30a75 100644
85--- a/IGC/DebugInfo/DebugInfoUtils.hpp
86+++ b/IGC/DebugInfo/DebugInfoUtils.hpp
87@@ -108,11 +108,7 @@ namespace IGC
88 IGCLLVM::DIBuilder Builder(M);
89 llvm::DIGlobalVariable* GV = GVs[j]->getVariable();
90 llvm::DIScope* scopeToUse = GV->getScope();
91-#if LLVM_VERSION_MAJOR >= 12
92 llvm::DILocation* locToUse = llvm::DILocation::get(scopeToUse->getContext(), GV->getLine(), 0, scopeToUse, loc);
93-#else
94- llvm::DILocation* locToUse = llvm::DebugLoc::get(GV->getLine(), 0, scopeToUse, loc);
95-#endif
96 if (llvm::isa<llvm::DICompileUnit>(GV->getScope()))
97 {
98 // Function has no DebugLoc so it is either internal
99diff --git a/IGC/DebugInfo/DwarfDebug.cpp b/IGC/DebugInfo/DwarfDebug.cpp
100index bd9f17b7..3d9f0835 100644
101--- a/IGC/DebugInfo/DwarfDebug.cpp
102+++ b/IGC/DebugInfo/DwarfDebug.cpp
103@@ -2102,17 +2102,9 @@ static DebugLoc getFnDebugLoc(DebugLoc DL, const LLVMContext& Ctx)
104 // Check for number of operands since the compatibility is cheap here.
105 if (SP->getNumOperands() > 19)
106 {
107-#if LLVM_VERSION_MAJOR >= 12
108 return DILocation::get(SP->getContext(), SP->getScopeLine(), 0, SP);
109-#else
110- return DebugLoc::get(SP->getScopeLine(), 0, SP);
111-#endif
112 }
113-#if LLVM_VERSION_MAJOR >= 12
114 return DILocation::get(SP->getContext(), SP->getLine(), 0, SP);
115-#else
116- return DebugLoc::get(SP->getLine(), 0, SP);
117-#endif
118 }
119
120 return DebugLoc();
121--
1222.17.1
123
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 @@
1From 11b923c99cbe3580885ce40c322277fc823107a0 Mon Sep 17 00:00:00 2001
2From: Naveen Saini <naveen.kumar.saini@intel.com>
3Date: Tue, 2 Feb 2021 13:39:53 +0800
4Subject: [PATCH] IGC/VectorCompiler/CMakeLists.txt: link to external
5 LLVMGenXIntrinsics
6
7By default LLVMGenXIntrinsics is to be build In-tree, but we want to
8link externally.
9
10Fix llvm-tblgen path.
11
12Upstream-Status: Inappropriate [configuration specific]
13
14Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
15---
16 IGC/VectorCompiler/CMakeLists.txt | 32 ++-----------------------------
17 1 file changed, 2 insertions(+), 30 deletions(-)
18
19diff --git a/IGC/VectorCompiler/CMakeLists.txt b/IGC/VectorCompiler/CMakeLists.txt
20index 86f343ee..b4268160 100644
21--- a/IGC/VectorCompiler/CMakeLists.txt
22+++ b/IGC/VectorCompiler/CMakeLists.txt
23@@ -53,10 +53,7 @@ if(IGC_BUILD__USING_SYSTEM_LLVM OR (WIN32 AND LLVM_USE_PREBUILT))
24 message(STATUS "[VC] Using system llvm")
25
26 # Need to search for llvm-tblgen
27- find_program(LLVM_TABLEGEN_EXE "llvm-tblgen"
28- ${LLVM_TOOLS_BINARY_DIR}
29- NO_DEFAULT_PATH
30- )
31+ find_program(LLVM_TABLEGEN_EXE "llvm-tblgen")
32 if(LLVM_TABLEGEN_EXE-NOTFOUND)
33 message(FATAL_ERROR "[VC] llvm-tblgen is not found")
34 endif()
35@@ -140,32 +137,7 @@ if(LLVM_ON_WIN32)
36 add_compile_options(/wd4141)
37 endif()
38
39-if(DEFINED VC_INTRINSICS_SRC)
40- set(INTRSRC "${VC_INTRINSICS_SRC}/GenXIntrinsics")
41-endif()
42-
43-if(NOT DEFINED INTRSRC)
44- set(INTRSRC "${CMAKE_CURRENT_SOURCE_DIR}/../../../vc-intrinsics/GenXIntrinsics")
45-endif()
46-
47-message(STATUS "[VC] Using vc-intrinsics source from: ${INTRSRC}")
48-
49-# We are using prebuilt SPIRV and building intrinsics.
50-set(INTRBUILD "${CMAKE_CURRENT_BINARY_DIR}/intrbuild")
51-add_subdirectory(${INTRSRC} ${INTRBUILD})
52-# Make separate target for intrinstics headers.
53-# Ideally, this should be inside intrinsics, but
54-# this breaks in-tree build of intrinsics with LLVM.
55-add_library(VCIntrinsicsHeaders INTERFACE)
56-target_include_directories(VCIntrinsicsHeaders
57- INTERFACE
58- ${INTRSRC}/include
59- ${INTRBUILD}/include
60- )
61-add_dependencies(VCIntrinsicsHeaders
62- GenXIntrinsics
63- )
64-
65+find_package(LLVMGenXIntrinsics REQUIRED)
66 include(cmake/spirv.cmake)
67 include(${IGC_SOURCE_DIR}/cmake/utils.cmake)
68
69--
702.17.1
71
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.15985.7.bb b/dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.15985.7.bb
new file mode 100644
index 00000000..96d828b6
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.15985.7.bb
@@ -0,0 +1,75 @@
1SUMMARY = "The Intel(R) Graphics Compiler for OpenCL(TM)"
2DESCRIPTION = "The Intel(R) Graphics Compiler for OpenCL(TM) is an \
3llvm based compiler for OpenCL(TM) targeting Intel Gen graphics \
4hardware architecture."
5
6LICENSE = "MIT & Apache-2.0"
7LIC_FILES_CHKSUM = "file://IGC/BiFModule/Implementation/ExternalLibraries/libclc/LICENSE.TXT;md5=311cfc1a5b54bab8ed34a0b5fba4373e \
8 file://LICENSE.md;md5=488d74376edf2765f6e78d271543dde3 \
9 file://NOTICES.txt;md5=7f4fbc3eb2c34807465e63b1ec3c9d1a"
10
11SRC_URI = "git://github.com/intel/intel-graphics-compiler.git;protocol=https;name=igc;branch=releases/igc-1.0.15985 \
12 git://github.com/intel/vc-intrinsics.git;protocol=https;destsuffix=git/vc-intrinsics;name=vc;nobranch=1 \
13 git://github.com/KhronosGroup/SPIRV-Tools.git;protocol=https;destsuffix=git/SPIRV-Tools;name=spirv-tools;branch=main \
14 git://github.com/KhronosGroup/SPIRV-Headers.git;protocol=https;destsuffix=git/SPIRV-Headers;name=spirv-headers;branch=main \
15 file://0003-Improve-Reproducibility-for-src-package.patch \
16 file://0001-BiF-CMakeLists.txt-remove-opt-from-DEPENDS.patch \
17 file://0001-external-SPIRV-Tools-change-path-to-tools-and-header.patch \
18 "
19
20SRC_URI:append:class-native = " file://0001-fix-tblgen.patch"
21
22SRCREV_igc = "6cc111d262e1c3abcf4bc6b6d8a589ebf821a5c0"
23SRCREV_vc = "da892e1982b6c25b9a133f85b4ac97142d8a3def"
24SRCREV_spirv-tools = "f0cc85efdbbe3a46eae90e0f915dc1509836d0fc"
25SRCREV_spirv-headers = "cca08c63cefa129d082abca0302adcb81610b465"
26
27SRCREV_FORMAT = "igc_vc_spirv-tools_spirv-headers"
28
29# Used to replace with relative path in reproducibility patch
30export B
31
32S = "${WORKDIR}/git"
33
34inherit cmake pkgconfig qemu python3native
35
36CXXFLAGS:append = " -Wno-error=nonnull"
37
38COMPATIBLE_HOST = '(x86_64).*-linux'
39COMPATIBLE_HOST:libc-musl = "null"
40
41DEPENDS += " flex-native bison-native clang clang-cross-x86_64 opencl-clang qemu-native python3-mako-native"
42
43RDEPENDS:${PN} += "opencl-clang"
44
45PACKAGECONFIG ??= "vc"
46PACKAGECONFIG[vc] = "-DIGC_BUILD__VC_ENABLED=ON -DIGC_OPTION__LINK_KHRONOS_SPIRV_TRANSLATOR=ON -DIGC_OPTION__SPIRV_TRANSLATOR_MODE=Prebuilds,-DIGC_BUILD__VC_ENABLED=OFF,"
47
48EXTRA_OECMAKE = " \
49 -DIGC_OPTION__LLVM_PREFERRED_VERSION=${LLVMVERSION} \
50 -DVC_INTRINSICS_SRC="${S}/vc-intrinsics" \
51 -DIGC_OPTION__LLVM_MODE=Prebuilds \
52 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
53 -DLLVM_LINK_EXE=${STAGING_BINDIR_NATIVE}/llvm-link \
54 -DCLANG_EXE=${STAGING_BINDIR_NATIVE}/clang \
55 -DCMAKE_CROSSCOMPILING_EMULATOR=${WORKDIR}/qemuwrapper \
56 "
57
58do_configure:prepend:class-target () {
59 # Write out a qemu wrapper that will be used by cmake.
60 qemu_binary="${@qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST'), [d.expand('${STAGING_DIR_HOST}${libdir}'),d.expand('${STAGING_DIR_HOST}${base_libdir}')])}"
61 cat > ${WORKDIR}/qemuwrapper << EOF
62#!/bin/sh
63$qemu_binary "\$@"
64EOF
65 chmod +x ${WORKDIR}/qemuwrapper
66}
67
68UPSTREAM_CHECK_GITTAGREGEX = "^igc-(?P<pver>(?!19\..*)\d+(\.\d+)+)$"
69
70FILES:${PN} += " \
71 ${libdir}/igc/NOTICES.txt \
72 "
73
74# libigc.so contains buildpaths
75INSANE_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 @@
1SUMMARY = "The Intel(R) Graphics Compiler for OpenCL(TM)"
2DESCRIPTION = "The Intel(R) Graphics Compiler for OpenCL(TM) is an \
3llvm based compiler for OpenCL(TM) targeting Intel Gen graphics \
4hardware architecture."
5
6LICENSE = "MIT & BSD-3-Clause"
7LIC_FILES_CHKSUM = "file://IGC/BiFModule/Implementation/ExternalLibraries/libclc/LICENSE.TXT;md5=311cfc1a5b54bab8ed34a0b5fba4373e \
8 file://IGC/Compiler/LegalizationPass.cpp;beginline=1;endline=23;md5=8b19c5999abc484f18232b0905367f9f \
9 file://NOTICES.txt;md5=b12e73994de4fbe0f688cf0bc91512a0"
10
11SRC_URI = "git://github.com/intel/intel-graphics-compiler.git;protocol=https; \
12 file://0001-skip-execution-of-ElfPackager.patch \
13 file://link-to-LLVMGenXIntrinsics.patch \
14 file://improve_src_package_reproducibility.patch \
15 file://0001-Fix-build-with-LLVM-12.patch \
16 file://0002-Review-fixes-for-LLVM-12-phase-1.patch \
17 file://0003-Review-fixes-for-LLVM-12-phase-2.patch \
18 "
19
20SRCREV = "535aaaef03ce338e05e6162118082e6e007e8c10"
21
22# Used to replace with relative path in reproducibility patch
23export B
24
25S = "${WORKDIR}/git"
26
27inherit cmake
28
29COMPATIBLE_HOST = '(x86_64).*-linux'
30COMPATIBLE_HOST_libc-musl = "null"
31
32DEPENDS += " flex-native bison-native clang opencl-clang vc-intrinsics"
33DEPENDS_append_class-target = " clang-cross-x86_64"
34
35RDEPENDS_${PN} += "opencl-clang"
36
37EXTRA_OECMAKE = "-DIGC_OPTION__LLVM_PREFERRED_VERSION=${LLVMVERSION} -DPYTHON_EXECUTABLE=${HOSTTOOLS_DIR}/python3 -DIGC_BUILD__VC_ENABLED=OFF -DIGC_BUILD__USE_KHRONOS_SPIRV_TRANSLATOR=ON"
38
39BBCLASSEXTEND = "native nativesdk"
40
41UPSTREAM_CHECK_GITTAGREGEX = "^igc-(?P<pver>(?!19\..*)\d+(\.\d+)+)$"
42
43FILES_${PN} += " \
44 ${libdir}/igc/NOTICES.txt \
45 "
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 @@
1From 7fc05c52dd91902fa324a7aac9b90715cfca4717 Mon Sep 17 00:00:00 2001
2From: Naveen Saini <naveen.kumar.saini@intel.com>
3Date: Wed, 15 Apr 2020 17:55:32 +0800
4Subject: [PATCH] Building in-tree with LLVM 10.0 with the LLVM_LINK_LLVM_DYLIB
5
6Failed to link with the LLVMSPIRVLib library.
7
8Add an explicit dependency to force the correct build order and linking.
9
10Reference:
11https://github.com/KhronosGroup/SPIRV-LLVM-Translator/commit/a6d4ccf082858e63e139ca06c02a071c343d2657
12
13Upstream-Status: Submitted [https://github.com/intel/opencl-clang/pull/118]
14
15Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
16---
17 CMakeLists.txt | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20diff --git a/CMakeLists.txt b/CMakeLists.txt
21index 51c140d..b8b514e 100644
22--- a/CMakeLists.txt
23+++ b/CMakeLists.txt
24@@ -208,7 +208,7 @@ link_directories(
25
26 set(OPENCL_CLANG_LINK_LIBS ${CMAKE_DL_LIBS})
27
28-if(NOT LLVMSPIRVLib IN_LIST LLVM_AVAILABLE_LIBS)
29+if(NOT LLVMSPIRVLib IN_LIST LLVM_AVAILABLE_LIBS OR (USE_PREBUILT_LLVM AND LLVM_LINK_LLVM_DYLIB))
30 # SPIRV-LLVM-Translator is not included into LLVM as a component.
31 # So, we need to list it here explicitly as an external library
32 list(APPEND OPENCL_CLANG_LINK_LIBS LLVMSPIRVLib)
33--
342.17.1
35
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 @@
1From 5aea653e611b59c70e529a1bd71885a509831557 Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Tue, 1 Aug 2023 11:15:31 +0800
4Subject: [PATCH] cl_headers/CMakeLists.txt: use clang from native sysroot
5
6Allow clang to be found in target sysroot for target builds and dont try
7to compile cross binaries, we do that ourselves.
8
9Upstream-Status: Inappropriate [oe-specific]
10Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
11---
12 CMakeLists.txt | 8 ++++----
13 cl_headers/CMakeLists.txt | 2 +-
14 2 files changed, 5 insertions(+), 5 deletions(-)
15
16diff --git a/CMakeLists.txt b/CMakeLists.txt
17index 5864009..60ba39e 100644
18--- a/CMakeLists.txt
19+++ b/CMakeLists.txt
20@@ -35,10 +35,10 @@ set(CMAKE_MODULE_PATH
21
22 include(CMakeFunctions)
23
24-if(CMAKE_CROSSCOMPILING AND OPENCL_CLANG_BUILD_EXTERNAL)
25- include(CrossCompile)
26- llvm_create_cross_target(${PROJECT_NAME} NATIVE "" Release)
27-endif()
28+#if(CMAKE_CROSSCOMPILING AND OPENCL_CLANG_BUILD_EXTERNAL)
29+# include(CrossCompile)
30+# llvm_create_cross_target(${PROJECT_NAME} NATIVE "" Release)
31+#endif()
32
33 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
34 set(USE_PREBUILT_LLVM ON)
35diff --git a/cl_headers/CMakeLists.txt b/cl_headers/CMakeLists.txt
36index 16cabb7..4423536 100644
37--- a/cl_headers/CMakeLists.txt
38+++ b/cl_headers/CMakeLists.txt
39@@ -1,6 +1,6 @@
40 set(CL_HEADERS_LIB cl_headers)
41 if(USE_PREBUILT_LLVM)
42- find_program(CLANG_COMMAND clang PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
43+ find_program(CLANG_COMMAND clang PATHS ${LLVM_TOOLS_BINARY_DIR})
44 else()
45 set(CLANG_COMMAND $<TARGET_FILE:clang>)
46 endif()
47--
482.37.3
49
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 @@
1From f3ef79a6301bab0b3a447f07ceb94c39a95009df Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Thu, 2 Apr 2020 08:59:20 +0800
4Subject: [PATCH] don't redefine LLVM_TABLEGEN_EXE
5
6Use the value that has been passed by the user.
7
8Upstream-Status: Submitted
9Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
10---
11 CMakeLists.txt | 5 ++++-
12 1 file changed, 4 insertions(+), 1 deletion(-)
13
14diff --git a/CMakeLists.txt b/CMakeLists.txt
15index 6893e97..941b0ae 100644
16--- a/CMakeLists.txt
17+++ b/CMakeLists.txt
18@@ -137,7 +137,10 @@ endif(NOT USE_PREBUILT_LLVM)
19 set (COMPILE_OPTIONS_TD opencl_clang_options.td)
20 set (COMPILE_OPTIONS_INC opencl_clang_options.inc)
21
22-set(LLVM_TABLEGEN_EXE "llvm-tblgen")
23+if(NOT DEFINED LLVM_TABLEGEN_EXE)
24+ set(LLVM_TABLEGEN_EXE "llvm-tblgen")
25+endif()
26+
27 set(LLVM_TARGET_DEFINITIONS ${COMPILE_OPTIONS_TD})
28 if(USE_PREBUILT_LLVM)
29 set(TABLEGEN_ADDITIONAL -I ${LLVM_INCLUDE_DIRS})
30--
312.25.1
32
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 @@
1From 43c806ef321b1f677a49d28c89fb7ffecf539c2d Mon Sep 17 00:00:00 2001
2From: Tim Creech <timothy.m.creech@intel.com>
3Date: Wed, 28 Jun 2023 03:45:51 -0400
4Subject: [PATCH 2/2] Request native clang only when cross-compiling (#464)
5
6* Request native clang only when cross-compiling
7
8LLVM_USE_HOST_TOOLS may be set if LLVM is configured with
9LLVM_OPTIMIZED_TABLEGEN, which does not necessarily indicate
10cross-compilation or that clang will only execute on the target.
11
12By checking that CMAKE_CROSSCOMPILING is set, we ensure that we only
13build/use clang again if necessary for host execution.
14
15* fixup: CMAKE_CROSSCOMPILING implies LLVM_USE_HOST_TOOLS
16
17Co-authored-by: Wenju He <wenju.he@intel.com>
18
19* fixup: also use CMAKE_CROSSCOMPILING in top-level CMakeLists.txt
20
21---------
22
23Co-authored-by: Wenju He <wenju.he@intel.com>
24
25Upstream-Status: Backport [https://github.com/intel/opencl-clang/commit/53843eee13cfb2357919ee02714a43bef1af0f86]
26Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
27---
28 CMakeLists.txt | 2 +-
29 cl_headers/CMakeLists.txt | 2 +-
30 2 files changed, 2 insertions(+), 2 deletions(-)
31
32diff --git a/CMakeLists.txt b/CMakeLists.txt
33index e772de9..5864009 100644
34--- a/CMakeLists.txt
35+++ b/CMakeLists.txt
36@@ -35,7 +35,7 @@ set(CMAKE_MODULE_PATH
37
38 include(CMakeFunctions)
39
40-if(LLVM_USE_HOST_TOOLS AND OPENCL_CLANG_BUILD_EXTERNAL)
41+if(CMAKE_CROSSCOMPILING AND OPENCL_CLANG_BUILD_EXTERNAL)
42 include(CrossCompile)
43 llvm_create_cross_target(${PROJECT_NAME} NATIVE "" Release)
44 endif()
45diff --git a/cl_headers/CMakeLists.txt b/cl_headers/CMakeLists.txt
46index 18296c2..16cabb7 100644
47--- a/cl_headers/CMakeLists.txt
48+++ b/cl_headers/CMakeLists.txt
49@@ -4,7 +4,7 @@ if(USE_PREBUILT_LLVM)
50 else()
51 set(CLANG_COMMAND $<TARGET_FILE:clang>)
52 endif()
53-if(LLVM_USE_HOST_TOOLS AND NOT OPENCL_CLANG_BUILD_EXTERNAL)
54+if(CMAKE_CROSSCOMPILING AND NOT OPENCL_CLANG_BUILD_EXTERNAL)
55 build_native_tool(clang CLANG_COMMAND)
56 endif()
57
58--
592.37.3
60
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 @@
1From b29e00e6fe428a031cf577dfb703cf13eff837f6 Mon Sep 17 00:00:00 2001
2From: Naveen Saini <naveen.kumar.saini@intel.com>
3Date: Wed, 15 Apr 2020 18:05:14 +0800
4Subject: [PATCH 2/2] make sure only static libraries linked for native build
5
6LINK_COMPONENTS=all isn't working for static libs for out of tree builds. Use
7LLVM_AVAILABLE_LIBS instead. Reported:
8
9https://github.com/intel/opencl-clang/issues/114
10
11Upstream-Status: Pending
12
13Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
14Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
15---
16 CMakeLists.txt | 3 ++-
17 1 file changed, 2 insertions(+), 1 deletion(-)
18
19diff --git a/CMakeLists.txt b/CMakeLists.txt
20index 8707487..ad2dbda 100644
21--- a/CMakeLists.txt
22+++ b/CMakeLists.txt
23@@ -218,7 +218,7 @@ add_subdirectory(cl_headers)
24
25 set(LLVM_REQUIRES_EH ON)
26
27-if(USE_PREBUILT_LLVM OR CLANG_LINK_CLANG_DYLIB)
28+if(false)
29 list(APPEND OPENCL_CLANG_LINK_LIBS clang-cpp)
30 else()
31 list(APPEND OPENCL_CLANG_LINK_LIBS
32@@ -266,6 +266,7 @@ add_llvm_library(${TARGET_NAME} SHARED
33 all
34 LINK_LIBS
35 ${OPENCL_CLANG_LINK_LIBS}
36+ ${LLVM_AVAILABLE_LIBS}
37 )
38
39 # Configure resource file on Windows
40--
412.17.1
42
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 \
5LICENSE = "NCSA" 5LICENSE = "NCSA"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=e8a15bf1416762a09ece07e44c79118c" 6LIC_FILES_CHKSUM = "file://LICENSE;md5=e8a15bf1416762a09ece07e44c79118c"
7 7
8SRC_URI = "git://github.com/intel/opencl-clang.git;branch=ocl-open-110;protocol=https \ 8SRC_URI = "git://github.com/intel/opencl-clang.git;branch=${BRANCH};protocol=https \
9 file://0001-don-t-redefine-LLVM_TABLEGEN_EXE.patch \ 9 file://0002-Request-native-clang-only-when-cross-compiling-464.patch \
10 file://0001-cl_headers-CMakeLists.txt-use-clang-from-native-sysr.patch \
10 " 11 "
11SRC_URI_append_class-native = " file://0002-make-sure-only-static-libraries-linked-for-native-bu.patch"
12
13SRCREV = "c67648d41df00ea8ee9d701d17299b86f86f0321"
14
15S = "${WORKDIR}/git" 12S = "${WORKDIR}/git"
16 13
17inherit cmake 14inherit cmake
18DEPENDS += "clang" 15DEPENDS += "clang"
19DEPENDS_append_class-target = " opencl-clang-native" 16DEPENDS:append:class-target = " opencl-clang-native"
20 17
21COMPATIBLE_HOST = '(x86_64).*-linux' 18COMPATIBLE_HOST = '(x86_64).*-linux'
22COMPATIBLE_HOST_libc-musl = "null" 19COMPATIBLE_HOST:libc-musl = "null"
20
21DEPENDS += " spirv-llvm-translator"
23 22
24EXTRA_OECMAKE += "\ 23EXTRA_OECMAKE += "\
25 -DLLVM_TABLEGEN_EXE=${STAGING_BINDIR_NATIVE}/llvm-tblgen \ 24 -DLLVM_TABLEGEN_EXE=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
26 -DCMAKE_SKIP_RPATH=TRUE \ 25 -DCMAKE_SKIP_RPATH=TRUE \
27 -DPREFERRED_LLVM_VERSION="11.1.0" \ 26 -DPREFERRED_LLVM_VERSION=${LLVMVERSION} \
28 " 27 "
29 28
30do_install_append_class-native() { 29do_install:append:class-native() {
31 install -d ${D}${bindir} 30 install -d ${D}${bindir}
32 install -m 0755 ${B}/linux_linker/linux_resource_linker ${D}${bindir}/ 31 install -m 0755 ${B}/bin/linux_resource_linker ${D}${bindir}/
33} 32}
34 33
35BBCLASSEXTEND = "native nativesdk" 34BBCLASSEXTEND = "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 c5ba96c1..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_10.0.0.bb
+++ /dev/null
@@ -1,35 +0,0 @@
1SUMMARY = "Common clang is a thin wrapper library around clang"
2DESCRIPTION = "Common clang has OpenCL-oriented API and is capable \
3 to compile OpenCL C kernels to SPIR-V modules."
4
5LICENSE = "NCSA"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=e8a15bf1416762a09ece07e44c79118c"
7
8SRC_URI = "git://github.com/intel/opencl-clang.git;branch=ocl-open-100;protocol=https \
9 file://0001-don-t-redefine-LLVM_TABLEGEN_EXE.patch \
10 file://0001-Building-in-tree-with-LLVM-10.0-with-the-LLVM_LINK_L.patch \
11 "
12SRC_URI_append_class-native = " file://0002-make-sure-only-static-libraries-linked-for-native-bu.patch"
13
14SRCREV = "92f3f7f1a06f25fb13708f87c26b0fbf50924c96"
15
16S = "${WORKDIR}/git"
17
18inherit cmake
19DEPENDS += "clang"
20DEPENDS_append_class-target = " opencl-clang-native"
21
22COMPATIBLE_HOST = '(x86_64).*-linux'
23COMPATIBLE_HOST_libc-musl = "null"
24
25EXTRA_OECMAKE += "\
26 -DLLVM_TABLEGEN_EXE=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
27 -DCMAKE_SKIP_RPATH=TRUE \
28 "
29
30do_install_append_class-native() {
31 install -d ${D}${bindir}
32 install -m 0755 ${B}/linux_linker/linux_resource_linker ${D}${bindir}/
33}
34
35BBCLASSEXTEND = "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 @@
1SUMMARY = "Common clang is a thin wrapper library around clang"
2DESCRIPTION = "Common clang has OpenCL-oriented API and is capable \
3 to compile OpenCL C kernels to SPIR-V modules."
4
5LICENSE = "NCSA"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=e8a15bf1416762a09ece07e44c79118c"
7
8SRC_URI = "git://github.com/intel/opencl-clang.git;branch=ocl-open-120;protocol=https \
9 file://0001-don-t-redefine-LLVM_TABLEGEN_EXE.patch \
10 "
11
12SRCREV = "cea544b04460a47848e585bfe75cd774c0324b45"
13
14S = "${WORKDIR}/git"
15
16inherit cmake
17DEPENDS += " clang spirv-llvm-translator"
18DEPENDS_append_class-target = " opencl-clang-native"
19
20COMPATIBLE_HOST = '(x86_64).*-linux'
21COMPATIBLE_HOST_libc-musl = "null"
22
23EXTRA_OECMAKE += "\
24 -DLLVM_TABLEGEN_EXE=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
25 -DCMAKE_SKIP_RPATH=TRUE \
26 -DPREFERRED_LLVM_VERSION="12.0.0" \
27 "
28
29do_install_append_class-native() {
30 install -d ${D}${bindir}
31 install -m 0755 ${B}/linux_linker/linux_resource_linker ${D}${bindir}/
32}
33
34BBCLASSEXTEND = "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 @@
1require opencl-clang.inc
2
3SRCREV = "980f1691c5babcf824ee10375a04a0d0c5d7d44a"
4
5BRANCH = "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 @@
1require opencl-clang.inc
2
3SRCREV = "60fd799cc58755c16d951f9ebfde6d0f9b8554dd"
4
5BRANCH = "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 @@
1SUMMARY = "VC Intrinsics"
2DESCRIPTION = "VC Intrinsics project contains a set of new intrinsics on \
3top of core LLVM IR instructions that represent SIMD semantics of a program \
4targeting GPU"
5
6LICENSE = "MIT"
7LIC_FILES_CHKSUM = "file://License.md;md5=c18ea6bb4786a26bf4eee88a7424a408"
8
9SRC_URI = "git://github.com/intel/vc-intrinsics.git;protocol=https; \
10 "
11SRCREV = "77974f5a32e19475125531483bede9ee23935257"
12
13S = "${WORKDIR}/git"
14
15inherit cmake
16
17COMPATIBLE_HOST = '(x86_64).*-linux'
18COMPATIBLE_HOST_libc-musl = "null"
19
20DEPENDS += " clang"
21
22EXTRA_OECMAKE = "-DLLVM_DIR=${STAGING_LIBDIR}"
23
24BBCLASSEXTEND = "native nativesdk"
diff --git a/dynamic-layers/meta-python/recipes-opencv/dldt/openvino-model-optimizer_2021.2.bb b/dynamic-layers/meta-python/recipes-opencv/dldt/openvino-model-optimizer_2024.0.0.bb
index 9d8c1e18..70177c28 100644
--- a/dynamic-layers/meta-python/recipes-opencv/dldt/openvino-model-optimizer_2021.2.bb
+++ b/dynamic-layers/meta-python/recipes-opencv/dldt/openvino-model-optimizer_2024.0.0.bb
@@ -5,29 +5,29 @@ environment, performs static model analysis, and adjusts deep \
5learning models for optimal execution on end-point target devices." 5learning models for optimal execution on end-point target devices."
6HOMEPAGE = "https://01.org/openvinotoolkit" 6HOMEPAGE = "https://01.org/openvinotoolkit"
7 7
8SRC_URI = "git://github.com/openvinotoolkit/openvino.git;protocol=https;branch=releases/2021/2;lfs=0 \ 8SRC_URI = "git://github.com/openvinotoolkit/openvino.git;protocol=https;branch=releases/2024/0;lfs=0 \
9 " 9 "
10SRCREV = "4795391b73381660b69b4cd3986c7a0bf902e868" 10SRCREV = "34caeefd07800b59065345d651949efbe8ab6649"
11 11
12LICENSE = "Apache-2.0" 12LICENSE = "Apache-2.0"
13LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" 13LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327"
14 14
15CVE_PRODUCT = "intel:openvino" 15CVE_PRODUCT = "intel:openvino"
16
17S = "${WORKDIR}/git" 16S = "${WORKDIR}/git"
18 17
19do_install() { 18inherit setuptools3
20 mkdir -p ${D}${datadir}/openvino/model-optimizer
21 cp -r model-optimizer ${D}${datadir}/openvino/
22}
23 19
24RDEPENDS_${PN} += " \ 20SETUPTOOLS_SETUP_PATH = "${WORKDIR}/git/tools/mo"
25 python3-numpy \ 21
26 python3-protobuf \ 22RDEPENDS:${PN} += " \
27 python3-defusedxml \ 23 python3-defusedxml \
24 python3-fastjsonschema \
28 python3-networkx \ 25 python3-networkx \
29 python3-test-generator \ 26 python3-numpy \
27 python3-protobuf \
28 python3-requests \
29 python3-urllib3 \
30 bash \ 30 bash \
31 " 31 "
32 32
33FILES_${PN} += "${datadir}/openvino" 33UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+\.\d+\.\d+))$"
diff --git a/dynamic-layers/openembedded-layer/recipes-bsp/amt/lms_2102.1.0.0.bb b/dynamic-layers/openembedded-layer/recipes-bsp/amt/lms_2406.0.0.0.bb
index c4cf8052..bdf32576 100644
--- a/dynamic-layers/openembedded-layer/recipes-bsp/amt/lms_2102.1.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"
8 8
9COMPATIBLE_HOST = '(i.86|x86_64).*-linux' 9COMPATIBLE_HOST = '(i.86|x86_64).*-linux'
10 10
11COMPATIBLE_HOST_libc-musl = "null" 11COMPATIBLE_HOST:libc-musl = "null"
12 12
13inherit cmake systemd features_check 13inherit cmake systemd features_check python3native
14 14
15DEPENDS = "metee ace xerces-c libnl libxml2 glib-2.0 glib-2.0-native" 15DEPENDS = "metee ace xerces-c libnl libxml2 glib-2.0 glib-2.0-native pkgconfig-native python3-packaging-native"
16
17EXTRA_OECMAKE += "-DPYTHON_EXECUTABLE=${HOSTTOOLS_DIR}/python3"
18 16
19# Enable either connman or networkmanager or none but not both. 17# Enable either connman or networkmanager or none but not both.
20PACKAGECONFIG ??= "connman" 18PACKAGECONFIG ??= "connman"
@@ -23,19 +21,24 @@ PACKAGECONFIG[networkmanager] = "-DNETWORK_NM=ON, -DNETWORK_NM=OFF, networkmanag
23 21
24REQUIRED_DISTRO_FEATURES= "systemd" 22REQUIRED_DISTRO_FEATURES= "systemd"
25 23
26FILES_${PN} += "${datadir}/dbus-1/system-services/*.service" 24FILES:${PN} += "${datadir}/dbus-1/system-services/*.service"
27 25
28S = "${WORKDIR}/git" 26S = "${WORKDIR}/git"
29 27
30SYSTEMD_SERVICE_${PN} = "lms.service" 28SYSTEMD_SERVICE:${PN} = "lms.service"
31 29
32SRC_URI = "git://github.com/intel/lms.git \ 30SRC_URI = "git://github.com/intel/lms.git;branch=master;protocol=https \
33 " 31 "
34SRCREV = "2d400ec587470fc960dceecc84c123a38415d137" 32SRCREV = "388f115b2aeb3ea11499971c65f828daefd32c47"
35 33
36do_install_append() { 34do_install:append() {
35 install -d ${D}${sysconfdir}/lms
37 install -d ${D}${systemd_system_unitdir} 36 install -d ${D}${systemd_system_unitdir}
38 install -m 0644 ${B}/UNS/lms.service ${D}${systemd_system_unitdir} 37 install -m 0644 ${B}/UNS/lms.service ${D}${systemd_system_unitdir}
38 install -d ${D}${sysconfdir}/udev/rules.d
39 install -m 0644 ${S}/UNS/linux_scripts/70-mei-wdt.rules ${D}${sysconfdir}/udev/rules.d/70-mei-wdt.rules
39} 40}
40 41
41RDEPENDS_${PN} += "ace" 42RDEPENDS:${PN} += "ace"
43
44CVE_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..270cc84d
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-bsp/thermald/files/0001-Makefile-Fix-build-Issue.patch
@@ -0,0 +1,39 @@
1From c4c049481d48f33319b1d04cad56d622c4eed65f Mon Sep 17 00:00:00 2001
2From: Yogesh Tyagi <yogesh.tyagi@intel.com>
3Date: Mon, 11 Mar 2024 13:13:32 +0800
4Subject: [PATCH] Makefile: Fix build Issue
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9In case build directory is different from source, make sure make is able to find the correct input files.
10
11Fixes:
12| dbus-binding-tool --prefix=thd_dbus_interface --mode=glib-server --output=thd_dbus_interface.h ../git/src/thd_dbus_interface.xml
13| glib-compile-resources --generate-source thermald-resource.gresource.xml
14| Failed to open file “thermald-resource.gresource.xml”: No such file or directory
15
16
17Upstream-Status: Submitted
18https://github.com/intel/thermal_daemon/pull/436
19
20Signed-off-by: Yogesh Tyagi <yogesh.tyagi@intel.com>
21---
22 Makefile.am | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25diff --git a/Makefile.am b/Makefile.am
26index a0c051a..772e280 100644
27--- a/Makefile.am
28+++ b/Makefile.am
29@@ -95,6 +95,6 @@ thd_dbus_interface.h: $(top_srcdir)/src/thd_dbus_interface.xml
30 $(AM_V_GEN) dbus-binding-tool --prefix=thd_dbus_interface --mode=glib-server --output=$@ $<
31
32 thermald-resource.c: $(top_srcdir)/thermald-resource.gresource.xml
33- $(AM_V_GEN) glib-compile-resources --generate-source thermald-resource.gresource.xml
34+ $(AM_V_GEN) glib-compile-resources --generate-source --sourcedir=${top_srcdir} $<
35
36 CLEANFILES = $(BUILT_SOURCES)
37--
382.34.1
39
diff --git a/dynamic-layers/openembedded-layer/recipes-bsp/thermald/thermald_2.4.3.bb b/dynamic-layers/openembedded-layer/recipes-bsp/thermald/thermald_2.5.6.bb
index add00e3b..df242cdf 100644
--- a/dynamic-layers/openembedded-layer/recipes-bsp/thermald/thermald_2.4.3.bb
+++ b/dynamic-layers/openembedded-layer/recipes-bsp/thermald/thermald_2.5.6.bb
@@ -7,20 +7,23 @@ compensation using available cooling methods."
7HOMEPAGE = "https://github.com/01org/thermal_daemon" 7HOMEPAGE = "https://github.com/01org/thermal_daemon"
8 8
9DEPENDS = "dbus dbus-glib dbus-glib-native libxml2 glib-2.0 glib-2.0-native upower libevdev" 9DEPENDS = "dbus dbus-glib dbus-glib-native libxml2 glib-2.0 glib-2.0-native upower libevdev"
10LICENSE = "GPLv2" 10DEPENDS += "autoconf-archive-native"
11
12LICENSE = "GPL-2.0-only"
11LIC_FILES_CHKSUM = "file://COPYING;md5=ea8831610e926e2e469075b52bf08848" 13LIC_FILES_CHKSUM = "file://COPYING;md5=ea8831610e926e2e469075b52bf08848"
12 14
13SRC_URI = "git://github.com/intel/thermal_daemon/ \ 15SRC_URI = "git://github.com/intel/thermal_daemon/;branch=master;protocol=https \
16 file://0001-Makefile-Fix-build-Issue.patch \
14 " 17 "
15 18
16SRCREV = "9e731de1bd7bccd2c7c2e7923f01fbc4287ed80a" 19SRCREV = "3990ce2391e5c07293758c056e09e4f2453691b4"
17S = "${WORKDIR}/git" 20S = "${WORKDIR}/git"
18 21
19inherit pkgconfig autotools systemd gtk-doc 22inherit pkgconfig autotools systemd gtk-doc
20 23
21# gtkdocsize runs before autotools do_configure and it copies gtk-doc.m4 and fails 24# gtkdocsize runs before autotools do_configure and it copies gtk-doc.m4 and fails
22# to copy becuase there is no m4 dir yet. 25# to copy becuase there is no m4 dir yet.
23do_configure_prepend () { 26do_configure:prepend () {
24 mkdir -p ${S}/m4 27 mkdir -p ${S}/m4
25} 28}
26 29
@@ -28,13 +31,13 @@ EXTRA_OECONF = " \
28 --with-systemdsystemunitdir=${systemd_system_unitdir} \ 31 --with-systemdsystemunitdir=${systemd_system_unitdir} \
29 " 32 "
30 33
31FILES_${PN} += "${datadir}/dbus-1/system-services/*.service" 34FILES:${PN} += "${datadir}/dbus-1"
32 35
33SYSTEMD_SERVICE_${PN} = "thermald.service" 36SYSTEMD_SERVICE:${PN} = "thermald.service"
34 37
35COMPATIBLE_HOST = '(i.86|x86_64).*-linux' 38COMPATIBLE_HOST = '(i.86|x86_64).*-linux'
36 39
37CONFFILES_${PN} = " \ 40CONFFILES:${PN} = " \
38 ${sysconfdir}/thermald/thermal-conf.xml \ 41 ${sysconfdir}/thermald/thermal-conf.xml \
39 ${sysconfdir}/thermald/thermal-cpu-cdev-order.xml \ 42 ${sysconfdir}/thermald/thermal-cpu-cdev-order.xml \
40 " 43 "
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 @@
1From deccc0c69c2c8759c52885be8bdda54d3cee481c Mon Sep 17 00:00:00 2001
2From: Yogesh Tyagi <yogesh.tyagi@intel.com>
3Date: Sun, 11 Dec 2022 22:34:15 +0800
4Subject: [PATCH] Add print function to print test run status in ptest format
5
6Upstream-Status: Inappropriate [OE ptest specific]
7
8Signed-off-by: Yogesh Tyagi <yogesh.tyagi@intel.com>
9---
10 run_tests.py | 16 ++++++++++++++++
11 1 file changed, 16 insertions(+)
12
13diff --git a/run_tests.py b/run_tests.py
14index 1cd796dd..e3ffd1ab 100755
15--- a/run_tests.py
16+++ b/run_tests.py
17@@ -327,6 +327,9 @@ def run_test(testname, host, target):
18 else:
19 ispc_exe_rel = add_prefix(host.ispc_cmd, host, target)
20
21+ # to reslove the error '.rodata' can not be used when making a PIE object
22+ ispc_exe_rel = ispc_exe_rel + " --pic"
23+
24 # is this a test to make sure an error is issued?
25 want_error = (filename.find("tests_errors") != -1)
26 if want_error == True:
27@@ -795,6 +798,17 @@ def check_compiler_exists(compiler_exe):
28 return
29 error("missing the required compiler: %s \n" % compiler_exe, 1)
30
31+def print_test_run_status(results):
32+ for fstatus in results:
33+ if (fstatus[1] == Status.Success):
34+ print( "%s: %s" % ("PASS", fstatus[0]))
35+ elif (fstatus[1] == Status.Compfail):
36+ print( "%s: %s" % ("FAIL", fstatus[0]))
37+ elif (fstatus[1] == Status.Runfail):
38+ print( "%s: %s" % ("FAIL", fstatus[0]))
39+ elif (fstatus[1] == Status.Skip):
40+ print( "%s: %s" % ("SKIP", fstatus[0]))
41+
42 def print_result(status, results, s, run_tests_log, csv):
43 title = StatusStr[status]
44 file_list = [fname for fname, fstatus in results if status == fstatus]
45@@ -938,6 +952,8 @@ def run_tests(options1, args, print_version):
46 pass_rate = -1
47 print_debug("PASSRATE (%d/%d) = %d%% \n\n" % (len(run_succeed_files), total_tests_executed, pass_rate), s, run_tests_log)
48
49+ print_test_run_status(results)
50+
51 for status in Status:
52 print_result(status, results, s, run_tests_log, options.csv)
53 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 @@
1From 7beff95c11071170eb27b6fa7d0cc77588caee8e Mon Sep 17 00:00:00 2001
2From: Yogesh Tyagi <yogesh.tyagi@intel.com>
3Date: Tue, 26 Jul 2022 15:25:10 +0800
4Subject: [PATCH] Fix QA Issues
5
6Stop ispc from inserting host file path in generated headers which leads to reproducibility problems.
7
8Upstream-Status: Inappropriate [OE build specific]
9
10Signed-off-by: Yogesh Tyagi <yogesh.tyagi@intel.com>
11---
12 src/module.cpp | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
14
15diff --git a/src/module.cpp b/src/module.cpp
16index e2084d2e..e2626865 100644
17--- a/src/module.cpp
18+++ b/src/module.cpp
19@@ -2555,7 +2555,7 @@ bool Module::writeHeader(const char *fn) {
20 perror("fopen");
21 return false;
22 }
23- fprintf(f, "//\n// %s\n// (Header automatically generated by the ispc compiler.)\n", fn);
24+ fprintf(f, "//\n// \n// (Header automatically generated by the ispc compiler.)\n");
25 fprintf(f, "// DO NOT EDIT THIS FILE.\n//\n\n");
26
27 // Create a nice guard string from the filename, turning any
28@@ -2677,7 +2677,7 @@ bool Module::writeDispatchHeader(DispatchHeaderInfo *DHI) {
29 FILE *f = DHI->file;
30
31 if (DHI->EmitFrontMatter) {
32- fprintf(f, "//\n// %s\n// (Header automatically generated by the ispc compiler.)\n", DHI->fn);
33+ fprintf(f, "//\n// \n// (Header automatically generated by the ispc compiler.)\n");
34 fprintf(f, "// DO NOT EDIT THIS FILE.\n//\n\n");
35 }
36 // 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 @@
1From 16a2c22339287122d2c25d8bb33a5a51b4e6ee51 Mon Sep 17 00:00:00 2001
2From: Naveen Saini <naveen.kumar.saini@intel.com>
3Date: Thu, 24 Feb 2022 20:01:11 +0530
4Subject: [PATCH] cmake: don't build for 32-bit targets
5
6Error log:
7| 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
8| #include <bits/long-double-32.h>
9| ^~~~~~~~~~~~~~~~~~~~~~~
10| 1 error generated.
11
12Remove SYSTEM include search path and set -isysroot dir path
13for root dir for cross compilation.
14
15Upstream-Status: Inappropriate
16
17Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
18---
19 cmake/GenerateBuiltins.cmake | 6 +++---
20 1 file changed, 3 insertions(+), 3 deletions(-)
21
22diff --git a/cmake/GenerateBuiltins.cmake b/cmake/GenerateBuiltins.cmake
23index f84494ed..d90cb1ec 100644
24--- a/cmake/GenerateBuiltins.cmake
25+++ b/cmake/GenerateBuiltins.cmake
26@@ -253,7 +253,7 @@ function(builtin_to_cpp bit os_name arch supported_archs supported_oses resultFi
27 # In this case headers will be installed in /usr/arm-linux-gnueabihf/include and will not be picked up
28 # by clang by default. So the following line adds such path explicitly. If this path doesn't exist and
29 # the headers can be found in other locations, this should not be a problem.
30- set(includePath -isystem/usr/${debian_triple}/include)
31+ set(includePath -isysroot${SYSROOT_DIR})
32 endif()
33 endif()
34
35@@ -339,7 +339,7 @@ function (generate_target_builtins resultList)
36 set(regular_targets ${ARGN})
37 list(FILTER regular_targets EXCLUDE REGEX wasm)
38 foreach (ispc_target ${regular_targets})
39- foreach (bit 32 64)
40+ foreach (bit 64)
41 foreach (os_name ${TARGET_OS_LIST_FOR_LL})
42 target_ll_to_cpp(target-${ispc_target} ${bit} ${os_name} output${os_name}${bit})
43 list(APPEND tmpList ${output${os_name}${bit}})
44@@ -405,7 +405,7 @@ function (generate_common_builtins resultList)
45 endif()
46
47 message (STATUS "ISPC will be built with support of ${supported_oses} for ${supported_archs}")
48- foreach (bit 32 64)
49+ foreach (bit 64)
50 foreach (os_name "windows" "linux" "freebsd" "macos" "android" "ios" "ps4" "web")
51 foreach (arch "x86" "arm" "wasm")
52 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 @@
1#!/bin/sh
2python3 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 @@
1SUMMARY = "Intel(R) Implicit SPMD Program Compiler"
2DESCRIPTION = "ispc is a compiler for a variant of the C programming language, \
3with extensions for single program, multiple data programming."
4HOMEPAGE = "https://github.com/ispc/ispc"
5
6LICENSE = "BSD-3-Clause & Apache-2.0-with-LLVM-exception"
7LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=da5ecffdd210b3cf776b32b41c182e87 \
8 file://third-party-programs.txt;md5=2061218c7be521556719c8b504bf9ddd"
9
10inherit cmake python3native ptest
11
12S = "${WORKDIR}/git"
13
14SRC_URI = "git://github.com/ispc/ispc.git;protocol=https;branch=main \
15 file://0002-cmake-don-t-build-for-32-bit-targets.patch \
16 file://0001-Fix-QA-Issues.patch \
17 file://0001-Add-print-function-to-print-test-run-status-in-ptest.patch \
18 file://run-ptest \
19 "
20
21SRCREV = "bcb2cf896c00f9a802a11cbf291ef6e44b205416"
22
23COMPATIBLE_HOST = '(x86_64).*-linux'
24
25DEPENDS += " clang-native bison-native flex-native"
26DEPENDS:append:class-target = " clang"
27RDEPENDS:${PN}-ptest += " python3-multiprocessing"
28
29PACKAGECONFIG ??= "tbb"
30PACKAGECONFIG[tbb] = "-DISPCRT_BUILD_TASK_MODEL=TBB, -DISPCRT_BUILD_TASK_MODEL=OpenMP, tbb"
31
32YFLAGS='-d -t -v -y --file-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}'
33
34do_configure:prepend() {
35 sed -i -e 's#\${BISON_EXECUTABLE}.*#\${BISON_EXECUTABLE} ${YFLAGS} #g' ${S}/CMakeLists.txt
36 sed -i -e 's#\${FLEX_EXECUTABLE}.*#\${FLEX_EXECUTABLE} \-L #g' ${S}/CMakeLists.txt
37}
38
39do_install_ptest() {
40 cp -rf ${S}/run_tests.py ${D}${PTEST_PATH}
41 cp -rf ${S}/common.py ${D}${PTEST_PATH}
42 cp -rf ${S}/tests ${D}${PTEST_PATH}
43 cp -rf ${S}/test_static.isph ${D}${PTEST_PATH}
44 cp -rf ${S}/fail_db.txt ${D}${PTEST_PATH}
45 cp -rf ${S}/test_static.cpp ${D}${PTEST_PATH}
46}
47
48EXTRA_OECMAKE += " \
49 -DISPC_INCLUDE_TESTS=OFF \
50 -DISPC_INCLUDE_EXAMPLES=OFF \
51 -DARM_ENABLED=OFF \
52 -DISPC_CROSS=ON \
53 -DISPC_ANDROID_TARGET=OFF \
54 -DISPC_FREEBSD_TARGET=OFF \
55 -DISPC_WINDOWS_TARGET=OFF \
56 -DISPC_IOS_TARGET=OFF \
57 -DISPC_PS_TARGET=OFF \
58 -DSYSROOT_DIR=${STAGING_DIR} \
59 -DCLANG_EXECUTABLE=${STAGING_BINDIR_NATIVE}/clang \
60 -DCLANGPP_EXECUTABLE=${STAGING_BINDIR_NATIVE}/clang++ \
61 -DLLVM_AS_EXECUTABLE=${STAGING_BINDIR_NATIVE}/llvm-as \
62 "
63
64BBCLASSEXTEND = "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 @@
1SUMMARY = "oneAPI Level Zero Specification Headers and Loader" 1SUMMARY = "oneAPI Level Zero Specification Headers and Loader"
2HOMEPAGE = "https://github.com/oneapi-src/level-zero" 2HOMEPAGE = "https://github.com/oneapi-src/level-zero"
3LICENSE = "MIT" 3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://LICENSE;md5=8956dfdba7f8169c4005d1e9753ffddc" 4LIC_FILES_CHKSUM = "file://LICENSE;md5=97957beb2f7808ffa247e5d93e6442cc"
5 5
6SRC_URI = "git://github.com/oneapi-src/level-zero.git;protocol=https" 6SRC_URI = "git://github.com/oneapi-src/level-zero.git;protocol=https;branch=master"
7SRCREV = "0d30b1fa712253c68bfdfa3863d380df4301b8a4" 7SRCREV = "1685d01497428ca4d8b99200972b64685424d5c9"
8S = "${WORKDIR}/git" 8S = "${WORKDIR}/git"
9 9
10inherit cmake 10inherit cmake
@@ -14,7 +14,7 @@ UPSTREAM_CHECK_GITTAGREGEX = "^v(?P<pver>(\d+(\.\d+)+))$"
14 14
15PACKAGES =+ "${PN}-headers ${PN}-samples ${PN}-loader" 15PACKAGES =+ "${PN}-headers ${PN}-samples ${PN}-loader"
16 16
17do_install_append () { 17do_install:append () {
18 install -d ${D}${bindir} ${D}${libdir} 18 install -d ${D}${bindir} ${D}${libdir}
19 install -m 755 ${B}/bin/zello* ${D}${bindir} 19 install -m 755 ${B}/bin/zello* ${D}${bindir}
20 20
@@ -22,10 +22,12 @@ do_install_append () {
22} 22}
23 23
24 24
25FILES_${PN}-headers = "${includedir}" 25FILES:${PN}-headers = "${includedir}"
26FILES_${PN}-samples = "${bindir} ${libdir}/libze_null* ${libdir}/libze_validation*" 26FILES:${PN}-samples = "${bindir} ${libdir}/libze_null* ${libdir}/libze_validation*"
27FILES_${PN}-loader = "${libdir}" 27FILES:${PN}-loader = "${libdir}"
28 28
29# PN-loader (non -dev/-dbg/nativesdk- package) contains symlink .so 29# PN-loader (non -dev/-dbg/nativesdk- package) contains symlink .so
30INSANE_SKIP_${PN}-loader = "dev-so" 30INSANE_SKIP:${PN}-loader = "dev-so"
31INSANE_SKIP_${PN}-samples = "dev-so" 31INSANE_SKIP:${PN}-samples = "dev-so"
32ALLOW_EMPTY:${PN} = "1"
33BBCLASSEXTEND = "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 @@
1SUMMARY = "Intel® oneAPI DPC++/C++ Compiler runtime files"
2DESCRIPTION = "The Intel® oneAPI DPC++/C++ Compiler provides optimizations \
3that help your applications run faster on Intel® 64 architectures with support \
4for the latest C, C++, and SYCL language standards. This compiler produces \
5optimized code that can run significantly faster by taking advantage of the \
6ever-increasing core count and vector register width in Intel® Xeon® processors \
7and compatible processors."
8
9HOMEPAGE = "https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compiler.html"
10
11LICENSE="EULA"
12
13COMPILERMAINVER = "2024.0"
14
15LIC_FILES_CHKSUM = " \
16 file://opt/intel/oneapi/licensing/${COMPILERMAINVER}/licensing/${COMPILERMAINVER}/license.htm;md5=5ff64c6ff3ef98089ed69360e7a84c39 \
17 "
18COMPILERDOTVER = "2024.0.0-49406"
19DEVUTILITVERSION = "2024.0-2024.0.0-49320"
20SRC_URI = " \
21 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-compiler-dpcpp-cpp-runtime-${COMPILERMAINVER}-${PV}_amd64.deb;subdir=${BPN};name=dpcpp-runtime \
22 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-compiler-dpcpp-cpp-common-${COMPILERMAINVER}-${PV}_all.deb;subdir=${BPN};name=dpcpp-common \
23 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-compiler-shared-runtime-${COMPILERMAINVER}-${PV}_amd64.deb;subdir=${BPN};name=compiler-shared-runtime \
24 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-common-vars-${COMPILERDOTVER}_all.deb;subdir=${BPN};name=common-vars \
25 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-openmp-${COMPILERMAINVER}-${PV}_amd64.deb;subdir=${BPN};name=openmp \
26 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-openmp-common-${COMPILERMAINVER}-${PV}_all.deb;subdir=${BPN};name=openmp-common \
27 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-common-licensing-${COMPILERMAINVER}-${COMPILERDOTVER}_all.deb;subdir=${BPN};name=license \
28 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-dev-utilities-${DEVUTILITVERSION}_amd64.deb;subdir=${BPN};name=dev-utils \
29 "
30
31SRC_URI[dpcpp-runtime.sha256sum] = "e24f0ba69daf3f66ceaf23d5e632f183cdb90bac69f65407fdb4407fc9034f33"
32SRC_URI[dpcpp-common.sha256sum] = "f5a3db6a725598224edf1099260955aee3e36beadcaed2af5b8b453e873a82fa"
33SRC_URI[compiler-shared-runtime.sha256sum] = "bce010cbe076259ddd3feb8e69792869e22fccd5b4e2c9af9e815826f2c1a394"
34SRC_URI[common-vars.sha256sum] = "368553c99db1b52060b8225355336778be0b00e5991d0f769c42f891c6328750"
35SRC_URI[openmp.sha256sum] = "154ff1e81adfdc872ba1d47bd860de70d62188417c7128422435dfd0ceca62fe"
36SRC_URI[openmp-common.sha256sum] = "8217001d78311cbef97dd139e684c6767932b532309c3843ba57d7894d15c07d"
37SRC_URI[license.sha256sum] = "9f9c8a12fc0bc82ab5b71e118e66745eff23f42224eba304068225b366cd74b6"
38SRC_URI[dev-utils.sha256sum] = "c675d960a5abca361cead9217d6e74adee499ee0a095c4e44092bd710b304d50"
39
40S = "${WORKDIR}/${BPN}"
41
42inherit bin_package
43
44RDEPENDS:${PN} += "virtual-opencl-icd zlib tbb level-zero-loader bash tcsh"
45SKIP_FILEDEPS:${PN} = '1'
46
47INHIBIT_PACKAGE_STRIP = "1"
48INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
49
50# doesn't have GNU_HASH (didn't pass LDFLAGS?)
51INSANE_SKIP:${PN} += "textrel dev-so dev-elf ldflags already-stripped staticdev rpaths arch useless-rpaths file-rdeps"
52
53FILES_SOLIBSDEV = ""
54BBCLASSEXTEND = "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 @@
1SUMMARY = "Intel® oneAPI DPC++/C++ Compiler"
2DESCRIPTION = "The Intel® oneAPI DPC++/C++ Compiler provides optimizations \
3that help your applications run faster on Intel® 64 architectures with support \
4for the latest C, C++, and SYCL language standards. This compiler produces \
5optimized code that can run significantly faster by taking advantage of the \
6ever-increasing core count and vector register width in Intel® Xeon® processors \
7and compatible processors."
8
9HOMEPAGE = "https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compiler.html"
10
11LICENSE="EULA"
12
13COMPILERMAINVER = "2024.0"
14
15LIC_FILES_CHKSUM = " \
16 file://opt/intel/oneapi/compiler/${COMPILERMAINVER}/share/doc/compiler/credist.txt;md5=b41f55af9f479b9570fc35b955d5ba1a \
17 "
18
19SRC_URI = " \
20 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-dpcpp-cpp-${COMPILERMAINVER}-${PV}_amd64.deb;subdir=${BPN};name=icx-compiler \
21 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-compiler-shared-${COMPILERMAINVER}-${PV}_amd64.deb;subdir=${BPN};name=compiler-linker \
22 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-compiler-shared-common-${COMPILERMAINVER}-${PV}_all.deb;subdir=${BPN};name=shared-common \
23 "
24
25SRC_URI[icx-compiler.sha256sum] = "0dcbac766d5a1519d4cf393f5a85e71d19024fef65f77638f3f849796b62cd82"
26SRC_URI[compiler-linker.sha256sum] = "e00faea6d797934d62143e4aa70b727ce30f80fdf30769d22122b3051140c236"
27SRC_URI[shared-common.sha256sum] = "cf490a4a790f349da79e618359598d3b32312ca3b2639e5d4c84e1cfa2745558"
28
29S = "${WORKDIR}/${BPN}"
30
31inherit bin_package
32
33RDEPENDS:${PN} += "intel-oneapi-dpcpp-cpp-runtime"
34SKIP_FILEDEPS:${PN} = '1'
35
36INHIBIT_PACKAGE_STRIP = "1"
37INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
38
39# doesn't have GNU_HASH (didn't pass LDFLAGS?)
40INSANE_SKIP:${PN} += "textrel dev-so dev-elf ldflags already-stripped file-rdeps staticdev rpaths arch useless-rpaths"
41
42FILES_SOLIBSDEV = ""
43
44EXCLUDE_FROM_SHLIBS = "1"
45BBCLASSEXTEND = "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 @@
1SUMMARY = "Collection of high-performance ray tracing kernels"
2DESCRIPTION = "A collection of high-performance ray tracing kernels \
3intended to graphics application engineers that want to improve the \
4performance of their application."
5HOMEPAGE = "https://github.com/embree/embree"
6
7LICENSE = "Apache-2.0 & syrah"
8LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57 \
9 file://third-party-programs.txt;md5=f989f5b74cfff0d45d3ccf0e1366cbdc \
10 file://common/math/transcendental.h;beginline=6;endline=8;md5=73380bb2ab6613b30b8464f114bd0ca8"
11
12inherit pkgconfig cmake
13
14S = "${WORKDIR}/git"
15
16SRC_URI = "git://github.com/embree/embree.git;protocol=https;branch=master"
17SRCREV = "daa8de0e714e18ad5e5c9841b67c1950d9c91c51"
18
19COMPATIBLE_HOST = '(x86_64).*-linux'
20COMPATIBLE_HOST:libc-musl = "null"
21
22DEPENDS = "tbb jpeg libpng glfw ispc-native"
23
24EXTRA_OECMAKE += " \
25 -DEMBREE_IGNORE_CMAKE_CXX_FLAGS=OFF \
26 -DEMBREE_MAX_ISA=DEFAULT \
27 -DEMBREE_TUTORIALS=OFF \
28 -DEMBREE_ISPC_SUPPORT=ON \
29 -DEMBREE_ZIP_MODE=OFF \
30 "
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 @@
1DESCRIPTION = "Intel® Integrated Performance Primitives are production-ready \
2 building blocks for cross-platform performance. Develop high-performance vision, \
3 signal, security, and storage applications with this multithreaded software library."
4HOMEPAGE = "https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/ipp.html"
5
6LICENSE = "ISSL"
7
8MAXVER = "2021.10"
9
10LIC_FILES_CHKSUM = " \
11 file://opt/intel/oneapi/ipp/${MAXVER}/share/doc/ipp/licensing/license.txt;md5=d7cdc92ed6c4de1263da879599ddc3e2 \
12 file://opt/intel/oneapi/ipp/${MAXVER}/share/doc/ipp/licensing/third-party-programs.txt;md5=22bd13987911dcf790907041b43081f3 \
13 "
14SRC_URI = " \
15 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-ipp-${MAXVER}-${PV}_amd64.deb;subdir=${BPN};name=ipp \
16 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-ipp-common-devel-${MAXVER}-${PV}_all.deb;subdir=${BPN};name=headers \
17 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-ipp-common-${MAXVER}-${PV}_all.deb;subdir=${BPN};name=env \
18 "
19
20SRC_URI[ipp.sha256sum] = "b51e45c6e691aa46c7136b0ab61f5abe346388433e017a30cf53fd23e92bea07"
21SRC_URI[headers.sha256sum] = "342f37ab2f82bc9f4498435f848ee660591c2488b44d988bf6ee96b2a71fd005"
22SRC_URI[env.sha256sum] = "731e8c28a3b8b757730cd874d0941de2eb744856128f24ade59d36c12b415bf6"
23
24S = "${WORKDIR}/${BPN}"
25
26COMPATIBLE_HOST:libc-musl = "null"
27
28inherit bin_package
29
30INHIBIT_PACKAGE_STRIP = "1"
31INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
32INHIBIT_DEFAULT_DEPS = ""
33
34RDEPENDS:${PN} += "tbb setup-intel-oneapi-env"
35INSANE_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 @@
1SUMMARY = "Intel® oneAPI Math Kernel Library (oneMKL)"
2DESCRIPTION = "The Intel® oneAPI Math Kernel Library (oneMKL) is a computing \
3 math library of highly optimized and extensively parallelized routines \
4 for applications that require maximum performance. oneMKL contains \
5 the high-performance optimizations from the full Intel® Math Kernel Library \
6 for CPU architectures (with C/Fortran programming language interfaces)\
7 and adds to them a set of DPC++ programming language interfaces for \
8 achieving performance on various CPU architectures \
9 and Intel Graphics Technology for certain key functionalities."
10HOMEPAGE = "https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html"
11
12LICENSE = "ISSL"
13
14MKLMAINVER = "2024.0"
15
16LIC_FILES_CHKSUM = " \
17 file://opt/intel/oneapi/mkl/${MKLMAINVER}/share/doc/mkl/licensing/license.txt;md5=8510d21bf355a76e378c3216c3929ccd \
18 file://opt/intel/oneapi/mkl/${MKLMAINVER}/share/doc/mkl/licensing/third-party-programs-benchmarks.txt;md5=cb98e1a1f14c05ea85a979ea8982e7a4 \
19 file://opt/intel/oneapi/mkl/${MKLMAINVER}/share/doc/mkl/licensing/third-party-programs-ipp.txt;md5=a4b2bf15e38f5c1267cdafed18bc0b09 \
20 file://opt/intel/oneapi/mkl/${MKLMAINVER}/share/doc/mkl/licensing/third-party-programs-openmp.txt;md5=6b3c1aa2a11393060074c0346ce21e49 \
21 file://opt/intel/oneapi/mkl/${MKLMAINVER}/share/doc/mkl/licensing/third-party-programs-safestring.txt;md5=c3aeee91c6d35a0f0753aed6c2633b82 \
22 file://opt/intel/oneapi/mkl/${MKLMAINVER}/share/doc/mkl/licensing/third-party-programs.txt;md5=27de873e4084d62530fe828406b33ca9 \
23 "
24
25SRC_URI = " \
26 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-mkl-${MKLMAINVER}-${PV}_amd64.deb;subdir=${BPN};name=runtime \
27 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-mkl-common-devel-${MKLMAINVER}-${PV}_all.deb;subdir=${BPN};name=common-devel \
28 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-mkl-devel-${MKLMAINVER}-${PV}_amd64.deb;subdir=${BPN};name=devel \
29 https://apt.repos.intel.com/oneapi/pool/main/intel-oneapi-mkl-common-${MKLMAINVER}-${PV}_all.deb;subdir=${BPN};name=common-vars \
30 "
31
32SRC_URI[runtime.sha256sum] = "10a86e24051d6ef4a80fd839c570e629190638a3c0ac9bcca99ab855f534b959"
33SRC_URI[common-devel.sha256sum] = "adbf0ea946f63946d29b7f9c750c38a42ea7a65d8c81655b268aa2c7bb908192"
34SRC_URI[devel.sha256sum] = "fab2a6f15e18bfd9b4d425f2703e4e98928c57f52c4feebc9ed886f097062e84"
35SRC_URI[common-vars.sha256sum] = "ec2b67813739fa4a2895f63479a41acba2174afe2d0cb8a0c1c9119d1317d8ef"
36
37S = "${WORKDIR}/${BPN}"
38
39inherit bin_package
40
41do_install:append () {
42 install -d ${D}${bindir}
43 (cd ${D}${bindir} ; ln -s ../../opt/intel/oneapi/mkl/${MKLMAINVER}/bin/* .)
44 install -d ${D}${libdir}
45 (cd ${D}${libdir} ; ln -s ../../opt/intel/oneapi/mkl/${MKLMAINVER}/lib/intel64/*.so* .)
46 (cd ${D}${libdir} ; ln -s ../../opt/intel/oneapi/mkl/${MKLMAINVER}/lib/intel64/*.a* .)
47 install -d ${D}${libdir}/pkgconfig
48 (cd ${D}${libdir}/pkgconfig ; ln -s ../../../opt/intel/oneapi/mkl/${MKLMAINVER}/lib/pkgconfig/* .)
49 install -d ${D}${libdir}/cmake
50 (cd ${D}${libdir}/cmake ; ln -s ../../../opt/intel/oneapi/mkl/${MKLMAINVER}/lib/cmake/* .)
51
52 install -d ${D}${includedir}
53 find ${D}/opt/intel/oneapi/mkl/${MKLMAINVER}/include/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read srcdir; do
54 install -d ${D}${includedir}/$srcdir
55 (cd ${D}${includedir} ; ln -s ../../opt/intel/oneapi/mkl/${MKLMAINVER}/include/$srcdir/* ./$srcdir/)
56 done
57
58 find ${D}/opt/intel/oneapi/mkl/${MKLMAINVER}/include/ -mindepth 1 -maxdepth 1 -type f -printf '%f\n' | while read srcfile; do
59 (cd ${D}${includedir} ; ln -s ../../opt/intel/oneapi/mkl/${MKLMAINVER}/include/$srcfile .)
60 done
61}
62
63AUTO_LIBNAME_PKGS = ""
64INHIBIT_PACKAGE_STRIP = "1"
65INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
66
67RDEPENDS:${PN} += "bash tbb intel-oneapi-dpcpp-cpp-runtime setup-intel-oneapi-env virtual-opencl-icd"
68INSANE_SKIP:${PN} = "ldflags textrel dev-so staticdev arch already-stripped"
69
70FILES:${PN}-staticdev += "/opt/intel/oneapi/mkl/${MKLMAINVER}/lib/*.a*"
71
72SKIP_FILEDEPS:${PN} = '1'
73
74SYSROOT_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 @@
1SUMMARY = "Intel® Open Image Denoise"
2DESCRIPTION = "Intel Open Image Denoise is an open source library of \
3high-performance, high-quality denoising filters for images \
4rendered with ray tracing. Intel Open Image Denoise is part \
5of the Intel® oneAPI Rendering Toolkit"
6HOMEPAGE = "https://www.openimagedenoise.org/"
7
8LICENSE = "Apache-2.0 & BSD-3-Clause"
9LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57 \
10 file://external/mkl-dnn/LICENSE;md5=b48e3de3bfd47c27882a0d85b20823f5 \
11 file://external/mkl-dnn/src/cpu/x64/xbyak/COPYRIGHT;md5=3b9bf048d063d54cdb28964db558bcc7 \
12 file://external/mkl-dnn/src/common/ittnotify/LICENSE.BSD;md5=e671ff178b24a95a382ba670503c66fb \
13 file://weights/LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57"
14
15SRC_URI = "https://github.com/OpenImageDenoise/${BPN}/releases/download/v${PV}/${BP}.src.tar.gz\
16 "
17SRC_URI[sha256sum] = "ce144ba582ff36563d9442ee07fa2a4d249bc85aa93e5b25fc527ff4ee755ed6"
18
19inherit cmake
20
21DEPENDS += "tbb ispc-native"
22
23UPSTREAM_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 @@
1SUMMARY = "Intel(R) Open Volume Kernel Library"
2DESCRIPTION = "Intel(R) Open Volume Kernel Library (Intel(R) Open VKL) is a \
3collection of high-performance volume computation kernels. The target users \
4of Open VKL are graphics application engineers who want to improve the \
5performance of their volume rendering applications by leveraging Open VKL’s \
6performance-optimized kernels, which include volume traversal and sampling \
7functionality for a variety of volumetric data formats. The kernels are optimized \
8for the latest Intel(R) processors with support for SSE, AVX, AVX2, and AVX-512 \
9instructions."
10HOMEPAGE = "https://www.openvkl.org/"
11
12LICENSE = "Apache-2.0 & BSD-3-Clause & MIT & Zlib"
13LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57 \
14 file://third-party-programs.txt;md5=69ec7caf49616c471161b921f53d5ec0 \
15 file://testing/external/half.hpp;beginline=1;endline=17;md5=4b60058493630c3bd0ef145470f04a7b"
16
17inherit pkgconfig cmake
18
19S = "${WORKDIR}/git"
20
21SRC_URI = "git://github.com/openvkl/openvkl.git;protocol=https;branch=master \
22 "
23SRCREV = "8c6ba526813b871a624cb9d73d4cbb689ac7f4ce"
24
25COMPATIBLE_HOST = '(x86_64).*-linux'
26COMPATIBLE_HOST:libc-musl = "null"
27
28DEPENDS = "ispc ispc-native rkcommon embree"
29
30EXTRA_OECMAKE += " \
31 -DISPC_EXECUTABLE=${STAGING_BINDIR_NATIVE}/ispc \
32 "
33EXTRA_OECMAKE:intel-corei7-64 += " \
34 -DOPENVKL_ISA_AVX=OFF \
35 -DOPENVKL_ISA_AVX2=OFF \
36 -DOPENVKL_ISA_AVX512SKX=OFF \
37 "
38
39PACKAGES =+ "${PN}-examples"
40FILES:${PN}-examples = "\
41 ${bindir} \
42 "
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 @@
1From 09e6b6615d9a16e9555eff9d569356e32bd26aa4 Mon Sep 17 00:00:00 2001
2From: benradel <86351445+benradel@users.noreply.github.com>
3Date: Wed, 23 Jun 2021 11:56:03 +0200
4Subject: [PATCH] Fix GCC11 Compile Error in benchmark_register.h
5
6Fix GCC11 compilation error due to missing header "limits" in benchmark_register.h
7
8Upstream-Status: Submitted [https://github.com/ospray/ospray/pull/484/files]
9Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
10---
11 apps/common/external/benchmark/src/benchmark_register.h | 1 +
12 1 file changed, 1 insertion(+)
13
14diff --git a/apps/common/external/benchmark/src/benchmark_register.h b/apps/common/external/benchmark/src/benchmark_register.h
15index 61377d742..8f1bb7795 100644
16--- a/apps/common/external/benchmark/src/benchmark_register.h
17+++ b/apps/common/external/benchmark/src/benchmark_register.h
18@@ -2,6 +2,7 @@
19 #define BENCHMARK_REGISTER_H
20
21 #include <vector>
22+#include <limits>
23
24 #include "check.h"
25
26--
272.32.0
28
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 @@
1SUMMARY = "Intel OSPray, Ray Tracing based Rendering Engine"
2DESCRIPTION = "Intel OSPRay is an open source, scalable, and portable ray \
3tracing engine for high-performance, high-fidelity visualization on \
4Intel Architecture CPUs."
5HOMEPAGE = "https://www.ospray.org/"
6
7LICENSE = "Apache-2.0 & BSD-3-Clause & MIT & Zlib"
8LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=1dece7821bf3fd70fe1309eaa37d52a2 \
9 file://third-party-programs.txt;md5=e37b77e3bd997abccc359c710fb1f1db \
10 "
11
12inherit pkgconfig cmake
13
14S = "${WORKDIR}/git"
15
16SRC_URI = "git://github.com/ospray/ospray.git;protocol=https;branch=master \
17 "
18SRCREV = "f2a61c2eb58ccd666e34abfdb0fd7049ea073194"
19
20COMPATIBLE_HOST = '(x86_64).*-linux'
21COMPATIBLE_HOST:libc-musl = "null"
22
23DEPENDS = "rkcommon ispc ispc-native openvkl embree"
24
25EXTRA_OECMAKE += " \
26 -DISPC_EXECUTABLE=${STAGING_BINDIR_NATIVE}/ispc \
27 -DOSPRAY_ENABLE_APPS_BENCHMARK=OFF \
28 -DOSPRAY_ENABLE_APPS_TESTING=OFF \
29 -DOSPRAY_ENABLE_APPS_EXAMPLES=OFF \
30 "
31
32PACKAGES =+ "${PN}-apps"
33FILES:${PN}-apps = "\
34 ${bindir} \
35 "
36
37UPSTREAM_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 @@
1SUMMARY = "rkcommon - C++/CMake infrastructure"
2DESCRIPTION = "A common set of C++ infrastructure and CMake utilities \
3used by various components of Intel® oneAPI Rendering Toolkit."
4HOMEPAGE = "https://github.com/ospray/rkcommon"
5
6LICENSE = "Apache-2.0"
7LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57"
8
9inherit pkgconfig cmake
10
11S = "${WORKDIR}/git"
12
13SRC_URI = "git://github.com/ospray/rkcommon.git;protocol=https;branch=master \
14 "
15SRCREV = "7ebfa0765ea590767202b328e7da38102c2f5a15"
16
17DEPENDS = "tbb"
18
19EXTRA_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 @@
1From ef56be8e6bf2ea273cbeb960f3131164e7b517b6 Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Wed, 18 May 2022 12:24:03 +0800
4Subject: [PATCH] CMakeLists: disable Werror
5
6gcc12 highlights minor warnings that cause the build to fail. Ignore
7those until they aren't fixed upstream.
8
9Upstream-Status: Inappropriate
10
11Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
12---
13 CMakeLists.txt | 4 ++--
14 1 file changed, 2 insertions(+), 2 deletions(-)
15
16diff --git a/CMakeLists.txt b/CMakeLists.txt
17index 418483f7..c019fea0 100644
18--- a/CMakeLists.txt
19+++ b/CMakeLists.txt
20@@ -146,7 +146,7 @@ else()
21 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -fno-strict-aliasing -D_FORTIFY_SOURCE=2")
22 if(LNX_BUILD)
23 #A few warnings yet to resolve under esx
24- set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Werror")
25+ #set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Werror")
26 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Werror")
27 endif()
28 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -ggdb")
29@@ -791,4 +791,4 @@ if(ESX_BUILD)
30 include(CMake/esx.cmake)
31 endif()
32
33-add_subdirectory(src/os/nvm_api_sample)
34\ No newline at end of file
35+add_subdirectory(src/os/nvm_api_sample)
36--
372.35.3
38
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 @@
1From cc0e412ad05574d22938586172c56863666eb2a5 Mon Sep 17 00:00:00 2001 1Subject: [PATCH] [PATCH]: ignore static asserts and null define for os and ut
2From: Nolan Hergert <nolan.hergert@intel.com> 2 builds
3Date: Mon, 5 Apr 2021 11:15:09 +0800 3Upstream-Status: Backport
4Subject: [PATCH] Ignore STATIC_ASSERT and NULL definition so we can compile in 4Signed-off-by: Teoh Suh Haw <suh.haw.teoh@intel.com>
5 OS
6
7Upstream-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]
8
9Signed-off-by: Nolan Hergert <nolan.hergert@intel.com>
10Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
11--- 5---
12 MdePkg/Include/Base.h | 13 ++++++++++++- 6 MdePkg/Include/Base.h | 12 ++++++++++++
13 1 file changed, 12 insertions(+), 1 deletion(-) 7 1 file changed, 12 insertions(+)
14 8
15diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h 9diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
16index 8e4271f6ea..c39511a064 100644 10index d209e6de28..6e61b8f3d3 100644
17--- a/MdePkg/Include/Base.h 11--- a/MdePkg/Include/Base.h
18+++ b/MdePkg/Include/Base.h 12+++ b/MdePkg/Include/Base.h
19@@ -318,7 +318,11 @@ struct _LIST_ENTRY { 13@@ -316,8 +316,12 @@ struct _LIST_ENTRY {
20 /// 14 #define NULL __null
21 /// NULL pointer (VOID *) 15 #endif
22 /// 16 #else
23+#ifndef OS_BUILD 17+#ifndef OS_BUILD
24+#ifndef UNIT_TEST_UEFI_BUILD 18+#ifndef UNIT_TEST_UEFI_BUILD
25 #define NULL ((VOID *) 0) 19 #define NULL ((VOID *) 0)
20 #endif
26+#endif 21+#endif
27+#endif 22+#endif
28 23
29 // 24 //
30 // Null character 25 // Null character
31@@ -809,7 +813,8 @@ typedef UINTN *BASE_LIST; 26@@ -779,6 +783,8 @@ typedef UINTN *BASE_LIST;
32 // Verify that ProcessorBind.h produced UEFI Data Types that are compliant with
33 // Section 2.3.1 of the UEFI 2.3 Specification. 27 // Section 2.3.1 of the UEFI 2.3 Specification.
34 // 28 //
35- 29
36+#ifndef OS_BUILD 30+#ifndef OS_BUILD
37+#ifndef UNIT_TEST_UEFI_BUILD 31+#ifndef UNIT_TEST_UEFI_BUILD
38 STATIC_ASSERT (sizeof (BOOLEAN) == 1, "sizeof (BOOLEAN) does not meet UEFI Specification Data Type requirements"); 32 STATIC_ASSERT (sizeof (BOOLEAN) == 1, "sizeof (BOOLEAN) does not meet UEFI Specification Data Type requirements");
39 STATIC_ASSERT (sizeof (INT8) == 1, "sizeof (INT8) does not meet UEFI Specification Data Type requirements"); 33 STATIC_ASSERT (sizeof (INT8) == 1, "sizeof (INT8) does not meet UEFI Specification Data Type requirements");
40 STATIC_ASSERT (sizeof (UINT8) == 1, "sizeof (UINT8) does not meet UEFI Specification Data Type requirements"); 34 STATIC_ASSERT (sizeof (UINT8) == 1, "sizeof (UINT8) does not meet UEFI Specification Data Type requirements");
41@@ -821,6 +826,8 @@ STATIC_ASSERT (sizeof (INT64) == 8, "sizeof (INT64) does not meet UEFI Specifi 35@@ -792,6 +798,8 @@ STATIC_ASSERT (sizeof (CHAR8) == 1, "sizeof (CHAR8) does not meet UEFI Specifi
42 STATIC_ASSERT (sizeof (UINT64) == 8, "sizeof (UINT64) does not meet UEFI Specification Data Type requirements");
43 STATIC_ASSERT (sizeof (CHAR8) == 1, "sizeof (CHAR8) does not meet UEFI Specification Data Type requirements");
44 STATIC_ASSERT (sizeof (CHAR16) == 2, "sizeof (CHAR16) does not meet UEFI Specification Data Type requirements"); 36 STATIC_ASSERT (sizeof (CHAR16) == 2, "sizeof (CHAR16) does not meet UEFI Specification Data Type requirements");
37 STATIC_ASSERT (sizeof (L'A') == 2, "sizeof (L'A') does not meet UEFI Specification Data Type requirements");
38 STATIC_ASSERT (sizeof (L"A") == 4, "sizeof (L\"A\") does not meet UEFI Specification Data Type requirements");
45+#endif 39+#endif
46+#endif 40+#endif
47 41
48 // 42 //
49 // The following three enum types are used to verify that the compiler 43 // The following three enum types are used to verify that the compiler
50@@ -841,9 +848,13 @@ typedef enum { 44@@ -812,9 +820,13 @@ typedef enum {
51 __VerifyUint32EnumValue = 0xffffffff 45 __VerifyUint32EnumValue = 0xffffffff
52 } __VERIFY_UINT32_ENUM_SIZE; 46 } __VERIFY_UINT32_ENUM_SIZE;
53 47
54+#ifndef OS_BUILD 48+#ifndef OS_BUILD
55+#ifndef UNIT_TEST_UEFI_BUILD 49+#ifndef UNIT_TEST_UEFI_BUILD
56 STATIC_ASSERT (sizeof (__VERIFY_UINT8_ENUM_SIZE) == 4, "Size of enum does not meet UEFI Specification Data Type requirements"); 50 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
58 STATIC_ASSERT (sizeof (__VERIFY_UINT32_ENUM_SIZE) == 4, "Size of enum does not meet UEFI Specification Data Type requirements"); 52 STATIC_ASSERT (sizeof (__VERIFY_UINT32_ENUM_SIZE) == 4, "Size of enum does not meet UEFI Specification Data Type requirements");
59+#endif 53+#endif
60+#endif 54+#endif
61 55
62 /** 56 /**
63 Macro that returns a pointer to the data structure that contains a specified field of 57 Macro that returns a pointer to the data structure that contains a specified field of
64-- 58--
652.17.1 592.37.3
66
diff --git a/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl_03.00.00.0302.bb b/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl_03.00.00.0485.bb
index 688ad108..c4743d1c 100644
--- a/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl_03.00.00.0302.bb
+++ b/dynamic-layers/openembedded-layer/recipes-support/ipmctl/ipmctl_03.00.00.0485.bb
@@ -13,27 +13,35 @@ BUGTRACKER = "https://github.com/intel/ipmctl/issues"
13 13
14LICENSE = "BSD-3-Clause | BSD-2-Clause" 14LICENSE = "BSD-3-Clause | BSD-2-Clause"
15LIC_FILES_CHKSUM = "file://LICENSE;md5=72b9da60da6219d612ce30b746a0fe71 \ 15LIC_FILES_CHKSUM = "file://LICENSE;md5=72b9da60da6219d612ce30b746a0fe71 \
16 file://../edk2/License.txt;md5=2b415520383f7964e96700ae12b4570a" 16 file://edk2/License.txt;md5=6123e5bf044a66db96c4ce88a36b2d08"
17 17
18SRC_URI = "git://github.com/intel/ipmctl.git;protocol=https;branch=development;name=ipmctl; \ 18SRC_URI = "git://github.com/intel/ipmctl.git;protocol=https;branch=master;name=ipmctl; \
19 git://github.com/tianocore/edk2.git;protocol=https;name=edk2;destsuffix=edk2; \ 19 git://github.com/tianocore/edk2.git;protocol=https;name=edk2;destsuffix=git/edk2;branch=master \
20 file://0001-Ignore-STATIC_ASSERT-and-NULL-definition-so-we-can-c.patch;patchdir=../edk2 \ 20 file://0001-Ignore-STATIC_ASSERTs-and-NULL-define-for-os-and-ut-builds.patch;patchdir=edk2 \
21 file://0001-CMakeLists-disable-Werror.patch \
21" 22"
22 23
23SRCREV_ipmctl = "4579c7ec127d6c678ce25136f928b66c7ba51097" 24SRCREV_ipmctl = "c75bd840ea7820c8f93a5488fcff75d08beedd51"
24#tag: edk2-stable202102 25#tag edk2-stable202302
25SRCREV_edk2 = "ef91b07388e1c0a50c604e5350eeda98428ccea6" 26SRCREV_edk2 = "f80f052277c88a67c55e107b550f504eeea947d3"
27SRCREV_FORMAT = "ipmctl_edk2"
26 28
27S = "${WORKDIR}/git" 29S = "${WORKDIR}/git"
28 30
29inherit cmake 31inherit cmake dos2unix
30 32
31DEPENDS = "ndctl" 33DEPENDS = "ndctl pkgconfig-native"
32 34
33EXTRA_OECMAKE = "-DRELEASE=ON" 35EXTRA_OECMAKE = "-DRELEASE=ON"
34 36
35do_configure_prepend() { 37do_configure:prepend() {
36 for dir in BaseTools MdeModulePkg MdePkg ShellPkg ; do 38 for dir in BaseTools MdeModulePkg MdePkg ShellPkg ; do
37 ln -sf ../edk2/${dir} ${S} 39 ln -sf edk2/${dir} ${S}
38 done 40 done
39} 41}
42
43do_install:append() {
44 # Remove /var/log/ipmctl as anything created in /var/log will not be
45 # available when tmpfs is mounted at /var/volatile/log.
46 rm -rf ${D}${localstatedir}/log
47}
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-CPU-Solving-the-build-failure-caused-by-setting-the-.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-CPU-Solving-the-build-failure-caused-by-setting-the-.patch
new file mode 100644
index 00000000..d1851406
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-CPU-Solving-the-build-failure-caused-by-setting-the-.patch
@@ -0,0 +1,43 @@
1From b8c3bae71e6d3417ade5cb537cb1785fd75a75c8 Mon Sep 17 00:00:00 2001
2From: Razvan Apetroaie <117895604+razvanapetroaie@users.noreply.github.com>
3Date: Tue, 20 Feb 2024 02:28:14 +0200
4Subject: [PATCH] [CPU] Solving the build failure caused by setting the
5 "ENABLE_OV_ONNX_FRONTEND" option to "OFF" (#22934)
6
7### Details:
8See the [ticket
9description](https://jira.devtools.intel.com/browse/CVS-132119). The
10solution was checked only on a local setup on Ubuntu, if there's a way
11to check that using the CI please let me know (or if you could run the
12job and paste the link in the comments I would be grateful).
13
14Disclaimer: I'm not a CPU plugin developer, so I can't tell for sure if
15this is the ideal fix and no side effects are introduced. Please take
16that into account when reviewing/merging.
17
18### Tickets:
19 - [CVS-132119](https://jira.devtools.intel.com/browse/CVS-132119)
20
21Upstream-Status: Backport [https://github.com/openvinotoolkit/openvino/commit/b8c3bae71e6d3417ade5cb537cb1785fd75a75c8]
22
23Signed-off-by: Yogesh Tyagi <yogesh.tyagi@intel.com>
24---
25 src/plugins/intel_cpu/tests/functional/CMakeLists.txt | 2 +-
26 1 file changed, 1 insertion(+), 1 deletion(-)
27
28diff --git a/src/plugins/intel_cpu/tests/functional/CMakeLists.txt b/src/plugins/intel_cpu/tests/functional/CMakeLists.txt
29index db5ae8d01c..6941cb528d 100644
30--- a/src/plugins/intel_cpu/tests/functional/CMakeLists.txt
31+++ b/src/plugins/intel_cpu/tests/functional/CMakeLists.txt
32@@ -16,7 +16,7 @@ set(LINK_LIBRARIES funcSharedTests cpuSpecificRtInfo openvino::snippets ov_snipp
33 if(ENABLE_OV_ONNX_FRONTEND)
34 list(APPEND DEFINES TEST_MODELS="${TEST_MODEL_ZOO}")
35 else()
36- set(EXCLUDED_SOURCE_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/extension ${CMAKE_CURRENT_SOURCE_DIR}/shared_tests_instances/onnx)
37+ set(EXCLUDED_SOURCE_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/custom/extension ${CMAKE_CURRENT_SOURCE_DIR}/shared_tests_instances/onnx)
38 endif()
39
40 if(NOT (ARM OR AARCH64))
41--
422.34.1
43
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-cmake-fix-build-when-using-sysroot.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-cmake-fix-build-when-using-sysroot.patch
new file mode 100644
index 00000000..d251f21b
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-cmake-fix-build-when-using-sysroot.patch
@@ -0,0 +1,32 @@
1From b5dfcf8bc1245e804c847745c237068eb6f19931 Mon Sep 17 00:00:00 2001
2From: Yogesh Tyagi <yogesh.tyagi@intel.com>
3Date: Fri, 15 Mar 2024 16:28:41 +0800
4Subject: [PATCH] cmake: fix build when using sysroot
5
6When cross-compiling against a sysroot, system headers will not be at a place
7that starts with /usr. Update conditional check to exclude directories
8which have "/usr/include" in them to not add <sysroot>/usr/include as well.
9
10Upstream-Status: Submitted [https://github.com/openvinotoolkit/openvino/pull/23486]
11
12Signed-off-by: Yogesh Tyagi <yogesh.tyagi@intel.com>
13---
14 src/cmake/ov_parallel.cmake | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/src/cmake/ov_parallel.cmake b/src/cmake/ov_parallel.cmake
18index 3793db98e30..819d3410531 100644
19--- a/src/cmake/ov_parallel.cmake
20+++ b/src/cmake/ov_parallel.cmake
21@@ -296,7 +296,7 @@ function(ov_set_threading_interface_for TARGET_NAME)
22 if(include_directories)
23 foreach(include_directory IN LISTS include_directories)
24 # cannot include /usr/include headers as SYSTEM
25- if(NOT "${include_directory}" MATCHES "^/usr.*$")
26+ if(NOT "${include_directory}" MATCHES ".*/usr/include.*$")
27 target_include_directories(${TARGET_NAME} SYSTEM
28 ${LINK_TYPE} $<BUILD_INTERFACE:${include_directory}>)
29 else()
30--
312.34.1
32
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..7ab31309
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-cmake-yocto-specific-tweaks-to-the-build-process.patch
@@ -0,0 +1,90 @@
1From bfcf5ae581ca4e7266cf7dc65b1c71754cd78cc0 Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Wed, 29 Nov 2023 12:42:57 +0530
4Subject: [PATCH 1/4] cmake: yocto specific tweaks to the build process
5
6* Dont try to detect glibc version as that doesn't work when cross compiling.
7* Install sample binaries as well.
8* Dont strip binaries.
9* Dont try to write triggers for CPack. We package ourselves.
10* Fix the installation path for Python modules when baselib = lib64.
11
12Upstream-Status: Inappropriate
13
14Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
15---
16 cmake/developer_package/packaging/rpm/rpm.cmake | 2 +-
17 cmake/developer_package/target_flags.cmake | 2 +-
18 samples/cpp/CMakeLists.txt | 6 +++---
19 src/bindings/python/CMakeLists.txt | 2 +-
20 src/bindings/python/wheel/setup.py | 1 -
21 5 files changed, 6 insertions(+), 7 deletions(-)
22
23diff --git a/cmake/developer_package/packaging/rpm/rpm.cmake b/cmake/developer_package/packaging/rpm/rpm.cmake
24index a7c0ec2cf61..40448e8a962 100644
25--- a/cmake/developer_package/packaging/rpm/rpm.cmake
26+++ b/cmake/developer_package/packaging/rpm/rpm.cmake
27@@ -154,7 +154,7 @@ ov_rpm_specific_settings()
28 # needed to add triggers for packages with libraries
29 set(def_triggers "${OpenVINO_BINARY_DIR}/_CPack_Packages/triggers")
30 set(triggers_content "# /bin/sh -p\n/sbin/ldconfig\n")
31-file(WRITE "${def_triggers}" "${triggers_content}")
32+#file(WRITE "${def_triggers}" "${triggers_content}")
33
34 #
35 # Functions helpful for packaging your modules with RPM cpack
36diff --git a/cmake/developer_package/target_flags.cmake b/cmake/developer_package/target_flags.cmake
37index 29f23e713e1..942dd445b19 100644
38--- a/cmake/developer_package/target_flags.cmake
39+++ b/cmake/developer_package/target_flags.cmake
40@@ -145,4 +145,4 @@ function(ov_glibc_version)
41 endif()
42 endfunction()
43
44-ov_glibc_version()
45+#ov_glibc_version()
46diff --git a/samples/cpp/CMakeLists.txt b/samples/cpp/CMakeLists.txt
47index c814cc37e2c..431e7bd2ed3 100644
48--- a/samples/cpp/CMakeLists.txt
49+++ b/samples/cpp/CMakeLists.txt
50@@ -206,9 +206,9 @@ macro(ov_add_sample)
51 target_link_libraries(${SAMPLE_NAME} PRIVATE ${ov_link_libraries} Threads::Threads ${SAMPLE_DEPENDENCIES})
52
53 install(TARGETS ${SAMPLE_NAME}
54- RUNTIME DESTINATION samples_bin/
55- COMPONENT samples_bin
56- EXCLUDE_FROM_ALL)
57+ DESTINATION ${CMAKE_INSTALL_BINDIR}
58+ COMPONENT samples_bin)
59+
60
61 # create global target with all samples / demo apps
62 if(NOT TARGET ov_samples)
63diff --git a/src/bindings/python/CMakeLists.txt b/src/bindings/python/CMakeLists.txt
64index 58ff9b74302..4763994ba56 100644
65--- a/src/bindings/python/CMakeLists.txt
66+++ b/src/bindings/python/CMakeLists.txt
67@@ -356,7 +356,7 @@ if(ENABLE_PYTHON_PACKAGING)
68 endif()
69
70 set(python_package_prefix "${CMAKE_CURRENT_BINARY_DIR}/install_${pyversion}")
71- set(install_lib "${python_package_prefix}/lib/${python_versioned_folder}/${ov_site_packages}")
72+ set(install_lib "${python_package_prefix}/${CMAKE_INSTALL_LIBDIR}/${python_versioned_folder}/${ov_site_packages}")
73 set(meta_info_subdir "openvino-${OpenVINO_VERSION}-py${python_xy}.egg-info")
74 set(meta_info_file "${install_lib}/${meta_info_subdir}/PKG-INFO")
75
76diff --git a/src/bindings/python/wheel/setup.py b/src/bindings/python/wheel/setup.py
77index 4b056912212..5f05d891310 100644
78--- a/src/bindings/python/wheel/setup.py
79+++ b/src/bindings/python/wheel/setup.py
80@@ -270,7 +270,6 @@ class CustomBuild(build):
81 self.spawn(["cmake", "--install", binary_dir,
82 "--prefix", prefix,
83 "--config", CONFIG,
84- "--strip",
85 "--component", cpack_comp_name])
86
87 def run(self):
88--
892.34.1
90
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 2a2c8b87..00000000
--- a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-dont-install-licenses-and-version-file.patch
+++ /dev/null
@@ -1,54 +0,0 @@
1From a60710c910e6c995aef9dd36757bf040bf24acf5 Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Tue, 9 Jun 2020 11:35:59 +0800
4Subject: [PATCH] don't install licenses and version
5
6Upstream-Status: Inappropriate
7
8Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
9---
10 ngraph/CMakeLists.txt | 6 ++----
11 ngraph/test/runtime/CMakeLists.txt | 2 ++
12 2 files changed, 4 insertions(+), 4 deletions(-)
13
14diff --git a/ngraph/CMakeLists.txt b/ngraph/CMakeLists.txt
15index 99f32a6181..b90aa382b9 100644
16--- a/ngraph/CMakeLists.txt
17+++ b/ngraph/CMakeLists.txt
18@@ -490,7 +490,7 @@ if (NGRAPH_EXPORT_TARGETS_ENABLE)
19 install(EXPORT ngraphTargets
20 FILE ngraphTargets.cmake
21 NAMESPACE ngraph::
22- DESTINATION ${NGRAPH_COMPONENT_PREFIX}cmake
23+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ngraph
24 COMPONENT ngraph)
25
26 configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/share/ngraphConfig.cmake.in
27@@ -503,7 +503,7 @@ if (NGRAPH_EXPORT_TARGETS_ENABLE)
28
29 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ngraphConfig.cmake
30 ${CMAKE_CURRENT_BINARY_DIR}/ngraphConfigVersion.cmake
31- DESTINATION ${NGRAPH_COMPONENT_PREFIX}cmake
32+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ngraph
33 COMPONENT ngraph)
34 endif()
35
36@@ -518,5 +518,3 @@ add_subdirectory(test)
37 if (NGRAPH_PYTHON_BUILD_ENABLE)
38 add_subdirectory(python)
39 endif()
40-
41-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/VERSION DESTINATION "${NGRAPH_COMPONENT_PREFIX}." COMPONENT ngraph)
42diff --git a/ngraph/test/runtime/CMakeLists.txt b/ngraph/test/runtime/CMakeLists.txt
43index d27ea8090c..17a3843f7d 100644
44--- a/ngraph/test/runtime/CMakeLists.txt
45+++ b/ngraph/test/runtime/CMakeLists.txt
46@@ -80,3 +80,5 @@ target_include_directories(ngraph_backend PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
47
48 add_subdirectory(interpreter)
49 add_subdirectory(ie)
50+
51+install(TARGETS ngraph_backend DESTINATION ${NGRAPH_INSTALL_LIB})
52--
532.29.2
54
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 1f64ce21..00000000
--- a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0001-inference-engine-use-system-installed-packages.patch
+++ /dev/null
@@ -1,172 +0,0 @@
1From a8b6a2e251c42a393218174c6737208760d2e1c1 Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Wed, 10 Jun 2020 09:43:55 +0800
4Subject: [PATCH] inference-engine: use system installed packages
5
6Use installed versions of ade, protobuf and tbb.
7
8Upstream-Status: Pending
9
10Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
11---
12 cmake/dependencies.cmake | 18 ------------------
13 inference-engine/CMakeLists.txt | 2 +-
14 inference-engine/cmake/ie_parallel.cmake | 7 +------
15 .../src/inference_engine/CMakeLists.txt | 19 -------------------
16 .../common_test_utils/CMakeLists.txt | 4 +---
17 .../unit_test_utils/CMakeLists.txt | 3 +--
18 inference-engine/thirdparty/CMakeLists.txt | 5 ++---
19 7 files changed, 6 insertions(+), 52 deletions(-)
20
21diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake
22index 6a44c8769e..a128eb63a1 100644
23--- a/cmake/dependencies.cmake
24+++ b/cmake/dependencies.cmake
25@@ -13,25 +13,7 @@ if(CMAKE_CROSSCOMPILING AND NGRAPH_ONNX_IMPORT_ENABLE)
26
27 set(protoc_version "3.7.1")
28 if(CMAKE_HOST_SYSTEM_NAME MATCHES Linux)
29- RESOLVE_DEPENDENCY(SYSTEM_PROTOC_ROOT
30- ARCHIVE_LIN "protoc-${protoc_version}-linux-x86_64.tar.gz"
31- TARGET_PATH "${TEMP}/protoc-${protoc_version}-linux-x86_64")
32- debug_message(STATUS "host protoc-${protoc_version} root path = " ${SYSTEM_PROTOC_ROOT})
33 else()
34 message(FATAL_ERROR "Unsupported host system (${CMAKE_HOST_SYSTEM_NAME}) and arch (${CMAKE_HOST_SYSTEM_PROCESSOR}) for cross-compilation")
35 endif()
36-
37- reset_deps_cache(SYSTEM_PROTOC)
38-
39- message("${SYSTEM_PROTOC_ROOT}/bin")
40- find_program(
41- SYSTEM_PROTOC
42- NAMES protoc
43- PATHS "${SYSTEM_PROTOC_ROOT}/bin"
44- NO_DEFAULT_PATH)
45- if(NOT SYSTEM_PROTOC)
46- message(FATAL_ERROR "[ONNX IMPORTER] Missing host protoc binary")
47- endif()
48-
49- update_deps_cache(SYSTEM_PROTOC "${SYSTEM_PROTOC}" "Path to host protoc for ONNX Importer")
50 endif()
51diff --git a/inference-engine/CMakeLists.txt b/inference-engine/CMakeLists.txt
52index a3e4f74c40..76b09683dd 100644
53--- a/inference-engine/CMakeLists.txt
54+++ b/inference-engine/CMakeLists.txt
55@@ -56,7 +56,7 @@ function(ie_developer_export)
56 APPEND FILE "${CMAKE_BINARY_DIR}/targets_developer.cmake")
57
58 # Custom target to build only Inference Engine Developer Package targets
59- add_custom_target(ie_dev_targets ALL DEPENDS ${OpenVINODeveloperPackageTargets} ${IEDeveloperPackageTargets} gflags
60+ add_custom_target(ie_dev_targets ALL DEPENDS ${OpenVINODeveloperPackageTargets} ${IEDeveloperPackageTargets}
61 inference_engine_ir_reader inference_engine_ir_v7_reader)
62 endfunction()
63
64diff --git a/inference-engine/cmake/ie_parallel.cmake b/inference-engine/cmake/ie_parallel.cmake
65index f8988aa105..28e79417f4 100644
66--- a/inference-engine/cmake/ie_parallel.cmake
67+++ b/inference-engine/cmake/ie_parallel.cmake
68@@ -67,13 +67,8 @@ function(set_ie_threading_interface_for TARGET_NAME)
69 set(IE_THREAD_DEFINE "IE_THREAD_SEQ")
70
71 if (THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
72- if (TBB_FOUND)
73 set(IE_THREAD_DEFINE "IE_THREAD_TBB")
74- ie_target_link_libraries(${TARGET_NAME} ${LINK_TYPE} ${TBB_IMPORTED_TARGETS})
75- else ()
76- ext_message(WARNING "TBB was not found by the configured TBB_DIR path.\
77- SEQ method will be used for ${TARGET_NAME}")
78- endif ()
79+ target_link_libraries(${TARGET_NAME} INTERFACE tbb tbbmalloc)
80 elseif (THREADING STREQUAL "OMP")
81 if (WIN32)
82 set(omp_lib_name libiomp5md)
83diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt
84index f012a038a2..3bba22215e 100644
85--- a/inference-engine/src/inference_engine/CMakeLists.txt
86+++ b/inference-engine/src/inference_engine/CMakeLists.txt
87@@ -216,25 +216,6 @@ list(APPEND core_components ngraph)
88 if((THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO") AND TBBROOT MATCHES ${TEMP})
89 ie_cpack_add_component(tbb REQUIRED)
90 list(APPEND core_components tbb)
91-
92- install(DIRECTORY "${TBB}/include"
93- DESTINATION ${IE_CPACK_IE_DIR}/external/tbb
94- COMPONENT tbb)
95- install(DIRECTORY "${TBB}/lib"
96- DESTINATION ${IE_CPACK_IE_DIR}/external/tbb
97- COMPONENT tbb)
98- if(EXISTS "${TBB}/bin")
99- install(DIRECTORY "${TBB}/bin"
100- DESTINATION ${IE_CPACK_IE_DIR}/external/tbb
101- COMPONENT tbb)
102- endif()
103- install(FILES "${TBB}/LICENSE"
104- DESTINATION ${IE_CPACK_IE_DIR}/external/tbb
105- COMPONENT tbb)
106- install(FILES "${TBB}/cmake/TBBConfig.cmake"
107- "${TBB}/cmake/TBBConfigVersion.cmake"
108- DESTINATION ${IE_CPACK_IE_DIR}/external/tbb/cmake
109- COMPONENT tbb)
110 endif()
111
112 ie_cpack_add_component(core REQUIRED DEPENDS ${core_components})
113diff --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
114index ca58264bd5..11df150845 100644
115--- a/inference-engine/tests/ie_test_utils/common_test_utils/CMakeLists.txt
116+++ b/inference-engine/tests/ie_test_utils/common_test_utils/CMakeLists.txt
117@@ -26,7 +26,7 @@ function(add_gtest_libraries)
118 PROPERTIES FOLDER thirdparty)
119 endfunction()
120
121-add_gtest_libraries()
122+#add_gtest_libraries()
123
124 if (MSVC)
125 set(PUGI pugixml_mt)
126@@ -37,8 +37,6 @@ endif ()
127 list(APPEND EXPORT_DEPENDENCIES
128 ${PUGI}
129 ${NGRAPH_LIBRARIES}
130- gtest
131- gtest_main
132 )
133
134 set(TARGET_NAME commonTestUtils)
135diff --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
136index 5413d13895..3f2803750f 100644
137--- a/inference-engine/tests/ie_test_utils/unit_test_utils/CMakeLists.txt
138+++ b/inference-engine/tests/ie_test_utils/unit_test_utils/CMakeLists.txt
139@@ -8,8 +8,7 @@ add_subdirectory(mocks/mock_engine)
140
141 list(APPEND EXPORT_DEPENDENCIES
142 commonTestUtils_s
143- inference_engine_s
144- gmock)
145+ inference_engine_s)
146
147 addIeTarget(
148 NAME ${TARGET_NAME}
149diff --git a/inference-engine/thirdparty/CMakeLists.txt b/inference-engine/thirdparty/CMakeLists.txt
150index fa2a4d02d8..67d3b7ad05 100644
151--- a/inference-engine/thirdparty/CMakeLists.txt
152+++ b/inference-engine/thirdparty/CMakeLists.txt
153@@ -62,14 +62,13 @@ else()
154 endif()
155
156 add_subdirectory(stb_lib)
157-add_subdirectory(ade)
158 add_subdirectory(fluid/modules/gapi)
159
160-set_target_properties(ade fluid stb_image PROPERTIES FOLDER thirdparty)
161+set_target_properties(fluid stb_image PROPERTIES FOLDER thirdparty)
162
163 # developer package
164
165-ie_developer_export_targets(ade fluid)
166+ie_developer_export_targets(fluid)
167
168 if (NOT USE_SYSTEM_PUGIXML)
169 set_target_properties(pugixml PROPERTIES FOLDER thirdparty)
170--
1712.29.2
172
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 @@
1From 65014a2703a6a3892fdebc86fe1c5a3a589dbf56 Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Wed, 10 Jun 2020 09:45:48 +0800
4Subject: [PATCH 2/5] cldNN: disable Werror
5
6Don't treat warnings as errors. This just leads to failures every time
7we upgrade the compiler.
8
9Upstream-Status: Inappropriate
10
11Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
12---
13 inference-engine/thirdparty/clDNN/CMakeLists.txt | 1 -
14 1 file changed, 1 deletion(-)
15
16diff --git a/inference-engine/thirdparty/clDNN/CMakeLists.txt b/inference-engine/thirdparty/clDNN/CMakeLists.txt
17index 4b444eca..8610b9b8 100644
18--- a/inference-engine/thirdparty/clDNN/CMakeLists.txt
19+++ b/inference-engine/thirdparty/clDNN/CMakeLists.txt
20@@ -770,7 +770,6 @@ foreach(__CLDNN_CompilerFlagName IN ITEMS "CMAKE_CXX_FLAGS" "CMAKE_C_FLAGS")
21 MultiProcessorCompilation
22 DeadCodeEliminate
23 ExtensionsEnabled
24- TreatWarnAsErrorEnabled
25 WarnLevel4
26 NoFastMath
27 StackProtector
28--
292.25.4
30
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0003-cmake-Fix-overloaded-virtual-error.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0003-cmake-Fix-overloaded-virtual-error.patch
new file mode 100644
index 00000000..e0967d55
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0003-cmake-Fix-overloaded-virtual-error.patch
@@ -0,0 +1,33 @@
1From 900eeeb2953095e651270c0f42ccd8b26fd7885c Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Wed, 29 Nov 2023 12:49:35 +0530
4Subject: [PATCH 3/4] cmake: Fix overloaded-virtual error
5
6* Remove -Werror for:
7|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=]
8| 129 | virtual JitDefinitions GetDefinitions() const = 0;
9| |
10
11Upstream-Status: Pending
12
13Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
14---
15 src/plugins/intel_gpu/CMakeLists.txt | 2 +-
16 1 file changed, 1 insertion(+), 1 deletion(-)
17
18diff --git a/src/plugins/intel_gpu/CMakeLists.txt b/src/plugins/intel_gpu/CMakeLists.txt
19index b0c66a435d6..a3037147cc2 100644
20--- a/src/plugins/intel_gpu/CMakeLists.txt
21+++ b/src/plugins/intel_gpu/CMakeLists.txt
22@@ -38,7 +38,7 @@ add_subdirectory(thirdparty)
23 include(thirdparty/cmake/rapidjson.cmake)
24
25 if(CMAKE_COMPILER_IS_GNUCXX)
26- ov_add_compiler_flags(-Werror)
27+ #ov_add_compiler_flags(-Werror)
28 endif()
29
30 add_subdirectory(src/runtime)
31--
322.34.1
33
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 52049eb0..00000000
--- a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0003-inference-engine-installation-fixes.patch
+++ /dev/null
@@ -1,223 +0,0 @@
1From cb9a755218ff033c8c42e9dc46a845310a3331fa Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Thu, 11 Jun 2020 14:24:04 +0800
4Subject: [PATCH] cmake installation fixes
5
6Make sure that libraries/samples/binaries are installed correctly.
7
8Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
9---
10 CMakeLists.txt | 14 --------------
11 cmake/developer_package.cmake | 10 ++++++----
12 .../samples/common/opencv_c_wraper/CMakeLists.txt | 2 ++
13 inference-engine/samples/CMakeLists.txt | 9 +++------
14 .../samples/common/format_reader/CMakeLists.txt | 2 ++
15 .../src/inference_engine/CMakeLists.txt | 4 ++--
16 .../src/vpu/myriad_plugin/CMakeLists.txt | 2 +-
17 inference-engine/tests/unit/cpu/CMakeLists.txt | 2 ++
18 .../tests/unit/inference_engine/CMakeLists.txt | 2 ++
19 inference-engine/tests/unit/vpu/CMakeLists.txt | 2 ++
20 inference-engine/tools/compile_tool/CMakeLists.txt | 2 +-
21 11 files changed, 23 insertions(+), 28 deletions(-)
22
23diff --git a/CMakeLists.txt b/CMakeLists.txt
24index 5c3585a3e9..2b8c99f862 100644
25--- a/CMakeLists.txt
26+++ b/CMakeLists.txt
27@@ -176,12 +176,8 @@ ie_shellcheck_process(DIRECTORY "${OpenVINO_MAIN_SOURCE_DIR}"
28
29 # install setupvars
30
31-ie_cpack_add_component(setupvars REQUIRED)
32
33 if(UNIX)
34- install(PROGRAMS scripts/setupvars/setupvars.sh
35- DESTINATION bin
36- COMPONENT setupvars)
37 elseif(WIN32)
38 install(PROGRAMS scripts/setupvars/setupvars.bat
39 DESTINATION bin
40@@ -191,22 +187,12 @@ endif()
41 # install install_dependencies
42
43 if(UNIX)
44- ie_cpack_add_component(install_dependencies REQUIRED)
45- install(DIRECTORY scripts/install_dependencies/
46- DESTINATION install_dependencies
47- COMPONENT install_dependencies)
48 endif()
49
50 # install files for demo
51
52-ie_cpack_add_component(demo_scripts REQUIRED DEPENDS core)
53
54 if(UNIX)
55- install(DIRECTORY scripts/demo/
56- DESTINATION deployment_tools/demo
57- COMPONENT demo_scripts
58- USE_SOURCE_PERMISSIONS
59- PATTERN *.bat EXCLUDE)
60 elseif(WIN32)
61 install(DIRECTORY scripts/demo/
62 DESTINATION deployment_tools/demo
63diff --git a/cmake/developer_package.cmake b/cmake/developer_package.cmake
64index cda7afd294..ec51636e96 100644
65--- a/cmake/developer_package.cmake
66+++ b/cmake/developer_package.cmake
67@@ -29,7 +29,9 @@ list(APPEND CMAKE_MODULE_PATH
68 include(CPackComponent)
69 unset(IE_CPACK_COMPONENTS_ALL CACHE)
70
71-set(IE_CPACK_IE_DIR deployment_tools/inference_engine)
72+if (NOT DEFINED IE_CPACK_IE_DIR)
73+ set(IE_CPACK_IE_DIR deployment_tools/inference_engine)
74+endif()
75
76 # Search packages for the host system instead of packages for the target system
77 # in case of cross compilation these macros should be defined by the toolchain file
78@@ -55,8 +57,8 @@ function(ie_cpack_set_library_dir)
79 set(IE_CPACK_RUNTIME_PATH ${IE_CPACK_IE_DIR}/bin/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} PARENT_SCOPE)
80 set(IE_CPACK_ARCHIVE_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} PARENT_SCOPE)
81 else()
82- set(IE_CPACK_LIBRARY_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER} PARENT_SCOPE)
83- set(IE_CPACK_RUNTIME_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER} PARENT_SCOPE)
84+ set(IE_CPACK_LIBRARY_PATH ${CMAKE_INSTALL_LIBDIR} PARENT_SCOPE)
85+ set(IE_CPACK_RUNTIME_PATH ${CMAKE_INSTALL_BINDIR} PARENT_SCOPE)
86 set(IE_CPACK_ARCHIVE_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER} PARENT_SCOPE)
87 endif()
88 endfunction()
89@@ -151,7 +153,7 @@ endif()
90
91 # allow to override default OUTPUT_ROOT root
92 if(NOT DEFINED OUTPUT_ROOT)
93- set(OUTPUT_ROOT ${OpenVINO_MAIN_SOURCE_DIR})
94+ set(OUTPUT_ROOT ${CMAKE_CURRENT_BINARY_DIR})
95 endif()
96
97 # Enable postfixes for Debug/Release builds
98diff --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
99index b8d5ddf622..d086478f6d 100644
100--- a/inference-engine/ie_bridges/c/samples/common/opencv_c_wraper/CMakeLists.txt
101+++ b/inference-engine/ie_bridges/c/samples/common/opencv_c_wraper/CMakeLists.txt
102@@ -29,3 +29,5 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER c_samples)
103 if(COMMAND add_cpplint_target)
104 add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})
105 endif()
106+
107+install(TARGETS ${TARGET_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
108diff --git a/inference-engine/samples/CMakeLists.txt b/inference-engine/samples/CMakeLists.txt
109index 236c17e6af..22f410d1fd 100644
110--- a/inference-engine/samples/CMakeLists.txt
111+++ b/inference-engine/samples/CMakeLists.txt
112@@ -34,7 +34,7 @@ endif()
113
114 if(IE_MAIN_SOURCE_DIR)
115 # in case if samples are built from IE repo
116- set(IE_MAIN_SAMPLES_DIR ${OpenVINO_MAIN_SOURCE_DIR})
117+ set(IE_MAIN_SAMPLES_DIR ${CMAKE_BINARY_DIR})
118 # hint for find_package(InferenceEngine in the samples folder)
119 set(InferenceEngine_DIR "${CMAKE_BINARY_DIR}")
120 # hint for find_package(ngraph in the samples folder)
121@@ -118,11 +118,6 @@ set (HAVE_INTTYPES_H 1)
122 set (INTTYPES_FORMAT C99)
123 set (BUILD_TESTING OFF)
124
125-if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gflags")
126- add_subdirectory(thirdparty/gflags)
127- set_target_properties(gflags_nothreads_static PROPERTIES FOLDER thirdparty)
128-endif()
129-
130 if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
131 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
132 endif()
133@@ -245,6 +240,8 @@ macro(ie_add_sample)
134 add_cpplint_target(${IE_SAMPLE_NAME}_cpplint FOR_TARGETS ${IE_SAMPLE_NAME}
135 CUSTOM_FILTERS ${custom_filters})
136 endif()
137+
138+ install(TARGETS ${IE_SAMPLE_NAME} DESTINATION bin)
139 endmacro()
140
141 # collect all samples subdirectories
142diff --git a/inference-engine/samples/common/format_reader/CMakeLists.txt b/inference-engine/samples/common/format_reader/CMakeLists.txt
143index 48dbed9f2b..76532fd047 100644
144--- a/inference-engine/samples/common/format_reader/CMakeLists.txt
145+++ b/inference-engine/samples/common/format_reader/CMakeLists.txt
146@@ -41,3 +41,5 @@ target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}"
147
148 set_target_properties(${TARGET_NAME} PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME}
149 FOLDER cpp_samples)
150+
151+install(TARGETS ${TARGET_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
152diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt
153index 3bba22215e..b6f6b7b203 100644
154--- a/inference-engine/src/inference_engine/CMakeLists.txt
155+++ b/inference-engine/src/inference_engine/CMakeLists.txt
156@@ -229,8 +229,8 @@ install(TARGETS ${TARGET_NAME}
157 install(FILES "${OpenVINO_BINARY_DIR}/share/ie_parallel.cmake"
158 "${OpenVINO_BINARY_DIR}/share/InferenceEngineConfig.cmake"
159 "${OpenVINO_BINARY_DIR}/share/InferenceEngineConfig-version.cmake"
160- DESTINATION ${IE_CPACK_IE_DIR}/share
161+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/InferenceEngine
162 COMPONENT core)
163 install(FILES $<TARGET_FILE_DIR:${TARGET_NAME}>/plugins.xml
164- DESTINATION ${IE_CPACK_RUNTIME_PATH}
165+ DESTINATION ${CMAKE_INSTALL_LIBDIR}
166 COMPONENT core)
167diff --git a/inference-engine/src/vpu/myriad_plugin/CMakeLists.txt b/inference-engine/src/vpu/myriad_plugin/CMakeLists.txt
168index 889f2e6e66..67de9c3a32 100644
169--- a/inference-engine/src/vpu/myriad_plugin/CMakeLists.txt
170+++ b/inference-engine/src/vpu/myriad_plugin/CMakeLists.txt
171@@ -50,5 +50,5 @@ set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_REL
172 # install
173
174 install(FILES ${IE_MAIN_SOURCE_DIR}/thirdparty/movidius/mvnc/src/97-myriad-usbboot.rules
175- DESTINATION ${IE_CPACK_IE_DIR}/external
176+ DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/udev/rules.d
177 COMPONENT myriad)
178diff --git a/inference-engine/tests/unit/cpu/CMakeLists.txt b/inference-engine/tests/unit/cpu/CMakeLists.txt
179index c9a92b4857..2b4fcc4d01 100644
180--- a/inference-engine/tests/unit/cpu/CMakeLists.txt
181+++ b/inference-engine/tests/unit/cpu/CMakeLists.txt
182@@ -25,3 +25,5 @@ addIeTargetTest(
183 ie_faster_build(${TARGET_NAME}
184 UNITY
185 )
186+
187+install(TARGETS ${TARGET_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
188diff --git a/inference-engine/tests/unit/inference_engine/CMakeLists.txt b/inference-engine/tests/unit/inference_engine/CMakeLists.txt
189index 76cc67cca1..04ff11cc05 100644
190--- a/inference-engine/tests/unit/inference_engine/CMakeLists.txt
191+++ b/inference-engine/tests/unit/inference_engine/CMakeLists.txt
192@@ -26,3 +26,5 @@ addIeTargetTest(
193 LABELS
194 IE
195 )
196+
197+install(TARGETS ${TARGET_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
198diff --git a/inference-engine/tests/unit/vpu/CMakeLists.txt b/inference-engine/tests/unit/vpu/CMakeLists.txt
199index 215562f2af..215ec9f4fb 100644
200--- a/inference-engine/tests/unit/vpu/CMakeLists.txt
201+++ b/inference-engine/tests/unit/vpu/CMakeLists.txt
202@@ -35,3 +35,5 @@ addIeTargetTest(
203 VPU
204 MYRIAD
205 )
206+
207+install(TARGETS ${TARGET_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
208diff --git a/inference-engine/tools/compile_tool/CMakeLists.txt b/inference-engine/tools/compile_tool/CMakeLists.txt
209index 58614d3ced..9dfa068e4d 100644
210--- a/inference-engine/tools/compile_tool/CMakeLists.txt
211+++ b/inference-engine/tools/compile_tool/CMakeLists.txt
212@@ -49,7 +49,7 @@ add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})
213 # install
214
215 install(TARGETS compile_tool
216- RUNTIME DESTINATION deployment_tools/tools/compile_tool
217+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
218 COMPONENT core)
219
220 install(FILES README.md
221--
2222.29.2
223
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0004-protobuf-allow-target-protoc-to-be-built.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0004-protobuf-allow-target-protoc-to-be-built.patch
new file mode 100644
index 00000000..59095133
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0004-protobuf-allow-target-protoc-to-be-built.patch
@@ -0,0 +1,45 @@
1From 3e288ed876c6bcb6aa3174e52446b479255ddf22 Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Wed, 29 Nov 2023 12:55:19 +0530
4Subject: [PATCH 4/4] protobuf: allow target protoc to be built
5
6We can run target binaries using a qemu wrapper so allow these to be
7built and run.
8
9Upstream-Status: Inappropriate
10
11Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
12---
13 cmake/developer_package/frontends/frontends.cmake | 2 +-
14 thirdparty/protobuf/CMakeLists.txt | 2 +-
15 2 files changed, 2 insertions(+), 2 deletions(-)
16
17diff --git a/cmake/developer_package/frontends/frontends.cmake b/cmake/developer_package/frontends/frontends.cmake
18index 49c5b881030..2a1ea8562bc 100644
19--- a/cmake/developer_package/frontends/frontends.cmake
20+++ b/cmake/developer_package/frontends/frontends.cmake
21@@ -143,7 +143,7 @@ macro(ov_add_frontend)
22 set(OUTPUT_PB_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${relative_path}/${FILE_WE}.pb.h)
23 add_custom_command(
24 OUTPUT "${OUTPUT_PB_SRC}" "${OUTPUT_PB_HEADER}"
25- COMMAND ${PROTOC_EXECUTABLE} ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} -I ${protofiles_root_dir} ${proto_file}
26+ COMMAND protoc ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} -I ${protofiles_root_dir} ${proto_file}
27 DEPENDS ${PROTOC_DEPENDENCY} ${proto_file}
28 COMMENT "Running C++ protocol buffer compiler (${PROTOC_EXECUTABLE}) on ${proto_file_relative}"
29 VERBATIM
30diff --git a/thirdparty/protobuf/CMakeLists.txt b/thirdparty/protobuf/CMakeLists.txt
31index 4b6d6da87f3..409e492a5b3 100644
32--- a/thirdparty/protobuf/CMakeLists.txt
33+++ b/thirdparty/protobuf/CMakeLists.txt
34@@ -28,7 +28,7 @@ set(ABSL_PROPAGATE_CXX_STD ON CACHE BOOL "Abseil protogate CXX standard to depen
35 if(CMAKE_CROSSCOMPILING OR
36 (APPLE AND (HOST_X86_64 AND AARCH64)) OR
37 (MSVC AND (HOST_X86_64 AND (AARCH64 OR ARM))))
38- set(protobuf_BUILD_PROTOC_BINARIES OFF CACHE BOOL "Build protoc binaries" FORCE)
39+ set(protobuf_BUILD_PROTOC_BINARIES ON CACHE BOOL "Build protoc binaries" FORCE)
40 else()
41 set(protobuf_BUILD_PROTOC_BINARIES ON CACHE BOOL "Build protoc binaries" FORCE)
42 endif()
43--
442.34.1
45
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0005-cldnn-fix-inclusion-of-headers.patch b/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0005-cldnn-fix-inclusion-of-headers.patch
deleted file mode 100644
index d4819077..00000000
--- a/dynamic-layers/openembedded-layer/recipes-support/opencv/files/0005-cldnn-fix-inclusion-of-headers.patch
+++ /dev/null
@@ -1,53 +0,0 @@
1From aa515686548d74a68456b9ba7a295b6ae4be343a Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Wed, 10 Jun 2020 09:50:19 +0800
4Subject: [PATCH] cldnn: fix inclusion of headers
5
6Upstream-Status: Inappropriate
7
8Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
9
10---
11 inference-engine/include/gpu/gpu_ocl_wrapper.hpp | 2 +-
12 inference-engine/src/cldnn_engine/CMakeLists.txt | 1 +
13 .../thirdparty/clDNN/common/khronos_ocl_clhpp/cl2_ext.hpp | 2 +-
14 3 files changed, 3 insertions(+), 2 deletions(-)
15
16diff --git a/inference-engine/include/gpu/gpu_ocl_wrapper.hpp b/inference-engine/include/gpu/gpu_ocl_wrapper.hpp
17index 68ccf3217..c5b0ce6be 100644
18--- a/inference-engine/include/gpu/gpu_ocl_wrapper.hpp
19+++ b/inference-engine/include/gpu/gpu_ocl_wrapper.hpp
20@@ -39,7 +39,7 @@
21 # pragma GCC system_header
22 #endif
23
24-#include <CL/cl2.hpp>
25+#include <cl2.hpp>
26
27 #ifdef __GNUC__
28 # pragma GCC diagnostic pop
29diff --git a/inference-engine/src/cldnn_engine/CMakeLists.txt b/inference-engine/src/cldnn_engine/CMakeLists.txt
30index 7e15abbed..46d43e0e5 100644
31--- a/inference-engine/src/cldnn_engine/CMakeLists.txt
32+++ b/inference-engine/src/cldnn_engine/CMakeLists.txt
33@@ -31,6 +31,7 @@ target_include_directories(${TARGET_NAME} PRIVATE
34 ${CMAKE_CURRENT_SOURCE_DIR}
35 $<TARGET_PROPERTY:inference_engine_transformations,INTERFACE_INCLUDE_DIRECTORIES>
36 ${CLDNN__IOCL_ICD_INCDIRS}
37+ ${CLDNN_TOP_FOLDER}/common/khronos_ocl_clhpp
38 ${CLDNN_TOP_FOLDER})
39
40 set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
41diff --git a/inference-engine/thirdparty/clDNN/common/khronos_ocl_clhpp/cl2_ext.hpp b/inference-engine/thirdparty/clDNN/common/khronos_ocl_clhpp/cl2_ext.hpp
42index 97608c30a..3a04096c0 100644
43--- a/inference-engine/thirdparty/clDNN/common/khronos_ocl_clhpp/cl2_ext.hpp
44+++ b/inference-engine/thirdparty/clDNN/common/khronos_ocl_clhpp/cl2_ext.hpp
45@@ -29,7 +29,7 @@ typedef cl_d3d11_device_set_khr cl_device_set_intel;
46 typedef cl_va_api_device_source_intel cl_device_source_intel;
47 typedef cl_va_api_device_set_intel cl_device_set_intel;
48 #endif
49-#include <CL/cl_intel_planar_yuv.h>
50+#include <CL/cl_ext_intel.h>
51 #include "cl_intel_usm_defs.h"
52
53 #include <memory>
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 864c735e..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 @@
1From 56078933a8397b7fae146156743408319eac1ae0 Mon Sep 17 00:00:00 2001 1From 804b08023b3f8e72b8e3eb09e464d6775c11d966 Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com> 2From: Naveen Saini <naveen.kumar.saini@intel.com>
3Date: Mon, 19 Oct 2020 23:29:23 +0800 3Date: Fri, 21 Oct 2022 11:38:23 +0800
4Subject: [PATCH] demos: use gflags from meta-oe 4Subject: [PATCH] demos: use gflags from meta-oe
5 5
6Upstream-Status: Inappropriate 6Upstream-Status: Inappropriate
7 7
8Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> 8Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
9Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
10
9--- 11---
10 demos/CMakeLists.txt | 4 ++-- 12 demos/CMakeLists.txt | 2 +-
11 1 file changed, 2 insertions(+), 2 deletions(-) 13 1 file changed, 1 insertion(+), 1 deletion(-)
12 14
13diff --git a/demos/CMakeLists.txt b/demos/CMakeLists.txt 15diff --git a/demos/CMakeLists.txt b/demos/CMakeLists.txt
14index e5f17231..08d4e4e6 100644 16index 51767051c..fb7e3d22f 100644
15--- a/demos/CMakeLists.txt 17--- a/demos/CMakeLists.txt
16+++ b/demos/CMakeLists.txt 18+++ b/demos/CMakeLists.txt
17@@ -90,11 +90,11 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) 19@@ -141,7 +141,7 @@ endmacro()
18 endif() 20 find_package(OpenCV REQUIRED COMPONENTS core highgui videoio imgproc imgcodecs)
19 #################################### 21 find_package(OpenVINO REQUIRED COMPONENTS Runtime)
20
21-set (GFLAGS_IS_SUBPROJECT TRUE)
22+set (GFLAGS_IS_SUBPROJECT FALSE)
23 set (HAVE_SYS_STAT_H 1)
24 set (HAVE_INTTYPES_H 1)
25 22
26-add_subdirectory(thirdparty/gflags) 23-add_subdirectory(thirdparty/gflags)
27+#add_subdirectory(thirdparty/gflags) 24+#add_subdirectory(thirdparty/gflags)
25 add_subdirectory(common/cpp)
28 26
29 if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) 27 find_package(OpenCV QUIET COMPONENTS gapi)
30 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
31--
322.26.2
33
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo_2021.2.bb b/dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo_2021.2.bb
deleted file mode 100644
index 6784d0d8..00000000
--- a/dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo_2021.2.bb
+++ /dev/null
@@ -1,63 +0,0 @@
1SUMMARY = "OpenVINO(TM) Toolkit - Open Model Zoo repository"
2HOMEPAGE = "https://github.com/opencv/open_model_zoo"
3DESCRIPTION = "This repository includes optimized deep learning \
4models and a set of demos to expedite development of high-performance \
5deep learning inference applications."
6
7SRC_URI = "git://github.com/opencv/open_model_zoo.git;protocol=git;branch=master \
8 file://0001-use-oe-gflags.patch;striplevel=2 \
9 "
10
11SRCREV = "338630987b403a6981d03ab6d04c2d5ad367793a"
12
13LICENSE = "Apache-2.0"
14LIC_FILES_CHKSUM = "file://../LICENSE;md5=86d3f3a95c324c9479bd8986968f4327 \
15"
16
17inherit cmake
18
19S = "${WORKDIR}/git/demos"
20
21DEPENDS += "openvino-inference-engine opencv gflags"
22
23RDEPENDS_${PN} += " \
24 python3-decorator \
25 python3-defusedxml \
26 python3-networkx \
27 python3-protobuf \
28 python3-test-generator \
29 python3-requests \
30 python3-pyyaml \
31"
32
33COMPATIBLE_HOST = '(x86_64).*-linux'
34
35EXTRA_OECMAKE += " \
36 -DIE_MAIN_SOURCE_DIR=${B} \
37 -DENABLE_SAMPLES=ON \
38 -DIE_INCLUDE_DIR=${STAGING_EXECPREFIXDIR} \
39 -DIE_RELEASE_LIBRARY=${STAGING_LIBDIR}/libinference_engine.so \
40 -DIE_C_API_RELEASE_LIBRARY=${STAGING_LIBDIR}/libinference_engine_c_api.so \
41 -DIE_LEGACY_RELEASE_LIBRARY=${STAGING_LIBDIR}/libinference_engine_legacy.so \
42 -DIE_NN_BUILDER_RELEASE_LIBRARY=${STAGING_LIBDIR}/libinference_engine_nn_builder.so \
43 -DIE_ROOT_DIR=${WORKDIR}/InferenceEngine \
44"
45
46do_configure_prepend(){
47 mkdir -p ${WORKDIR}/InferenceEngine/share
48 cp ${STAGING_LIBDIR}/cmake/InferenceEngine/* ${WORKDIR}/InferenceEngine/share/
49}
50
51do_install(){
52 install -d ${D}${libdir}
53 install -d ${D}${bindir}
54 install -d ${D}${datadir}/openvino/open-model-zoo/tools
55 install -d ${D}${datadir}/openvino/open-model-zoo/demos/python_demos
56 cp -rf ${WORKDIR}/build/intel64/Release/lib/*.a ${D}${libdir}
57 cp -rf ${WORKDIR}/build/intel64/Release/*_demo* ${D}${bindir}
58 cp -rf ${WORKDIR}/git/models ${D}${datadir}/openvino/open-model-zoo
59 cp -rf ${WORKDIR}/git/tools/downloader ${D}${datadir}/openvino/open-model-zoo/tools
60 cp -rf ${WORKDIR}/git/demos/python_demos ${D}${datadir}/openvino/open-model-zoo/demos
61}
62
63FILES_${PN} += "${datadir}/openvino"
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo_2024.0.0.bb b/dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo_2024.0.0.bb
new file mode 100644
index 00000000..495a4786
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/open-model-zoo_2024.0.0.bb
@@ -0,0 +1,54 @@
1SUMMARY = "OpenVINO(TM) Toolkit - Open Model Zoo repository"
2HOMEPAGE = "https://github.com/opencv/open_model_zoo"
3DESCRIPTION = "This repository includes optimized deep learning \
4models and a set of demos to expedite development of high-performance \
5deep learning inference applications."
6
7SRC_URI = "git://github.com/opencv/open_model_zoo.git;protocol=https;branch=master \
8 file://0001-use-oe-gflags.patch \
9 "
10
11SRCREV = "37f60eb7fe1dcdedc552b2fb184d646723ed5e80"
12
13LICENSE = "Apache-2.0"
14LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327 \
15"
16
17inherit cmake
18
19S = "${WORKDIR}/git"
20OECMAKE_SOURCEPATH = "${S}/demos"
21
22DEPENDS += "openvino-inference-engine opencv gflags"
23
24RDEPENDS:${PN} += " \
25 python3-decorator \
26 python3-defusedxml \
27 python3-networkx \
28 python3-protobuf \
29 python3-requests \
30 python3-pyyaml \
31 python3-numpy \
32 bash \
33"
34
35COMPATIBLE_HOST = '(x86_64).*-linux'
36COMPATIBLE_HOST:libc-musl = "null"
37
38EXTRA_OECMAKE += " \
39 -DENABLE_SAMPLES=ON \
40 "
41
42do_install(){
43 install -d ${D}${libdir}
44 install -d ${D}${bindir}
45 install -d ${D}${datadir}/openvino/open-model-zoo/tools
46 install -d ${D}${datadir}/openvino/open-model-zoo/demos
47 cp -rf ${WORKDIR}/build/intel64/Release/*.a ${D}${libdir}
48 cp -rf ${WORKDIR}/build/intel64/Release/*_demo* ${D}${bindir}
49 cp -rf ${WORKDIR}/git/models ${D}${datadir}/openvino/open-model-zoo
50 cp -rf ${WORKDIR}/git/demos ${D}${datadir}/openvino/open-model-zoo
51 cp -rf ${WORKDIR}/git/tools/model_tools ${D}${datadir}/openvino/open-model-zoo/tools
52}
53
54FILES:${PN} += "${datadir}/openvino"
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/openvino-inference-engine_2021.2.bb b/dynamic-layers/openembedded-layer/recipes-support/opencv/openvino-inference-engine_2021.2.bb
deleted file mode 100644
index 22194467..00000000
--- a/dynamic-layers/openembedded-layer/recipes-support/opencv/openvino-inference-engine_2021.2.bb
+++ /dev/null
@@ -1,123 +0,0 @@
1SUMMARY = "OpenVINO(TM) Toolkit - Deep Learning Deployment Toolkit"
2HOMEPAGE = "https://github.com/opencv/dldt"
3DESCRIPTION = "This toolkit allows developers to deploy pre-trained \
4deep learning models through a high-level C++ Inference Engine API \
5integrated with application logic."
6
7SRC_URI = "git://github.com/openvinotoolkit/openvino.git;protocol=git;branch=releases/2021/2;lfs=0 \
8 https://download.01.org/opencv/master/openvinotoolkit/thirdparty/unified/VPU/usb-ma2x8x/firmware_usb-ma2x8x_1522.zip;name=usb_ma2x8x \
9 https://download.01.org/opencv/master/openvinotoolkit/thirdparty/unified/VPU/pcie-ma2x8x/firmware_pcie-ma2x8x_1522.zip;name=pcie_ma2x8x \
10 git://github.com/openvinotoolkit/oneDNN.git;protocol=https;destsuffix=git/inference-engine/thirdparty/mkl-dnn;name=mkl;nobranch=1 \
11 file://0001-inference-engine-use-system-installed-packages.patch \
12 file://0002-cldNN-disable-Werror.patch \
13 file://0003-inference-engine-installation-fixes.patch \
14 file://0005-cldnn-fix-inclusion-of-headers.patch \
15 file://0001-dont-install-licenses-and-version-file.patch \
16 "
17
18SRCREV = "4795391b73381660b69b4cd3986c7a0bf902e868"
19SRCREV_mkl = "5ef085d5af65e8966e03cdfcbaa65761d61a5c9a"
20
21SRC_URI[usb_ma2x8x.sha256sum] = "95a93144f0bbfe6e35d3830e93e6b63e1e109f849a6a7c307cae9030e3a662aa"
22SRC_URI[pcie_ma2x8x.sha256sum] = "6d061d21d90f1919ef375138066ba7a20ceb663901d2729d9cb1b639169df5da"
23
24LICENSE = "Apache-2.0 & ISSL & MIT"
25LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327 \
26 file://inference-engine/thirdparty/mkl-dnn/LICENSE;md5=afa44a3d001cc203032135324f9636b7 \
27 file://inference-engine/thirdparty/mkl-dnn/src/cpu/xbyak/COPYRIGHT;md5=03532861dad9003cc2c17f14fc7a4efa \
28 file://inference-engine/thirdparty/clDNN/common/khronos_ocl_clhpp/LICENSE.txt;md5=88b295a48d2b3244ba65d3c055472c8a \
29"
30LICENSE_${PN}-vpu-firmware = "ISSL"
31
32inherit cmake python3native
33
34S = "${WORKDIR}/git"
35
36EXTRA_OECMAKE += " \
37 -DENABLE_OPENCV=0 \
38 -DENABLE_PLUGIN_RPATH=0 \
39 -DENABLE_GNA=0 \
40 -DPYTHON_EXECUTABLE=${PYTHON} \
41 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
42 -DTHREADING=TBB -DTBB_DIR=${STAGING_LIBDIR} \
43 -DENABLE_SAMPLES=1 \
44 -DIE_CPACK_IE_DIR=${prefix} \
45 -DNGRAPH_UNIT_TEST_ENABLE=FALSE \
46 -DNGRAPH_TEST_UTIL_ENABLE=FALSE \
47 -DNGRAPH_ONNX_IMPORT_ENABLE=OFF \
48 -DNGRAPH_JSON_ENABLE=FALSE \
49 -DTREAT_WARNING_AS_ERROR=FALSE \
50 -DENABLE_SPEECH_DEMO=FALSE \
51 -DENABLE_DATA=FALSE \
52 -DUSE_SYSTEM_PUGIXML=TRUE \
53 "
54
55DEPENDS += "libusb1 \
56 ade \
57 opencv \
58 pugixml \
59 protobuf-native \
60 tbb \
61 onednn \
62 "
63
64COMPATIBLE_HOST = '(x86_64).*-linux'
65COMPATIBLE_HOST_libc-musl = "null"
66
67PACKAGECONFIG ?= "vpu opencl"
68PACKAGECONFIG[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"
69PACKAGECONFIG[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"
70PACKAGECONFIG[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"
71PACKAGECONFIG[verbose] = "-DVERBOSE_BUILD=1,-DVERBOSE_BUILD=0"
72
73do_install_append() {
74 if ${@bb.utils.contains('PACKAGECONFIG', 'vpu', 'true', 'false', d)}; then
75 install -m0644 ${WORKDIR}/mvnc/usb-ma2x8x.mvcmd ${D}${libdir}/
76 install -m0644 ${WORKDIR}/mvnc/pcie-ma2x8x.mvcmd ${D}${libdir}/
77 fi
78
79 if ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'true', 'false', d)}; then
80 install -d ${D}${datadir}/inference_engine
81 mv ${D}/usr/samples/python ${D}${datadir}/inference_engine/
82
83 install -d ${D}${PYTHON_SITEPACKAGES_DIR}
84 mv ${D}${prefix}/python/${PYTHON_DIR}/openvino ${D}${PYTHON_SITEPACKAGES_DIR}/
85 mv ${D}${prefix}/deployment_tools/tools/benchmark_tool ${D}${PYTHON_SITEPACKAGES_DIR}/openvino/
86 mv ${D}${prefix}/deployment_tools/tools/cross_check_tool ${D}${PYTHON_SITEPACKAGES_DIR}/openvino/
87
88 rm -rf ${D}${prefix}/python
89 fi
90
91 rm -rf ${D}${prefix}/deployment_tools
92
93 # Remove the samples source directory. We install the built samples.
94 rm -rf ${D}/usr/samples
95}
96
97# Otherwise e.g. ros-openvino-toolkit-dynamic-vino-sample when using dldt-inference-engine uses dldt-inference-engine WORKDIR
98# instead of RSS
99SSTATE_SCAN_FILES_append = " *.cmake"
100
101FILES_${PN}-dev = "${includedir} \
102 ${libdir}/cmake \
103 "
104
105FILES_${PN} += "${libdir}/lib*${SOLIBSDEV} \
106 ${datadir}/openvino \
107 ${libdir}/custom_kernels \
108 ${libdir}/plugins.xml \
109 ${libdir}/cache.json \
110 "
111
112# Move inference engine samples into a separate package
113PACKAGES =+ "${PN}-samples ${PN}-vpu-firmware"
114
115FILES_${PN}-samples = "${datadir}/inference_engine \
116 ${bindir} \
117 "
118FILES_${PN}-vpu-firmware += "${libdir}/*.mvcmd"
119
120# Package for inference engine python API
121PACKAGES =+ "${PN}-${PYTHON_PN}"
122
123FILES_${PN}-${PYTHON_PN} = "${PYTHON_SITEPACKAGES_DIR}/openvino"
diff --git a/dynamic-layers/openembedded-layer/recipes-support/opencv/openvino-inference-engine_2024.0.0.bb b/dynamic-layers/openembedded-layer/recipes-support/opencv/openvino-inference-engine_2024.0.0.bb
new file mode 100644
index 00000000..94edd1b8
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-support/opencv/openvino-inference-engine_2024.0.0.bb
@@ -0,0 +1,143 @@
1SUMMARY = "OpenVINO(TM) Toolkit - Deep Learning Deployment Toolkit"
2HOMEPAGE = "https://github.com/opencv/dldt"
3DESCRIPTION = "This toolkit allows developers to deploy pre-trained \
4deep learning models through a high-level C++ Inference Engine API \
5integrated with application logic."
6
7SRC_URI = "git://github.com/openvinotoolkit/openvino.git;protocol=https;name=openvino;branch=releases/2024/0;lfs=0 \
8 git://github.com/openvinotoolkit/oneDNN.git;protocol=https;destsuffix=git/src/plugins/intel_cpu/thirdparty/onednn;name=mkl;nobranch=1 \
9 git://github.com/oneapi-src/oneDNN.git;protocol=https;destsuffix=git/src/plugins/intel_gpu/thirdparty/onednn_gpu;name=onednn;nobranch=1 \
10 git://github.com/herumi/xbyak.git;protocol=https;destsuffix=git/thirdparty/xbyak;name=xbyak;branch=master \
11 git://github.com/nlohmann/json.git;protocol=https;destsuffix=git/thirdparty/json/nlohmann_json;name=json;branch=develop \
12 git://github.com/opencv/ade.git;protocol=https;destsuffix=git/thirdparty/ade;name=ade;nobranch=1 \
13 git://github.com/protocolbuffers/protobuf.git;protocol=https;destsuffix=git/thirdparty/protobuf/protobuf;name=protobuf;branch=3.20.x \
14 git://github.com/gflags/gflags.git;protocol=https;destsuffix=git/thirdparty/gflags/gflags;name=gflags;nobranch=1 \
15 git://github.com/madler/zlib.git;protocol=https;destsuffix=git/thirdparty/zlib/zlib;name=zlib;nobranch=1 \
16 git://github.com/openvinotoolkit/mlas.git;protocol=https;destsuffix=git/src/plugins/intel_cpu/thirdparty/mlas;name=mlas;nobranch=1 \
17 git://github.com/nodejs/node-api-headers.git;protocol=https;destsuffix=git/node-api-headers-src;name=node-api-headers;nobranch=1 \
18 git://github.com/nodejs/node-addon-api.git;protocol=https;destsuffix=git/node-addon-api-src;name=node-addon-api;nobranch=1 \
19 file://0001-cmake-yocto-specific-tweaks-to-the-build-process.patch \
20 file://0003-cmake-Fix-overloaded-virtual-error.patch \
21 file://0004-protobuf-allow-target-protoc-to-be-built.patch \
22 file://0001-cmake-fix-build-when-using-sysroot.patch \
23 file://0001-CPU-Solving-the-build-failure-caused-by-setting-the-.patch \
24 "
25
26SRCREV_openvino = "34caeefd07800b59065345d651949efbe8ab6649"
27SRCREV_mkl = "f82148befdbdc9576ec721c9d500155ee4de8060"
28SRCREV_onednn = "494af5f9921bdae98f1a0e2955fa7d76ff386c4f"
29SRCREV_xbyak = "740dff2e866f3ae1a70dd42d6e8836847ed95cc2"
30SRCREV_json = "9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03"
31SRCREV_ade = "0e8a2ccdd34f29dba55894f5f3c5179809888b9e"
32SRCREV_protobuf = "fe271ab76f2ad2b2b28c10443865d2af21e27e0e"
33SRCREV_gflags = "e171aa2d15ed9eb17054558e0b3a6a413bb01067"
34SRCREV_zlib = "09155eaa2f9270dc4ed1fa13e2b4b2613e6e4851"
35SRCREV_mlas = "d1bc25ec4660cddd87804fcf03b2411b5dfb2e94"
36SRCREV_node-api-headers = "186e04b5e40e54d7fd1655bc67081cc483f12488"
37SRCREV_node-addon-api = "39a25bf27788ff7a7ea5c64978c4dcd1e7b9d80d"
38SRCREV_FORMAT = "openvino_mkl_onednn_xbyak_json_ade_protobuf_gflags_zlib_node-api-headers_node-addon-api_mlas"
39
40LICENSE = "Apache-2.0 & MIT & BSD-3-Clause & Zlib"
41LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327 \
42 file://thirdparty/xbyak/COPYRIGHT;md5=3c98edfaa50a86eeaef4c6109e803f16 \
43 file://thirdparty/cnpy/LICENSE;md5=689f10b06d1ca2d4b1057e67b16cd580 \
44 file://thirdparty/json/nlohmann_json/LICENSE.MIT;md5=f969127d7b7ed0a8a63c2bbeae002588 \
45 file://thirdparty/ade/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
46 file://thirdparty/gflags/gflags/COPYING.txt;md5=c80d1a3b623f72bb85a4c75b556551df \
47 file://thirdparty/zlib/zlib/LICENSE;md5=b51a40671bc46e961c0498897742c0b8 \
48 file://src/plugins/intel_cpu/thirdparty/mlas/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327 \
49 file://src/plugins/intel_cpu/thirdparty/onednn/LICENSE;md5=3b64000f6e7d52516017622a37a94ce9 \
50 file://src/plugins/intel_gpu/thirdparty/onednn_gpu/LICENSE;md5=3b64000f6e7d52516017622a37a94ce9 \
51 file://node-api-headers-src/LICENSE;md5=6adb2909701d4605b4b2ae1a9b25d8bd \
52 file://node-addon-api-src/LICENSE.md;md5=0492ef29a9d558a3e9660e7accc9ca6a \
53"
54
55inherit cmake python3native pkgconfig qemu
56
57S = "${WORKDIR}/git"
58EXTRA_OECMAKE += " \
59 -DCMAKE_CROSSCOMPILING_EMULATOR=${WORKDIR}/qemuwrapper \
60 -DENABLE_OPENCV=OFF \
61 -DENABLE_INTEL_GNA=OFF \
62 -DENABLE_SYSTEM_TBB=ON \
63 -DPYTHON_EXECUTABLE=${PYTHON} \
64 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
65 -DTHREADING=TBB -DTBB_DIR="${STAGING_LIBDIR}/cmake/TBB" \
66 -DTREAT_WARNING_AS_ERROR=FALSE \
67 -DENABLE_DATA=FALSE \
68 -DENABLE_SYSTEM_PUGIXML=TRUE \
69 -DENABLE_OV_ONNX_FRONTEND=FALSE \
70 -DUSE_BUILD_TYPE_SUBFOLDER=OFF \
71 -DENABLE_FUZZING=OFF \
72 -DENABLE_TBBBIND_2_5=OFF \
73 -DCPACK_GENERATOR=RPM \
74 -DENABLE_SYSTEM_FLATBUFFERS=ON \
75 -DENABLE_SYSTEM_SNAPPY=ON \
76 -DFETCHCONTENT_BASE_DIR="${S}" \
77 "
78
79DEPENDS += "\
80 flatbuffers-native \
81 pugixml \
82 python3-pybind11 \
83 python3-pybind11-native \
84 qemu-native \
85 snappy \
86 tbb \
87 "
88
89COMPATIBLE_HOST = '(x86_64).*-linux'
90COMPATIBLE_HOST:libc-musl = "null"
91
92PACKAGECONFIG ?= "opencl samples"
93PACKAGECONFIG[opencl] = "-DENABLE_INTEL_GPU=TRUE, -DENABLE_INTEL_GPU=FALSE, virtual/opencl-icd opencl-headers opencl-clhpp,"
94PACKAGECONFIG[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"
95PACKAGECONFIG[samples] = "-DENABLE_SAMPLES=ON -DENABLE_COMPILE_TOOL=ON, -DENABLE_SAMPLES=OFF -DENABLE_COMPILE_TOOL=OFF, opencv"
96PACKAGECONFIG[verbose] = "-DVERBOSE_BUILD=1,-DVERBOSE_BUILD=0"
97
98do_configure:prepend() {
99 # Dont set PROJECT_ROOT_DIR
100 sed -i -e 's:\${OpenVINO_SOURCE_DIR}::;' ${S}/src/CMakeLists.txt
101
102 # qemu wrapper that can be used by cmake to run target binaries.
103 qemu_binary="${@qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST'), [d.expand('${STAGING_DIR_HOST}${libdir}'),d.expand('${STAGING_DIR_HOST}${base_libdir}')])}"
104 cat > ${WORKDIR}/qemuwrapper << EOF
105#!/bin/sh
106$qemu_binary "\$@"
107EOF
108 chmod +x ${WORKDIR}/qemuwrapper
109}
110
111do_install:append() {
112 rm -rf ${D}${prefix}/install_dependencies
113 rm -rf ${D}${prefix}/setupvars.sh
114
115 find ${B}/src/plugins/intel_cpu/cross-compiled/ -type f -name *_disp.cpp -exec sed -i -e 's%'"${S}"'%'"${TARGET_DBGSRC_DIR}"'%g' {} +
116}
117
118# Otherwise e.g. ros-openvino-toolkit-dynamic-vino-sample when using dldt-inference-engine uses dldt-inference-engine WORKDIR
119# instead of RSS
120SSTATE_SCAN_FILES:append = " *.cmake"
121
122FILES:${PN} += "\
123 ${libdir}/openvino-${PV}/lib*${SOLIBSDEV} \
124 ${libdir}/openvino-${PV}/plugins.xml \
125 ${libdir}/openvino-${PV}/cache.json \
126 "
127
128# Move inference engine samples into a separate package
129PACKAGES =+ "${PN}-samples"
130
131FILES:${PN}-samples = "${datadir}/openvino \
132 ${bindir} \
133 ${libdir}/libformat_reader.a \
134 ${libdir}/libopencv_c_wrapper.a \
135 "
136RDEPENDS:${PN}-samples += "python3-core"
137
138# Package for inference engine python API
139PACKAGES =+ "${PN}-python3"
140
141FILES:${PN}-python3 = "${PYTHON_SITEPACKAGES_DIR}"
142
143UPSTREAM_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 @@
1import os
2from oeqa.runtime.decorator.package import OEHasPackage
3from oeqa.runtime.case import OERuntimeTestCase
4from oeqa.core.decorator.depends import OETestDepends
5
6class JhiTest(OERuntimeTestCase):
7
8 @classmethod
9 def tearDownClass(cls):
10 _, output = cls.tc.target.run('pidof jhid')
11 cls.tc.target.run('kill %s' % output)
12
13 @OEHasPackage(['openssh-sshd'])
14 @OEHasPackage(['jhi'])
15 def test_jhi_mei_driver(self):
16 command = 'ls /dev/mei*'
17 (status, output) = self.target.run(command)
18 self.assertEqual(status, 0, msg="Error messages: %s" % output)
19
20 @OETestDepends(['jhi.JhiTest.test_jhi_mei_driver'])
21 def test_jhi_daemon_version(self):
22 command = 'jhid -v'
23 (status, output) = self.target.run(command)
24 self.assertEqual(status, 0, msg="Error messages: %s" % output)
25
26 @OETestDepends(['jhi.JhiTest.test_jhi_mei_driver'])
27 def test_jhi_daemon_can_initialized(self):
28 command = 'jhid -d'
29 (status, output) = self.target.run(command)
30 self.assertEqual(status, 0, msg="Error messages: %s" % output)
31
32 @OEHasPackage(['jhi-test'])
33 @OETestDepends(['jhi.JhiTest.test_jhi_daemon_can_initialized'])
34 def test_jhi_bist(self):
35 (status, output) = self.target.run('uname -m')
36 self.assertEqual(status, 0, msg='status and output: %s and %s' % (status, output))
37 if 'x86_64' not in output:
38 self.skipTest("Skipped jhi bist test if not x86_64 machine (current machine: %s)." % output)
39 command = 'bist'
40 (status, output) = self.target.run(command)
41 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 @@
1# These should be reviewed to see if they are still needed
2ACPI: No _BQC method, cannot determine initial brightness
3[Firmware Bug]: ACPI: No _BQC method, cannot determine initial brightness
4(EE) Failed to load module "psb"
5(EE) Failed to load module "psbdrv"
6(EE) open /dev/fb0: No such file or directory
7(EE) AIGLX: reverting to software rendering
8dmi: Firmware registration failed.
9ioremap 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 @@
1# These should be reviewed to see if they are still needed
2can't set Max Payload Size to 256
3intel_punit_ipc: can't request region for resource
4[drm] parse error at position 4 in video mode 'efifb'
5ACPI Error: Could not enable RealTimeClock event
6ACPI Warning: Could not enable fixed event - RealTimeClock
7hci_intel INT33E1:00: Unable to retrieve gpio
8hci_intel: probe of INT33E1:00 failed
9can't derive routing for PCI INT A
10failed to read out thermal zone
11Bluetooth: hci0: Setting Intel event mask failed
12ttyS2 - failed to request DMA
13Bluetooth: hci0: Failed to send firmware data (-38)
14atkbd 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 @@
1SUMMARY = "intel-cmt-cat"
2DESCRIPTION = "Software package which provides basic support for Intel(R) \
3Resource Director Technology (Intel(R) RDT)"
4HOMEPAGE = "https://github.com/intel/intel-cmt-cat"
5
6LICENSE = "BSD-3-Clause"
7LIC_FILES_CHKSUM = "file://LICENSE;md5=4b63c65942e1c16fd897f8cd20abebf8"
8
9SRC_URI = "git://github.com/intel/intel-cmt-cat;protocol=https;branch=master"
10SRCREV = "b26b31b0ae6980c5939a421cefe0316cae884626"
11
12S = "${WORKDIR}/git"
13
14COMPATIBLE_HOST = '(x86_64).*-linux'
15COMPATIBLE_HOST:libc-musl = "null"
16
17do_install() {
18 oe_runmake install PREFIX=${D}${prefix} NOLDCONFIG=y
19}
20
21FILES:${PN} += "${nonarch_libdir}/libpqos*"
22FILES:${PN}-doc = "/usr/man*"
23
24INSANE_SKIP:${PN} += "ldflags"
25INSANE_SKIP:${PN} += "dev-so"
26INSANE_SKIP:${PN} += "libdir"
27INSANE_SKIP:${PN} += "already-stripped"
28
29INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
diff --git a/recipes-bsp/metee/metee_3.0.0.bb b/recipes-bsp/metee/metee_3.2.4.bb
index 0f970a87..da8220b9 100644
--- a/recipes-bsp/metee/metee_3.0.0.bb
+++ b/recipes-bsp/metee/metee_3.2.4.bb
@@ -10,8 +10,9 @@ COMPATIBLE_HOST = '(i.86|x86_64).*-linux'
10 10
11inherit cmake 11inherit cmake
12 12
13SRC_URI = "git://github.com/intel/metee.git" 13SRC_URI = "git://github.com/intel/metee.git;branch=master;protocol=https \
14SRCREV = "92e1597181d7faec3196847a4bf35ea1f881383f" 14"
15SRCREV = "db45e37e146fd9c06907a15ade55eba06ad1f951"
15 16
16S = "${WORKDIR}/git" 17S = "${WORKDIR}/git"
17 18
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 @@
1# Add i915 graphics firmware 1# Add i915 graphics firmware
2PACKAGE_INSTALL_append_intel-x86-common = " linux-firmware-i915" 2PACKAGE_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() {
32 d.appendVarFlag('do_image', 'depends', ' %s:do_image_complete' % initrd_i) 32 d.appendVarFlag('do_image', 'depends', ' %s:do_image_complete' % initrd_i)
33} 33}
34 34
35WKS_FILE_intel-corei7-64 = "core-image-tiny.wks.in" 35WKS_FILE:intel-corei7-64 = "core-image-tiny.wks.in"
36WKS_FILE_intel-core2-32 = "core-image-tiny.wks.in" 36WKS_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 @@
1From d4c97b50b577ea16b9ff6d9a352ab474a119310e Mon Sep 17 00:00:00 2001
2From: Naveen Saini <naveen.kumar.saini@intel.com>
3Date: Wed, 18 May 2022 15:41:24 +0800
4Subject: [PATCH] fake_v4l2_device.h: fix narrowing warning
5
6Use uint32_t instead of int for IOCTLs commands.
7
8Warning log:
9| ../../../git/xcore/fake_v4l2_device.h: In member function 'virtual int XCam::FakeV4l2Device::io_control(int, void*)':
10| ../../../git/xcore/fake_v4l2_device.h:42:14: error: narrowing conversion of '3225441794' from 'long unsigned int' to 'int' [-Wnarrowing]
11| 42 | case VIDIOC_ENUM_FMT:
12| | ^~~~~~~~~~~~~~~
13| make[4]: *** [Makefile:685: libgstxcamsrc_la-gstxcamsrc.lo] Error 1
14
15Issue: https://github.com/intel/libxcam/issues/801
16Upstream-Status: Submitted [https://github.com/intel/libxcam/pull/802]
17
18Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
19---
20 xcore/base/xcam_common.h | 2 +-
21 xcore/fake_v4l2_device.h | 2 +-
22 xcore/v4l2_device.cpp | 2 +-
23 xcore/v4l2_device.h | 2 +-
24 xcore/xcam_common.cpp | 2 +-
25 5 files changed, 5 insertions(+), 5 deletions(-)
26
27diff --git a/xcore/base/xcam_common.h b/xcore/base/xcam_common.h
28index 1f16e1e..4aa6cb9 100644
29--- a/xcore/base/xcam_common.h
30+++ b/xcore/base/xcam_common.h
31@@ -75,7 +75,7 @@ void xcam_free (void *ptr);
32 * return, 0 successfully
33 * else, check errno
34 */
35-int xcam_device_ioctl (int fd, int cmd, void *arg);
36+int xcam_device_ioctl (int fd, uint32_t cmd, void *arg);
37 const char *xcam_fourcc_to_string (uint32_t fourcc);
38
39 void xcam_set_log (const char* file_name);
40diff --git a/xcore/fake_v4l2_device.h b/xcore/fake_v4l2_device.h
41index f679c19..e29787d 100644
42--- a/xcore/fake_v4l2_device.h
43+++ b/xcore/fake_v4l2_device.h
44@@ -33,7 +33,7 @@ public:
45 : V4l2Device ("/dev/null")
46 {}
47
48- int io_control (int cmd, void *arg)
49+ int io_control (uint32_t cmd, void *arg)
50 {
51 XCAM_UNUSED (arg);
52
53diff --git a/xcore/v4l2_device.cpp b/xcore/v4l2_device.cpp
54index 395461e..66a8ac6 100644
55--- a/xcore/v4l2_device.cpp
56+++ b/xcore/v4l2_device.cpp
57@@ -185,7 +185,7 @@ V4l2Device::close ()
58 }
59
60 int
61-V4l2Device::io_control (int cmd, void *arg)
62+V4l2Device::io_control (uint32_t cmd, void *arg)
63
64 {
65 if (_fd <= 0)
66diff --git a/xcore/v4l2_device.h b/xcore/v4l2_device.h
67index b4ad7ad..2551a92 100644
68--- a/xcore/v4l2_device.h
69+++ b/xcore/v4l2_device.h
70@@ -104,7 +104,7 @@ public:
71 XCamReturn queue_buffer (SmartPtr<V4l2Buffer> &buf);
72
73 // use as less as possible
74- virtual int io_control (int cmd, void *arg);
75+ virtual int io_control (uint32_t cmd, void *arg);
76
77 protected:
78
79diff --git a/xcore/xcam_common.cpp b/xcore/xcam_common.cpp
80index 848884d..d4d5093 100644
81--- a/xcore/xcam_common.cpp
82+++ b/xcore/xcam_common.cpp
83@@ -53,7 +53,7 @@ void xcam_free(void *ptr)
84 free (ptr);
85 }
86
87-int xcam_device_ioctl (int fd, int cmd, void *arg)
88+int xcam_device_ioctl (int fd, uint32_t cmd, void *arg)
89 {
90 int ret = 0;
91 int tried_time = 0;
92--
932.25.1
94
diff --git a/recipes-core/libxcam/libxcam_1.5.0.bb b/recipes-core/libxcam/libxcam_1.5.0.bb
index fcd14bd4..31e9344b 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
8 8
9S = "${WORKDIR}/git" 9S = "${WORKDIR}/git"
10SRCREV = "231a1d5243cd45c7a6b511b667f1ec52178fdda8" 10SRCREV = "231a1d5243cd45c7a6b511b667f1ec52178fdda8"
11SRC_URI = "git://github.com/intel/libxcam.git;branch=1.5.0; \ 11SRC_URI = "git://github.com/intel/libxcam.git;branch=1.5.0;protocol=https \
12 file://0001-fake_v4l2_device.h-fix-narrowing-warning.patch \
12" 13"
13 14
14COMPATIBLE_HOST_libc-musl = "null" 15COMPATIBLE_HOST:libc-musl = "null"
15 16
16PACKAGECONFIG ??= " gst \ 17PACKAGECONFIG ??= " gst \
17 ${@bb.utils.contains("DISTRO_FEATURES", "opengl", "gles", "", d)} \ 18 ${@bb.utils.contains("DISTRO_FEATURES", "opengl", "gles", "", d)} \
@@ -27,12 +28,12 @@ PACKAGECONFIG[gles] = "--enable-gles, --disable-gles, virtual/mesa"
27PACKAGECONFIG[vulkan] = "--enable-vulkan, --disable-vulkan, vulkan-loader virtual/mesa" 28PACKAGECONFIG[vulkan] = "--enable-vulkan, --disable-vulkan, vulkan-loader virtual/mesa"
28PACKAGECONFIG[dnn] = "--enable-dnn, --disable-dnn," 29PACKAGECONFIG[dnn] = "--enable-dnn, --disable-dnn,"
29 30
30do_install_append () { 31do_install:append () {
31 install -d ${D}${bindir}/libxcam 32 install -d ${D}${bindir}/libxcam
32 cp -r ${WORKDIR}/build/tests/.libs/* ${D}${bindir}/libxcam/ 33 cp -r ${WORKDIR}/build/tests/.libs/* ${D}${bindir}/libxcam/
33} 34}
34 35
35FILES_${PN} += "${libdir}/gstreamer-*/*.so" 36FILES:${PN} += "${libdir}/gstreamer-*/*.so"
36FILES_${PN}-test = "${bindir}/libxcam/*" 37FILES:${PN}-test = "${bindir}/libxcam/*"
37PACKAGES =+ "${PN}-test" 38PACKAGES =+ "${PN}-test"
38RDEPENDS_${PN}-test =+ "bash" 39RDEPENDS:${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 @@
1export ICX_LDFLAGS_OPTION = " -Wl,-dynamic-linker,/lib/ld-linux-x86-64.so.2"
2export ICXSDK_PREFIX_OPTION = "-B ${TARGET_PREFIX}"
3export ICXQSDK_PREFIX_OPTION = "-qgnu-prefix=${TARGET_PREFIX}"
4
5create_sdk_files:append() {
6 script=${SDK_OUTPUT}/${SDKPATH}/environment-setup-${REAL_MULTIMACH_TARGET_SYS}
7 if ${@bb.utils.contains('ICXSDK', '1', 'true', 'false', d)}; then
8 echo 'export ICX="icx ${ICXSDK_PREFIX_OPTION} --target=${TARGET_SYS} ${TARGET_CC_ARCH} --sysroot=$SDKTARGETSYSROOT ${ICX_LDFLAGS_OPTION}"' >> $script
9 echo 'export ICXCXX="icpx ${ICXSDK_PREFIX_OPTION} --target=${TARGET_SYS} ${TARGET_CC_ARCH} --sysroot=$SDKTARGETSYSROOT ${ICX_LDFLAGS_OPTION}"' >> $script
10 echo 'export ICXCPP="icx ${ICXSDK_PREFIX_OPTION} -E --target=${TARGET_SYS} ${TARGET_CC_ARCH} --sysroot=$SDKTARGETSYSROOT ${ICX_LDFLAGS_OPTION}"' >> $script
11 echo 'export ICXLD="xild --sysroot=$SDKTARGETSYSROOT "' >> $script
12 echo 'export ICXCCLD="icx ${ICXSDK_PREFIX_OPTION} --sysroot=$SDKTARGETSYSROOT"' >> $script
13 echo 'export ICXAR="xiar ${ICXQSDK_PREFIX_OPTION}"' >> $script
14 fi
15}
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 @@
1FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
2
3require ${@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 @@
1FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
2
3require ${@bb.utils.contains('ICXSDK', '1', 'icx-environment.inc', '', d)}
diff --git a/recipes-core/microcode/intel-microcode_20210216.bb b/recipes-core/microcode/intel-microcode_20240312.bb
index 69c8f08c..00b18231 100644
--- a/recipes-core/microcode/intel-microcode_20210216.bb
+++ b/recipes-core/microcode/intel-microcode_20240312.bb
@@ -16,7 +16,7 @@ LIC_FILES_CHKSUM = "file://license;md5=d8405101ec6e90c1d84b082b0c40c721"
16SRC_URI = "git://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files.git;protocol=https;branch=main \ 16SRC_URI = "git://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files.git;protocol=https;branch=main \
17 " 17 "
18 18
19SRCREV = "4c5f3fdcc7f5d2b6c1bcc11001ed58923db481ab" 19SRCREV = "41af34500598418150aa298bb04e7edacc547897"
20 20
21DEPENDS = "iucode-tool-native" 21DEPENDS = "iucode-tool-native"
22S = "${WORKDIR}/git" 22S = "${WORKDIR}/git"
@@ -34,12 +34,6 @@ do_compile() {
34 ${STAGING_DIR_NATIVE}${sbindir_native}/iucode_tool \ 34 ${STAGING_DIR_NATIVE}${sbindir_native}/iucode_tool \
35 ${UCODE_FILTER_PARAMETERS} \ 35 ${UCODE_FILTER_PARAMETERS} \
36 --overwrite \ 36 --overwrite \
37 --write-to=${WORKDIR}/microcode_${PV}.bin \
38 ${S}/intel-ucode/* ${S}/intel-ucode-with-caveats/*
39
40 ${STAGING_DIR_NATIVE}${sbindir_native}/iucode_tool \
41 ${UCODE_FILTER_PARAMETERS} \
42 --overwrite \
43 --write-earlyfw=${WORKDIR}/microcode_${PV}.cpio \ 37 --write-earlyfw=${WORKDIR}/microcode_${PV}.cpio \
44 ${S}/intel-ucode/* ${S}/intel-ucode-with-caveats/* 38 ${S}/intel-ucode/* ${S}/intel-ucode-with-caveats/*
45} 39}
@@ -47,6 +41,7 @@ do_compile() {
47do_install() { 41do_install() {
48 install -d ${D}${nonarch_base_libdir}/firmware/intel-ucode/ 42 install -d ${D}${nonarch_base_libdir}/firmware/intel-ucode/
49 ${STAGING_DIR_NATIVE}${sbindir_native}/iucode_tool \ 43 ${STAGING_DIR_NATIVE}${sbindir_native}/iucode_tool \
44 ${UCODE_FILTER_PARAMETERS} \
50 --write-firmware=${D}${nonarch_base_libdir}/firmware/intel-ucode \ 45 --write-firmware=${D}${nonarch_base_libdir}/firmware/intel-ucode \
51 ${S}/intel-ucode/* ${S}/intel-ucode-with-caveats/* 46 ${S}/intel-ucode/* ${S}/intel-ucode-with-caveats/*
52} 47}
@@ -63,6 +58,6 @@ addtask deploy before do_build after do_compile
63 58
64PACKAGES = "${PN}" 59PACKAGES = "${PN}"
65 60
66FILES_${PN} = "${nonarch_base_libdir}" 61FILES:${PN} = "${nonarch_base_libdir}"
67 62
68UPSTREAM_CHECK_GITTAGREGEX = "^microcode-(?P<pver>(\d+)[a-z]*)$" 63UPSTREAM_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\
12HOMEPAGE = "https://gitlab.com/iucode-tool/" 12HOMEPAGE = "https://gitlab.com/iucode-tool/"
13BUGTRACKER = "https://bugs.debian.org/cgi-bin/pkgreport.cgi?ordering=normal;archive=0;src=iucode-tool;repeatmerged=0" 13BUGTRACKER = "https://bugs.debian.org/cgi-bin/pkgreport.cgi?ordering=normal;archive=0;src=iucode-tool;repeatmerged=0"
14 14
15LICENSE = "GPLv2+" 15LICENSE = "GPL-2.0-or-later"
16LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \ 16LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
17 file://iucode_tool.c;beginline=1;endline=15;md5=71eeab3190360ff0267101b570874756" 17 file://iucode_tool.c;beginline=1;endline=15;md5=71eeab3190360ff0267101b570874756"
18 18
19DEPENDS_append_libc-musl = " argp-standalone" 19DEPENDS:append:libc-musl = " argp-standalone"
20 20
21SRC_URI = "https://gitlab.com/iucode-tool/releases/raw/master/iucode-tool_${PV}.tar.xz" 21SRC_URI = "https://gitlab.com/iucode-tool/releases/raw/master/iucode-tool_${PV}.tar.xz"
22SRC_URI_append_libc-musl = " file://0001-Makefile.am-Add-arg-parse-library-for-MUSL-support.patch" 22SRC_URI:append:libc-musl = " file://0001-Makefile.am-Add-arg-parse-library-for-MUSL-support.patch"
23 23
24SRC_URI[md5sum] = "63b33cc0ea1f8c73b443412abbf39d6f" 24SRC_URI[md5sum] = "63b33cc0ea1f8c73b443412abbf39d6f"
25SRC_URI[sha256sum] = "12b88efa4d0d95af08db05a50b3dcb217c0eb2bfc67b483779e33d498ddb2f95" 25SRC_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 @@
1From 149b34de80e7f9f5331c285b862776cdd4b02ee3 Mon Sep 17 00:00:00 2001 1From b2099e7184d48a6d05c8713b6fd5dac0e2e70963 Mon Sep 17 00:00:00 2001
2From: Mikko Ylinen <mikko.ylinen@linux.intel.com> 2From: Mikko Ylinen <mikko.ylinen@linux.intel.com>
3Date: Fri, 7 Apr 2017 12:06:14 +0300 3Date: Wed, 2 Mar 2022 10:55:35 +0800
4Subject: [PATCH] ovmf: RefkitTestCA: TEST UEFI SecureBoot 4Subject: [PATCH] ovmf: RefkitTestCA: TEST UEFI SecureBoot
5 5
6This patch adds refkit-db.cer (via xxd -i) in OVMF's db 6This patch adds refkit-db.cer (via xxd -i) in OVMF's db
@@ -9,25 +9,23 @@ application. It's used for testing purposes only.
9 9
10Images signed with refkit-db keys are allowed to boot. 10Images signed with refkit-db keys are allowed to boot.
11 11
12Signed-off-by: Mikko Ylinen <mikko.ylinen@linux.intel.com> 12Upstream-Status: Inappropriate
13
14[ Change location of key to AuthData.c ]
15Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
16 13
17%% original patch: 0001-ovmf-RefkitTestCA-TEST-UEFI-SecureBoot.patch 14Signed-off-by: Mikko Ylinen <mikko.ylinen@linux.intel.com>
15Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
18--- 16---
19 OvmfPkg/EnrollDefaultKeys/AuthData.c | 68 +++++++++++++++++++ 17 OvmfPkg/EnrollDefaultKeys/AuthData.c | 69 +++++++++++++++++++
20 OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c | 1 + 18 OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c | 3 +
21 OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.h | 2 + 19 OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.h | 2 +
22 3 files changed, 71 insertions(+) 20 3 files changed, 74 insertions(+)
23 21
24diff --git a/OvmfPkg/EnrollDefaultKeys/AuthData.c b/OvmfPkg/EnrollDefaultKeys/AuthData.c 22diff --git a/OvmfPkg/EnrollDefaultKeys/AuthData.c b/OvmfPkg/EnrollDefaultKeys/AuthData.c
25index 3b4856a01f..7109766296 100644 23index 53ee7f7003..127131cd05 100644
26--- a/OvmfPkg/EnrollDefaultKeys/AuthData.c 24--- a/OvmfPkg/EnrollDefaultKeys/AuthData.c
27+++ b/OvmfPkg/EnrollDefaultKeys/AuthData.c 25+++ b/OvmfPkg/EnrollDefaultKeys/AuthData.c
28@@ -398,6 +398,74 @@ CONST UINT8 mMicrosoftUefiCa[] = { 26@@ -395,6 +395,75 @@ CONST UINT8 mMicrosoftUefiCa[] = {
29 27
30 CONST UINTN mSizeOfMicrosoftUefiCa = sizeof mMicrosoftUefiCa; 28 CONST UINTN mSizeOfMicrosoftUefiCa = sizeof mMicrosoftUefiCa;
31 29
32+CONST UINT8 mRefkitTestCA[] = { 30+CONST UINT8 mRefkitTestCA[] = {
33+ 0x30, 0x82, 0x02, 0xfb, 0x30, 0x82, 0x01, 0xe3, 0xa0, 0x03, 0x02, 0x01, 31+ 0x30, 0x82, 0x02, 0xfb, 0x30, 0x82, 0x01, 0xe3, 0xa0, 0x03, 0x02, 0x01,
@@ -97,32 +95,35 @@ index 3b4856a01f..7109766296 100644
97+}; 95+};
98+ 96+
99+CONST UINTN mSizeOfRefkitTestCA = sizeof mRefkitTestCA; 97+CONST UINTN mSizeOfRefkitTestCA = sizeof mRefkitTestCA;
100 98+
101 // 99 //
102 // The Microsoft.UefiSecureBootLogo.Tests.OutOfBoxConfirmDBXisPresent test case 100 // The Microsoft.UefiSecureBootLogo.Tests.OutOfBoxConfirmDBXisPresent test case
101 // of the Secure Boot Logo Test in the Microsoft Hardware Certification Kit
103diff --git a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c 102diff --git a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
104index f45cb799f7..fb1252e768 100644 103index 094e4c821b..0a7eef54dc 100644
105--- a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c 104--- a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
106+++ b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c 105+++ b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
107@@ -615,6 +615,7 @@ ShellAppMain ( 106@@ -702,6 +702,9 @@ ShellAppMain (
108 &gEfiCertX509Guid, 107 mMicrosoftUefiCa,
109 mMicrosoftPca, mSizeOfMicrosoftPca, &gMicrosoftVendorGuid, 108 mSizeOfMicrosoftUefiCa,
110 mMicrosoftUefiCa, mSizeOfMicrosoftUefiCa, &gMicrosoftVendorGuid, 109 &gMicrosoftVendorGuid,
111+ mRefkitTestCA, mSizeOfRefkitTestCA, &gEfiCallerIdGuid, 110+ mRefkitTestCA,
112 NULL); 111+ mSizeOfRefkitTestCA,
112+ &gEfiCallerIdGuid,
113 NULL
114 );
113 } 115 }
114 if (EFI_ERROR (Status)) {
115diff --git a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.h b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.h 116diff --git a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.h b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.h
116index 8e61f0a77b..e3fa046f95 100644 117index 56da9c71d6..8de1dfe4e0 100644
117--- a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.h 118--- a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.h
118+++ b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.h 119+++ b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.h
119@@ -135,4 +135,6 @@ extern CONST UINTN mSizeOfMicrosoftUefiCa; 120@@ -133,4 +133,6 @@ extern CONST UINTN mSizeOfMicrosoftUefiCa;
120 extern CONST UINT8 mSha256OfDevNull[]; 121 extern CONST UINT8 mSha256OfDevNull[];
121 extern CONST UINTN mSizeOfSha256OfDevNull; 122 extern CONST UINTN mSizeOfSha256OfDevNull;
122 123
123+extern CONST UINT8 mRefkitTestCA[]; 124+extern CONST UINT8 mRefkitTestCA[];
124+extern CONST UINTN mSizeOfRefkitTestCA; 125+extern CONST UINTN mSizeOfRefkitTestCA;
125 #endif /* ENROLL_DEFAULT_KEYS_H_ */ 126 #endif /* ENROLL_DEFAULT_KEYS_H_ */
126-- 127--
1272.21.0 1282.17.1
128 129
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 @@
1require recipes-core/ovmf/ovmf-shell-image.bb 1require recipes-core/ovmf/ovmf-shell-image.bb
2 2
3WKS_SEARCH_PATH_append = ":${COREBASE}/meta/recipes-core/ovmf" 3WKS_SEARCH_PATH:append = ":${COREBASE}/meta/recipes-core/ovmf"
4 4
5QB_DRIVE_TYPE = "/dev/vd" 5QB_DRIVE_TYPE = "/dev/vd"
6 6
7do_image_append() { 7do_image:append() {
8 cat > ${IMAGE_ROOTFS}/startup.nsh << EOF 8 cat > ${IMAGE_ROOTFS}/startup.nsh << EOF
9EnrollDefaultKeys 9EnrollDefaultKeys
10reset 10reset
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 @@
1FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/files:" 1FILESEXTRAPATHS:prepend:intel-x86-common := "${THISDIR}/files:"
2 2
3SRC_URI_append_intel-x86-common = " \ 3SRC_URI:append:intel-x86-common = " \
4 file://0001-ovmf-RefkitTestCA-TEST-UEFI-SecureBoot.patch \ 4 file://0001-ovmf-RefkitTestCA-TEST-UEFI-SecureBoot.patch \
5" 5"
6PACKAGECONFIG_append_intel-x86-common = " secureboot" 6PACKAGECONFIG: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 @@
1require recipes-core/zlib/zlib_1.2.11.bb
2
3FILESEXTRAPATHS_append = ":${COREBASE}/meta/recipes-core/zlib/zlib"
4
5SUMMARY = "Zlib Compression Library (Intel-tuned)"
6
7PROVIDES = "zlib"
8
9SRC_URI_remove = "${SOURCEFORGE_MIRROR}/libpng/${BPN}/${PV}/${BPN}-${PV}.tar.xz"
10SRC_URI_prepend = "git://github.com/jtkukunas/zlib.git;protocol=git "
11
12SRCREV = "a43a247bfa16ec5368747b5b64f11ea5ca033010"
13S = "${WORKDIR}/git"
14
15RPROVIDES_${PN} += "zlib"
16RPROVIDES_${PN}-ptest += "zlib-ptest"
17
18UPSTREAM_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\
4Operating Systems or Hypervisors." 4Operating Systems or Hypervisors."
5HOMEPAGE = "https://slimbootloader.github.io/tools/index.html" 5HOMEPAGE = "https://slimbootloader.github.io/tools/index.html"
6 6
7SRC_URI = "git://github.com/slimbootloader/slimbootloader;protocol=https" 7SRC_URI = "git://github.com/slimbootloader/slimbootloader;protocol=https;branch=master"
8SRCREV = "9f146afd47e0ca204521826a583d55388850b216" 8SRCREV = "df5bd0bc2a522afcb8945a6797592b04838db753"
9PV = "0.0.0+git${SRCPV}" 9PV = "0.0.0+git${SRCPV}"
10LICENSE = "BSD-2-Clause-Patent" 10LICENSE = "BSD-2-Clause-Patent"
11LIC_FILES_CHKSUM = "file://LICENSE;md5=d1ed89007e7aa232a4dc1c59b6c9efc4" 11LIC_FILES_CHKSUM = "file://LICENSE;md5=ef7fba7be2819ac13aaf5d0f842ce5d9"
12S = "${WORKDIR}/git" 12S = "${WORKDIR}/git"
13 13
14inherit python3native 14inherit 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..21cffe24
--- /dev/null
+++ b/recipes-graphics/gmmlib/files/0001-Add-new-DG2-device-IDs-194.patch
@@ -0,0 +1,38 @@
1From 8729d66800995a9b7e693bd78249932bd12383e1 Mon Sep 17 00:00:00 2001
2From: John Machado <john.machado@intel.com>
3Date: Mon, 25 Mar 2024 11:13:27 +0530
4Subject: [PATCH] Add new DG2 device IDs (#194)
5
6Upstream-status: Backport
7https://github.com/intel/gmmlib/commit/dcc4b85ea3728c848b62fbb164c00f43b519b6fb
8
9Signed-off-by: Hoe, Sheng Yang <sheng.yang.hoe@intel.com>
10---
11 Source/inc/common/igfxfmid.h | 4 ++++
12 1 file changed, 4 insertions(+)
13
14diff --git a/Source/inc/common/igfxfmid.h b/Source/inc/common/igfxfmid.h
15index 7969779..8e2c955 100644
16--- a/Source/inc/common/igfxfmid.h
17+++ b/Source/inc/common/igfxfmid.h
18@@ -1932,6 +1932,8 @@ typedef enum __NATIVEGTTYPE
19 #define DEV_ID_56BB 0x56BB
20 #define DEV_ID_56BC 0x56BC
21 #define DEV_ID_56BD 0x56BD
22+#define DEV_ID_56BE 0x56BE
23+#define DEV_ID_56BF 0x56BF
24 #define DEV_ID_56C0 0x56C0
25 #define DEV_ID_56C1 0x56C1
26
27@@ -1992,6 +1994,8 @@ typedef enum __NATIVEGTTYPE
28 ( d == DEV_ID_5690 ) || \
29 ( d == DEV_ID_5691 ) || \
30 ( d == DEV_ID_5692 ) || \
31+ ( d == DEV_ID_56BE ) || \
32+ ( d == DEV_ID_56BF ) || \
33 ( d == DEV_ID_56C0 ) || \
34 ( d == DEV_ID_4F80 ) || \
35 ( d == DEV_ID_4F81 ) || \
36--
372.34.1
38
diff --git a/recipes-graphics/gmmlib/files/0001-Introduce-ARL-H-support-172.patch b/recipes-graphics/gmmlib/files/0001-Introduce-ARL-H-support-172.patch
new file mode 100644
index 00000000..ab4cb178
--- /dev/null
+++ b/recipes-graphics/gmmlib/files/0001-Introduce-ARL-H-support-172.patch
@@ -0,0 +1,42 @@
1From 2b267b72d6aaa922861b120da9c1543161797046 Mon Sep 17 00:00:00 2001
2From: John Machado <john.machado@intel.com>
3Date: Fri, 9 Feb 2024 13:10:18 +0530
4Subject: [PATCH] Introduce ARL-H support (#172)
5
6Upstream-Status: Backport [https://github.com/intel/gmmlib/commit/544a8be6f66631e085c86c453aafd78b0e7f5179]
7Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
8---
9 Source/inc/common/igfxfmid.h | 10 ++++++++++
10 1 file changed, 10 insertions(+)
11
12diff --git a/Source/inc/common/igfxfmid.h b/Source/inc/common/igfxfmid.h
13index 99fc624..19aa505 100644
14--- a/Source/inc/common/igfxfmid.h
15+++ b/Source/inc/common/igfxfmid.h
16@@ -1966,6 +1966,11 @@ typedef enum __NATIVEGTTYPE
17 // ARL-S
18 #define DEV_ID_7D67 0x7D67
19
20+// ARL-H
21+#define DEV_ID_7D41 0x7D41
22+#define DEV_ID_7D51 0x7D51
23+#define DEV_ID_7DD1 0x7DD1
24+
25 #define MGM_HAS 0
26
27 //#define SDG_HAS 1 //Reserve place for Springdale-G HAS
28@@ -2012,6 +2017,11 @@ typedef enum __NATIVEGTTYPE
29 // Macro to identify ARL-S Device ID
30 #define GFX_IS_ARL_S(d) ( ( d == DEV_ID_7D67 ) )
31
32+// Macro to identify ARL-H Device ID
33+#define GFX_IS_ARL_H(d) ( ( d == DEV_ID_7D41 ) || \
34+ ( d == DEV_ID_7D51 ) || \
35+ ( d == DEV_ID_7DD1 ))
36+
37 //we define the highest cap and lower cap of stepping IDs
38 #define SI_REV_ID(lo,hi) (lo | hi<<16)
39
40--
412.40.1
42
diff --git a/recipes-graphics/gmmlib/gmmlib_21.1.1.bb b/recipes-graphics/gmmlib/gmmlib_22.3.15.bb
index f5de0ef5..875fbaf5 100644
--- a/recipes-graphics/gmmlib/gmmlib_21.1.1.bb
+++ b/recipes-graphics/gmmlib/gmmlib_22.3.15.bb
@@ -4,17 +4,19 @@ device specific and buffer management for the Intel(R) Graphics \
4Compute Runtime for OpenCL(TM) and the Intel(R) Media Driver for VAAPI." 4Compute Runtime for OpenCL(TM) and the Intel(R) Media Driver for VAAPI."
5 5
6LICENSE = "MIT" 6LICENSE = "MIT"
7LIC_FILES_CHKSUM = "file://LICENSE.md;md5=d9a6e772cd4c362ee4c8ef87c5aad843" 7LIC_FILES_CHKSUM = "file://LICENSE.md;md5=465fe90caea3edd6a2cecb3f0c28a654"
8 8
9SRC_URI = " \ 9SRC_URI = " \
10 git://github.com/intel/gmmlib.git;protocol=https \ 10 git://github.com/intel/gmmlib.git;protocol=https;branch=master \
11 file://0001-Introduce-ARL-H-support-172.patch \
12 file://0001-Add-new-DG2-device-IDs-194.patch \
11 " 13 "
12 14
13SRCREV = "60a77187c43ff23a0888b2f297ae5c93cc50a666" 15SRCREV = "5fb4180e22695ad4e3c155cf680119913c9f44bc"
14 16
15S = "${WORKDIR}/git" 17S = "${WORKDIR}/git"
16 18
17COMPATIBLE_HOST_x86-x32 = "null" 19COMPATIBLE_HOST:x86-x32 = "null"
18 20
19UPSTREAM_CHECK_GITTAGREGEX = "^intel-gmmlib-(?P<pver>(\d+(\.\d+)+))$" 21UPSTREAM_CHECK_GITTAGREGEX = "^intel-gmmlib-(?P<pver>(\d+(\.\d+)+))$"
20 22
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.
9Added wait function to block parent process 9Added wait function to block parent process
10until child process exits. 10until child process exits.
11 11
12Upstream-Status: Submitted[https://github.com/intel/hdcp/pull/17] 12Upstream-Status: Submitted [https://github.com/intel/hdcp/pull/17]
13 13
14Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> 14Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
15--- 15---
diff --git a/recipes-graphics/hdcp/hdcp_20.4.0.bb b/recipes-graphics/hdcp/hdcp_21.2.0.bb
index 016e8e0a..8529b5ab 100644
--- a/recipes-graphics/hdcp/hdcp_20.4.0.bb
+++ b/recipes-graphics/hdcp/hdcp_21.2.0.bb
@@ -9,7 +9,7 @@ SECTION = "lib"
9 9
10inherit pkgconfig cmake useradd systemd features_check 10inherit pkgconfig cmake useradd systemd features_check
11 11
12SRC_URI = "git://github.com/intel/hdcp.git \ 12SRC_URI = "git://github.com/intel/hdcp.git;branch=master;protocol=https \
13 file://0001-main-fix-hdcpd-service-failure.patch \ 13 file://0001-main-fix-hdcpd-service-failure.patch \
14" 14"
15SRCREV = "cacc352159c5bdaf1c21846cecdd1eb7b031e1d3" 15SRCREV = "cacc352159c5bdaf1c21846cecdd1eb7b031e1d3"
@@ -20,7 +20,7 @@ REQUIRED_DISTRO_FEATURES = "systemd"
20DEPENDS = "libdrm virtual/mesa systemd" 20DEPENDS = "libdrm virtual/mesa systemd"
21 21
22USERADD_PACKAGES = "${PN}" 22USERADD_PACKAGES = "${PN}"
23USERADD_PARAM_${PN} = "--system --no-create-home --shell /bin/false --gid nogroup media" 23USERADD_PARAM:${PN} = "--system --no-create-home --shell /bin/false --gid nogroup media"
24 24
25SYSTEMD_SERVICE_${PN} = "hdcpd.service" 25SYSTEMD_SERVICE:${PN} = "hdcpd.service"
26SYSTEMD_AUTO_ENABLE = "disable" 26SYSTEMD_AUTO_ENABLE = "disable"
diff --git a/recipes-graphics/libva/libva-intel-utils_2.11.1.bb b/recipes-graphics/libva/libva-intel-utils_2.20.1.bb
index f9bea364..9c26f009 100644
--- a/recipes-graphics/libva/libva-intel-utils_2.11.1.bb
+++ b/recipes-graphics/libva/libva-intel-utils_2.20.1.bb
@@ -14,8 +14,8 @@ SECTION = "x11"
14LICENSE = "MIT" 14LICENSE = "MIT"
15LIC_FILES_CHKSUM = "file://COPYING;md5=b148fc8adf19dc9aec17cf9cd29a9a5e" 15LIC_FILES_CHKSUM = "file://COPYING;md5=b148fc8adf19dc9aec17cf9cd29a9a5e"
16 16
17SRC_URI = "git://github.com/intel/libva-utils.git;branch=v2.11-branch" 17SRC_URI = "git://github.com/intel/libva-utils.git;branch=v2.20-branch;protocol=https"
18SRCREV = "959b2f20cf99d4611eab66164af3d7e4a84f674b" 18SRCREV = "2ad888bb463dc9bfb3deb512ec9faf78f1d3bfa8"
19S = "${WORKDIR}/git" 19S = "${WORKDIR}/git"
20 20
21UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+(\.\d+)+))" 21UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+(\.\d+)+))"
@@ -32,4 +32,4 @@ PACKAGECONFIG[x11] = "-Dx11=true, -Dx11=false,virtual/libx11 libxext libxfixes"
32PACKAGECONFIG[wayland] = "-Dwayland=true, -Dwayland=false,wayland-native wayland" 32PACKAGECONFIG[wayland] = "-Dwayland=true, -Dwayland=false,wayland-native wayland"
33 33
34PROVIDES = "libva-utils" 34PROVIDES = "libva-utils"
35RPROVIDES_${PN} += "libva-utils" 35RPROVIDES:${PN} += "libva-utils"
diff --git a/recipes-graphics/libva/libva-intel_2.11.0.bb b/recipes-graphics/libva/libva-intel_2.20.0.bb
index 406f6f68..c81ed65c 100644
--- a/recipes-graphics/libva/libva-intel_2.11.0.bb
+++ b/recipes-graphics/libva/libva-intel_2.20.0.bb
@@ -17,8 +17,9 @@ SECTION = "x11"
17LICENSE = "MIT" 17LICENSE = "MIT"
18LIC_FILES_CHKSUM = "file://COPYING;md5=2e48940f94acb0af582e5ef03537800f" 18LIC_FILES_CHKSUM = "file://COPYING;md5=2e48940f94acb0af582e5ef03537800f"
19 19
20SRC_URI = "https://github.com/intel/libva/releases/download/${PV}/libva-${PV}.tar.bz2" 20SRC_URI = "https://github.com/intel/libva/releases/download/${PV}/libva-${PV}.tar.bz2 \
21SRC_URI[sha256sum] = "6e361117038b571ad4741d38c9280db8c140b17e76e8c01fc7a4d608d3ed7d5d" 21 "
22SRC_URI[sha256sum] = "f72bdb4f48dfe71ad01f1cbefe069672a2c949a6abd51cf3c4d4784210badc49"
22 23
23S = "${WORKDIR}/libva-${PV}" 24S = "${WORKDIR}/libva-${PV}"
24 25
@@ -40,15 +41,15 @@ PACKAGECONFIG[wayland] = "-Dwith_wayland=yes,-Dwith_wayland=no,wayland-native wa
40 41
41PACKAGES =+ "${PN}-x11 ${PN}-glx ${PN}-wayland" 42PACKAGES =+ "${PN}-x11 ${PN}-glx ${PN}-wayland"
42 43
43RDEPENDS_${PN}-x11 =+ "${PN}" 44RDEPENDS:${PN}-x11 =+ "${PN}"
44RDEPENDS_${PN}-glx =+ "${PN}-x11" 45RDEPENDS:${PN}-glx =+ "${PN}-x11"
45 46
46FILES_${PN}-x11 =+ "${libdir}/libva-x11*${SOLIBS}" 47FILES:${PN}-x11 =+ "${libdir}/libva-x11*${SOLIBS}"
47FILES_${PN}-glx =+ "${libdir}/libva-glx*${SOLIBS}" 48FILES:${PN}-glx =+ "${libdir}/libva-glx*${SOLIBS}"
48FILES_${PN}-wayland =+ "${libdir}/libva-wayland*${SOLIBS}" 49FILES:${PN}-wayland =+ "${libdir}/libva-wayland*${SOLIBS}"
49 50
50PROVIDES += "libva" 51PROVIDES += "libva"
51RPROVIDES_${PN} += "libva" 52RPROVIDES:${PN} += "libva"
52RPROVIDES_${PN}-x11 += "libva-x11" 53RPROVIDES:${PN}-x11 += "libva-x11"
53RPROVIDES_${PN}-glx += "libva-glx" 54RPROVIDES:${PN}-glx += "libva-glx"
54RPROVIDES_${PN}-wayland += "libva-wayland" 55RPROVIDES:${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 @@
1From 8c11096a0e5cf980309692ae3e272108da5f2b4e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 9 Oct 2019 11:36:56 -0700
4Subject: [PATCH] md_internal.h: Replace string.h with <string> C++ header API
5
6This helps in compiling with libc++/Clang
7Fixes
8usr/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> > >'
9: public integral_constant<bool, __is_empty(_Tp)> {};
10^
11
12Upstream-Status: Submitted [https://github.com/intel/metrics-discovery/pull/14]
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 instrumentation/metrics_discovery/common/md_internal.cpp | 2 +-
16 1 file changed, 1 insertion(+), 1 deletion(-)
17
18diff --git a/instrumentation/metrics_discovery/common/md_internal.cpp b/instrumentation/metrics_discovery/common/md_internal.cpp
19index f9571ac..0767e81 100644
20--- a/instrumentation/metrics_discovery/common/md_internal.cpp
21+++ b/instrumentation/metrics_discovery/common/md_internal.cpp
22@@ -27,8 +27,8 @@
23 \*****************************************************************************/
24 #include "md_internal.h"
25
26-#include <string.h>
27 #include <stdlib.h>
28+#include <string>
29 #include <new>
30 #include <unordered_map>
31
32--
332.23.0
34
diff --git a/recipes-graphics/metrics-discovery/metrics-discovery_1.5.108.bb b/recipes-graphics/metrics-discovery/metrics-discovery_1.12.170.bb
index da7cb652..3ed1c9bd 100644
--- a/recipes-graphics/metrics-discovery/metrics-discovery_1.5.108.bb
+++ b/recipes-graphics/metrics-discovery/metrics-discovery_1.12.170.bb
@@ -8,9 +8,8 @@ SECTION = "lib"
8inherit pkgconfig cmake 8inherit pkgconfig cmake
9 9
10S = "${WORKDIR}/git" 10S = "${WORKDIR}/git"
11SRCREV = "a495db4682b7318bc82b1cccfb17fafdf2e3a2ff" 11SRCREV = "75b292eb1309e4ea10dce403065ee8ca5bf29ecc"
12SRC_URI = "git://github.com/intel/metrics-discovery.git \ 12SRC_URI = "git://github.com/intel/metrics-discovery.git;branch=master;protocol=https \
13 file://0001-md_internal.h-Replace-string.h-with-string-C-header-.patch \
14 " 13 "
15 14
16EXTRA_OECMAKE += "-DMD_PLATFORM=linux" 15EXTRA_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"
7LIC_FILES_CHKSUM = "file://COPYING;md5=0b8c242f0218eea5caa949b7910a774b" 7LIC_FILES_CHKSUM = "file://COPYING;md5=0b8c242f0218eea5caa949b7910a774b"
8 8
9DEPENDS += "libpciaccess" 9DEPENDS += "libpciaccess"
10XORG_DRIVER_COMPRESSOR = ".tar.gz"
10 11
11SRC_URI[md5sum] = "4f85febe48d51e53624550a96fc9e9ee" 12SRC_URI[sha256sum] = "eeff52178ce2916a0e07b531bb23c8b105826b6e6e6c5f7c90e33f757827a7c7"
12SRC_URI[sha256sum] = "1edbbc55d47d3fd71dec99b15c2483e22738c642623a0fb86ef4a81a9067a2de"
diff --git a/recipes-kernel/intel-ethernet/ixgbe_5.11.3.bb b/recipes-kernel/intel-ethernet/ixgbe_5.19.6.bb
index 73b13c9b..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."
4 4
5HOMEPAGE = "https://sourceforge.net/projects/e1000/" 5HOMEPAGE = "https://sourceforge.net/projects/e1000/"
6SECTION = "kernel/network" 6SECTION = "kernel/network"
7LICENSE = "GPLv2" 7LICENSE = "GPL-2.0-only"
8LIC_FILES_CHKSUM = "file://${WORKDIR}/${BP}/COPYING;md5=a216b4192dc6b777b6f0db560e9a8417" 8LIC_FILES_CHKSUM = "file://${WORKDIR}/${BP}/COPYING;md5=a216b4192dc6b777b6f0db560e9a8417"
9 9
10SRC_URI = "https://sourceforge.net/projects/e1000/files/ixgbe%20stable/${PV}/${BP}.tar.gz \ 10SRC_URI = "https://sourceforge.net/projects/e1000/files/ixgbe%20stable/${PV}/${BP}.tar.gz \
11 " 11 "
12 12
13SRC_URI[sha256sum] = "b7e5de734c406d28ea146366a5cc3b58bb3b6be039977863e4e1b217a8185ae2" 13SRC_URI[sha256sum] = "a844f1fea8064e30b276792455c3b286c1d7af26731e8f865d4a4e9ed1dcf4ab"
14 14
15UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/e1000/files/ixgbe%20stable/" 15UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/e1000/files/ixgbe%20stable/"
16UPSTREAM_CHECK_REGEX = "ixgbe%20stable/(?P<pver>\d+(\.\d+)+)/" 16UPSTREAM_CHECK_REGEX = "ixgbe%20stable/(?P<pver>\d+(\.\d+)+)/"
@@ -19,14 +19,14 @@ CVE_PRODUCT = "linux:linux_kernel_ixgbe"
19 19
20S = "${WORKDIR}/${BP}/src" 20S = "${WORKDIR}/${BP}/src"
21 21
22EXTRA_OEMAKE='KSRC="${STAGING_KERNEL_BUILDDIR}" KVER="${KERNEL_VERSION}" INSTALL_MOD_PATH="${D}"' 22EXTRA_OEMAKE=' KSRC="${STAGING_KERNEL_DIR}" KOBJ="${STAGING_KERNEL_BUILDDIR}" KVER="${KERNEL_VERSION}" INSTALL_MOD_PATH="${D}"'
23 23
24KERNEL_MODULE_AUTOLOAD_append_intel-core2-32 = " ixgbe" 24KERNEL_MODULE_AUTOLOAD:append:intel-core2-32 = " ixgbe"
25KERNEL_MODULE_AUTOLOAD_append_intel-corei7-64 = " ixgbe" 25KERNEL_MODULE_AUTOLOAD:append:intel-corei7-64 = " ixgbe"
26 26
27inherit module 27inherit module
28 28
29do_install_append () { 29do_install:append () {
30 # Install scripts/set_irq_affinity 30 # Install scripts/set_irq_affinity
31 install -d ${D}${sysconfdir}/network 31 install -d ${D}${sysconfdir}/network
32 install -m 0755 ${S}/../scripts/set_irq_affinity ${D}${sysconfdir}/network 32 install -m 0755 ${S}/../scripts/set_irq_affinity ${D}${sysconfdir}/network
@@ -36,6 +36,8 @@ do_install_append () {
36 36
37PACKAGES += "${PN}-script" 37PACKAGES += "${PN}-script"
38 38
39FILES_${PN}-script += "${sysconfdir}/network/set_irq_affinity" 39FILES:${PN}-script += "${sysconfdir}/network/set_irq_affinity"
40 40
41EXCLUDE_FROM_WORLD = "1" 41EXCLUDE_FROM_WORLD = "1"
42
43CVE_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 d1c5f299..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."
7 7
8HOMEPAGE = "https://sourceforge.net/projects/e1000/" 8HOMEPAGE = "https://sourceforge.net/projects/e1000/"
9SECTION = "kernel/network" 9SECTION = "kernel/network"
10LICENSE = "GPLv2" 10LICENSE = "GPL-2.0-only"
11LIC_FILES_CHKSUM = "file://${WORKDIR}/${BP}/COPYING;md5=a216b4192dc6b777b6f0db560e9a8417" 11LIC_FILES_CHKSUM = "file://${WORKDIR}/${BP}/COPYING;md5=a216b4192dc6b777b6f0db560e9a8417"
12 12
13SRC_URI = "https://sourceforge.net/projects/e1000/files/ixgbevf%20stable/${PV}/${BP}.tar.gz \ 13SRC_URI = "https://sourceforge.net/projects/e1000/files/ixgbevf%20stable/${PV}/${BP}.tar.gz \
14 " 14 "
15 15
16SRC_URI[sha256sum] = "0031d09a54af9ecf1216c185e4641e38527643afa09e78d1bd95752e49fe8985" 16SRC_URI[sha256sum] = "90f6cd614008839b6fc748ae0f4ad3503435f8b788318d4f40cfc83c7029025e"
17 17
18UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/e1000/files/ixgbevf%20stable/" 18UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/e1000/files/ixgbevf%20stable/"
19UPSTREAM_CHECK_REGEX = "ixgbevf%20stable/(?P<pver>\d+(\.\d+)+)/" 19UPSTREAM_CHECK_REGEX = "ixgbevf%20stable/(?P<pver>\d+(\.\d+)+)/"
@@ -22,14 +22,14 @@ CVE_PRODUCT = "linux:linux_kernel_ixgbe"
22 22
23S = "${WORKDIR}/${BP}/src" 23S = "${WORKDIR}/${BP}/src"
24 24
25EXTRA_OEMAKE='KSRC="${STAGING_KERNEL_BUILDDIR}" KVER="${KERNEL_VERSION}" INSTALL_MOD_PATH="${D}"' 25EXTRA_OEMAKE='KSRC="${STAGING_KERNEL_DIR}" KOBJ="${STAGING_KERNEL_BUILDDIR}" KVER="${KERNEL_VERSION}" INSTALL_MOD_PATH="${D}"'
26 26
27KERNEL_MODULE_AUTOLOAD_append_intel-core2-32 = " ixgbevf" 27KERNEL_MODULE_AUTOLOAD:append:intel-core2-32 = " ixgbevf"
28KERNEL_MODULE_AUTOLOAD_append_intel-corei7-64 = " ixgbevf" 28KERNEL_MODULE_AUTOLOAD:append:intel-corei7-64 = " ixgbevf"
29 29
30inherit module 30inherit module
31 31
32do_install_append () { 32do_install:append () {
33 # Install scripts/set_irq_affinity 33 # Install scripts/set_irq_affinity
34 install -d ${D}${sysconfdir}/network 34 install -d ${D}${sysconfdir}/network
35 install -m 0755 ${S}/../scripts/set_irq_affinity ${D}${sysconfdir}/network 35 install -m 0755 ${S}/../scripts/set_irq_affinity ${D}${sysconfdir}/network
@@ -39,4 +39,8 @@ do_install_append () {
39 39
40PACKAGES += "${PN}-script" 40PACKAGES += "${PN}-script"
41 41
42FILES_${PN}-script += "${sysconfdir}/network/set_irq_affinity" 42FILES:${PN}-script += "${sysconfdir}/network/set_irq_affinity"
43
44CVE_STATUS[CVE-2015-1142857] = "fixed-version: Fixed from version 4.4-rc1"
45
46EXCLUDE_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 @@
1SUMMARY = "Intel Wireless LinuxCore kernel driver" 1SUMMARY = "Intel Wireless LinuxCore kernel driver"
2DESCRIPTION = "Intel Wireless LinuxCore kernel driver" 2DESCRIPTION = "Intel Wireless LinuxCore kernel driver"
3SECTION = "kernel" 3SECTION = "kernel"
4LICENSE = "GPL-2.0" 4LICENSE = "GPL-2.0-only"
5 5
6REQUIRED_DISTRO_FEATURES = "wifi" 6REQUIRED_DISTRO_FEATURES = "wifi"
7 7
8LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=bbea815ee2795b2f4230826c0c6b8814" 8LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
9 9
10inherit module 10inherit module features_check
11 11
12# For some iwfwifi LinuxCore supported wireless chips, the best/latest 12# For some iwfwifi LinuxCore supported wireless chips, the best/latest
13# firmware blobs are found in the iwlwifi's linux-firmware.git fork. 13# firmware blobs are found in the iwlwifi's linux-firmware.git fork.
@@ -17,8 +17,8 @@ inherit module
17# When updating this recipe, ensure that the proper firmware is included from 17# When updating this recipe, ensure that the proper firmware is included from
18# either the linux-firmware or iwlwifi-firmware repos. 18# either the linux-firmware or iwlwifi-firmware repos.
19 19
20PV = "45" 20PV = "79"
21SRCREV = "a75c1de6b3fa87885556c67619429cfa87cc048f" 21SRCREV = "574631d89d736fd2c76b0e2ea489270c50903e52"
22 22
23SRC_URI = " \ 23SRC_URI = " \
24 git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/backport-iwlwifi;branch=release/core${PV} \ 24 git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/backport-iwlwifi;branch=release/core${PV} \
@@ -36,16 +36,18 @@ do_configure() {
36 36
37MODULES_INSTALL_TARGET="install" 37MODULES_INSTALL_TARGET="install"
38 38
39do_install_append() { 39do_install:append() {
40 ## install configs and service scripts 40 ## install configs and service scripts
41 install -d ${D}${sysconfdir}/modprobe.d 41 install -d ${D}${sysconfdir}/modprobe.d
42 install -m 0644 ${WORKDIR}/iwlwifi.conf ${D}${sysconfdir}/modprobe.d 42 install -m 0644 ${WORKDIR}/iwlwifi.conf ${D}${sysconfdir}/modprobe.d
43} 43}
44 44
45RDEPENDS_${PN} = "linux-firmware-iwlwifi" 45RDEPENDS:${PN} = "linux-firmware-iwlwifi"
46 46
47KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " iwlwifi" 47FILES:${PN} += "${sysconfdir}/modprobe.d/iwlwifi.conf"
48KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " iwlwifi" 48
49KERNEL_MODULE_AUTOLOAD:append:core2-32-intel-common = " iwlwifi"
50KERNEL_MODULE_AUTOLOAD:append:corei7-64-intel-common = " iwlwifi"
49 51
50KERNEL_MODULE_PACKAGE_PREFIX = "backport-iwlwifi" 52KERNEL_MODULE_PACKAGE_PREFIX = "backport-iwlwifi"
51 53
diff --git a/recipes-kernel/linux/linux-intel-dev.bb b/recipes-kernel/linux/linux-intel-dev.bb
deleted file mode 100644
index f99b1f19..00000000
--- a/recipes-kernel/linux/linux-intel-dev.bb
+++ /dev/null
@@ -1,34 +0,0 @@
1require recipes-kernel/linux/linux-yocto.inc
2require recipes-kernel/linux/meta-intel-compat-kernel.inc
3
4FILESEXTRAPATHS_prepend := "${THISDIR}/linux-intel:"
5
6SRC_URI = " \
7 git://github.com/intel/mainline-tracking.git;protocol=https;name=machine;nobranch=1; \
8 git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=${KMETA_BRANCH};destsuffix=${KMETA} \
9 file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch \
10 "
11SRC_URI_append_core2-32-intel-common = " file://disable_skylake_sound.cfg"
12
13KMETA = "kernel-meta"
14KCONF_BSP_AUDIT_LEVEL = "2"
15
16KMETA_BRANCH = "master"
17
18LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
19
20DEPENDS += "elfutils-native openssl-native util-linux-native"
21
22LINUX_VERSION ?= "5.11-rc6"
23SRCREV_machine ?= "1048ba83fb1c00cd24172e23e8263972f6b5d9ac"
24SRCREV_meta ?= "3356fb62fb5eadec1f5c3c4248f1f8dbab968aa1"
25
26LINUX_VERSION_EXTENSION ?= "-mainline-tracking-${LINUX_KERNEL_TYPE}"
27PV = "${LINUX_VERSION}+git${SRCPV}"
28
29COMPATIBLE_MACHINE ?= "(intel-corei7-64|intel-core2-32)"
30
31# Functionality flags
32KERNEL_FEATURES_append = " ${KERNEL_EXTRA_FEATURES}"
33KERNEL_FEATURES_append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "" ,d)}"
34KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/security/security.scc"
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 6b61e168..00000000
--- a/recipes-kernel/linux/linux-intel-rt_5.4.bb
+++ /dev/null
@@ -1,30 +0,0 @@
1require linux-intel.inc
2
3# Skip processing of this recipe if it is not explicitly specified as the
4# PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying
5# to build multiple virtual/kernel providers, e.g. as dependency of
6# core-image-rt-sdk, core-image-rt.
7python () {
8 if d.getVar("KERNEL_PACKAGE_NAME", True) == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != "linux-intel-rt":
9 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-intel-rt to enable it")
10}
11
12LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
13SRC_URI_append = " file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch \
14"
15
16KBRANCH = "5.4/preempt-rt"
17KMETA_BRANCH = "yocto-5.4"
18
19DEPENDS += "elfutils-native openssl-native util-linux-native"
20
21LINUX_VERSION ?= "5.4.102"
22SRCREV_machine ?= "7bbaa89ee7f0cb8e912e52b17247d0c0a7b2db15"
23SRCREV_meta ?= "19738ca97b999a3b150e2d34232bb44b6537348f"
24
25LINUX_KERNEL_TYPE = "preempt-rt"
26
27# Kernel config 'CONFIG_GPIO_LYNXPOINT' goes by a different name 'CONFIG_PINCTRL_LYNXPOINT' in
28# linux-intel 5.4 specifically. This cause annoying warning during kernel config audit. So suppress the
29# harmless warning for now.
30KCONF_BSP_AUDIT_LEVEL = "0"
diff --git a/recipes-kernel/linux/linux-intel-rt_5.10.bb b/recipes-kernel/linux/linux-intel-rt_6.6.bb
index 7d67fb0a..23e79a43 100644
--- a/recipes-kernel/linux/linux-intel-rt_5.10.bb
+++ b/recipes-kernel/linux/linux-intel-rt_6.6.bb
@@ -1,5 +1,8 @@
1require linux-intel.inc 1require linux-intel.inc
2 2
3SRC_URI:prepend = "git://github.com/intel/linux-intel-lts.git;protocol=https;name=machine;branch=${KBRANCH}; \
4 "
5
3# Skip processing of this recipe if it is not explicitly specified as the 6# Skip processing of this recipe if it is not explicitly specified as the
4# PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying 7# PREFERRED_PROVIDER for virtual/kernel. This avoids errors when trying
5# to build multiple virtual/kernel providers, e.g. as dependency of 8# to build multiple virtual/kernel providers, e.g. as dependency of
@@ -9,17 +12,22 @@ python () {
9 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-intel-rt to enable it") 12 raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-intel-rt to enable it")
10} 13}
11 14
12LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" 15KBRANCH = "6.6/preempt-rt"
13SRC_URI_append = " file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch \ 16KMETA_BRANCH = "yocto-6.6"
14 "
15 17
16KBRANCH = "5.10/preempt-rt" 18LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
17KMETA_BRANCH = "yocto-5.10"
18 19
19DEPENDS += "elfutils-native openssl-native util-linux-native" 20DEPENDS += "elfutils-native openssl-native util-linux-native"
20 21
21LINUX_VERSION ?= "5.10.21" 22LINUX_VERSION_EXTENSION ??= "-intel-pk-${LINUX_KERNEL_TYPE}"
22SRCREV_machine ?= "774cd893ee3f4044305e0a7bf5090e32b72578b3" 23
23SRCREV_meta ?= "eb09284047fec2f09d62068c338ae320c6681bd1" 24LINUX_VERSION ?= "6.6.23"
25SRCREV_machine ?= "73113409624a0a68494db7b1c1d535d1c8b96689"
26SRCREV_meta ?= "eb283ea577df80542d48f0c498365960b4c4ecd9"
24 27
25LINUX_KERNEL_TYPE = "preempt-rt" 28LINUX_KERNEL_TYPE = "preempt-rt"
29
30# Functionality flags
31KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/security/security.scc"
32
33UPSTREAM_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 @@
1require recipes-kernel/linux/linux-yocto.inc 1require recipes-kernel/linux/linux-yocto.inc
2require recipes-kernel/linux/meta-intel-compat-kernel.inc 2require recipes-kernel/linux/meta-intel-compat-kernel.inc
3 3
4FILESEXTRAPATHS_prepend := "${THISDIR}/linux-intel:" 4FILESEXTRAPATHS:prepend := "${THISDIR}/linux-intel:"
5 5
6KERNEL_CONFIG_URI ?= "git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=${KMETA_BRANCH};destsuffix=${KMETA}" 6KERNEL_CONFIG_URI ?= "git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=${KMETA_BRANCH};destsuffix=${KMETA}"
7 7
8SRC_URI = " \ 8SRC_URI = " \
9 git://github.com/intel/linux-intel-lts.git;protocol=https;name=machine;branch=${KBRANCH}; \
10 ${KERNEL_CONFIG_URI} \ 9 ${KERNEL_CONFIG_URI} \
10 file://0001-vt-conmakehash-improve-reproducibility.patch \
11 file://0001-lib-build_OID_registry-fix-reproducibility-issues.patch \
12 file://fix-perf-reproducibility.patch \
13 file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch \
14 file://0002-mconf-fix-output-of-cflags-and-libraries.patch \
11 " 15 "
12 16
13SRC_URI_append = " file://enable_lynxpoint_gpio.cfg"
14SRC_URI_append_core2-32-intel-common = " file://disable_skylake_sound.cfg"
15
16LINUX_VERSION_EXTENSION ??= "-intel-pk-${LINUX_KERNEL_TYPE}"
17
18PV = "${LINUX_VERSION}+git${SRCPV}" 17PV = "${LINUX_VERSION}+git${SRCPV}"
19 18
20KMETA = "kernel-meta" 19KMETA = "kernel-meta"
21KCONF_BSP_AUDIT_LEVEL = "2" 20KCONF_BSP_AUDIT_LEVEL = "0"
22 21
23COMPATIBLE_MACHINE ?= "(intel-corei7-64|intel-core2-32)" 22COMPATIBLE_MACHINE ?= "(intel-corei7-64)"
24 23
25KERNEL_FEATURES_append = " ${KERNEL_EXTRA_FEATURES}" 24KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}"
26KERNEL_FEATURES_append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "" ,d)}"
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 @@
1From 2fca0fd719812ea2ff67630b01355aa80481623e Mon Sep 17 00:00:00 2001
2From: Bruce Ashfield <bruce.ashfield@gmail.com>
3Date: Sun, 10 Jul 2022 22:56:53 -0400
4Subject: [PATCH] lib/build_OID_registry: fix reproducibility issues
5
6The script build_OID_registry captures the full path of itself
7in the generated data. This causes reproduciblity issues as the
8path is captured and packaged.
9
10We use the basename of the script instead, and that allows us
11to be reprodicible, with slightly less information captured in
12the output data (but the generating script can still easily
13be found).
14
15Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
16Upstream-Status: Inappropriate
17
18Taken from linux-yocto, v5.15/standard/base.
19
20Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
21---
22 lib/build_OID_registry | 3 ++-
23 1 file changed, 2 insertions(+), 1 deletion(-)
24
25diff --git a/lib/build_OID_registry b/lib/build_OID_registry
26index d7fc32ea8ac2..f6de0a7f7457 100755
27--- a/lib/build_OID_registry
28+++ b/lib/build_OID_registry
29@@ -8,6 +8,7 @@
30 #
31
32 use strict;
33+use File::Basename;
34
35 my @names = ();
36 my @oids = ();
37@@ -35,7 +36,7 @@ close IN_FILE || die;
38 #
39 open C_FILE, ">$ARGV[1]" or die;
40 print C_FILE "/*\n";
41-print C_FILE " * Automatically generated by ", $0, ". Do not edit\n";
42+print C_FILE " * Automatically generated by ", basename $0, ". Do not edit\n";
43 print C_FILE " */\n";
44
45 #
46--
472.36.1
48
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 @@
1From bebd63730a433ba62549a80114a9851328aa8897 Mon Sep 17 00:00:00 2001 1From 1811da09f42ca5e82282970e8ad014707bc94c82 Mon Sep 17 00:00:00 2001
2From: Bruce Ashfield <bruce.ashfield@windriver.com> 2From: Bruce Ashfield <bruce.ashfield@windriver.com>
3Date: Mon, 2 Jul 2018 23:10:28 -0400 3Date: Mon, 2 Jul 2018 23:10:28 -0400
4Subject: [PATCH] menuconfig,mconf-cfg: Allow specification of ncurses location 4Subject: [PATCH 1/2] menuconfig,mconf-cfg: Allow specification of ncurses
5 location
5 6
6In some cross build environments such as the Yocto Project build 7In some cross build environments such as the Yocto Project build
7environment it provides an ncurses library that is compiled 8environment it provides an ncurses library that is compiled
@@ -16,33 +17,36 @@ check-lxdialog.sh for environments such as the Yocto Project. Adding
16a CROSS_CURSES_LIB and CROSS_CURSES_INC solves the issue and allowing 17a CROSS_CURSES_LIB and CROSS_CURSES_INC solves the issue and allowing
17compiling and linking against the right headers and libraries. 18compiling and linking against the right headers and libraries.
18 19
20Upstream-Status: Submitted
21
19Signed-off-by: Jason Wessel <jason.wessel@windriver.com> 22Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
20cc: Michal Marek <mmarek@suse.cz> 23cc: Michal Marek <mmarek@suse.cz>
21cc: linux-kbuild@vger.kernel.org 24cc: linux-kbuild@vger.kernel.org
22Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> 25Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
26Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
23--- 27---
24 scripts/kconfig/mconf-cfg.sh | 8 ++++++++ 28 scripts/kconfig/mconf-cfg.sh | 8 ++++++++
25 1 file changed, 8 insertions(+) 29 1 file changed, 8 insertions(+)
26 30
27diff --git a/scripts/kconfig/mconf-cfg.sh b/scripts/kconfig/mconf-cfg.sh 31diff --git a/scripts/kconfig/mconf-cfg.sh b/scripts/kconfig/mconf-cfg.sh
28index c812872d7f9d..42d20819025c 100755 32index 1e61f50a5905..38cf8304bb31 100755
29--- a/scripts/kconfig/mconf-cfg.sh 33--- a/scripts/kconfig/mconf-cfg.sh
30+++ b/scripts/kconfig/mconf-cfg.sh 34+++ b/scripts/kconfig/mconf-cfg.sh
31@@ -4,6 +4,14 @@ 35@@ -7,6 +7,14 @@ libs=$2
32 PKG="ncursesw" 36 PKG="ncursesw"
33 PKG2="ncurses" 37 PKG2="ncurses"
34 38
35+if [ "$CROSS_CURSES_LIB" != "" ]; then 39+if [ "$CROSS_CURSES_LIB" != "" ]; then
36+ echo libs=\'$CROSS_CURSES_LIB\' 40+ echo libs=\'$CROSS_CURSES_LIB\'
37+ if [ x"$CROSS_CURSES_INC" != x ]; then 41+ if [ x"$CROSS_CURSES_INC" != x ]; then
38+ echo cflags=\'$CROSS_CURSES_INC\' 42+ echo cflags=\'$CROSS_CURSES_INC\'
39+ fi 43+ fi
40+ exit 0 44+ exit 0
41+fi 45+fi
42+ 46+
43 if [ -n "$(command -v pkg-config)" ]; then 47 if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then
44 if pkg-config --exists $PKG; then 48 if ${HOSTPKG_CONFIG} --exists $PKG; then
45 echo cflags=\"$(pkg-config --cflags $PKG)\" 49 ${HOSTPKG_CONFIG} --cflags ${PKG} > ${cflags}
46-- 50--
472.17.1 512.34.1
48 52
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 @@
1From 0f586f4ee8adacac79b64d1f3d47799a5eb7fbea Mon Sep 17 00:00:00 2001
2From: Bruce Ashfield <bruce.ashfield@gmail.com>
3Date: Sun, 10 Jul 2022 21:37:07 -0400
4Subject: [PATCH] vt/conmakehash: improve reproducibility
5
6The file generated by conmakehash capture the application
7path used to generate the file. While that can be informative,
8it varies based on where the kernel was built, as the full
9path is captured.
10
11We tweak the application to use a second input as the "capture
12name", and then modify the Makefile to pass the basename of
13the source, making it reproducible.
14
15This could be improved by using some sort of path mapping,
16or the application manipualing argv[1] itself, but for now
17this solves the reprodicibility issue.
18
19Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
20
21Upstream-Status: Inappropriate
22
23Taken from linux-yocto, v5.15/standard/base
24Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
25---
26 drivers/tty/vt/Makefile | 2 +-
27 drivers/tty/vt/conmakehash.c | 2 +-
28 2 files changed, 2 insertions(+), 2 deletions(-)
29
30diff --git a/drivers/tty/vt/Makefile b/drivers/tty/vt/Makefile
31index fe30ce512819..cb51c21b58f9 100644
32--- a/drivers/tty/vt/Makefile
33+++ b/drivers/tty/vt/Makefile
34@@ -15,7 +15,7 @@ clean-files := consolemap_deftbl.c defkeymap.c
35 hostprogs += conmakehash
36
37 quiet_cmd_conmk = CONMK $@
38- cmd_conmk = $(obj)/conmakehash $< > $@
39+ cmd_conmk = $(obj)/conmakehash $< $(shell basename $<) > $@
40
41 $(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE) $(obj)/conmakehash
42 $(call cmd,conmk)
43diff --git a/drivers/tty/vt/conmakehash.c b/drivers/tty/vt/conmakehash.c
44index cddd789fe46e..d62510b280e9 100644
45--- a/drivers/tty/vt/conmakehash.c
46+++ b/drivers/tty/vt/conmakehash.c
47@@ -253,7 +253,7 @@ int main(int argc, char *argv[])
48 #include <linux/types.h>\n\
49 \n\
50 u8 dfont_unicount[%d] = \n\
51-{\n\t", argv[1], fontlen);
52+{\n\t", argv[2], fontlen);
53
54 for ( i = 0 ; i < fontlen ; i++ )
55 {
56--
572.36.1
58
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 @@
1From 1b53d82a8152843afcddd7f16b0c43b6b4f22895 Mon Sep 17 00:00:00 2001
2From: Bruce Ashfield <bruce.ashfield@gmail.com>
3Date: Mon, 17 Jul 2023 17:17:55 -0400
4Subject: [PATCH 2/2] mconf: fix output of cflags and libraries
5
6commit 3122c84409d578a5df8bcb1 [kconfig: refactor Makefile to reduce
7process forks] changes the way that flags are detected. They are
8no longer just echo'd and captured, they are written to a file and
9later read.
10
11We adjust our CROSS ncurses patch accordingly.
12
13We'll eventually be able to drop this patch, but not quite yet.
14
15Upstream-Status: Inappropriate [OE-Specific]
16Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
17Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
18---
19 scripts/kconfig/mconf-cfg.sh | 4 ++--
20 1 file changed, 2 insertions(+), 2 deletions(-)
21
22diff --git a/scripts/kconfig/mconf-cfg.sh b/scripts/kconfig/mconf-cfg.sh
23index 38cf8304bb31..a5ae56e08b07 100755
24--- a/scripts/kconfig/mconf-cfg.sh
25+++ b/scripts/kconfig/mconf-cfg.sh
26@@ -8,9 +8,9 @@ PKG="ncursesw"
27 PKG2="ncurses"
28
29 if [ "$CROSS_CURSES_LIB" != "" ]; then
30- echo libs=\'$CROSS_CURSES_LIB\'
31+ echo $CROSS_CURSES_LIB > ${libs}
32 if [ x"$CROSS_CURSES_INC" != x ]; then
33- echo cflags=\'$CROSS_CURSES_INC\'
34+ echo $CROSS_CURSES_INC > ${cflags}
35 fi
36 exit 0
37 fi
38--
392.34.1
40
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 @@
1# CONFIG_SND_SOC_INTEL_SKYLAKE is not set
2# CONFIG_SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH is not set
3# CONFIG_SND_SOC_INTEL_BXT_RT298_MACH is not set
4# CONFIG_SND_SOC_INTEL_KBL_RT5663_MAX98927_MACH is not set
5# CONFIG_SND_SOC_INTEL_SKL_RT286_MACH is not set
6# CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH is not set
7# 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 @@
1CONFIG_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 @@
1From b8cd0e429bf75b673c438a8277d4bc74327df992 Mon Sep 17 00:00:00 2001
2From: Tom Zanussi <tom.zanussi@intel.com>
3Date: Tue, 3 Jul 2012 13:07:23 -0500
4Subject: perf: change --root to --prefix for python install
5
6Otherwise we get the sysroot path appended to the build path, not what
7we want.
8
9Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
10
11Upstream-Status: Inappropriate
12
13Taken from linux-yocto, v5.15/standard/base
14https://git.yoctoproject.org/linux-yocto/commit?id=b8cd0e429bf75b673c438a8277d4bc74327df992&h=v5.15%2Fstandard%2Fbase
15
16Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
17---
18 tools/perf/Makefile.perf | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21(limited to 'tools/perf/Makefile.perf')
22
23diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
24index 8f738e11356d..ee945d8e3996 100644
25--- a/tools/perf/Makefile.perf
26+++ b/tools/perf/Makefile.perf
27@@ -1022,7 +1022,7 @@ install-bin: install-tools install-tests install-traceevent-plugins
28 install: install-bin try-install-man
29
30 install-python_ext:
31- $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
32+ $(PYTHON_WORD) util/setup.py --quiet install --prefix='$(DESTDIR_SQ)/usr'
33
34 # 'make install-doc' should call 'make -C Documentation install'
35 $(INSTALL_DOC_TARGETS):
36--
37cgit
38
39
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 399ab014..00000000
--- a/recipes-kernel/linux/linux-intel_5.10.bb
+++ /dev/null
@@ -1,22 +0,0 @@
1require linux-intel.inc
2
3KBRANCH = "5.10/yocto"
4KMETA_BRANCH = "yocto-5.10"
5
6LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
7
8SRC_URI_append = " file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch \
9 "
10
11DEPENDS += "elfutils-native openssl-native util-linux-native"
12
13LINUX_VERSION ?= "5.10.25"
14SRCREV_machine ?= "7c8f517558810be0c9470f78a06f9c8b909157b4"
15SRCREV_meta ?= "eb09284047fec2f09d62068c338ae320c6681bd1"
16
17# For Crystalforest and Romley
18KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " uio"
19KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " uio"
20
21# Functionality flags
22KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/security/security.scc"
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 5b8a4457..00000000
--- a/recipes-kernel/linux/linux-intel_5.4.bb
+++ /dev/null
@@ -1,26 +0,0 @@
1require linux-intel.inc
2
3KBRANCH = "5.4/yocto"
4KMETA_BRANCH = "yocto-5.4"
5
6LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
7
8SRC_URI_append = " file://0001-menuconfig-mconf-cfg-Allow-specification-of-ncurses-.patch"
9
10DEPENDS += "elfutils-native openssl-native util-linux-native"
11
12LINUX_VERSION ?= "5.4.106"
13SRCREV_machine ?= "4dbe3697c9b89500917d5b6ff3a42b7af769de00"
14SRCREV_meta ?= "19738ca97b999a3b150e2d34232bb44b6537348f"
15
16# For Crystalforest and Romley
17KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " uio"
18KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " uio"
19
20# Functionality flags
21KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/security/security.scc"
22
23# Kernel config 'CONFIG_GPIO_LYNXPOINT' goes by a different name 'CONFIG_PINCTRL_LYNXPOINT' in
24# linux-intel 5.4 specifically. This cause warning during kernel config audit. So suppress the
25# harmless warning for now.
26KCONF_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..0d914b73
--- /dev/null
+++ b/recipes-kernel/linux/linux-intel_6.6.bb
@@ -0,0 +1,21 @@
1require linux-intel.inc
2
3SRC_URI:prepend = "git://github.com/intel/linux-intel-lts.git;protocol=https;name=machine;branch=${KBRANCH}; \
4 "
5KBRANCH = "6.6/linux"
6KMETA_BRANCH = "yocto-6.6"
7
8LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
9
10DEPENDS += "elfutils-native openssl-native util-linux-native"
11
12LINUX_VERSION_EXTENSION ??= "-intel-pk-${LINUX_KERNEL_TYPE}"
13
14LINUX_VERSION ?= "6.6.23"
15SRCREV_machine ?= "lts-v6.6.23-linux-240407T055600Z"
16SRCREV_meta ?= "eb283ea577df80542d48f0c498365960b4c4ecd9"
17
18# Functionality flags
19KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/security/security.scc"
20
21UPSTREAM_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 @@
1require linux-intel.inc
2
3SRC_URI:prepend = "git://github.com/intel/mainline-tracking.git;protocol=https;name=machine;nobranch=1; \
4 "
5KMETA_BRANCH = "master"
6
7LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
8
9DEPENDS += "elfutils-native openssl-native util-linux-native"
10
11LINUX_VERSION_EXTENSION ??= "-mainline-tracking-${LINUX_KERNEL_TYPE}"
12
13LINUX_VERSION ?= "6.8"
14SRCREV_machine ?= "efbae83db36abbbbdb946d4f7bbdfda174107cd2"
15SRCREV_meta ?= "27907f391a4fc508da21358b13419c6e86926c34"
16
17# Functionality flags
18KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc features/security/security.scc"
19
20UPSTREAM_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 @@
1FILESEXTRAPATHS_prepend_intel-x86-common := "${THISDIR}/${PN}:" 1FILESEXTRAPATHS:prepend:intel-x86-common := "${THISDIR}/${PN}:"
2 2
3COMPATIBLE_MACHINE_core2-32-intel-common = "${MACHINE}" 3COMPATIBLE_MACHINE:core2-32-intel-common = "${MACHINE}"
4KMACHINE_core2-32-intel-common = "intel-core2-32" 4KMACHINE:core2-32-intel-common = "intel-core2-32"
5KERNEL_FEATURES_append_core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" 5KERNEL_FEATURES:append:core2-32-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}"
6 6
7COMPATIBLE_MACHINE_corei7-64-intel-common = "${MACHINE}" 7COMPATIBLE_MACHINE:corei7-64-intel-common = "${MACHINE}"
8KMACHINE_corei7-64-intel-common = "intel-corei7-64" 8KMACHINE:corei7-64-intel-common = "intel-corei7-64"
9KERNEL_FEATURES_append_corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}" 9KERNEL_FEATURES:append:corei7-64-intel-common = "${KERNEL_FEATURES_INTEL_COMMON}"
10 10
11# NOTE: We do not set SRCREVs here as -dev is intended to be built with AUTOREV 11# NOTE: We do not set SRCREVs here as -dev is intended to be built with AUTOREV
12# and setting them here breaks the default mechanism to use AUTOREV if the 12# and setting them here breaks the default mechanism to use AUTOREV if the
13# default SRCREV is set and linux-yocto-dev is the preferred provider. 13# default SRCREV is set and linux-yocto-dev is the preferred provider.
14 14
15# For Crystalforest and Romley 15# For Crystalforest and Romley
16KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " uio" 16KERNEL_MODULE_AUTOLOAD:append:core2-32-intel-common = " uio"
17KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " uio" 17KERNEL_MODULE_AUTOLOAD:append:corei7-64-intel-common = " uio"
18 18
19# For FRI2, NUC 19# For FRI2, NUC
20KERNEL_MODULE_AUTOLOAD_append_core2-32-intel-common = " iwlwifi" 20KERNEL_MODULE_AUTOLOAD:append:core2-32-intel-common = " iwlwifi"
21KERNEL_MODULE_AUTOLOAD_append_corei7-64-intel-common = " iwlwifi" 21KERNEL_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 @@
1require meta-intel-compat-kernel.inc
2
1# The kernel build is 64-bit regardless, so include both common overrides. 3# The kernel build is 64-bit regardless, so include both common overrides.
2# Without this, the kernel will be missing vars that make it buildable for the 4# Without this, the kernel will be missing vars that make it buildable for the
3# intel-corei7-64 machine. 5# intel-corei7-64 machine.
4MACHINEOVERRIDES_prepend_corei7-64-x32-intel-common = "corei7-64-intel-common:" 6MACHINEOVERRIDES: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 @@
1require 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 @@
3 3
4KERNEL_FEATURES_INTEL_COMMON ?= "" 4KERNEL_FEATURES_INTEL_COMMON ?= ""
5 5
6COMPATIBLE_MACHINE_intel-x86-common = "${MACHINE}" 6COMPATIBLE_MACHINE:intel-x86-common = "${MACHINE}"
7KERNEL_FEATURES_intel-x86-common = "${KERNEL_FEATURES_INTEL_COMMON}" 7KERNEL_FEATURES:intel-x86-common = "${KERNEL_FEATURES_INTEL_COMMON}"
8 8
9KMACHINE_corei7-64-intel-common = "intel-corei7-64" 9KMACHINE:corei7-64-intel-common = "intel-corei7-64"
10KMACHINE_core2-32-intel-common = "intel-core2-32" 10KMACHINE:core2-32-intel-common = "intel-core2-32"
11KMACHINE_skylake-64-intel-common = "intel-corei7-64" 11KMACHINE:x86-64-v3-intel-common = "intel-corei7-64"
12 12
13INTEL_COMMON_AUTOLOAD ?= " uio iwlwifi i915" 13INTEL_COMMON_AUTOLOAD ?= " uio iwlwifi i915"
14KERNEL_MODULE_AUTOLOAD_intel-x86-common = " ${INTEL_COMMON_AUTOLOAD}" 14KERNEL_MODULE_AUTOLOAD:intel-x86-common = " ${INTEL_COMMON_AUTOLOAD}"
diff --git a/recipes-multimedia/itt/itt_3.18.10.bb b/recipes-multimedia/itt/itt_3.24.6.bb
index c410977b..1c4759f9 100644
--- a/recipes-multimedia/itt/itt_3.18.10.bb
+++ b/recipes-multimedia/itt/itt_3.24.6.bb
@@ -3,18 +3,20 @@ DESCRIPTION = "The Instrumentation and Tracing Technology (ITT) API enables \
3application to generate and control the collection of trace data during its \ 3application to generate and control the collection of trace data during its \
4execution across different Intel tools." 4execution across different Intel tools."
5 5
6LICENSE = "BSD-3-Clause & GPLv2" 6LICENSE = "BSD-3-Clause & GPL-2.0-only"
7LIC_FILES_CHKSUM = "file://LICENSES/BSD-3-Clause.txt;md5=c551872bcf41ce707df54c722edeca7b \ 7LIC_FILES_CHKSUM = "file://LICENSES/BSD-3-Clause.txt;md5=c551872bcf41ce707df54c722edeca7b \
8 file://LICENSES/GPL-2.0-only.txt;md5=e2d76e7801260c21b90eea3605508ad6 \ 8 file://LICENSES/GPL-2.0-only.txt;md5=e2d76e7801260c21b90eea3605508ad6 \
9 " 9 "
10 10
11SRC_URI = "git://github.com/intel/ittapi.git;protocol=https" 11SRC_URI = "git://github.com/intel/ittapi.git;protocol=https;branch=master"
12SRCREV = "66ebaee7a44fcdfb6ae052beb9507318781f3cd0" 12SRCREV = "ec077431fc725dba590b09b2cec5137878b14783"
13S = "${WORKDIR}/git" 13S = "${WORKDIR}/git"
14PE = "1" 14PE = "1"
15 15
16UPSTREAM_CHECK_GITTAGREGEX = "^v(?P<pver>(\d+(\.\d+)+))$" 16UPSTREAM_CHECK_GITTAGREGEX = "^v(?P<pver>(\d+(\.\d+)+))$"
17 17
18COMPATIBLE_HOST = '(i.86|x86_64).*-linux'
19
18inherit pkgconfig cmake 20inherit pkgconfig cmake
19 21
20EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=Release" 22EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=Release"
@@ -34,4 +36,4 @@ do_install() {
34 36
35} 37}
36 38
37RDEPENDS_${PN}-dev_remove = "${PN} (= ${EXTENDPKGV})" 39RDEPENDS:${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 @@
1From 1b303f417113ad1aa6b63fc024fbe4aa0c943f57 Mon Sep 17 00:00:00 2001
2From: Lim Siew Hoon <siew.hoon.lim@intel.com>
3Date: Tue, 5 Sep 2023 16:13:42 +0800
4Subject: [PATCH 01/12] Disable vp9 padding on mtl.
5
6Upstream-Status: Submitted [https://github.com/intel/media-driver/pull/1720]
7
8Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
9---
10 media_softlet/linux/Xe_M_plus/ddi/media_sku_wa_mtl.cpp | 4 ++--
11 1 file changed, 2 insertions(+), 2 deletions(-)
12
13diff --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
14index 844545a87..72265289c 100644
15--- a/media_softlet/linux/Xe_M_plus/ddi/media_sku_wa_mtl.cpp
16+++ b/media_softlet/linux/Xe_M_plus/ddi/media_sku_wa_mtl.cpp
17@@ -284,7 +284,7 @@ static bool InitMtlMediaWaExt(struct GfxDeviceInfo *devInfo,
18
19 MEDIA_WR_WA(waTable, WaDisableSetObjectCapture, 1);
20
21- MEDIA_WR_WA(waTable, Wa_Vp9UnalignedHeight, 1);
22+ MEDIA_WR_WA(waTable, Wa_Vp9UnalignedHeight, 0);
23
24 MEDIA_WR_WA(waTable, Wa_15013355402, 1);
25
26@@ -337,4 +337,4 @@ static struct LinuxDeviceInit arlDeviceInit =
27 };
28
29 static bool arlDeviceRegister = DeviceInfoFactory<LinuxDeviceInit>::
30- RegisterDevice((uint32_t)IGFX_ARROWLAKE, &arlDeviceInit);
31\ No newline at end of file
32+ RegisterDevice((uint32_t)IGFX_ARROWLAKE, &arlDeviceInit);
33--
342.40.1
35
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 @@
1From 1580f01ec5ad5afdad58c39dded999494275be10 Mon Sep 17 00:00:00 2001
2From: Lim Siew Hoon <siew.hoon.lim@intel.com>
3Date: Wed, 11 Oct 2023 15:36:21 +0800
4Subject: [PATCH 02/12] Force ARGB surface to tile4 for ACM
5
6Upstream-Status: Submitted [https://github.com/intel/media-driver/pull/1728]
7
8Signed-off-by: Soon, Thean Siew <thean.siew.soon@intel.com>
9Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
10---
11 media_driver/linux/common/ddi/media_libva_util.cpp | 10 ++++++++++
12 1 file changed, 10 insertions(+)
13
14diff --git a/media_driver/linux/common/ddi/media_libva_util.cpp b/media_driver/linux/common/ddi/media_libva_util.cpp
15index 63c173419..73be76366 100755
16--- a/media_driver/linux/common/ddi/media_libva_util.cpp
17+++ b/media_driver/linux/common/ddi/media_libva_util.cpp
18@@ -504,6 +504,7 @@ VAStatus DdiMediaUtil_AllocateSurface(
19 gmmCustomParams.Flags.Gpu.UnifiedAuxSurface = 0;
20 }
21 }
22+
23 break;
24 case TILING_X:
25 gmmCustomParams.Flags.Info.TiledX = true;
26@@ -685,6 +686,15 @@ VAStatus DdiMediaUtil_AllocateSurface(
27 }
28 }
29 }
30+ // There's no VAAPI interface for modifier query yet. As a workaround, always allocate
31+ // RGB surface as tile4.
32+ if ((format == Media_Format_A8R8G8B8 ||
33+ format == Media_Format_B10G10R10A2 |
34+ format == Media_Format_A8B8G8R8 ||
35+ format == Media_Format_X8R8G8B8) && !MEDIA_IS_SKU(&mediaDrvCtx->SkuTable, FtrTileY))
36+ {
37+ gmmParams.Flags.Info.Tile4 = true;
38+ }
39 break;
40 case TILING_X:
41 gmmParams.Flags.Info.TiledX = true;
42--
432.40.1
44
diff --git a/recipes-multimedia/libva/files/0004-Add-device-ID-for-ARL.patch b/recipes-multimedia/libva/files/0004-Add-device-ID-for-ARL.patch
new file mode 100644
index 00000000..59fff127
--- /dev/null
+++ b/recipes-multimedia/libva/files/0004-Add-device-ID-for-ARL.patch
@@ -0,0 +1,45 @@
1From bb860c0bfe53060925b1dce50da4e6e94cfc8cae Mon Sep 17 00:00:00 2001
2From: huangli2018 <li.h.huang@intel.com>
3Date: Wed, 20 Dec 2023 15:47:43 +0800
4Subject: [PATCH 04/13] Add device ID for ARL
5
6Add device ID for ARL
7
8Upstream-Status: Backport [https://github.com/intel/media-driver/commit/95cbfce81cafa3c24d9d4601d41a855093bc51fb]
9Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
10---
11 .../linux/Xe_M_plus/ddi/media_sysinfo_mtl.cpp | 13 +++++++++++--
12 1 file changed, 11 insertions(+), 2 deletions(-)
13
14diff --git a/media_softlet/linux/Xe_M_plus/ddi/media_sysinfo_mtl.cpp b/media_softlet/linux/Xe_M_plus/ddi/media_sysinfo_mtl.cpp
15index 426bd795f..7b73dfaff 100644
16--- a/media_softlet/linux/Xe_M_plus/ddi/media_sysinfo_mtl.cpp
17+++ b/media_softlet/linux/Xe_M_plus/ddi/media_sysinfo_mtl.cpp
18@@ -1,6 +1,6 @@
19 /*===================== begin_copyright_notice ==================================
20
21-Copyright (c) 2022, Intel Corporation
22+Copyright (c) 2023, Intel Corporation
23
24 Permission is hereby granted, free of charge, to any person obtaining a
25 copy of this software and associated documentation files (the "Software"),
26@@ -218,4 +218,13 @@ static struct GfxDeviceInfo arlInfo = {
27 };
28
29 static bool arlsDevice7d67 = DeviceInfoFactory<GfxDeviceInfo>::
30- RegisterDevice(0x7D67, &arlInfo);
31\ No newline at end of file
32+ RegisterDevice(0x7D67, &arlInfo);
33+
34+static bool arlhDevice7d51 = DeviceInfoFactory<GfxDeviceInfo>::
35+ RegisterDevice(0x7D51, &arlInfo);
36+
37+static bool arlhDevice7dd1 = DeviceInfoFactory<GfxDeviceInfo>::
38+ RegisterDevice(0x7DD1, &arlInfo);
39+
40+static bool arlhDevice7d41 = DeviceInfoFactory<GfxDeviceInfo>::
41+ RegisterDevice(0x7D41, &arlInfo);
42\ No newline at end of file
43--
442.40.1
45
diff --git a/recipes-multimedia/libva/files/0005-Add-XR24-support-to-DMABuf.patch b/recipes-multimedia/libva/files/0005-Add-XR24-support-to-DMABuf.patch
new file mode 100644
index 00000000..a9cd2317
--- /dev/null
+++ b/recipes-multimedia/libva/files/0005-Add-XR24-support-to-DMABuf.patch
@@ -0,0 +1,34 @@
1From bbd3af94a6146d702909ff7e25b0c0547ecbb895 Mon Sep 17 00:00:00 2001
2From: jlui <jonathan.ming.jun.lui@intel.com>
3Date: Wed, 15 Nov 2023 10:48:34 +0800
4Subject: [PATCH 05/13] Add XR24 support to DMABuf
5
6This is to enable XR24/BGRX support for DMABuf
7
8Signed-off-by: Lui, Jonathan Ming Jun <jonathan.ming.jun.lui@intel.com>
9
10Upstream-Status: Backport [https://github.com/intel/media-driver/commit/3910b7029f5416fd0b5972f940c65d0a82c48c7b]
11
12Signed-off-by: Lim, Siew Hoon <siew.hoon.lim@intel.com>
13---
14 .../vp/ddi/capstable_data_vp_xe_lpm_plus_r0_specific.h | 3 ++-
15 1 file changed, 2 insertions(+), 1 deletion(-)
16
17diff --git a/media_softlet/linux/xe_lpm_plus_r0/vp/ddi/capstable_data_vp_xe_lpm_plus_r0_specific.h b/media_softlet/linux/xe_lpm_plus_r0/vp/ddi/capstable_data_vp_xe_lpm_plus_r0_specific.h
18index fdcca8873..2dcf440a4 100644
19--- a/media_softlet/linux/xe_lpm_plus_r0/vp/ddi/capstable_data_vp_xe_lpm_plus_r0_specific.h
20+++ b/media_softlet/linux/xe_lpm_plus_r0/vp/ddi/capstable_data_vp_xe_lpm_plus_r0_specific.h
21@@ -55,8 +55,9 @@ static ProfileSurfaceAttribInfo surfaceAttribInfo_VAEntrypointVideoProc_VAProfil
22 {VASurfaceAttribPixelFormat, VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE, {VAGenericValueTypeInteger, {VA_FOURCC('4', '2', '2', 'V')}}},
23 {VASurfaceAttribPixelFormat, VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE, {VAGenericValueTypeInteger, {VA_FOURCC('R', 'G', 'B', 'A')}}},
24 {VASurfaceAttribPixelFormat, VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE, {VAGenericValueTypeInteger, {VA_FOURCC('B', 'G', 'R', 'A')}}},
25- {VASurfaceAttribPixelFormat, VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE, {VAGenericValueTypeInteger, { VA_FOURCC('R', 'G', 'B', 'P')}}},
26+ {VASurfaceAttribPixelFormat, VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE, {VAGenericValueTypeInteger, {VA_FOURCC('R', 'G', 'B', 'P')}}},
27 {VASurfaceAttribPixelFormat, VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE, {VAGenericValueTypeInteger, {VA_FOURCC('R', 'G', 'B', 'X')}}},
28+ {VASurfaceAttribPixelFormat, VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE, {VAGenericValueTypeInteger, {VA_FOURCC('X', 'R', 'G', 'B')}}},
29 {VASurfaceAttribPixelFormat, VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE, {VAGenericValueTypeInteger, {VA_FOURCC('P', '0', '1', '0')}}},
30 {VASurfaceAttribPixelFormat, VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE, {VAGenericValueTypeInteger, {VA_FOURCC('R', 'G', '2', '4')}}},
31 {VASurfaceAttribPixelFormat, VA_SURFACE_ATTRIB_GETTABLE | VA_SURFACE_ATTRIB_SETTABLE, {VAGenericValueTypeInteger, {VA_FOURCC_ARGB}}},
32--
332.40.1
34
diff --git a/recipes-multimedia/libva/files/0006-add-INTEL-MEDIA-ALLOC-refineE-to-specify-the-memory-.patch b/recipes-multimedia/libva/files/0006-add-INTEL-MEDIA-ALLOC-refineE-to-specify-the-memory-.patch
new file mode 100644
index 00000000..5b04201a
--- /dev/null
+++ b/recipes-multimedia/libva/files/0006-add-INTEL-MEDIA-ALLOC-refineE-to-specify-the-memory-.patch
@@ -0,0 +1,214 @@
1From 67fb6128adf8fc03d429393e98f0982b42a40e64 Mon Sep 17 00:00:00 2001
2From: Zhang_Xinfeng <carl.zhang@intel.com>
3Date: Wed, 27 Dec 2023 09:59:29 +0800
4Subject: [PATCH 06/12] add INTEL MEDIA ALLOC refineE to specify the memory
5 alignment
6
7this key is used to allocate bigger pages
8env variable INTEL_MEDIA_ALLOC_refineE also could be used
9and was not enabled by default
10mode 0 is default mode
11mode 1 is < 64 align to 64
12mode 2 is > 1M && <= 3M align to 1M, >3M align to 2M
13mode 3 is mode 1 & mode 2
14
15Upstream-Status: Backport [https://github.com/intel/media-driver/commit/765dd939dcc5562d18cca18e5eda505bda952797]
16Signed-off-by: Lim, Siew Hoon <siew.hoon.lim@intel.com>
17---
18 .../linux/common/os/i915/mos_bufmgr.c | 75 +++++++++++++++----
19 .../common/os/i915_production/mos_bufmgr.c | 1 +
20 .../common/os/mos_context_specific_next.cpp | 21 +++++-
21 .../common/os/mos_user_setting_specific.cpp | 7 ++
22 4 files changed, 90 insertions(+), 14 deletions(-)
23
24diff --git a/media_softlet/linux/common/os/i915/mos_bufmgr.c b/media_softlet/linux/common/os/i915/mos_bufmgr.c
25index c0b3ba027..b623d0129 100644
26--- a/media_softlet/linux/common/os/i915/mos_bufmgr.c
27+++ b/media_softlet/linux/common/os/i915/mos_bufmgr.c
28@@ -138,7 +138,7 @@ struct mos_bufmgr_gem {
29 int exec_count;
30
31 /** Array of lists of cached gem objects of power-of-two sizes */
32- struct mos_gem_bo_bucket cache_bucket[14 * 4];
33+ struct mos_gem_bo_bucket cache_bucket[64];
34 int num_buckets;
35 time_t time;
36
37@@ -3852,9 +3852,9 @@ add_bucket(struct mos_bufmgr_gem *bufmgr_gem, int size)
38 }
39
40 static void
41-init_cache_buckets(struct mos_bufmgr_gem *bufmgr_gem)
42+init_cache_buckets(struct mos_bufmgr_gem *bufmgr_gem, uint8_t alloc_mode)
43 {
44- unsigned long size, cache_max_size = 64 * 1024 * 1024;
45+ unsigned long size, cache_max_size = 64 * 1024 * 1024, unit_size;
46
47 /* OK, so power of two buckets was too wasteful of memory.
48 * Give 3 other sizes between each power of two, to hopefully
49@@ -3864,17 +3864,63 @@ init_cache_buckets(struct mos_bufmgr_gem *bufmgr_gem)
50 * width/height alignment and rounding of sizes to pages will
51 * get us useful cache hit rates anyway)
52 */
53- add_bucket(bufmgr_gem, 4096);
54- add_bucket(bufmgr_gem, 4096 * 2);
55- add_bucket(bufmgr_gem, 4096 * 3);
56+ /* alloc_mode 0 is default alloc_mode
57+ * alloc_mode 1 rounding up to 64K for all < 1M
58+ * alloc_mode 2 rounding up to 2M for size> 1M
59+ * alloc_mode 3 rounding up to 2M for size > 1M and 64K for size <= 1M */
60+ if( alloc_mode > 3 )
61+ alloc_mode = 0;
62+
63+ if ( 0 == alloc_mode || 2 == alloc_mode)
64+ {
65+ // < 1M normal alloc_mode
66+ add_bucket(bufmgr_gem, 4096);
67+ add_bucket(bufmgr_gem, 4096 * 2);
68+ add_bucket(bufmgr_gem, 4096 * 3);
69+ /* Initialize the linked lists for BO reuse cache. */
70+ for (size = 4 * 4096; size < 1024 * 1024; size *= 2) {
71+ add_bucket(bufmgr_gem, size);
72+ add_bucket(bufmgr_gem, size + size * 1 / 4);
73+ add_bucket(bufmgr_gem, size + size * 2 / 4);
74+ add_bucket(bufmgr_gem, size + size * 3 / 4);
75+ }
76
77- /* Initialize the linked lists for BO reuse cache. */
78- for (size = 4 * 4096; size <= cache_max_size; size *= 2) {
79- add_bucket(bufmgr_gem, size);
80+ add_bucket(bufmgr_gem, 1024 * 1024);
81+ }
82+ if (1 == alloc_mode || 3 == alloc_mode)
83+ {
84+ // < 1M 64k alignment
85+ unit_size = 64 * 1024;
86+ for (size = unit_size; size <= 1024 * 1024; size += unit_size)
87+ {
88+ add_bucket(bufmgr_gem, size);
89+ }
90+ }
91+ if( 0 == alloc_mode || 1 == alloc_mode)
92+ {
93+ //> 1M is normal alloc_mode
94+ add_bucket(bufmgr_gem, 1280 * 1024);
95+ add_bucket(bufmgr_gem, 1536 * 1024);
96+ add_bucket(bufmgr_gem, 1792 * 1024);
97+
98+ for (size = 2 * 1024 * 1024; size < cache_max_size; size *= 2) {
99+ add_bucket(bufmgr_gem, size);
100+ add_bucket(bufmgr_gem, size + size * 1 / 4);
101+ add_bucket(bufmgr_gem, size + size * 2 / 4);
102+ add_bucket(bufmgr_gem, size + size * 3 / 4);
103+ }
104+ }
105+ if( 2 == alloc_mode || 3 == alloc_mode)
106+ {
107+ //> 1M rolling to 2M
108+ unit_size = 2 * 1024 * 1024;
109+ add_bucket(bufmgr_gem, unit_size);
110+ add_bucket(bufmgr_gem, 3 * 1024 * 1024);
111
112- add_bucket(bufmgr_gem, size + size * 1 / 4);
113- add_bucket(bufmgr_gem, size + size * 2 / 4);
114- add_bucket(bufmgr_gem, size + size * 3 / 4);
115+ for (size = 4 * 1024 * 1024; size <= cache_max_size; size += unit_size)
116+ {
117+ add_bucket(bufmgr_gem, size);
118+ }
119 }
120 }
121
122@@ -5100,6 +5146,7 @@ mos_bufmgr_gem_init_i915(int fd, int batch_size)
123 struct drm_i915_gem_get_aperture aperture;
124 drm_i915_getparam_t gp;
125 int ret, tmp;
126+ uint8_t alloc_mode;
127 bool exec2 = false;
128
129 pthread_mutex_lock(&bufmgr_list_mutex);
130@@ -5352,10 +5399,12 @@ mos_bufmgr_gem_init_i915(int fd, int batch_size)
131 *
132 * Every 4 was too few for the blender benchmark.
133 */
134+ alloc_mode = (uint8_t)(batch_size & 0xff);
135+ batch_size &= 0xffffff00;
136 bufmgr_gem->max_relocs = batch_size / sizeof(uint32_t) / 2 - 2;
137
138 DRMINITLISTHEAD(&bufmgr_gem->named);
139- init_cache_buckets(bufmgr_gem);
140+ init_cache_buckets(bufmgr_gem,alloc_mode);
141
142 DRMLISTADD(&bufmgr_gem->managers, &bufmgr_list);
143
144diff --git a/media_softlet/linux/common/os/i915_production/mos_bufmgr.c b/media_softlet/linux/common/os/i915_production/mos_bufmgr.c
145index 90b5685b1..b3574f7d3 100644
146--- a/media_softlet/linux/common/os/i915_production/mos_bufmgr.c
147+++ b/media_softlet/linux/common/os/i915_production/mos_bufmgr.c
148@@ -5403,6 +5403,7 @@ mos_bufmgr_gem_init_i915(int fd, int batch_size)
149 *
150 * Every 4 was too few for the blender benchmark.
151 */
152+ batch_size &= 0xffffff00;
153 bufmgr_gem->max_relocs = batch_size / sizeof(uint32_t) / 2 - 2;
154
155 DRMINITLISTHEAD(&bufmgr_gem->named);
156diff --git a/media_softlet/linux/common/os/mos_context_specific_next.cpp b/media_softlet/linux/common/os/mos_context_specific_next.cpp
157index 9e9e3ff7e..543e262d1 100644
158--- a/media_softlet/linux/common/os/mos_context_specific_next.cpp
159+++ b/media_softlet/linux/common/os/mos_context_specific_next.cpp
160@@ -64,6 +64,7 @@ MOS_STATUS OsContextSpecificNext::Init(DDI_DEVICE_CONTEXT ddiDriverContext)
161 uint32_t iDeviceId = 0;
162 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
163 uint32_t value = 0;
164+ uint32_t mode = 0;
165 MediaUserSettingSharedPtr userSettingPtr = nullptr;
166
167 MOS_OS_FUNCTION_ENTER;
168@@ -89,7 +90,25 @@ MOS_STATUS OsContextSpecificNext::Init(DDI_DEVICE_CONTEXT ddiDriverContext)
169
170 userSettingPtr = MosInterface::MosGetUserSettingInstance(osDriverContext);
171
172- m_bufmgr = mos_bufmgr_gem_init(m_fd, BATCH_BUFFER_SIZE, &m_deviceType);
173+ mode = BATCH_BUFFER_SIZE;
174+ ReadUserSetting(
175+ userSettingPtr,
176+ value,
177+ "INTEL MEDIA ALLOC MODE",
178+ MediaUserSetting::Group::Device);
179+
180+ if (value)
181+ {
182+ mode |= (value & 0x000000ff);
183+ }
184+ value = 0;
185+ /* no need to set batch buffer size after switch to softpin
186+ * keep it, just for test during relocation to softpin transition
187+ * now , it could be a debug method , but is actually useless
188+ * so it is safe to reuse the lowest 8bit to convey addtional information
189+ * more suitable solution is deleting it , or add additional parameter*/
190+
191+ m_bufmgr = mos_bufmgr_gem_init(m_fd, (int)mode, &m_deviceType);
192 if (nullptr == m_bufmgr)
193 {
194 MOS_OS_ASSERTMESSAGE("Not able to allocate buffer manager, fd=0x%d", m_fd);
195diff --git a/media_softlet/linux/common/os/mos_user_setting_specific.cpp b/media_softlet/linux/common/os/mos_user_setting_specific.cpp
196index 6be8b4298..caed584f4 100644
197--- a/media_softlet/linux/common/os/mos_user_setting_specific.cpp
198+++ b/media_softlet/linux/common/os/mos_user_setting_specific.cpp
199@@ -52,5 +52,12 @@ MOS_STATUS MosUserSetting::InitMosUserSettingSpecific(MediaUserSettingSharedPtr
200 0,
201 true); //"Enable VM Bind."
202
203+ DeclareUserSettingKey(
204+ userSettingPtr,
205+ "INTEL MEDIA ALLOC MODE",
206+ MediaUserSetting::Group::Device,
207+ 0,
208+ false); //
209+
210 return MOS_STATUS_SUCCESS;
211 }
212--
2132.40.1
214
diff --git a/recipes-multimedia/libva/files/0007-Skip-report-keys.patch b/recipes-multimedia/libva/files/0007-Skip-report-keys.patch
new file mode 100644
index 00000000..459ff490
--- /dev/null
+++ b/recipes-multimedia/libva/files/0007-Skip-report-keys.patch
@@ -0,0 +1,78 @@
1From b1aebef4d342c77fc2b9c5efbf20aeb2aa9d634e Mon Sep 17 00:00:00 2001
2From: Wang_Pingli <pingli.wang@intel.com>
3Date: Thu, 28 Dec 2023 16:44:40 +0800
4Subject: [PATCH 07/12] Skip report keys
5
6Skip to report keys
7
8Upstream-Status: Backport [https://github.com/intel/media-driver/commit/68ce25b0a6fa90614eb4734c8680aa4e149e8323]
9Signed-off-by: Lim, Siew Hoon <siew.hoon.lim@intel.com>
10---
11 .../os/osservice/mos_utilities_specific.cpp | 30 +++++++++++++++++--
12 1 file changed, 28 insertions(+), 2 deletions(-)
13
14diff --git a/media_softlet/linux/common/os/osservice/mos_utilities_specific.cpp b/media_softlet/linux/common/os/osservice/mos_utilities_specific.cpp
15index b5df29f06..96785e21e 100644
16--- a/media_softlet/linux/common/os/osservice/mos_utilities_specific.cpp
17+++ b/media_softlet/linux/common/os/osservice/mos_utilities_specific.cpp
18@@ -67,6 +67,8 @@ int32_t g_mosMemoryFailSimulateAllocCounter = 0;
19 int32_t *MosUtilities::m_mosAllocMemoryFailSimulateAllocCounter = &g_mosMemoryFailSimulateAllocCounter;
20 #endif
21
22+static bool s_skipToReportReg = false;
23+
24 double MosUtilities::MosGetTime()
25 {
26 struct timespec ts = {};
27@@ -1551,6 +1553,10 @@ MOS_STATUS MosUtilities::MosInitializeReg(RegBufferMap &regBufferMap)
28 {
29 std::string id = "";
30
31+ static const char *disableReportRegKeyList[] = {
32+ "INTEL MEDIA ALLOC MODE"
33+ };
34+ static const uint32_t disableReportRegKeyListCount = sizeof(disableReportRegKeyList) / sizeof(disableReportRegKeyList[0]);
35 while(!regStream.eof())
36 {
37 std::string line = "";
38@@ -1585,8 +1591,22 @@ MOS_STATUS MosUtilities::MosInitializeReg(RegBufferMap &regBufferMap)
39 {
40 std::string name = line.substr(0,pos);
41 std::string value = line.substr(pos+1);
42- auto &keys = regBufferMap[id];
43- keys[name] = value;
44+ if (name.size() > 0 && value.size() > 0)
45+ {
46+ auto &keys = regBufferMap[id];
47+ keys[name] = value;
48+ if (s_skipToReportReg == false && id == USER_SETTING_CONFIG_PATH)
49+ {
50+ for (uint32_t i = 0; i < disableReportRegKeyListCount; i++)
51+ {
52+ if (strcmp(name.c_str(), disableReportRegKeyList[i]) == 0)
53+ {
54+ s_skipToReportReg = true;
55+ break;
56+ }
57+ }
58+ }
59+ }
60 }
61 }
62 }
63@@ -1606,6 +1626,12 @@ MOS_STATUS MosUtilities::MosInitializeReg(RegBufferMap &regBufferMap)
64 MOS_STATUS MosUtilities::MosUninitializeReg(RegBufferMap &regBufferMap)
65 {
66 MOS_STATUS status = MOS_STATUS_SUCCESS;
67+
68+ if (s_skipToReportReg)
69+ {
70+ return MOS_STATUS_SUCCESS;
71+ }
72+
73 if (regBufferMap.size() == 0)
74 {
75 return MOS_STATUS_SUCCESS;
76--
772.40.1
78
diff --git a/recipes-multimedia/libva/files/0008-Limit-INTEL-MEDIA-ALLOC-MODE-to-MTL-and-ARL-only.patch b/recipes-multimedia/libva/files/0008-Limit-INTEL-MEDIA-ALLOC-MODE-to-MTL-and-ARL-only.patch
new file mode 100644
index 00000000..ece5e00b
--- /dev/null
+++ b/recipes-multimedia/libva/files/0008-Limit-INTEL-MEDIA-ALLOC-MODE-to-MTL-and-ARL-only.patch
@@ -0,0 +1,255 @@
1From ac2ffac8d4aade216cc361c6c7120c13a8780719 Mon Sep 17 00:00:00 2001
2From: "Soon, Thean Siew" <thean.siew.soon@intel.com>
3Date: Thu, 28 Dec 2023 18:42:59 +0000
4Subject: [PATCH 08/12] Limit INTEL MEDIA ALLOC MODE to MTL and ARL only
5
6Upstream-Status: Submitted [https://github.com/intel/media-driver/pull/1754]
7
8Signed-off-by: Soon, Thean Siew <thean.siew.soon@intel.com>
9---
10 .../common/os/i915/include/mos_bufmgr_api.h | 1 +
11 .../common/os/i915/include/mos_bufmgr_priv.h | 2 +-
12 .../linux/common/os/i915/mos_bufmgr.c | 69 +++++++++++++++----
13 .../linux/common/os/i915/mos_bufmgr_api.c | 19 +++++
14 .../os/i915_production/mos_bufmgr_priv.h | 1 +
15 .../common/os/mos_context_specific_next.cpp | 36 +++++-----
16 6 files changed, 94 insertions(+), 34 deletions(-)
17
18diff --git a/media_softlet/linux/common/os/i915/include/mos_bufmgr_api.h b/media_softlet/linux/common/os/i915/include/mos_bufmgr_api.h
19index 71cc01099..ab4f1ba89 100644
20--- a/media_softlet/linux/common/os/i915/include/mos_bufmgr_api.h
21+++ b/media_softlet/linux/common/os/i915/include/mos_bufmgr_api.h
22@@ -299,6 +299,7 @@ void mos_bufmgr_enable_vmbind(struct mos_bufmgr *bufmgr);
23 void mos_bufmgr_disable_object_capture(struct mos_bufmgr *bufmgr);
24 int mos_bufmgr_get_memory_info(struct mos_bufmgr *bufmgr, char *info, uint32_t length);
25 int mos_bufmgr_get_devid(struct mos_bufmgr *bufmgr);
26+void mos_bufmgr_realloc_cache(struct mos_bufmgr *bufmgr, uint8_t alloc_mode);
27
28 int mos_bo_map_unsynchronized(struct mos_linux_bo *bo);
29 int mos_bo_map_gtt(struct mos_linux_bo *bo);
30diff --git a/media_softlet/linux/common/os/i915/include/mos_bufmgr_priv.h b/media_softlet/linux/common/os/i915/include/mos_bufmgr_priv.h
31index 63f69f985..6fd58f827 100644
32--- a/media_softlet/linux/common/os/i915/include/mos_bufmgr_priv.h
33+++ b/media_softlet/linux/common/os/i915/include/mos_bufmgr_priv.h
34@@ -358,9 +358,9 @@ struct mos_bufmgr {
35 void (*disable_object_capture)(struct mos_bufmgr *bufmgr) = nullptr;
36 int (*get_memory_info)(struct mos_bufmgr *bufmgr, char *info, uint32_t length) = nullptr;
37 int (*get_devid)(struct mos_bufmgr *bufmgr) = nullptr;
38+ void (*realloc_cache)(struct mos_bufmgr *bufmgr, uint8_t alloc_mode) = nullptr;
39 int (*query_engines_count)(struct mos_bufmgr *bufmgr,
40 unsigned int *nengine) = nullptr;
41-
42 int (*query_engines)(struct mos_bufmgr *bufmgr,
43 __u16 engine_class,
44 __u64 caps,
45diff --git a/media_softlet/linux/common/os/i915/mos_bufmgr.c b/media_softlet/linux/common/os/i915/mos_bufmgr.c
46index b623d0129..2814ddbb7 100644
47--- a/media_softlet/linux/common/os/i915/mos_bufmgr.c
48+++ b/media_softlet/linux/common/os/i915/mos_bufmgr.c
49@@ -2426,19 +2426,9 @@ mos_gem_bo_start_gtt_access(struct mos_linux_bo *bo, int write_enable)
50 }
51
52 static void
53-mos_bufmgr_gem_destroy(struct mos_bufmgr *bufmgr)
54+mos_bufmgr_cleanup_cache(struct mos_bufmgr_gem *bufmgr_gem)
55 {
56- struct mos_bufmgr_gem *bufmgr_gem = (struct mos_bufmgr_gem *) bufmgr;
57- struct drm_gem_close close_bo;
58- int i, ret;
59-
60- free(bufmgr_gem->exec2_objects);
61- free(bufmgr_gem->exec_objects);
62- free(bufmgr_gem->exec_bos);
63- pthread_mutex_destroy(&bufmgr_gem->lock);
64-
65- /* Free any cached buffer objects we were going to reuse */
66- for (i = 0; i < bufmgr_gem->num_buckets; i++) {
67+ for (int i = 0; i < bufmgr_gem->num_buckets; i++) {
68 struct mos_gem_bo_bucket *bucket =
69 &bufmgr_gem->cache_bucket[i];
70 struct mos_bo_gem *bo_gem;
71@@ -2450,7 +2440,25 @@ mos_bufmgr_gem_destroy(struct mos_bufmgr *bufmgr)
72
73 mos_gem_bo_free(&bo_gem->bo);
74 }
75+ bufmgr_gem->cache_bucket[i].size = 0;
76 }
77+ bufmgr_gem->num_buckets = 0;
78+}
79+
80+static void
81+mos_bufmgr_gem_destroy(struct mos_bufmgr *bufmgr)
82+{
83+ struct mos_bufmgr_gem *bufmgr_gem = (struct mos_bufmgr_gem *)bufmgr;
84+ struct drm_gem_close close_bo;
85+ int ret;
86+
87+ free(bufmgr_gem->exec2_objects);
88+ free(bufmgr_gem->exec_objects);
89+ free(bufmgr_gem->exec_bos);
90+ pthread_mutex_destroy(&bufmgr_gem->lock);
91+
92+ /* Free any cached buffer objects we were going to reuse */
93+ mos_bufmgr_cleanup_cache(bufmgr_gem);
94
95 /* Release userptr bo kept hanging around for optimisation. */
96 if (bufmgr_gem->userptr_active.ptr) {
97@@ -3852,9 +3860,41 @@ add_bucket(struct mos_bufmgr_gem *bufmgr_gem, int size)
98 }
99
100 static void
101-init_cache_buckets(struct mos_bufmgr_gem *bufmgr_gem, uint8_t alloc_mode)
102+init_cache_buckets(struct mos_bufmgr_gem *bufmgr_gem)
103+{
104+ unsigned long size, cache_max_size = 64 * 1024 * 1024;
105+
106+ /* OK, so power of two buckets was too wasteful of memory.
107+ * Give 3 other sizes between each power of two, to hopefully
108+ * cover things accurately enough. (The alternative is
109+ * probably to just go for exact matching of sizes, and assume
110+ * that for things like composited window resize the tiled
111+ * width/height alignment and rounding of sizes to pages will
112+ * get us useful cache hit rates anyway)
113+ */
114+ add_bucket(bufmgr_gem, 4096);
115+ add_bucket(bufmgr_gem, 4096 * 2);
116+ add_bucket(bufmgr_gem, 4096 * 3);
117+
118+ /* Initialize the linked lists for BO reuse cache. */
119+ for (size = 4 * 4096; size <= cache_max_size; size *= 2) {
120+ add_bucket(bufmgr_gem, size);
121+
122+ add_bucket(bufmgr_gem, size + size * 1 / 4);
123+ add_bucket(bufmgr_gem, size + size * 2 / 4);
124+ add_bucket(bufmgr_gem, size + size * 3 / 4);
125+ }
126+}
127+
128+static void
129+mos_gem_realloc_cache(struct mos_bufmgr *bufmgr, uint8_t alloc_mode)
130 {
131 unsigned long size, cache_max_size = 64 * 1024 * 1024, unit_size;
132+ struct mos_bufmgr_gem *bufmgr_gem = (struct mos_bufmgr_gem *)bufmgr;
133+
134+ // Clean up the pre-allocated cache before re-allocating according
135+ // to alloc_mode
136+ mos_bufmgr_cleanup_cache(bufmgr_gem);
137
138 /* OK, so power of two buckets was too wasteful of memory.
139 * Give 3 other sizes between each power of two, to hopefully
140@@ -5218,6 +5258,7 @@ mos_bufmgr_gem_init_i915(int fd, int batch_size)
141 bufmgr_gem->bufmgr.disable_object_capture = mos_gem_disable_object_capture;
142 bufmgr_gem->bufmgr.get_memory_info = mos_gem_get_memory_info;
143 bufmgr_gem->bufmgr.get_devid = mos_gem_get_devid;
144+ bufmgr_gem->bufmgr.realloc_cache = mos_gem_realloc_cache;
145 bufmgr_gem->bufmgr.set_context_param = mos_gem_set_context_param;
146 bufmgr_gem->bufmgr.set_context_param_parallel = mos_gem_set_context_param_parallel;
147 bufmgr_gem->bufmgr.set_context_param_load_balance = mos_gem_set_context_param_load_balance;
148@@ -5404,7 +5445,7 @@ mos_bufmgr_gem_init_i915(int fd, int batch_size)
149 bufmgr_gem->max_relocs = batch_size / sizeof(uint32_t) / 2 - 2;
150
151 DRMINITLISTHEAD(&bufmgr_gem->named);
152- init_cache_buckets(bufmgr_gem,alloc_mode);
153+ init_cache_buckets(bufmgr_gem);
154
155 DRMLISTADD(&bufmgr_gem->managers, &bufmgr_list);
156
157diff --git a/media_softlet/linux/common/os/i915/mos_bufmgr_api.c b/media_softlet/linux/common/os/i915/mos_bufmgr_api.c
158index abe8ef96a..d0e02c267 100644
159--- a/media_softlet/linux/common/os/i915/mos_bufmgr_api.c
160+++ b/media_softlet/linux/common/os/i915/mos_bufmgr_api.c
161@@ -1204,6 +1204,25 @@ mos_bufmgr_get_devid(struct mos_bufmgr *bufmgr)
162 }
163 }
164
165+void
166+mos_bufmgr_realloc_cache(struct mos_bufmgr *bufmgr, uint8_t alloc_mode)
167+{
168+ if(!bufmgr)
169+ {
170+ MOS_OS_CRITICALMESSAGE("Input null ptr\n");
171+ return;
172+ }
173+
174+ if (bufmgr->realloc_cache)
175+ {
176+ return bufmgr->realloc_cache(bufmgr, alloc_mode);
177+ }
178+ else
179+ {
180+ MOS_OS_CRITICALMESSAGE("Unsupported\n");
181+ }
182+}
183+
184 int
185 mos_query_engines_count(struct mos_bufmgr *bufmgr,
186 unsigned int *nengine)
187diff --git a/media_softlet/linux/common/os/i915_production/mos_bufmgr_priv.h b/media_softlet/linux/common/os/i915_production/mos_bufmgr_priv.h
188index c3b765a4c..1d7f7edb0 100644
189--- a/media_softlet/linux/common/os/i915_production/mos_bufmgr_priv.h
190+++ b/media_softlet/linux/common/os/i915_production/mos_bufmgr_priv.h
191@@ -358,6 +358,7 @@ struct mos_bufmgr {
192 void (*disable_object_capture)(struct mos_bufmgr *bufmgr) = nullptr;
193 int (*get_memory_info)(struct mos_bufmgr *bufmgr, char *info, uint32_t length) = nullptr;
194 int (*get_devid)(struct mos_bufmgr *bufmgr) = nullptr;
195+ void (*realloc_cache)(struct mos_bufmgr *bufmgr, uint8_t alloc_mode) = nullptr;
196 int (*query_engines_count)(struct mos_bufmgr *bufmgr,
197 unsigned int *nengine) = nullptr;
198
199diff --git a/media_softlet/linux/common/os/mos_context_specific_next.cpp b/media_softlet/linux/common/os/mos_context_specific_next.cpp
200index 543e262d1..87059f538 100644
201--- a/media_softlet/linux/common/os/mos_context_specific_next.cpp
202+++ b/media_softlet/linux/common/os/mos_context_specific_next.cpp
203@@ -90,25 +90,7 @@ MOS_STATUS OsContextSpecificNext::Init(DDI_DEVICE_CONTEXT ddiDriverContext)
204
205 userSettingPtr = MosInterface::MosGetUserSettingInstance(osDriverContext);
206
207- mode = BATCH_BUFFER_SIZE;
208- ReadUserSetting(
209- userSettingPtr,
210- value,
211- "INTEL MEDIA ALLOC MODE",
212- MediaUserSetting::Group::Device);
213-
214- if (value)
215- {
216- mode |= (value & 0x000000ff);
217- }
218- value = 0;
219- /* no need to set batch buffer size after switch to softpin
220- * keep it, just for test during relocation to softpin transition
221- * now , it could be a debug method , but is actually useless
222- * so it is safe to reuse the lowest 8bit to convey addtional information
223- * more suitable solution is deleting it , or add additional parameter*/
224-
225- m_bufmgr = mos_bufmgr_gem_init(m_fd, (int)mode, &m_deviceType);
226+ m_bufmgr = mos_bufmgr_gem_init(m_fd, BATCH_BUFFER_SIZE, &m_deviceType);
227 if (nullptr == m_bufmgr)
228 {
229 MOS_OS_ASSERTMESSAGE("Not able to allocate buffer manager, fd=0x%d", m_fd);
230@@ -151,6 +133,22 @@ MOS_STATUS OsContextSpecificNext::Init(DDI_DEVICE_CONTEXT ddiDriverContext)
231 return eStatus;
232 }
233
234+ if (m_platformInfo.eProductFamily == IGFX_METEORLAKE ||
235+ m_platformInfo.eProductFamily == IGFX_ARROWLAKE)
236+ {
237+ ReadUserSetting(
238+ userSettingPtr,
239+ value,
240+ "INTEL MEDIA ALLOC MODE",
241+ MediaUserSetting::Group::Device);
242+
243+ if (value)
244+ {
245+ mode = (value & 0x000000ff);
246+ }
247+ mos_bufmgr_realloc_cache(m_bufmgr, mode);
248+ }
249+
250 ReadUserSetting(
251 userSettingPtr,
252 value,
253--
2542.40.1
255
diff --git a/recipes-multimedia/libva/files/0009-Skip-cache-bucket-realloc-for-default-mode-0.patch b/recipes-multimedia/libva/files/0009-Skip-cache-bucket-realloc-for-default-mode-0.patch
new file mode 100644
index 00000000..8ee7ef14
--- /dev/null
+++ b/recipes-multimedia/libva/files/0009-Skip-cache-bucket-realloc-for-default-mode-0.patch
@@ -0,0 +1,33 @@
1From 18c32247cbc0e9fabff7a847add099496af9e53f Mon Sep 17 00:00:00 2001
2From: "Soon, Thean Siew" <thean.siew.soon@intel.com>
3Date: Mon, 8 Jan 2024 18:12:30 +0000
4Subject: [PATCH 09/12] Skip cache bucket realloc for default mode 0
5
6Upstream-Status: Submitted [https://github.com/intel/media-driver/pull/1754]
7
8Signed-off-by: Soon, Thean Siew <thean.siew.soon@intel.com>
9---
10 .../linux/common/os/mos_context_specific_next.cpp | 7 ++++++-
11 1 file changed, 6 insertions(+), 1 deletion(-)
12
13diff --git a/media_softlet/linux/common/os/mos_context_specific_next.cpp b/media_softlet/linux/common/os/mos_context_specific_next.cpp
14index 87059f538..9dbd5da79 100644
15--- a/media_softlet/linux/common/os/mos_context_specific_next.cpp
16+++ b/media_softlet/linux/common/os/mos_context_specific_next.cpp
17@@ -146,7 +146,12 @@ MOS_STATUS OsContextSpecificNext::Init(DDI_DEVICE_CONTEXT ddiDriverContext)
18 {
19 mode = (value & 0x000000ff);
20 }
21- mos_bufmgr_realloc_cache(m_bufmgr, mode);
22+
23+ // Realloc cache only if it's not mode 0
24+ if (mode)
25+ {
26+ mos_bufmgr_realloc_cache(m_bufmgr, mode);
27+ }
28 }
29
30 ReadUserSetting(
31--
322.40.1
33
diff --git a/recipes-multimedia/libva/files/0010-Fix-failed-4k-video-wall-test-case-and-color-corrupt.patch b/recipes-multimedia/libva/files/0010-Fix-failed-4k-video-wall-test-case-and-color-corrupt.patch
new file mode 100644
index 00000000..0100df77
--- /dev/null
+++ b/recipes-multimedia/libva/files/0010-Fix-failed-4k-video-wall-test-case-and-color-corrupt.patch
@@ -0,0 +1,195 @@
1From 7291ab5206c5e172c6c94dcfbe4f1bc258f3b7a5 Mon Sep 17 00:00:00 2001
2From: WenshengZhang <wensheng.zhang@intel.com>
3Date: Wed, 10 Jan 2024 14:08:37 +0800
4Subject: [PATCH 10/12] Fix failed 4k video wall test case and color corruption
5 of video composition
6
7Fix failed 4k video wall test case from 16CH video only show 1CH output and
8corruption observed on certain number of video composition when doing
9sample_multi_transcode.
10
11Upstream-Status: Backport [https://github.com/intel/media-driver/commit/38e14b1b97170b51586d00d1fa607e496b0c5825]
12Signed-off-by: Lim, Siew Hoon <siew.hoon.lim@intel.com>
13---
14 .../common/vp/kdll/hal_kerneldll_next.h | 1 +
15 .../vp/hal/packet/vp_render_fc_kernel.cpp | 7 ++
16 .../common/vp/kdll/hal_kerneldll_next.c | 70 +++++++++++--------
17 .../linux/common/vp/ddi/ddi_vp_functions.cpp | 20 ++----
18 4 files changed, 55 insertions(+), 43 deletions(-)
19
20diff --git a/media_common/agnostic/common/vp/kdll/hal_kerneldll_next.h b/media_common/agnostic/common/vp/kdll/hal_kerneldll_next.h
21index 6447999b7..8e2ab371e 100644
22--- a/media_common/agnostic/common/vp/kdll/hal_kerneldll_next.h
23+++ b/media_common/agnostic/common/vp/kdll/hal_kerneldll_next.h
24@@ -588,6 +588,7 @@ typedef struct tagKdll_FilterEntry
25 Kdll_Scalingratio ScalingRatio;
26 Kdll_RenderMethod RenderMethod;
27 Kdll_SetCSCCoeffMethod SetCSCCoeffMode;
28+ bool forceToTargetColorSpace;
29 } Kdll_FilterEntry, *PKdll_FilterEntry;
30
31 // Structure that defines a compositing filter
32diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_fc_kernel.cpp b/media_softlet/agnostic/common/vp/hal/packet/vp_render_fc_kernel.cpp
33index 8e982f67e..f8308fed1 100644
34--- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_fc_kernel.cpp
35+++ b/media_softlet/agnostic/common/vp/hal/packet/vp_render_fc_kernel.cpp
36@@ -775,6 +775,13 @@ MOS_STATUS VpRenderFcKernel::BuildFilter(
37
38 for (i = 0; (i < (int)compParams->sourceCount) && (iMaxFilterSize > 0); i++)
39 {
40+ if (i > 0)
41+ {
42+ if (!RECT1_CONTAINS_RECT2(compParams->source[0].surf->rcDst, compParams->source[i].surf->rcDst))
43+ {
44+ pFilter->forceToTargetColorSpace = true;
45+ }
46+ }
47 src = &compParams->source[i];
48
49 //--------------------------------
50diff --git a/media_softlet/agnostic/common/vp/kdll/hal_kerneldll_next.c b/media_softlet/agnostic/common/vp/kdll/hal_kerneldll_next.c
51index d8f7d429a..151f3b039 100644
52--- a/media_softlet/agnostic/common/vp/kdll/hal_kerneldll_next.c
53+++ b/media_softlet/agnostic/common/vp/kdll/hal_kerneldll_next.c
54@@ -2378,6 +2378,7 @@ bool KernelDll_SetupCSC(
55 Kdll_CSC_Matrix curr_matrix;
56 Kdll_CSC_Matrix *matrix = pCSC->Matrix; // Color Space conversion matrix
57 uint8_t * matrixID = pCSC->MatrixID; // CSC coefficient allocation table
58+ bool forceToTargetColorSpace = false;
59
60 // Clear all CSC matrices
61 MOS_ZeroMemory(matrix, sizeof(pCSC->Matrix));
62@@ -2395,6 +2396,10 @@ bool KernelDll_SetupCSC(
63 //---------------------------------------------------------------//
64 for (i = iFilterSize, pFilter = pSearchState->Filter; i > 0; i--, pFilter++)
65 {
66+ if (pFilter->forceToTargetColorSpace)
67+ {
68+ forceToTargetColorSpace = true;
69+ }
70 // Disable Procamp for all layers except Main Video
71 // Disable Procamp if source is RGB
72 if (pFilter->layer != Layer_MainVideo ||
73@@ -2456,44 +2461,51 @@ bool KernelDll_SetupCSC(
74 //---------------------------------------------------------------//
75 if (sel_cspace == CSpace_Any)
76 {
77- int cs;
78- for (cs = (CSpace_Any + 1); cs < CSpace_Count; cs++)
79+ if (forceToTargetColorSpace)
80 {
81- // Skip color spaces not in use
82- cspace = (VPHAL_CSPACE)cs;
83- if (!cspace_in_use[cspace])
84- {
85- continue;
86- }
87-
88- // xvYCC and BT are treated as same for CSC considerations (BT.x to xvYCC.x matrix is I)
89- cspace = KernelDll_TranslateCspace(cspace);
90-
91- // Count # of CS conversions and matrices
92- csc_count = 0;
93- for (i = iFilterSize, pFilter = pSearchState->Filter; i > 0; i--, pFilter++)
94+ sel_cspace = out_cspace;
95+ }
96+ else
97+ {
98+ int cs;
99+ for (cs = (CSpace_Any + 1); cs < CSpace_Count; cs++)
100 {
101- // Ignore layers where the Color Space may be set in software (colorfill, palletized)
102- if (pFilter->cspace == CSpace_Any)
103+ // Skip color spaces not in use
104+ cspace = (VPHAL_CSPACE)cs;
105+ if (!cspace_in_use[cspace])
106 {
107 continue;
108 }
109
110- // Check if CSC/PA is required
111- if (KernelDll_TranslateCspace(pFilter->cspace) != cspace ||
112- pFilter->procamp != DL_PROCAMP_DISABLED)
113+ // xvYCC and BT are treated as same for CSC considerations (BT.x to xvYCC.x matrix is I)
114+ cspace = KernelDll_TranslateCspace(cspace);
115+
116+ // Count # of CS conversions and matrices
117+ csc_count = 0;
118+ for (i = iFilterSize, pFilter = pSearchState->Filter; i > 0; i--, pFilter++)
119 {
120- csc_count++;
121+ // Ignore layers where the Color Space may be set in software (colorfill, palletized)
122+ if (pFilter->cspace == CSpace_Any)
123+ {
124+ continue;
125+ }
126+
127+ // Check if CSC/PA is required
128+ if (KernelDll_TranslateCspace(pFilter->cspace) != cspace ||
129+ pFilter->procamp != DL_PROCAMP_DISABLED)
130+ {
131+ csc_count++;
132+ }
133 }
134- }
135
136- // Save best choice as requiring minimum number of CSC operations
137- if ((sel_csc_count < 0) || // Initial value
138- (csc_count < sel_csc_count) || // Minimum number of CSC operations
139- (csc_count == sel_csc_count && cs == main_cspace)) // Use main cspace as default if same CSC count
140- {
141- sel_cspace = cspace;
142- sel_csc_count = csc_count;
143+ // Save best choice as requiring minimum number of CSC operations
144+ if ((sel_csc_count < 0) || // Initial value
145+ (csc_count < sel_csc_count) || // Minimum number of CSC operations
146+ (csc_count == sel_csc_count && cs == main_cspace)) // Use main cspace as default if same CSC count
147+ {
148+ sel_cspace = cspace;
149+ sel_csc_count = csc_count;
150+ }
151 }
152 }
153 }
154diff --git a/media_softlet/linux/common/vp/ddi/ddi_vp_functions.cpp b/media_softlet/linux/common/vp/ddi/ddi_vp_functions.cpp
155index 40d0b3fad..e60a6c69c 100644
156--- a/media_softlet/linux/common/vp/ddi/ddi_vp_functions.cpp
157+++ b/media_softlet/linux/common/vp/ddi/ddi_vp_functions.cpp
158@@ -2115,9 +2115,8 @@ VAStatus DdiVpFunctions::SetBackgroundColorfill(
159 {
160 DDI_VP_FUNC_ENTER;
161 DDI_VP_CHK_NULL(vpHalRenderParams, "nullptr vpHalRenderParams.", VA_STATUS_ERROR_INVALID_PARAMETER);
162- DDI_VP_CHK_NULL(vpHalRenderParams->pTarget[0],"nullptr pTarget[0].", VA_STATUS_ERROR_INVALID_PARAMETER);
163
164- if ((outBackGroundcolor >> 24) != 0 || vpHalRenderParams->pTarget[0]->ColorSpace == CSpace_sRGB)
165+ if ((outBackGroundcolor >> 24) != 0)
166 {
167 if (vpHalRenderParams->pColorFillParams == nullptr)
168 {
169@@ -2126,18 +2125,11 @@ VAStatus DdiVpFunctions::SetBackgroundColorfill(
170
171 DDI_VP_CHK_NULL(vpHalRenderParams->pColorFillParams, "nullptr pColorFillParams.", VA_STATUS_ERROR_UNKNOWN);
172
173- if (vpHalRenderParams->pTarget[0]->ColorSpace == CSpace_sRGB && (outBackGroundcolor >> 24) == 0)
174- {
175- // set color space for sRGB output
176- vpHalRenderParams->pColorFillParams->CSpace = CSpace_sRGB;
177- }
178- else
179- {
180- // set background colorfill option
181- vpHalRenderParams->pColorFillParams->Color = outBackGroundcolor;
182- vpHalRenderParams->pColorFillParams->bYCbCr = false;
183- vpHalRenderParams->pColorFillParams->CSpace = CSpace_sRGB;
184- }
185+ // set background colorfill option
186+ vpHalRenderParams->pColorFillParams->Color = outBackGroundcolor;
187+ vpHalRenderParams->pColorFillParams->bYCbCr = false;
188+ vpHalRenderParams->pColorFillParams->CSpace = CSpace_sRGB;
189+
190 }
191 else
192 {
193--
1942.40.1
195
diff --git a/recipes-multimedia/libva/files/0011-Disable-422H-format-output.patch b/recipes-multimedia/libva/files/0011-Disable-422H-format-output.patch
new file mode 100644
index 00000000..2f4aec1e
--- /dev/null
+++ b/recipes-multimedia/libva/files/0011-Disable-422H-format-output.patch
@@ -0,0 +1,33 @@
1From f8b4d982232d4c1330e1e5f5dcd7cd8ca94decba Mon Sep 17 00:00:00 2001
2From: WenshengZhang <wensheng.zhang@intel.com>
3Date: Thu, 25 Jan 2024 16:35:10 +0800
4Subject: [PATCH 11/12] Disable 422H format output
5
6Disable 422H format output.
7
8Upstream-Status: Backport [https://github.com/intel/media-driver/commit/eab411768e61a46e096793291f5f992eecf76cd8]
9Signed-off-by: Lim, Siew Hoon <siew.hoon.lim@intel.com>
10---
11 .../agnostic/common/vp/hal/feature_manager/policy.cpp | 6 ++++++
12 1 file changed, 6 insertions(+)
13
14diff --git a/media_softlet/agnostic/common/vp/hal/feature_manager/policy.cpp b/media_softlet/agnostic/common/vp/hal/feature_manager/policy.cpp
15index 317cec25a..12f1124fa 100644
16--- a/media_softlet/agnostic/common/vp/hal/feature_manager/policy.cpp
17+++ b/media_softlet/agnostic/common/vp/hal/feature_manager/policy.cpp
18@@ -1140,6 +1140,12 @@ MOS_STATUS Policy::GetScalingExecutionCaps(SwFilter *feature, bool isHdrEnabled)
19 bool isAlphaSettingSupportedByVebox =
20 IsAlphaSettingSupportedByVebox(scalingParams->formatInput, scalingParams->formatOutput, scalingParams->pCompAlpha);
21
22+ if (scalingParams->formatOutput == Format_422H)
23+ {
24+ VP_PUBLIC_ASSERTMESSAGE("Scaling not support 422H format output.");
25+ return MOS_STATUS_UNIMPLEMENTED;
26+ }
27+
28 // Clean usedForNextPass flag.
29 if (scalingEngine->usedForNextPass)
30 {
31--
322.40.1
33
diff --git a/recipes-multimedia/libva/files/0012-Decode-Fix-AVC-decode-SFC-4K-hang-issue.patch b/recipes-multimedia/libva/files/0012-Decode-Fix-AVC-decode-SFC-4K-hang-issue.patch
new file mode 100644
index 00000000..1be9139d
--- /dev/null
+++ b/recipes-multimedia/libva/files/0012-Decode-Fix-AVC-decode-SFC-4K-hang-issue.patch
@@ -0,0 +1,32 @@
1From b93904533d3ee66c7919fa8e23d26b852a37a917 Mon Sep 17 00:00:00 2001
2From: Lim Siew Hoon <siew.hoon.lim@intel.com>
3Date: Tue, 30 Jan 2024 13:27:52 +0800
4Subject: [PATCH 12/12] [Decode] Fix AVC decode SFC 4K hang issue
5
6Updated VDSFC input width and height for AVC decode
7
8Upstream-Status: Submitted [https://github.com/intel-innersource/drivers.gpu.unified/pull/151401]
9
10Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
11---
12 .../hal/dec/avc/packet/decode_avc_downsampling_packet.cpp | 4 ++++
13 1 file changed, 4 insertions(+)
14
15diff --git a/media_softlet/agnostic/common/codec/hal/dec/avc/packet/decode_avc_downsampling_packet.cpp b/media_softlet/agnostic/common/codec/hal/dec/avc/packet/decode_avc_downsampling_packet.cpp
16index e75fd8137..9cc236bd7 100644
17--- a/media_softlet/agnostic/common/codec/hal/dec/avc/packet/decode_avc_downsampling_packet.cpp
18+++ b/media_softlet/agnostic/common/codec/hal/dec/avc/packet/decode_avc_downsampling_packet.cpp
19@@ -59,6 +59,10 @@ MOS_STATUS AvcDownSamplingPkt::InitSfcParams(VDBOX_SFC_PARAMS &sfcParams)
20
21 AvcBasicFeature *avcBasicFeature = dynamic_cast<AvcBasicFeature*>(m_basicFeature);
22 DECODE_CHK_NULL(avcBasicFeature);
23+
24+ sfcParams.input.width = avcBasicFeature->m_width;
25+ sfcParams.input.height = avcBasicFeature->m_height;
26+
27 CODEC_PICTURE curPic = avcBasicFeature->m_avcPicParams->CurrPic;
28
29 if (avcBasicFeature->m_avcPicParams->seq_fields.mb_adaptive_frame_field_flag == true)
30--
312.40.1
32
diff --git a/recipes-multimedia/libva/intel-media-driver_21.1.3.bb b/recipes-multimedia/libva/intel-media-driver_23.4.3.bb
index 637d8f0a..6513d574 100644
--- a/recipes-multimedia/libva/intel-media-driver_21.1.3.bb
+++ b/recipes-multimedia/libva/intel-media-driver_23.4.3.bb
@@ -19,19 +19,30 @@ REQUIRED_DISTRO_FEATURES = "opengl"
19DEPENDS += "libva gmmlib" 19DEPENDS += "libva gmmlib"
20 20
21SRC_URI = "git://github.com/intel/media-driver.git;protocol=https;nobranch=1 \ 21SRC_URI = "git://github.com/intel/media-driver.git;protocol=https;nobranch=1 \
22 file://0001-Disable-vp9-padding-on-mtl.patch \
23 file://0002-Force-ARGB-surface-to-tile4-for-ACM.patch \
24 file://0004-Add-device-ID-for-ARL.patch \
25 file://0005-Add-XR24-support-to-DMABuf.patch \
26 file://0006-add-INTEL-MEDIA-ALLOC-refineE-to-specify-the-memory-.patch \
27 file://0007-Skip-report-keys.patch \
28 file://0008-Limit-INTEL-MEDIA-ALLOC-MODE-to-MTL-and-ARL-only.patch \
29 file://0009-Skip-cache-bucket-realloc-for-default-mode-0.patch \
30 file://0010-Fix-failed-4k-video-wall-test-case-and-color-corrupt.patch \
31 file://0011-Disable-422H-format-output.patch \
32 file://0012-Decode-Fix-AVC-decode-SFC-4K-hang-issue.patch \
22 " 33 "
23 34
24SRCREV = "bec8e1382637589bc3f302edf6c866bec3d754dd" 35SRCREV = "a9f272496fc0f3e823cc4a814666ea27b443d902"
25S = "${WORKDIR}/git" 36S = "${WORKDIR}/git"
26 37
27COMPATIBLE_HOST_x86-x32 = "null" 38COMPATIBLE_HOST:x86-x32 = "null"
28 39
29UPSTREAM_CHECK_GITTAGREGEX = "^intel-media-(?P<pver>(?!600\..*)\d+(\.\d+)+)$" 40UPSTREAM_CHECK_GITTAGREGEX = "^intel-media-(?P<pver>(?!600\..*)\d+(\.\d+)+)$"
30 41
31inherit cmake pkgconfig 42inherit cmake pkgconfig
32 43
33MEDIA_DRIVER_ARCH_x86 = "32" 44MEDIA_DRIVER_ARCH:x86 = "32"
34MEDIA_DRIVER_ARCH_x86-64 = "64" 45MEDIA_DRIVER_ARCH:x86-64 = "64"
35 46
36EXTRA_OECMAKE += " \ 47EXTRA_OECMAKE += " \
37 -DMEDIA_RUN_TEST_SUITE=OFF \ 48 -DMEDIA_RUN_TEST_SUITE=OFF \
@@ -39,12 +50,12 @@ EXTRA_OECMAKE += " \
39 -DMEDIA_BUILD_FATAL_WARNINGS=OFF \ 50 -DMEDIA_BUILD_FATAL_WARNINGS=OFF \
40 " 51 "
41 52
42CXXFLAGS_append_x86 = " -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" 53CXXFLAGS:append:x86 = " -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
43 54
44do_configure_prepend_toolchain-clang() { 55do_configure:prepend:toolchain-clang() {
45 sed -i -e '/-fno-tree-pre/d' ${S}/media_driver/cmake/linux/media_compile_flags_linux.cmake 56 sed -i -e '/-fno-tree-pre/d' ${S}/media_driver/cmake/linux/media_compile_flags_linux.cmake
46} 57}
47 58
48FILES_${PN} += " \ 59FILES:${PN} += " \
49 ${libdir}/dri/ \ 60 ${libdir}/dri/ \
50 " 61 "
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)}
29PACKAGECONFIG[x11] = "-Dwith_x11=yes, -Dwith_x11=no" 29PACKAGECONFIG[x11] = "-Dwith_x11=yes, -Dwith_x11=no"
30PACKAGECONFIG[wayland] = "-Dwith_wayland=yes, -Dwith_wayland=no, wayland wayland-native virtual/egl" 30PACKAGECONFIG[wayland] = "-Dwith_wayland=yes, -Dwith_wayland=no, wayland wayland-native virtual/egl"
31 31
32FILES_${PN} += "${libdir}/dri/*.so" 32FILES:${PN} += "${libdir}/dri/*.so"
33FILES_${PN}-dev += "${libdir}/dri/*.la" 33FILES:${PN}-dev += "${libdir}/dri/*.la"
34FILES_${PN}-dbg += "${libdir}/dri/.debug" 34FILES:${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 @@
1From f2e6d2ecfea635ab952649156e31ca893d4b1a47 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 12 Aug 2017 08:49:20 -0700
4Subject: [PATCH] Fix build with clang
5
6Fix errors e.g.
7error: 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]
8
9and
10
11psnr.cpp:225:17: error: bool literal returned from 'main' [-Werror,-Wmain]
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14Upstream-Status: Pending
15
16---
17 tests/decodehelp.cpp | 2 +-
18 tests/encodehelp.h | 2 +-
19 tests/vpp.cpp | 2 +-
20 tests/yamitranscode.cpp | 2 +-
21 testscripts/psnr.cpp | 4 ++--
22 5 files changed, 6 insertions(+), 6 deletions(-)
23
24diff --git a/tests/decodehelp.cpp b/tests/decodehelp.cpp
25index b27b977..62cca63 100644
26--- a/tests/decodehelp.cpp
27+++ b/tests/decodehelp.cpp
28@@ -81,7 +81,7 @@ bool processCmdLine(int argc, char** argv, DecodeParameter* parameters)
29 { NULL, no_argument, NULL, 0 }
30 };
31
32- char opt;
33+ int opt;
34 while ((opt = getopt_long_only(argc, argv, "h:m:n:i:f:o:w:?", long_opts,&option_index)) != -1){
35 switch (opt) {
36 case 'h':
37diff --git a/tests/encodehelp.h b/tests/encodehelp.h
38index 63580a4..651ec08 100644
39--- a/tests/encodehelp.h
40+++ b/tests/encodehelp.h
41@@ -109,7 +109,7 @@ static VideoRateControl string_to_rc_mode(char *str)
42
43 static bool process_cmdline(int argc, char *argv[])
44 {
45- char opt;
46+ int opt;
47 const struct option long_opts[] = {
48 { "help", no_argument, NULL, 'h' },
49 { "qp", required_argument, NULL, 0 },
50diff --git a/tests/vpp.cpp b/tests/vpp.cpp
51index 5a60c0a..52da43b 100644
52--- a/tests/vpp.cpp
53+++ b/tests/vpp.cpp
54@@ -151,7 +151,7 @@ public:
55 private:
56 bool processCmdLine(int argc, char* argv[])
57 {
58- char opt;
59+ int opt;
60 const struct option long_opts[] = {
61 { "help", no_argument, NULL, 'h' },
62 { "sharpening", required_argument, NULL, 's' },
63diff --git a/tests/yamitranscode.cpp b/tests/yamitranscode.cpp
64index 6207209..00164ce 100755
65--- a/tests/yamitranscode.cpp
66+++ b/tests/yamitranscode.cpp
67@@ -100,7 +100,7 @@ static VideoRateControl string_to_rc_mode(char *str)
68
69 static bool processCmdLine(int argc, char *argv[], TranscodeParams& para)
70 {
71- char opt;
72+ int opt;
73 const struct option long_opts[] = {
74 { "help", no_argument, NULL, 'h' },
75 { "qp", required_argument, NULL, 0 },
76diff --git a/testscripts/psnr.cpp b/testscripts/psnr.cpp
77index 5cc24c9..68bd668 100644
78--- a/testscripts/psnr.cpp
79+++ b/testscripts/psnr.cpp
80@@ -215,14 +215,14 @@ int main(int argc, char *argv[])
81 const char* psnrresult = "average_psnr.txt";
82 int width=0,height=0;
83 int standardpsnr = NORMAL_PSNR;
84- char opt;
85+ int opt;
86 while ((opt = getopt(argc, argv, "h:W:H:i:o:s:?")) != -1)
87 {
88 switch (opt) {
89 case 'h':
90 case '?':
91 print_help(argv[0]);
92- return false;
93+ return -1;
94 case 'i':
95 filename1 = optarg;
96 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 @@
1SUMMARY = "Applications and Scripts for libyami."
2DESCRIPTION = "Applications and Scripts for libyami."
3
4HOMEPAGE = "https://github.com/intel/libyami-utils"
5BUGTRACKER = "https://github.com/intel/libyami-utils/issues/new"
6
7LICENSE = "Apache-2.0"
8LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
9
10SRC_URI = "git://github.com/intel/libyami-utils.git \
11 file://0001-Fix-build-with-clang.patch \
12 "
13SRCREV = "c3d25b64b05aeb0c4eecc140aef617cfeced6b8e"
14S = "${WORKDIR}/git"
15
16DEPENDS = "libva libyami"
17
18inherit autotools pkgconfig features_check
19
20REQUIRED_DISTRO_FEATURES = "opengl"
21
22PACKAGECONFIG = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
23
24# --enable-x11 needs libva-x11
25# gles-tests fail to build without x11: see https://github.com/intel/libyami-utils/issues/91
26PACKAGECONFIG[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 @@
1SUMMARY = "Yami is media infrastructure base on libva"
2DESCRIPTION = "Yet Another Media Infrastructure \
3light weight hardware codec library base on VA-API "
4
5HOMEPAGE = "https://github.com/intel/libyami"
6BUGTRACKER = "https://github.com/intel/libyami/issues/new"
7
8LICENSE = "Apache-2.0"
9LIC_FILES_CHKSUM = "file://LICENSE.md;md5=3b83ef96387f14655fc854ddc3c6bd57"
10
11SRC_URI = "git://github.com/intel/libyami.git;branch=apache \
12"
13SRCREV = "08606d0a43e0ef15e5b61cc13563169370ce8715"
14S = "${WORKDIR}/git"
15
16CXXFLAGS_append = " -Wno-error"
17
18PACKAGECONFIG ??= "${@bb.utils.contains("DISTRO_FEATURES", "x11", "x11", "", d)}"
19PACKAGECONFIG[x11] = "--enable-x11,--disable-x11,virtual/libx11 libxrandr libxrender"
20
21DEPENDS = "libva"
22inherit autotools pkgconfig features_check
23
24REQUIRED_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 @@
1From 6945cd0ad84855ab4a2dc40016879fb5fc7f2b6a Mon Sep 17 00:00:00 2001
2From: Vincent Cheah Beng Keat <vincent.beng.keat.cheah@intel.com>
3Date: Wed, 7 Apr 2021 05:30:15 +0000
4Subject: [PATCH] Don't try to autheticate with render node
5
6Replicate similar libVA wayland change.
7https://github.com/intel/libva/commit/283f776a9649dcef58b47958c1269499adfa1cd4
8
9Platform: ADL-S, EHL, TGL
10OS: Yocto native wayland weston
11Tested:
12 ./sample_decode h265 -i Puppies_3840x2160.265 -rwld -rgb4
13
14Issue: #2592
15
16Upstream-Status: Backport [https://github.com/Intel-Media-SDK/MediaSDK/commit/6945cd0ad84855ab4a2dc40016879fb5fc7f2b6a]
17
18Signed-off-by: Cheah, Vincent Beng Keat <vincent.beng.keat.cheah@intel.com>
19---
20 samples/sample_misc/wayland/src/class_wayland.cpp | 8 ++++++--
21 1 file changed, 6 insertions(+), 2 deletions(-)
22
23diff --git a/samples/sample_misc/wayland/src/class_wayland.cpp b/samples/sample_misc/wayland/src/class_wayland.cpp
24index 62f326e3..4a0beed3 100644
25--- a/samples/sample_misc/wayland/src/class_wayland.cpp
26+++ b/samples/sample_misc/wayland/src/class_wayland.cpp
27@@ -433,8 +433,12 @@ void Wayland::DrmHandleDevice(const char *name)
28 m_device_name << "\n";
29 return;
30 }
31- drmGetMagic(m_fd, &magic);
32- wl_drm_authenticate(m_drm, magic);
33+
34+ int type = drmGetNodeTypeFromFd(m_fd);
35+ if (type != DRM_NODE_RENDER) {
36+ drmGetMagic(m_fd, &magic);
37+ wl_drm_authenticate(m_drm, magic);
38+ }
39 }
40
41 void Wayland::DrmHandleAuthenticated()
42--
432.24.3
44
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 @@
1Upstream-Status: Inactive-Upstream
2Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
3
4diff --git a/api/mfx_dispatch/linux/mfxparser.cpp b/api/mfx_dispatch/linux/mfxparser.cpp
5index 9d3823ec3e..12e46d1881 100644
6--- a/api/mfx_dispatch/linux/mfxparser.cpp
7+++ b/api/mfx_dispatch/linux/mfxparser.cpp
8@@ -20,6 +20,7 @@
9
10 #include <ctype.h>
11 #include <stdio.h>
12+#include <stdint.h>
13 #include <stdlib.h>
14 #include <string.h>
15
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"
12 12
13# Only for 64 bit until media-driver issues aren't fixed 13# Only for 64 bit until media-driver issues aren't fixed
14COMPATIBLE_HOST = '(x86_64).*-linux' 14COMPATIBLE_HOST = '(x86_64).*-linux'
15COMPATIBLE_HOST_x86-x32 = "null" 15COMPATIBLE_HOST:x86-x32 = "null"
16 16
17inherit features_check 17inherit features_check
18REQUIRED_DISTRO_FEATURES = "opengl" 18REQUIRED_DISTRO_FEATURES = "opengl"
19 19
20DEPENDS += "libdrm libva intel-media-driver" 20DEPENDS += "libva"
21
22RDEPENDS:${PN} += "intel-media-driver"
21 23
22PACKAGECONFIG ??= "${@bb.utils.contains("DISTRO_FEATURES", "x11", "dri3", "", d)} \ 24PACKAGECONFIG ??= "${@bb.utils.contains("DISTRO_FEATURES", "x11", "dri3", "", d)} \
23 ${@bb.utils.contains("DISTRO_FEATURES", "wayland", "wayland", "", d)} \ 25 ${@bb.utils.contains("DISTRO_FEATURES", "wayland", "wayland", "", d)} \
@@ -27,16 +29,16 @@ PACKAGECONFIG ??= "${@bb.utils.contains("DISTRO_FEATURES", "x11", "dri3", "", d)
27 29
28PACKAGECONFIG[dri3] = "-DENABLE_X11_DRI3=ON, -DENABLE_X11_DRI3=OFF" 30PACKAGECONFIG[dri3] = "-DENABLE_X11_DRI3=ON, -DENABLE_X11_DRI3=OFF"
29PACKAGECONFIG[itt] = "-DENABLE_ITT=ON, -DENABLE_ITT=OFF, itt" 31PACKAGECONFIG[itt] = "-DENABLE_ITT=ON, -DENABLE_ITT=OFF, itt"
30PACKAGECONFIG[opencl] = "-DENABLE_OPENCL=ON, -DENABLE_OPENCL=OFF, ocl-icd opencl-clhpp opencl-headers" 32PACKAGECONFIG[opencl] = "-DENABLE_OPENCL=ON, -DENABLE_OPENCL=OFF, virtual/opencl-icd opencl-clhpp opencl-headers"
31PACKAGECONFIG[samples] = "-DBUILD_SAMPLES=ON, -DBUILD_SAMPLES=OFF" 33PACKAGECONFIG[samples] = "-DBUILD_SAMPLES=ON, -DBUILD_SAMPLES=OFF"
32PACKAGECONFIG[wayland] = "-DENABLE_WAYLAND=ON, -DENABLE_WAYLAND=OFF, wayland wayland-native" 34PACKAGECONFIG[wayland] = "-DENABLE_WAYLAND=ON, -DENABLE_WAYLAND=OFF, wayland wayland-native"
33 35
34SRC_URI = "git://github.com/Intel-Media-SDK/MediaSDK.git;protocol=https;nobranch=1;lfs=0 \ 36SRC_URI = "git://github.com/Intel-Media-SDK/MediaSDK.git;protocol=https;nobranch=1;lfs=0 \
35 file://0001-FindITT.cmake-fix-detection-of-header-library.patch \ 37 file://0001-FindITT.cmake-fix-detection-of-header-library.patch \
36 file://0001-Don-t-try-to-autheticate-with-render-node.patch \ 38 file://fix-gcc13.patch \
37 " 39 "
38 40
39SRCREV = "03164a0b491651c210abd4549ca5275ac974d105" 41SRCREV = "869b60a6c3d7b5e9f7c3b3b914986322dca4bbae"
40S = "${WORKDIR}/git" 42S = "${WORKDIR}/git"
41 43
42UPSTREAM_CHECK_GITTAGREGEX = "^intel-mediasdk-(?P<pver>(\d+(\.\d+)+))$" 44UPSTREAM_CHECK_GITTAGREGEX = "^intel-mediasdk-(?P<pver>(\d+(\.\d+)+))$"
@@ -45,17 +47,17 @@ inherit cmake pkgconfig
45 47
46EXTRA_OECMAKE += "-DMFX_INCLUDE=${S}/api/include" 48EXTRA_OECMAKE += "-DMFX_INCLUDE=${S}/api/include"
47 49
48do_install_append() { 50do_install:append() {
49 mv ${D}${datadir}/mfx/samples ${D}${libdir}/mfx/samples 51 mv ${D}${datadir}/mfx/samples ${D}${libdir}/mfx/samples
50} 52}
51 53
52PACKAGE_BEFORE_PN = " ${PN}-samples" 54PACKAGE_BEFORE_PN = " ${PN}-samples"
53 55
54FILES_${PN} += " \ 56FILES:${PN} += " \
55 ${libdir}/mfx \ 57 ${libdir}/mfx \
56 ${datadir}/mfx/plugins.cfg \ 58 ${datadir}/mfx/plugins.cfg \
57 " 59 "
58 60
59FILES_${PN}-samples = "${libdir}/mfx/samples" 61FILES:${PN}-samples = "${libdir}/mfx/samples"
60 62
61INSANE_SKIP_${PN}-samples += "staticdev" 63INSANE_SKIP:${PN}-samples += "staticdev"
diff --git a/recipes-multimedia/onevpl/files/0001-ARLH-DID-open-source-6286.patch b/recipes-multimedia/onevpl/files/0001-ARLH-DID-open-source-6286.patch
new file mode 100644
index 00000000..8d1f3380
--- /dev/null
+++ b/recipes-multimedia/onevpl/files/0001-ARLH-DID-open-source-6286.patch
@@ -0,0 +1,39 @@
1From a425927469b36e7bc597bff4fdc24d42a1168d1a Mon Sep 17 00:00:00 2001
2From: gfxVPLsdm <gfxvplsdm@intel.com>
3Date: Mon, 18 Dec 2023 09:58:35 +0800
4Subject: [PATCH] ARLH DID open source (#6286)
5
6Co-authored-by: huangli <li.h.huang@intel.com>
7
8Upstream-Status: Backport [https://github.com/oneapi-src/oneVPL-intel-gpu/commit/66f1b4d60a367eb1b0774e0b4369f906e0e632ae]
9Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
10
11---
12 _studio/shared/include/mfxstructures-int.h | 7 ++++++-
13 1 file changed, 6 insertions(+), 1 deletion(-)
14
15diff --git a/_studio/shared/include/mfxstructures-int.h b/_studio/shared/include/mfxstructures-int.h
16index 363d9a63..8f16b0a8 100644
17--- a/_studio/shared/include/mfxstructures-int.h
18+++ b/_studio/shared/include/mfxstructures-int.h
19@@ -1,4 +1,4 @@
20-// Copyright (c) 2007-2021 Intel Corporation
21+// Copyright (c) 2007-2023 Intel Corporation
22 //
23 // Permission is hereby granted, free of charge, to any person obtaining a copy
24 // of this software and associated documentation files (the "Software"), to deal
25@@ -569,6 +569,11 @@ typedef struct {
26 /* ARL S */
27 { 0x7D67, MFX_HW_ARL, MFX_GT2 },
28
29+ /* ARL H*/
30+ { 0x7D51, MFX_HW_ARL, MFX_GT2 },
31+ { 0x7DD1, MFX_HW_ARL, MFX_GT2 },
32+ { 0x7D41, MFX_HW_ARL, MFX_GT2 },
33+
34 };
35
36 /*
37--
382.40.1
39
diff --git a/recipes-multimedia/onevpl/files/0001-Fix-SetBuffersYV12-V-U-plane-offsets-calculation-647.patch b/recipes-multimedia/onevpl/files/0001-Fix-SetBuffersYV12-V-U-plane-offsets-calculation-647.patch
new file mode 100644
index 00000000..8e014c97
--- /dev/null
+++ b/recipes-multimedia/onevpl/files/0001-Fix-SetBuffersYV12-V-U-plane-offsets-calculation-647.patch
@@ -0,0 +1,32 @@
1From e118062518c95d8fb0080cc8276b123a90bd0eb9 Mon Sep 17 00:00:00 2001
2From: gfxVPLsdm <gfxvplsdm@intel.com>
3Date: Wed, 21 Feb 2024 17:11:52 +0800
4Subject: [PATCH] Fix SetBuffersYV12() V & U plane offsets calculation (#6475)
5
6Signed-off-by: Hoe, Sheng Yang <sheng.yang.hoe@intel.com>
7Co-authored-by: Hoe, Sheng Yang <sheng.yang.hoe@intel.com>
8
9Upstream-Status: Backport [https://github.com/oneapi-src/oneVPL-intel-gpu/commit/ce704ddfe11724767ba86c9425a3917dc3100d4a]
10Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
11---
12 _studio/shared/src/libmfx_core_vaapi.cpp | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
14
15diff --git a/_studio/shared/src/libmfx_core_vaapi.cpp b/_studio/shared/src/libmfx_core_vaapi.cpp
16index 2cad86f8..fd5fc269 100644
17--- a/_studio/shared/src/libmfx_core_vaapi.cpp
18+++ b/_studio/shared/src/libmfx_core_vaapi.cpp
19@@ -462,8 +462,8 @@ public:
20 }
21 else
22 {
23- eb.offsets[1] = eb.offsets[0] + uint32_t(eb.height * eb.pitches[1] / 2);
24- eb.offsets[2] = eb.offsets[1] + uint32_t(eb.height * eb.pitches[2] / 2);
25+ eb.offsets[1] = eb.offsets[0] + uint32_t(eb.height * eb.pitches[0]);
26+ eb.offsets[2] = eb.offsets[1] + uint32_t(eb.height * eb.pitches[1] / 2);
27 }
28 eb.num_planes = 3;
29 eb.data_size = eb.offsets[2] + (eb.height * eb.pitches[2] / 2);
30--
312.40.1
32
diff --git a/recipes-multimedia/onevpl/files/0001-JPEGe-Enable-BGR4-JPEG-Enc-support-6470.patch b/recipes-multimedia/onevpl/files/0001-JPEGe-Enable-BGR4-JPEG-Enc-support-6470.patch
new file mode 100644
index 00000000..e3854407
--- /dev/null
+++ b/recipes-multimedia/onevpl/files/0001-JPEGe-Enable-BGR4-JPEG-Enc-support-6470.patch
@@ -0,0 +1,96 @@
1From 40c0bc6d3dfe172dd25908df2c16de29c34fa4d4 Mon Sep 17 00:00:00 2001
2From: gfxVPLsdm <gfxvplsdm@intel.com>
3Date: Mon, 5 Feb 2024 17:14:07 +0800
4Subject: [PATCH] [JPEGe] Enable BGR4 JPEG Enc support (#6470)
5
6Co-authored-by: vcheah <vincent.beng.keat.cheah@intel.com>
7
8Upstream-Status: Backport [https://github.com/oneapi-src/oneVPL-intel-gpu/commit/e73763d05f8fdc348c356b58dcb83075b5e868f8]
9Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
10---
11 .../mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw.cpp | 6 ++++--
12 .../encode_hw/mjpeg/src/mfx_mjpeg_encode_hw_utils.cpp | 9 +++++----
13 2 files changed, 9 insertions(+), 6 deletions(-)
14
15diff --git a/_studio/mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw.cpp b/_studio/mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw.cpp
16index 141564b1..332f6372 100644
17--- a/_studio/mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw.cpp
18+++ b/_studio/mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw.cpp
19@@ -212,7 +212,8 @@ mfxStatus MFXVideoENCODEMJPEG_HW::QueryImplsDescription(
20 ah.PushBack(memCaps.ColorFormats) = MFX_FOURCC_YV12;
21 ah.PushBack(memCaps.ColorFormats) = MFX_FOURCC_YUY2;
22 ah.PushBack(memCaps.ColorFormats) = MFX_FOURCC_RGB4;
23- memCaps.NumColorFormats = 4;
24+ ah.PushBack(memCaps.ColorFormats) = MFX_FOURCC_BGR4;
25+ memCaps.NumColorFormats = 5;
26
27 ah.PushBack(profileCaps.MemDesc);
28 profileCaps.MemDesc[1] = profileCaps.MemDesc[0];
29@@ -392,7 +393,7 @@ mfxStatus MFXVideoENCODEMJPEG_HW::Query(VideoCORE * core, mfxVideoParam *in, mfx
30 if ((fourCC == 0 && chromaFormat == 0) ||
31 (fourCC == MFX_FOURCC_NV12 && (chromaFormat == MFX_CHROMAFORMAT_YUV420 || chromaFormat == MFX_CHROMAFORMAT_YUV400)) ||
32 (fourCC == MFX_FOURCC_YUY2 && chromaFormat == MFX_CHROMAFORMAT_YUV422H) ||
33- (fourCC == MFX_FOURCC_RGB4 && chromaFormat == MFX_CHROMAFORMAT_YUV444))
34+ ((fourCC == MFX_FOURCC_RGB4 || fourCC == MFX_FOURCC_BGR4) && chromaFormat == MFX_CHROMAFORMAT_YUV444))
35 {
36 out->mfx.FrameInfo.FourCC = in->mfx.FrameInfo.FourCC;
37 out->mfx.FrameInfo.ChromaFormat = in->mfx.FrameInfo.ChromaFormat;
38@@ -698,6 +699,7 @@ mfxStatus MFXVideoENCODEMJPEG_HW::Init(mfxVideoParam *par)
39 doubleBytesPerPx = 4;
40 break;
41 case MFX_FOURCC_RGB4:
42+ case MFX_FOURCC_BGR4:
43 default:
44 doubleBytesPerPx = 8;
45 break;
46diff --git a/_studio/mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw_utils.cpp b/_studio/mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw_utils.cpp
47index 3fc619d1..b1ab556e 100644
48--- a/_studio/mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw_utils.cpp
49+++ b/_studio/mfx_lib/encode_hw/mjpeg/src/mfx_mjpeg_encode_hw_utils.cpp
50@@ -108,6 +108,7 @@ mfxStatus MfxHwMJpegEncode::CheckJpegParam(VideoCORE *core, mfxVideoParam & par,
51 BytesPerPx = 2;
52 break;
53 case MFX_FOURCC_RGB4:
54+ case MFX_FOURCC_BGR4:
55 default:
56 BytesPerPx = 4;
57 }
58@@ -157,7 +158,7 @@ mfxStatus ExecuteBuffers::Init(mfxVideoParam const *par, mfxEncodeCtrl const * c
59
60 m_payload_base.length = 0;
61 m_payload_list.clear();
62- if (fourCC == MFX_FOURCC_RGB4 && chromaFormat == MFX_CHROMAFORMAT_YUV444)
63+ if ((fourCC == MFX_FOURCC_RGB4 || fourCC == MFX_FOURCC_BGR4) && chromaFormat == MFX_CHROMAFORMAT_YUV444)
64 {
65 m_app14_data.header = 0xEEFF;//APP14
66 m_app14_data.lenH = 0;
67@@ -287,7 +288,7 @@ mfxStatus ExecuteBuffers::Init(mfxVideoParam const *par, mfxEncodeCtrl const * c
68 m_pps.num_components = 3;
69 else if (fourCC == MFX_FOURCC_NV12 && chromaFormat == MFX_CHROMAFORMAT_YUV400)
70 m_pps.num_components = 1;
71- else if (fourCC == MFX_FOURCC_RGB4 && chromaFormat == MFX_CHROMAFORMAT_YUV444)
72+ else if ((fourCC == MFX_FOURCC_RGB4 || fourCC == MFX_FOURCC_BGR4) && chromaFormat == MFX_CHROMAFORMAT_YUV444)
73 m_pps.num_components = 3;
74 else
75 MFX_RETURN(MFX_ERR_UNDEFINED_BEHAVIOR);
76@@ -341,7 +342,7 @@ mfxStatus ExecuteBuffers::Init(mfxVideoParam const *par, mfxEncodeCtrl const * c
77 {
78 // No external tables - use Quality parameter
79 m_dqt_list.resize(0);
80- if (fourCC == MFX_FOURCC_RGB4)
81+ if (fourCC == MFX_FOURCC_RGB4 || fourCC == MFX_FOURCC_BGR4)
82 {
83 m_pps.quantiser_table_selector[0] = 0;
84 m_pps.quantiser_table_selector[1] = 0;
85@@ -393,7 +394,7 @@ mfxStatus ExecuteBuffers::Init(mfxVideoParam const *par, mfxEncodeCtrl const * c
86 {
87 m_dht_list.resize(0);
88 }
89- else if (hwCaps->MaxNumHuffTable == 1 || fourCC == MFX_FOURCC_RGB4)
90+ else if (hwCaps->MaxNumHuffTable == 1 || (fourCC == MFX_FOURCC_RGB4 || fourCC == MFX_FOURCC_BGR4))
91 {
92 m_dht_list.resize(1);
93
94--
952.40.1
96
diff --git a/recipes-multimedia/onevpl/files/0001-vpl.pc.in-dont-pass-pcfiledir-to-cflags.patch b/recipes-multimedia/onevpl/files/0001-vpl.pc.in-dont-pass-pcfiledir-to-cflags.patch
new file mode 100644
index 00000000..762a4902
--- /dev/null
+++ b/recipes-multimedia/onevpl/files/0001-vpl.pc.in-dont-pass-pcfiledir-to-cflags.patch
@@ -0,0 +1,28 @@
1From 630c32194f53c70f4f654fb3d198790df253ba1f Mon Sep 17 00:00:00 2001
2From: Markus Volk <f_l_k@t-online.de>
3Date: Thu, 15 Jun 2023 13:43:32 +0200
4Subject: [PATCH] vpl.pc.in: dont pass pcfiledir to cflags
5
6Signed-off-by: Markus Volk <f_l_k@t-online.de>
7
8Upstream-Status: Inappropriate [oe specific]
9---
10 libvpl/pkgconfig/vpl.pc.in | 4 ++--
11 1 file changed, 2 insertions(+), 2 deletions(-)
12
13diff --git a/libvpl/pkgconfig/vpl.pc.in b/libvpl/pkgconfig/vpl.pc.in
14index ab468a9..05c020e 100644
15--- a/libvpl/pkgconfig/vpl.pc.in
16+++ b/libvpl/pkgconfig/vpl.pc.in
17@@ -8,6 +8,6 @@ Description: oneAPI Video Processing Library
18 Version: @API_VERSION_MAJOR@.@API_VERSION_MINOR@
19 URL: https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onevpl.html
20
21-Libs: -L${libdir} -l@OUTPUT_NAME@ @VPL_PKGCONFIG_DEPENDENT_LIBS@
22+Libs: -L@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ -l@OUTPUT_NAME@ @VPL_PKGCONFIG_DEPENDENT_LIBS@
23 Libs.private: @VPL_PKGCONFIG_PRIVATE_LIBS@
24-Cflags: -I${includedir} -I${includedir}/vpl
25+Cflags: -I@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@ -I@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/vpl
26--
272.40.1
28
diff --git a/recipes-multimedia/onevpl/onevpl-intel-gpu_23.4.3.bb b/recipes-multimedia/onevpl/onevpl-intel-gpu_23.4.3.bb
new file mode 100644
index 00000000..0b849bf1
--- /dev/null
+++ b/recipes-multimedia/onevpl/onevpl-intel-gpu_23.4.3.bb
@@ -0,0 +1,33 @@
1SUMMARY = "Intel(R) oneVPL runtime for Intel GPU accelerated media processing"
2DESCRIPTION = "Intel(R) oneVPL runtime provides an runtime to access hardware-accelerated \
3video decode, encode and filtering on Intel® graphics."
4
5HOMEPAGE = "https://github.com/oneapi-src/oneVPL-intel-gpu"
6BUGTRACKER = "https://github.com/oneapi-src/oneVPL-intel-gpu/issues"
7
8LICENSE = "MIT"
9LIC_FILES_CHKSUM = "file://LICENSE;md5=eb8cb45b9b57dbaa9fcc9adc4230202b"
10
11PE = "1"
12
13# Only for 64 bit
14COMPATIBLE_HOST = '(x86_64).*-linux'
15COMPATIBLE_HOST:x86-x32 = "null"
16
17DEPENDS += "libdrm libva intel-media-driver onevpl pkgconfig-native"
18RDEPENDS:${PN} += "intel-media-driver"
19
20SRC_URI = "git://github.com/oneapi-src/oneVPL-intel-gpu.git;protocol=https;nobranch=1;lfs=0 \
21 file://0001-ARLH-DID-open-source-6286.patch \
22 file://0001-JPEGe-Enable-BGR4-JPEG-Enc-support-6470.patch \
23 file://0001-Fix-SetBuffersYV12-V-U-plane-offsets-calculation-647.patch \
24 "
25
26SRCREV = "852fa9f705ef44c004d014548601f3804a6de705"
27S = "${WORKDIR}/git"
28
29FILES:${PN} += " \
30 ${libdir}/libmfx-gen/enctools.so \
31 "
32
33inherit cmake
diff --git a/recipes-multimedia/onevpl/onevpl_2023.4.0.bb b/recipes-multimedia/onevpl/onevpl_2023.4.0.bb
new file mode 100644
index 00000000..513c7f2c
--- /dev/null
+++ b/recipes-multimedia/onevpl/onevpl_2023.4.0.bb
@@ -0,0 +1,40 @@
1SUMMARY = "oneAPI Video Processing Library"
2DESCRIPTION = "The oneAPI Video Processing Library (oneVPL) provides \
3a single video processing API for encode, decode, and video processing \
4that works across a wide range of accelerators."
5
6HOMEPAGE = "https://github.com/oneapi-src/oneVPL"
7LICENSE = "MIT"
8LIC_FILES_CHKSUM = "file://LICENSE;md5=c18ea6bb4786a26bf4eee88a7424a408 \
9 file://third-party-programs.txt;md5=0e35a23482445dd089b4eabe19103a06"
10
11SRC_URI = "git://github.com/oneapi-src/oneVPL.git;protocol=https;branch=master \
12 file://0001-vpl.pc.in-dont-pass-pcfiledir-to-cflags.patch \
13 "
14SRCREV = "2274efcd3672b43297ef774f332e1fed6781381c"
15S = "${WORKDIR}/git"
16
17inherit cmake
18DEPENDS += "libva pkgconfig-native"
19
20PACKAGECONFIG ??= "tools"
21PACKAGECONFIG[tools] = "-DBUILD_TOOLS=ON, -DBUILD_TOOLS=OFF, wayland wayland-native wayland-protocols"
22
23do_install:append() {
24 mkdir -p ${D}${datadir}/oneVPL/samples
25 mv ${D}${bindir}/sample_* ${D}${datadir}/oneVPL/samples
26}
27
28COMPATIBLE_HOST = '(x86_64).*-linux'
29
30PACKAGES =+ "${PN}-examples"
31
32FILES:${PN}-examples = "${datadir}/vpl \
33 "
34
35FILES_SOLIBSDEV = ""
36FILES:${PN}-dev += "${libdir}/libvpl.so"
37
38FILES:${PN} += " ${datadir}/oneVPL/samples \
39 ${libdir}/vpl/libvpl_wayland.so \
40 "
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 @@
1From efedbf9080c19241c2aa9ee7ba901245d38c8fa2 Mon Sep 17 00:00:00 2001
2From: Naveen Saini <naveen.kumar.saini@intel.com>
3Date: Mon, 7 Mar 2022 16:44:24 +0800
4Subject: [PATCH 1/2] CMakeLists.txt: exclude host system headers
5
6Upstream-Status: Inappropriate
7
8Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
9---
10 sources/ippcp/crypto_mb/CMakeLists.txt | 1 -
11 1 file changed, 1 deletion(-)
12
13diff --git a/sources/ippcp/crypto_mb/CMakeLists.txt b/sources/ippcp/crypto_mb/CMakeLists.txt
14index c4cc82a..4094f34 100644
15--- a/sources/ippcp/crypto_mb/CMakeLists.txt
16+++ b/sources/ippcp/crypto_mb/CMakeLists.txt
17@@ -82,7 +82,6 @@ include_directories(
18 ${CRYPTO_MB_INCLUDE_DIR}
19 ${OPENSSL_INCLUDE_DIR}
20 $<$<C_COMPILER_ID:Intel>:$ENV{ROOT}/compiler/include $ENV{ROOT}/compiler/include/icc>
21- $<$<NOT:$<C_COMPILER_ID:Intel>>:${CMAKE_SYSTEM_INCLUDE_PATH}>
22 $<$<OR:$<C_COMPILER_ID:Intel>,$<BOOL:${MSVC_IDE}>>:$ENV{INCLUDE}>
23 )
24
25--
262.17.1
27
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 @@
1From 3b7b4eca54aa8d851e37f60c74e4a027fa7b21f2 Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Wed, 14 Jun 2023 13:18:45 +0800
4Subject: [PATCH] crypto-mb: Make sure libs are installed correctly
5
6Dont assume that "lib" is always the correct destination. This fixes
7multilib builds when libdir != /usr/lib.
8
9Upstream-Status: Pending
10
11Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
12---
13 sources/ippcp/crypto_mb/src/CMakeLists.txt | 6 +++---
14 1 file changed, 3 insertions(+), 3 deletions(-)
15
16diff --git a/sources/ippcp/crypto_mb/src/CMakeLists.txt b/sources/ippcp/crypto_mb/src/CMakeLists.txt
17index c9cad06..31f52bd 100644
18--- a/sources/ippcp/crypto_mb/src/CMakeLists.txt
19+++ b/sources/ippcp/crypto_mb/src/CMakeLists.txt
20@@ -123,8 +123,8 @@ endif(DYNAMIC_LIB OR MB_STANDALONE)
21 # Installation of the shared library
22 if (MB_STANDALONE) # standalone crypto_mb's cmake run
23 install(TARGETS ${MB_DYN_LIB_TARGET}
24- LIBRARY DESTINATION "lib"
25- RUNTIME DESTINATION "lib"
26+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
27+ RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
28 PUBLIC_HEADER DESTINATION "include/crypto_mb")
29 elseif (DYNAMIC_LIB) # build from ippcp's cmake
30 install(TARGETS ${MB_DYN_LIB_TARGET}
31@@ -154,7 +154,7 @@ endif()
32 # Static lib installation
33 if(MB_STANDALONE)
34 install(TARGETS ${MB_STATIC_LIB_TARGET}
35- ARCHIVE DESTINATION "lib"
36+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
37 PUBLIC_HEADER DESTINATION "include/crypto_mb")
38 else()
39 install(TARGETS ${MB_STATIC_LIB_TARGET}
40--
412.37.3
42
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 @@
1From b4549bb765d279b5ba042c6340e1dd69d0890b64 Mon Sep 17 00:00:00 2001
2From: Naveen Saini <naveen.kumar.saini@intel.com>
3Date: Thu, 10 Mar 2022 14:30:01 +0800
4Subject: [PATCH 2/2] cmake: exclude Yocto build flags
5
6Ipp-crypto has its own set of flags and -march values,
7which causes conflict with default -march=nehalem in gcc
8
9Upstream-Status: Inappropriate
10
11Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
12---
13 sources/ippcp/crypto_mb/src/CMakeLists.txt | 2 +-
14 sources/ippcp/crypto_mb/src/cmake/linux/GNU.cmake | 2 +-
15 2 files changed, 2 insertions(+), 2 deletions(-)
16
17diff --git a/sources/ippcp/crypto_mb/src/CMakeLists.txt b/sources/ippcp/crypto_mb/src/CMakeLists.txt
18index 1ca1a8c..5284d62 100644
19--- a/sources/ippcp/crypto_mb/src/CMakeLists.txt
20+++ b/sources/ippcp/crypto_mb/src/CMakeLists.txt
21@@ -81,7 +81,7 @@ endif()
22 set(MB_LIB_TARGET ${MB_DYN_LIB_TARGET})
23
24 set_source_files_properties(${CRYPTO_MB_SOURCES} PROPERTIES COMPILE_DEFINITIONS "${AVX512_LIBRARY_DEFINES}"
25- COMPILE_FLAGS "${AVX512_CFLAGS} ${CMAKE_ASM_FLAGS} ${CMAKE_C_FLAGS_SECURITY}")
26+ COMPILE_FLAGS "${AVX512_CFLAGS} ${CMAKE_C_FLAGS_SECURITY}")
27
28 # 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'
29 # The bug has been fixed since version 2021.3. This is a workaround to support older versions of Intel® C Compiler.
30diff --git a/sources/ippcp/crypto_mb/src/cmake/linux/GNU.cmake b/sources/ippcp/crypto_mb/src/cmake/linux/GNU.cmake
31index a2abeeb..aadd6e2 100644
32--- a/sources/ippcp/crypto_mb/src/cmake/linux/GNU.cmake
33+++ b/sources/ippcp/crypto_mb/src/cmake/linux/GNU.cmake
34@@ -58,7 +58,7 @@ set(LINK_FLAGS_DYNAMIC "${LINK_FLAGS_DYNAMIC} ${CRYPTO_MB_SOURCES_DIR}/cmake/dll
35 # Compiler flags
36
37 # Tells the compiler to align functions and loops
38-set(CMAKE_C_FLAGS " -falign-functions=32 -falign-loops=32")
39+set(CMAKE_C_FLAGS " -falign-functions=32 -falign-loops=32 ${TOOLCHAIN_OPTIONS}")
40 # Ensures that compilation takes place in a freestanding environment
41 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffreestanding")
42
43--
442.17.1
45
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 @@
1SUMMARY = "Crypto Multi-buffer Library"
2DESCRIPTION = "Intel® Integrated Performance Primitives (Intel® IPP) Cryptography \
3is a secure, fast and lightweight library of building blocks for cryptography, \
4highly-optimized for various Intel® CPUs."
5HOMEPAGE = "https://github.com/intel/ipp-crypto"
6
7LICENSE = "Apache-2.0"
8
9LIC_FILES_CHKSUM = "file://../../../LICENSE;md5=e787af283468feca985d6b865d27d95b"
10
11IPP_BRANCH = "ipp-crypto_${@'_'.join(d.getVar('PV').rsplit('.')[-3:])}"
12
13SRC_URI = "git://github.com/intel/ipp-crypto;protocol=https;branch=${IPP_BRANCH} \
14 file://0001-CMakeLists.txt-exclude-host-system-headers.patch;striplevel=4 \
15 file://0002-cmake-exclude-Yocto-build-flags.patch;striplevel=4 \
16 file://0001-crypto-mb-Make-sure-libs-are-installed-correctly.patch;striplevel=4 \
17 "
18SRCREV = "d02611e34328898d16025467d3deeb7d62b6076b"
19
20S = "${WORKDIR}/git/sources/ippcp/crypto_mb"
21
22DEPENDS = "openssl"
23
24inherit cmake pkgconfig
25COMPATIBLE_HOST = '(x86_64).*-linux'
26
27EXTRA_OECMAKE += " -DARCH=intel64"
28EXTRA_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 @@
1SUMMARY = "oneAPI DPC++ Library (oneDPL)"
2DESCRIPTION = "The oneAPI DPC++ Library (oneDPL) aims to work with the \
3oneAPI DPC++ Compiler to provide high-productivity APIs to developers, \
4which can minimize DPC++ programming efforts across devices for high \
5performance parallel applications."
6HOMEPAGE = "https://github.com/oneapi-src/oneDPL"
7
8LICENSE = "Apache-2.0-with-LLVM-exception"
9LIC_FILES_CHKSUM = "file://licensing/LICENSE.txt;md5=2e982d844baa4df1c80de75470e0c5cb \
10 file://licensing/third-party-programs.txt;md5=cfb8d6b1f04a8fcc7d0dddd817619634"
11
12S = "${WORKDIR}/git"
13
14SRC_URI = "git://github.com/oneapi-src/oneDPL.git;protocol=https;branch=release/2022.3 \
15 "
16SRCREV = "180f18ad25fbc39fa13bad43f1df7d54ee8f5609"
17
18do_compile[noexec] = "1"
19do_configure[noexec] = "1"
20
21do_install() {
22 install -d -m 755 ${D}${includedir}/onedpl
23 cp -r ${S}/include/* ${D}${includedir}/onedpl
24}
25
26UPSTREAM_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 @@
1/opt/intel/oneapi/lib
2/opt/intel/oneapi/lib/intel64
3/opt/intel/oneapi/lib/ia32
4/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 @@
1SUMMARY = "Intel® oneAPI runtime libraries environment set up"
2DESCRIPTION = "Recipe to set up the environment for Intel® oneAPI runtime libraries \
3via configuration file in ld.so.conf.d directory."
4
5LICENSE = "EULA"
6LIC_FILES_CHKSUM = "file://${CUSTOM_LICENSES_PATH}/EULA;md5=7bfc91523de2e84e7131d0eacf2827d4"
7
8SRC_URI = "file://intel-oneapi-runtime.conf"
9
10do_install() {
11 mkdir -p ${D}${sysconfdir}/ld.so.conf.d/
12 install -m 644 ${WORKDIR}/intel-oneapi-runtime.conf ${D}${sysconfdir}/ld.so.conf.d/
13}
14
15pkg_postinst_ontarget:${PN}() {
16if [ x"$D" = "x" ]; then
17 if [ -x /sbin/ldconfig ]; then /sbin/ldconfig ; fi
18fi
19}
20BBCLASSEXTEND = "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 @@
1require recipes-core/images/core-image-minimal.bb 1require recipes-core/images/core-image-minimal.bb
2 2
3DEPENDS_remove = "grub-efi" 3DEPENDS:remove = "grub-efi"
4 4
5inherit uefi-comboapp 5inherit uefi-comboapp
6 6
7WKS_FILE = "generic-bootdisk.wks.in" 7WKS_FILE = "generic-bootdisk.wks.in"
8 8
9do_uefiapp_deploy_append() { 9do_uefiapp_deploy:append() {
10 for i in ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.boot*.efi; do 10 for i in ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.boot*.efi; do
11 target=`basename $i` 11 target=`basename $i`
12 target=`echo $target | sed -e 's/${IMAGE_LINK_NAME}.//'` 12 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"
2DESCRIPTION = "ISA-L is a collection of optimized low-level functions \ 2DESCRIPTION = "ISA-L is a collection of optimized low-level functions \
3targeting storage applications." 3targeting storage applications."
4LICENSE = "BSD-3-Clause" 4LICENSE = "BSD-3-Clause"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=e6c7d82ad7dd512687b0991a159a1ca9" 5LIC_FILES_CHKSUM = "file://LICENSE;md5=2476688d0948d4a3f7c69473a603540d"
6SECTION = "lib" 6SECTION = "lib"
7 7
8inherit autotools pkgconfig 8inherit autotools pkgconfig
9 9
10S = "${WORKDIR}/git" 10S = "${WORKDIR}/git"
11SRCREV = "2df39cf5f1b9ccaa2973f6ef273857e4dc46f0cf" 11SRCREV = "bd226375027899087bd48f3e59b910430615cc0a"
12SRC_URI = "git://github.com/intel/isa-l.git" 12SRC_URI = "git://github.com/intel/isa-l.git;branch=master;protocol=https"
13 13
14DEPENDS = "nasm-native" 14DEPENDS = "nasm-native"
15AS[unexport] = "1" 15AS[unexport] = "1"
16 16
17TARGET_CC_ARCH += "${LDFLAGS}"
18
17COMPATIBLE_HOST = '(x86_64).*-linux' 19COMPATIBLE_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 @@
1SUMMARY = "Intel Dynamic Application Loader (DAL) Host Interface"
2DESCRIPTION = "A daemon and libraries which allow user space applications \
3to install Java applets on DAL FW and communicate with them"
4LICENSE = "Apache-2.0"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=833126f14614a3276708a4d7c9734645"
6
7SRC_URI = "git://github.com/intel/dynamic-application-loader-host-interface.git;protocol=https"
8
9inherit cmake useradd systemd pkgconfig update-rc.d
10
11SRCREV = "4c9ef52bcd55fa03b30ac323e553a05be858d41e"
12
13S = "${WORKDIR}/git"
14
15DEPENDS += "util-linux libxml2"
16DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"
17RDEPENDS_${PN} += "bash"
18
19USERADD_PACKAGES = "${PN}"
20USERADD_PARAM_${PN} = "--system --no-create-home --shell /bin/false -g mei jhi"
21
22GROUPADD_PARAM_${PN} = "-g 880 mei"
23
24COMPATIBLE_HOST_libc-musl = 'null'
25
26SYSTEMD_SERVICE_${PN} = "jhi.service"
27
28INITSCRIPT_PACKAGES = "${PN}"
29INITSCRIPT_NAME_${PN} = "${PN}"
30INITSCRIPT_PARAMS_${PN} = "defaults"
31
32# systemd is the default so they are installed when sysvinit is not selected as INIT_SYSTEM
33EXTRA_OECMAKE = "-DCMAKE_SKIP_RPATH=ON \
34 -DINIT_SYSTEM=${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'SysVinit', 'systemd', d)} \
35 -DAPPLETS_DIR=${libdir}/dal/applets \
36 -DAPP_REPO_DIR=${localstatedir}/cache/dal/applet_repository \
37 "
38
39do_install_append () {
40 install -d ${D}${localstatedir}/cache/dal/applet_repository
41
42 chown -R jhi ${D}${localstatedir}/cache/dal/applet_repository
43 chgrp -R mei ${D}${localstatedir}/cache/dal/applet_repository
44
45 install -d ${D}${bindir}
46 install -m 755 ${B}/bin_linux/smoketest ${D}${bindir}
47 install -m 755 ${B}/bin_linux/bist ${D}${bindir}
48
49 install -d ${D}${libdir}/dal/applets
50 cp -r ${S}/test/smoketest/applets/* ${D}${libdir}/dal/applets/
51}
52
53PACKAGES += "${PN}-test"
54
55FILES_${PN}-dev = ""
56
57FILES_${PN} = "\
58 ${sbindir} \
59 ${sysconfdir} \
60 ${libdir}/lib*${SOLIBSDEV} \
61 ${libdir}/dal/applets/SpoolerApplet.dalp \
62 ${nonarch_libdir}/tmpfiles.d \
63 ${systemd_system_unitdir} \
64 ${localstatedir}/cache/dal/applet_repository \
65 "
66
67FILES_${PN}-test = "\
68 ${bindir} \
69 ${libdir}/dal/applets \
70 "
71
72UPSTREAM_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..205967c1 100644
--- a/recipes-support/libipt/libipt_2.0.4.bb
+++ b/recipes-support/libipt/libipt_2.1.1.bb
@@ -5,23 +5,24 @@ library or it can be partially or fully integrated into your tool."
5HOMEPAGE = "https://github.com/intel/libipt" 5HOMEPAGE = "https://github.com/intel/libipt"
6 6
7LICENSE = "BSD-3-Clause" 7LICENSE = "BSD-3-Clause"
8LIC_FILES_CHKSUM = "file://LICENSE;md5=aea4783603fc6bd8dff5157996ccb9d9" 8LIC_FILES_CHKSUM = "file://LICENSE;md5=a429afa59f273b5d12778eda69d10313"
9 9
10inherit pkgconfig cmake 10inherit pkgconfig cmake
11 11
12S = "${WORKDIR}/git" 12S = "${WORKDIR}/git"
13 13
14SRC_URI = "git://github.com/intel/libipt.git;protocol=https;branch=stable/v2.0" 14SRC_URI = "git://github.com/intel/libipt.git;protocol=https;branch=stable/v2.1"
15 15
16SRCREV = "63813186694487a2bc005f32be57eb526e16714b" 16SRCREV = "1c9bc700f4b9a71fd2d1cf1742de7e2351ddb281"
17 17
18EXTRA_OECMAKE += " \ 18EXTRA_OECMAKE += " \
19 -DPTDUMP=ON \ 19 -DPTDUMP=ON \
20 -DPTTC=ON \ 20 -DPTTC=ON \
21 -DPTSEG=ON \
21 -DCMAKE_SKIP_RPATH=ON \ 22 -DCMAKE_SKIP_RPATH=ON \
22 " 23 "
23 24
24do_install_append() { 25do_install:append() {
25 install -d ${D}${bindir}/libipt 26 install -d ${D}${bindir}/libipt
26 install -d ${D}${bindir}/libipt/tests 27 install -d ${D}${bindir}/libipt/tests
27 28
@@ -29,5 +30,5 @@ do_install_append() {
29 cp -r ${WORKDIR}/git/test/src/* ${D}${bindir}/libipt/tests 30 cp -r ${WORKDIR}/git/test/src/* ${D}${bindir}/libipt/tests
30} 31}
31 32
32FILES_${PN}-test = "${bindir}" 33FILES:${PN}-test = "${bindir}"
33PACKAGES =+ "${PN}-test" 34PACKAGES =+ "${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 @@
1DESCRIPTION = "Utility for signing and verifying files for UEFI Secure Boot" 1DESCRIPTION = "Utility for signing and verifying files for UEFI Secure Boot"
2LICENSE = "GPLv3 & LGPL-2.1 & LGPL-3.0 & MIT" 2LICENSE = "GPL-3.0-only & LGPL-2.1-only & LGPL-3.0-only & MIT"
3 3
4# sbsigntool statically links to libccan.a which is built with modules 4# sbsigntool statically links to libccan.a which is built with modules
5# passed to "create-ccan-tree" (and their dependencies). Therefore, 5# passed to "create-ccan-tree" (and their dependencies). Therefore,
@@ -19,25 +19,25 @@ LIC_FILES_CHKSUM = "file://LICENSE.GPLv3;md5=9eef91148a9b14ec7f9df333daebc746 \
19 19
20# The original upstream is git://kernel.ubuntu.com/jk/sbsigntool but it has 20# The original upstream is git://kernel.ubuntu.com/jk/sbsigntool but it has
21# not been maintained and many patches have been backported in this repo. 21# not been maintained and many patches have been backported in this repo.
22SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git;protocol=https;name=sbsigntools \ 22SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git;protocol=https;name=sbsigntools;branch=master \
23 git://github.com/rustyrussell/ccan.git;protocol=https;destsuffix=git/lib/ccan.git;name=ccan \ 23 git://github.com/rustyrussell/ccan.git;protocol=https;destsuffix=git/lib/ccan.git;name=ccan;branch=master \
24 file://0001-configure-Fixup-build-dependencies-for-cross-compili.patch \ 24 file://0001-configure-Fixup-build-dependencies-for-cross-compili.patch \
25 " 25 "
26 26
27SRCREV_sbsigntools ?= "f12484869c9590682ac3253d583bf59b890bb826" 27SRCREV_sbsigntools ?= "9cfca9fe7aa7a8e29b92fe33ce8433e212c9a8ba"
28SRCREV_ccan ?= "b1f28e17227f2320d07fe052a8a48942fe17caa5" 28SRCREV_ccan ?= "b1f28e17227f2320d07fe052a8a48942fe17caa5"
29SRCREV_FORMAT = "sbsigntools_ccan" 29SRCREV_FORMAT = "sbsigntools_ccan"
30 30
31DEPENDS = "binutils-native gnu-efi-native help2man-native openssl-native util-linux-native" 31DEPENDS = "binutils-native gnu-efi-native help2man-native openssl-native util-linux-native"
32 32
33PV = "0.9.4-git${SRCPV}" 33PV = "0.9.5"
34 34
35S = "${WORKDIR}/git" 35S = "${WORKDIR}/git"
36 36
37inherit autotools pkgconfig 37inherit autotools pkgconfig
38inherit native 38inherit native
39 39
40do_configure_prepend() { 40do_configure:prepend() {
41 cd ${S} 41 cd ${S}
42 42
43 sed -i s#RECIPE_SYSROOT#${RECIPE_SYSROOT_NATIVE}#g configure.ac 43 sed -i s#RECIPE_SYSROOT#${RECIPE_SYSROOT_NATIVE}#g configure.ac
@@ -79,3 +79,5 @@ EXTRA_OEMAKE = "\
79 -I${STAGING_INCDIR_NATIVE} \ 79 -I${STAGING_INCDIR_NATIVE} \
80 -I${STAGING_INCDIR_NATIVE}/efi/${@efi_arch(d)}' \ 80 -I${STAGING_INCDIR_NATIVE}/efi/${@efi_arch(d)}' \
81 " 81 "
82
83CFLAGS: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.
10Prepend these paths with a placeholder that can be replaced with the 10Prepend these paths with a placeholder that can be replaced with the
11actual paths once they are resolved. 11actual paths once they are resolved.
12 12
13Upstream status: inappropriate [OE specific] 13Upstream-Status: Inappropriate [OE specific]
14 14
15Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com> 15Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
16 16