mirror of
https://github.com/intel/llvm.git
synced 2026-01-15 04:17:17 +08:00
[OpenCL] Implement extended subgroups fully in headers.
Extended subgroups are library style extensions and therefore they require no changes in the frontend. This commit: 1. Moves extension macro definitions to the internal headers. 2. Removes extension pragmas because they are not needed. Tags: #clang Differential Revision: https://reviews.llvm.org/D92231
This commit is contained in:
@@ -66,13 +66,6 @@ OPENCLEXT_INTERNAL(cl_khr_mipmap_image, 200, ~0U)
|
||||
OPENCLEXT_INTERNAL(cl_khr_mipmap_image_writes, 200, ~0U)
|
||||
OPENCLEXT_INTERNAL(cl_khr_srgb_image_writes, 200, ~0U)
|
||||
OPENCLEXT_INTERNAL(cl_khr_subgroups, 200, ~0U)
|
||||
OPENCLEXT_INTERNAL(cl_khr_subgroup_extended_types, 200, ~0U)
|
||||
OPENCLEXT_INTERNAL(cl_khr_subgroup_non_uniform_vote, 200, ~0U)
|
||||
OPENCLEXT_INTERNAL(cl_khr_subgroup_ballot, 200, ~0U)
|
||||
OPENCLEXT_INTERNAL(cl_khr_subgroup_non_uniform_arithmetic, 200, ~0U)
|
||||
OPENCLEXT_INTERNAL(cl_khr_subgroup_shuffle, 200, ~0U)
|
||||
OPENCLEXT_INTERNAL(cl_khr_subgroup_shuffle_relative, 200, ~0U)
|
||||
OPENCLEXT_INTERNAL(cl_khr_subgroup_clustered_reduce, 200, ~0U)
|
||||
|
||||
// Clang Extensions.
|
||||
OPENCLEXT_INTERNAL(cl_clang_storage_class_specifiers, 100, ~0U)
|
||||
|
||||
@@ -9,6 +9,21 @@
|
||||
#ifndef _OPENCL_BASE_H_
|
||||
#define _OPENCL_BASE_H_
|
||||
|
||||
// Define extension macros
|
||||
|
||||
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
|
||||
// For SPIR all extensions are supported.
|
||||
#if defined(__SPIR__)
|
||||
#define cl_khr_subgroup_extended_types 1
|
||||
#define cl_khr_subgroup_non_uniform_vote 1
|
||||
#define cl_khr_subgroup_ballot 1
|
||||
#define cl_khr_subgroup_non_uniform_arithmetic 1
|
||||
#define cl_khr_subgroup_shuffle 1
|
||||
#define cl_khr_subgroup_shuffle_relative 1
|
||||
#define cl_khr_subgroup_clustered_reduce 1
|
||||
#endif // defined(__SPIR__)
|
||||
#endif // (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
|
||||
|
||||
// built-in scalar data types:
|
||||
|
||||
/**
|
||||
|
||||
@@ -84,7 +84,11 @@ void test_atomics(__generic volatile unsigned int* a) {
|
||||
#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
|
||||
global atomic_int z = ATOMIC_VAR_INIT(99);
|
||||
#endif //__OPENCL_C_VERSION__
|
||||
// CHECK-MOD: Reading modules
|
||||
|
||||
// Check that extension macros are defined correctly.
|
||||
|
||||
// FIXME: this should not be defined for all targets
|
||||
// Verify that non-builtin cl_intel_planar_yuv extension is defined from
|
||||
// OpenCL 1.2 onwards.
|
||||
#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
|
||||
@@ -94,4 +98,57 @@ global atomic_int z = ATOMIC_VAR_INIT(99);
|
||||
#endif //__OPENCL_C_VERSION__
|
||||
#pragma OPENCL EXTENSION cl_intel_planar_yuv : enable
|
||||
|
||||
// CHECK-MOD: Reading modules
|
||||
// For SPIR all extensions are supported.
|
||||
#if defined(__SPIR__)
|
||||
|
||||
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
|
||||
|
||||
#if cl_khr_subgroup_extended_types != 1
|
||||
#error "Incorrectly defined cl_khr_subgroup_extended_types"
|
||||
#endif
|
||||
#if cl_khr_subgroup_non_uniform_vote != 1
|
||||
#error "Incorrectly defined cl_khr_subgroup_non_uniform_vote"
|
||||
#endif
|
||||
#if cl_khr_subgroup_ballot != 1
|
||||
#error "Incorrectly defined cl_khr_subgroup_ballot"
|
||||
#endif
|
||||
#if cl_khr_subgroup_non_uniform_arithmetic != 1
|
||||
#error "Incorrectly defined cl_khr_subgroup_non_uniform_arithmetic"
|
||||
#endif
|
||||
#if cl_khr_subgroup_shuffle != 1
|
||||
#error "Incorrectly defined cl_khr_subgroup_shuffle"
|
||||
#endif
|
||||
#if cl_khr_subgroup_shuffle_relative != 1
|
||||
#error "Incorrectly defined cl_khr_subgroup_shuffle_relative"
|
||||
#endif
|
||||
#if cl_khr_subgroup_clustered_reduce != 1
|
||||
#error "Incorrectly defined cl_khr_subgroup_clustered_reduce"
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifdef cl_khr_subgroup_extended_types
|
||||
#error "Incorrect cl_khr_subgroup_extended_types define"
|
||||
#endif
|
||||
#ifdef cl_khr_subgroup_non_uniform_vote
|
||||
#error "Incorrect cl_khr_subgroup_non_uniform_vote define"
|
||||
#endif
|
||||
#ifdef cl_khr_subgroup_ballot
|
||||
#error "Incorrect cl_khr_subgroup_ballot define"
|
||||
#endif
|
||||
#ifdef cl_khr_subgroup_non_uniform_arithmetic
|
||||
#error "Incorrect cl_khr_subgroup_non_uniform_arithmetic define"
|
||||
#endif
|
||||
#ifdef cl_khr_subgroup_shuffle
|
||||
#error "Incorrect cl_khr_subgroup_shuffle define"
|
||||
#endif
|
||||
#ifdef cl_khr_subgroup_shuffle_relative
|
||||
#error "Incorrect cl_khr_subgroup_shuffle_relative define"
|
||||
#endif
|
||||
#ifdef cl_khr_subgroup_clustered_reduce
|
||||
#error "Incorrect cl_khr_subgroup_clustered_reduce define"
|
||||
#endif
|
||||
|
||||
#endif //(defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
|
||||
|
||||
#endif // defined(__SPIR__)
|
||||
|
||||
@@ -205,88 +205,3 @@
|
||||
// expected-warning@+2{{unsupported OpenCL extension 'cl_intel_device_side_avc_motion_estimation' - ignoring}}
|
||||
#endif
|
||||
#pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : enable
|
||||
|
||||
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
|
||||
#ifndef cl_khr_subgroup_extended_types
|
||||
#error "Missing cl_khr_subgroup_extended_types"
|
||||
#endif
|
||||
#else
|
||||
#ifdef cl_khr_subgroup_extended_types
|
||||
#error "Incorrect cl_khr_subgroup_extended_types define"
|
||||
#endif
|
||||
// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_extended_types' - ignoring}}
|
||||
#endif
|
||||
#pragma OPENCL EXTENSION cl_khr_subgroup_extended_types : enable
|
||||
|
||||
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
|
||||
#ifndef cl_khr_subgroup_non_uniform_vote
|
||||
#error "Missing cl_khr_subgroup_non_uniform_vote"
|
||||
#endif
|
||||
#else
|
||||
#ifdef cl_khr_subgroup_non_uniform_vote
|
||||
#error "Incorrect cl_khr_subgroup_non_uniform_vote define"
|
||||
#endif
|
||||
// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_non_uniform_vote' - ignoring}}
|
||||
#endif
|
||||
#pragma OPENCL EXTENSION cl_khr_subgroup_non_uniform_vote : enable
|
||||
|
||||
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
|
||||
#ifndef cl_khr_subgroup_ballot
|
||||
#error "Missing cl_khr_subgroup_ballot"
|
||||
#endif
|
||||
#else
|
||||
#ifdef cl_khr_subgroup_ballot
|
||||
#error "Incorrect cl_khr_subgroup_ballot define"
|
||||
#endif
|
||||
// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_ballot' - ignoring}}
|
||||
#endif
|
||||
#pragma OPENCL EXTENSION cl_khr_subgroup_ballot : enable
|
||||
|
||||
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
|
||||
#ifndef cl_khr_subgroup_non_uniform_arithmetic
|
||||
#error "Missing cl_khr_subgroup_non_uniform_arithmetic"
|
||||
#endif
|
||||
#else
|
||||
#ifdef cl_khr_subgroup_non_uniform_arithmetic
|
||||
#error "Incorrect cl_khr_subgroup_non_uniform_arithmetic define"
|
||||
#endif
|
||||
// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_non_uniform_arithmetic' - ignoring}}
|
||||
#endif
|
||||
#pragma OPENCL EXTENSION cl_khr_subgroup_non_uniform_arithmetic : enable
|
||||
|
||||
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
|
||||
#ifndef cl_khr_subgroup_shuffle
|
||||
#error "Missing cl_khr_subgroup_shuffle"
|
||||
#endif
|
||||
#else
|
||||
#ifdef cl_khr_subgroup_shuffle
|
||||
#error "Incorrect cl_khr_subgroup_shuffle define"
|
||||
#endif
|
||||
// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_shuffle' - ignoring}}
|
||||
#endif
|
||||
#pragma OPENCL EXTENSION cl_khr_subgroup_shuffle : enable
|
||||
|
||||
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
|
||||
#ifndef cl_khr_subgroup_shuffle_relative
|
||||
#error "Missing cl_khr_subgroup_shuffle_relative"
|
||||
#endif
|
||||
#else
|
||||
#ifdef cl_khr_subgroup_shuffle_relative
|
||||
#error "Incorrect cl_khr_subgroup_shuffle_relative define"
|
||||
#endif
|
||||
// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_shuffle_relative' - ignoring}}
|
||||
#endif
|
||||
#pragma OPENCL EXTENSION cl_khr_subgroup_shuffle_relative : enable
|
||||
|
||||
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
|
||||
#ifndef cl_khr_subgroup_clustered_reduce
|
||||
#error "Missing cl_khr_subgroup_clustered_reduce"
|
||||
#endif
|
||||
#else
|
||||
#ifdef cl_khr_subgroup_clustered_reduce
|
||||
#error "Incorrect cl_khr_subgroup_clustered_reduce define"
|
||||
#endif
|
||||
// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_subgroup_clustered_reduce' - ignoring}}
|
||||
#endif
|
||||
#pragma OPENCL EXTENSION cl_khr_subgroup_clustered_reduce : enable
|
||||
|
||||
|
||||
Reference in New Issue
Block a user