Add -qt3d-simd option to enable SIMD instructions

The SSE2 SIMD option is enabled by default if the respective
qtbase feature is enabled. In this sense, this is an opt-out
feature. The SIMD instructions can also be extended to take
advantage of AVX2 instructions by passing -qt3d-simd avx2.
The use of SIMD instructions in Qt 3D can be disabled entirely
with -qt3d-simd no.

Note that these options *force* the use of SIMD instructions.
This differs in semantics from the qtbase configure options for
SIMD. In qtbase, there is also a runtime check on CPU capabilities
before using SIMD instructions (except SSE2 on x86 or x86_64).
Profiling in Qt 3D found that such function pointer indirection
totally negated any performance gains. Therefore, given the need
to choose this at compile time, this commit introduces a new
option with these semantics.

[ChangeLog][Qt3DCore][General] Added support for SIMD instructions
to accelerate matrix and vector operations within Qt 3D. At
present, SSE2 and AVX2 are supported. By default, SSE2
instructions are enabled. To additionally enable the use of AVX2
instructions, configure with the -qt3d-simd avx2 option. Passing
-no-sse2 disables SSE2 use in QtCore, QtGui and Qt3D. Configuring
with -no-qt3d-simd disables SIMD in Qt 3D only.

Change-Id: Ifcc05004f39a420aa578c3e09d1236dea1fb1990
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This commit is contained in:
Paul Lemire 2017-03-08 15:59:49 +01:00 committed by Paul Lemire
parent 3da85ccec3
commit 8227e3c9f1
2 changed files with 21 additions and 1 deletions

View File

@ -3,6 +3,7 @@ Qt3D options:
-assimp .............. Select used assimp library [system/qt/no]
-qt3d-profile-jobs ... Enable jobs profiling [no]
-qt3d-profile-gl ..... Enable OpenGL profiling [no]
-qt3d-simd ........... Select level of SIMD support [no/sse2/avx2]
-qt3d-render ......... Enable the Qt3D Render aspect [yes]
-qt3d-input .......... Enable the Qt3D Input aspect [yes]
-qt3d-logic .......... Enable the Qt3D Logic aspect [yes]

View File

@ -11,7 +11,8 @@
"qt3d-input": "boolean",
"qt3d-logic": "boolean",
"qt3d-extras": "boolean",
"qt3d-animation": "boolean"
"qt3d-animation": "boolean",
"qt3d-simd": { "type": "optionalString", "values": [ "no", "sse2", "avx2" ] }
}
},
@ -79,6 +80,22 @@
"section": "Aspects",
"condition": "features.qt3d-render",
"output": [ "publicFeature" ]
},
"qt3d-simd-sse2": {
"label": "Use SSE2 instructions",
"purpose": "Use SSE2 SIMD instructions to accelerate matrix operations",
"autoDetect": "features.sse2",
"enable": "input.qt3d-simd == 'sse2' || input.qt3d-simd == 'avx2'",
"disable": "input.qt3d-simd == 'no'",
"output": [ "privateFeature" ]
},
"qt3d-simd-avx2": {
"label": "Use AVX2 instructions",
"purpose": "Use AVX2 SIMD instructions to accelerate matrix operations",
"autoDetect": false,
"enable": "input.qt3d-simd == 'avx2'",
"disable": "input.qt3d-simd == 'sse2' || input.qt3d-simd == 'no'",
"output": [ "privateFeature" ]
}
},
@ -93,6 +110,8 @@
"system-assimp",
"qt3d-profile-jobs",
"qt3d-profile-gl",
"qt3d-simd-sse2",
"qt3d-simd-avx2",
{
"section": "Aspects",
"entries": [