Add limit on size of tensor lists

List maximum varies by Level.
Also cleans up some stray references to tosa_list_t.

Signed-off-by: Eric Kunze <eric.kunze@arm.com>
Change-Id: I66ba807361948f0b679d0865f967fa2684f8b279
diff --git a/chapters/introduction.adoc b/chapters/introduction.adoc
index 95e405c..d931967 100644
--- a/chapters/introduction.adoc
+++ b/chapters/introduction.adoc
@@ -208,7 +208,7 @@
 
 [source,c++]
 ----
-bool tosa_test_compliance(tosa_graph_t graph, tosa_list_t input_list, tosa_level_t level) {
+bool tosa_test_compliance(tosa_graph_t graph, tensor_list_t input_list, tosa_level_t level) {
     shape_list_t output_list_spec = tosa_allocate_list(tosa_output_shape(graph));
     shape_list_t output_list_test = tosa_allocate_list(tosa_output_shape(graph));
     tosa_graph_result = tosa_valid;    // result starts as valid
diff --git a/chapters/operators.adoc b/chapters/operators.adoc
index b63ca1e..2f444e0 100644
--- a/chapters/operators.adoc
+++ b/chapters/operators.adoc
@@ -16,7 +16,8 @@
 Arguments may have one of the following types:
 
 * `tensor_t<element_type>`, abbreviated `T<element_type>`, represents a tensor whose elements are of type `element_type` where `element_type` can be any of the data types supported in TOSA.
-* `tensor_list_t` represents a list of tensors. When lists are homogeneous, containing tensors of the same type, their type is further qualified as follows: `tensor_list_t<T<element_type>>`.
+* `tensor_list_t` represents a list of tensors. When lists are homogeneous, containing tensors of the same type, their type is further qualified as follows: `tensor_list_t<T<element_type>>`. +
+The maximum number of elements in a tensor list is set by the MAX_TENSOR_LIST_SIZE level parameter.
 * `tosa_graph_t` represents a TOSA graph (see <<operator-graphs>>).
 
 Arguments belong to one of three categories: Input, Output, or Attribute. The category to which an argument belongs further constrains its type:
@@ -47,7 +48,7 @@
 Similarly the type tensor_list_t will be used for a list of tensors and the following function returns the shape of a tensor list:
 [source,c++]
 ----
-shape_list_t tensor_list_shape(tosa_list_t tensor_list);
+shape_list_t tensor_list_shape(tensor_list_t tensor_list);
 ----
 
 The following function denotes the execution of a TOSA graph within a TOSA context,
@@ -59,7 +60,7 @@
 
 [source,c++]
 ----
-tosa_execute_graph(tosa_context_t context, tosa_graph_t graph, tosa_list_t input_list, tosa_list_t output_list, tosa_level_t level) {
+tosa_execute_graph(tosa_context_t context, tosa_graph_t graph, tensor_list_t input_list, tensor_list_t output_list, tosa_level_t level) {
     ERROR_IF(tensor_list_shape(input_list) != tosa_input_shape(graph));
     ERROR_IF(tensor_list_shape(output_list) != tosa_output_shape(graph));
 
diff --git a/tools/tosa.py b/tools/tosa.py
index a0e4ddb..4b0a2fe 100644
--- a/tools/tosa.py
+++ b/tools/tosa.py
@@ -170,6 +170,7 @@
             "MAX_SCALE": level.get("max_scale"),
             "MAX_LOG2_SIZE": level.get("max_log2_size"),
             "MAX_NESTING": level.get("max_nesting"),
+            "MAX_TENSOR_LIST_SIZE": level.get("max_tensor_list_size"),
         }
         return TOSALevel(name, desc, maximums)
 
diff --git a/tosa.xml b/tosa.xml
index 0cd791e..9a3b2c2 100644
--- a/tosa.xml
+++ b/tosa.xml
@@ -31,8 +31,8 @@
     </profile_extension>
   </profile_extensions>
   <levels>
-    <level name="none" max_rank="32" max_kernel="2147483647" max_stride="2147483647" max_scale="2048" max_log2_size="63" max_nesting="256">No level</level>
-    <level name="8K"   max_rank="6"  max_kernel="8192"       max_stride="8192"       max_scale="256"   max_log2_size="31" max_nesting="6">Level 8K</level>
+    <level name="none" max_rank="32" max_kernel="2147483647" max_stride="2147483647" max_scale="2048" max_log2_size="63" max_nesting="256" max_tensor_list_size="256">No level</level>
+    <level name="8K"   max_rank="6"  max_kernel="8192"       max_stride="8192"       max_scale="256"   max_log2_size="31" max_nesting="6" max_tensor_list_size="64">Level 8K</level>
   </levels>
   <operators>
     <operatorgroup name="tensor">
@@ -2118,6 +2118,7 @@
         <arguments>
           <argument category="input" name="input1" type="tensor_list_t" shape="shapes1" tensor-element-type="in_out_t">
             <description>List of input tensors. All inputs must have the same rank and data type</description>
+            <levellimit value="tensor_list_shape(input1)" limit="MAX_TENSOR_LIST_SIZE"/>
             <rank min="0" max="MAX_RANK"/>
           </argument>
           <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="i32_t">
@@ -2974,6 +2975,7 @@
         <arguments>
           <argument category="input" name="input_list" type="tensor_list_t" shape="-" tensor-element-type="-">
             <description>List of input tensors</description>
+            <levellimit value="tensor_list_shape(input_list)" limit="MAX_TENSOR_LIST_SIZE"/>
           </argument>
           <argument category="attribute" name="operator_name" type="String" shape="-" tensor-element-type="-">
             <description>String which tells the backend which custom operator is being called</description>
@@ -2988,6 +2990,7 @@
           </argument>
           <argument category="output" name="output_list" type="tensor_list_t" shape="-" tensor-element-type="-">
             <description>List of output tensors</description>
+            <levellimit value="tensor_list_shape(output_list)" limit="MAX_TENSOR_LIST_SIZE"/>
           </argument>
         </arguments>
         <types>
@@ -3009,6 +3012,7 @@
           </argument>
           <argument category="input" name="input_list" type="tensor_list_t" shape="-" tensor-element-type="-">
             <description>List of input tensors</description>
+            <levellimit value="tensor_list_shape(input_list)" limit="MAX_TENSOR_LIST_SIZE"/>
           </argument>
           <argument category="attribute" name="then_graph" type="tosa_graph_t" shape="-" tensor-element-type="-">
             <description>TOSA graph to execute if condition is true</description>
@@ -3018,6 +3022,7 @@
           </argument>
           <argument category="output" name="output_list" type="tensor_list_t" shape="-" tensor-element-type="-">
             <description>List of output tensors</description>
+            <levellimit value="tensor_list_shape(output_list)" limit="MAX_TENSOR_LIST_SIZE"/>
           </argument>
         </arguments>
         <types>
@@ -3033,6 +3038,7 @@
         <arguments>
           <argument category="input" name="input_list" type="tensor_list_t" shape="-" tensor-element-type="-">
             <description>List of input tensors</description>
+            <levellimit value="tensor_list_shape(input_list)" limit="MAX_TENSOR_LIST_SIZE"/>
           </argument>
           <argument category="attribute" name="cond_graph" type="tosa_graph_t" shape="-" tensor-element-type="-">
             <description>TOSA graph to evaluate the condition</description>
@@ -3042,6 +3048,7 @@
           </argument>
           <argument category="output" name="output_list" type="tensor_list_t" shape="-" tensor-element-type="-">
             <description>List of output tensors</description>
+            <levellimit value="tensor_list_shape(output_list)" limit="MAX_TENSOR_LIST_SIZE"/>
           </argument>
         </arguments>
         <types>
diff --git a/tosa.xsd b/tosa.xsd
index e8ce657..12b92a4 100644
--- a/tosa.xsd
+++ b/tosa.xsd
@@ -32,6 +32,7 @@
     <xs:enumeration value="MAX_RANK"/>
     <xs:enumeration value="MAX_LOG2_SIZE"/>
     <xs:enumeration value="MAX_NESTING"/>
+    <xs:enumeration value="MAX_TENSOR_LIST_SIZE"/>
   </xs:restriction>
 </xs:simpleType>
 
@@ -124,6 +125,7 @@
         <xs:attribute name="max_scale"  type="xs:int" use="required"/>
         <xs:attribute name="max_log2_size" type="xs:int" use="required"/>
         <xs:attribute name="max_nesting" type="xs:int" use="required"/>
+        <xs:attribute name="max_tensor_list_size" type="xs:int" use="required"/>
       </xs:extension>
     </xs:simpleContent>
   </xs:complexType>