Skip to content

Commit 0e98470

Browse files
Merge pull request #5 from cgerum/uma_tests
Upgrade UMA to current main and fix test cases
2 parents c658445 + 9582e10 commit 0e98470

File tree

367 files changed

+7793
-2305
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

367 files changed

+7793
-2305
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ endif()
395395
if(USE_PROFILER)
396396
message(STATUS "Build with profiler...")
397397

398-
add_definitions(-DUSE_PROFILER=1)
399398
tvm_file_glob(GLOB RUNTIME_GRAPH_EXECUTOR_DEBUG_SRCS src/runtime/graph_executor/debug/*.cc)
400399
list(APPEND RUNTIME_SRCS ${RUNTIME_GRAPH_EXECUTOR_DEBUG_SRCS})
401400
set_source_files_properties(${RUNTIME_GRAPH_EXECUTOR_SRCS}

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ We do encourage everyone to work anything they are interested in.
115115
- [Chenfan Jia](https://github.com/jcf94): @jcf94
116116
- [Hua Jiang](https://github.com/huajsj): @huajsj
117117
- [Ziheng Jiang](https://github.com/ZihengJiang): @ZihengJiang
118+
- [Hongyi Jin](https://github.com/jinhongyii): @jinhongyii
118119
- [Manupa Karunaratne](https://github.com/manupa-arm): @manupa-arm
119120
- [Elen Kalda](https://github.com/ekalda): @ekalda
120121
- [Marisa Kirisame](https://github.com/MarisaKirisame): @MarisaKirisame

Jenkinsfile

Lines changed: 9 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/cpp_rpc/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ if (BUILD_FOR_ANDROID AND USE_HEXAGON)
5757
list(APPEND TVM_RPC_LINKER_LIBS cdsprpc log)
5858
endif()
5959

60+
if(USE_ETHOSN)
61+
if (ETHOSN_RUNTIME_LIBRARY)
62+
list(APPEND TVM_RPC_LINKER_LIBS ${ETHOSN_RUNTIME_LIBRARY})
63+
else()
64+
message(WARNING "Could not locate Arm(R) Ethos(TM)-N runtime library components")
65+
endif()
66+
endif()
67+
6068
if(BUILD_STATIC_RUNTIME)
6169
list(APPEND TVM_RPC_LINKER_LIBS -Wl,--whole-archive tvm_runtime -Wl,--no-whole-archive)
6270
else()

apps/microtvm/zephyr/template_project/microtvm_api_server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ def _create_prj_conf(self, project_dir, options):
393393

394394
if options["project_type"] == "host_driven":
395395
f.write(
396+
"CONFIG_TIMING_FUNCTIONS=y\n"
396397
"# For RPC server C++ bindings.\n"
397398
"CONFIG_CPLUSPLUS=y\n"
398399
"CONFIG_LIB_CPLUSPLUS=y\n"

apps/microtvm/zephyr/template_project/src/host_driven/main.c

Lines changed: 12 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <sys/printk.h>
3939
#include <sys/reboot.h>
4040
#include <sys/ring_buffer.h>
41+
#include <timing/timing.h>
4142
#include <tvm/runtime/crt/logging.h>
4243
#include <tvm/runtime/crt/microtvm_rpc_server.h>
4344
#include <unistd.h>
@@ -144,11 +145,7 @@ tvm_crt_error_t TVMPlatformMemoryFree(void* ptr, DLDevice dev) {
144145
return kTvmErrorNoError;
145146
}
146147

147-
#define MILLIS_TIL_EXPIRY 200
148-
#define TIME_TIL_EXPIRY (K_MSEC(MILLIS_TIL_EXPIRY))
149-
K_TIMER_DEFINE(g_microtvm_timer, /* expiry func */ NULL, /* stop func */ NULL);
150-
151-
uint32_t g_microtvm_start_time;
148+
volatile timing_t g_microtvm_start_time, g_microtvm_end_time;
152149
int g_microtvm_timer_running = 0;
153150

154151
// Called to start system timer.
@@ -161,8 +158,7 @@ tvm_crt_error_t TVMPlatformTimerStart() {
161158
#ifdef CONFIG_LED
162159
gpio_pin_set(led0_pin, LED0_PIN, 1);
163160
#endif
164-
k_timer_start(&g_microtvm_timer, TIME_TIL_EXPIRY, TIME_TIL_EXPIRY);
165-
g_microtvm_start_time = k_cycle_get_32();
161+
g_microtvm_start_time = timing_counter_get();
166162
g_microtvm_timer_running = 1;
167163
return kTvmErrorNoError;
168164
}
@@ -174,43 +170,14 @@ tvm_crt_error_t TVMPlatformTimerStop(double* elapsed_time_seconds) {
174170
return kTvmErrorSystemErrorMask | 2;
175171
}
176172

177-
uint32_t stop_time = k_cycle_get_32();
178173
#ifdef CONFIG_LED
179174
gpio_pin_set(led0_pin, LED0_PIN, 0);
180175
#endif
181176

182-
// compute how long the work took
183-
uint32_t cycles_spent = stop_time - g_microtvm_start_time;
184-
if (stop_time < g_microtvm_start_time) {
185-
// we rolled over *at least* once, so correct the rollover it was *only*
186-
// once, because we might still use this result
187-
cycles_spent = ~((uint32_t)0) - (g_microtvm_start_time - stop_time);
188-
}
189-
190-
uint32_t ns_spent = (uint32_t)k_cyc_to_ns_floor64(cycles_spent);
191-
double hw_clock_res_us = ns_spent / 1000.0;
192-
193-
// need to grab time remaining *before* stopping. when stopped, this function
194-
// always returns 0.
195-
int32_t time_remaining_ms = k_timer_remaining_get(&g_microtvm_timer);
196-
k_timer_stop(&g_microtvm_timer);
197-
// check *after* stopping to prevent extra expiries on the happy path
198-
if (time_remaining_ms < 0) {
199-
TVMLogf("negative time remaining");
200-
return kTvmErrorSystemErrorMask | 3;
201-
}
202-
uint32_t num_expiries = k_timer_status_get(&g_microtvm_timer);
203-
uint32_t timer_res_ms = ((num_expiries * MILLIS_TIL_EXPIRY) + time_remaining_ms);
204-
double approx_num_cycles =
205-
(double)k_ticks_to_cyc_floor32(1) * (double)k_ms_to_ticks_ceil32(timer_res_ms);
206-
// if we approach the limits of the HW clock datatype (uint32_t), use the
207-
// coarse-grained timer result instead
208-
if (approx_num_cycles > (0.5 * (~((uint32_t)0)))) {
209-
*elapsed_time_seconds = timer_res_ms / 1000.0;
210-
} else {
211-
*elapsed_time_seconds = hw_clock_res_us / 1e6;
212-
}
213-
177+
g_microtvm_end_time = timing_counter_get();
178+
uint64_t cycles = timing_cycles_get(&g_microtvm_start_time, &g_microtvm_end_time);
179+
uint64_t ns_spent = timing_cycles_to_ns(cycles);
180+
*elapsed_time_seconds = ns_spent / (double)1e9;
214181
g_microtvm_timer_running = 0;
215182
return kTvmErrorNoError;
216183
}
@@ -278,6 +245,11 @@ void main(void) {
278245
tvm_uart = device_get_binding(DT_LABEL(DT_CHOSEN(zephyr_console)));
279246
uart_rx_init(&uart_rx_rbuf, tvm_uart);
280247

248+
// Initialize system timing. We could stop and start it every time, but we'll
249+
// be using it enough we should just keep it enabled.
250+
timing_init();
251+
timing_start();
252+
281253
// Initialize microTVM RPC server, which will receive commands from the UART and execute them.
282254
microtvm_rpc_server_t server = MicroTVMRpcServerInit(write_serial, NULL);
283255
TVMLogf("microTVM Zephyr runtime - running");

ci/README.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<!--- Licensed to the Apache Software Foundation (ASF) under one -->
2+
<!--- or more contributor license agreements. See the NOTICE file -->
3+
<!--- distributed with this work for additional information -->
4+
<!--- regarding copyright ownership. The ASF licenses this file -->
5+
<!--- to you under the Apache License, Version 2.0 (the -->
6+
<!--- "License"); you may not use this file except in compliance -->
7+
<!--- with the License. You may obtain a copy of the License at -->
8+
9+
<!--- http://www.apache.org/licenses/LICENSE-2.0 -->
10+
11+
<!--- Unless required by applicable law or agreed to in writing, -->
12+
<!--- software distributed under the License is distributed on an -->
13+
<!--- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -->
14+
<!--- KIND, either express or implied. See the License for the -->
15+
<!--- specific language governing permissions and limitations -->
16+
<!--- under the License. -->
17+
18+
# Apache TVM Continuous Integration (CI)
19+
20+
## Overview
21+
22+
TVM's Continuous Integration is responsible for verifying the code in `apache/tvm` and testing PRs
23+
before they merge to inform TVM contributors and committers. These jobs are essential to keeping the
24+
TVM project in a healthy state and preventing breakages. CI in TVM is broken into these pieces:
25+
- Lint scripts in [`tests/lint`](../tests/lint).
26+
- The tests themselves, all of which live underneath [`tests`](../tests).
27+
- Definitions of test suites, with each suite defined as a separate `task_` script in
28+
[`tests/scripts`](../tests/scripts).
29+
- The linux test sequence (in [`Jenkinsfile`](../Jenkinsfile)), which lints and builds TVM and runs test
30+
suites using Docker on Linux.
31+
- The Windows and Mac test sequences (in [`.github/actions`](../.github/actions)).
32+
- GitHub Actions that support the code review process (in [`.github/actions`](../.github/actions)).
33+
- Tools to reproduce the CI locally (in `tests/scripts`).
34+
- Infrastructure-as-Code that configures the cloud services that provide Jenkins for the TVM CI (in the
35+
[`tlc-pack/ci`](https://github.com/tlc-pack/ci) repo).
36+
37+
## CI Documentation Index
38+
39+
The CI documentation belongs with the implementation it describes. To make that concrete, the
40+
documentation is split like so:
41+
1. An overview of the CI is in this file.
42+
1. User-facing documentation lives in `apache/tvm`'s `docs/contribute` sub-directory and is served on the
43+
[TVM docs site](https://tvm.apache.org/docs/contribute/ci.html).
44+
2. Documentation of the tools that run TVM's various regression tests locally and the test suites
45+
are in this sub-directory.
46+
3. Documentation of the cloud services and their configuration lives in the
47+
[`tlc-pack/ci`](https://github.com/tlc-pack/ci) repo.
48+
49+
## Jenkins
50+
51+
Jenkins runs all of the Linux-based TVM CI-enabled regression tests. This includes tests against accelerated hardware such as GPUs. It excludes those regression tests that run against hardware not available in the cloud (those tests aren't currently exercised in TVM CI). The tests run by Jenkins represent most of the merge-blocking tests (and passing Jenkins should mostly correlate with passing the remaining Windows/Mac builds).
52+
53+
## GitHub Actions
54+
55+
GitHub Actions is used to run Windows jobs, MacOS jobs, and various on-GitHub automations. These are defined in [`.github/workflows`](../.github/workflows/). These automations include bots to:
56+
* [cc people based on subscribed teams/topics](https://github.com/apache/tvm/issues/10317)
57+
* [allow non-committers to merge approved / CI passing PRs](https://discuss.tvm.apache.org/t/rfc-allow-merging-via-pr-comments/12220)
58+
* [add cc-ed people as reviewers on GitHub](https://discuss.tvm.apache.org/t/rfc-remove-codeowners/12095)
59+
* [ping languishing PRs after no activity for a week (currently opt-in only)](https://github.com/apache/tvm/issues/9983)
60+
* [push a `last-successful` branch to GitHub with the last `main` commit that passed CI](https://github.com/apache/tvm/tree/last-successful)
61+
62+
https://github.com/apache/tvm/actions has the logs for each of these workflows. Note that when debugging these workflows changes from PRs from forked repositories won't be reflected in the PR. These should be tested in the forked repository first and linked in the PR body.
63+
64+
## Docker Images
65+
66+
Each CI job runs most of its work inside a Docker container, built from files
67+
in the [`docker/`](../docker) folder. These
68+
files are built nightly in Jenkins via the [docker-images-ci](https://ci.tlcpack.ai/job/docker-images-ci/>) job.
69+
The images for these containers are hosted in the [tlcpack Docker Hub](https://hub.docker.com/u/tlcpack>)
70+
and referenced in the [`Jenkinsfile.j2`](Jenkinsfile.j2). These can be inspected and run
71+
locally via standard Docker commands.
72+
73+
### `ci-docker-staging`
74+
75+
The [ci-docker-staging](https://github.com/apache/tvm/tree/ci-docker-staging>)
76+
branch is used to test updates to Docker images and `Jenkinsfile` changes. When
77+
running a build for a normal PR from a forked repository, Jenkins uses the code
78+
from the PR except for the `Jenkinsfile` itself, which comes from the base branch.
79+
When branches are built, the `Jenkinsfile` in the branch is used, so a committer
80+
with write access must push PRs to a branch in apache/tvm to properly test
81+
`Jenkinsfile` changes. If your PR makes changes to the `Jenkinsfile`, make sure
82+
to @ a [committer](../CONTRIBUTORS.md>)
83+
and ask them to push your PR as a branch to test the changes.
84+
85+
# Jenkins CI
86+
87+
TVM uses Jenkins for running Linux continuous integration (CI) tests on
88+
[branches](https://ci.tlcpack.ai/job/tvm/) and
89+
[pull requests](https://ci.tlcpack.ai/job/tvm/view/change-requests/) through a
90+
build configuration specified in a [`Jenkinsfile`](../Jenkinsfile).
91+
Other jobs run in GitHub Actions for Windows and MacOS jobs.
92+
93+
## `Jenkinsfile`
94+
95+
The template files in this directory are used to generate the [`Jenkinsfile`](../Jenkinsfile) used by Jenkins to run CI jobs for each commit to PRs and branches.
96+
97+
To regenerate the `Jenkinsfile`, run `make` in the `ci/jenkins` dir.

ci/jenkins/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/_venv
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)