Poplar and PopLibs
GfloatExpr.hpp
1// Copyright (c) 2019 Graphcore Ltd. All rights reserved.
2#ifndef _popfloat_gfloat_expr_hpp_
3#define _popfloat_gfloat_expr_hpp_
4
5namespace popfloat {
6namespace experimental {
7
8enum class RoundType {
9 INV, // Invalid rounding mode
10 RZ, // Round-to-zero
11 RN, // Round-to-nearest ties to even
12 RA, // Round-to-nearest ties away
13 RU, // Round towards positive infinity
14 RD, // Round towards negative infinity
15 SR, // Stochastic rounding with maximum number of random bits
16 SX // Stochastic rounding "eXtended" to use of fewer random bits
17};
18
19enum class FormatType {
20 INVALID_FORMAT, // Invalid format
21 IEEE_FP16, // IEEE FP16
22 QUANTISED_FP32, // Generic float stored as IEEE FP32
23 QUANTISED_FP16, // Generic float stored as IEEE FP16
24 MIN_NORM_ALIGN_GF8, // FP8 with less than 5 exponent bits
25 ONE_FIVE_TWO_GF8, // 1/5/2 with Infs/Nans enabled
26 MAX_NORM_ALIGN_GF8, // 1/5/2 with Infs/Nans disabled
27 BFLOAT16, // 1/8/7 format "Google's Bfloat"
28 NO_DENORM_GF16, // A custom FP16 with denorms disabled
29 ENABLE_DENORM_GF16 // A custom FP16 with denorms enabled
30};
31
32enum class SRDensityType {
33 INVALID, // Invalid SR Noise density
34 UNIFORM, // Uniform SR Noise density
35 NORMAL, // Normal SR Noise density
36 TRUNCATED_NORMAL, // Truncated Normal SR Noise density
37 BERNOULLI, // Bernoulli SR
38 LOGISTIC, // Logistic SR Noise density
39 TRUNCATED_LOGISTIC, // Truncated Logistic SR Noise density
40 LAPLACE, // Laplace SR Noise density
41 TRUNCATED_LAPLACE, // Truncated Laplace SR Noise density
42 LOGIT_NORMAL, // Logit-normal SR Noise density
43 TRUNCATED_LOGIT_NORMAL // Truncated-logit-normal SR Noise density
44};
45
46enum class SpecType {
47 FP32, // Select poplar::FLOAT to store the cast output
48 BF16, // Select poplar::BFLOAT to store the cast output
49 FP16, // Select poplar::HALF to store the cast output
50 INT8, // Select poplar::CHAR to store the cast output
51 INT16, // Select poplar::SHORT to store the cast output
52 INT32, // Select poplar::INT to store the cast output
53 AUTO // Select the smallest storage type to represent the cast output
54};
55
56} // end namespace experimental
57} // end namespace popfloat
58#endif // _popfloat_experimental_gfloat_expr_hpp_