Skip to content

Commit 8348da2

Browse files
authored
Merge pull request #2065 from Idclip/ax_backend_upgrade
AX backend restructure for LLVM opaque ptr support (LLVM 16+)
2 parents 7ebe25f + 286a197 commit 8348da2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+8157
-4294
lines changed

.github/workflows/ax.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,21 @@ jobs:
6666
strategy:
6767
matrix:
6868
# Only test unified builds (core+ax). weekly CI should test standalone
69+
# @note LLVM 17 builds are incompatible with the vdb python plugin on linux
6970
config:
71+
- { image: '2025-clang19', cxx: 'clang++', build: 'Release', cmake: '' }
72+
- { image: '2025-clang19', cxx: 'g++', build: 'Release', cmake: '' }
73+
- { image: '2025-clang19', cxx: 'clang++', build: 'Debug', cmake: '' }
74+
- { image: '2025-clang18', cxx: 'clang++', build: 'Release', cmake: '' }
75+
- { image: '2024-clang17', cxx: 'clang++', build: 'Release', cmake: '-DOPENVDB_PYTHON_USE_AX=OFF' }
76+
- { image: '2024-clang16', cxx: 'clang++', build: 'Release', cmake: '' }
7077
- { image: '2023-clang15', cxx: 'clang++', build: 'Release', cmake: '' }
7178
- { image: '2023-clang15', cxx: 'g++', build: 'Release', cmake: '' }
72-
- { image: '2023-clang15', cxx: 'clang++', build: 'Debug', cmake: '' }
7379
fail-fast: false
7480
steps:
7581
- uses: actions/checkout@v3
7682
- name: nanobind
77-
#if: contains(matrix.config.image, '2023') == false
7883
run: ./ci/install_nanobind.sh 2.0.0
79-
- name: install_gtest
80-
run: ./ci/install_gtest.sh 1.15.2
8184
- name: timestamp
8285
id: timestamp
8386
run: echo "timestamp=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
@@ -94,12 +97,11 @@ jobs:
9497
run: >
9598
./ci/build.sh -v
9699
--build-type=${{ matrix.config.build }}
97-
--components='core,python,bin,axcore,axbin,axtest'
100+
--components='core,python,axcore,axbin,axtest'
98101
--cargs=\"
99102
${{ matrix.config.cmake }}
100103
-DOPENVDB_AX_TEST_CMD_DOWNLOADS=ON
101104
-DUSE_EXPLICIT_INSTANTIATION=OFF
102-
-DOPENVDB_CXX_STRICT=ON
103105
\"
104106
- name: test
105107
run: cd build && ctest -V
@@ -123,8 +125,12 @@ jobs:
123125
matrix:
124126
config:
125127
# Last macos runner before M1 (macos-14)
128+
- { runner: 'macos-13', cxx: 'clang++', build: 'Release', llvm: '20' }
129+
- { runner: 'macos-13', cxx: 'clang++', build: 'Release', llvm: '19' }
130+
- { runner: 'macos-13', cxx: 'clang++', build: 'Release', llvm: '18' }
131+
- { runner: 'macos-13', cxx: 'clang++', build: 'Release', llvm: '17' }
132+
- { runner: 'macos-13', cxx: 'clang++', build: 'Release', llvm: '16' }
126133
- { runner: 'macos-13', cxx: 'clang++', build: 'Release', llvm: '15' }
127-
- { runner: 'macos-13', cxx: 'clang++', build: 'Release', llvm: '13' }
128134
fail-fast: false
129135
steps:
130136
- uses: actions/checkout@v3
@@ -136,7 +142,7 @@ jobs:
136142
run: >
137143
./ci/build.sh -v
138144
--build-type=${{ matrix.config.build }}
139-
--components="core,python,bin,axcore,axbin,axtest"
145+
--components="core,python,axcore,axbin,axtest"
140146
--cargs=\"
141147
-DOPENVDB_AX_TEST_CMD_DOWNLOADS=ON
142148
-DUSE_EXPLICIT_INSTANTIATION=OFF

.github/workflows/weekly.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ jobs:
295295
matrix:
296296
config:
297297
# Unified
298-
- { image: '2023-clang15', cxx: 'clang++', build: 'Release', components: 'core,bin,axcore,axbin,axtest', cmake: '' }
299-
- { image: '2023-clang15', cxx: 'g++', build: 'Release', components: 'core,bin,axcore,axbin,axtest', cmake: '' }
298+
- { image: '2025-clang19', cxx: 'clang++', build: 'Release', components: 'core,axcore,axbin,axtest', cmake: '' }
299+
- { image: '2025-clang19', cxx: 'g++', build: 'Release', components: 'core,axcore,axbin,axtest', cmake: '' }
300300
fail-fast: false
301301
steps:
302302
- uses: actions/checkout@v3
@@ -378,7 +378,7 @@ jobs:
378378
github.event.inputs.type == 'all' ||
379379
github.event.inputs.type == 'ax'
380380
runs-on: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'windows-2022-8c-32g-300h') || 'windows-latest' }}
381-
name: windows-vc:${{ matrix.config.vc }}-type:${{ matrix.config.build }}
381+
name: ${{ matrix.config.vc }}-${{ matrix.config.crt }}-${{ matrix.config.build }}-llvm${{ matrix.config.llvm }}
382382
env:
383383
VCPKG_DEFAULT_TRIPLET: ${{ matrix.config.vc }}
384384
# Export this with '' avoid bash treating \ as escape
@@ -392,28 +392,36 @@ jobs:
392392
# @todo We don't currently run the axtests with shared builds of ax
393393
# due to symbol issues using LLVM as a static lib (which is the only
394394
# option on Windows).
395-
- { vc: 'x64-windows', crt: 'MD', components: 'core,bin,axcore,axbin,python', build: 'Release', cmake: '-DOPENVDB_CORE_STATIC=OFF -DOPENVDB_AX_STATIC=OFF' }
396-
- { vc: 'x64-windows-static', crt: 'MT', components: 'core,bin,axcore,axbin,axtest', build: 'Release', cmake: '-DOPENVDB_CORE_SHARED=OFF -DOPENVDB_AX_SHARED=OFF -DUSE_STATIC_DEPENDENCIES=ON -DBLOSC_USE_EXTERNAL_SOURCES=ON' }
397-
- { vc: 'x64-windows-static', crt: 'MTd', components: 'core,bin,axcore,axbin,axtest', build: 'Debug', cmake: '-DOPENVDB_CORE_SHARED=OFF -DOPENVDB_AX_SHARED=OFF -DUSE_STATIC_DEPENDENCIES=ON -DBLOSC_USE_EXTERNAL_SOURCES=ON' }
395+
# @note currently only test static builds with MT as building LLVM as
396+
# a shared lib on windows is a bit dicey
397+
- { vc: 'x64-windows-static', llvm: '18.1.0', crt: 'MultiThreaded', components: 'core,axcore,axbin,axtest', build: 'Release', cmake: '-DOPENVDB_CORE_SHARED=OFF -DOPENVDB_AX_SHARED=OFF -DUSE_STATIC_DEPENDENCIES=ON -DBLOSC_USE_EXTERNAL_SOURCES=ON' }
398+
- { vc: 'x64-windows-static', llvm: '18.1.0', crt: 'MultiThreadedDebug', components: 'core,axcore,axbin,axtest', build: 'Debug', cmake: '-DOPENVDB_CORE_SHARED=OFF -DOPENVDB_AX_SHARED=OFF -DUSE_STATIC_DEPENDENCIES=ON -DBLOSC_USE_EXTERNAL_SOURCES=ON' }
399+
- { vc: 'x64-windows', llvm: '18.1.0', crt: 'MultiThreadedDLL', components: 'core,axcore,axbin', build: 'Release', cmake: '-DOPENVDB_CORE_STATIC=OFF -DOPENVDB_AX_STATIC=OFF' }
400+
- { vc: 'x64-windows-static', llvm: '15.0.0', crt: 'MultiThreaded', components: 'core,axcore,axbin,axtest', build: 'Release', cmake: '-DOPENVDB_CORE_SHARED=OFF -DOPENVDB_AX_SHARED=OFF -DUSE_STATIC_DEPENDENCIES=ON -DBLOSC_USE_EXTERNAL_SOURCES=ON' }
398401
fail-fast: false
399402
steps:
400403
- uses: actions/checkout@v3
401404
- name: llvm
402-
run: ./ci/install_llvm_windows.sh ${{ matrix.config.crt }}
405+
run: ./ci/install_llvm_windows.sh ${{ matrix.config.llvm }} ${{ matrix.config.crt }}
403406
- name: install
404407
shell: powershell
405-
run: .\ci\install_windows.ps1
408+
run: |
409+
vcpkg update
410+
vcpkg install tbb cppunit
406411
- name: build
407412
run: >
408413
./ci/build.sh -v
409414
--config=${{ matrix.config.build }}
410415
--components="${{ matrix.config.components }}"
411416
--cargs=\'
412417
-A x64 -G \"Visual Studio 17 2022\"
418+
-DOPENVDB_USE_DELAYED_LOADING=OFF
419+
-DUSE_BLOSC=OFF \
420+
-DUSE_ZLIB=OFF \
413421
-DVCPKG_TARGET_TRIPLET=${VCPKG_DEFAULT_TRIPLET}
414422
-DCMAKE_TOOLCHAIN_FILE=\"${VCPKG_INSTALLATION_ROOT}\\scripts\\buildsystems\\vcpkg.cmake\"
415423
-DMSVC_COMPRESS_PDB=ON
416-
-DOPENVDB_AX_TEST_CMD_DOWNLOADS=ON
424+
-DOPENVDB_AX_TEST_CMD_DOWNLOADS=OFF
417425
-DUSE_EXPLICIT_INSTANTIATION=OFF
418426
-DLLVM_DIR=\"${HOME}\\llvm_install\\lib\\cmake\\llvm\"
419427
-DCMAKE_INSTALL_PREFIX=\"${VDB_INSTALL_PREFIX}\"

ci/build.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ declare -A COMPONENTS
5151
COMPONENTS['core']='OPENVDB_BUILD_CORE'
5252
COMPONENTS['python']='OPENVDB_BUILD_PYTHON_MODULE'
5353
COMPONENTS['test']='OPENVDB_BUILD_UNITTESTS'
54-
COMPONENTS['bin']='OPENVDB_BUILD_BINARIES'
54+
# @todo split out vdb tool from this...
55+
COMPONENTS['bin']='OPENVDB_BUILD_VDB_PRINT,OPENVDB_BUILD_VDB_LOD,OPENVDB_BUILD_VDB_TOOL,OPENVDB_BUILD_VDB_TOOL_UNITTESTS'
5556
COMPONENTS['view']='OPENVDB_BUILD_VDB_VIEW'
5657
COMPONENTS['render']='OPENVDB_BUILD_VDB_RENDER'
5758
COMPONENTS['hou']='OPENVDB_BUILD_HOUDINI_PLUGIN'
@@ -150,7 +151,11 @@ for comp in "${!COMPONENTS[@]}"; do
150151
setting="ON"; break
151152
fi
152153
done
153-
CMAKE_EXTRA+=("-D${COMPONENTS[$comp]}=$setting")
154+
OPENVDB_TOGGLES="${COMPONENTS[$comp]}"
155+
OPENVDB_TOGGLES=(${OPENVDB_TOGGLES//,/ })
156+
for toggle in "${!OPENVDB_TOGGLES[@]}"; do
157+
CMAKE_EXTRA+=("-D${OPENVDB_TOGGLES[$toggle]}=$setting")
158+
done
154159
done
155160

156161
################################################
@@ -182,17 +187,14 @@ cd ${BUILD_DIR}
182187
set -x
183188

184189
# Note:
185-
# - print and lod binary options are always on and can be toggles with: OPENVDB_BUILD_BINARIES=ON/OFF
190+
# - OPENVDB_BUILD_BINARIES is always ON, but each binary will be toggled depending on the provided comps
186191
# - always enabled the python tests with OPENVDB_BUILD_PYTHON_UNITTESTS if the python module is in use,
187192
# regardless of the 'test' component being enabled or not (see the OPENVDB_BUILD_PYTHON_UNITTESTS option).
188193
cmake \
189194
-DOPENVDB_USE_DEPRECATED_ABI_10=ON \
190195
-DOPENVDB_USE_DEPRECATED_ABI_11=ON \
191-
-DOPENVDB_BUILD_VDB_PRINT=ON \
192-
-DOPENVDB_BUILD_VDB_LOD=ON \
193-
-DOPENVDB_BUILD_VDB_TOOL=ON \
194-
-DOPENVDB_BUILD_VDB_TOOL_UNITTESTS=ON \
195196
-DOPENVDB_TOOL_USE_NANO=OFF \
197+
-DOPENVDB_BUILD_BINARIES=ON \
196198
-DOPENVDB_BUILD_PYTHON_UNITTESTS=ON \
197199
-DMSVC_MP_THREAD_COUNT=${PARMS[-j]} \
198200
"${CMAKE_EXTRA[@]}" \

ci/install_llvm_windows.sh

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,55 @@
44

55
set -ex
66

7-
LLVM_CRT="$1"
8-
9-
git clone -b llvmorg-14.0.0 --depth 1 https://github.com/llvm/llvm-project.git llvm
7+
LLVM_VER="$1"
8+
LLVM_CRT="$2"
9+
10+
# Legacy define for older versions of LLVM
11+
LLVM_LEGACY_CRT_DEFINE=""
12+
if [[ "${LLVM_CRT}" == "MultiThreaded" ]]; then
13+
LLVM_LEGACY_CRT_DEFINE="MT"
14+
elif [[ "${LLVM_CRT}" == "MultiThreadedDebug" ]]; then
15+
LLVM_LEGACY_CRT_DEFINE="MTd"
16+
elif [[ "${LLVM_CRT}" == "MultiThreadedDLL" ]]; then
17+
LLVM_LEGACY_CRT_DEFINE="MD"
18+
elif [[ "${LLVM_CRT}" == "MultiThreadedDebugDLL" ]]; then
19+
LLVM_LEGACY_CRT_DEFINE="MDd"
20+
fi
21+
22+
git clone -b llvmorg-${LLVM_VER} --depth 1 https://github.com/llvm/llvm-project.git llvm
1023
cd llvm
1124

1225
mkdir .build
1326
cd .build
1427

15-
# @note currently only test static builds with MT
1628
cmake -B . -S ../llvm -A x64 -G "Visual Studio 17 2022" -Thost=x64 \
1729
-DCMAKE_INSTALL_PREFIX="${HOME}/llvm_install" \
30+
-DCMAKE_BUILD_TYPE=Release \
31+
-DLLVM_ENABLE_ASSERTIONS=OFF \
32+
-DLLVM_ENABLE_PROJECTS="" \
33+
-DLLVM_ENABLE_RUNTIMES="" \
34+
-DLLVM_ENABLE_UNWIND_TABLES=OFF \
1835
-DLLVM_TARGETS_TO_BUILD="host" \
19-
-DLLVM_BUILD_TOOLS=OFF \
2036
-DLLVM_INCLUDE_BENCHMARKS=OFF \
2137
-DLLVM_INCLUDE_EXAMPLES=OFF \
2238
-DLLVM_INCLUDE_TESTS=OFF \
39+
-DLLVM_INCLUDE_DOCS=OFF \
2340
-DLLVM_INCLUDE_TOOLS=OFF \
24-
-DLLVM_USE_CRT_RELEASE=${LLVM_CRT}
25-
26-
cmake --build . --config Release --target install
41+
-DLLVM_INCLUDE_UTILS=OFF \
42+
-DLLVM_BUILD_BENCHMARKS=OFF \
43+
-DLLVM_BUILD_EXAMPLES=OFF \
44+
-DLLVM_BUILD_TESTS=OFF \
45+
-DLLVM_BUILD_DOCS=OFF \
46+
-DLLVM_BUILD_TOOLS=OFF \
47+
-DLLVM_BUILD_UTILS=OFF \
48+
-DLLVM_ENABLE_BINDINGS=OFF \
49+
-DLLVM_ENABLE_OCAMLDOC=OFF \
50+
-DLLVM_PARALLEL_COMPILE_JOBS=4 \
51+
-DLLVM_PARALLEL_LINK_JOBS=4 \
52+
-DCMAKE_MSVC_RUNTIME_LIBRARY=${LLVM_CRT} \
53+
-DLLVM_USE_CRT_RELEASE=${LLVM_LEGACY_CRT_DEFINE}
54+
55+
cmake --build . --parallel 4 --config Release --target install
2756

2857
cd ..
2958

cmake/config/OpenVDBVersions.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ if(NOT DISABLE_DEPENDENCY_VERSION_CHECKS)
4848
set(MINIMUM_OPENEXR_VERSION 3.1)
4949
set(MINIMUM_ZLIB_VERSION 1.2.7)
5050
set(MINIMUM_TBB_VERSION 2020.3)
51-
set(MINIMUM_LLVM_VERSION 13.0.0)
51+
set(MINIMUM_LLVM_VERSION 15.0.0)
5252
set(MINIMUM_BLOSC_VERSION 1.17.0)
5353
set(MINIMUM_GLFW_VERSION 3.1)
5454

@@ -85,4 +85,4 @@ set(FUTURE_MINIMUM_LOG4CPLUS_VERSION 2.0)
8585
set(FUTURE_MINIMUM_PYTHON_VERSION 3.11)
8686
set(FUTURE_MINIMUM_NUMPY_VERSION 1.26.0)
8787
# set(FUTURE_MINIMUM_HOUDINI_VERSION 20.0)
88-
set(FUTURE_MINIMUM_LLVM_VERSION 15.0.0)
88+
set(FUTURE_MINIMUM_LLVM_VERSION 18.0.0)

doc/dependencies.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ OpenEXR | 3.1 | Latest | EXR serialization support
6666
TBB | 2020.3 | 2020.3 | Threading Building Blocks - template library for task parallelism | Y | Y | https://www.threadingbuildingblocks.org
6767
ZLIB | 1.2.7 | Latest | Compression library for disk serialization compression | Y | Y | https://www.zlib.net
6868
Boost | 1.80 | 1.82 | Components: iostreams | Y | Y | https://www.boost.org
69-
LLVM | 13.0.0 | 15.0.0* | Target-independent code generation | Y | Y | https://llvm.org/
69+
LLVM | 15.0.0* | 18.0.0 | Target-independent code generation | Y | Y | https://llvm.org/
7070
Bison | 3.7.0 | 3.7.0 | General-purpose parser generator | Y | Y | https://www.gnu.org/software/gcc
7171
Flex | 2.6.4 | 2.6.4 | Fast lexical analyzer generator | Y | Y | https://github.com/westes/flex
7272
Python | 3.10 | 3.11 | The python interpreter and libraries | Y | Y | https://www.python.org
@@ -87,10 +87,9 @@ Doxygen | 1.8.8 | 1.8.11 | Documentation generation from C++
8787

8888
@subsection depKnownIssues Known Issues
8989

90-
- @b LLVM >= 15. LLVM has recently changed their IR pointer data types to be
91-
completely opaque. Some support is provided in LLVM 15 but tests with AX show
92-
that this is extremely unstable. AX currently only supports LLVM versions up
93-
until 14.X.X. See https://llvm.org/docs/OpaquePointers.html for more details.
90+
- @b On Linux, LLVM == 17 has symbol issues which makes it incompatible when
91+
used with the OpenVDB Python plugin. LLVM versions greater than 18 should be
92+
preferred.
9493

9594
- @b GLFW: Crash with GLFW 3.2.1 when used with EGL on Linux. OpenVDB View may
9695
segfault on closure. Fixed in GLFW 3.3

openvdb/openvdb/python/CMakeLists.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ include(GNUInstallDirs)
1515
###### OpenVDB Python Options
1616

1717
option(USE_NUMPY "Build the python library with numpy support." OFF)
18+
option(OPENVDB_PYTHON_USE_AX [=[
19+
Build the python library with AX support. Defaults to ON when OpenVDB AX is enabled."]=] ${USE_AX})
1820
option(OPENVDB_PYTHON_WRAP_ALL_GRID_TYPES [=[
1921
Expose (almost) all of the grid types in the python module. Otherwise, only FloatGrid, BoolGrid and
2022
Vec3SGrid will be exposed (see, e.g., exportIntGrid() in python/pyIntGrid.cc). Compiling the Python
@@ -39,7 +41,15 @@ else()
3941
set(OPENVDB_LIB openvdb)
4042
endif()
4143

42-
if(USE_AX)
44+
if(OPENVDB_PYTHON_USE_AX)
45+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
46+
get_property(OPENVDB_LLVM_VERSION_MAJOR GLOBAL PROPERTY "OPENVDB_LLVM_VERSION_MAJOR")
47+
if(OPENVDB_LLVM_VERSION_MAJOR VERSION_EQUAL 17)
48+
message(FATAL_ERROR "LLVM version 17.X, used with OpenVDB AX, is incompatible "
49+
"with the OpenVDB python plugin. Use any version of LLVM 18+")
50+
endif()
51+
endif()
52+
4353
# Link the python module against openvdb_ax
4454
if(NOT OPENVDB_BUILD_AX)
4555
find_package(OpenVDB REQUIRED openvdb_ax)
@@ -69,7 +79,7 @@ endif()
6979
if(USE_NUMPY)
7080
target_compile_definitions(openvdb_python PUBLIC "-DPY_OPENVDB_USE_NUMPY")
7181
endif()
72-
if(USE_AX)
82+
if(OPENVDB_PYTHON_USE_AX)
7383
target_link_libraries(openvdb_python PUBLIC ${OPENVDB_AX_LIB})
7484
target_compile_definitions(openvdb_python PUBLIC "-DPY_OPENVDB_USE_AX")
7585
endif()
@@ -95,7 +105,7 @@ if(OPENVDB_BUILD_PYTHON_UNITTESTS)
95105
WORKING_DIRECTORY "${OPENVDB_PYTHON_WORKING_DIR}")
96106

97107
set(OPENVDB_PYTHON_TEST_ENV "")
98-
if(USE_AX)
108+
if(OPENVDB_PYTHON_USE_AX)
99109
list(APPEND OPENVDB_PYTHON_TEST_ENV "OPENVDB_TEST_PYTHON_AX=1")
100110
endif()
101111

0 commit comments

Comments
 (0)