-
Notifications
You must be signed in to change notification settings - Fork 206
/
bug372_perf.t
302 lines (270 loc) · 6.12 KB
/
bug372_perf.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
-- This test exercises a compile time performance regression. The
-- large structs in the C include in this file result in very bad
-- compile times (in the tens of minutes) if the LLVM IR is not
-- generated very carefully. This is due to an LLVM SROA optimization
-- which takes the code and produces tens of thousands of lines of
-- LLVM IR (which then must pass through the entire LLVM compiler
-- backend). With proper LLVM code generation the test should compile
-- instantly and generate short LLVM IR/machine code.
local C = terralib.includecstring
[[
#ifndef __CONFIG_SCHEMA_H__
#define __CONFIG_SCHEMA_H__
#include <stdbool.h>
#include <stdint.h>
typedef int TurbForcingModel;
#define TurbForcingModel_OFF 0
#define TurbForcingModel_CHANNEL 1
typedef int FlowBC;
#define FlowBC_IsothermalWall 4
#define FlowBC_Dirichlet 0
#define FlowBC_NSCBC_Outflow 6
#define FlowBC_Periodic 1
#define FlowBC_SuctionAndBlowingWall 7
#define FlowBC_AdiabaticWall 3
#define FlowBC_NSCBC_Inflow 5
#define FlowBC_Symmetry 2
typedef int ViscosityModel;
#define ViscosityModel_PowerLaw 1
#define ViscosityModel_Constant 0
#define ViscosityModel_Sutherland 2
typedef int TempProfile;
#define TempProfile_File 0
#define TempProfile_Constant 1
#define TempProfile_Incoming 2
typedef int MixtureProfile;
#define MixtureProfile_File 0
#define MixtureProfile_Constant 1
#define MixtureProfile_Incoming 2
typedef int FlowInitCase;
#define FlowInitCase_Perturbed 3
#define FlowInitCase_TaylorGreen2DVortex 4
#define FlowInitCase_ChannelFlow 13
#define FlowInitCase_GrossmanCinnellaProblem 12
#define FlowInitCase_VortexAdvection2D 11
#define FlowInitCase_Restart 2
#define FlowInitCase_RiemannTestOne 6
#define FlowInitCase_SodProblem 8
#define FlowInitCase_LaxProblem 9
#define FlowInitCase_ShuOsherProblem 10
#define FlowInitCase_Random 1
#define FlowInitCase_TaylorGreen3DVortex 5
#define FlowInitCase_RiemannTestTwo 7
#define FlowInitCase_Uniform 0
typedef int GridType;
#define GridType_Uniform 0
#define GridType_TanhPlus 3
#define GridType_Tanh 4
#define GridType_TanhMinus 2
#define GridType_Cosine 1
typedef int InflowProfile;
#define InflowProfile_File 0
#define InflowProfile_Constant 1
#define InflowProfile_SuctionAndBlowing 2
#define InflowProfile_Incoming 3
struct TurbForcingModel {
int32_t type;
struct {
struct {
int32_t __dummy;
} OFF;
struct {
double Forcing;
double RhoUbulk;
} CHANNEL;
} u;
};
#ifdef __cplusplus
extern "C" {
#endif
void parse_TurbForcingModel(struct TurbForcingModel*, char*);
#ifdef __cplusplus
}
#endif
struct Window {
int32_t uptoCell[2];
int32_t fromCell[2];
};
#ifdef __cplusplus
extern "C" {
#endif
void parse_Window(struct Window*, char*);
#ifdef __cplusplus
}
#endif
struct TempProfile {
int32_t type;
struct {
struct {
int8_t FileDir[256];
} File;
struct {
double temperature;
} Constant;
struct {
int32_t __dummy;
} Incoming;
} u;
};
#ifdef __cplusplus
extern "C" {
#endif
void parse_TempProfile(struct TempProfile*, char*);
#ifdef __cplusplus
}
#endif
struct InflowProfile {
int32_t type;
struct {
struct {
int8_t FileDir[256];
} File;
struct {
double velocity[3];
} Constant;
struct {
double sigma;
struct {
uint32_t length;
double values[20];
} beta;
struct {
uint32_t length;
double values[20];
} omega;
struct {
uint32_t length;
double values[20];
} A;
double Xmax;
double X0;
double Zw;
double Xmin;
} SuctionAndBlowing;
struct {
double addedVelocity;
} Incoming;
} u;
};
#ifdef __cplusplus
extern "C" {
#endif
void parse_InflowProfile(struct InflowProfile*, char*);
#ifdef __cplusplus
}
#endif
struct Species {
int8_t Name[10];
double MolarFrac;
};
#ifdef __cplusplus
extern "C" {
#endif
void parse_Species(struct Species*, char*);
#ifdef __cplusplus
}
#endif
struct Mixture {
struct {
uint32_t length;
struct Species values[10];
} Species;
};
#ifdef __cplusplus
extern "C" {
#endif
void parse_Mixture(struct Mixture*, char*);
#ifdef __cplusplus
}
#endif
struct MixtureProfile {
int32_t type;
struct {
struct {
int8_t FileDir[256];
} File;
struct {
struct Mixture Mixture;
} Constant;
struct {
int32_t __dummy;
} Incoming;
} u;
};
#ifdef __cplusplus
extern "C" {
#endif
void parse_MixtureProfile(struct MixtureProfile*, char*);
#ifdef __cplusplus
}
#endif
struct BCStruct {
struct TempProfile yBCRightHeat;
struct TempProfile zBCRightHeat;
struct InflowProfile yBCRightInflowProfile;
double yBCRightP;
double xBCRightP;
double xBCLeftP;
struct InflowProfile xBCLeftInflowProfile;
double zBCLeftP;
double yBCLeftP;
int32_t xBCRight;
int32_t zBCRight;
int32_t yBCRight;
struct MixtureProfile zBCRightMixture;
double zBCRightP;
struct InflowProfile zBCRightInflowProfile;
struct MixtureProfile zBCLeftMixture;
struct MixtureProfile xBCRightMixture;
struct MixtureProfile yBCRightMixture;
int32_t yBCLeft;
struct InflowProfile zBCLeftInflowProfile;
int32_t zBCLeft;
struct TempProfile zBCLeftHeat;
struct MixtureProfile yBCLeftMixture;
struct TempProfile xBCLeftHeat;
struct TempProfile yBCLeftHeat;
struct InflowProfile yBCLeftInflowProfile;
int32_t xBCLeft;
struct InflowProfile xBCRightInflowProfile;
struct MixtureProfile xBCLeftMixture;
struct TempProfile xBCRightHeat;
};
#ifdef __cplusplus
extern "C" {
#endif
void parse_BCStruct(struct BCStruct*, char*);
#ifdef __cplusplus
}
#endif
struct Volume {
int32_t uptoCell[3];
int32_t fromCell[3];
};
#ifdef __cplusplus
extern "C" {
#endif
void parse_Volume(struct Volume*, char*);
#ifdef __cplusplus
}
#endif
struct Config {
struct BCStruct BC;
};
#ifdef __cplusplus
extern "C" {
#endif
void parse_Config(struct Config*, char*);
#ifdef __cplusplus
}
#endif
#endif // __CONFIG_SCHEMA_H__
]]
terra unpack_param(fixed_ptr : &opaque) : C.BCStruct
var result : C.BCStruct = @[&C.BCStruct](fixed_ptr)
return result
end
unpack_param:printpretty(false)
-- unpack_param:setoptimized(false)
unpack_param:compile()
unpack_param:disas()