Allow selection of higher rank tests using --target-rank

 * The default rank range has been increased from 1-4 to 1-6.
 * Higher ranks often make tests too large so a default_test_rank_range
has been included which makes the test generator produce only tests with
ranks 1-4.
 * The user can now specify target-rank up to rank 6 which is allowed
for all operators with the default rank range.
 * The maximum rank allowed (6) stored in TOSA_TENSOR_MAX_RANK variable.
 * User specified target shapes up to maximum rank are accepted without
need for setting target-rank filter.

Signed-off-by: Jeremy Johnson <jeremy.johnson@arm.com>
Change-Id: Ie4ca408d329cb1000ce9d3592b2c7d62bf311b3b
diff --git a/verif/tosa_test_gen.py b/verif/tosa_test_gen.py
index df9a649..b3731ce 100644
--- a/verif/tosa_test_gen.py
+++ b/verif/tosa_test_gen.py
@@ -872,6 +872,9 @@
 
 
 class TosaTestGen:
+    # Maximum rank of tensor supported by test generator.
+    TOSA_TENSOR_MAX_RANK = 6
+
     def __init__(self, args):
         self.args = args
         self.basePath = args.output_dir
@@ -1617,6 +1620,9 @@
         # Generate the lists of arguments
         rmin, rmax = op["rank"]
 
+        # Create a default testing rank range, 1-4 inclusive to keep test sizes reasonably small.
+        default_test_rank_range = range(1, 5)
+
         # Test list consists of a tuple of:
         # (opName, testNameStr, dtype, shapeList, argumentsList)
         testList = []
@@ -1629,6 +1635,8 @@
             # Filter out the rank?
             if rankFilter is not None and r not in rankFilter:
                 continue
+            if rankFilter is None and shapeFilter[0] is None and r not in default_test_rank_range:
+                continue
 
             for t in op["types"]:
 
@@ -1954,7 +1962,7 @@
         DType.FLOAT,
     ]
 
-    DEFAULT_RANK_RANGE = (1, 4)
+    DEFAULT_RANK_RANGE = (1, TOSA_TENSOR_MAX_RANK)
 
     TOSA_OP_LIST = {
         # Tensor operators