-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenColorIO: Add options for SIMD optimization support #26105
base: master
Are you sure you want to change the base?
Changes from all commits
7069e97
4209245
e4c7358
59a4d0a
52ac089
8545826
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,12 +22,36 @@ class OpenColorIOConan(ConanFile): | |
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
"use_sse": [True, False], | ||
|
||
# OCIO supports a number of optimized code paths using different SIMD instruction sets. | ||
# By default it will determin the support of the current platform. A setting of none keeps | ||
# those defaults, True or False will intentionally set the values. | ||
# OCIO_USE_SSE was an option in older versions (< 2.3.2), newer versions support the following | ||
# instruction sets OCIO_USE_SSE2 up to OCIO_USE_AVX512 (no pure SSE anymore). | ||
"use_sse": [None, True, False], | ||
"use_sse2": [None, True, False], | ||
"use_sse3": [None, True, False], | ||
"use_ssse3": [None, True, False], | ||
"use_sse4": [None, True, False], | ||
"use_sse42": [None, True, False], | ||
"use_avx": [None, True, False], | ||
"use_avx2": [None, True, False], | ||
"use_avx512": [None, True, False], | ||
"use_f16c": [None, True, False], | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True, | ||
"use_sse": True, | ||
"use_sse": None, | ||
"use_sse2": None, | ||
"use_sse3": None, | ||
"use_ssse3": None, | ||
"use_sse4": None, | ||
"use_sse42": None, | ||
"use_avx": None, | ||
"use_avx2": None, | ||
"use_avx512": None, | ||
"use_f16c": None, | ||
} | ||
|
||
def export_sources(self): | ||
|
@@ -36,8 +60,9 @@ def export_sources(self): | |
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
if self.settings.arch not in ["x86", "x86_64"]: | ||
del self.options.use_sse | ||
# Reproduce the previous default which was injected instead of letting it be determined | ||
if self.options.get_safe("use_sse", None) == None: | ||
self.options.use_sse = self.settings.arch in ["x86", "x86_64"] | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
|
@@ -117,7 +142,37 @@ def generate(self): | |
tc.variables["TINYXML_OBJECT_LIB_EMBEDDED"] = False | ||
tc.variables["USE_EXTERNAL_LCMS"] = True | ||
|
||
tc.variables["OCIO_USE_SSE"] = self.options.get_safe("use_sse", False) | ||
# Selection of SIMD Instruction sets | ||
if not self.options.get_safe("use_sse", None) == None: | ||
print('Set OCIO_USE_SSE to ', self.options.use_sse) | ||
tc.variables["OCIO_USE_SSE"] = self.options.use_sse | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This specific OCIO_USE_SSE I don't see it in https://github.com/AcademySoftwareFoundation/OpenColorIO/blob/6fa40a4f6c3f0dd9f52f2476c3279927d5f23d71/CMakeLists.txt#L263, sure it exists? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It exists in older release, https://github.com/AcademySoftwareFoundation/OpenColorIO/blob/2.1.1/CMakeLists.txt#L148 |
||
if not self.options.get_safe("use_sse2", None) == None: | ||
print('Set OCIO_USE_SSE2 to ', self.options.use_sse2) | ||
tc.variables["OCIO_USE_SSE2"] = self.options.use_sse2 | ||
if not self.options.get_safe("use_sse3", None) == None: | ||
print('Set OCIO_USE_SSE3 to ', self.options.use_sse3) | ||
tc.variables["OCIO_USE_SSE3"] = self.options.use_sse3 | ||
if not self.options.get_safe("use_ssse3", None) == None: | ||
print('Set OCIO_USE_SSSE3 to ', self.options.use_ssse3) | ||
tc.variables["OCIO_USE_SSSE3"] = self.options.use_ssse3 | ||
if not self.options.get_safe("use_sse4", None) == None: | ||
print('Set OCIO_USE_SSE4 to ', self.options.use_sse4) | ||
tc.variables["OCIO_USE_SSE4"] = self.options.use_sse4 | ||
if not self.options.get_safe("use_sse42", None) == None: | ||
print('Set OCIO_USE_SSE42 to ', self.options.use_sse42) | ||
tc.variables["OCIO_USE_SSE42"] = self.options.use_sse42 | ||
if not self.options.get_safe("use_avx", None) == None: | ||
print('Set OCIO_USE_AVX to ', self.options.use_avx) | ||
tc.variables["OCIO_USE_AVX"] = self.options.use_avx | ||
if not self.options.get_safe("use_avx2", None) == None: | ||
print('Set OCIO_USE_AVX2 to ', self.options.use_avx2) | ||
tc.variables["OCIO_USE_AVX2"] = self.options.use_avx2 | ||
if not self.options.get_safe("use_avx512", None) == None: | ||
print('Set OCIO_USE_AVX512 to ', self.options.use_avx512) | ||
tc.variables["OCIO_USE_AVX512"] = self.options.use_avx512 | ||
if not self.options.get_safe("use_f16c", None) == None: | ||
print('Set OCIO_USE_F16C to ', self.options.use_f16c) | ||
tc.variables["OCIO_USE_F16C"] = self.options.use_f16c | ||
|
||
# openexr 2.x provides Half library | ||
tc.variables["OCIO_USE_OPENEXR_HALF"] = True | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
print()
must be removed before merging. The ways to display information in recipes is viaself.output.info/verbose/warning/..
, but it seems this wouldn't be necessary, I'd remove the prints.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It sounds like this logic could be done in a for-loop in a more compact way.