OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
Conformance Test Runner
Description
Conformance suites certify plugin functionality using a set of tests with plugin specificity independent parameters. There are two types of conformance validation.
API Conformance
The suite checks the following OpenVINO API entities in a plugin implementation:
- plugin
- compiled model (executable network)
- infer request Also, there are test instantiations to validate hardware plugin functionality via software plugins (for example, MULTI, HETERO, etc.) for the entities.
API conformance contains 2 test types:
mandatoryscope validates functionality required to be implemented in plugin. The expected pass-rate of mandatory tests is 100% for conformant harware plugin.optionalscope validates both not key functionality in an OpenVINO plugin. OpenVINO provides API, but plugin is able to decide not to implement these methods. Optional scope contains all API Conforformance tests.
NOTE: To run only mandatory API Conformance tests use
--gtest_filter=*mandatory*.
A result of the ov_api_conformance_tests run is report report_api.xml. It shows OpenVINO API entities' test statistics for each OpenVINO API entity, such as passed/failed/crashed/skipped/hanging, tests number, pass rates, and implementation status.
Opset Conformance
The other part of the API conformance suite is QueryModel validation:
The suite contains:
ReadIR_Inferenceset allows reading model based graphs from folders recursively, inferring them, and comparing plugin results with the reference.ReadIR_QueryModeltests validate thequery_modelAPI (support the operation by plugin), using a simple ]graph (Conformance IR) extracted from models.ReadIR_ImportExporttests exports and imports of compiled model, using a graph (Conformance IR) based on model parameters.OpImplCheckTestset checks an operation plugin implementation status, using a simple synthetic single operation graph (Implemented/Not implemented). The suite checks onlycompile_modelwithout comparison with the reference.
A result of the ov_op_conformance_tests run is the report_opset.xml file. It shows tests statistic, like pass rate, passed, crashed, skipped, failed tests, and plugin implementation per operation for devices.
How to build
Run the following commands in the build directory:
- Generate CMake project:
cmake -DENABLE_TESTS=ON -DENABLE_FUNCTIONAL_TESTS=ON .. - Build the targets:
make --jobs=$(nproc --all) ov_subgraphs_dumper make --jobs=$(nproc --all) ov_op_conformance_tests make --jobs=$(nproc --all) ov_api_conformance_tests - Build plugins to validate:
make --jobs=$(nproc --all) lib_plugin_name - Install python dependencies to use
run_conformancescript:cd /path/to/openvino/src/tests/test_utils/functional_test_utils/layer_tests_summary pip3 install -r [requirements.txt](./../../../../../tests/test_utils/functional_test_utils/layer_tests_summary/requirements.txt)
How to run using simple conformance runner
There is a simple python runner to complete the whole conformance pipeline locally. Some steps could be excluded from the pipeline by command-line parameter configuration.
NOTE: Conformance reports
ov python apiWARNING in case of its absence.ov python apiis not required to get a conformance results. It is a way to get HASHED conformance IR names afterov_subgraphs_dumpertool using (in case of-s=1).
The conformance pipeline steps:
- (Optional: Applicable only for Opset Conformance suite) Download models/conformance IR via URL / copy archive to working directory / verify dirs / check list-files.
- (Optional: Applicable only for Opset Conformance suite) Run
ov_subgraphs_dumperto extract graph from models or download theconformance_irfolder. (if-s=1) - Run conformance test executable files.
- Generate conformance reports.
Command-line arguments
The script has the following optional arguments:
h, --helpShow this help message and exitd DEVICE, --device DEVICESpecify a target device. The default value isCPUt TYPE, --type TYPESpecify conformance type:OPorAPI. The default value isOP-gtest_filter GTEST_FILTERSpecify gtest filter to apply for a test run. E.g. Add:BinaryConv. The default value isNonew WORKING_DIR, --working_dir WORKING_DIRSpecify a working directory to save a run artifacts. The default value iscurrent_dir/temp.m MODELS_PATH, --models_path MODELS_PATHPath to the directory/ies containing models to dump subgraph (the default way is to download conformance IR). It may be directory, archieve file, .lst file with models to download by a link, model file paths. If --s=0, specify the Conformance IRs directory. NOTE: Applicable only for Opset Conformance.ov OV_PATH, --ov_path OV_PATHOV binary path. The default way is to find the absolute path of latest bin in the repo (by using script path)j WORKERS, --workers WORKERSSpecify number of workers to run in parallel. The default value isCPU_countc OV_CONFIG_PATH, --ov_config_path OV_CONFIG_PATHSpecify path to a plugin config file as.lstfile. Default value is ``s DUMP_GRAPH, --dump_graph DUMP_GRAPHSet '1' to create Conformance IRs from models using ov_subgraphs_dumper tool. The default value is '0'. NOTE: Applicable only for Opset Conformance.sm SPECIAL_MODE, --special_mode SPECIAL_MODESpecify shape mode (static,dynamicor) for Opset conformance or API scope type (`mandatory` or). Default value is ``-e ENTITY, --entity ENTITYSpecify validation entity:Inference,ImportExport,QueryModelorOpImplforOPorov. Default value isov_compiled_model,ov_infer_requestorov_pluginforAPI. Default value is ``(all)p PARALLEL_DEVICES, --parallel_devices PARALLEL_DEVICESParallel over HW devices. For example run tests overGPU.0andGPU.1in case when device are the samef EXPECTED_FAILURES, --expected_failures EXPECTED_FAILURESExcepted failures list file path as csv. See more in the Working with expected failures section.u EXPECTED_FAILURES_UPDATE, --expected_failures_update EXPECTED_FAILURES_UPDATEOverwrite expected failures list in case same failures were fixed-cache_path CACHE_PATHPath to the cache file with test_name list sorted by execution time as.lstfile!-r DISABLE_RERUN, --disable_rerun DISABLE_RERUNDisable re-run of interapted/lost tests. Default value isFalse--timeout TIMEOUTSet a custom timeout per worker in s
NOTE: All arguments are optional and have default values to reproduce OMZ based Opset conformance results on
CPUin a default method.
NOTE: The approach can be used as custom model scope validator!
Examples of usage:
- Use the default method to reproduce opset conformance results for OMZ on GPU:
python3 run_conformance.py -d GPU
- Use the conformance pipeline to check new models support (as IRs) on the CPU plugin and save results to a custom directory:
python3 run_conformance.py -m /path/to/new/model_irs -s=1 -w /path/to/working/dir -d CPU
- Use custom OV build to check GNA conformance, using pre-generated
conformance_irs:
python3 run_conformance.py -m /path/to/conformance_irs -s=0 -ov /path/to/ov_repo_on_custom_branch/bin/intel64/Debug -d GNA
- Use the default method to reproduce opset conformance results for OMZ on TEMPLATE using custom config file:
python3 run_conformance.py -d GPU -c /path/to/ov/config.lst
IMPORTANT NOTE: If you need to debug some conformance tests, use the binary run as the default method. If you want to get conformance results or reproduce CI behavior, use the simple python runner.
How to generate Conformance IRs set
Run the following commands:
- Clone
Open Model Zoo repoor prepare custom model scope - Download all models using Downloader tool from the repo.
- Convert downloaded models to IR files, using Converter tool from the repo.
- Run Subgraph dumper to collect unique operation set from the models.
NOTE: There are ready to use Conformance IRs based on latest OMZ scope in the public storage.
NOTE: You can use the above algorithm to generate Conformance IRs using a custom model scope supported by OpenVINO.
How to run a conformance suite
The target is able to take the following command-line arguments:
-hprints target command-line options with description.--devicespecifies target device.--input_foldersspecifies the input folders with IRs or.lstfile. It contains paths, separated by a comma,.--plugin_lib_nameis a name of a plugin library. The example isopenvino_intel_cpu_plugin. Use only with unregistered in OV Core devices.--disable_test_configallows ignoring all skipped tests with the exception ofDISABLED_prefix using.--skip_config_pathallows specifying paths to files. It contains a list of regular expressions to skip tests. Examples--config_pathallows specifying the path to a file that contains plugin config. Example--extend_reportallows you not to re-write device results to the report (add results of this run to the existing one). Mutually exclusive with--report_unique_name.--report_unique_nameallows you to save a report with a unique name (report_pid_timestamp.xml). Mutually exclusive with--extend_report.--save_report_timeoutallows saving a report in the cycle, using timeout (in seconds).--output_folderspecifies the path to the output folder to save a report.--extract_bodyallows you to count extracted operation bodies to a report.--shape_modeis optional. It allows you to runstatic,dynamic, or both scenarios. The default value is an empty string, which allows running both scenarios. Possible values arestatic,dynamic, ``--test_timeoutspecifies setup timeout for each test in seconds. The default timeout is 900 seconds (15 minutes).--ignore_crashOptional. Allow to not terminate the whole run after crash and continue execution from the next test. This is organized with custom crash handler. Please, note, that handler work for test body, if crash happened on SetUp/TearDown stage, the process will be terminated.- All
gtestcommand-line parameters
NOTE:
Using
parallel_runnertool to run a conformance suite helps to report crashed tests and collect correct statistics after unexpected crashes. The tool is able to work in two modes:
- one test is run in a separate thread (first run, as the output the cache will be saved as a custom file).
- similar load time per one worker based on test execution time. May contain different test count per worker.
The example of usage is:
python3 run_parallel.py -e=/path/to/openvino/bin/intel64/Debug/conformanceTests -d . --gtest_filter=*Add*:*BinaryConv* -- --input_folders=/path/to/ir_1,/path/to/ir_2 --device=CPU --report_unique_name --output_folder=/path/to/temp_output_report_folderAll arguments after
--symbol is forwarding toconformanceTeststarget.If you use the
--report_unique_nameargument, run the merge xml script to aggregate the results to one xml file. Check command-line arguments with--helpbefore running the command. The example of usage is:python3 merge_xmls.py --input_folders=/path/to/temp_output_report_folder --output_folder=/path/to/output_report_folder --output_filename=report_aggregated
Working with expected failures
The run_conformace.py script has an optional --expected_failures argument which accepts a path to a csv file with a list of tests that should not be run.
You can find the files with the most up-to-date expected failures for different devices and conformance types here.
These files are used in the Linux GitHub workflow for test skip.
You can update the file(s) you need with either new passing tests, i.e., when something is fixed, or with new failing tests to skip them. The changes will be reflected in the GitHub actions pipeline, in the Conformance_Tests job.
How to create a conformance report
Run the summarize script to generate html and csv report. Check command-line arguments with --help before running the command.
The example of using the script is:
python3 summarize.py --xml /opt/repo/infrastructure-master/thirdparty/gtest-parallel/report_opset.xml --out /opt/repo/infrastructure-master/thirdparty/gtest-parallel/ -t OP
python3 summarize.py --xml /opt/repo/infrastructure-master/thirdparty/gtest-parallel/report_api.xml --out /opt/repo/infrastructure-master/thirdparty/gtest-parallel/ -t API
NOTE: Remember to copy styles folder to the output directory. It helps to provide a report with filters and other useful features.
The report contains statistics based on conformance results and filter fields at the top of the page.