annotate liboffloadmic/runtime/dv_util.h @ 111:04ced10e8804

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