libflame
revision_anchor
|
00001 /* 00002 libflame 00003 An object-based infrastructure for developing high-performance 00004 dense linear algebra libraries. 00005 00006 Copyright (C) 2011, The University of Texas 00007 00008 libflame is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU Lesser General Public License as 00010 published by the Free Software Foundation; either version 2.1 of 00011 the License, or (at your option) any later version. 00012 00013 libflame is distributed in the hope that it will be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public 00019 License along with libflame; if you did not receive a copy, see 00020 http://www.gnu.org/licenses/. 00021 00022 For more information, please contact us at flame@cs.utexas.edu or 00023 send mail to: 00024 00025 Field G. Van Zee and/or 00026 Robert A. van de Geijn 00027 The University of Texas at Austin 00028 Department of Computer Sciences 00029 1 University Station C0500 00030 Austin TX 78712 00031 */ 00032 00033 #ifndef FLA_TYPE_DEFS_H 00034 #define FLA_TYPE_DEFS_H 00035 00036 #if FLA_MULTITHREADING_MODEL == FLA_OPENMP 00037 #ifdef FLA_ENABLE_TIDSP 00038 #include <ti/omp/omp.h> 00039 #else 00040 #include <omp.h> 00041 #endif 00042 #elif FLA_MULTITHREADING_MODEL == FLA_PTHREADS 00043 #include <pthread.h> 00044 #endif 00045 00046 00047 // --- Complex type definitions ----------------------------------------------- 00048 00049 typedef struct scomplex 00050 { 00051 float real, imag; 00052 } scomplex; 00053 00054 typedef struct dcomplex 00055 { 00056 double real, imag; 00057 } dcomplex; 00058 00059 00060 // --- Parameter and return type definitions ---------------------------------- 00061 00062 typedef int FLA_Bool; 00063 typedef int FLA_Error; 00064 typedef int FLA_Quadrant; 00065 typedef int FLA_Datatype; 00066 typedef int FLA_Elemtype; 00067 typedef int FLA_Side; 00068 typedef int FLA_Uplo; 00069 typedef int FLA_Trans; 00070 typedef int FLA_Conj; 00071 typedef int FLA_Diag; 00072 typedef int FLA_Dimension; 00073 typedef int FLA_Pivot_type; 00074 typedef int FLA_Direct; 00075 typedef int FLA_Store; 00076 typedef int FLA_Matrix_type; 00077 typedef int FLA_Precision; 00078 typedef int FLA_Domain; 00079 typedef int FLA_Inv; 00080 typedef int FLA_Evd_type; 00081 typedef int FLA_Svd_type; 00082 typedef int FLA_Machval; 00083 typedef int FLA_Diag_off; 00084 typedef unsigned int dim_t; 00085 00086 // --- Intrinsic/assembly definitions ---------------------------------------- 00087 00088 #if FLA_VECTOR_INTRINSIC_TYPE == FLA_SSE_INTRINSICS 00089 00090 #include "pmmintrin.h" 00091 00092 //typedef double v2df __attribute__ ((vector_size (16))); 00093 00094 typedef union 00095 { 00096 __m128 v; 00097 float f[4]; 00098 } v4sf_t; 00099 00100 typedef union 00101 { 00102 __m128d v; 00103 double d[2]; 00104 } v2df_t; 00105 00106 #endif 00107 00108 // --- FLAME object definitions ----------------------------------------------- 00109 00110 typedef struct FLA_Lock_s FLA_Lock; 00111 00112 //#ifdef FLA_ENABLE_MULTITHREADING 00113 struct FLA_Lock_s 00114 { 00115 // Implementation-specific lock object 00116 #if FLA_MULTITHREADING_MODEL == FLA_OPENMP 00117 omp_lock_t lock; 00118 #elif FLA_MULTITHREADING_MODEL == FLA_PTHREADS 00119 pthread_mutex_t lock; 00120 #endif 00121 }; 00122 //#endif 00123 00124 #ifdef FLA_ENABLE_SUPERMATRIX 00125 typedef int FLASH_Verbose; 00126 typedef int FLASH_Data_aff; 00127 00128 typedef struct FLASH_Queue_s FLASH_Queue; 00129 typedef struct FLASH_Task_s FLASH_Task; 00130 typedef struct FLASH_Dep_s FLASH_Dep; 00131 #endif 00132 typedef struct FLASH_Thread_s FLASH_Thread; 00133 00134 typedef struct FLA_Obj_struct 00135 { 00136 // Basic object description fields 00137 FLA_Datatype datatype; 00138 FLA_Elemtype elemtype; 00139 dim_t m; 00140 dim_t n; 00141 dim_t rs; 00142 dim_t cs; 00143 dim_t m_inner; 00144 dim_t n_inner; 00145 unsigned long id; 00146 dim_t m_index; 00147 dim_t n_index; 00148 00149 dim_t n_elem_alloc; 00150 void* buffer; 00151 int buffer_info; 00152 00153 FLA_Uplo uplo; 00154 00155 #ifdef FLA_ENABLE_SUPERMATRIX 00156 // Fields for supermatrix 00157 int n_read_blocks; 00158 int n_write_blocks; 00159 00160 // All the tasks that previously read this block, anti-dependency 00161 int n_read_tasks; 00162 FLASH_Dep* read_task_head; 00163 FLASH_Dep* read_task_tail; 00164 00165 // Task that last overwrote this block, flow dependency 00166 FLASH_Task* write_task; 00167 #endif 00168 } FLA_Base_obj; 00169 00170 typedef struct FLA_Obj_view 00171 { 00172 // Basic object view description fields 00173 dim_t offm; 00174 dim_t offn; 00175 dim_t m; 00176 dim_t n; 00177 dim_t m_inner; 00178 dim_t n_inner; 00179 00180 FLA_Base_obj* base; 00181 00182 } FLA_Obj; 00183 00184 #ifdef FLA_ENABLE_SUPERMATRIX 00185 struct FLASH_Queue_s 00186 { 00187 // Number of tasks currently in queue 00188 unsigned int n_tasks; 00189 00190 // Pointers to head (front) and tail (back) of queue 00191 FLASH_Task* head; 00192 FLASH_Task* tail; 00193 }; 00194 00195 struct FLASH_Task_s 00196 { 00197 // Execution information 00198 int n_ready; 00199 00200 // Labels 00201 int order; 00202 int queue; 00203 int height; 00204 int thread; 00205 int cache; 00206 FLA_Bool hit; 00207 00208 // Function pointer 00209 void* func; 00210 00211 // Control tree pointer 00212 void* cntl; 00213 00214 // Name of task 00215 char* name; 00216 00217 // GPU enabled task 00218 FLA_Bool enabled_gpu; 00219 00220 // Integer arguments 00221 int n_int_args; 00222 int* int_arg; 00223 00224 // Constant FLA_Obj arguments 00225 int n_fla_args; 00226 FLA_Obj* fla_arg; 00227 00228 // Input FLA_Obj arguments 00229 int n_input_args; 00230 FLA_Obj* input_arg; 00231 00232 // Output FLA_Obj argument 00233 int n_output_args; 00234 FLA_Obj* output_arg; 00235 00236 // Number of blocks within all macroblocks 00237 int n_macro_args; 00238 00239 // Number of write after read dependencies 00240 int n_war_args; 00241 00242 // Dependence information 00243 int n_dep_args; 00244 FLASH_Dep* dep_arg_head; 00245 FLASH_Dep* dep_arg_tail; 00246 00247 // Support for a doubly linked list of tasks 00248 FLASH_Task* prev_task; 00249 FLASH_Task* next_task; 00250 00251 // Support for a doubly linked list for wait queue 00252 FLASH_Task* prev_wait; 00253 FLASH_Task* next_wait; 00254 }; 00255 00256 struct FLASH_Dep_s 00257 { 00258 // Task yielding dependency 00259 FLASH_Task* task; 00260 00261 // Support for linked list of FLASH_Deps 00262 FLASH_Dep* next_dep; 00263 }; 00264 #endif // FLA_ENABLE_SUPERMATRIX 00265 00266 struct FLASH_Thread_s 00267 { 00268 // The thread's unique identifier 00269 int id; 00270 00271 // Pointer to variables needed to execute SuperMatrix mechanism 00272 void* args; 00273 00274 #if FLA_MULTITHREADING_MODEL == FLA_PTHREADS 00275 // The thread object. Only needed for the POSIX threads implementation. 00276 pthread_t pthread_obj; 00277 #endif 00278 }; 00279 00280 #endif // FLA_TYPE_DEFS_H