forked from pytorch/FBGEMM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fbgemm.cc
572 lines (491 loc) · 21.9 KB
/
Fbgemm.cc
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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
/*
* Copyright (c) Facebook, Inc. and its affiliates.
* All rights reserved.
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
#define FBGEMM_EXPORTS
#include "fbgemm/Fbgemm.h"
#include <cpuinfo.h>
#include <stdexcept>
#include <functional>
#include "./ExecuteKernel.h"
#ifdef FBGEMM_MEASURE_TIME_BREAKDOWN
double packing_time = 0.0;
double computing_time = 0.0;
double run_time = 0.0;
#endif
namespace fbgemm {
template <
typename packingAMatrix,
typename packingBMatrix,
typename cT,
typename processOutputType>
void fbgemmPacked(
PackMatrix<
packingAMatrix,
typename packingAMatrix::inpType,
typename packingAMatrix::accType>& packA,
PackMatrix<
packingBMatrix,
typename packingBMatrix::inpType,
typename packingBMatrix::accType>& packB,
cT* C,
int32_t* C_buffer,
uint32_t ldc,
const processOutputType& outProcess,
int thread_id,
int num_threads,
const BlockingFactors* blocking_params) {
static_assert(
std::is_same<
typename packingAMatrix::accType,
typename packingBMatrix::accType>::value,
"Accumulation type of both matrices should be the same");
// Run time CPU detection
if (!cpuinfo_initialize()) {
throw std::runtime_error("Failed to initialize cpuinfo!");
}
if ((!fbgemmHasAvx512VnniSupport() && !fbgemmHasAvx512Support() &&
!fbgemmHasAvx2Support())) {
assert(0 && "unknown architecure");
}
int MCB;
int KCB;
int MR;
if (blocking_params) {
MCB = blocking_params->MCB;
KCB = blocking_params->KCB;
MR = blocking_params->MR;
} else {
if (fbgemmHasAvx512VnniSupport()) {
MCB = PackingTraits<
typename packingAMatrix::inpType,
typename packingAMatrix::accType,
inst_set_t::avx512_vnni>::MCB;
KCB = PackingTraits<
typename packingAMatrix::inpType,
typename packingAMatrix::accType,
inst_set_t::avx512_vnni>::KCB;
MR = PackingTraits<
typename packingAMatrix::inpType,
typename packingAMatrix::accType,
inst_set_t::avx512_vnni>::MR;
} else if (fbgemmHasAvx512Support()) {
MCB = PackingTraits<
typename packingAMatrix::inpType,
typename packingAMatrix::accType,
inst_set_t::avx512>::MCB;
KCB = PackingTraits<
typename packingAMatrix::inpType,
typename packingAMatrix::accType,
inst_set_t::avx512>::KCB;
MR = PackingTraits<
typename packingAMatrix::inpType,
typename packingAMatrix::accType,
inst_set_t::avx512>::MR;
} else {
MCB = PackingTraits<
typename packingAMatrix::inpType,
typename packingAMatrix::accType,
inst_set_t::avx2>::MCB;
KCB = PackingTraits<
typename packingAMatrix::inpType,
typename packingAMatrix::accType,
inst_set_t::avx2>::KCB;
MR = PackingTraits<
typename packingAMatrix::inpType,
typename packingAMatrix::accType,
inst_set_t::avx2>::MR;
}
}
if (!packB.isPrePacked()) {
throw std::runtime_error("B matrix must be prepacked");
}
int G = packA.numGroups();
if (G != packB.numGroups()) {
throw std::runtime_error(
"A.groups = " + std::to_string(G) + " and B.groups = " +
std::to_string(packB.numGroups()) + " are not the same");
}
int MDim = packA.numRows();
int KDimPerGroup = packB.numRows() / G;
int NDim = packB.numCols();
int kBlocks = (KDimPerGroup + KCB - 1) / KCB;
// remainders
int _kc = KDimPerGroup % KCB;
int kc, mc;
block_type_t blockA{0, 0, 0, 0};
#ifdef FBGEMM_MEASURE_TIME_BREAKDOWN
std::chrono::time_point<std::chrono::high_resolution_clock> t_very_start,
t_start, t_end;
double dt;
t_start = std::chrono::high_resolution_clock::now();
t_very_start = std::chrono::high_resolution_clock::now();
#endif
thread_type_t th_info =
fbgemmGetThreadPartition(G, MDim, NDim, thread_id, num_threads);
// if (thread_id == 0)
// std::cout << ", " << th_info.toString();
int g_begin, g_end, i_begin, i_end;
// Calculate the begin and end index along the group dimension
fbgemmPartition1D(
th_info.g_thread_id, th_info.g_num_threads, G, g_begin, g_end);
// Calculate the begin and end index along the m dimension
fbgemmPartition1DBlocked(
th_info.m_thread_id, th_info.m_num_threads, MDim, MR, i_begin, i_end);
for (int g = g_begin; g < g_end; ++g) {
ExecuteKernel<packingAMatrix, packingBMatrix, cT, processOutputType>
exeKernelObj(
packA,
packB,
C,
C_buffer,
ldc,
outProcess,
th_info,
blocking_params);
for (int i = i_begin; i < i_end; i += MCB) { // i is the element index
mc = std::min(i_end - i, MCB);
for (int kb = 0; kb < kBlocks; ++kb) { // kb is the block index
kc = (kb != kBlocks - 1 || _kc == 0) ? KCB : _kc;
// pack A matrix
blockA = {i, mc, g * KDimPerGroup + kb * KCB, kc};
packA.pack(blockA);
#ifdef FBGEMM_MEASURE_TIME_BREAKDOWN
t_end = std::chrono::high_resolution_clock::now();
dt = std::chrono::duration_cast<std::chrono::nanoseconds>(
t_end - t_start)
.count();
packing_time += (dt);
t_start = std::chrono::high_resolution_clock::now();
#endif
exeKernelObj.execute(g * kBlocks + kb);
#ifdef FBGEMM_MEASURE_TIME_BREAKDOWN
t_end = std::chrono::high_resolution_clock::now();
dt = std::chrono::duration_cast<std::chrono::nanoseconds>(
t_end - t_start)
.count();
computing_time += (dt);
t_start = std::chrono::high_resolution_clock::now();
#endif
}
}
} // for each group
#ifdef FBGEMM_MEASURE_TIME_BREAKDOWN
t_end = std::chrono::high_resolution_clock::now();
dt =
std::chrono::duration_cast<std::chrono::nanoseconds>(t_end - t_very_start)
.count();
run_time += (dt);
t_start = std::chrono::high_resolution_clock::now();
#endif
}
template <int SPATIAL_DIM>
bool fbgemmOptimizedGConv(const conv_param_t<SPATIAL_DIM>& conv_p) {
static_assert(SPATIAL_DIM >= 2, "Unsupported spatial dims");
int C_per_G = conv_p.IC / conv_p.G;
int K_per_G = conv_p.OC / conv_p.G;
int G_together = PackWeightMatrixForGConv<int8_t, int32_t, SPATIAL_DIM>::
numOfGroupsTogether(conv_p);
auto areEqual = [](int a, int b) { return a == b; };
return (C_per_G == K_per_G) &&
(C_per_G == 2 || C_per_G == 4 || C_per_G == 8 || C_per_G == 16) &&
(conv_p.G >= G_together) &&
std::all_of(
conv_p.K.begin(),
conv_p.K.end(),
std::bind(areEqual, std::placeholders::_1, 3)) &&
std::all_of(
conv_p.pad.begin(),
conv_p.pad.end(),
std::bind(areEqual, std::placeholders::_1, 1)) &&
std::all_of(
conv_p.dilation.begin(),
conv_p.dilation.end(),
std::bind(areEqual, std::placeholders::_1, 1)) &&
// Height/Width strides should be the same and
// should be either 1 or 2
// Temporal stride can be anything.
(std::all_of(
conv_p.stride.begin() + SPATIAL_DIM - 2,
conv_p.stride.end(),
std::bind(areEqual, std::placeholders::_1, 1)) ||
std::all_of(
conv_p.stride.begin() + SPATIAL_DIM - 2,
conv_p.stride.end(),
std::bind(areEqual, std::placeholders::_1, 2))) &&
// Height and Width should be both even or both odd
// and at least as big as filter size
(conv_p.IN_DIM[SPATIAL_DIM - 2] % 2 ==
conv_p.IN_DIM[SPATIAL_DIM - 1] % 2) &&
(conv_p.IN_DIM[SPATIAL_DIM - 2] >= conv_p.K[SPATIAL_DIM - 2]) &&
(conv_p.IN_DIM[SPATIAL_DIM - 1] >= conv_p.K[SPATIAL_DIM - 1]) &&
(conv_p.OUT_DIM[SPATIAL_DIM - 2] >= conv_p.K[SPATIAL_DIM - 2]) &&
(conv_p.OUT_DIM[SPATIAL_DIM - 1] >= conv_p.K[SPATIAL_DIM - 1]);
}
template bool fbgemmOptimizedGConv(const conv_param_t<2>& conv_p);
template bool fbgemmOptimizedGConv(const conv_param_t<3>& conv_p);
bool fbgemmSupportedCPU() {
return (cpuinfo_initialize() && fbgemmHasAvx2Support());
}
////////////////////////////////////////////////////////////////////////////////
// ReQuantizeOutput
#define INSTANTIATE_BASE(PACK_A, ACC_T, RELU, Q_GRAN, BIAS_TYPE) \
template void fbgemmPacked( \
PackMatrix<PACK_A<uint8_t, ACC_T>, uint8_t, ACC_T>& packA, \
PackMatrix<PackBMatrix<int8_t, ACC_T>, int8_t, ACC_T>& packB, \
uint8_t* C, \
int32_t* C_buffer, \
uint32_t ldc, \
const ReQuantizeOutput<RELU, Q_GRAN, BIAS_TYPE>& outProcess, \
int thread_id, \
int num_threads, \
const BlockingFactors* blocking_params);
#define INSTANTIATE_BIAS_T(PACK_A, ACC_T, RELU, Q_GRAN) \
INSTANTIATE_BASE(PACK_A, ACC_T, RELU, Q_GRAN, float); \
INSTANTIATE_BASE(PACK_A, ACC_T, RELU, Q_GRAN, int32_t);
#define INSTANTIATE_Q_GRANS(PACK_A, ACC_T, RELU) \
INSTANTIATE_BIAS_T(PACK_A, ACC_T, RELU, QuantizationGranularity::TENSOR); \
INSTANTIATE_BIAS_T(PACK_A, ACC_T, RELU, QuantizationGranularity::GROUP); \
INSTANTIATE_BIAS_T(PACK_A, ACC_T, RELU, QuantizationGranularity::OUT_CHANNEL);
#define INSTANTIATE_RELU(PACK_A, ACC_T) \
INSTANTIATE_Q_GRANS(PACK_A, ACC_T, false); \
INSTANTIATE_Q_GRANS(PACK_A, ACC_T, true);
#define INSTANTIATE_ACC_T(PACK_A) \
INSTANTIATE_RELU(PACK_A, int32_t); \
INSTANTIATE_RELU(PACK_A, int16_t);
INSTANTIATE_ACC_T(PackAMatrix);
INSTANTIATE_ACC_T(PackAWithRowOffset);
#undef INSTANTIATE_ACC_T
#undef INSTANTIATE_RELU
#undef INSTANTIATE_Q_GRANS
#undef INSTANTIATE_BIAS_T
#undef INSTANTIATE_BASE
#define INSTANTIATE_BASE(ACC_T, RELU, SPATIAL_DIM, Q_GRAN, BIAS_TYPE) \
template void fbgemmPacked( \
PackMatrix< \
PackAWithIm2Col<uint8_t, ACC_T, SPATIAL_DIM>, \
uint8_t, \
ACC_T>& packA, \
PackMatrix<PackBMatrix<int8_t, ACC_T>, int8_t, ACC_T>& packB, \
uint8_t* C, \
int32_t* C_buffer, \
uint32_t ldc, \
const ReQuantizeOutput<RELU, Q_GRAN, BIAS_TYPE>& outProcess, \
int thread_id, \
int num_threads, \
const BlockingFactors* blocking_params);
#define INSTANTIATE_BIAS_T(ACC_T, RELU, SPATIAL_DIM, Q_GRAN) \
INSTANTIATE_BASE(ACC_T, RELU, SPATIAL_DIM, Q_GRAN, float); \
INSTANTIATE_BASE(ACC_T, RELU, SPATIAL_DIM, Q_GRAN, int32_t);
#define INSTANTIATE_Q_GRANS(ACC_T, RELU, SPATIAL_DIM) \
INSTANTIATE_BIAS_T( \
ACC_T, RELU, SPATIAL_DIM, QuantizationGranularity::TENSOR); \
INSTANTIATE_BIAS_T( \
ACC_T, RELU, SPATIAL_DIM, QuantizationGranularity::GROUP); \
INSTANTIATE_BIAS_T( \
ACC_T, RELU, SPATIAL_DIM, QuantizationGranularity::OUT_CHANNEL);
#define INSTANTIATE_SPATIAL_DIM(ACC_T, RELU) \
INSTANTIATE_Q_GRANS(ACC_T, RELU, 2); \
INSTANTIATE_Q_GRANS(ACC_T, RELU, 3);
#define INSTANTIATE_RELU(ACC_T) \
INSTANTIATE_SPATIAL_DIM(ACC_T, false); \
INSTANTIATE_SPATIAL_DIM(ACC_T, true);
INSTANTIATE_RELU(int32_t);
INSTANTIATE_RELU(int16_t);
#undef INSTANTIATE_RELU
#undef INSTANTIATE_SPATIAL_DIM
#undef INSTANTIATE_Q_GRANS
#undef INSTANTIATE_BIAS_T
#undef INSTANTIATE_BASE
////////////////////////////////////////////////////////////////////////////////
// ReQuantizeForFloat
#define INSTANTIATE_BASE(PACK_A, RELU, Q_GRAN) \
template void fbgemmPacked( \
PackMatrix<PACK_A<uint8_t, int32_t>, uint8_t, int32_t>& packA, \
PackMatrix<PackBMatrix<int8_t, int32_t>, int8_t, int32_t>& packB, \
float* C, \
int32_t* C_buffer, \
uint32_t ldc, \
const ReQuantizeForFloat<RELU, Q_GRAN>& outProcess, \
int thread_id, \
int num_threads, \
const BlockingFactors* blocking_params);
#define INSTANTIATE_Q_GRANS(PACK_A, RELU) \
INSTANTIATE_BASE(PACK_A, RELU, QuantizationGranularity::TENSOR); \
INSTANTIATE_BASE(PACK_A, RELU, QuantizationGranularity::GROUP); \
INSTANTIATE_BASE(PACK_A, RELU, QuantizationGranularity::OUT_CHANNEL);
#define INSTANTIATE_RELU(PACK_A) \
INSTANTIATE_Q_GRANS(PACK_A, false); \
INSTANTIATE_Q_GRANS(PACK_A, true);
INSTANTIATE_RELU(PackAWithRowOffset);
INSTANTIATE_RELU(PackAWithQuantRowOffset);
#undef INSTANTIATE_RELU
#undef INSTANTIATE_Q_GRANS
#undef INSTANTIATE_BASE
#define INSTANTIATE_BASE(ACC_T, RELU, SPATIAL_DIM, Q_GRAN) \
template void fbgemmPacked( \
PackMatrix< \
PackAWithIm2Col<uint8_t, ACC_T, SPATIAL_DIM>, \
uint8_t, \
ACC_T>& packA, \
PackMatrix<PackBMatrix<int8_t, ACC_T>, int8_t, ACC_T>& packB, \
float* C, \
int32_t* C_buffer, \
uint32_t ldc, \
const ReQuantizeForFloat<RELU, Q_GRAN>& outProcess, \
int thread_id, \
int num_threads, \
const BlockingFactors* blocking_params);
#define INSTANTIATE_Q_GRANS(ACC_T, RELU, SPATIAL_DIM) \
INSTANTIATE_BASE(ACC_T, RELU, SPATIAL_DIM, QuantizationGranularity::TENSOR); \
INSTANTIATE_BASE(ACC_T, RELU, SPATIAL_DIM, QuantizationGranularity::GROUP); \
INSTANTIATE_BASE( \
ACC_T, RELU, SPATIAL_DIM, QuantizationGranularity::OUT_CHANNEL);
#define INSTANTIATE_SPATIAL_DIM(ACC_T, RELU) \
INSTANTIATE_Q_GRANS(ACC_T, RELU, 2); \
INSTANTIATE_Q_GRANS(ACC_T, RELU, 3);
#define INSTANTIATE_RELU(ACC_T) \
INSTANTIATE_SPATIAL_DIM(ACC_T, false); \
INSTANTIATE_SPATIAL_DIM(ACC_T, true);
INSTANTIATE_RELU(int32_t);
INSTANTIATE_RELU(int16_t);
#undef INSTANTIATE_RELU
#undef INSTANTIATE_SPATIAL_DIM
#undef INSTANTIATE_Q_GRANS
#undef INSTANTIATE_BASE
template void fbgemmPacked(
PackMatrix<PackAWithRowOffset<uint8_t, int16_t>, uint8_t, int16_t>& packA,
PackMatrix<PackBMatrix<int8_t, int16_t>, int8_t, int16_t>& packB,
float* C,
int32_t* C_buffer,
uint32_t ldc,
const ReQuantizeForFloat<false>& outProcess,
int thread_id,
int num_threads,
const BlockingFactors* blocking_params);
////////////////////////////////////////////////////////////////////////////////
// DoSpmdmOnInpBuffer
#define INSTANTIATE_BASE(PACK_A, RELU, Q_GRAN) \
template void fbgemmPacked( \
PackMatrix<PACK_A<uint8_t, int16_t>, uint8_t, int16_t>& packA, \
PackMatrix<PackBMatrix<int8_t, int16_t>, int8_t, int16_t>& packB, \
uint8_t* C, \
int32_t* C_buffer, \
uint32_t ldc, \
const DoSpmdmOnInpBuffer< \
uint8_t, \
int32_t, \
ReQuantizeOutput<RELU, Q_GRAN>>& outProcess, \
int thread_id, \
int num_threads, \
const BlockingFactors* blocking_params);
#define INSTANTIATE_Q_GRANS(PACK_A, RELU) \
INSTANTIATE_BASE(PACK_A, RELU, QuantizationGranularity::TENSOR); \
INSTANTIATE_BASE(PACK_A, RELU, QuantizationGranularity::GROUP); \
INSTANTIATE_BASE(PACK_A, RELU, QuantizationGranularity::OUT_CHANNEL);
#define INSTANTIATE_RELU(PACK_A) \
INSTANTIATE_Q_GRANS(PACK_A, false); \
INSTANTIATE_Q_GRANS(PACK_A, true);
INSTANTIATE_RELU(PackAMatrix);
INSTANTIATE_RELU(PackAWithRowOffset);
#undef INSTANTIATE_Q_GRANS
#undef INSTANTIATE_BASE
#undef INSTANTIATE_RELU
#define INSTANTIATE_BASE(RELU, Q_GRAN) \
template void fbgemmPacked( \
PackMatrix<PackAWithIm2Col<uint8_t, int16_t>, uint8_t, int16_t>& packA, \
PackMatrix<PackBMatrix<int8_t, int16_t>, int8_t, int16_t>& packB, \
uint8_t* C, \
int32_t* C_buffer, \
uint32_t ldc, \
const DoSConvOnInpBuffer< \
uint8_t, \
int32_t, \
ReQuantizeOutput<RELU, Q_GRAN>>& outProcess, \
int thread_id, \
int num_threads, \
const BlockingFactors* blocking_params);
#define INSTANTIATE_Q_GRANS(RELU) \
INSTANTIATE_BASE(RELU, QuantizationGranularity::TENSOR); \
INSTANTIATE_BASE(RELU, QuantizationGranularity::GROUP); \
INSTANTIATE_BASE(RELU, QuantizationGranularity::OUT_CHANNEL);
INSTANTIATE_Q_GRANS(false);
INSTANTIATE_Q_GRANS(true);
#undef INSTANTIATE_Q_GRANS
#undef INSTANTIATE_BASE
template void fbgemmPacked(
PackMatrix<PackAWithRowOffset<uint8_t, int16_t>, uint8_t, int16_t>& packA,
PackMatrix<PackBMatrix<int8_t, int16_t>, int8_t, int16_t>& packB,
float* C,
int32_t* C_buffer,
uint32_t ldc,
const DoSpmdmOnInpBuffer<float, int32_t, ReQuantizeForFloat<false>>&
outProcess,
int thread_id,
int num_threads,
const BlockingFactors* blocking_params);
////////////////////////////////////////////////////////////////////////////////
// memCopy
#define INSTANTIATE_BASE(PACK_A, ACC_T) \
template void fbgemmPacked( \
PackMatrix<PACK_A<uint8_t, ACC_T>, uint8_t, ACC_T>& packA, \
PackMatrix<PackBMatrix<int8_t, ACC_T>, int8_t, ACC_T>& packB, \
int32_t* C, \
int32_t* C_buffer, \
uint32_t ldc, \
const memCopy<>& outProcess, \
int thread_id, \
int num_threads, \
const BlockingFactors* blocking_params);
#define INSTANTIATE_ACC_T(PACK_A) \
INSTANTIATE_BASE(PACK_A, int32_t) \
INSTANTIATE_BASE(PACK_A, int16_t)
INSTANTIATE_ACC_T(PackAMatrix);
INSTANTIATE_ACC_T(PackAWithRowOffset);
#undef INSTANTIATE_ACC_T
#undef INSTANTIATE_BASE
#define INSTANTIATE_BASE(ACC_T, SPATIAL_DIM) \
template void fbgemmPacked( \
PackMatrix< \
PackAWithIm2Col<uint8_t, ACC_T, SPATIAL_DIM>, \
uint8_t, \
ACC_T>& packA, \
PackMatrix<PackBMatrix<int8_t, ACC_T>, int8_t, ACC_T>& packB, \
int32_t* C, \
int32_t* C_buffer, \
uint32_t ldc, \
const memCopy<>& outProcess, \
int thread_id, \
int num_threads, \
const BlockingFactors* blocking_params);
#define INSTANTIATE_SPATIAL_DIM(ACC_T) \
INSTANTIATE_BASE(ACC_T, 2); \
INSTANTIATE_BASE(ACC_T, 3);
INSTANTIATE_SPATIAL_DIM(int32_t);
INSTANTIATE_SPATIAL_DIM(int16_t);
#undef INSTANTIATE_SPATIAL_DIM
#undef INSTANTIATE_BASE
template void fbgemmPacked(
PackMatrix<PackAWithQuantRowOffset<uint8_t, int32_t>, uint8_t, int32_t>&
packA,
PackMatrix<PackBMatrix<int8_t, int32_t>, int8_t, int32_t>& packB,
int32_t* C,
int32_t* C_buffer,
uint32_t ldc,
const memCopy<>& outProcess,
int thread_id,
int num_threads,
const BlockingFactors* blocking_params);
template void fbgemmPacked(
PackMatrix<PackAMatrix<uint8_t, int16_t>, uint8_t, int16_t>& packA,
PackMatrix<PackBMatrix<int8_t, int16_t>, int8_t, int16_t>& packB,
int32_t* C,
int32_t* C_buffer,
uint32_t ldc,
const DoNothing<int32_t, int32_t>& outProcess,
int thread_id,
int num_threads,
const BlockingFactors* blocking_params);
} // namespace fbgemm