summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2025-09-11 14:13:08 +0000
committerCoprDistGit <infra@openeuler.org>2025-09-11 14:13:08 +0000
commitac9d57aa05e912dd7586ff4c9ee938129fe902a3 (patch)
tree2e57f2efb3443682d5ce4d4286b36019cf91d342
parentb9cfeb86ffcf6e752e75ebf0584a0b69c3c66557 (diff)
automatic import of ANNCopeneuler22.03_LTS_SP3
-rw-r--r--0001-fix-pattern-conflicts.patch72
-rw-r--r--ANNC.spec14
2 files changed, 84 insertions, 2 deletions
diff --git a/0001-fix-pattern-conflicts.patch b/0001-fix-pattern-conflicts.patch
new file mode 100644
index 0000000..461a7e6
--- /dev/null
+++ b/0001-fix-pattern-conflicts.patch
@@ -0,0 +1,72 @@
+From d941fd6d6893abd1893d2da25afa7847ec32f132 Mon Sep 17 00:00:00 2001
+From: zhengchenhui <zhengchenhui1@huawei.com>
+Date: Tue, 9 Sep 2025 15:27:43 +0800
+Subject: [PATCH 1/2] fix pattern conflicts.
+
+---
+ python/annc/optimize/graph.py | 6 ++++++
+ python/annc/optimize/rewriter.py | 17 ++++++++++-------
+ python/setup.py | 1 -
+ 3 files changed, 16 insertions(+), 8 deletions(-)
+
+diff --git a/python/annc/optimize/graph.py b/python/annc/optimize/graph.py
+index dae7d6d..1a97d1b 100644
+--- a/python/annc/optimize/graph.py
++++ b/python/annc/optimize/graph.py
+@@ -255,6 +255,12 @@ class Graph:
+
+ self.versions['producer'] = graph_def.versions.producer
+
++ def check_node_exist(self, node: Node) -> bool:
++ for i, n in enumerate(self.nodes):
++ if n.name == node.name:
++ return True
++ return False
++
+ def get_node(self, name: str) -> Node:
+ for node in self.nodes:
+ if node.name == name:
+diff --git a/python/annc/optimize/rewriter.py b/python/annc/optimize/rewriter.py
+index 2e66189..c0f2894 100644
+--- a/python/annc/optimize/rewriter.py
++++ b/python/annc/optimize/rewriter.py
+@@ -46,15 +46,18 @@ class BaseRewriter(ABC):
+ :param users: expected list of user types and names
+ :param expected_num_users: expected number of users (optional)
+ """
+- if user_num is not None and len(node.users) != user_num:
+- raise CheckFailed
+- if len(users) > len(node.users):
+- raise CheckFailed
+- for i, (type, name) in enumerate(users):
+- if type is not None and node.users[i].type != type:
++ if self.graph.check_node_exist(node):
++ if user_num is not None and len(node.users) != user_num:
+ raise CheckFailed
+- if name is not None and node.users[i].name != name:
++ if len(users) > len(node.users):
+ raise CheckFailed
++ for i, (type, name) in enumerate(users):
++ if type is not None and node.users[i].type != type:
++ raise CheckFailed
++ if name is not None and node.users[i].name != name:
++ raise CheckFailed
++ else:
++ raise CheckFailed
+
+ def check_operands(self,
+ node: Node,
+diff --git a/python/setup.py b/python/setup.py
+index 1197745..d32026e 100644
+--- a/python/setup.py
++++ b/python/setup.py
+@@ -34,6 +34,5 @@ setup(name=project,
+ entry_points={
+ 'console_scripts': [
+ f'{project}-opt = {project}.main:opt',
+- f'{project}-apply-tf = scripts.install:tf_install',
+ ],
+ })
+--
+2.33.0
+
diff --git a/ANNC.spec b/ANNC.spec
index 5dc8316..7b06320 100644
--- a/ANNC.spec
+++ b/ANNC.spec
@@ -12,7 +12,7 @@
Summary: %{name} is an AI compiler designed to optimize and compile ML model into high-performance executable code that can be executed on various targets.
Name: ANNC
Version: 0.0.2
-Release: 1
+Release: 2
# Package onnxruntime and SafeInt have MIT License.
# Package onnx has Apache License 2.0.
License: MIT and ASL 2.0 and Boost and BSD
@@ -26,6 +26,7 @@ Source5: v3.2.tar.gz
%ifarch x86_64
Patch0: x86_64_external_files.patch
%endif
+Patch1: 0001-fix-pattern-conflicts.patch
BuildRequires: cmake >= 3.9.9
BuildRequires: make
@@ -56,6 +57,7 @@ tar xf %{SOURCE4} -C .
mkdir proxy
cp %{SOURCE5} ./proxy
%setup -q -n %{pkg_version}
+%patch1 -p1
%build
export ANNC=%{build_dir}
@@ -120,6 +122,9 @@ pushd %{build_dir}/python
install -d %{install_includedir}
install %{build_dir}/annc/service/cpu/kdnn_rewriter.h -t %{install_includedir}
install %{build_dir}/annc/service/cpu/annc_flags.h -t %{install_includedir}
+install %{build_dir}/annc/service/cpu/xla/*.h -t %{install_includedir}
+install -d %{install_includedir}/bisheng-cpu
+install %{build_dir}/annc/service/bisheng-cpu/*.h -t %{install_includedir}/bisheng-cpu
cp -r %{build_dir}/install/* %{install_includedir}
install %{build_dir}/python/tensorflow/kernels/* -t %{install_includedir}
install -d %{install_libdir}
@@ -135,9 +140,14 @@ pushd %{build_dir}/python
%{_libdir}/*
%{python3_sitelib}/*
/usr/bin/annc-opt
-/usr/bin/annc-apply-tf
%changelog
+* Thu Sep 11 2025 Chenhui Zheng <zhengchenhui1@huawei.com> - 0.0.2-2
+- Type:Fix
+- ID:NA
+- SUG:NA
+- DEC:Fix pattern conflict & missing header files.
+
* Fri Aug 22 2025 Chenhui Zheng <zhengchenhui1@huawei.com> - 0.0.2-1
- Type:Update
- ID:NA