clBLAS  2.11
 All Functions Typedefs Enumerations Enumerator Groups Pages
solver.h
1 /* ************************************************************************
2  * Copyright 2013 Advanced Micro Devices, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  * ************************************************************************/
16 
17 
18 #ifndef SOLVER_H_
19 #define SOLVER_H_
20 
21 #include <defbool.h>
22 
23 #include <cltypes.h>
24 #include <kerngen.h>
25 #include <clkern.h>
26 #include <clBLAS.h>
27 #include <kernel_extra.h>
28 
29 struct Kernel;
30 
31 // OpenCL solver ID
32 typedef int solver_id_t;
33 
41 
46 typedef enum SolverFlags {
48  SF_WSPACE_1D = 0x01,
50  SF_WSPACE_2D = 0x02,
52  SF_TOP_INPUT_SQUARE_BLOCKS = 0x04
53 } SolverFlags;
54 
55 typedef enum PatternPerformance{
56  PPERF_NOT_SUPPORTED = -1,
57  PPERF_POOR = 0,
58  PPERF_AVERAGE,
59  PPERF_GOOD,
60  PPERF_BEST
61 } PatternPerformance;
62 
63 typedef enum CheckCalcPGran{
64  PGRAN_CHECK = 0,
65  PGRAN_CALC
66 } CheckCalcPGran;
67 
89 typedef ssize_t
90 (*SolverKgen)(
91  char *buf,
92  size_t buflen,
93  const SubproblemDim *subdims,
94  const PGranularity *pgran,
95  void *extra);
96 
105 typedef struct SolverOps {
107  SolverKgen genKernel;
108 
111  void (*assignKargs)(KernelArg*, const void* args, const void *extra);
112 
116  bool (*isFitToLDS)(
117  SubproblemDim *dims,
118  DataType,
119  cl_ulong ldsSize,
120  const void *args);
121 
125  int (*getPatternPerf)(
126  unsigned int kflags,
127  const void *args);
128 
134  DecompositionAxis (*innerDecompositionAxis)(const void *args);
135 
137  void (*calcThreads)(
138  size_t threads[2],
139  const SubproblemDim *subdims,
140  const PGranularity *pgran,
141  const void *args,
142  const void *extra);
143 
147  void (*imgPackMode)(
148  const void *extra,
149  const SubproblemDim *subdims,
150  int dataID,
151  unsigned int *rate,
152  clblasOrder *order);
153 
155  SolverFlags (*getFlags)(void);
156 
161  void (*fixupArgs)(void *args, SubproblemDim* pSubDims, void *extra);
162 
164  int ( *getDefaultDecomp)(
165  PGranularity *pgran,
166  SubproblemDim *subdims,
167  unsigned int subdimsNum,
168  void *pArgs);
169 
175  bool (*checkCalcDecomp)(
176  PGranularity *pgran,
177  SubproblemDim *subdims,
178  unsigned int subdimsNum,
179  DataType dtype,
180  int check);
181 
182 
183  /*
184  SetBuildOptions
185  */
186  void (*setBuildOptions)( char *buildOptsStr, const void *args);
187 
188  /*
189  * selectVectorization
190  */
191  KernelExtraFlags (*selectVectorization)( void *kargs, unsigned int vlen);
192 } SolverOps;
193 
196 #endif /* SOLVER_H_ */
enum clblasOrder_ clblasOrder