diff options
Diffstat (limited to 'verif')
-rw-r--r-- | verif/checker/verifier.py | 2 | ||||
-rw-r--r-- | verif/generator/tosa_test_gen.py | 14 | ||||
-rw-r--r-- | verif/generator/tosa_utils.py | 1 | ||||
-rw-r--r-- | verif/tests/test_schemavalidation.py | 6 | ||||
-rw-r--r-- | verif/tests/test_tosa_verifier.py | 3 |
5 files changed, 15 insertions, 11 deletions
diff --git a/verif/checker/verifier.py b/verif/checker/verifier.py index 06ffcfb..684bea3 100644 --- a/verif/checker/verifier.py +++ b/verif/checker/verifier.py @@ -72,7 +72,7 @@ class VerifierLibrary: ct.cast(shape, ct.POINTER(ct.c_int32)), ct.c_int32(len(array.shape)), ct.c_int(NUMPY_DATATYPE_TO_CLIENTTYPE[array.dtype]["type"]), - ct.cast(np.ctypeslib.as_ctypes(array), ct.POINTER(ct.c_uint8)), + array.ctypes.data_as(ct.POINTER(ct.c_uint8)), ct.c_size_t(size_in_bytes), ) return tensor diff --git a/verif/generator/tosa_test_gen.py b/verif/generator/tosa_test_gen.py index d15f785..8beb2ae 100644 --- a/verif/generator/tosa_test_gen.py +++ b/verif/generator/tosa_test_gen.py @@ -282,17 +282,21 @@ class TosaTestGen: ) def tensorComplianceMetaData(self, op, argsDict, outputTensor, errorName): - if errorName: - # No compliance for error tests + if errorName or not gtu.dtypeIsFloat(outputTensor.dtype): + # No compliance for error tests or integer tests currently return None + # Create compliance meta data for expected output tensor - compliance_tens = {"mode": None} + compliance_tens = { + "mode": None, + # Data type is needed for all FP runs, as refmodel precise mode produces FP64 + "data_type": gtu.DTYPE_ATTRIBUTES[outputTensor.dtype]["json"], + } if argsDict["dg_type"] == gtu.DataGenType.DOT_PRODUCT: mode = gtu.ComplianceMode.DOT_PRODUCT compliance_tens["dot_product_info"] = { "s": argsDict["s"], "ks": argsDict["ks"], - "data_type": gtu.DTYPE_ATTRIBUTES[outputTensor.dtype]["json"], } elif argsDict["dg_type"] == gtu.DataGenType.OP_SPECIAL: mode = gtu.ComplianceMode.FP_SPECIAL @@ -301,6 +305,8 @@ class TosaTestGen: compliance_tens["ulp_info"] = {"ulp": op["compliance"]["ulp"]} elif op["op"] == Op.REDUCE_PRODUCT: mode = gtu.ComplianceMode.REDUCE_PRODUCT + elif op["op"] in (Op.ADD, Op.MUL, Op.SUB, Op.CEIL, Op.FLOOR, Op.CAST): + mode = gtu.ComplianceMode.ROUND else: mode = gtu.ComplianceMode.EXACT compliance_tens["mode"] = gtu.ComplianceMode(mode).name diff --git a/verif/generator/tosa_utils.py b/verif/generator/tosa_utils.py index 75a0df5..dddc320 100644 --- a/verif/generator/tosa_utils.py +++ b/verif/generator/tosa_utils.py @@ -38,6 +38,7 @@ class ComplianceMode(IntEnum): ULP = 2 FP_SPECIAL = 3 REDUCE_PRODUCT = 4 + ROUND = 5 class DataGenType(IntEnum): diff --git a/verif/tests/test_schemavalidation.py b/verif/tests/test_schemavalidation.py index 1ecd3ee..664e3a4 100644 --- a/verif/tests/test_schemavalidation.py +++ b/verif/tests/test_schemavalidation.py @@ -72,11 +72,7 @@ def test_schemavalidation_full_unexpected(): def test_schemavalidation_compliance_minimal(): json = { "version": "v", - "tensors": { - "output": { - "mode": "mode", - } - }, + "tensors": {"output": {"mode": "mode", "data_type": "type"}}, } sv = sch.TestDescSchemaValidator() diff --git a/verif/tests/test_tosa_verifier.py b/verif/tests/test_tosa_verifier.py index 996939c..864fa9c 100644 --- a/verif/tests/test_tosa_verifier.py +++ b/verif/tests/test_tosa_verifier.py @@ -40,7 +40,8 @@ JSON_COMPLIANCE_DOT_PRODUCT = { "tensors": { "output1": { "mode": "DOT_PRODUCT", - "dot_product_info": {"ks": 1000, "s": 0, "data_type": "FP32"}, + "data_type": "FP32", + "dot_product_info": {"ks": 1000, "s": 0}, } }, } |