Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d8af167

Browse files
committedMar 28, 2025
Arm backend: Install TOSA reference model with local patches
In preparation to move to TOSA 1.0 release the 0.80 package is moved to it's own namespace to be able to handle both versions during the transition period. Signed-off-by: Per Åstrand <[email protected]> Change-Id: Ib653ae81125052f5105ff124b59155018c98aef5
1 parent d72ef5b commit d8af167

File tree

5 files changed

+491
-14
lines changed

5 files changed

+491
-14
lines changed
 
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2025 Arm Limited and/or its affiliates.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
set -euo pipefail
8+
9+
# Installation script to manage transition to 1.0
10+
11+
# TOSA reference model
12+
tosa_reference_model_url="https://git.gitlab.arm.com/tosa/tosa-reference-model.git"
13+
tosa_reference_model_0_80_branch="v0.80"
14+
tosa_reference_model_0_80_rev="70ed0b40fa831387e36abdb4f7fb9670a3464f5a"
15+
tosa_serialization_lib_0_80_rev="v0.80.1"
16+
tosa_reference_model_1_0_rev="v1.0"
17+
18+
script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
19+
20+
source ${script_dir}/utils.sh
21+
22+
23+
function setup_tosa_reference_model() {
24+
local work_dir="$1"
25+
26+
if [[ -z "$work_dir" ]]; then
27+
echo "Error: work_dir parameter is required."
28+
return 1
29+
fi
30+
31+
mkdir -p "$work_dir"
32+
pushd "$work_dir" || exit 1
33+
34+
# Install a patched version of TOSA reference model v0.80.1 to make it co-exist with 1.0 during the transition period
35+
if [[ ! -d "reference_model" ]]; then
36+
git clone --recurse-submodules --branch ${tosa_reference_model_0_80_branch} --depth 1 "$tosa_reference_model_url" reference_model
37+
fi
38+
39+
patches_dir=${script_dir}/../third-party/reference_model/patches/v0.80
40+
patch_repo reference_model ${tosa_reference_model_0_80_rev} ${patches_dir}
41+
patch_repo reference_model/thirdparty/serialization_lib ${tosa_serialization_lib_0_80_rev} ${patches_dir}
42+
43+
pushd reference_model
44+
# reference_model flatbuffers version clashes with Vela.
45+
# go with Vela's since it newer.
46+
# Vela's flatbuffer requirement is expected to loosen, then remove this. MLETORCH-565
47+
CMAKE_POLICY_VERSION_MINIMUM=3.5 pip install . --no-dependencies flatbuffers
48+
popd
49+
}
50+
51+
setup_tosa_reference_model $1

‎backends/arm/scripts/utils.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,13 @@ function patch_repo() {
4646
local patch_dir="${3}/$name"
4747

4848
echo -e "[${FUNCNAME[0]}] Patching ${name} repo_dir:${repo_dir} base_rev:${base_rev} patch_dir:${patch_dir}"
49-
cd $repo_dir
49+
pushd $repo_dir
5050
git fetch
5151
git reset --hard ${base_rev}
5252

5353
[[ -e ${patch_dir} && $(ls -A ${patch_dir}) ]] && \
5454
git am -3 ${patch_dir}/*.patch
5555

5656
echo -e "[${FUNCNAME[0]}] Patched ${name} @ $(git describe --all --long 2> /dev/null) in ${repo_dir} dir.\n"
57+
popd
5758
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
From 20c2059723d5c6952cecfb7fcde92601639ef825 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Per=20=C3=85strand?= <per.astrand@arm.com>
3+
Date: Wed, 5 Feb 2025 12:31:47 +0100
4+
Subject: [PATCH 1/2] Move tosa-tools to be namespaced into tosa-tools.v0_80
5+
6+
---
7+
CMakeLists.txt | 4 ++-
8+
pyproject.toml | 3 ++-
9+
setup.cfg | 70 +++++++++++++++++++++++++-------------------------
10+
setup.py | 3 ++-
11+
4 files changed, 42 insertions(+), 38 deletions(-)
12+
13+
diff --git a/CMakeLists.txt b/CMakeLists.txt
14+
index 68e8d8a..34becd0 100644
15+
--- a/CMakeLists.txt
16+
+++ b/CMakeLists.txt
17+
@@ -1,4 +1,6 @@
18+
-cmake_minimum_required (VERSION 3.4)
19+
+cmake_minimum_required (VERSION 3.19)
20+
+
21+
+cmake_policy(SET CMP0077 NEW)
22+
23+
set(CMAKE_INSTALL_PREFIX ".")
24+
project(tosa_tools LANGUAGES CXX)
25+
diff --git a/pyproject.toml b/pyproject.toml
26+
index 7565f93..60448e7 100644
27+
--- a/pyproject.toml
28+
+++ b/pyproject.toml
29+
@@ -6,7 +6,8 @@ requires = [
30+
"setuptools>=42",
31+
"wheel",
32+
"setuptools_scm[toml]>=6.0",
33+
- "cmake"
34+
+ "cmake",
35+
+ "ninja",
36+
]
37+
build-backend = "setuptools.build_meta"
38+
39+
diff --git a/setup.cfg b/setup.cfg
40+
index 82ec9b8..c1bd1a8 100644
41+
--- a/setup.cfg
42+
+++ b/setup.cfg
43+
@@ -2,7 +2,7 @@
44+
# SPDX-License-Identifier: Apache-2.0
45+
46+
[metadata]
47+
-name = tosa-tools
48+
+name = tosa-tools-v0.80
49+
# version = done by setuptools_scm in pyproject.toml
50+
author = Arm Limited
51+
#author_email =
52+
@@ -25,44 +25,44 @@ install_requires =
53+
python_requires = >=3.6
54+
include_package_data = True
55+
packages =
56+
- runner
57+
- generator
58+
- checker
59+
- frameworks
60+
- tests
61+
- conformance
62+
- xunit
63+
- json2fbbin
64+
- json2numpy
65+
- schemavalidation
66+
- convert2conformance
67+
- tosa
68+
- serializer
69+
- tosa_reference_model
70+
+ tosa_tools.v0_80.verif.runner
71+
+ tosa_tools.v0_80.verif.generator
72+
+ tosa_tools.v0_80.verif.checker
73+
+ tosa_tools.v0_80.verif.frameworks
74+
+ tosa_tools.v0_80.verif.tests
75+
+ tosa_tools.v0_80.verif.conformance
76+
+ tosa_tools.v0_80.xunit
77+
+ tosa_tools.v0_80.json2fbbin
78+
+ tosa_tools.v0_80.json2numpy
79+
+ tosa_tools.v0_80.schemavalidation
80+
+ tosa_tools.v0_80.convert2conformance
81+
+ tosa_tools.v0_80.tosa
82+
+ tosa_tools.v0_80.serializer
83+
+ tosa_tools.v0_80.tosa_reference_model
84+
package_dir =
85+
- = verif
86+
- xunit = scripts/xunit
87+
- json2fbbin = scripts/json2fbbin
88+
- json2numpy = scripts/json2numpy
89+
- convert2conformance = scripts/convert2conformance
90+
- tosa = thirdparty/serialization_lib/python/tosa
91+
- serializer = thirdparty/serialization_lib/python/serializer
92+
- tosa_reference_model = py_package
93+
- schemavalidation = scripts/schemavalidation
94+
+ tosa_tools.v0_80.verif = verif
95+
+ tosa_tools.v0_80.xunit = scripts/xunit
96+
+ tosa_tools.v0_80.json2fbbin = scripts/json2fbbin
97+
+ tosa_tools.v0_80.json2numpy = scripts/json2numpy
98+
+ tosa_tools.v0_80.convert2conformance = scripts/convert2conformance
99+
+ tosa_tools.v0_80.tosa = thirdparty/serialization_lib/python/tosa
100+
+ tosa_tools.v0_80.serializer = thirdparty/serialization_lib/python/serializer
101+
+ tosa_tools.v0_80.tosa_reference_model = py_package
102+
+ tosa_tools.v0_80.schemavalidation = scripts/schemavalidation
103+
104+
[options.entry_points]
105+
console_scripts =
106+
- tosa_verif_run_ref = runner.tosa_verif_run_tests:main
107+
- tosa_verif_run_tests = runner.tosa_verif_run_tests:main
108+
- tosa_verif_build_tests = generator.tosa_verif_build_tests:main
109+
- tosa_json2numpy = json2numpy.json2numpy:main
110+
- tosa_json2fbbin = json2fbbin.json2fbbin:main
111+
- tosa_verif_result_check = checker.tosa_result_checker:main
112+
- tosa_convert2conformance = convert2conformance.convert2conformance:main
113+
- tosa_verif_framework_generator = frameworks.tosa_verif_framework_generator:main
114+
- tosa_verif_framework_compiler_runner = frameworks.tosa_verif_framework_compiler_runner:main
115+
- tosa_verif_conformance_generator = conformance.tosa_verif_conformance_generator:main
116+
- tosa_schemavalidation = schemavalidation.schemavalidation:main
117+
+ tosa_verif_run_ref = tosa_tools.v0_80.verif.runner.tosa_verif_run_tests:main
118+
+ tosa_verif_run_tests = tosa_tools.v0_80.verif.runner.tosa_verif_run_tests:main
119+
+ tosa_verif_build_tests = tosa_tools.v0_80.verif.generator.tosa_verif_build_tests:main
120+
+ tosa_json2numpy = tosa_tools.v0_80.verif.json2numpy.json2numpy:main
121+
+ tosa_json2fbbin = tosa_tools.v0_80.verif.json2fbbin.json2fbbin:main
122+
+ tosa_verif_result_check = tosa_tools.v0_80.verif.checker.tosa_result_checker:main
123+
+ tosa_convert2conformance = tosa_tools.v0_80.verif.convert2conformance.convert2conformance:main
124+
+ tosa_verif_framework_generator = tosa_tools.v0_80.verif.frameworks.tosa_verif_framework_generator:main
125+
+ tosa_verif_framework_compiler_runner = tosa_tools.v0_80.verif.frameworks.tosa_verif_framework_compiler_runner:main
126+
+ tosa_verif_conformance_generator = tosa_tools.v0_80.verif.conformance.tosa_verif_conformance_generator:main
127+
+ tosa_schemavalidation = tosa_tools.v0_80.verif.schemavalidation.schemavalidation:main
128+
129+
[options.package_data]
130+
schemavalidation=
131+
diff --git a/setup.py b/setup.py
132+
index 8c6b4cd..95896ad 100644
133+
--- a/setup.py
134+
+++ b/setup.py
135+
@@ -20,7 +20,7 @@ class CMakeBuild(build_py):
136+
root_dir = Path(__file__).parent
137+
build_dir = root_dir / "build"
138+
build_dir.mkdir(exist_ok=True)
139+
- package_dir = root_dir / "py_package"
140+
+ package_dir = root_dir / "build/lib/tosa_tools/v0_80/tosa_reference_model/"
141+
142+
cmake_cmd = [
143+
"cmake",
144+
@@ -90,6 +90,7 @@ class CMakeBuild(build_py):
145+
# Python will know which one to import
146+
copied_so = False
147+
so_dir = build_dir / "reference_model"
148+
+ package_dir.mkdir(parents=True, exist_ok=True)
149+
print(f"copying .so files from '{so_dir}' to '{package_dir}'")
150+
for so_file in so_dir.glob("tosa_reference_model.*.so"):
151+
shutil.copy(so_file, package_dir)
152+
--
153+
2.39.5 (Apple Git-154)
154+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
From b3c8c3f779a7e051826f317598fb831fa9cfe923 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Per=20=C3=85strand?= <per.astrand@arm.com>
3+
Date: Wed, 5 Feb 2025 12:30:09 +0100
4+
Subject: [PATCH] Make TOSA serializer lib to be self contained
5+
6+
---
7+
CMakeLists.txt | 4 ++
8+
python/serializer/tosa_serializer.py | 57 ++++++++++++++--------------
9+
2 files changed, 32 insertions(+), 29 deletions(-)
10+
11+
diff --git a/CMakeLists.txt b/CMakeLists.txt
12+
index ac34b75..5e191aa 100644
13+
--- a/CMakeLists.txt
14+
+++ b/CMakeLists.txt
15+
@@ -19,6 +19,8 @@
16+
cmake_minimum_required(VERSION 3.13.4)
17+
project(TosaSerialization)
18+
19+
+cmake_policy(SET CMP0077 NEW)
20+
+
21+
set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
22+
set(CMAKE_CXX_STANDARD_REQUIRED YES)
23+
24+
@@ -27,6 +29,8 @@ set(CMAKE_VERBOSE_MAKEFILE ON)
25+
option(BUILD_TESTS "Build test applications" ON)
26+
option(FLATBUFFERS_ROOT "Location where the flatbuffers 'include' and 'lib' folders to be found" Off)
27+
28+
+message(STATUS "FLATBUFFERS_ROOT set to: ${FLATBUFFERS_ROOT}")
29+
+
30+
include_directories(${PROJECT_SOURCE_DIR}/third_party/half/include)
31+
32+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
33+
diff --git a/python/serializer/tosa_serializer.py b/python/serializer/tosa_serializer.py
34+
index 7bc75f0..d191997 100644
35+
--- a/python/serializer/tosa_serializer.py
36+
+++ b/python/serializer/tosa_serializer.py
37+
@@ -14,12 +14,11 @@
38+
39+
import os
40+
import struct
41+
-import serializer.tosa_serializer as ts
42+
import json
43+
import flatbuffers
44+
import numpy as np
45+
from enum import IntEnum, unique
46+
-from tosa import (
47+
+from ..tosa import (
48+
TosaGraph,
49+
TosaRegion,
50+
TosaBasicBlock,
51+
@@ -27,8 +26,8 @@ from tosa import (
52+
TosaOperator,
53+
Version,
54+
)
55+
-import tosa.DType as TosaDType
56+
-import tosa.Op as TosaOp
57+
+from ..tosa import DType as TosaDType
58+
+from ..tosa import Op as TosaOp
59+
60+
# Keep version number in sync with the version default value with schema/tosa.fbs
61+
TOSA_VERSION_MAJOR = 0
62+
@@ -159,7 +158,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
63+
output_zp,
64+
accum_dtype,
65+
):
66+
- from tosa import PoolAttribute as a, Attribute
67+
+ from ..tosa import PoolAttribute as a, Attribute
68+
69+
self.utype = Attribute.Attribute().PoolAttribute
70+
71+
@@ -172,7 +171,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
72+
self.ints.append((a.AddAccumDtype, accum_dtype))
73+
74+
def ConvAttribute(self, pad, stride, dilation, input_zp, weight_zp, local_bound):
75+
- from tosa import ConvAttribute as a, Attribute
76+
+ from ..tosa import ConvAttribute as a, Attribute
77+
78+
self.utype = Attribute.Attribute().ConvAttribute
79+
self.optFcns = (a.Start, a.End)
80+
@@ -187,7 +186,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
81+
def TransposeConvAttribute(
82+
self, outpad, stride, output_shape, input_zp, weight_zp, local_bound
83+
):
84+
- from tosa import TransposeConvAttribute as a, Attribute
85+
+ from ..tosa import TransposeConvAttribute as a, Attribute
86+
87+
self.utype = Attribute.Attribute().TransposeConvAttribute
88+
self.optFcns = (a.Start, a.End)
89+
@@ -200,7 +199,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
90+
self.bools.append((a.AddLocalBound, local_bound))
91+
92+
def PadAttribute(self, serializer_builder, padding, pad_const_int, pad_const_fp):
93+
- from tosa import PadAttribute as a, Attribute
94+
+ from ..tosa import PadAttribute as a, Attribute
95+
96+
self.utype = Attribute.Attribute().PadAttribute
97+
self.optFcns = (a.Start, a.End)
98+
@@ -210,14 +209,14 @@ class TosaSerializerAttribute(TosaSerializerUnion):
99+
100+
# pad_const_fp attribute serialized as uint8 vector
101+
pad_const_float_as_bytes = struct.pack("<f", pad_const_fp)
102+
- serialized_pad_const_fp = ts.TosaSerializer.serializeUint8Vec(
103+
+ serialized_pad_const_fp = TosaSerializer.serializeUint8Vec(
104+
serializer_builder, pad_const_float_as_bytes
105+
)
106+
107+
self.floats.append((a.AddPadConstFp, serialized_pad_const_fp))
108+
109+
def AxisAttribute(self, axis):
110+
- from tosa import AxisAttribute as a, Attribute
111+
+ from ..tosa import AxisAttribute as a, Attribute
112+
113+
self.utype = Attribute.Attribute().AxisAttribute
114+
self.optFcns = (a.Start, a.End)
115+
@@ -225,7 +224,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
116+
self.ints.append((a.AddAxis, axis))
117+
118+
def ReshapeAttribute(self, new_shape):
119+
- from tosa import ReshapeAttribute as a, Attribute
120+
+ from ..tosa import ReshapeAttribute as a, Attribute
121+
122+
self.utype = Attribute.Attribute().ReshapeAttribute
123+
self.optFcns = (a.Start, a.End)
124+
@@ -233,7 +232,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
125+
self.intvecs.append((a.AddNewShape, new_shape))
126+
127+
def SliceAttribute(self, start, size):
128+
- from tosa import SliceAttribute as a, Attribute
129+
+ from ..tosa import SliceAttribute as a, Attribute
130+
131+
self.utype = Attribute.Attribute().SliceAttribute
132+
self.optFcns = (a.Start, a.End)
133+
@@ -242,7 +241,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
134+
self.intvecs.append((a.AddSize, size))
135+
136+
def TileAttribute(self, multiples):
137+
- from tosa import TileAttribute as a, Attribute
138+
+ from ..tosa import TileAttribute as a, Attribute
139+
140+
self.utype = Attribute.Attribute().TileAttribute
141+
self.optFcns = (a.Start, a.End)
142+
@@ -250,7 +249,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
143+
self.intvecs.append((a.AddMultiples, multiples))
144+
145+
def ResizeAttribute(self, scale, offset, border, mode):
146+
- from tosa import ResizeAttribute as a, Attribute
147+
+ from ..tosa import ResizeAttribute as a, Attribute
148+
149+
self.utype = Attribute.Attribute().ResizeAttribute
150+
self.optFcns = (a.Start, a.End)
151+
@@ -261,7 +260,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
152+
self.ints.append((a.AddMode, mode))
153+
154+
def ClampAttribute(self, serializer_builder, minint, maxint, minfp, maxfp):
155+
- from tosa import ClampAttribute as a, Attribute
156+
+ from ..tosa import ClampAttribute as a, Attribute
157+
158+
self.utype = Attribute.Attribute().ClampAttribute
159+
self.optFcns = (a.Start, a.End)
160+
@@ -272,10 +271,10 @@ class TosaSerializerAttribute(TosaSerializerUnion):
161+
# min/max float attributes serialized as uint8 vectors
162+
minfp_bytes = struct.pack("<f", minfp)
163+
maxfp_bytes = struct.pack("<f", maxfp)
164+
- serialized_minfp_bytes = ts.TosaSerializer.serializeUint8Vec(
165+
+ serialized_minfp_bytes = TosaSerializer.serializeUint8Vec(
166+
serializer_builder, minfp_bytes
167+
)
168+
- serialized_maxfp_bytes = ts.TosaSerializer.serializeUint8Vec(
169+
+ serialized_maxfp_bytes = TosaSerializer.serializeUint8Vec(
170+
serializer_builder, maxfp_bytes
171+
)
172+
173+
@@ -294,7 +293,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
174+
input_unsigned,
175+
output_unsigned,
176+
):
177+
- from tosa import RescaleAttribute as a, Attribute
178+
+ from ..tosa import RescaleAttribute as a, Attribute
179+
180+
self.utype = Attribute.Attribute().RescaleAttribute
181+
self.optFcns = (a.Start, a.End)
182+
@@ -310,7 +309,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
183+
self.bools.append((a.AddOutputUnsigned, output_unsigned))
184+
185+
def MulAttribute(self, shift):
186+
- from tosa import MulAttribute as a, Attribute
187+
+ from ..tosa import MulAttribute as a, Attribute
188+
189+
self.utype = Attribute.Attribute().MulAttribute
190+
self.optFcns = (a.Start, a.End)
191+
@@ -318,7 +317,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
192+
self.ints.append((a.AddShift, shift))
193+
194+
def ArithmeticRightShiftAttribute(self, round):
195+
- from tosa import ArithmeticRightShiftAttribute as a, Attribute
196+
+ from ..tosa import ArithmeticRightShiftAttribute as a, Attribute
197+
198+
self.utype = Attribute.Attribute().ArithmeticRightShiftAttribute
199+
self.optFcns = (
200+
@@ -329,7 +328,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
201+
self.bools.append((a.AddRound, round))
202+
203+
def CondIfAttribute(self, then_branch, else_branch):
204+
- from tosa import CondIfAttribute as a, Attribute
205+
+ from ..tosa import CondIfAttribute as a, Attribute
206+
207+
self.utype = Attribute.Attribute().CondIfAttribute
208+
self.optFcns = (a.Start, a.End)
209+
@@ -338,7 +337,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
210+
self.strings.append((a.AddElseBranch, else_branch))
211+
212+
def WhileLoopAttribute(self, cond_branch, body_branch):
213+
- from tosa import WhileLoopAttribute as a, Attribute
214+
+ from ..tosa import WhileLoopAttribute as a, Attribute
215+
216+
self.utype = Attribute.Attribute().WhileLoopAttribute
217+
self.optFcns = (a.Start, a.End)
218+
@@ -347,7 +346,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
219+
self.strings.append((a.AddBodyBranch, body_branch))
220+
221+
def TransposeAttribute(self, perms):
222+
- from tosa import TransposeAttribute as a, Attribute
223+
+ from ..tosa import TransposeAttribute as a, Attribute
224+
225+
self.utype = Attribute.Attribute().TransposeAttribute
226+
self.optFcns = (a.Start, a.End)
227+
@@ -355,7 +354,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
228+
self.intvecs.append((a.AddPerms, perms))
229+
230+
def TableAttribute(self, table):
231+
- from tosa import TableAttribute as a, Attribute
232+
+ from ..tosa import TableAttribute as a, Attribute
233+
234+
self.utype = Attribute.Attribute().TableAttribute
235+
self.optFcns = (a.Start, a.End)
236+
@@ -363,7 +362,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
237+
self.int16vecs.append((a.AddTable, table))
238+
239+
def MatMulAttribute(self, A_zp, B_zp):
240+
- from tosa import MatMulAttribute as a, Attribute
241+
+ from ..tosa import MatMulAttribute as a, Attribute
242+
243+
self.utype = Attribute.Attribute().MatMulAttribute
244+
self.optFcns = (a.Start, a.End)
245+
@@ -372,7 +371,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
246+
self.ints.append((a.AddBZp, B_zp))
247+
248+
def FullyConnectedAttribute(self, input_zp, weight_zp):
249+
- from tosa import FullyConnectedAttribute as a, Attribute
250+
+ from ..tosa import FullyConnectedAttribute as a, Attribute
251+
252+
self.utype = Attribute.Attribute().FullyConnectedAttribute
253+
self.optFcns = (a.Start, a.End)
254+
@@ -381,7 +380,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
255+
self.ints.append((a.AddWeightZp, weight_zp))
256+
257+
def NegateAttribute(self, input1_zp, output_zp):
258+
- from tosa import NegateAttribute as a, Attribute
259+
+ from ..tosa import NegateAttribute as a, Attribute
260+
261+
self.utype = Attribute.Attribute().NegateAttribute
262+
self.optFcns = (a.Start, a.End)
263+
@@ -390,7 +389,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
264+
self.ints.append((a.AddOutputZp, output_zp))
265+
266+
def FFTAttribute(self, inverse, local_bound):
267+
- from tosa import FFTAttribute as a, Attribute
268+
+ from ..tosa import FFTAttribute as a, Attribute
269+
270+
self.utype = Attribute.Attribute().FFTAttribute
271+
self.optFcns = (a.Start, a.End)
272+
@@ -399,7 +398,7 @@ class TosaSerializerAttribute(TosaSerializerUnion):
273+
self.bools.append((a.AddLocalBound, local_bound))
274+
275+
def RFFTAttribute(self, local_bound):
276+
- from tosa import RFFTAttribute as a, Attribute
277+
+ from ..tosa import RFFTAttribute as a, Attribute
278+
279+
self.utype = Attribute.Attribute().RFFTAttribute
280+
self.optFcns = (a.Start, a.End)
281+
--
282+
2.39.5 (Apple Git-154)
283+

‎examples/arm/setup.sh

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ else
5555
echo "[main] Error: only x86-64 & aarch64/arm64 architecture is supported for now!"; exit 1;
5656
fi
5757

58-
# tosa reference model
59-
tosa_reference_model_url="https://git.gitlab.arm.com/tosa/tosa-reference-model.git"
60-
tosa_reference_model_rev="70ed0b40fa831387e36abdb4f7fb9670a3464f5a"
61-
6258
# vela
6359
vela_repo_url="https://gitlab.arm.com/artificial-intelligence/ethos-u/ethos-u-vela"
6460
vela_rev="425541302c7e4b6fbeca7c0061286b131ee507c3"
@@ -156,14 +152,6 @@ function setup_toolchain() {
156152
tar xf "${toolchain_dir}.tar.xz"
157153
}
158154

159-
function setup_tosa_reference_model() {
160-
# reference_model flatbuffers version clashes with Vela.
161-
# go with Vela's since it newer.
162-
# Vela's flatbuffer requirement is expected to loosen, then remove this. MLETORCH-565
163-
CMAKE_POLICY_VERSION_MINIMUM=3.5 pip install tosa-tools@git+${tosa_reference_model_url}@${tosa_reference_model_rev} --no-dependencies flatbuffers
164-
165-
}
166-
167155
function setup_vela() {
168156
pip install ethos-u-vela@git+${vela_repo_url}@${vela_rev}
169157
}
@@ -233,7 +221,7 @@ if [[ $is_script_sourced -eq 0 ]]
233221
create_setup_path
234222

235223
# Setup the tosa_reference_model
236-
setup_tosa_reference_model
224+
$et_dir/backends/arm/scripts/install_reference_model.sh ${root_dir}
237225

238226
# Setup vela and patch in codegen fixes
239227
setup_vela

0 commit comments

Comments
 (0)
Please sign in to comment.