From d44dd79b926470b2588f56f514527d7ad45f4632 Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Tue, 16 Apr 2024 17:07:43 -0700 Subject: 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 Change-Id: I66ba807361948f0b679d0865f967fa2684f8b279 --- chapters/introduction.adoc | 2 +- chapters/operators.adoc | 7 ++++--- tools/tosa.py | 1 + tosa.xml | 11 +++++++++-- tosa.xsd | 2 ++ 5 files changed, 17 insertions(+), 6 deletions(-) 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 @@ In terms of psuedo-code, if *graph* is a TOSA graph consisting of Baseline Infer [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 @@ Their behavior can be configured using attribute arguments. Arguments may have one of the following types: * `tensor_t`, abbreviated `T`, 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>`. +* `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>`. + +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 <>). 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 @@ shape_list_t tosa_output_shape(tosa_graph_t graph); 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 @@ implementation-defined order that must be a topological ordering of the TOSA gra [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 @@ class TOSASpec: "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 @@ - No level - Level 8K + No level + Level 8K @@ -2118,6 +2118,7 @@ List of input tensors. All inputs must have the same rank and data type + @@ -2974,6 +2975,7 @@ used. List of input tensors + String which tells the backend which custom operator is being called @@ -2988,6 +2990,7 @@ used. List of output tensors + @@ -3009,6 +3012,7 @@ used. List of input tensors + TOSA graph to execute if condition is true @@ -3018,6 +3022,7 @@ used. List of output tensors + @@ -3033,6 +3038,7 @@ used. List of input tensors + TOSA graph to evaluate the condition @@ -3042,6 +3048,7 @@ used. List of output tensors + diff --git a/tosa.xsd b/tosa.xsd index e8ce657..12b92a4 100644 --- a/tosa.xsd +++ b/tosa.xsd @@ -32,6 +32,7 @@ + @@ -124,6 +125,7 @@ + -- cgit v1.2.1