1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>test-suite Guide — LLVM 13 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/llvm-theme.css" type="text/css" />
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="test-suite Makefile Guide (deprecated)" href="TestSuiteMakefileGuide.html" />
<link rel="prev" title="LLVM Testing Infrastructure Guide" href="TestingGuide.html" />
<style type="text/css">
table.right { float: right; margin-left: 20px; }
table.right td { border: 1px solid #ccc; }
</style>
</head><body>
<div class="logo">
<a href="index.html">
<img src="_static/logo.png"
alt="LLVM Logo" width="250" height="88"/></a>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="TestSuiteMakefileGuide.html" title="test-suite Makefile Guide (deprecated)"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="TestingGuide.html" title="LLVM Testing Infrastructure Guide"
accesskey="P">previous</a> |</li>
<li><a href="https://llvm.org/">LLVM Home</a> | </li>
<li><a href="index.html">Documentation</a>»</li>
<li class="nav-item nav-item-1"><a href="Reference.html" >Reference</a> »</li>
<li class="nav-item nav-item-2"><a href="TestingGuide.html" accesskey="U">LLVM Testing Infrastructure Guide</a> »</li>
<li class="nav-item nav-item-this"><a href="">test-suite Guide</a></li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3>Documentation</h3>
<ul class="want-points">
<li><a href="https://llvm.org/docs/GettingStartedTutorials.html">Getting Started/Tutorials</a></li>
<li><a href="https://llvm.org/docs/UserGuides.html">User Guides</a></li>
<li><a href="https://llvm.org/docs/Reference.html">Reference</a></li>
</ul>
<h3>Getting Involved</h3>
<ul class="want-points">
<li><a href="https://llvm.org/docs/Contributing.html">Contributing to LLVM</a></li>
<li><a href="https://llvm.org/docs/HowToSubmitABug.html">Submitting Bug Reports</a></li>
<li><a href="https://llvm.org/docs/GettingInvolved.html#mailing-lists">Mailing Lists</a></li>
<li><a href="https://llvm.org/docs/GettingInvolved.html#irc">IRC</a></li>
<li><a href="https://llvm.org/docs/GettingInvolved.html#meetups-and-social-events">Meetups and Social Events</a></li>
</ul>
<h3>Additional Links</h3>
<ul class="want-points">
<li><a href="https://llvm.org/docs/FAQ.html">FAQ</a></li>
<li><a href="https://llvm.org/docs/Lexicon.html">Glossary</a></li>
<li><a href="https://llvm.org/pubs">Publications</a></li>
<li><a href="https://github.com/llvm/llvm-project//">Github Repository</a></li>
</ul>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/TestSuiteGuide.md.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="test-suite-guide">
<h1>test-suite Guide<a class="headerlink" href="#test-suite-guide" title="Permalink to this headline">¶</a></h1>
<div class="section" id="quickstart">
<h2>Quickstart<a class="headerlink" href="#quickstart" title="Permalink to this headline">¶</a></h2>
<ol>
<li><p>The lit test runner is required to run the tests. You can either use one
from an LLVM build:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>% <path to llvm build>/bin/llvm-lit --version
lit <span class="m">0</span>.8.0dev
</pre></div>
</div>
<p>An alternative is installing it as a python package in a python virtual
environment:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>% mkdir venv
% virtualenv venv
% . venv/bin/activate
% pip install svn+https://llvm.org/svn/llvm-project/llvm/trunk/utils/lit
% lit --version
lit <span class="m">0</span>.8.0dev
</pre></div>
</div>
</li>
<li><p>Check out the <code class="docutils literal notranslate"><span class="pre">test-suite</span></code> module with:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>% git clone https://github.com/llvm/llvm-test-suite.git test-suite
</pre></div>
</div>
</li>
<li><p>Create a build directory and use CMake to configure the suite. Use the
<code class="docutils literal notranslate"><span class="pre">CMAKE_C_COMPILER</span></code> option to specify the compiler to test. Use a cache file
to choose a typical build configuration:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>% mkdir test-suite-build
% <span class="nb">cd</span> test-suite-build
% cmake -DCMAKE_C_COMPILER<span class="o">=</span><path to llvm build>/bin/clang <span class="se">\</span>
-C../test-suite/cmake/caches/O3.cmake <span class="se">\</span>
../test-suite
</pre></div>
</div>
</li>
</ol>
<p><strong>NOTE!</strong> if you are using your built clang, and you want to build and run the
MicroBenchmarks/XRay microbenchmarks, you need to add <code class="docutils literal notranslate"><span class="pre">compiler-rt</span></code> to your
<code class="docutils literal notranslate"><span class="pre">LLVM_ENABLE_RUNTIMES</span></code> cmake flag.</p>
<ol>
<li><p>Build the benchmarks:</p>
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>% make
Scanning dependencies of target timeit-target
[ 0%] Building C object tools/CMakeFiles/timeit-target.dir/timeit.c.o
[ 0%] Linking C executable timeit-target
...
</pre></div>
</div>
</li>
<li><p>Run the tests with lit:</p>
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>% llvm-lit -v -j 1 -o results.json .
-- Testing: 474 tests, 1 threads --
PASS: test-suite :: MultiSource/Applications/ALAC/decode/alacconvert-decode.test (1 of 474)
********** TEST 'test-suite :: MultiSource/Applications/ALAC/decode/alacconvert-decode.test' RESULTS **********
compile_time: 0.2192
exec_time: 0.0462
hash: "59620e187c6ac38b36382685ccd2b63b"
size: 83348
**********
PASS: test-suite :: MultiSource/Applications/ALAC/encode/alacconvert-encode.test (2 of 474)
...
</pre></div>
</div>
</li>
<li><p>Show and compare result files (optional):</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Make sure pandas and scipy are installed. Prepend `sudo` if necessary.</span>
% pip install pandas scipy
<span class="c1"># Show a single result file:</span>
% test-suite/utils/compare.py results.json
<span class="c1"># Compare two result files:</span>
% test-suite/utils/compare.py results_a.json results_b.json
</pre></div>
</div>
</li>
</ol>
</div>
<div class="section" id="structure">
<h2>Structure<a class="headerlink" href="#structure" title="Permalink to this headline">¶</a></h2>
<p>The test-suite contains benchmark and test programs. The programs come with
reference outputs so that their correctness can be checked. The suite comes
with tools to collect metrics such as benchmark runtime, compilation time and
code size.</p>
<p>The test-suite is divided into several directories:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">SingleSource/</span></code></p>
<p>Contains test programs that are only a single source file in size. A
subdirectory may contain several programs.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">MultiSource/</span></code></p>
<p>Contains subdirectories which entire programs with multiple source files.
Large benchmarks and whole applications go here.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">MicroBenchmarks/</span></code></p>
<p>Programs using the <a class="reference external" href="https://github.com/google/benchmark">google-benchmark</a>
library. The programs define functions that are run multiple times until the
measurement results are statistically significant.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">External/</span></code></p>
<p>Contains descriptions and test data for code that cannot be directly
distributed with the test-suite. The most prominent members of this
directory are the SPEC CPU benchmark suites.
See <a class="reference external" href="#external-suites">External Suites</a>.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">Bitcode/</span></code></p>
<p>These tests are mostly written in LLVM bitcode.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">CTMark/</span></code></p>
<p>Contains symbolic links to other benchmarks forming a representative sample
for compilation performance measurements.</p>
</li>
</ul>
<div class="section" id="benchmarks">
<h3>Benchmarks<a class="headerlink" href="#benchmarks" title="Permalink to this headline">¶</a></h3>
<p>Every program can work as a correctness test. Some programs are unsuitable for
performance measurements. Setting the <code class="docutils literal notranslate"><span class="pre">TEST_SUITE_BENCHMARKING_ONLY</span></code> CMake
option to <code class="docutils literal notranslate"><span class="pre">ON</span></code> will disable them.</p>
</div>
</div>
<div class="section" id="configuration">
<h2>Configuration<a class="headerlink" href="#configuration" title="Permalink to this headline">¶</a></h2>
<p>The test-suite has configuration options to customize building and running the
benchmarks. CMake can print a list of them:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>% <span class="nb">cd</span> test-suite-build
<span class="c1"># Print basic options:</span>
% cmake -LH
<span class="c1"># Print all options:</span>
% cmake -LAH
</pre></div>
</div>
<div class="section" id="common-configuration-options">
<h3>Common Configuration Options<a class="headerlink" href="#common-configuration-options" title="Permalink to this headline">¶</a></h3>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">CMAKE_C_FLAGS</span></code></p>
<p>Specify extra flags to be passed to C compiler invocations. The flags are
also passed to the C++ compiler and linker invocations. See
<a class="reference external" href="https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html">https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html</a></p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">CMAKE_C_COMPILER</span></code></p>
<p>Select the C compiler executable to be used. Note that the C++ compiler is
inferred automatically i.e. when specifying <code class="docutils literal notranslate"><span class="pre">path/to/clang</span></code> CMake will
automatically use <code class="docutils literal notranslate"><span class="pre">path/to/clang++</span></code> as the C++ compiler. See
<a class="reference external" href="https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html">https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html</a></p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">CMAKE_Fortran_COMPILER</span></code></p>
<p>Select the Fortran compiler executable to be used. Not set by default and not
required unless running the Fortran Test Suite.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">CMAKE_BUILD_TYPE</span></code></p>
<p>Select a build type like <code class="docutils literal notranslate"><span class="pre">OPTIMIZE</span></code> or <code class="docutils literal notranslate"><span class="pre">DEBUG</span></code> selecting a set of predefined
compiler flags. These flags are applied regardless of the <code class="docutils literal notranslate"><span class="pre">CMAKE_C_FLAGS</span></code>
option and may be changed by modifying <code class="docutils literal notranslate"><span class="pre">CMAKE_C_FLAGS_OPTIMIZE</span></code> etc. See
<a class="reference external" href="https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html">https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html</a></p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">TEST_SUITE_FORTRAN</span></code></p>
<p>Activate that Fortran tests. This is a work in progress. More information can be
found in the <a class="reference external" href="https://flang.llvm.org/docs/html/FortranLLVMTestSuite.html">Flang documentation</a></p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">TEST_SUITE_RUN_UNDER</span></code></p>
<p>Prefix test invocations with the given tool. This is typically used to run
cross-compiled tests within a simulator tool.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">TEST_SUITE_BENCHMARKING_ONLY</span></code></p>
<p>Disable tests that are unsuitable for performance measurements. The disabled
tests either run for a very short time or are dominated by I/O performance
making them unsuitable as compiler performance tests.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">TEST_SUITE_SUBDIRS</span></code></p>
<p>Semicolon-separated list of directories to include. This can be used to only
build parts of the test-suite or to include external suites. This option
does not work reliably with deeper subdirectories as it skips intermediate
<code class="docutils literal notranslate"><span class="pre">CMakeLists.txt</span></code> files which may be required.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">TEST_SUITE_COLLECT_STATS</span></code></p>
<p>Collect internal LLVM statistics. Appends <code class="docutils literal notranslate"><span class="pre">-save-stats=obj</span></code> when invoking the
compiler and makes the lit runner collect and merge the statistic files.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">TEST_SUITE_RUN_BENCHMARKS</span></code></p>
<p>If this is set to <code class="docutils literal notranslate"><span class="pre">OFF</span></code> then lit will not actually run the tests but just
collect build statistics like compile time and code size.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">TEST_SUITE_USE_PERF</span></code></p>
<p>Use the <code class="docutils literal notranslate"><span class="pre">perf</span></code> tool for time measurement instead of the <code class="docutils literal notranslate"><span class="pre">timeit</span></code> tool that
comes with the test-suite. The <code class="docutils literal notranslate"><span class="pre">perf</span></code> is usually available on linux systems.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">TEST_SUITE_SPEC2000_ROOT</span></code>, <code class="docutils literal notranslate"><span class="pre">TEST_SUITE_SPEC2006_ROOT</span></code>, <code class="docutils literal notranslate"><span class="pre">TEST_SUITE_SPEC2017_ROOT</span></code>, …</p>
<p>Specify installation directories of external benchmark suites. You can find
more information about expected versions or usage in the README files in the
<code class="docutils literal notranslate"><span class="pre">External</span></code> directory (such as <code class="docutils literal notranslate"><span class="pre">External/SPEC/README</span></code>)</p>
</li>
</ul>
</div>
<div class="section" id="common-cmake-flags">
<h3>Common CMake Flags<a class="headerlink" href="#common-cmake-flags" title="Permalink to this headline">¶</a></h3>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">-GNinja</span></code></p>
<p>Generate build files for the ninja build tool.</p>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">-Ctest-suite/cmake/caches/<cachefile.cmake></span></code></p>
<p>Use a CMake cache. The test-suite comes with several CMake caches which
predefine common or tricky build configurations.</p>
</li>
</ul>
</div>
</div>
<div class="section" id="displaying-and-analyzing-results">
<h2>Displaying and Analyzing Results<a class="headerlink" href="#displaying-and-analyzing-results" title="Permalink to this headline">¶</a></h2>
<p>The <code class="docutils literal notranslate"><span class="pre">compare.py</span></code> script displays and compares result files. A result file is
produced when invoking lit with the <code class="docutils literal notranslate"><span class="pre">-o</span> <span class="pre">filename.json</span></code> flag.</p>
<p>Example usage:</p>
<ul>
<li><p>Basic Usage:</p>
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>% test-suite/utils/compare.py baseline.json
Warning: 'test-suite :: External/SPEC/CINT2006/403.gcc/403.gcc.test' has No metrics!
Tests: 508
Metric: exec_time
Program baseline
INT2006/456.hmmer/456.hmmer 1222.90
INT2006/464.h264ref/464.h264ref 928.70
...
baseline
count 506.000000
mean 20.563098
std 111.423325
min 0.003400
25% 0.011200
50% 0.339450
75% 4.067200
max 1222.896800
</pre></div>
</div>
</li>
<li><p>Show compile_time or text segment size metrics:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>% test-suite/utils/compare.py -m compile_time baseline.json
% test-suite/utils/compare.py -m size.__text baseline.json
</pre></div>
</div>
</li>
<li><p>Compare two result files and filter short running tests:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>% test-suite/utils/compare.py --filter-short baseline.json experiment.json
...
Program baseline experiment diff
SingleSour.../Benchmarks/Linpack/linpack-pc <span class="m">5</span>.16 <span class="m">4</span>.30 -16.5%
MultiSourc...erolling-dbl/LoopRerolling-dbl <span class="m">7</span>.01 <span class="m">7</span>.86 <span class="m">12</span>.2%
SingleSour...UnitTests/Vectorizer/gcc-loops <span class="m">3</span>.89 <span class="m">3</span>.54 -9.0%
...
</pre></div>
</div>
</li>
<li><p>Merge multiple baseline and experiment result files by taking the minimum
runtime each:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>% test-suite/utils/compare.py base0.json base1.json base2.json vs exp0.json exp1.json exp2.json
</pre></div>
</div>
</li>
</ul>
<div class="section" id="continuous-tracking-with-lnt">
<h3>Continuous Tracking with LNT<a class="headerlink" href="#continuous-tracking-with-lnt" title="Permalink to this headline">¶</a></h3>
<p>LNT is a set of client and server tools for continuously monitoring
performance. You can find more information at
<a class="reference external" href="https://llvm.org/docs/lnt">https://llvm.org/docs/lnt</a>. The official LNT instance
of the LLVM project is hosted at <a class="reference external" href="http://lnt.llvm.org">http://lnt.llvm.org</a>.</p>
</div>
</div>
<div class="section" id="external-suites">
<h2>External Suites<a class="headerlink" href="#external-suites" title="Permalink to this headline">¶</a></h2>
<p>External suites such as SPEC can be enabled by either</p>
<ul class="simple">
<li><p>placing (or linking) them into the <code class="docutils literal notranslate"><span class="pre">test-suite/test-suite-externals/xxx</span></code> directory (example: <code class="docutils literal notranslate"><span class="pre">test-suite/test-suite-externals/speccpu2000</span></code>)</p></li>
<li><p>using a configuration option such as <code class="docutils literal notranslate"><span class="pre">-D</span> <span class="pre">TEST_SUITE_SPEC2000_ROOT=path/to/speccpu2000</span></code></p></li>
</ul>
<p>You can find further information in the respective README files such as
<code class="docutils literal notranslate"><span class="pre">test-suite/External/SPEC/README</span></code>.</p>
<p>For the SPEC benchmarks you can switch between the <code class="docutils literal notranslate"><span class="pre">test</span></code>, <code class="docutils literal notranslate"><span class="pre">train</span></code> and
<code class="docutils literal notranslate"><span class="pre">ref</span></code> input datasets via the <code class="docutils literal notranslate"><span class="pre">TEST_SUITE_RUN_TYPE</span></code> configuration option.
The <code class="docutils literal notranslate"><span class="pre">train</span></code> dataset is used by default.</p>
</div>
<div class="section" id="custom-suites">
<h2>Custom Suites<a class="headerlink" href="#custom-suites" title="Permalink to this headline">¶</a></h2>
<p>You can build custom suites using the test-suite infrastructure. A custom suite
has a <code class="docutils literal notranslate"><span class="pre">CMakeLists.txt</span></code> file at the top directory. The <code class="docutils literal notranslate"><span class="pre">CMakeLists.txt</span></code> will be
picked up automatically if placed into a subdirectory of the test-suite or when
setting the <code class="docutils literal notranslate"><span class="pre">TEST_SUITE_SUBDIRS</span></code> variable:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>% cmake -DTEST_SUITE_SUBDIRS<span class="o">=</span>path/to/my/benchmark-suite ../test-suite
</pre></div>
</div>
</div>
<div class="section" id="profile-guided-optimization">
<h2>Profile Guided Optimization<a class="headerlink" href="#profile-guided-optimization" title="Permalink to this headline">¶</a></h2>
<p>Profile guided optimization requires to compile and run twice. First the
benchmark should be compiled with profile generation instrumentation enabled
and setup for training data. The lit runner will merge the profile files
using <code class="docutils literal notranslate"><span class="pre">llvm-profdata</span></code> so they can be used by the second compilation run.</p>
<p>Example:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Profile generation run:</span>
% cmake -DTEST_SUITE_PROFILE_GENERATE<span class="o">=</span>ON <span class="se">\</span>
-DTEST_SUITE_RUN_TYPE<span class="o">=</span>train <span class="se">\</span>
../test-suite
% make
% llvm-lit .
<span class="c1"># Use the profile data for compilation and actual benchmark run:</span>
% cmake -DTEST_SUITE_PROFILE_GENERATE<span class="o">=</span>OFF <span class="se">\</span>
-DTEST_SUITE_PROFILE_USE<span class="o">=</span>ON <span class="se">\</span>
-DTEST_SUITE_RUN_TYPE<span class="o">=</span>ref <span class="se">\</span>
.
% make
% llvm-lit -o result.json .
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">TEST_SUITE_RUN_TYPE</span></code> setting only affects the SPEC benchmark suites.</p>
</div>
<div class="section" id="cross-compilation-and-external-devices">
<h2>Cross Compilation and External Devices<a class="headerlink" href="#cross-compilation-and-external-devices" title="Permalink to this headline">¶</a></h2>
<div class="section" id="compilation">
<h3>Compilation<a class="headerlink" href="#compilation" title="Permalink to this headline">¶</a></h3>
<p>CMake allows to cross compile to a different target via toolchain files. More
information can be found here:</p>
<ul class="simple">
<li><p><a class="reference external" href="https://llvm.org/docs/lnt/tests.html#cross-compiling">https://llvm.org/docs/lnt/tests.html#cross-compiling</a></p></li>
<li><p><a class="reference external" href="https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html">https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html</a></p></li>
</ul>
<p>Cross compilation from macOS to iOS is possible with the
<code class="docutils literal notranslate"><span class="pre">test-suite/cmake/caches/target-target-*-iphoneos-internal.cmake</span></code> CMake cache
files; this requires an internal iOS SDK.</p>
</div>
<div class="section" id="running">
<h3>Running<a class="headerlink" href="#running" title="Permalink to this headline">¶</a></h3>
<p>There are two ways to run the tests in a cross compilation setting:</p>
<ul>
<li><p>Via SSH connection to an external device: The <code class="docutils literal notranslate"><span class="pre">TEST_SUITE_REMOTE_HOST</span></code> option
should be set to the SSH hostname. The executables and data files need to be
transferred to the device after compilation. This is typically done via the
<code class="docutils literal notranslate"><span class="pre">rsync</span></code> make target. After this, the lit runner can be used on the host
machine. It will prefix the benchmark and verification command lines with an
<code class="docutils literal notranslate"><span class="pre">ssh</span></code> command.</p>
<p>Example:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>% cmake -G Ninja -D <span class="nv">CMAKE_C_COMPILER</span><span class="o">=</span>path/to/clang <span class="se">\</span>
-C ../test-suite/cmake/caches/target-arm64-iphoneos-internal.cmake <span class="se">\</span>
-D <span class="nv">TEST_SUITE_REMOTE_HOST</span><span class="o">=</span>mydevice <span class="se">\</span>
../test-suite
% ninja
% ninja rsync
% llvm-lit -j1 -o result.json .
</pre></div>
</div>
</li>
<li><p>You can specify a simulator for the target machine with the
<code class="docutils literal notranslate"><span class="pre">TEST_SUITE_RUN_UNDER</span></code> setting. The lit runner will prefix all benchmark
invocations with it.</p></li>
</ul>
</div>
</div>
<div class="section" id="running-the-test-suite-via-lnt">
<h2>Running the test-suite via LNT<a class="headerlink" href="#running-the-test-suite-via-lnt" title="Permalink to this headline">¶</a></h2>
<p>The LNT tool can run the test-suite. Use this when submitting test results to
an LNT instance. See
<a class="reference external" href="https://llvm.org/docs/lnt/tests.html#llvm-cmake-test-suite">https://llvm.org/docs/lnt/tests.html#llvm-cmake-test-suite</a>
for details.</p>
</div>
<div class="section" id="running-the-test-suite-via-makefiles-deprecated">
<h2>Running the test-suite via Makefiles (deprecated)<a class="headerlink" href="#running-the-test-suite-via-makefiles-deprecated" title="Permalink to this headline">¶</a></h2>
<p><strong>Note</strong>: The test-suite comes with a set of Makefiles that are considered
deprecated. They do not support newer testing modes like <code class="docutils literal notranslate"><span class="pre">Bitcode</span></code> or
<code class="docutils literal notranslate"><span class="pre">Microbenchmarks</span></code> and are harder to use.</p>
<p>Old documentation is available in the
<a class="reference internal" href="TestSuiteMakefileGuide.html"><span class="doc">test-suite Makefile Guide</span></a>.</p>
</div>
</div>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="TestSuiteMakefileGuide.html" title="test-suite Makefile Guide (deprecated)"
>next</a> |</li>
<li class="right" >
<a href="TestingGuide.html" title="LLVM Testing Infrastructure Guide"
>previous</a> |</li>
<li><a href="https://llvm.org/">LLVM Home</a> | </li>
<li><a href="index.html">Documentation</a>»</li>
<li class="nav-item nav-item-1"><a href="Reference.html" >Reference</a> »</li>
<li class="nav-item nav-item-2"><a href="TestingGuide.html" >LLVM Testing Infrastructure Guide</a> »</li>
<li class="nav-item nav-item-this"><a href="">test-suite Guide</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2003-2021, LLVM Project.
Last updated on 2021-09-18.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.5.4.
</div>
</body>
</html>
|