Skip to content

Commit 88ab843

Browse files
committed
Formatting
1 parent 03190fc commit 88ab843

2 files changed

Lines changed: 546 additions & 309 deletions

File tree

lib/DXIL/DxilCounters.cpp

Lines changed: 85 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ bool CountDxilOp_floats(unsigned op) {
143143
// Hsin=19, Htan=20, Exp=21, Frc=22, Log=23, Sqrt=24, Rsqrt=25, Round_ne=26,
144144
// Round_ni=27, Round_pi=28, Round_z=29, FMax=35, FMin=36, Fma=47, Dot2=54,
145145
// Dot3=55, Dot4=56, Dot2AddHalf=162, FDot=311
146-
return (6 <= op && op <= 29) || (35 <= op && op <= 36) || op == 47 || (54 <= op && op <= 56) || op == 162 || op == 311;
146+
return (6 <= op && op <= 29) || (35 <= op && op <= 36) || op == 47 ||
147+
(54 <= op && op <= 56) || op == 162 || op == 311;
147148
}
148149
bool CountDxilOp_gs_cut(unsigned op) {
149150
// Instructions: CutStream=98, EmitThenCutStream=99
@@ -156,10 +157,12 @@ bool CountDxilOp_gs_emit(unsigned op) {
156157
bool CountDxilOp_ints(unsigned op) {
157158
// Instructions: IMax=37, IMin=38, IMul=41, IMad=48, Ibfe=51,
158159
// Dot4AddI8Packed=163, VectorReduceAnd=309, VectorReduceOr=310
159-
return (37 <= op && op <= 38) || op == 41 || op == 48 || op == 51 || op == 163 || (309 <= op && op <= 310);
160+
return (37 <= op && op <= 38) || op == 41 || op == 48 || op == 51 ||
161+
op == 163 || (309 <= op && op <= 310);
160162
}
161163
bool CountDxilOp_sig_ld(unsigned op) {
162-
// Instructions: LoadInput=4, LoadOutputControlPoint=103, LoadPatchConstant=104
164+
// Instructions: LoadInput=4, LoadOutputControlPoint=103,
165+
// LoadPatchConstant=104
163166
return op == 4 || (103 <= op && op <= 104);
164167
}
165168
bool CountDxilOp_sig_st(unsigned op) {
@@ -174,7 +177,8 @@ bool CountDxilOp_tex_bias(unsigned op) {
174177
bool CountDxilOp_tex_cmp(unsigned op) {
175178
// Instructions: SampleCmp=64, SampleCmpLevelZero=65, TextureGatherCmp=74,
176179
// SampleCmpLevel=224, SampleCmpGrad=254, SampleCmpBias=255
177-
return (64 <= op && op <= 65) || op == 74 || op == 224 || (254 <= op && op <= 255);
180+
return (64 <= op && op <= 65) || op == 74 || op == 224 ||
181+
(254 <= op && op <= 255);
178182
}
179183
bool CountDxilOp_tex_grad(unsigned op) {
180184
// Instructions: SampleGrad=63
@@ -195,14 +199,17 @@ bool CountDxilOp_tex_store(unsigned op) {
195199
// WriteSamplerFeedback=174, WriteSamplerFeedbackBias=175,
196200
// WriteSamplerFeedbackLevel=176, WriteSamplerFeedbackGrad=177,
197201
// TextureStoreSample=225, RawBufferVectorStore=304
198-
return op == 67 || op == 69 || op == 140 || (174 <= op && op <= 177) || op == 225 || op == 304;
202+
return op == 67 || op == 69 || op == 140 || (174 <= op && op <= 177) ||
203+
op == 225 || op == 304;
199204
}
200205
bool CountDxilOp_uints(unsigned op) {
201206
// Instructions: Bfrev=30, Countbits=31, FirstbitLo=32, FirstbitHi=33,
202207
// FirstbitSHi=34, UMax=39, UMin=40, UMul=42, UDiv=43, UAddc=44, USubb=45,
203-
// UMad=49, Msad=50, Ubfe=52, Bfi=53, Dot4AddU8Packed=164, VectorReduceAnd=309,
204-
// VectorReduceOr=310
205-
return (30 <= op && op <= 34) || (39 <= op && op <= 40) || (42 <= op && op <= 45) || (49 <= op && op <= 50) || (52 <= op && op <= 53) || op == 164 || (309 <= op && op <= 310);
208+
// UMad=49, Msad=50, Ubfe=52, Bfi=53, Dot4AddU8Packed=164,
209+
// VectorReduceAnd=309, VectorReduceOr=310
210+
return (30 <= op && op <= 34) || (39 <= op && op <= 40) ||
211+
(42 <= op && op <= 45) || (49 <= op && op <= 50) ||
212+
(52 <= op && op <= 53) || op == 164 || (309 <= op && op <= 310);
206213
}
207214
// Counter functions for llvm ops:
208215
bool CountLlvmOp_atomic(unsigned op) {
@@ -216,17 +223,20 @@ bool CountLlvmOp_fence(unsigned op) {
216223
bool CountLlvmOp_floats(unsigned op) {
217224
// Instructions: FAdd=9, FSub=11, FMul=13, FDiv=16, FRem=19, FPToUI=36,
218225
// FPToSI=37, UIToFP=38, SIToFP=39, FPTrunc=40, FPExt=41, FCmp=47
219-
return op == 9 || op == 11 || op == 13 || op == 16 || op == 19 || (36 <= op && op <= 41) || op == 47;
226+
return op == 9 || op == 11 || op == 13 || op == 16 || op == 19 ||
227+
(36 <= op && op <= 41) || op == 47;
220228
}
221229
bool CountLlvmOp_ints(unsigned op) {
222230
// Instructions: Add=8, Sub=10, Mul=12, SDiv=15, SRem=18, AShr=22, Trunc=33,
223231
// SExt=35, ICmp=46
224-
return op == 8 || op == 10 || op == 12 || op == 15 || op == 18 || op == 22 || op == 33 || op == 35 || op == 46;
232+
return op == 8 || op == 10 || op == 12 || op == 15 || op == 18 || op == 22 ||
233+
op == 33 || op == 35 || op == 46;
225234
}
226235
bool CountLlvmOp_uints(unsigned op) {
227236
// Instructions: UDiv=14, URem=17, Shl=20, LShr=21, And=23, Or=24, Xor=25,
228237
// ZExt=34
229-
return op == 14 || op == 17 || (20 <= op && op <= 21) || (23 <= op && op <= 25) || op == 34;
238+
return op == 14 || op == 17 || (20 <= op && op <= 21) ||
239+
(23 <= op && op <= 25) || op == 34;
230240
}
231241
// OPCODE-COUNTERS:END
232242

@@ -236,21 +246,36 @@ void CountDxilOp(unsigned op, DxilCounters &counters) {
236246
// <py::lines('COUNT-DXIL-OPS')>['if (CountDxilOp_%s(op)) ++counters.%s;' % (c,c) for c in hctdb_instrhelp.get_dxil_op_counters()]</py>
237247
// clang-format on
238248
// COUNT-DXIL-OPS:BEGIN
239-
if (CountDxilOp_atomic(op)) ++counters.atomic;
240-
if (CountDxilOp_barrier(op)) ++counters.barrier;
241-
if (CountDxilOp_floats(op)) ++counters.floats;
242-
if (CountDxilOp_gs_cut(op)) ++counters.gs_cut;
243-
if (CountDxilOp_gs_emit(op)) ++counters.gs_emit;
244-
if (CountDxilOp_ints(op)) ++counters.ints;
245-
if (CountDxilOp_sig_ld(op)) ++counters.sig_ld;
246-
if (CountDxilOp_sig_st(op)) ++counters.sig_st;
247-
if (CountDxilOp_tex_bias(op)) ++counters.tex_bias;
248-
if (CountDxilOp_tex_cmp(op)) ++counters.tex_cmp;
249-
if (CountDxilOp_tex_grad(op)) ++counters.tex_grad;
250-
if (CountDxilOp_tex_load(op)) ++counters.tex_load;
251-
if (CountDxilOp_tex_norm(op)) ++counters.tex_norm;
252-
if (CountDxilOp_tex_store(op)) ++counters.tex_store;
253-
if (CountDxilOp_uints(op)) ++counters.uints;
249+
if (CountDxilOp_atomic(op))
250+
++counters.atomic;
251+
if (CountDxilOp_barrier(op))
252+
++counters.barrier;
253+
if (CountDxilOp_floats(op))
254+
++counters.floats;
255+
if (CountDxilOp_gs_cut(op))
256+
++counters.gs_cut;
257+
if (CountDxilOp_gs_emit(op))
258+
++counters.gs_emit;
259+
if (CountDxilOp_ints(op))
260+
++counters.ints;
261+
if (CountDxilOp_sig_ld(op))
262+
++counters.sig_ld;
263+
if (CountDxilOp_sig_st(op))
264+
++counters.sig_st;
265+
if (CountDxilOp_tex_bias(op))
266+
++counters.tex_bias;
267+
if (CountDxilOp_tex_cmp(op))
268+
++counters.tex_cmp;
269+
if (CountDxilOp_tex_grad(op))
270+
++counters.tex_grad;
271+
if (CountDxilOp_tex_load(op))
272+
++counters.tex_load;
273+
if (CountDxilOp_tex_norm(op))
274+
++counters.tex_norm;
275+
if (CountDxilOp_tex_store(op))
276+
++counters.tex_store;
277+
if (CountDxilOp_uints(op))
278+
++counters.uints;
254279
// COUNT-DXIL-OPS:END
255280
}
256281

@@ -260,11 +285,16 @@ void CountLlvmOp(unsigned op, DxilCounters &counters) {
260285
// <py::lines('COUNT-LLVM-OPS')>['if (CountLlvmOp_%s(op)) ++counters.%s;' % (c,c) for c in hctdb_instrhelp.get_llvm_op_counters()]</py>
261286
// clang-format on
262287
// COUNT-LLVM-OPS:BEGIN
263-
if (CountLlvmOp_atomic(op)) ++counters.atomic;
264-
if (CountLlvmOp_fence(op)) ++counters.fence;
265-
if (CountLlvmOp_floats(op)) ++counters.floats;
266-
if (CountLlvmOp_ints(op)) ++counters.ints;
267-
if (CountLlvmOp_uints(op)) ++counters.uints;
288+
if (CountLlvmOp_atomic(op))
289+
++counters.atomic;
290+
if (CountLlvmOp_fence(op))
291+
++counters.fence;
292+
if (CountLlvmOp_floats(op))
293+
++counters.floats;
294+
if (CountLlvmOp_ints(op))
295+
++counters.ints;
296+
if (CountLlvmOp_uints(op))
297+
++counters.uints;
268298
// COUNT-LLVM-OPS:END
269299
}
270300

@@ -361,30 +391,30 @@ static const CounterOffsetByName CountersByName[] = {
361391
// <py::lines('COUNTER-MEMBER-PTRS')>['{ "%s", &DxilCounters::%s },' % (c,c) for c in hctdb_instrhelp.get_counters()]</py>
362392
// clang-format on
363393
// COUNTER-MEMBER-PTRS:BEGIN
364-
{ "array_local_bytes", &DxilCounters::array_local_bytes },
365-
{ "array_local_ldst", &DxilCounters::array_local_ldst },
366-
{ "array_static_bytes", &DxilCounters::array_static_bytes },
367-
{ "array_static_ldst", &DxilCounters::array_static_ldst },
368-
{ "array_tgsm_bytes", &DxilCounters::array_tgsm_bytes },
369-
{ "array_tgsm_ldst", &DxilCounters::array_tgsm_ldst },
370-
{ "atomic", &DxilCounters::atomic },
371-
{ "barrier", &DxilCounters::barrier },
372-
{ "branches", &DxilCounters::branches },
373-
{ "fence", &DxilCounters::fence },
374-
{ "floats", &DxilCounters::floats },
375-
{ "gs_cut", &DxilCounters::gs_cut },
376-
{ "gs_emit", &DxilCounters::gs_emit },
377-
{ "insts", &DxilCounters::insts },
378-
{ "ints", &DxilCounters::ints },
379-
{ "sig_ld", &DxilCounters::sig_ld },
380-
{ "sig_st", &DxilCounters::sig_st },
381-
{ "tex_bias", &DxilCounters::tex_bias },
382-
{ "tex_cmp", &DxilCounters::tex_cmp },
383-
{ "tex_grad", &DxilCounters::tex_grad },
384-
{ "tex_load", &DxilCounters::tex_load },
385-
{ "tex_norm", &DxilCounters::tex_norm },
386-
{ "tex_store", &DxilCounters::tex_store },
387-
{ "uints", &DxilCounters::uints },
394+
{"array_local_bytes", &DxilCounters::array_local_bytes},
395+
{"array_local_ldst", &DxilCounters::array_local_ldst},
396+
{"array_static_bytes", &DxilCounters::array_static_bytes},
397+
{"array_static_ldst", &DxilCounters::array_static_ldst},
398+
{"array_tgsm_bytes", &DxilCounters::array_tgsm_bytes},
399+
{"array_tgsm_ldst", &DxilCounters::array_tgsm_ldst},
400+
{"atomic", &DxilCounters::atomic},
401+
{"barrier", &DxilCounters::barrier},
402+
{"branches", &DxilCounters::branches},
403+
{"fence", &DxilCounters::fence},
404+
{"floats", &DxilCounters::floats},
405+
{"gs_cut", &DxilCounters::gs_cut},
406+
{"gs_emit", &DxilCounters::gs_emit},
407+
{"insts", &DxilCounters::insts},
408+
{"ints", &DxilCounters::ints},
409+
{"sig_ld", &DxilCounters::sig_ld},
410+
{"sig_st", &DxilCounters::sig_st},
411+
{"tex_bias", &DxilCounters::tex_bias},
412+
{"tex_cmp", &DxilCounters::tex_cmp},
413+
{"tex_grad", &DxilCounters::tex_grad},
414+
{"tex_load", &DxilCounters::tex_load},
415+
{"tex_norm", &DxilCounters::tex_norm},
416+
{"tex_store", &DxilCounters::tex_store},
417+
{"uints", &DxilCounters::uints},
388418
// COUNTER-MEMBER-PTRS:END
389419
};
390420

0 commit comments

Comments
 (0)