Skip to content

Commit 38cc74b

Browse files
dsawferDoyleLi
authored andcommitted
[SYCL] Predefine SYCL macros with vendor strings (intel#4498)
The SYCL 2020 specification requires at least one macro of the form SYCL_IMPLEMENTATION_"vendorstring" to be predefined, which allows applications to check if they compile with this provider's implementation. Our vendorstrings are SYCL_IMPLEMENTATION_ONEAPI and SYCL_IMPLEMENTATION_INTEL. The SYCL_FEATURE_SET_FULL macro is mandated by section 5.6. "Preprocessor directives and macros" of the SYCL 2020 specification.
1 parent 2e7e361 commit 38cc74b

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

sycl/include/CL/sycl.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <CL/sycl/buffer.hpp>
1717
#include <CL/sycl/builtins.hpp>
1818
#include <CL/sycl/context.hpp>
19+
#include <CL/sycl/define_vendors.hpp>
1920
#include <CL/sycl/device.hpp>
2021
#include <CL/sycl/device_selector.hpp>
2122
#include <CL/sycl/event.hpp>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//==---------- define_vendors.hpp ----- Preprocessor directives ------------==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#pragma once
10+
11+
#define SYCL_IMPLEMENTATION_ONEAPI
12+
#define SYCL_FEATURE_SET_FULL
13+
#define SYCL_IMPLEMENTATION_INTEL
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -c -o %t.out
2+
#include <CL/sycl.hpp>
3+
4+
#if !defined(SYCL_IMPLEMENTATION_ONEAPI)
5+
#error SYCL_IMPLEMENTATION_ONEAPI is not defined
6+
#endif
7+
8+
#if !defined(SYCL_FEATURE_SET_FULL)
9+
#error SYCL_FEATURE_SET_FULL is not defined
10+
#endif
11+
12+
#if !defined(SYCL_IMPLEMENTATION_INTEL)
13+
#error SYCL_IMPLEMENTATION_INTEL is not defined
14+
#endif

0 commit comments

Comments
 (0)