Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and test TVM under minimal configuration #12178

Merged
merged 4 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -794,3 +794,5 @@ find_and_set_linker(${USE_ALTERNATIVE_LINKER})
if(${SUMMARIZE})
print_summary()
endif()

dump_options_to_file("${TVM_ALL_OPTIONS}")
141 changes: 139 additions & 2 deletions Jenkinsfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion ci/jenkins/Build.groovy.j2
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def cpp_unittest(image) {
)
}


def add_microtvm_permissions() {
{% for folder in microtvm_template_projects %}
sh(
Expand Down Expand Up @@ -123,6 +122,24 @@ stage('Build') {
Utils.markStageSkippedForConditional('BUILD: CPU')
}
},
'BUILD: CPU MINIMAL': {
if (!skip_ci && is_docs_only_build != 1) {
node('CPU-SMALL') {
ws({{ m.per_exec_ws('tvm/build-cpu-minimal') }}) {
docker_init(ci_minimal)
init_git()
sh (
script: "${docker_run} ${ci_minimal} ./tests/scripts/task_config_build_minimal.sh build",
label: 'Create CPU minimal cmake config',
)
make(ci_minimal, 'build', '-j2')
{{ m.upload_artifacts(tag='cpu-minimal', filenames=tvm_lib) }}
}
}
} else {
Utils.markStageSkippedForConditional('BUILD: CPU MINIMAL')
}
},
'BUILD: WASM': {
if (!skip_ci && is_docs_only_build != 1) {
node('CPU-SMALL') {
Expand Down
1 change: 1 addition & 0 deletions ci/jenkins/Jenkinsfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
ci_lint = 'tlcpack/ci-lint:20220715-060127-37f9d3c49'
ci_gpu = 'tlcpack/ci-gpu:20220801-060139-d332eb374'
ci_cpu = 'tlcpack/ci-cpu:20220715-060127-37f9d3c49'
ci_minimal = 'tlcpack/ci-minimal:20220725-133226-d3cefdaf1'
ci_wasm = 'tlcpack/ci-wasm:20220715-060127-37f9d3c49'
ci_i386 = 'tlcpack/ci-i386:20220715-060127-37f9d3c49'
ci_cortexm = 'tlcpack/ci-cortexm:v0.01'
Expand Down
16 changes: 16 additions & 0 deletions ci/jenkins/Test.groovy.j2
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,19 @@
)
{% endcall %}

def run_unittest_minimal() {
{% call m.test_step_body(
name="unittest: CPU MINIMAL",
node="CPU-SMALL",
ws="tvm/ut-python-cpu-minimal",
platform="minimal",
docker_image="ci_minimal",
) %}
{{ m.download_artifacts(tag='cpu-minimal', filenames=tvm_lib) }}
cpp_unittest(ci_minimal)
python_unittest(ci_minimal)
{% endcall %}
}

def test() {
stage('Test') {
Expand All @@ -223,6 +236,9 @@ stage('Test') {
{{ method_name }}()
},
{% endfor %}
'unittest: CPU MINIMAL': {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use the m.test_step macro here instead? That way we don't need to duplicate all the meta-logic (timeout, workspace, etc) just for this test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to do that. The test_step inlines the body while in this case, I am calling run_unittest_minimal. I could try to inline the method and use the macro, but that might not work due to the 64KB bytecode size/method limit in the JVM.

I also guess I could modify the macros.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I am adding a new macro

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant something like https://github.com/apache/tvm/blob/main/ci/jenkins/Test.groovy.j2#L202-L218, if you do that it will automatically call the test method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I needed a different macro that did not include the step name (eg unittest: CPU MINIMAL, frontend: aarch64 2 of 2, unittest: CPU).

https://github.com/apache/tvm/pull/12178/files#diff-1a31fe4681520821e63f0bec0a963c86b8eea7af2c7130b28eba0b987a5fc21bR86

run_unittest_minimal()
},
driazati marked this conversation as resolved.
Show resolved Hide resolved
{% call m.test_step(
name="unittest: CPU",
node="CPU-SMALL",
Expand Down
4 changes: 4 additions & 0 deletions ci/jenkins/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
"name": "ci_cpu",
"platform": "CPU",
},
{
"name": "ci_minimal",
"platform": "CPU",
},
{
"name": "ci_gpu",
"platform": "CPU",
Expand Down
23 changes: 23 additions & 0 deletions ci/jenkins/macros.j2
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,29 @@ def {{ method_name }}() {
{% endfor %}
{% endmacro %}

{% macro test_step_body(name, node, ws, docker_image, platform) %}
{% set test_dir_name = name.replace(":", "").replace(" ", "-").replace("-", "_")|string %}
if (!skip_ci && is_docs_only_build != 1) {
node('{{ node }}') {
ws({{ per_exec_ws(ws) }}) {
timeout(time: max_time, unit: 'MINUTES') {
try {
docker_init({{ docker_image }})
init_git()
withEnv(['PLATFORM={{ platform }}'], {
{{ caller() | indent(width=8) | trim }}
})
} finally {
{{ junit_to_s3(test_dir_name) | indent(width=0) }}
junit 'build/pytest-results/*.xml'
}
}
}
}
} else {
Utils.markStageSkippedForConditional('{{ name }}')
}
{% endmacro %}

{% macro test_step(name, node, ws, docker_image, platform) %}
{% set test_dir_name = name.replace(":", "").replace(" ", "-").replace("-", "_")|string %}
Expand Down
7 changes: 7 additions & 0 deletions cmake/utils/Summary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,10 @@ macro(print_summary)
message(STATUS ${OUT} " : " ${OPTION_VALUE})
endforeach()
endmacro()

function(dump_options_to_file tvm_options)
file(REMOVE ${CMAKE_BINARY_DIR}/TVMBuildOptions.txt)
foreach(option ${tvm_options})
file(APPEND ${CMAKE_BINARY_DIR}/TVMBuildOptions.txt "${option} ${${option}} \n")
endforeach()
endfunction()
Loading