From 0fc278bbd87827875ef4add9cfd46aea0d787b31 Mon Sep 17 00:00:00 2001 From: Jerry Ge Date: Fri, 11 Aug 2023 16:43:30 +0000 Subject: Add StatefulOps to TOSA specification Signed-off-by: Jerry Ge Change-Id: I63a4c1202a1eddcdedb222e64cac34557647ff21 --- tools/dictionary.dic | 1 + tools/tosa.py | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/dictionary.dic b/tools/dictionary.dic index 70e556a..e2e1a58 100644 --- a/tools/dictionary.dic +++ b/tools/dictionary.dic @@ -82,3 +82,4 @@ TPUs ulp unary Unary +uid diff --git a/tools/tosa.py b/tools/tosa.py index 26e501f..803e478 100644 --- a/tools/tosa.py +++ b/tools/tosa.py @@ -4,6 +4,7 @@ import re import xml.etree.ElementTree as ET + # possible shapes: shape1, [2], [N,H,W,C] # returns (checkable, rank) # checkable is false if shape doesn't contain [] @@ -46,8 +47,18 @@ class TOSALevel: class TOSAOperatorArgument: def __init__( - self, name, description, categories, ty, elty, shape, levellimits, rank + self, + name, + description, + categories, + ty, + elty, + shape, + levellimits, + rank, + optional=False, ): + assert isinstance(optional, bool) self.name = name self.description = description self.categories = categories @@ -56,6 +67,7 @@ class TOSAOperatorArgument: self.shape = shape self.levellimits = levellimits self.rank = rank + self.optional = optional class TOSAOperatorDataTypeSupport: @@ -161,6 +173,7 @@ class TOSASpec: shape = arg.get("shape") levellimits = [] rank = [] + optional = arg.get("optional", "false") == "true" r = arg.find("rank") if r is not None: rank = [r.get("min"), r.get("max")] @@ -194,7 +207,7 @@ class TOSASpec: argcats.append(TOSAOperatorArgumentCategory(cat[0], cat[1].split(","))) return TOSAOperatorArgument( - name, desc, argcats, argtype, argtelty, shape, levellimits, rank + name, desc, argcats, argtype, argtelty, shape, levellimits, rank, optional ) def __load_enum(self, arg): -- cgit v1.2.1