• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Vulkan CTS README
2=================
3
4This document describes how to build and run Vulkan Conformance Test suite.
5
6Vulkan CTS is built on dEQP framework. dEQP documentation is available
7at http://source.android.com/devices/graphics/testing.html
8
9
10Requirements
11------------
12
13### Common
14
15The following tools must be installed and present in the PATH variable:
16
17 * Git (for checking out sources)
18 * Python 2.7.x (all recent versions in 2.x should work, 3.x is not supported)
19 * CMake 2.8 (3.6 for Android NDK r15+ builds) or newer
20
21### Win32
22
23 * Visual Studio 2013 or newer (glslang uses several C++11 features)
24
25### Linux
26
27 * Standard toolchain (make, gcc/clang)
28
29### Android
30
31 * Android NDK r15c or later.
32 * Android SDK with: SDK Tools, SDK Platform-tools, SDK Build-tools, and API 22 (API 26 for Android 8.x, API 28 for Android 9.x)
33 * Java Development Kit (JDK)
34 * Windows: either NMake or Ninja in PATH
35
36If you have downloaded Android SDK tools, you can install necessary components
37by running:
38
39	tools/android update sdk --no-ui --all --filter tools,platform-tools,build-tools-25.0.2,android-22
40
41
42Building CTS
43------------
44
45To build dEQP, you need first to download sources for zlib, libpng, glslang,
46spirv-headers, and spirv-tools.
47
48To download sources, run:
49
50	python external/fetch_sources.py
51
52You may need to re-run `fetch_sources.py` to update to the latest glslang and
53spirv-tools revisions occasionally.
54
55With CMake out-of-source builds are always recommended. Create a build directory
56of your choosing, and in that directory generate Makefiles or IDE project
57using cmake.
58
59
60### Windows x86-32
61
62	cmake <path to vulkancts> -G"Visual Studio 12"
63	start dEQP-Core-default.sln
64
65### Windows x86-64
66
67	cmake <path to vulkancts> -G"Visual Studio 12 Win64"
68	start dEQP-Core-default.sln
69
70### Linux 32-bit Debug
71
72	cmake <path to vulkancts> -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32
73	make -j
74
75Release build can be done by using -DCMAKE_BUILD_TYPE=Release
76
77### Linux 64-bit Debug
78
79	cmake <path to vulkancts> -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=-m64 -DCMAKE_CXX_FLAGS=-m64
80	make -j
81
82### Android
83
84Following command will build dEQP.apk:
85
86	python scripts/android/build_apk.py --sdk <path to Android SDK> --ndk <path to Android NDK>
87
88By default the CTS package will be built for the Android API level 21 (Android 5.0 and above).
89Another API level may be supplied using --native-api command line option.
90
91Additional requirements for implementations supporting VK\_ANDROID\_external\_memory\_android\_hardware_buffer:
92
93- For Android 8.x builds the API level must be selected to >= 26 (i.e --native-api=26)
94- For Android 9.x builds the API level must be selected to >= 28 (i.e --native-api=28)
95
96The package can be installed by either running:
97
98	python scripts/android/install_apk.py
99
100By default the CTS package will contain libdeqp.so built for armeabi-v7a, arm64-v8a,
101x86, and x86_64 ABIs, but that can be changed using --abis command line option.
102
103To pick which ABI to use at install time, following commands must be used
104instead:
105
106	adb install --abi <ABI name> <build-root>/package/dEQP.apk /data/local/tmp/dEQP-debug.apk
107
108
109Building Mustpass
110-----------------
111
112Current mustpass is checked into repository and can be found at:
113
114	external/vulkancts/mustpass/1.1.3/vk-default.txt
115
116Vulkan CTS mustpass can be re-generated by running:
117
118	python <vulkancts>/external/vulkancts/scripts/build_mustpass.py
119
120
121Pre-compiling SPIR-V binaries
122-----------------------------
123
124For distribution, and platforms that don't support GLSL to SPIR-V compilation,
125SPIR-V binaries can be pre-built with following command:
126
127	python external/vulkancts/scripts/build_spirv_binaries.py
128
129By default the script builds SPIR-V binaries for Vulkan 1.1.
130Binaries for other Vulkan versions can be requested by supplying
131an extra command line option:
132
133	python external/vulkancts/scripts/build_spirv_binaries.py --target-vulkan-version <Vulkan version>
134
135Binaries will be written to `external/vulkancts/data/vulkan/prebuilt/`.
136
137Test modules (or in case of Android, the APK) must be re-built after building
138SPIR-V programs in order for the binaries to be available.
139
140
141Running CTS
142-----------
143
144Following command line options MUST be used when running CTS:
145
146	--deqp-caselist-file=<vulkancts>/external/vulkancts/mustpass/1.1.3/vk-default.txt
147	--deqp-log-images=disable
148	--deqp-log-shader-sources=disable
149
150In addition on multi-device systems the device for which conformance is claimed
151can be selected with:
152
153	--deqp-vk-device-id=<value>
154
155To speed up the conformance run on some platforms the following command line
156option may be used to disable frequent fflush() calls to the output logs:
157
158	--deqp-log-flush=disable
159
160By default, the test log will be written into the path "TestResults.qpa". If the
161platform requires a different path, it can be specified with:
162
163	--deqp-log-filename=<path>
164
165By default, the shader cache will be written into the path "shadercache.bin". If the
166platform requires a different path, it can be specified with:
167
168	--deqp-shadercache-filename=<path>
169
170If the shader cache is not desired, it can be disabled with:
171
172	--deqp-shadercache=disable
173
174No other command line options are allowed.
175
176### Win32
177
178	cd <builddir>/external/vulkancts/modules/vulkan
179	Debug/deqp-vk.exe --deqp-caselist-file=...
180
181Test log will be written into TestResults.qpa
182
183### Linux
184
185	cd <builddir>/external/vulkancts/modules/vulkan
186	./deqp-vk --deqp-vk-caselist-file=...
187
188### Android
189
190	adb push <vulkancts>/external/vulkancts/mustpass/1.1.3/vk-default.txt /sdcard/vk-default.txt
191	adb shell
192
193In device shell:
194
195	am start -n com.drawelements.deqp/android.app.NativeActivity -e cmdLine "deqp --deqp-caselist-file=/sdcard/vk-default.txt --deqp-log-images=disable --deqp-log-shader-sources=disable --deqp-log-filename=/sdcard/TestResults.qpa"
196
197Test progress will be written to device log and can be displayed with:
198
199	adb logcat -s dEQP
200
201Test log will be written into `/sdcard/TestResults.qpa`.
202
203
204Conformance Submission Package Requirements
205-------------------------------------------
206
207The conformance submission package must contain the following:
208
2091. Full test logs (`TestResults.qpa`) from CTS runs against all driver builds
2102. Result of `git status` and `git log` from CTS source directory
2113. Any patches used on top of release tag
2124. Conformance statement
213
214Test logs (1) should be named `<submission pkg dir>/TestResults-<driver build type>.qpa`,
215for example `TestResults-armeabi-v7a.qpa`. On platforms where multiple different driver
216builds (for example 64-bit and 32-bit) are present, CTS logs must be provided
217for each driver build as part of the submission package.
218
219Test logs generated on a system which exposes more than one physical device
220in a device group can be used for products that expose one or more physical
221devices in their device group.
222
223The CTS build must always be done from clean git repository that doesn't have any
224uncommitted changes. Thus it is necessary to run and capture output of `git
225status` and `git log` (2) in the source directory:
226
227	git status > <submission pkg dir>/git-status.txt
228	git log --first-parent <release tag>^..HEAD > <submission pkg dir>/git-log.txt
229
230Any changes made to CTS must be committed to the local repository, and provided
231as part of the submission package (3). This can be done by running:
232
233	git format-patch -o <submission pkg dir> <release tag>..HEAD
234
235In general, bugfixes and changes to platform-specific code (mostly under
236`framework/platform`) are allowed. The commit message for each change must
237include a clear description of the change and why it is necessary. Non-porting
238related changes must be accompanied by a waiver (see below).
239
240NOTE: When cherry-picking patches on top of release tag, please use `git cherry-pick -x`
241to include original commit hash in the commit message.
242
243Conformance statement (4) must be included in a file called `STATEMENT-<adopter>`
244and must contain following:
245
246	CONFORM_VERSION:         <git tag of CTS release>
247	PRODUCT:                 <string-value>
248	CPU:                     <string-value>
249	OS:                      <string-value>
250
251Note that product/cpu/os information is also captured in `dEQP-VK.info.*` tests
252if `vk::Platform::describePlatform()` is implemented.
253
254If the submission package covers multiple products, you can list them by appending
255additional `PRODUCT:` lines to the conformance statement. For example:
256
257	CONFORM_VERSION:         vulkan-cts-1.1.3.0
258	PRODUCT:                 Product A
259	PRODUCT:                 Product B
260	...
261
262The actual submission package consists of the above set of files which must
263be bundled into a gzipped tar file named `VK<API major><API minor>_<adopter><_info>.tgz`.
264`<API major>` is the major version of the Vulkan API specification, `<API minor>`is the minor
265version of the Vulkan API specification.
266`<adopter>` is the name of the Adopting member company, or some recognizable abbreviation.
267The `<_info>` field is optional. It may be used to uniquely identify a submission
268by OS, platform, date, or other criteria when making multiple submissions.
269For example, a company XYZ may make a submission for a Vulkan 1.1 implementation named
270`VK11_XYZ_PRODUCTA_Windows10.tgz`
271
272One way to create a suiteable gzipped tar file is to execute the command:
273
274	tar -cvzf <filename.tgz> -C <submission pkg dir> .
275
276where `<submission pkg dir>` is the directory containing the files from (1)-(4)
277from above. A submission package must contain all of the files listed above,
278and only those files.
279
280As an example submission package could contain:
281
282	STATEMENT-Khronos
283	git-log.txt
284	git-status.txt
285	0001-Remove-Waived-Filtering-Tests.patch
286	0002-Fix-Pipeline-Parameters.patch
287	TestResults-armeabi-v7a.qpa
288	TestResults-arm64-v8a.qpa
289
290
291Waivers
292-------
293
294The process for requesting a waiver is to report the issue by filing a bug
295report in the Gitlab VulkanCTS project (TODO Github?). When creating the
296submission package, include references to the waiver in the commit message of
297the relevant change. Including as much information as possible in your bug
298report (including a unified diff or a merge request of suggested file changes)
299will ensure the issue can be progressed as rapidly as possible. Issues must
300be labeled "Waiver" (TODO!) and identify the version of the CTS and affected
301tests.
302
303Conformance Criteria
304--------------------
305
306Conformance run is considered passing if all tests finish with allowed result
307codes. Test results are contained in the TestResults.qpa log. Each
308test case section contains XML tag Result, for example:
309
310	<Result StatusCode="Pass">Not validated</Result>
311
312The result code is the value of the StatusCode attribute. Following status
313codes are allowed:
314
315	Pass
316	NotSupported
317	QualityWarning
318	CompatibilityWarning
319
320Submission package can be verified using `external/vulkancts/scripts/verify_submission.py`
321script. The script takes two arguments: path to extracted submission package
322and path to current mustpass list. For example:
323
324	python external/vulkancts/scripts/verify_submission.py VK_11_Khronos_1/ external/vulkancts/mustpass/1.1.3/vk-default.txt
325
326Please note that the script reports a warning even for a correctly generated git-log.txt
327If your git-log.txt contains only head commit of the release tag then
328the warning can be ignored.
329
330Vulkan platform port
331--------------------
332
333Vulkan support from Platform implementation requires providing
334`getVulkanPlatform()` method in `tcu::Platform` class implementation.
335
336See `framework/common/tcuPlatform.hpp` and examples in
337`framework/platform/win32/tcuWin32Platform.cpp` and
338`framework/platform/android/tcuAndroidPlatform.cpp`.
339
340If any WSI extensions are supported, platform port must also implement
341methods for creating native display (`vk::Platform::createWsiDisplay`)
342and window handles (`vk::wsi::Display::createWindow`). Otherwise tests
343under `dEQP-VK.wsi` will fail.
344
345
346Null (dummy) driver
347-------------------
348
349For testing and development purposes it might be useful to be able to run
350tests on dummy Vulkan implementation. One such implementation is provided in
351vkNullDriver.cpp. To use that, implement `vk::Platform::createLibrary()` with
352`vk::createNullDriver()`.
353
354
355Validation Layers
356-----------------
357
358Vulkan CTS framework includes first-party support for validation layers, that
359can be turned on with `--deqp-validation=enable` command line option.
360
361When validation is turned on, default instance and device will be created with
362validation layers enabled and debug callback is registered to record any
363messages. Debug messages collected during test execution will be included at
364the end of the test case log.
365
366If any validation errors are found, test result will be set to `InternalError`.
367
368By default `VK_DEBUG_REPORT_INFORMATION_BIT_EXT` and `_DEBUG_BIT_EXT` messages
369are excluded from the log, but that can be customized by modifying
370`vkt::TestCaseExecutor::deinit()` in `vktTestPackage.cpp`.
371
372On the Android target, layers can be added to the APK during the build process
373by setting the `--layers-path` command line option to point into the NDK or to
374a locally-built layers tree. The layers are expected to be found under $abi/
375under the layers path.
376
377
378Cherry GUI
379----------
380
381Vulkan test module can be used with Cherry (GUI for test execution and
382analysis). Cherry is available at
383https://android.googlesource.com/platform/external/cherry. Please follow
384instructions in README to get started.
385
386Before first launch, and every time test hierarchy has been modified, test
387case list must be refreshed by running:
388
389	python scripts/build_caselists.py path/to/cherry/data
390
391Cherry must be restarted for the case list update to take effect.
392
393
394Shader Optimizer
395----------------
396
397Vulkan CTS can be optionally run with the shader optimizer enabled. This
398is an experimental feature which can be used to further stress both the
399drivers as well as the optimizer itself. The shader optimizer is disabled
400by default.
401
402The following command line options can be used to configure the shader
403optimizer:
404
405	--deqp-optimization-recipe=<number>
406
407The list of the optimization recipes can be found and customized in the
408`optimizeCompiledBinary()` function in `vkPrograms.cpp`.
409
410As of this writing, there are 8 recipes to choose from:
411
412	0. Disabled (default)
413	1. The example recipe from spir-v opt 1.0 whitepaper
414	2. RegisterPerformancePasses from commandline optimizer tool october 2017
415	3. RegisterSizePasses from commandline optimizer tool october 2017
416	4. RegisterLegalizationPasses from commandline optimizer tool April 2018
417	5. RegisterPerformancePasses from commandline optimizer tool April 2018
418	6. RegisterPerformancePasses from commandline optimizer tool April 2018 with CreateCommonUniformElimPass
419	7. RegisterSizePasses from commandline optimizer tool April 2018
420	8. RegisterSizePasses from commandline optimizer tool April 2018 with CreateCommonUniformElimPass
421
422The `Register...Passes()` calls change in the SPIR-V optimizer tool from
423time to time. Since different sets of passes may result in different
424shaders, having several fixed sets is useful for issue discovery.
425
426	--deqp-optimize-spirv=enable
427
428This option is not required to run the optimizer. By default, the shader
429optimizer only optimizes shaders generated from GLSL or HLSL, and leaves
430hand-written SPIR-V shaders alone.
431
432Many of the hand-written SPIR-V tests stress specific features of the
433SPIR-V which might get optimized out. Using this option will enable the
434optimizer on the hand-written SPIR-V as well, which may be useful in
435finding new bugs in drivers or the optimizer itself, but will likely
436invalidate the tests themselves.
437
438
439Shader Cache
440------------
441
442The Vulkan CTS framework contains a shader cache for speeding up the running
443of the CTS. Skipping shader compilation can significantly reduce runtime,
444especially for repeated runs.
445
446Default behavior is to have the shader cache enabled, but truncated at the
447start of the CTS run. This still gives the benefit of skipping shader
448compilation for identical shaders in different tests (which there are many),
449while making sure that the shader cache file does not grow indefinitely.
450
451The shader cache identifies the shaders by hashing the shader source code
452along with various bits of information that may affect the shader compilation
453(such as shader stage, CTS version, possible compilation flags, etc). If a
454cached shader with matching hash is found, a byte-by-byte comparison of the
455shader sources is made to make sure that the correct shader is being
456retrieved from the cache.
457
458The behavior of the shader cache can be modified with the following command
459line options:
460
461	--deqp-shadercache=disable
462
463Disable the shader cache. All shaders will be compiled every time.
464
465	--deqp-shadercache-filename=<filename>
466
467Set the name of the file where the cached shaders will be stored. This
468option may be required for the shader cache to work at all on Android
469targets.
470
471	--deqp-shadercache-truncate=disable
472
473Do not truncate the shader cache file at startup. No shader compilation will
474occur on repeated runs of the CTS.
475
476
477RenderDoc
478---------
479The RenderDoc (https://renderdoc.org/) graphics debugger may be used to debug
480Vulkan tests.
481
482Following command line option should be used when launching tests from
483RenderDoc UI:
484
485	--deqp-renderdoc=enable
486
487This causes the framework to interface with the debugger and mark each dEQP
488test case as a separate 'frame', just for the purpose of capturing. The frames
489are added using RenderDoc 'In-Application API', instead of swapchain operations.
490