|
24 | 24 | * @date 15 March, 2016 |
25 | 25 | */ |
26 | 26 |
|
27 | | -#include <sstream> |
28 | | -#include <string> |
29 | | - |
30 | 27 | #ifndef _H_GRB_DESCRIPTOR |
31 | 28 | #define _H_GRB_DESCRIPTOR |
32 | 29 |
|
| 30 | +#include <string> |
| 31 | + |
| 32 | + |
33 | 33 | namespace grb { |
34 | 34 |
|
35 | 35 | /** |
36 | 36 | * Descriptors indicate pre- or post-processing for some or all of the |
37 | | - * arguments to a GraphBLAS call. |
| 37 | + * arguments to an ALP/GraphBLAS call. An example is to transpose the input |
| 38 | + * matrix during a sparse matrix--vector multiplication: |
| 39 | + * <tt>grb::mxv< grb::descriptors::transpose_matrix >( y, A, x, ring );</tt> |
| 40 | + * the above thus computes \f$ y \to y + A^Tx \f$ and not \f$ y \to y + Ax \f$. |
| 41 | + * |
| 42 | + * Such pre-processing often happens on-the-fly, without significant overhead |
| 43 | + * to the primitive costings in any of its cost dimensions -- work, intra- and |
| 44 | + * inter-process data movement, synchronisations, and memory usage. |
38 | 45 | * |
39 | | - * They can be combined using bit-wise operators. For instance, to both |
40 | | - * indicate the matrix needs be transposed and the mask needs be |
41 | | - * inverted, the following descriptor can be passed: |
| 46 | + * \note If the application of a descriptor is \em not without significant |
| 47 | + * overhead, a backend \em must clearly indicate so. |
| 48 | + * |
| 49 | + * Descriptors may be combined using bit-wise operators. For instance, to both |
| 50 | + * indicate the matrix needs be transposed and the mask needs be inverted, the |
| 51 | + * following descriptor can be passed: |
42 | 52 | * <tt> transpose_matrix | invert_mask </tt> |
43 | 53 | */ |
44 | 54 | typedef unsigned int Descriptor; |
@@ -107,9 +117,31 @@ namespace grb { |
107 | 117 | static constexpr Descriptor structural_complement = structural | invert_mask; |
108 | 118 |
|
109 | 119 | /** |
110 | | - * Indicates all vectors used in a computation are dense. This is a hint that |
111 | | - * might affect performance but will never affect the semantics of the |
112 | | - * computation. |
| 120 | + * Indicates that all input vectors to an ALP/GraphBLAS primitive are |
| 121 | + * structurally dense. |
| 122 | + * |
| 123 | + * If a user passes this descriptor but one or more vectors input to the call |
| 124 | + * are \em not structurally dense, then #ILLEGAL shall be returned. |
| 125 | + * |
| 126 | + * \warning <em>All vectors</em> includes any vectors that operate as masks. |
| 127 | + * Thus if the primitive is to operate with structurally sparse masks |
| 128 | + * but with otherwise dense vectors, then the dense descriptor may |
| 129 | + * \em not be defined. |
| 130 | + * |
| 131 | + * \warning For in-place operations with vector outputs --which are all |
| 132 | + * ALP/GraphBLAS primitives with vector outputs except grb::set and |
| 133 | + * grb::eWiseApply-- the output vector is also an input vector. Thus |
| 134 | + * passing this descriptor to such primitive indicates that also the |
| 135 | + * output vector is structurally dense. |
| 136 | + * |
| 137 | + * \warning Vectors with explicit zeroes (under the semiring passed to the |
| 138 | + * related primitive) will be computed with explicitly. |
| 139 | + * |
| 140 | + * The benefits of using this descriptor whenever possible are two-fold: |
| 141 | + * 1) less run-time overhead as code handling sparsity is disabled; |
| 142 | + * 2) smaller binary sizes as code handling structurally sparse vectors is |
| 143 | + * not emitted (unless required elsewhere). |
| 144 | + * The consistent use of this descriptor is hence strongly encouraged. |
113 | 145 | */ |
114 | 146 | static constexpr Descriptor dense = 16; |
115 | 147 |
|
|
0 commit comments