You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by dr...@apache.org on 2022/09/06 17:44:38 UTC

[tvm] 01/08: [ci] Add CSI-NN2 build to Jenkins

This is an automated email from the ASF dual-hosted git repository.

driazati pushed a commit to branch csinn_jenkins
in repository https://gitbox.apache.org/repos/asf/tvm.git

commit e0c8e0458d27dcf51316721970cd1bf039834bc2
Author: alter-xp <xp...@linux.alibaba.com>
AuthorDate: Tue Aug 30 15:09:13 2022 +0800

    [ci] Add CSI-NN2 build to Jenkins
---
 Jenkinsfile                               | 56 ++++++++++++++++++++++++++++++-
 ci/jenkins/Build.groovy.j2                | 21 ++++++++++++
 tests/scripts/task_config_build_c906.sh   | 30 +++++++++++++++++
 tests/scripts/task_config_build_csinn2.sh | 31 +++++++++++++++++
 4 files changed, 137 insertions(+), 1 deletion(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 2b73508da0..b920282299 100755
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -45,7 +45,7 @@
 // 'python3 jenkins/generate.py'
 // Note: This timestamp is here to ensure that updates to the Jenkinsfile are
 // always rebased on main before merging:
-// Generated at 2022-08-30T15:26:50.100067
+// Generated at 2022-08-31T10:03:05.681701
 
 import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
 // NOTE: these lines are scanned by docker/dev_common.sh. Please update the regex as needed. -->
@@ -1252,6 +1252,60 @@ stage('Build') {
       Utils.markStageSkippedForConditional('BUILD: RISC-V')
     }
   },
+  'BUILD: CSINN2': {
+    if (!skip_ci && is_docs_only_build != 1) {
+      node('CPU-SMALL') {
+        ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/build-csinn2") {
+          docker_init(ci_riscv)
+          init_git()
+          sh (
+            script: "${docker_run} ${ci_riscv} ./tests/scripts/task_config_build_csinn2.sh build-csinn2-x86",
+            label: 'Create CSINN2 x86 cmake config',
+            script: "${docker_run} ${ci_riscv} ./tests/scripts/task_config_build_c906.sh build-csinn2-c906",
+            label: 'Create CSINN2 c906 cmake config',
+          )
+          make(ci_riscv, 'build-csinn2-x86', '-j2')
+          make(ci_riscv, 'build-csinn2-c906', 'tvm_rpc -j2')
+          sh(
+            script: """
+              set -eux
+              retry() {
+                local max_retries=\$1
+                shift
+                local n=0
+                local backoff_max=30
+                until [ "\$n" -ge \$max_retries ]
+                do
+                    "\$@" && break
+                    n=\$((n+1))
+                    if [ "\$n" -eq \$max_retries ]; then
+                        echo "failed to update after attempt \$n / \$max_retries, giving up"
+                        exit 1
+                    fi
+
+                    WAIT=\$(python3 -c 'import random; print(random.randint(10, 30))')
+                    echo "failed to update \$n / \$max_retries, waiting \$WAIT to try again"
+                    sleep \$WAIT
+                done
+              }
+
+              md5sum build/libtvm.so
+              retry 3 aws s3 cp --no-progress build/libtvm.so s3://${s3_prefix}/riscv-csinn2/build/libtvm.so
+              md5sum build/libtvm_runtime.so
+              retry 3 aws s3 cp --no-progress build/libtvm_runtime.so s3://${s3_prefix}/riscv-csinn2/build/libtvm_runtime.so
+              md5sum build/config.cmake
+              retry 3 aws s3 cp --no-progress build/config.cmake s3://${s3_prefix}/riscv-csinn2/build/config.cmake
+              retry 3 aws s3 cp --no-progress build/microtvm_template_projects s3://${s3_prefix}/riscv-csinn2/build/microtvm_template_projects --recursive
+            """,
+            label: 'Upload artifacts to S3',
+          )
+
+        }
+      }
+     } else {
+      Utils.markStageSkippedForConditional('BUILD: CSINN2')
+    }
+  },
   )
 }
 }
diff --git a/ci/jenkins/Build.groovy.j2 b/ci/jenkins/Build.groovy.j2
index 51360b7d9c..4823a62b16 100644
--- a/ci/jenkins/Build.groovy.j2
+++ b/ci/jenkins/Build.groovy.j2
@@ -259,6 +259,27 @@ stage('Build') {
       Utils.markStageSkippedForConditional('BUILD: RISC-V')
     }
   },
+  'BUILD: CSINN2': {
+    if (!skip_ci && is_docs_only_build != 1) {
+      node('CPU-SMALL') {
+        ws({{ m.per_exec_ws('tvm/build-csinn2') }}) {
+          docker_init(ci_riscv)
+          init_git()
+          sh (
+            script: "${docker_run} ${ci_riscv} ./tests/scripts/task_config_build_csinn2.sh build-csinn2-x86",
+            label: 'Create CSINN2 x86 cmake config',
+            script: "${docker_run} ${ci_riscv} ./tests/scripts/task_config_build_c906.sh build-csinn2-c906",
+            label: 'Create CSINN2 c906 cmake config',
+          )
+          make(ci_riscv, 'build-csinn2-x86', '-j2')
+          make(ci_riscv, 'build-csinn2-c906', 'tvm_rpc -j2')
+          {{ m.upload_artifacts(tag='riscv-csinn2', filenames=tvm_lib, folders=microtvm_template_projects) }}
+        }
+      }
+     } else {
+      Utils.markStageSkippedForConditional('BUILD: CSINN2')
+    }
+  },
   )
 }
 }
diff --git a/tests/scripts/task_config_build_c906.sh b/tests/scripts/task_config_build_c906.sh
new file mode 100755
index 0000000000..9488558acf
--- /dev/null
+++ b/tests/scripts/task_config_build_c906.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -e
+set -u
+
+BUILD_DIR=$1
+mkdir -p "$BUILD_DIR"
+cd "$BUILD_DIR"
+cp ../cmake/config.cmake .
+
+echo set\(USE_CPP_RPC ON\) >> config.cmake
+echo set\(USE_LIBBACKTRACE OFF\) >> config.cmake
+# echo set\(USE_CSINN "/opt/csi-nn2"\) >> config.cmake
+# echo set\(USE_CSINN_DEVICE_RUNTIME C906\) >> config.cmake
diff --git a/tests/scripts/task_config_build_csinn2.sh b/tests/scripts/task_config_build_csinn2.sh
new file mode 100755
index 0000000000..747c4493f9
--- /dev/null
+++ b/tests/scripts/task_config_build_csinn2.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -e
+set -u
+
+BUILD_DIR=$1
+mkdir -p "$BUILD_DIR"
+cd "$BUILD_DIR"
+cp ../cmake/config.cmake .
+
+echo set\(USE_RPC ON\) >> config.cmake
+echo set\(USE_LLVM llvm-config-10\) >> config.cmake
+echo set\(USE_OPENMP gnu\) >> config.cmake
+# echo set\(USE_CSINN "/opt/csi-nn2"\) >> config.cmake
+# echo set\(USE_CSINN_DEVICE_RUNTIME X86\) >> config.cmake