Skip to content

Commit 5ba2145

Browse files
committed
Additions from LG:
* Make cmake option OIIO_USE_HWY able to be overridden by end (by using `set_option()`) * Let env variable OPENIMAGEIO_ENABLE_HWY override runtime hwy enabling. (It was documented to do so, but not yet implemented.) * Clarify that hwy support will be added for 3.2, not 3.1. And that for right now, it defaults to OFF until we have worked out all the bugs and gain more confidence in it. The intention is for it to be enabled by default in time for the release of OIIO 3.2. * When hwy is disabled at build time, don't allow attribute() to appear to enable it. Signed-off-by: Larry Gritz <lg@larrygritz.com>
1 parent 252edbb commit 5ba2145

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ else ()
112112
endif ()
113113
option (${PROJ_NAME}_BUILD_TOOLS "Build the command-line tools" ON)
114114
option (${PROJ_NAME}_BUILD_TESTS "Build the unit tests" ON)
115-
option (OIIO_USE_HWY "Enable experimental Google Highway SIMD optimizations (if Highway is available)" OFF)
115+
set_option (OIIO_USE_HWY "Enable experimental Google Highway SIMD optimizations (if Highway is available)" OFF)
116116
set (OIIO_LIBNAME_SUFFIX "" CACHE STRING
117117
"Optional name appended to ${PROJECT_NAME} libraries that are built")
118118
option (BUILD_OIIOUTIL_ONLY "If ON, will build *only* libOpenImageIO_Util" OFF)

src/doc/imageioapi.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,10 @@ inside the source code.
378378
image formats (uint8, uint16, int8, int16, uint32, int32, etc.) and provide
379379
additional speedup for scale-invariant operations (add, sub, min, max,
380380
absdiff) that can operate directly on integer data without float conversion.
381-
(This was added in OpenImageIO 3.1.)
381+
382+
This was added in OpenImageIO 3.2.
383+
384+
NOTE: This is currently disabled by default while we are testing!
382385

383386
.. cpp:var:: OPENIMAGEIO_PYTHON_LOAD_DLLS_FROM_PATH
384387

src/libOpenImageIO/imageio.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ int png_linear_premult(0);
5353
int tiff_half(0);
5454
int tiff_multithread(1);
5555
int dds_bc5normal(0);
56-
int enable_hwy(1); // Enable Google Highway SIMD optimizations by default
56+
#if OIIO_USE_HWY
57+
// hwy enabled at build time, but allow env var to override at runtime While
58+
// we're still testing, default to disabled. We intend to change the default
59+
// to be enabled in time for the release of 3.2.
60+
int enable_hwy = Strutil::stoi(Sysutil::getenv("OPENIMAGEIO_ENABLE_HWY", "0"));
61+
#else
62+
int enable_hwy = 0; // Not enabled at build time
63+
#endif
5764
int limit_channels(1024);
5865
int limit_imagesize_MB(std::min(32 * 1024,
5966
int(Sysutil::physical_memory() >> 20)));
@@ -407,7 +414,9 @@ attribute(string_view name, TypeDesc type, const void* val)
407414
return true;
408415
}
409416
if (name == "enable_hwy" && type == TypeInt) {
417+
#if OIIO_USE_HWY
410418
enable_hwy = *(const int*)val;
419+
#endif
411420
return true;
412421
}
413422
if (name == "limits:channels" && type == TypeInt) {

0 commit comments

Comments
 (0)