libflame  revision_anchor
FLA_type_defs.h
Go to the documentation of this file.
1 /*
2 
3  Copyright (C) 2014, The University of Texas at Austin
4 
5  This file is part of libflame and is available under the 3-Clause
6  BSD license, which can be found in the LICENSE file at the top-level
7  directory, or at http://opensource.org/licenses/BSD-3-Clause
8 
9 */
10 
11 #ifndef FLA_TYPE_DEFS_H
12 #define FLA_TYPE_DEFS_H
13 
14 #if FLA_MULTITHREADING_MODEL == FLA_OPENMP
15 #ifdef FLA_ENABLE_TIDSP
16 #include <ti/omp/omp.h>
17 #else
18 #include <omp.h>
19 #endif
20 #elif FLA_MULTITHREADING_MODEL == FLA_PTHREADS
21 #include <pthread.h>
22 #endif
23 
24 
25 // --- Complex type definitions -----------------------------------------------
26 
27 #ifndef _DEFINED_SCOMPLEX
28 #define _DEFINED_SCOMPLEX
29 typedef struct scomplex
30 {
31  float real, imag;
33 #endif
34 
35 #ifndef _DEFINED_DCOMPLEX
36 #define _DEFINED_DCOMPLEX
37 typedef struct dcomplex
38 {
39  double real, imag;
41 #endif
42 
43 
44 // --- Parameter and return type definitions ----------------------------------
45 
46 typedef int FLA_Bool;
47 typedef int FLA_Error;
48 typedef int FLA_Quadrant;
49 typedef int FLA_Datatype;
50 typedef int FLA_Elemtype;
51 typedef int FLA_Side;
52 typedef int FLA_Uplo;
53 typedef int FLA_Trans;
54 typedef int FLA_Conj;
55 typedef int FLA_Diag;
56 typedef int FLA_Dimension;
57 typedef int FLA_Pivot_type;
58 typedef int FLA_Direct;
59 typedef int FLA_Store;
60 typedef int FLA_Matrix_type;
61 typedef int FLA_Precision;
62 typedef int FLA_Domain;
63 typedef int FLA_Inv;
64 typedef int FLA_Evd_type;
65 typedef int FLA_Svd_type;
66 typedef int FLA_Machval;
67 typedef int FLA_Diag_off;
68 
69 #ifndef _DEFINED_DIM_T
70 #define _DEFINED_DIM_T
71 typedef unsigned long dim_t;
72 #endif
73 
74 // --- Intrinsic/assembly definitions ----------------------------------------
75 
76 #if FLA_VECTOR_INTRINSIC_TYPE == FLA_SSE_INTRINSICS
77 
78 #include "pmmintrin.h"
79 
80 //typedef double v2df __attribute__ ((vector_size (16)));
81 
82 typedef union
83 {
84  __m128 v;
85  float f[4];
86 } v4sf_t;
87 
88 typedef union
89 {
90  __m128d v;
91  double d[2];
92 } v2df_t;
93 
94 #endif
95 
96 // --- FLAME object definitions -----------------------------------------------
97 
98 typedef struct FLA_Lock_s FLA_Lock;
99 
100 //#ifdef FLA_ENABLE_MULTITHREADING
102 {
103  // Implementation-specific lock object
104 #if FLA_MULTITHREADING_MODEL == FLA_OPENMP
105  omp_lock_t lock;
106 #elif FLA_MULTITHREADING_MODEL == FLA_PTHREADS
107  pthread_mutex_t lock;
108 #endif
109 };
110 //#endif
111 
112 #ifdef FLA_ENABLE_SUPERMATRIX
113 typedef int FLASH_Verbose;
114 typedef int FLASH_Data_aff;
115 
116 typedef struct FLASH_Queue_s FLASH_Queue;
117 typedef struct FLASH_Task_s FLASH_Task;
118 typedef struct FLASH_Dep_s FLASH_Dep;
119 #endif
120 typedef struct FLASH_Thread_s FLASH_Thread;
121 
122 typedef struct FLA_Obj_struct
123 {
124  // Basic object description fields
133  unsigned long id;
136 
138  void* buffer;
140 
142 
143 #ifdef FLA_ENABLE_SUPERMATRIX
144  // Fields for supermatrix
147 
148  // All the tasks that previously read this block, anti-dependency
152 
153  // Task that last overwrote this block, flow dependency
155 #endif
157 
158 typedef struct FLA_Obj_view
159 {
160  // Basic object view description fields
167 
169 
171 
172 #ifdef FLA_ENABLE_SUPERMATRIX
174 {
175  // Number of tasks currently in queue
176  unsigned int n_tasks;
177 
178  // Pointers to head (front) and tail (back) of queue
181 };
182 
184 {
185  // Execution information
186  int n_ready;
187 
188  // Labels
189  int order;
190  int queue;
191  int height;
192  int thread;
193  int cache;
195 
196  // Function pointer
197  void* func;
198 
199  // Control tree pointer
200  void* cntl;
201 
202  // Name of task
203  char* name;
204 
205  // GPU enabled task
207 
208  // Integer arguments
210  int* int_arg;
211 
212  // Constant FLA_Obj arguments
215 
216  // Input FLA_Obj arguments
219 
220  // Output FLA_Obj argument
223 
224  // Number of blocks within all macroblocks
226 
227  // Number of write after read dependencies
229 
230  // Dependence information
234 
235  // Support for a doubly linked list of tasks
238 
239  // Support for a doubly linked list for wait queue
242 };
243 
245 {
246  // Task yielding dependency
248 
249  // Support for linked list of FLASH_Deps
251 };
252 #endif // FLA_ENABLE_SUPERMATRIX
253 
255 {
256  // The thread's unique identifier
257  int id;
258 
259  // Pointer to variables needed to execute SuperMatrix mechanism
260  void* args;
261 
262 #if FLA_MULTITHREADING_MODEL == FLA_PTHREADS
263  // The thread object. Only needed for the POSIX threads implementation.
264  pthread_t pthread_obj;
265 #endif
266 };
267 
268 #endif // FLA_TYPE_DEFS_H
int FLA_Error
Definition: FLA_type_defs.h:47
struct scomplex scomplex
struct dcomplex dcomplex
int FLASH_Verbose
Definition: FLA_type_defs.h:113
int FLA_Machval
Definition: FLA_type_defs.h:66
struct FLA_Obj_view FLA_Obj
int FLA_Side
Definition: FLA_type_defs.h:51
int FLA_Elemtype
Definition: FLA_type_defs.h:50
int FLA_Diag_off
Definition: FLA_type_defs.h:67
int FLA_Matrix_type
Definition: FLA_type_defs.h:60
int FLASH_Data_aff
Definition: FLA_type_defs.h:114
int FLA_Datatype
Definition: FLA_type_defs.h:49
int FLA_Inv
Definition: FLA_type_defs.h:63
int FLA_Conj
Definition: FLA_type_defs.h:54
int FLA_Domain
Definition: FLA_type_defs.h:62
int FLA_Trans
Definition: FLA_type_defs.h:53
int FLA_Evd_type
Definition: FLA_type_defs.h:64
int FLA_Svd_type
Definition: FLA_type_defs.h:65
int FLA_Store
Definition: FLA_type_defs.h:59
int FLA_Dimension
Definition: FLA_type_defs.h:56
struct FLA_Obj_struct FLA_Base_obj
unsigned long dim_t
Definition: FLA_type_defs.h:71
int FLA_Uplo
Definition: FLA_type_defs.h:52
int FLA_Quadrant
Definition: FLA_type_defs.h:48
int FLA_Diag
Definition: FLA_type_defs.h:55
int FLA_Bool
Definition: FLA_type_defs.h:46
int FLA_Pivot_type
Definition: FLA_type_defs.h:57
int FLA_Direct
Definition: FLA_type_defs.h:58
int FLA_Precision
Definition: FLA_type_defs.h:61
Definition: FLA_type_defs.h:245
FLASH_Task * task
Definition: FLA_type_defs.h:247
FLASH_Dep * next_dep
Definition: FLA_type_defs.h:250
Definition: FLA_type_defs.h:174
FLASH_Task * tail
Definition: FLA_type_defs.h:180
FLASH_Task * head
Definition: FLA_type_defs.h:179
unsigned int n_tasks
Definition: FLA_type_defs.h:176
Definition: FLA_type_defs.h:184
char * name
Definition: FLA_type_defs.h:203
FLA_Obj * input_arg
Definition: FLA_type_defs.h:218
FLA_Bool hit
Definition: FLA_type_defs.h:194
FLA_Bool enabled_gpu
Definition: FLA_type_defs.h:206
int n_dep_args
Definition: FLA_type_defs.h:231
int queue
Definition: FLA_type_defs.h:190
void * func
Definition: FLA_type_defs.h:197
FLA_Obj * fla_arg
Definition: FLA_type_defs.h:214
FLASH_Task * prev_wait
Definition: FLA_type_defs.h:240
int cache
Definition: FLA_type_defs.h:193
int n_output_args
Definition: FLA_type_defs.h:221
FLASH_Dep * dep_arg_head
Definition: FLA_type_defs.h:232
int n_int_args
Definition: FLA_type_defs.h:209
int height
Definition: FLA_type_defs.h:191
int n_war_args
Definition: FLA_type_defs.h:228
FLA_Obj * output_arg
Definition: FLA_type_defs.h:222
int thread
Definition: FLA_type_defs.h:192
FLASH_Task * next_task
Definition: FLA_type_defs.h:237
int n_fla_args
Definition: FLA_type_defs.h:213
int n_macro_args
Definition: FLA_type_defs.h:225
FLASH_Task * next_wait
Definition: FLA_type_defs.h:241
int n_ready
Definition: FLA_type_defs.h:186
void * cntl
Definition: FLA_type_defs.h:200
int order
Definition: FLA_type_defs.h:189
FLASH_Task * prev_task
Definition: FLA_type_defs.h:236
int * int_arg
Definition: FLA_type_defs.h:210
int n_input_args
Definition: FLA_type_defs.h:217
FLASH_Dep * dep_arg_tail
Definition: FLA_type_defs.h:233
Definition: FLA_type_defs.h:255
int id
Definition: FLA_type_defs.h:257
void * args
Definition: FLA_type_defs.h:260
pthread_t pthread_obj
Definition: FLA_type_defs.h:264
Definition: FLA_type_defs.h:102
pthread_mutex_t lock
Definition: FLA_type_defs.h:107
omp_lock_t lock
Definition: FLA_type_defs.h:105
Definition: FLA_type_defs.h:123
int n_write_blocks
Definition: FLA_type_defs.h:146
FLASH_Dep * read_task_tail
Definition: FLA_type_defs.h:151
dim_t rs
Definition: FLA_type_defs.h:129
FLASH_Dep * read_task_head
Definition: FLA_type_defs.h:150
int n_read_blocks
Definition: FLA_type_defs.h:145
dim_t n
Definition: FLA_type_defs.h:128
int buffer_info
Definition: FLA_type_defs.h:139
dim_t m
Definition: FLA_type_defs.h:127
FLASH_Task * write_task
Definition: FLA_type_defs.h:154
dim_t m_index
Definition: FLA_type_defs.h:134
dim_t n_elem_alloc
Definition: FLA_type_defs.h:137
unsigned long id
Definition: FLA_type_defs.h:133
dim_t n_inner
Definition: FLA_type_defs.h:132
int n_read_tasks
Definition: FLA_type_defs.h:149
FLA_Uplo uplo
Definition: FLA_type_defs.h:141
dim_t cs
Definition: FLA_type_defs.h:130
dim_t n_index
Definition: FLA_type_defs.h:135
void * buffer
Definition: FLA_type_defs.h:138
FLA_Datatype datatype
Definition: FLA_type_defs.h:125
dim_t m_inner
Definition: FLA_type_defs.h:131
FLA_Elemtype elemtype
Definition: FLA_type_defs.h:126
Definition: FLA_type_defs.h:159
dim_t n_inner
Definition: FLA_type_defs.h:166
dim_t offm
Definition: FLA_type_defs.h:161
dim_t m
Definition: FLA_type_defs.h:163
dim_t m_inner
Definition: FLA_type_defs.h:165
dim_t n
Definition: FLA_type_defs.h:164
FLA_Base_obj * base
Definition: FLA_type_defs.h:168
dim_t offn
Definition: FLA_type_defs.h:162
Definition: blis_type_defs.h:138
double real
Definition: blis_type_defs.h:139
double imag
Definition: blis_type_defs.h:139
Definition: blis_type_defs.h:133
float imag
Definition: blis_type_defs.h:134
float real
Definition: blis_type_defs.h:134
Definition: blis_type_defs.h:117
Definition: FLA_type_defs.h:83
__m128 v
Definition: FLA_type_defs.h:84