aboutsummaryrefslogtreecommitdiff
path: root/verif
diff options
context:
space:
mode:
authorJeremy Johnson <jeremy.johnson@arm.com>2023-11-07 16:27:35 +0000
committerEric Kunze <eric.kunze@arm.com>2023-11-16 21:24:23 +0000
commit9a758384d1066ade713311940f3d15c860f90866 (patch)
treec25c9624b7c1d589d0648d6b3b4e6333f87a7712 /verif
parent2d70ac4c02808609feb357488dcd080bd6fc5ba5 (diff)
downloadreference_model-9a758384d1066ade713311940f3d15c860f90866.tar.gz
Main Compliance testing support for EXP & POW
Added new ABS_ERROR mode to verify lib and ref model. Signed-off-by: Jeremy Johnson <jeremy.johnson@arm.com> Change-Id: Ifb78290675833d3df7df91a4d6cef336b02b64a4
Diffstat (limited to 'verif')
-rw-r--r--verif/conformance/tosa_main_profile_ops_info.json14
-rw-r--r--verif/generator/tosa_test_gen.py22
-rw-r--r--verif/generator/tosa_utils.py1
-rw-r--r--verif/runner/tosa_test_runner.py10
4 files changed, 27 insertions, 20 deletions
diff --git a/verif/conformance/tosa_main_profile_ops_info.json b/verif/conformance/tosa_main_profile_ops_info.json
index 62505fd..6538c81 100644
--- a/verif/conformance/tosa_main_profile_ops_info.json
+++ b/verif/conformance/tosa_main_profile_ops_info.json
@@ -898,6 +898,7 @@
"profile": [
"tosa-mi"
],
+ "support_for": [ "lazy_data_gen" ],
"generation": {
"standard": {
"generator_args": [
@@ -909,7 +910,7 @@
"--target-dtype",
"bf16",
"--fp-values-range",
- "-2.0,2.0",
+ "-max,max",
"--tensor-dim-range",
"15,64",
"--target-rank",
@@ -923,7 +924,7 @@
"--target-dtype",
"fp16",
"--fp-values-range",
- "-2.0,2.0",
+ "-max,max",
"--tensor-dim-range",
"1,15",
"--target-rank",
@@ -935,7 +936,7 @@
"--target-dtype",
"fp32",
"--fp-values-range",
- "-2.0,2.0",
+ "-max,max",
"--target-shape",
"1,1,65535,4",
"--target-shape",
@@ -1705,6 +1706,7 @@
"profile": [
"tosa-mi"
],
+ "support_for": [ "lazy_data_gen" ],
"generation": {
"standard": {
"generator_args": [
@@ -1716,7 +1718,7 @@
"--target-dtype",
"bf16",
"--fp-values-range",
- "-2.0,2.0",
+ "-max,max",
"--tensor-dim-range",
"16,64",
"--target-rank",
@@ -1730,7 +1732,7 @@
"--target-dtype",
"fp16",
"--fp-values-range",
- "-2.0,2.0",
+ "-max,max",
"--tensor-dim-range",
"1,16",
"--target-rank",
@@ -1742,7 +1744,7 @@
"--target-dtype",
"bf16",
"--fp-values-range",
- "-2.0,2.0",
+ "-max,max",
"--target-shape",
"65534,3,1,1",
"--target-shape",
diff --git a/verif/generator/tosa_test_gen.py b/verif/generator/tosa_test_gen.py
index 35cd78f..3e5aee8 100644
--- a/verif/generator/tosa_test_gen.py
+++ b/verif/generator/tosa_test_gen.py
@@ -333,6 +333,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.EXP, Op.POW):
+ mode = gtu.ComplianceMode.ABS_ERROR
else:
mode = gtu.ComplianceMode.EXACT
compliance_tens["mode"] = gtu.ComplianceMode(mode).name
@@ -400,8 +402,8 @@ class TosaTestGen:
self.ser.addOperator(op["op"], input_list, output_list, attr)
- if op["op"] in (Op.EXP, Op.LOG):
- # TODO - add compliance support LOG and EXP
+ if op["op"] in (Op.LOG,):
+ # TODO - add compliance support LOG
compliance = None
else:
compliance = self.tensorComplianceMetaData(
@@ -445,13 +447,9 @@ class TosaTestGen:
self.ser.addOperator(op["op"], input_list, output_list)
- if op["op"] == Op.POW:
- # TODO - add compliance support
- compliance = None
- else:
- compliance = self.tensorComplianceMetaData(
- op, a.dtype, args_dict, result_tensor, error_name
- )
+ compliance = self.tensorComplianceMetaData(
+ op, a.dtype, args_dict, result_tensor, error_name
+ )
return TosaTestGen.BuildInfo(result_tensor, compliance)
@@ -3576,6 +3574,9 @@ class TosaTestGen:
TosaErrorValidator.evDimensionMismatch,
TosaErrorValidator.evBroadcastShapesMismatch,
),
+ "data_gen": {
+ "fp": (gtu.DataGenType.PSEUDO_RANDOM,),
+ },
},
"sub": {
"op": Op.SUB,
@@ -3713,6 +3714,9 @@ class TosaTestGen:
TosaErrorValidator.evWrongInputList,
TosaErrorValidator.evWrongOutputList,
),
+ "data_gen": {
+ "fp": (gtu.DataGenType.PSEUDO_RANDOM,),
+ },
},
"floor": {
"op": Op.FLOOR,
diff --git a/verif/generator/tosa_utils.py b/verif/generator/tosa_utils.py
index 3b487de..318f296 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
+ ABS_ERROR = 5
class DataGenType(IntEnum):
diff --git a/verif/runner/tosa_test_runner.py b/verif/runner/tosa_test_runner.py
index 984b2d9..876fbdd 100644
--- a/verif/runner/tosa_test_runner.py
+++ b/verif/runner/tosa_test_runner.py
@@ -16,15 +16,15 @@ from json2numpy import json2numpy
from runner.tosa_test_presets import TOSA_REFCOMPLIANCE_RUNNER
-def isComplianceModeDotProduct(testDesc):
- """Checks the test descriptor for DOT_PRODUCT compliance mode."""
+def isComplianceAbsModeNeeded(testDesc):
+ """Checks the test descriptor for DOT_PRODUCT/ABS_ERROR compliance mode."""
if (
"meta" in testDesc
and "compliance" in testDesc["meta"]
and "tensors" in testDesc["meta"]["compliance"]
):
for _, t in testDesc["meta"]["compliance"]["tensors"].items():
- if "mode" in t and t["mode"] == "DOT_PRODUCT":
+ if "mode" in t and t["mode"] in ("DOT_PRODUCT", "ABS_ERROR"):
return True
return False
@@ -195,7 +195,7 @@ class TosaTestRunner:
conformanceFilePath = getRunnerResultFilePath(
resultFilePath, TOSA_REFCOMPLIANCE_RUNNER
)
- if isComplianceModeDotProduct(self.testDesc):
+ if isComplianceAbsModeNeeded(self.testDesc):
conformanceBoundsPath = getBoundsResultFilePath(
resultFilePath, TOSA_REFCOMPLIANCE_RUNNER
)
@@ -255,7 +255,7 @@ class TosaTestRunner:
getRunnerResultFilePath(resultFilePath, sutModule)
)
if (
- isComplianceModeDotProduct(self.testDesc)
+ isComplianceAbsModeNeeded(self.testDesc)
and sutModule == TOSA_REFCOMPLIANCE_RUNNER
):
boundsFilePath = getBoundsResultFilePath(resultFilePath)