aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominic Symes <dominic.symes@arm.com>2023-04-24 17:08:02 +0100
committerDominic Symes <dominic.symes@arm.com>2023-04-27 14:52:30 +0100
commitbc72ba8ec128dc8c851455300085961d6e716959 (patch)
tree1c269fc0ea90243b2028e5ef7da58c417020c429
parent211c5f5294cd08ebbf61278823e5195fef181dd7 (diff)
downloadspecification-bc72ba8ec128dc8c851455300085961d6e716959.tar.gz
Move the tensor size limit into the level range definition
The tensor size in bytes must fit within the level defined size range. Signed-off-by: Dominic Symes <dominic.symes@arm.com> Change-Id: I131e3aa7e8666b4d0093ae8198367f243081da51
-rw-r--r--chapters/introduction.adoc10
-rw-r--r--tools/tosa.py1
-rw-r--r--tosa.xml4
-rw-r--r--tosa.xsd2
4 files changed, 11 insertions, 6 deletions
diff --git a/chapters/introduction.adoc b/chapters/introduction.adoc
index b1d92d9..f3a6454 100644
--- a/chapters/introduction.adoc
+++ b/chapters/introduction.adoc
@@ -331,11 +331,13 @@ Tensor elements are addressed using dim_t values, where each element of the vect
==== Tensor size limit
-The tensor overall size in elements is limited by the data type size_t.
-In this version of the specification, size_t is defined as an unsigned 32-bit integer representing size from 1 to (1<<32) - 1.
+The tensor overall size is limited by the data type size_t.
+This type must be able to hold integers in the range 0 to (1++<<++(MAX_LOG2_SIZE+1)) - 1 where MAX_LOG2_SIZE is defined in <<Levels>>.
+For each tensor, the number of tensor elements multiplied by the element size in bytes (which is taken to be 1 for elements smaller than a 8-bit) must be less than or equal to (1<<(MAX_LOG2_SIZE+1)) - 1.
+
The size of tensors along each of their dimensions is limited by the data type index_t.
-In this version of the specification, index_t is defined as a signed 32-bit integer.
-This means that the maximum size of a tensor along each dimension is (1<<31) - 1 and therefore the maximum coordinate value is (1<<31) - 2.
+This type must be able to hold integers in the range 0 to (1++<<++MAX_LOG2_SIZE) - 1 where MAX_LOG2_SIZE is defined in <<Levels>>.
+This means that the maximum size of a tensor along each dimension is (1<<MAX_LOG2_SIZE) - 1 and therefore the maximum coordinate value is (1<<MAX_LOG2_SIZE) - 2.
Indices used to access tensors must be non-negative.
==== Data Layouts
diff --git a/tools/tosa.py b/tools/tosa.py
index 265d5f6..52fda3e 100644
--- a/tools/tosa.py
+++ b/tools/tosa.py
@@ -86,6 +86,7 @@ class TOSASpec:
'MAX_KERNEL': level.get("max_kernel"),
'MAX_STRIDE': level.get("max_stride"),
'MAX_SCALE': level.get("max_scale"),
+ 'MAX_LOG2_SIZE' : level.get("max_log2_size"),
}
return TOSALevel(name, desc, maximums)
diff --git a/tosa.xml b/tosa.xml
index 7effd1c..fa45c99 100644
--- a/tosa.xml
+++ b/tosa.xml
@@ -8,8 +8,8 @@
<profile name="MT">Main Training</profile>
</profiles>
<levels>
- <level name="none" max_rank="32" max_kernel="2147483647" max_stride="2147483647" max_scale="2048">No level</level>
- <level name="8K" max_rank="6" max_kernel="8192" max_stride="8192" max_scale="64" >Level 8K</level>
+ <level name="none" max_rank="32" max_kernel="2147483647" max_stride="2147483647" max_scale="2048" max_log2_size="63">No level</level>
+ <level name="8K" max_rank="6" max_kernel="8192" max_stride="8192" max_scale="64" max_log2_size="31">Level 8K</level>
</levels>
<operators>
<operatorgroup name="tensor">
diff --git a/tosa.xsd b/tosa.xsd
index 8c1e2b5..ca99a8e 100644
--- a/tosa.xsd
+++ b/tosa.xsd
@@ -24,6 +24,7 @@
<xs:enumeration value="MAX_STRIDE"/>
<xs:enumeration value="MAX_SCALE"/>
<xs:enumeration value="MAX_RANK"/>
+ <xs:enumeration value="MAX_LOG2_SIZE"/>
</xs:restriction>
</xs:simpleType>
@@ -95,6 +96,7 @@
<xs:attribute name="max_kernel" type="xs:int" use="required"/>
<xs:attribute name="max_stride" type="xs:int" use="required"/>
<xs:attribute name="max_scale" type="xs:int" use="required"/>
+ <xs:attribute name="max_log2_size" type="xs:int" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>