Repository navigation
Fix empty PatchMatch results on Blackwell GPUs (sm_100+) - #4213
Conversation
Fixes #3514. PatchMatch stereo produces empty/noisy depth maps and all-zero normal maps on Blackwell GPUs (RTX 5070, 5090, B200 — CUDA compute >= 100). The root cause is a known NVCC compiler bug that miscompiles complex kernels when generating native SASS for sm_100+ at -O2/-O3. The same bug affects other projects including ggml-org/llama.cpp#18331, TensorRT-LLM, and CCCL. When Blackwell architectures are detected in CMAKE_CUDA_ARCHITECTURES, the build system now removes sm_100+ entries for the colmap_mvs_cuda target and adds 90-virtual (PTX). Blackwell GPUs JIT-compile the PTX at first launch, bypassing the buggy native codegen path. Detection handles: - Explicit numeric architectures (e.g., 120, 100-real, 89;120) - native / all / all-major — queries nvidia-smi at configure time This workaround can be removed once NVIDIA ships a fixed NVCC. **Trade-offs** - One-time JIT compilation delay on first kernel launch (cached by the CUDA driver afterwards) - JIT'd code may miss some Blackwell-specific scheduling optimizations, though PatchMatch is texture-read bound so the impact should be minimal - Affects all CUDA files in colmap_mvs_cuda, not just patch_match_cuda.cu, since CMake doesn't support per-file CUDA_ARCHITECTURES
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical compilation issue affecting NVIDIA Blackwell GPUs, which caused incorrect output for PatchMatch stereo. By intelligently modifying the CUDA build process to generate PTX instead of native SASS for these specific architectures, it ensures the application functions correctly on the latest hardware, mitigating a significant bug without requiring a compiler fix from NVIDIA. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a workaround for an NVCC compiler bug on Blackwell GPUs by modifying the CUDA architectures at build time. The implementation in CMakeLists.txt has a logic bug in the detection of Blackwell architectures that can lead to incorrect build configurations under certain conditions. I've provided a comment with a suggested fix to make the detection logic more robust. The explanatory comment added to patch_match_cuda.cu is clear and helpful.
Fixes #3514. PatchMatch stereo produces empty/noisy depth maps and all-zero normal maps on Blackwell GPUs (RTX 5070, 5090, B200 — CUDA compute >= 100). The root cause is a known NVCC compiler bug that miscompiles complex kernels when generating native SASS for sm_100+ at -O2/-O3. The same bug affects other projects including ggml-org/llama.cpp#18331, TensorRT-LLM, and CCCL. When Blackwell architectures are detected in CMAKE_CUDA_ARCHITECTURES, the build system now removes sm_100+ entries for the colmap_mvs_cuda target and adds 90-virtual (PTX). Blackwell GPUs JIT-compile the PTX at first launch, bypassing the buggy native codegen path. Detection handles: - Explicit numeric architectures (e.g., 120, 100-real, 89;120) - native / all / all-major — queries nvidia-smi at configure time This workaround can be removed once NVIDIA ships a fixed NVCC. **Trade-offs** - One-time JIT compilation delay on first kernel launch (cached by the CUDA driver afterwards) - JIT'd code may miss some Blackwell-specific scheduling optimizations, though PatchMatch is texture-read bound so the impact should be minimal - Affects all CUDA files in colmap_mvs_cuda, not just patch_match_cuda.cu, since CMake doesn't support per-file CUDA_ARCHITECTURES
Fixes #3514. PatchMatch stereo produces empty/noisy depth maps and all-zero normal maps on Blackwell GPUs (RTX 5070, 5090, B200 — CUDA compute >= 100).
The root cause is a known NVCC compiler bug that miscompiles complex kernels when generating native SASS for sm_100+ at -O2/-O3. The same bug affects other projects including ggml-org/llama.cpp#18331, TensorRT-LLM, and CCCL.
When Blackwell architectures are detected in CMAKE_CUDA_ARCHITECTURES, the build system now removes sm_100+ entries for the colmap_mvs_cuda target and adds 90-virtual (PTX). Blackwell GPUs JIT-compile the PTX at first launch, bypassing the buggy native codegen path.
Detection handles:
This workaround can be removed once NVIDIA ships a fixed NVCC.
Trade-offs