Commit 33ef7f8
Add hasCudaSupport() runtime probe + Python has_cuda_support() API
Summary:
This is D6 in the GPU-accelerated H.265 decoding stack for projectaria-tools (plan v11 at ~/gdrive/plans/2026-04-03-gpu-accelerated-h265-decoding-pat-v11.md, tech design at https://docs.google.com/document/d/1TMeLy0TqvAdlYo0IY3Qm4BrzE8i035z9MzYvGl_CzeM/edit by Lou Yang).
Adds the user-facing `projectaria_tools.has_cuda_support()` API specified in the tech design. The Python helper lets users branch on GPU availability without crashing or guessing — typical use is picking a batch size, warning users about CPU fallback, or reporting environment info.
Five files, bottom-up through the layers:
1. `arvr/projects/compression/xprs/xprs.h` — declares `bool hasCudaSupport()` with docstring explaining the runtime semantics.
2. `arvr/projects/compression/xprs/xprsDecApi.cpp` — implementation. Under `XPRS_HAS_NVDEC` it calls `NvCodecContextProvider::getNvCodecContext()` inside a try/catch and returns true iff init succeeds. Under no-NVDEC builds it returns false unconditionally. The first call drives the actual CUDA bring-up; subsequent calls hit the tri-state-atomic cache added in D3 (single atomic load on the fast path, no mutex contention).
3. `arvr/projects/ariane/aria_research_kit/projectaria_tools/core/python/XprsPyBind.h` — exports `has_cuda_support` on the existing xprs submodule with a Python-style docstring.
4. `arvr/projects/ariane/aria_research_kit/projectaria_tools/projectaria_tools/core/__init__.py` — adds `xprs` to the `from . import (...)` block. Without this, the convenience wrapper at the top-level `__init__.py` would raise `AttributeError: module 'projectaria_tools.core' has no attribute 'xprs'` because the `xprs` submodule wouldn't be imported into the `core` namespace. Discovered while testing the end-to-end Python invocation (see test plan item 6).
5. `arvr/projects/ariane/aria_research_kit/projectaria_tools/projectaria_tools/__init__.py` — re-exports as `projectaria_tools.has_cuda_support()` so users get the documented top-level API per the tech design.
Reviewed By: PiotrBrzyski
Differential Revision: D103253729
fbshipit-source-id: ea7320c561efcb504b8de51703fcf5380b2935f41 parent 560d061 commit 33ef7f8
3 files changed
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
146 | 163 | | |
147 | 164 | | |
148 | 165 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
0 commit comments