-
Notifications
You must be signed in to change notification settings - Fork 361
/
bli_type_defs.h
1589 lines (1275 loc) · 43.4 KB
/
bli_type_defs.h
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
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
BLIS
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2014, The University of Texas at Austin
Copyright (C) 2016, Hewlett Packard Enterprise Development LP
Copyright (C) 2020, Advanced Micro Devices, Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name(s) of the copyright holder(s) nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BLIS_TYPE_DEFS_H
#define BLIS_TYPE_DEFS_H
//
// -- BLIS basic types ---------------------------------------------------------
//
#ifdef __cplusplus
// For C++, include stdint.h.
#include <cstdint>
#elif __STDC_VERSION__ >= 199901L
// For C99 (or later), include stdint.h.
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#else
// When stdint.h is not available, manually typedef the types we will use.
#ifdef _WIN32
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#error "Attempting to compile on pre-C99 system without stdint.h."
#endif
#endif
// -- General-purpose integers --
// If BLAS integers are 64 bits, mandate that BLIS integers also be 64 bits.
// NOTE: This cpp guard will only meaningfully change BLIS's behavior on
// systems where the BLIS integer size would have been automatically selected
// to be 32 bits, since explicit selection of 32 bits is prohibited at
// configure-time (and explicit or automatic selection of 64 bits is fine
// and would have had the same result).
#if BLIS_BLAS_INT_TYPE_SIZE == 64
#undef BLIS_INT_TYPE_SIZE
#define BLIS_INT_TYPE_SIZE 64
#endif
// Define integer types depending on what size integer was requested.
#if BLIS_INT_TYPE_SIZE == 32
typedef int32_t gint_t;
typedef uint32_t guint_t;
#elif BLIS_INT_TYPE_SIZE == 64
typedef int64_t gint_t;
typedef uint64_t guint_t;
#else
typedef signed long int gint_t;
typedef unsigned long int guint_t;
#endif
// -- Boolean type --
// NOTE: bool_t is no longer used and has been replaced with C99's bool type.
//typedef bool bool_t;
// BLIS uses TRUE and FALSE macro constants as possible boolean values, but we
// define these macros in terms of true and false, respectively, which are
// defined by C99 in stdbool.h.
#ifndef TRUE
#define TRUE true
#endif
#ifndef FALSE
#define FALSE false
#endif
// -- Special-purpose integers --
// This cpp guard provides a temporary hack to allow libflame
// interoperability with BLIS.
#ifndef _DEFINED_DIM_T
#define _DEFINED_DIM_T
typedef gint_t dim_t; // dimension type
#endif
typedef gint_t inc_t; // increment/stride type
typedef gint_t doff_t; // diagonal offset type
typedef guint_t siz_t; // byte size type
typedef uint32_t objbits_t; // object information bit field
// -- Real types --
// Define the number of floating-point types supported, and the size of the
// largest type.
#define BLIS_NUM_FP_TYPES 4
#define BLIS_MAX_TYPE_SIZE sizeof(dcomplex)
// There are some places where we need to use sizeof() inside of a C
// preprocessor #if conditional, and so here we define the various sizes
// for those purposes.
#define BLIS_SIZEOF_S 4 // sizeof(float)
#define BLIS_SIZEOF_D 8 // sizeof(double)
#define BLIS_SIZEOF_C 8 // sizeof(scomplex)
#define BLIS_SIZEOF_Z 16 // sizeof(dcomplex)
// -- Complex types --
#if defined(__cplusplus) && defined(BLIS_ENABLE_STD_COMPLEX)
} //extern "C"
#include <complex>
// Typedef official C++ complex types to BLIS complex type names.
// This cpp guard provides a temporary hack to allow libflame
// interoperability with BLIS.
#ifndef _DEFINED_SCOMPLEX
#define _DEFINED_SCOMPLEX
typedef std::complex<float> scomplex;
#endif
// This cpp guard provides a temporary hack to allow libflame
// interoperability with BLIS.
#ifndef _DEFINED_DCOMPLEX
#define _DEFINED_DCOMPLEX
typedef std::complex<double> dcomplex;
#endif
extern "C"
{
#elif defined(BLIS_ENABLE_C99_COMPLEX)
#if __STDC_VERSION__ >= 199901L
#include <complex.h>
// Typedef official C99 complex types to BLIS complex type names.
// This cpp guard provides a temporary hack to allow libflame
// interoperability with BLIS.
#ifndef _DEFINED_SCOMPLEX
#define _DEFINED_SCOMPLEX
typedef float complex scomplex;
#endif
// This cpp guard provides a temporary hack to allow libflame
// interoperability with BLIS.
#ifndef _DEFINED_DCOMPLEX
#define _DEFINED_DCOMPLEX
typedef double complex dcomplex;
#endif
#else
#error "Configuration requested C99 complex types, but C99 does not appear to be supported."
#endif
#else // ifndef BLIS_ENABLE_C99_COMPLEX
// This cpp guard provides a temporary hack to allow libflame
// interoperability with BLIS.
#ifndef _DEFINED_SCOMPLEX
#define _DEFINED_SCOMPLEX
typedef struct scomplex
{
float real;
float imag;
} scomplex;
#endif
// This cpp guard provides a temporary hack to allow libflame
// interoperability with BLIS.
#ifndef _DEFINED_DCOMPLEX
#define _DEFINED_DCOMPLEX
typedef struct dcomplex
{
double real;
double imag;
} dcomplex;
#endif
#endif // BLIS_ENABLE_C99_COMPLEX
// -- Atom type --
// Note: atom types are used to hold "bufferless" scalar object values. Note
// that it needs to be as large as the largest possible scalar value we might
// want to hold. Thus, for now, it is a dcomplex.
typedef dcomplex atom_t;
// -- Fortran-77 types --
// Note: These types are typically only used by BLAS compatibility layer, but
// we must define them even when the compatibility layer isn't being built
// because they also occur in bli_slamch() and bli_dlamch().
// Define f77_int depending on what size of integer was requested.
#if BLIS_BLAS_INT_TYPE_SIZE == 32
typedef int32_t f77_int;
#elif BLIS_BLAS_INT_TYPE_SIZE == 64
typedef int64_t f77_int;
#else
typedef long int f77_int;
#endif
typedef char f77_char;
typedef float f77_float;
typedef double f77_double;
typedef scomplex f77_scomplex;
typedef dcomplex f77_dcomplex;
// -- Misc. function pointer types --
// Note: This type should be used in any situation where the address of a
// *function* will be conveyed or stored prior to it being typecast back
// to the correct function type. It does not need to be used when conveying
// or storing the address of *data* (such as an array of float or double).
//typedef void (*void_fp)( void );
typedef void* void_fp;
// Typedef function pointer types for malloc() and free() substitutes.
typedef void* (*malloc_ft)( size_t size );
typedef void (*free_ft) ( void* p );
//
// -- BLIS info bit field sizes ------------------------------------------------
//
#define BLIS_DATATYPE_NUM_BITS ( BLIS_DOMAIN_NUM_BITS + BLIS_PRECISION_NUM_BITS )
#define BLIS_DOMAIN_NUM_BITS 1
#define BLIS_PRECISION_NUM_BITS 2
#define BLIS_CONJTRANS_NUM_BITS ( BLIS_TRANS_NUM_BITS + BLIS_CONJ_NUM_BITS )
#define BLIS_TRANS_NUM_BITS 1
#define BLIS_CONJ_NUM_BITS 1
#define BLIS_UPLO_NUM_BITS ( BLIS_UPPER_NUM_BITS + BLIS_DIAG_NUM_BITS + BLIS_LOWER_NUM_BITS )
#define BLIS_UPPER_NUM_BITS 1
#define BLIS_DIAG_NUM_BITS 1
#define BLIS_LOWER_NUM_BITS 1
#define BLIS_UNIT_DIAG_NUM_BITS 1
#define BLIS_INVERT_DIAG_NUM_BITS 1
#define BLIS_PACK_SCHEMA_NUM_BITS ( BLIS_PACK_PANEL_NUM_BITS + BLIS_PACK_FORMAT_NUM_BITS + BLIS_PACK_NUM_BITS )
#define BLIS_PACK_PANEL_NUM_BITS 1
#define BLIS_PACK_FORMAT_NUM_BITS 4
#define BLIS_PACK_NUM_BITS 1
#define BLIS_PACK_REV_IF_UPPER_NUM_BITS 1
#define BLIS_PACK_REV_IF_LOWER_NUM_BITS 1
#define BLIS_PACK_BUFFER_NUM_BITS 2
#define BLIS_STRUC_NUM_BITS 2
//
// -- BLIS info bit field offsets ----------------------------------------------
//
#define BLIS_DATATYPE_SHIFT 0
#define BLIS_DOMAIN_SHIFT ( BLIS_DATATYPE_SHIFT )
#define BLIS_PRECISION_SHIFT ( BLIS_DOMAIN_SHIFT + BLIS_DOMAIN_NUM_BITS )
#define BLIS_CONJTRANS_SHIFT ( BLIS_DATATYPE_SHIFT + BLIS_DATATYPE_NUM_BITS )
#define BLIS_TRANS_SHIFT ( BLIS_CONJTRANS_SHIFT )
#define BLIS_CONJ_SHIFT ( BLIS_TRANS_SHIFT + BLIS_TRANS_NUM_BITS )
#define BLIS_UPLO_SHIFT ( BLIS_CONJTRANS_SHIFT + BLIS_CONJTRANS_NUM_BITS )
#define BLIS_UPPER_SHIFT ( BLIS_UPLO_SHIFT )
#define BLIS_DIAG_SHIFT ( BLIS_UPPER_SHIFT + BLIS_UPPER_NUM_BITS )
#define BLIS_LOWER_SHIFT ( BLIS_DIAG_SHIFT + BLIS_DIAG_NUM_BITS )
#define BLIS_UNIT_DIAG_SHIFT ( BLIS_UPLO_SHIFT + BLIS_UPLO_NUM_BITS )
#define BLIS_INVERT_DIAG_SHIFT ( BLIS_UNIT_DIAG_SHIFT + BLIS_UNIT_DIAG_NUM_BITS )
#define BLIS_PACK_SCHEMA_SHIFT ( BLIS_INVERT_DIAG_SHIFT + BLIS_INVERT_DIAG_NUM_BITS )
#define BLIS_PACK_PANEL_SHIFT ( BLIS_PACK_SCHEMA_SHIFT )
#define BLIS_PACK_FORMAT_SHIFT ( BLIS_PACK_PANEL_SHIFT + BLIS_PACK_PANEL_NUM_BITS )
#define BLIS_PACK_SHIFT ( BLIS_PACK_FORMAT_SHIFT + BLIS_PACK_FORMAT_NUM_BITS )
#define BLIS_PACK_REV_IF_UPPER_SHIFT ( BLIS_PACK_SCHEMA_SHIFT + BLIS_PACK_SCHEMA_NUM_BITS )
#define BLIS_PACK_REV_IF_LOWER_SHIFT ( BLIS_PACK_REV_IF_UPPER_SHIFT + BLIS_PACK_REV_IF_UPPER_NUM_BITS )
#define BLIS_PACK_BUFFER_SHIFT ( BLIS_PACK_REV_IF_LOWER_SHIFT + BLIS_PACK_REV_IF_LOWER_NUM_BITS )
#define BLIS_STRUC_SHIFT ( BLIS_PACK_BUFFER_SHIFT + BLIS_PACK_BUFFER_NUM_BITS )
#define BLIS_COMP_PREC_SHIFT ( BLIS_STRUC_SHIFT + BLIS_STRUC_NUM_BITS )
#define BLIS_SCALAR_DT_SHIFT ( BLIS_COMP_PREC_SHIFT + BLIS_PRECISION_NUM_BITS )
#define BLIS_SCALAR_DOMAIN_SHIFT ( BLIS_SCALAR_DT_SHIFT )
#define BLIS_SCALAR_PREC_SHIFT ( BLIS_SCALAR_DOMAIN_SHIFT + BLIS_DOMAIN_NUM_BITS )
// This is the total number of bits, which should always be <= 32
#define BLIS_INFO_NUM_BITS ( BLIS_SCALAR_DT_SHIFT + BLIS_DATATYPE_NUM_BITS )
//
// -- BLIS info bit field masks ------------------------------------------------
//
#define BLIS_DATATYPE_BITS ( ( ( 1 << BLIS_DATATYPE_NUM_BITS ) - 1 ) << BLIS_DATATYPE_SHIFT )
#define BLIS_DOMAIN_BIT ( ( ( 1 << BLIS_DOMAIN_NUM_BITS ) - 1 ) << BLIS_DOMAIN_SHIFT )
#define BLIS_PRECISION_BIT ( ( ( 1 << BLIS_PRECISION_NUM_BITS ) - 1 ) << BLIS_PRECISION_SHIFT )
#define BLIS_CONJTRANS_BITS ( ( ( 1 << BLIS_CONJTRANS_NUM_BITS ) - 1 ) << BLIS_CONJTRANS_SHIFT )
#define BLIS_TRANS_BIT ( ( ( 1 << BLIS_TRANS_NUM_BITS ) - 1 ) << BLIS_TRANS_SHIFT )
#define BLIS_CONJ_BIT ( ( ( 1 << BLIS_CONJ_NUM_BITS ) - 1 ) << BLIS_CONJ_SHIFT )
#define BLIS_UPLO_BITS ( ( ( 1 << BLIS_UPLO_NUM_BITS ) - 1 ) << BLIS_UPLO_SHIFT )
#define BLIS_UPPER_BIT ( ( ( 1 << BLIS_UPPER_NUM_BITS ) - 1 ) << BLIS_UPPER_SHIFT )
#define BLIS_DIAG_BIT ( ( ( 1 << BLIS_DIAG_NUM_BITS ) - 1 ) << BLIS_DIAG_SHIFT )
#define BLIS_LOWER_BIT ( ( ( 1 << BLIS_LOWER_NUM_BITS ) - 1 ) << BLIS_LOWER_SHIFT )
#define BLIS_UNIT_DIAG_BIT ( ( ( 1 << BLIS_UNIT_DIAG_NUM_BITS ) - 1 ) << BLIS_UNIT_DIAG_SHIFT )
#define BLIS_INVERT_DIAG_BIT ( ( ( 1 << BLIS_INVERT_DIAG_NUM_BITS ) - 1 ) << BLIS_INVERT_DIAG_SHIFT )
#define BLIS_PACK_SCHEMA_BITS ( ( ( 1 << BLIS_PACK_SCHEMA_NUM_BITS ) - 1 ) << BLIS_PACK_SCHEMA_SHIFT )
#define BLIS_PACK_PANEL_BIT ( ( ( 1 << BLIS_PACK_PANEL_NUM_BITS ) - 1 ) << BLIS_PACK_PANEL_SHIFT )
#define BLIS_PACK_FORMAT_BITS ( ( ( 1 << BLIS_PACK_FORMAT_NUM_BITS ) - 1 ) << BLIS_PACK_FORMAT_SHIFT )
#define BLIS_PACK_BIT ( ( ( 1 << BLIS_PACK_NUM_BITS ) - 1 ) << BLIS_PACK_SHIFT )
#define BLIS_PACK_REV_IF_UPPER_BIT ( ( ( 1 << BLIS_PACK_REV_IF_UPPER_NUM_BITS ) - 1 ) << BLIS_PACK_REV_IF_UPPER_SHIFT )
#define BLIS_PACK_REV_IF_LOWER_BIT ( ( ( 1 << BLIS_PACK_REV_IF_LOWER_NUM_BITS ) - 1 ) << BLIS_PACK_REV_IF_LOWER_SHIFT )
#define BLIS_PACK_BUFFER_BITS ( ( ( 1 << BLIS_PACK_BUFFER_NUM_BITS ) - 1 ) << BLIS_PACK_BUFFER_SHIFT )
#define BLIS_STRUC_BITS ( ( ( 1 << BLIS_STRUC_NUM_BITS ) - 1 ) << BLIS_STRUC_SHIFT )
#define BLIS_COMP_PREC_BIT ( ( ( 1 << BLIS_PRECISION_NUM_BITS ) - 1 ) << BLIS_COMP_PREC_SHIFT )
#define BLIS_SCALAR_DT_BITS ( ( ( 1 << BLIS_DATATYPE_NUM_BITS ) - 1 ) << BLIS_SCALAR_DT_SHIFT )
#define BLIS_SCALAR_DOMAIN_BIT ( ( ( 1 << BLIS_DOMAIN_NUM_BITS ) - 1 ) << BLIS_SCALAR_DOMAIN_SHIFT )
#define BLIS_SCALAR_PREC_BIT ( ( ( 1 << BLIS_PRECISION_NUM_BITS ) - 1 ) << BLIS_SCALAR_PREC_SHIFT )
//
// -- BLIS enumerated type value definitions -----------------------------------
//
#define BLIS_BITVAL_REAL 0x0
#define BLIS_BITVAL_COMPLEX BLIS_DOMAIN_BIT
#define BLIS_BITVAL_SINGLE_PREC 0x0
#define BLIS_BITVAL_DOUBLE_PREC ( 0x1 << BLIS_PRECISION_SHIFT )
#define BLIS_BITVAL_FLOAT_TYPE 0x0
#define BLIS_BITVAL_SCOMPLEX_TYPE BLIS_DOMAIN_BIT
#define BLIS_BITVAL_DOUBLE_TYPE BLIS_BITVAL_DOUBLE_PREC
#define BLIS_BITVAL_DCOMPLEX_TYPE ( BLIS_DOMAIN_BIT | BLIS_BITVAL_DOUBLE_PREC )
#define BLIS_BITVAL_INT_TYPE 0x04
#define BLIS_BITVAL_CONST_TYPE 0x05
#define BLIS_BITVAL_NO_TRANS 0x0
#define BLIS_BITVAL_TRANS BLIS_TRANS_BIT
#define BLIS_BITVAL_NO_CONJ 0x0
#define BLIS_BITVAL_CONJ BLIS_CONJ_BIT
#define BLIS_BITVAL_CONJ_TRANS ( BLIS_CONJ_BIT | BLIS_TRANS_BIT )
#define BLIS_BITVAL_ZEROS 0x0
#define BLIS_BITVAL_UPPER ( BLIS_UPPER_BIT | BLIS_DIAG_BIT )
#define BLIS_BITVAL_LOWER ( BLIS_LOWER_BIT | BLIS_DIAG_BIT )
#define BLIS_BITVAL_DENSE BLIS_UPLO_BITS
#define BLIS_BITVAL_NONUNIT_DIAG 0x0
#define BLIS_BITVAL_UNIT_DIAG BLIS_UNIT_DIAG_BIT
#define BLIS_BITVAL_INVERT_DIAG BLIS_INVERT_DIAG_BIT
#define BLIS_BITVAL_NOT_PACKED 0x0
#define BLIS_BITVAL_1E ( 0x1 << BLIS_PACK_FORMAT_SHIFT )
#define BLIS_BITVAL_1R ( 0x2 << BLIS_PACK_FORMAT_SHIFT )
#define BLIS_BITVAL_RO ( 0x3 << BLIS_PACK_FORMAT_SHIFT )
#define BLIS_BITVAL_PACKED_UNSPEC ( BLIS_PACK_BIT )
#define BLIS_BITVAL_PACKED_PANELS ( BLIS_PACK_BIT | BLIS_PACK_PANEL_BIT )
#define BLIS_BITVAL_PACKED_PANELS_1E ( BLIS_PACK_BIT | BLIS_BITVAL_1E | BLIS_PACK_PANEL_BIT )
#define BLIS_BITVAL_PACKED_PANELS_1R ( BLIS_PACK_BIT | BLIS_BITVAL_1R | BLIS_PACK_PANEL_BIT )
#define BLIS_BITVAL_PACKED_PANELS_RO ( BLIS_PACK_BIT | BLIS_BITVAL_RO | BLIS_PACK_PANEL_BIT )
#define BLIS_BITVAL_PACK_FWD_IF_UPPER 0x0
#define BLIS_BITVAL_PACK_REV_IF_UPPER BLIS_PACK_REV_IF_UPPER_BIT
#define BLIS_BITVAL_PACK_FWD_IF_LOWER 0x0
#define BLIS_BITVAL_PACK_REV_IF_LOWER BLIS_PACK_REV_IF_LOWER_BIT
#define BLIS_BITVAL_BUFFER_FOR_A_BLOCK 0x0
#define BLIS_BITVAL_BUFFER_FOR_B_PANEL ( 0x1 << BLIS_PACK_BUFFER_SHIFT )
#define BLIS_BITVAL_BUFFER_FOR_C_PANEL ( 0x2 << BLIS_PACK_BUFFER_SHIFT )
#define BLIS_BITVAL_BUFFER_FOR_GEN_USE ( 0x3 << BLIS_PACK_BUFFER_SHIFT )
#define BLIS_BITVAL_GENERAL 0x0
#define BLIS_BITVAL_HERMITIAN ( 0x1 << BLIS_STRUC_SHIFT )
#define BLIS_BITVAL_SYMMETRIC ( 0x2 << BLIS_STRUC_SHIFT )
#define BLIS_BITVAL_TRIANGULAR ( 0x3 << BLIS_STRUC_SHIFT )
//
// -- BLIS enumerated type definitions -----------------------------------------
//
// -- Operational parameter types --
typedef enum
{
BLIS_NO_TRANSPOSE = 0x0,
BLIS_TRANSPOSE = BLIS_BITVAL_TRANS,
BLIS_CONJ_NO_TRANSPOSE = BLIS_BITVAL_CONJ,
BLIS_CONJ_TRANSPOSE = BLIS_BITVAL_CONJ_TRANS
} trans_t;
typedef enum
{
BLIS_NO_CONJUGATE = 0x0,
BLIS_CONJUGATE = BLIS_BITVAL_CONJ
} conj_t;
typedef enum
{
BLIS_ZEROS = BLIS_BITVAL_ZEROS,
BLIS_LOWER = BLIS_BITVAL_LOWER,
BLIS_UPPER = BLIS_BITVAL_UPPER,
BLIS_DENSE = BLIS_BITVAL_DENSE
} uplo_t;
typedef enum
{
BLIS_LEFT = 0x0,
BLIS_RIGHT
} side_t;
typedef enum
{
BLIS_NONUNIT_DIAG = 0x0,
BLIS_UNIT_DIAG = BLIS_BITVAL_UNIT_DIAG
} diag_t;
typedef enum
{
BLIS_NO_INVERT_DIAG = 0x0,
BLIS_INVERT_DIAG = BLIS_BITVAL_INVERT_DIAG
} invdiag_t;
typedef enum
{
BLIS_GENERAL = BLIS_BITVAL_GENERAL,
BLIS_HERMITIAN = BLIS_BITVAL_HERMITIAN,
BLIS_SYMMETRIC = BLIS_BITVAL_SYMMETRIC,
BLIS_TRIANGULAR = BLIS_BITVAL_TRIANGULAR
} struc_t;
// -- Data type --
typedef enum
{
BLIS_FLOAT = BLIS_BITVAL_FLOAT_TYPE,
BLIS_DOUBLE = BLIS_BITVAL_DOUBLE_TYPE,
BLIS_SCOMPLEX = BLIS_BITVAL_SCOMPLEX_TYPE,
BLIS_DCOMPLEX = BLIS_BITVAL_DCOMPLEX_TYPE,
BLIS_INT = BLIS_BITVAL_INT_TYPE,
BLIS_CONSTANT = BLIS_BITVAL_CONST_TYPE,
BLIS_DT_LO = BLIS_FLOAT,
BLIS_DT_HI = BLIS_DCOMPLEX
} num_t;
typedef enum
{
BLIS_REAL = BLIS_BITVAL_REAL,
BLIS_COMPLEX = BLIS_BITVAL_COMPLEX
} dom_t;
typedef enum
{
BLIS_SINGLE_PREC = BLIS_BITVAL_SINGLE_PREC,
BLIS_DOUBLE_PREC = BLIS_BITVAL_DOUBLE_PREC
} prec_t;
// -- Pack schema type --
typedef enum
{
BLIS_NOT_PACKED = BLIS_BITVAL_NOT_PACKED,
BLIS_PACKED_UNSPEC = BLIS_BITVAL_PACKED_UNSPEC,
BLIS_PACKED_VECTOR = BLIS_BITVAL_PACKED_UNSPEC,
BLIS_PACKED_MATRIX = BLIS_BITVAL_PACKED_UNSPEC,
BLIS_PACKED_PANELS = BLIS_BITVAL_PACKED_PANELS,
BLIS_PACKED_PANELS_1E = BLIS_BITVAL_PACKED_PANELS_1E,
BLIS_PACKED_PANELS_1R = BLIS_BITVAL_PACKED_PANELS_1R,
BLIS_PACKED_PANELS_RO = BLIS_BITVAL_PACKED_PANELS_RO,
// BLIS_NUM_PACK_SCHEMA_TYPES must be last!
// We start with BLIS_PACKED_PANELS.
BLIS_NUM_PACK_SCHEMA_TYPES_,
BLIS_NUM_PACK_SCHEMA_TYPES = ((( BLIS_NUM_PACK_SCHEMA_TYPES_ - BLIS_PACKED_PANELS - 1 ) >> BLIS_PACK_FORMAT_SHIFT ) + 1)
} pack_t;
// -- Pack order type --
typedef enum
{
BLIS_PACK_FWD_IF_UPPER = BLIS_BITVAL_PACK_FWD_IF_UPPER,
BLIS_PACK_REV_IF_UPPER = BLIS_BITVAL_PACK_REV_IF_UPPER,
BLIS_PACK_FWD_IF_LOWER = BLIS_BITVAL_PACK_FWD_IF_LOWER,
BLIS_PACK_REV_IF_LOWER = BLIS_BITVAL_PACK_REV_IF_LOWER
} packord_t;
// -- Pack buffer type --
typedef enum
{
BLIS_BUFFER_FOR_A_BLOCK = BLIS_BITVAL_BUFFER_FOR_A_BLOCK,
BLIS_BUFFER_FOR_B_PANEL = BLIS_BITVAL_BUFFER_FOR_B_PANEL,
BLIS_BUFFER_FOR_C_PANEL = BLIS_BITVAL_BUFFER_FOR_C_PANEL,
BLIS_BUFFER_FOR_GEN_USE = BLIS_BITVAL_BUFFER_FOR_GEN_USE
} packbuf_t;
// -- Partitioning direction --
typedef enum
{
BLIS_FWD,
BLIS_BWD
} dir_t;
// -- Subpartition type --
typedef enum
{
BLIS_SUBPART0,
BLIS_SUBPART1,
BLIS_SUBPART2,
BLIS_SUBPART1AND0,
BLIS_SUBPART1AND2,
BLIS_SUBPART1A,
BLIS_SUBPART1B,
BLIS_SUBPART00,
BLIS_SUBPART10,
BLIS_SUBPART20,
BLIS_SUBPART01,
BLIS_SUBPART11,
BLIS_SUBPART21,
BLIS_SUBPART02,
BLIS_SUBPART12,
BLIS_SUBPART22
} subpart_t;
// -- Matrix dimension type --
typedef enum
{
BLIS_M = 0,
BLIS_N = 1
} mdim_t;
// -- Machine parameter types --
typedef enum
{
BLIS_MACH_EPS = 0,
BLIS_MACH_SFMIN,
BLIS_MACH_BASE,
BLIS_MACH_PREC,
BLIS_MACH_NDIGMANT,
BLIS_MACH_RND,
BLIS_MACH_EMIN,
BLIS_MACH_RMIN,
BLIS_MACH_EMAX,
BLIS_MACH_RMAX,
BLIS_MACH_EPS2,
// BLIS_NUM_MACH_PARAMS must be last!
BLIS_NUM_MACH_PARAMS
} machval_t;
#define BLIS_MACH_PARAM_FIRST BLIS_MACH_EPS
#define BLIS_MACH_PARAM_LAST BLIS_MACH_EPS2
// -- Induced method types --
typedef enum
{
BLIS_1M = 0,
BLIS_NAT,
BLIS_IND_FIRST = 0,
BLIS_IND_LAST = BLIS_NAT,
// BLIS_NUM_IND_METHODS must be last!
BLIS_NUM_IND_METHODS
} ind_t;
// These are used in bli_l3_*_oapi.c to construct the ind_t values from
// the induced method substrings that go into function names.
#define bli_1m BLIS_1M
#define bli_nat BLIS_NAT
// -- Threading implementation type --
typedef enum
{
BLIS_SINGLE = 0,
BLIS_OPENMP,
BLIS_POSIX,
BLIS_HPX,
// BLIS_NUM_THREAD_IMPLS must be last!
BLIS_NUM_THREAD_IMPLS
} timpl_t;
// -- Kernel ID types --
// Encode the number of independent type parameters in the high
// bits of the kernel ID. This lets us identify kernel IDs as the
// appropriate type while also using them as linear indices after
// masking out these bits.
#define BLIS_NTYPE_KER_SHIFT 28
#define BLIS_NTYPE_KER_BITS (0xFu << BLIS_NTYPE_KER_SHIFT)
#define BLIS_1TYPE_KER ( 0u << BLIS_NTYPE_KER_SHIFT)
#define BLIS_2TYPE_KER ( 1u << BLIS_NTYPE_KER_SHIFT)
#define BLIS_3TYPE_KER ( 2u << BLIS_NTYPE_KER_SHIFT)
#define bli_ker_idx( ker ) ((ker) & ~BLIS_NTYPE_KER_BITS)
#define bli_ker_ntype( ker ) ((((ker) & BLIS_NTYPE_KER_BITS) >> BLIS_NTYPE_KER_SHIFT) + 1)
typedef enum
{
// -- Single-type kernels --
// l1v kernels
BLIS_ADDV_KER = BLIS_1TYPE_KER,
BLIS_AMAXV_KER,
BLIS_AXPBYV_KER,
BLIS_AXPYV_KER,
BLIS_COPYV_KER,
BLIS_DOTV_KER,
BLIS_DOTXV_KER,
BLIS_INVERTV_KER,
BLIS_INVSCALV_KER,
BLIS_SCALV_KER,
BLIS_SCAL2V_KER,
BLIS_SETV_KER,
BLIS_SUBV_KER,
BLIS_SWAPV_KER,
BLIS_XPBYV_KER,
BLIS_AXPY2V_KER,
BLIS_DOTAXPYV_KER,
// l1f kernels
BLIS_AXPYF_KER,
BLIS_DOTXF_KER,
BLIS_DOTXAXPYF_KER,
// l3 native kernels
BLIS_GEMMTRSM_L_UKR,
BLIS_GEMMTRSM_U_UKR,
BLIS_TRSM_L_UKR,
BLIS_TRSM_U_UKR,
// l3 1m kernels
BLIS_GEMMTRSM1M_L_UKR,
BLIS_GEMMTRSM1M_U_UKR,
// gemmsup kernels
BLIS_GEMMSUP_RRR_UKR,
BLIS_GEMMSUP_RRC_UKR,
BLIS_GEMMSUP_RCR_UKR,
BLIS_GEMMSUP_RCC_UKR,
BLIS_GEMMSUP_CRR_UKR,
BLIS_GEMMSUP_CRC_UKR,
BLIS_GEMMSUP_CCR_UKR,
BLIS_GEMMSUP_CCC_UKR,
BLIS_GEMMSUP_XXX_UKR,
// BLIS_NUM_UKRS must be last!
BLIS_NUM_UKRS_, BLIS_NUM_UKRS = bli_ker_idx( BLIS_NUM_UKRS_ ),
// -- Two-type kernels --
// pack kernels
BLIS_PACKM_KER = BLIS_2TYPE_KER,
BLIS_PACKM_1ER_KER,
BLIS_PACKM_RO_KER,
BLIS_PACKM_DIAG_KER,
BLIS_PACKM_DIAG_1ER_KER,
BLIS_PACKM_DIAG_RO_KER,
// unpack kernels
BLIS_UNPACKM_KER,
// l3 native kernels
BLIS_GEMM_UKR,
// l3 1m kernels
BLIS_GEMM1M_UKR,
// mixed-domain kernels
BLIS_GEMM_CCR_UKR,
BLIS_GEMM_RCC_UKR,
BLIS_GEMM_CRR_UKR,
// BLIS_NUM_UKR2S must be last!
BLIS_NUM_UKR2S_, BLIS_NUM_UKR2S = bli_ker_idx( BLIS_NUM_UKR2S_ )
} ukr_t;
typedef enum
{
// l3 kernel row preferences
BLIS_GEMM_UKR_ROW_PREF,
BLIS_GEMMTRSM_L_UKR_ROW_PREF,
BLIS_GEMMTRSM_U_UKR_ROW_PREF,
BLIS_TRSM_L_UKR_ROW_PREF,
BLIS_TRSM_U_UKR_ROW_PREF,
// gemmsup kernel row preferences
BLIS_GEMMSUP_RRR_UKR_ROW_PREF,
BLIS_GEMMSUP_RRC_UKR_ROW_PREF,
BLIS_GEMMSUP_RCR_UKR_ROW_PREF,
BLIS_GEMMSUP_RCC_UKR_ROW_PREF,
BLIS_GEMMSUP_CRR_UKR_ROW_PREF,
BLIS_GEMMSUP_CRC_UKR_ROW_PREF,
BLIS_GEMMSUP_CCR_UKR_ROW_PREF,
BLIS_GEMMSUP_CCC_UKR_ROW_PREF,
BLIS_GEMMSUP_XXX_UKR_ROW_PREF,
// BLIS_NUM_UKR_PREFS must be last!
BLIS_NUM_UKR_PREFS
} ukr_pref_t;
typedef enum
{
BLIS_REFERENCE_UKERNEL = 0,
BLIS_VIRTUAL_UKERNEL,
BLIS_OPTIMIZED_UKERNEL,
BLIS_NOTAPPLIC_UKERNEL,
// BLIS_NUM_UKR_IMPL_TYPES must be last!
BLIS_NUM_UKR_IMPL_TYPES
} kimpl_t;
#if 0
typedef enum
{
// RV = row-stored, contiguous vector-loading
// RG = row-stored, non-contiguous gather-loading
// CV = column-stored, contiguous vector-loading
// CG = column-stored, non-contiguous gather-loading
// RD = row-stored, dot-based
// CD = col-stored, dot-based
// RC = row-stored, column-times-column
// CR = column-stored, row-times-row
// GX = general-stored generic implementation
BLIS_GEMMSUP_RV_UKR = 0,
BLIS_GEMMSUP_RG_UKR,
BLIS_GEMMSUP_CV_UKR,
BLIS_GEMMSUP_CG_UKR,
BLIS_GEMMSUP_RD_UKR,
BLIS_GEMMSUP_CD_UKR,
BLIS_GEMMSUP_RC_UKR,
BLIS_GEMMSUP_CR_UKR,
BLIS_GEMMSUP_GX_UKR,
// BLIS_NUM_LEVEL3_SUP_UKRS must be last!
BLIS_NUM_LEVEL3_SUP_UKRS
} l3sup_t;
#endif
typedef enum
{
// 3-operand storage combinations
BLIS_RRR = 0,
BLIS_RRC, // 1
BLIS_RCR, // 2
BLIS_RCC, // 3
BLIS_CRR, // 4
BLIS_CRC, // 5
BLIS_CCR, // 6
BLIS_CCC, // 7
BLIS_XXX, // 8
#if 0
BLIS_RRG,
BLIS_RCG,
BLIS_RGR,
BLIS_RGC,
BLIS_RGG,
BLIS_CRG,
BLIS_CCG,
BLIS_CGR,
BLIS_CGC,
BLIS_CGG,
BLIS_GRR,
BLIS_GRC,
BLIS_GRG,
BLIS_GCR,
BLIS_GCC,
BLIS_GCG,
BLIS_GGR,
BLIS_GGC,
BLIS_GGG,
#endif
// BLIS_NUM_3OP_RC_COMBOS must be last!
BLIS_NUM_3OP_RC_COMBOS
} stor3_t;
#if 0
typedef enum
{
BLIS_JC_IDX = 0,
BLIS_PC_IDX,
BLIS_IC_IDX,
BLIS_JR_IDX,
BLIS_IR_IDX,
BLIS_PR_IDX
} thridx_t;
#endif
#define BLIS_NUM_LOOPS 6
// -- Operation ID type --
typedef enum
{
//
// NOTE: If/when additional type values are added to this enum,
// you must either:
// - keep the level-3 values (starting with _GEMM) beginning at
// index 0; or
// - if the value range is moved such that it does not begin at
// index 0, implement something like a BLIS_OPID_LEVEL3_RANGE_START
// value that can be subtracted from the opid_t value to map it
// to a zero-based range.
// This is needed because these level-3 opid_t values are used in
// bli_l3_ind.c to index into arrays.
//
BLIS_GEMM = 0,
BLIS_GEMMT,
BLIS_HEMM,
BLIS_HERK,
BLIS_HER2K,
BLIS_SYMM,
BLIS_SYRK,
BLIS_SYR2K,
BLIS_TRMM3,
BLIS_TRMM,
BLIS_TRSM,
// BLIS_NOID (= BLIS_NUM_LEVEL3_OPS) must be last!
BLIS_NOID,
BLIS_NUM_LEVEL3_OPS = BLIS_NOID
} opid_t;
// -- Blocksize ID type --
typedef enum
{
// NOTE: the level-3 blocksizes MUST be indexed starting at zero.
// At one point, we made this assumption in bli_cntx_set_blkszs()
// and friends.
BLIS_KR,
BLIS_MR,
BLIS_NR,
BLIS_MC,
BLIS_KC,
BLIS_NC,
// broadcast factors for packing
BLIS_BBM,
BLIS_BBN,
// level-2 blocksizes
BLIS_M2, // level-2 blocksize in m dimension
BLIS_N2, // level-2 blocksize in n dimension
// level-1f blocksizes
BLIS_AF, // level-1f axpyf fusing factor
BLIS_DF, // level-1f dotxf fusing factor
BLIS_XF, // level-1f dotxaxpyf fusing factor
// gemmsup thresholds
BLIS_MT, // level-3 small/unpacked matrix threshold in m dimension
BLIS_NT, // level-3 small/unpacked matrix threshold in n dimension
BLIS_KT, // level-3 small/unpacked matrix threshold in k dimension
// gemmsup block sizes
BLIS_KR_SUP,
BLIS_MR_SUP,
BLIS_NR_SUP,
BLIS_MC_SUP,
BLIS_KC_SUP,
BLIS_NC_SUP,
// BLIS_NO_PART (= BLIS_NUM_BLKSZS) must be last!
BLIS_NO_PART, // used as a placeholder when blocksizes are not applicable,
// such as when characterizing a packm operation.
BLIS_NUM_BLKSZS = BLIS_NO_PART
} bszid_t;
// A convenient version of the BLIS_XX block size IDs which can be used in bitfields.
enum
{
BLIS_THREAD_NONE = 0,
BLIS_THREAD_KR = 1 << BLIS_KR,
BLIS_THREAD_MR = 1 << BLIS_MR,
BLIS_THREAD_NR = 1 << BLIS_NR,
BLIS_THREAD_MC = 1 << BLIS_MC,
BLIS_THREAD_KC = 1 << BLIS_KC,
BLIS_THREAD_NC = 1 << BLIS_NC,
};
// -- Architecture ID type --
// NOTE: This typedef enum must be kept up-to-date with the arch_t
// string array in bli_arch.c. Whenever values are added/inserted
// OR if values are rearranged, be sure to update the string array
// in bli_arch.c.
typedef enum
{
// NOTE: The C language standard guarantees that the first enum value
// starts at 0.
// Intel
BLIS_ARCH_SKX,
BLIS_ARCH_KNL,
BLIS_ARCH_KNC,
BLIS_ARCH_HASWELL,
BLIS_ARCH_SANDYBRIDGE,
BLIS_ARCH_PENRYN,
// AMD
BLIS_ARCH_ZEN3,
BLIS_ARCH_ZEN2,
BLIS_ARCH_ZEN,
BLIS_ARCH_EXCAVATOR,
BLIS_ARCH_STEAMROLLER,
BLIS_ARCH_PILEDRIVER,
BLIS_ARCH_BULLDOZER,
// ARM-SVE
BLIS_ARCH_ARMSVE,
BLIS_ARCH_A64FX,
// ARM-NEON (4 pipes x 128-bit vectors)
BLIS_ARCH_ALTRAMAX,
BLIS_ARCH_ALTRA,
BLIS_ARCH_FIRESTORM,
// ARM (2 pipes x 128-bit vectors)
BLIS_ARCH_THUNDERX2,
BLIS_ARCH_CORTEXA57,
BLIS_ARCH_CORTEXA53,
// ARM 32-bit (vintage)
BLIS_ARCH_CORTEXA15,
BLIS_ARCH_CORTEXA9,
// IBM/Power
BLIS_ARCH_POWER10,
BLIS_ARCH_POWER9,
BLIS_ARCH_POWER7,
BLIS_ARCH_BGQ,
// RISC-V
BLIS_ARCH_RV32I,
BLIS_ARCH_RV64I,
BLIS_ARCH_RV32IV,
BLIS_ARCH_RV64IV,
// SiFive
BLIS_ARCH_SIFIVE_X280,
// Generic architecture/configuration
BLIS_ARCH_GENERIC,
// The total number of defined architectures. This must be last in the
// list of enums since its definition assumes that the previous enum
// value (BLIS_ARCH_GENERIC) is given index num_archs-1.
BLIS_NUM_ARCHS
} arch_t;