DPC++ Runtime
Runtime libraries for oneAPI DPC++
defines.hpp
Go to the documentation of this file.
1 //==---------- defines.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 
12 
13 #include <climits>
14 
15 #if __SYCL_ID_QUERIES_FIT_IN_INT__ && __has_builtin(__builtin_assume)
16 #define __SYCL_ASSUME_INT(x) __builtin_assume((x) <= INT_MAX)
17 #else
18 #define __SYCL_ASSUME_INT(x)
19 #if __SYCL_ID_QUERIES_FIT_IN_INT__ && !__has_builtin(__builtin_assume)
20 #warning "No assumptions will be emitted due to no __builtin_assume available"
21 #endif
22 #endif
23 
24 // FIXME Check for __SYCL_DEVICE_ONLY__ can be removed if implementation of
25 // __has_attribute is fixed to consider LangOpts when generating attributes in
26 // tablegen.
27 #if __has_attribute(sycl_special_class) && (defined __SYCL_DEVICE_ONLY__)
28 #define __SYCL_SPECIAL_CLASS __attribute__((sycl_special_class))
29 #else
30 #define __SYCL_SPECIAL_CLASS
31 #endif
32 
33 // FIXME Check for __SYCL_DEVICE_ONLY__ can be removed if implementation of
34 // __has_attribute is fixed to consider LangOpts when generating attributes in
35 // tablegen.
36 #if __has_cpp_attribute(__sycl_detail__::sycl_type) && \
37  (defined __SYCL_DEVICE_ONLY__)
38 #define __SYCL_TYPE(x) [[__sycl_detail__::sycl_type(x)]]
39 #else
40 #define __SYCL_TYPE(x)
41 #endif
42 
43 // joint matrix should only be included by default for SPIR or NVPTX backends
44 #if defined __SPIR__ || defined __NVPTX__ || !defined __SYCL_DEVICE_ONLY__
45 #ifndef SYCL_EXT_ONEAPI_MATRIX_VERSION
46 #define SYCL_EXT_ONEAPI_MATRIX_VERSION 4
47 #endif // SYCL_EXT_ONEAPI_MATRIX_VERSION
48 #endif // __SPIR__ || __NVPTX__ || !__SYCL_DEVICE_ONLY
defines_elementary.hpp