aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Johnson <jeremy.johnson@arm.com>2024-03-27 15:04:07 +0000
committerEric Kunze <eric.kunze@arm.com>2024-03-28 16:07:17 +0000
commit30a36844b3fc2e01d786ad72c96ff5577782c2de (patch)
treebe4295f982d83c060c5290aa4d07af5b898cea6a
parent5e36bde3bcfb0c55e61a80cde460ae3955968af3 (diff)
downloadreference_model-30a36844b3fc2e01d786ad72c96ff5577782c2de.tar.gz
Improve PAD coverage for main conformance
Signed-off-by: Jeremy Johnson <jeremy.johnson@arm.com> Change-Id: Ia3e0d871525840f26948b45658bba71e75d767ea
-rw-r--r--verif/conformance/tosa_main_profile_ops_info.json26
-rw-r--r--verif/generator/tosa_arg_gen.py36
-rw-r--r--verif/generator/tosa_verif_build_tests.py1
3 files changed, 48 insertions, 15 deletions
diff --git a/verif/conformance/tosa_main_profile_ops_info.json b/verif/conformance/tosa_main_profile_ops_info.json
index d5d08ba..83c1573 100644
--- a/verif/conformance/tosa_main_profile_ops_info.json
+++ b/verif/conformance/tosa_main_profile_ops_info.json
@@ -1942,14 +1942,35 @@
"5",
"--target-rank",
"6"
- ],
+ ]
+ ]
+ },
+ "extra": {
+ "selector": "minimal",
+ "no_negative_tests": "true",
+ "generator_args": [
[
"--target-dtype",
"fp32",
+ "--target-dtype",
+ "fp16",
+ "--target-dtype",
+ "bf16",
"--fp-values-range",
"-max,max",
"--target-shape",
"1,1,65539,1"
+ ],
+ [
+ "--target-dtype",
+ "fp32",
+ "--target-dtype",
+ "fp16",
+ "--target-dtype",
+ "bf16",
+ "--fp-values-range",
+ "-max,max",
+ "--oversize"
]
]
},
@@ -1991,6 +2012,9 @@
"[[0 0], [0 0], [0 0], [0 0], [0 0], [0 0]]"
]
}
+ },
+ "minimal": {
+ "maximum": 2
}
}
},
diff --git a/verif/generator/tosa_arg_gen.py b/verif/generator/tosa_arg_gen.py
index 3a85961..79d4e78 100644
--- a/verif/generator/tosa_arg_gen.py
+++ b/verif/generator/tosa_arg_gen.py
@@ -2545,13 +2545,17 @@ class TosaArgGen:
def agPad(testGen, rng, opName, shapeList, dtype, error_name=None):
rank = len(shapeList[0])
- # Exhaustively test combinations of padding on each side of each dimension
- # - the range of padding values is defined by pad_min and pad_max
- # - for padding >9, the name format needs to be more distinctive
- pad_min, pad_max = 0, 1
- pad_values = [x for x in range(pad_min, pad_max + 1)]
- if error_name == ErrorIf.PadSmallerZero:
+ if error_name is None and testGen.args.oversize:
+ pad_values = [6, 7, 10, 13]
+ elif error_name == ErrorIf.PadSmallerZero:
pad_values = [x for x in range(-2, 0)]
+ else:
+ # Exhaustively test combinations of padding on each side of each dimension
+ # - the range of padding values is defined by pad_min and pad_max
+ pad_min, pad_max = 0, 1
+ pad_values = [x for x in range(pad_min, pad_max + 1)]
+
+ # Calculate pad combinations
axis_pad_values = [x for x in itertools.product(pad_values, pad_values)]
shape_pad_values = itertools.product(*([axis_pad_values] * rank))
@@ -2593,15 +2597,19 @@ class TosaArgGen:
if all([p > -1 for p in paddings[i]]):
args_valid = False
if args_valid and n % sparsity == 0:
- name = "pad"
+ # Work out name
+ pad_list = []
for r in range(rank):
- before, after = paddings[r]
- name = f"{name}{before}{after}"
- args_dict = {
- "pad": np.array(paddings),
- "pad_const_int": pad_const_int,
- "pad_const_fp": pad_const_fp,
- }
+ pad_list.extend(paddings[r])
+
+ delim = "" if max(pad_list) <= 9 else "x"
+ name = "pad{}".format(delim.join([str(x) for x in pad_list]))
+
+ args_dict = {
+ "pad": np.array(paddings),
+ "pad_const_int": pad_const_int,
+ "pad_const_fp": pad_const_fp,
+ }
arg_list.append((name, args_dict))
if error_name == ErrorIf.PadSmallerZero and len(arg_list) == 0:
diff --git a/verif/generator/tosa_verif_build_tests.py b/verif/generator/tosa_verif_build_tests.py
index f746009..4a15834 100644
--- a/verif/generator/tosa_verif_build_tests.py
+++ b/verif/generator/tosa_verif_build_tests.py
@@ -284,6 +284,7 @@ def parseArgs(argv):
)
ops_group.add_argument(
+ "--oversize",
"--allow-pooling-and-conv-oversizes",
dest="oversize",
action="store_true",