DepthMap on AMD Radeon via HIP: RDNA1/2/4 validated against the CUDA output (bit-identical between RDNA1 and RDNA2), packaged for Windows and Linux #2175
dspl1236
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hello AliceVision folks. I have the CUDA depth-map backend running on AMD GPUs through HIP, without touching the CUDA sources, and I would like to know how you would want any of it back.
What it is. A CUDA-to-HIP compatibility header (
cuda_runtime.hshim plus a macro/ inline map) that letssrc/aliceVision/depthMap/cuda/*compile unchanged as HIP, a small CMake addition (ALICEVISION_USE_HIP, device sources as one unity translation unit because-fgpu-rdcis broken on Windows ROCm), and a patch set on top of a pinned upstream submodule (2cb1a39). Repo: https://github.com/dspl1236/cheshire (MPL-2.0, same as AliceVision).Validation. Same photos, same SfM, same DepthMap parameters as Meshroom 2023.3 on a GTX 1080 Ti; only the GPU stage differs. Per view over jointly valid pixels:
RDNA1 and RDNA2 are bit-identical to each other; the remaining 1-3 % of pixels differing by more than 1 % against CUDA behave like texture-filter and FMA rounding, not a port defect. A Meshroom 2023.3 job (41 photos,
standardpreset) ran end to end on the RX 6750 XT with the DepthMap node swapped for the HIP binary, 352 s for the stage against the CUDA job's 379 s on the same node; the mesh is within 1 % of the CUDA job's vertex count. Per-view tables and side-by-side panels are indocs/validation/; the median view of the 41-view set (CUDA | HIP on the RX 9070 | absolute difference):Things you may want regardless of HIP:
DepthMapEstimator::getNbSimultaneousTilessizes tile parallelism fromcudaMemGetInfo * 0.8. I measured that on two cards, 2 simultaneous tiles run the 6-view set as fast as 24, so a planner that prefers fewer resident tiles over more, spilled ones never loses; and a "never below one tile" fallback (spill that tile's volumes rather than throw "Not enough GPU memory to compute a single tile") lets small cards finish. Mine sits behind a HIP define; happy to make it generic and open a PR if you want it.hip/port/sgm_fused/).surf2Dwriteinto 16-bit float arrays, so the mip chain is computed into a pitched buffer and copied into the level. Harmless on CUDA, and it removes the surface dependency.DepthMapEstimator::compute(the EXR reads were 3 s per R camera on 12 MP inputs).What I am not proposing: replacing the CUDA backend, or a SYCL-style parallel tree. Everything is the existing CUDA source compiled a second way.
Ask. Does a HIP option in the CMake, gated off by default, fit your direction? And does anyone have an RDNA3 card (RX 7000) to run the 6-view cache through the packaged build? The code objects are in every release and nothing has executed them yet.
Edit 2026-09-15: the CUDA 41-view time originally read 105.5 s, which was the first of four Meshroom chunks; corrected to the sum. The HIP times are single invocations over all views.
All reactions