diff options
author | Eric Kunze <eric.kunze@arm.com> | 2023-10-20 15:58:55 -0700 |
---|---|---|
committer | Eric Kunze <eric.kunze@arm.com> | 2024-02-14 16:36:04 -0800 |
commit | 74e2ceba954ed6111b3e3ce40c5ff88fe79ff043 (patch) | |
tree | 7e1967b073313d7df4885693eda931230d401eb0 /pseudocode/library/generic_helpers.tosac | |
parent | 9fe5e964e2193f0e345670f7f4098beecd7fd6eb (diff) | |
download | specification-74e2ceba954ed6111b3e3ce40c5ff88fe79ff043.tar.gz |
Initial FP8 support
Adds support for Open Compute Project (OCP) 8-bit floating point operations
to the TOSA specification. Both E4M3 and E5M2 types are supported for profiles
as indicated in the Supported Data Types table for each operator.
FP8 operator list
ARGMAX
AVGPOOL
CONV2D
CONV3D
DEPTHWISE_CONV2D
MATMUL
MAX_POOL2D
TRANSPOSE_CONV2D
CONST
CAST
CONCAT
PAD
DIM
RESHAPE
REVERSE
SLICE
TILE
TRANSPOSE
GATHER
SCATTER
Signed-off-by: Eric Kunze <eric.kunze@arm.com>
Change-Id: I3dd83f48afcc3c880c5c88039337ff4f1fd95b1b
Diffstat (limited to 'pseudocode/library/generic_helpers.tosac')
-rw-r--r-- | pseudocode/library/generic_helpers.tosac | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pseudocode/library/generic_helpers.tosac b/pseudocode/library/generic_helpers.tosac index a9d71ec..a2fdbe0 100644 --- a/pseudocode/library/generic_helpers.tosac +++ b/pseudocode/library/generic_helpers.tosac @@ -8,11 +8,20 @@ // by a licensing agreement from ARM Limited. bool_t is_floating_point(type) { - if (type == fp16_t || type == fp32_t || type == bf16_t) + if (type == fp16_t || type == fp32_t || type == bf16_t || type == fp8e4m3_t || type == fp8e5m2_t) return true; return false; } +bool_t is_saturating_float_type(type) { + // Saturate for the fp8 formats, all other floats do not saturate + if (type == fp8e4m3_t || type == fp8e5m2_t) { + return true; + } + return false; +} + + int32_t idiv(int32_t input1, int32_t input2) { return input1 / input2; // Integer divide that truncates towards zero } |