Skip to content
This repository has been archived by the owner on Nov 25, 2022. It is now read-only.

Commit

Permalink
Build and test TVM under minimal configuration (apache#12178)
Browse files Browse the repository at this point in the history
This PR builds and tests TVM (running the CPP and unittests) under minimal configuration with some debug flags enabled:
- `USE_RELAY_DEBUG=ON` in TVM
- `-Wp,-D_GLIBCXX_ASSERTIONS` in TVM
- `-DLLVM_ENABLE_ASSERTIONS=ON` in LLVM

It also adds this configuration to the CI. 

`tests/python/unittest/test_meta_schedule_task_scheduler.py::test_meta_schedule_task_scheduler_multiple_gradient_based` results in an array OOB access and a segfault due to `D_GLIBCXX_ASSERTIONS`. I disable this test for now and will open an issue to solve it ASAP.

It should fix apache#11932 and address [this discussion](https://discuss.tvm.apache.org/t/pre-rfc-new-ci-container-ci-cpu-asserts/12536/9).
  • Loading branch information
gigiblender authored and xinetzone committed Nov 25, 2022
1 parent 98b0ee2 commit c433d4d
Show file tree
Hide file tree
Showing 15 changed files with 367 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -796,3 +796,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': {
run_unittest_minimal()
},
{% 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 @@ -86,6 +86,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

0 comments on commit c433d4d

Please sign in to comment.