Mercurial > hg > CbC > CbC_gcc
comparison liboffloadmic/runtime/dv_util.h @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* | |
2 Copyright (c) 2014-2016 Intel Corporation. All Rights Reserved. | |
3 | |
4 Redistribution and use in source and binary forms, with or without | |
5 modification, are permitted provided that the following conditions | |
6 are met: | |
7 | |
8 * Redistributions of source code must retain the above copyright | |
9 notice, this list of conditions and the following disclaimer. | |
10 * Redistributions in binary form must reproduce the above copyright | |
11 notice, this list of conditions and the following disclaimer in the | |
12 documentation and/or other materials provided with the distribution. | |
13 * Neither the name of Intel Corporation nor the names of its | |
14 contributors may be used to endorse or promote products derived | |
15 from this software without specific prior written permission. | |
16 | |
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
18 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
19 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
20 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
21 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
22 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
23 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
24 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
25 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
26 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
27 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
28 */ | |
29 | |
30 | |
31 #ifndef DV_UTIL_H_INCLUDED | |
32 #define DV_UTIL_H_INCLUDED | |
33 | |
34 #include <stdint.h> | |
35 #include "offload_util.h" | |
36 | |
37 // Dope vector declarations | |
38 #define ArrDescMaxArrayRank 31 | |
39 | |
40 // Dope vector flags | |
41 #define ArrDescFlagsDefined 1 | |
42 #define ArrDescFlagsNodealloc 2 | |
43 #define ArrDescFlagsContiguous 4 | |
44 | |
45 typedef int64_t dv_size; | |
46 | |
47 typedef struct DimDesc { | |
48 dv_size Extent; // Number of elements in this dimension | |
49 dv_size Mult; // Multiplier for this dimension. | |
50 // The number of bytes between successive | |
51 // elements in this dimension. | |
52 dv_size LowerBound; // LowerBound of this dimension | |
53 } DimDesc ; | |
54 | |
55 typedef struct ArrDesc { | |
56 dv_size Base; // Base address | |
57 dv_size Len; // Length of data type, used only for | |
58 // character strings. | |
59 dv_size Offset; | |
60 dv_size Flags; // Flags | |
61 dv_size Rank; // Rank of pointer | |
62 dv_size Reserved; // reserved for openmp requests | |
63 DimDesc Dim[ArrDescMaxArrayRank]; | |
64 } ArrDesc ; | |
65 | |
66 typedef ArrDesc* pArrDesc; | |
67 | |
68 DLL_LOCAL bool __dv_is_contiguous(const ArrDesc *dvp); | |
69 | |
70 DLL_LOCAL bool __dv_is_allocated(const ArrDesc *dvp); | |
71 | |
72 DLL_LOCAL uint64_t __dv_data_length(const ArrDesc *dvp); | |
73 | |
74 DLL_LOCAL uint64_t __dv_data_length(const ArrDesc *dvp, int64_t nelems); | |
75 | |
76 DLL_LOCAL CeanReadRanges * init_read_ranges_dv(const ArrDesc *dvp); | |
77 | |
78 #if OFFLOAD_DEBUG > 0 | |
79 DLL_LOCAL void __dv_desc_dump(const char *name, const ArrDesc *dvp); | |
80 #else // OFFLOAD_DEBUG | |
81 #define __dv_desc_dump(name, dvp) | |
82 #endif // OFFLOAD_DEBUG | |
83 | |
84 #endif // DV_UTIL_H_INCLUDED |