diff options
author | evacha01 <evan.chandler@arm.com> | 2024-02-07 11:21:55 +0000 |
---|---|---|
committer | evacha01 <evan.chandler@arm.com> | 2024-03-07 12:06:38 +0000 |
commit | 9c96eefbaca6c85be79529bce7ff04fd7dfe3a0d (patch) | |
tree | 55647ee0216800b621bd0b27277c6f895929ef3d /verif/generator/tosa_utils.py | |
parent | 6e1e2bc06bff785e87577f24064bbc846300f8fd (diff) | |
download | reference_model-9c96eefbaca6c85be79529bce7ff04fd7dfe3a0d.tar.gz |
FULL data gen mode for FP16
Signed-off-by: evacha01 <evan.chandler@arm.com>
Change-Id: I81bb322132daf25328a40342edc62d8e1db9edd6
Diffstat (limited to 'verif/generator/tosa_utils.py')
-rw-r--r-- | verif/generator/tosa_utils.py | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/verif/generator/tosa_utils.py b/verif/generator/tosa_utils.py index 384463f..6558bf8 100644 --- a/verif/generator/tosa_utils.py +++ b/verif/generator/tosa_utils.py @@ -13,22 +13,23 @@ MAX_RESIZE_DIMENSION = 16384 # Data type information dictionary # - str: filename abbreviation # - width: number of bytes needed for type +# - fullset: precalculated number of possible values in the data type's range, equal to 2^width # - json: JSON type string DTYPE_ATTRIBUTES = { - DType.BOOL: {"str": "b", "width": 1, "json": "BOOL"}, - DType.INT4: {"str": "i4", "width": 4, "json": "INT4"}, - DType.INT8: {"str": "i8", "width": 8, "json": "INT8"}, - DType.UINT8: {"str": "u8", "width": 8, "json": "UINT8"}, - DType.INT16: {"str": "i16", "width": 16, "json": "INT16"}, - DType.UINT16: {"str": "u16", "width": 16, "json": "UINT16"}, - DType.INT32: {"str": "i32", "width": 32, "json": "INT32"}, - DType.INT48: {"str": "i48", "width": 48, "json": "INT48"}, - DType.SHAPE: {"str": "s", "width": 64, "json": "SHAPE"}, - DType.FP16: {"str": "f16", "width": 16, "json": "FP16"}, - DType.BF16: {"str": "bf16", "width": 16, "json": "BF16"}, - DType.FP32: {"str": "f32", "width": 32, "json": "FP32"}, - DType.FP8E4M3: {"str": "f8e4m3", "width": 8, "json": "FP8E4M3"}, - DType.FP8E5M2: {"str": "f8e5m2", "width": 8, "json": "FP8E5M2"}, + DType.BOOL: {"str": "b", "width": 1, "fullset": 2, "json": "BOOL"}, + DType.INT4: {"str": "i4", "width": 4, "fullset": 16, "json": "INT4"}, + DType.INT8: {"str": "i8", "width": 8, "fullset": 256, "json": "INT8"}, + DType.UINT8: {"str": "u8", "width": 8, "fullset": 256, "json": "UINT8"}, + DType.INT16: {"str": "i16", "width": 16, "fullset": 65536, "json": "INT16"}, + DType.UINT16: {"str": "u16", "width": 16, "fullset": 65536, "json": "UINT16"}, + DType.INT32: {"str": "i32", "width": 32, "fullset": 1 << 32, "json": "INT32"}, + DType.INT48: {"str": "i48", "width": 48, "fullset": 1 << 48, "json": "INT48"}, + DType.SHAPE: {"str": "s", "width": 64, "fullset": 1 << 64, "json": "SHAPE"}, + DType.FP16: {"str": "f16", "width": 16, "fullset": 65536, "json": "FP16"}, + DType.BF16: {"str": "bf16", "width": 16, "fullset": 65536, "json": "BF16"}, + DType.FP32: {"str": "f32", "width": 32, "fullset": 1 << 32, "json": "FP32"}, + DType.FP8E4M3: {"str": "f8e4m3", "width": 8, "fullset": 256, "json": "FP8E4M3"}, + DType.FP8E5M2: {"str": "f8e5m2", "width": 8, "fullset": 256, "json": "FP8E5M2"}, } @@ -49,9 +50,9 @@ class DataGenType(IntEnum): PSEUDO_RANDOM = 0 DOT_PRODUCT = 1 - OP_BOUNDARY = 2 - OP_FULLSET = 3 - OP_SPECIAL = 4 + BOUNDARY = 2 + FULL_RANGE = 3 + SPECIAL = 4 FIXED_DATA = 5 |