1 /*
2  * Copyright (c) 2019-2020 The University of Tennessee and The University
3  *                         of Tennessee Research Foundation.  All rights
4  *                         reserved.
5  * $COPYRIGHT$
6  *
7  * Additional copyrights may follow
8  *
9  * $HEADER$
10  */
11 
12 #ifndef MCA_OP_AVX_EXPORT_H
13 #define MCA_OP_AVX_EXPORT_H
14 
15 #include "ompi_config.h"
16 
17 #include "ompi/mca/mca.h"
18 #include "opal/class/opal_object.h"
19 
20 #include "ompi/mca/op/op.h"
21 
22 BEGIN_C_DECLS
23 
24 #define OMPI_OP_AVX_HAS_AVX512BW_FLAG  0x00000200
25 #define OMPI_OP_AVX_HAS_AVX512F_FLAG   0x00000100
26 #define OMPI_OP_AVX_HAS_AVX2_FLAG      0x00000020
27 #define OMPI_OP_AVX_HAS_AVX_FLAG       0x00000010
28 #define OMPI_OP_AVX_HAS_SSE4_1_FLAG    0x00000008
29 #define OMPI_OP_AVX_HAS_SSE3_FLAG      0x00000004
30 #define OMPI_OP_AVX_HAS_SSE2_FLAG      0x00000002
31 #define OMPI_OP_AVX_HAS_SSE_FLAG       0x00000001
32 
33 /**
34  * Derive a struct from the base op component struct, allowing us to
35  * cache some component-specific information on our well-known
36  * component struct.
37  */
38 typedef struct {
39     /** The base op component struct */
40     ompi_op_base_component_1_0_0_t super;
41 
42     /* What follows is avx-component-specific cached information.  We
43        tend to use this scheme (caching information on the avx
44        component itself) instead of lots of individual global
45        variables for the component.  The following data fields are
46        avxs; replace them with whatever is relevant for your
47        component. */
48 
49     uint32_t supported; /* AVX capabilities supported by the environment */
50     uint32_t flags; /* AVX capabilities requested by this process */
51 } ompi_op_avx_component_t;
52 
53 /**
54  * Globally exported variable.  Note that it is a *avx* component
55  * (defined above), which has the ompi_op_base_component_t as its
56  * first member.  Hence, the MCA/op framework will find the data that
57  * it expects in the first memory locations, but then the component
58  * itself can cache additional information after that that can be used
59  * by both the component and modules.
60  */
61 OMPI_DECLSPEC extern ompi_op_avx_component_t
62     mca_op_avx_component;
63 
64 END_C_DECLS
65 
66 #endif /* MCA_OP_AVX_EXPORT_H */
67