Repository navigation
ci(cuda): install swig from cvcpkg in the linux CUDA job - #311
Merged
Merged
Conversation
The pycvc-cp311-cuda and pycvc-gl-cp311-cuda steps both died at configure with
Could NOT find SWIG (missing: SWIG_EXECUTABLE SWIG_DIR python)
taking the only CUDA-enabled Python columns down with them. libcvc-cuda and
cvcgl-cuda publish earlier in the same job, so the GPU C++ SDK shipped while the
GPU bindings did not — the failure looked like a CUDA problem and is not one.
swig now comes from the catalog: `cvcpkg install swig`, the same host_tool both
recipes already declare. fetch-libcvc-deps installs build+runtime deps only
("host_tools excluded — CI provides cmake/ninja"), which holds for the
GitHub-hosted images but not for this bare nvidia/cuda container, and the runner
host's swig is invisible from inside it. Taking it from the catalog rather than
the image keeps the toolchain hermetic and pinned by the same lockfile as
everything else.
SWIG_LIB is mandatory, not defensive: the packaged swig binary has the builder's
temp path baked in — `swig -swiglib` reports /tmp/cvcpkg-builder/... — so without
it every invocation fails with "Unable to find 'swig.swg'". Verified locally
against the published package: bare invocation fails exactly that way, and
succeeds with SWIG_LIB pointed at the installed share/swig/<version>. That
relocation bug is worth fixing in the swig recipe separately; this pins it here
so the lane can go green.
Note the catalog's swig is 4.4.1 while the CPU lanes use the GitHub image's
4.0.x. Both CUDA python columns are generated in this one job, so they stay
consistent with each other and with the pycvc-gl-cp311-cuda they ship beside —
which is the pairing that matters, since modules sharing a SWIG runtime must be
generated by the same series. Making the CPU lanes hermetic the same way is the
obvious follow-up, but it touches currently-green lanes and belongs in its own
change.
transfix
force-pushed
the
fix/cuda-container-swig
branch
from
September 2, 2026 21:43
a5492e0 to
5020745
Compare
transfix
added a commit
that referenced
this pull request
Nov 24, 2026
…es (#1474) ## Why In cvcdbg's demo3 (Humvees on the Austin city), Firefox misses a refresh on 5.7–8.3% of frames. The cost is the shadow bake. Since CVC-DBG/cvcdbg#311 the map is re-baked every frame a vehicle moves (a stale map let a Humvee drive into its own shadow), and each bake re-drew every caster from the sun, the city included. The bake did not get cheaper at 2048, so it is the draws, not the map's size. ## What `StridedShadowBaker` now bakes the static casters apart from the moving ones (`SceneGraph::setShadowStaticCache`, on by default). - **Sorting.** A caster that changed (moved, deformed, restyled) within the last 60 checks, or appeared since the last whole bake, is **moving**. The rest are **static**. - **Whole bake.** Draws the static casters into the maps the lookup reads. It keeps aside their colour and depth where the moving casters are about to be drawn (a save-under, in a saved map), then draws the moving casters over them, depth-tested. The maps hold exactly what one draw of every caster would, for the old bake's cost plus small copies. - **Moving-only bake** (only moving casters changed). Puts back the texels it kept aside where the moving casters were, keeps aside those under their new places, and draws them there, with the last whole bake's light cameras. - Footprints are each caster's bounds through the light camera, plus two texels. - Rectangles merge where one rectangle around two covers at most twice what they do (a convoy becomes one or two); past 16 they become one. - A vehicle's shadow is redrawn in the frame it moves, so there is no lag and no stale self-shadow. - **What makes a bake whole**, and re-sorts the casters: - a light changes; - the focus moves 2% of its radius (unchanged); - a static caster changes or leaves; - a moving one leaves the bounds the light cameras were fitted to; - `invalidateShadowBake()`, or a resolution change; - several moving casters have stopped and are most of the moving set (they become static). - **When the cache is not used:** with a casting camera light (VTK moves it with the view), under VTK's compositing z pass, or until both kinds of caster are present. Then the bake is as before, and no second set of maps is made. - **Only 3-D props are casters now.** A HUD's text or image actor never drew into the maps, but a changing one used to force a bake. - **Supporting changes:** - `ShadowCasterFilterPass` gains `Preserve`: the bake's camera pass without its clear, optionally scissored. - The baker's `ReleaseGraphicsResources` frees the static maps too, and makes the next frame bake. - Switching the cache off frees the static maps. - `SceneGraph::shadowBakeStats()` reports the bakes, how many were whole, the static and moving casters at the last bake, and the share of the maps it copied and drew into. **Cost:** while both kinds of caster are present, a saved map and depth buffer per casting light at the shadow resolution: +128 MB at 4096 for one light, +8 MB at 1024. With several casting lights, each also gets a depth buffer of its own. ## Measured **Native, synthetic, demo3's caster mix.** On the GTX 1650, Release, vsync off, 1600×900, map 4096 focused, with the low-memory mapper forced as on WebGL and in demo3's fast draw path. The mix is: - one 980k-triangle static mesh; - 6 movers of 7k triangles and 24 of 290, all moved every frame. Render plus `glFinish` per frame, cache on and off in interleaved blocks, two runs: | | Run 1 | Run 2 | |---|---|---| | cache off | 14.23 ms | 14.33 ms | | cache on | 10.19 ms | 10.18 ms | | shadows off | 4.07 ms | 4.12 ms | **In demo3 and demo3-ari themselves** (native, follow camera, `--capture-live`, 300 frames): | | static casters | moving casters | whole bakes | map share of a moving-only bake | |---|---|---|---|---| | demo3 | 3 (the city, 978k cells) | 30 (6 Humvees + 24 wheels) | 95 of 540 (18%) | 0.11% | | demo3-ari | 4 | 13 | 96 of 1080 (9%) | 0.12% | The remaining whole bakes come from the shadow focus following the chase camera (2% of its radius). Native wall-clock frame times of the demos were too noisy on this shared box to compare (load 30–200, the GPU shared with other sessions). **Browser.** cvcdbg main (#316, JSPI and wasm exceptions) built for wasm-mt against this branch. Cache on and off are the same build: a local, uncommitted `--no-static-cache` flag sets `setShadowStaticCache(false)`. Headless Firefox 158 and Chromium 145 on the GTX 1650, 1600×900, `?prof&flags=follow`, map 4096. Each run is 150 s with the first 40 s dropped, runs interleaved, box load 15–25. | | frames over 20 ms, cache off | frames over 20 ms, cache on | render, off → on | |---|---|---|---| | demo3, Firefox (5 runs each) | 1.3% (0.5–2.9) | 2.3% (1.8–3.1) | 10.8 → 10.3 ms | | demo3-ari, Firefox | 7.4% | 2.7% | 10.7 → 7.6 ms | | demo3, Chromium | 0.0% | 0.0% | 8.2 → 7.8 ms | | demo3, Firefox, camera not following (no save-under yet) | 13.3% | 1.8% | 14.5 → 13.5 ms | Before the save-under (`d2f1ecce9`), a whole bake copied the whole map, and demo3 in Firefox missed 4.7–5.6% against 1.5–2.0%. With the save-under, a whole bake costs no more than before. In demo3 with the follow camera, Firefox still misses about a point more with the cache. Its CPU per frame is lower, so that point most likely comes from the 6% of bakes that are still whole, now drawn in two passes. WebGL calls per frame (`?glcount`, Chromium) fall only 2–6% (demo3 3,160 → 3,086). The 30 moving vehicle parts still make about 1,500 calls per bake, and that is Firefox's remaining shadow cost. ## Tests - **New `cvcgl_shadow_static_cache`.** Two scenes alike in every way, one cached, one not. Every frame both make the same change, and every frame's picture must be the same, byte for byte (on Apple's GL, within 2 levels). - A vehicle drives through a building's shadow for 38 frames: - each frame matches the reference and differs from the frame before; - its shadow is on the ground beside it in the frame it moved to; - the building's shadow is on its roof; - after the first bakes, every bake draws only the vehicle, over 0.12% of the map (0 whole). - These each give the reference picture, and a whole bake where expected: a building moved, hidden and shown; the moving vehicle hidden and shown; a car hidden and shown; the sun turned; a caster added; the focus set, moved and cleared. - Cars that stop become static in one whole bake, once they are most of the moving set. - With the cache off, every bake is whole and nothing is cached. - At interval 2, the bakes stride as before, and stale frames match too. - **The new test fails, as it should, on three broken builds:** - the blit without depth: 14 of 38 frames match; - no redraw of the moving casters (#311's stale map): 1 of 38 frames match; - the copy forgetting where the casters were: the interval-2 frames don't match. - **`cvcgl_shadow_pass_reuse` F.** A moving box adds exactly one texture, framebuffer and renderbuffer. A resolution change re-makes them, and the cache off or shadows off frees them. No VTK errors. - **`cvcgl_shadow_pass_programs` A.** Only the mover switches pass sets now, twice a frame. The static casters stay on the view's. - Locally (Linux, GTX 1650, `CVC_REQUIRE_RENDER=1`), all pass: - `cvcgl_shadow_static_cache`, `cvcgl_shadow_casters`, `cvcgl_shadow_pass_reuse`, `cvcgl_shadow_pass_programs`; - `cvcgl_city_sun_shadows`, `cvcgl_shadow_caster_growth`, `cvcgl_shadow_volume`; - `cvcgl_lod_node`, `cvcgl_texture_rows`, `cvcgl_ariadne_scenes`, `cvcgl_room_view`, `cvcgl_multi_app`. ## Not in this PR - The web demos get this only through a libcvc release and a cvcdbg pin. No release is cut here; the 4.0.6 tag is tracked separately. - With a moving shadow focus, demo3 still makes a whole bake every 2% of the focus radius it travels: 6% of its bakes in the browser. - Firefox's remaining cost is per WebGL call: the moving casters' draws in the bake, at about 50 calls each. Fewer or leaner bake draws for them would be the next step.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
pycvc-cp311-cudaandpycvc-gl-cp311-cudasteps both died at configure withtaking the only CUDA-enabled Python columns down with them.
libcvc-cudaandcvcgl-cudapublish earlier in the same job, so the GPU C++ SDK shipped while the GPU bindings did not — the failure looked like a CUDA problem and is not one.Why
This job deliberately builds inside
nvidia/cuda:12.9.1-devel-ubuntu22.04to pin the glibc floor, and that image is a bare toolkit — the step already apt-installsbuild-essential git curl python3 …for exactly this reason.swigwas simply missing from the list.The CPU lanes never noticed: the GitHub-hosted
ubuntu-22.04image ships swig, and the runner host's swig (prettyhatemachine has 4.2.0 on PATH) is invisible from inside the container. That asymmetry is why this survived every previous run — and it only became visible at all once av*tag forced the CUDA lanes on, sincepublish_cudadefaults tofalseon a dispatch.Version note
22.04's swig is the same 4.0.x series the CPU lanes build with, so the generated wrappers and the SWIG runtime stay consistent across the pycvc family — which matters here, since a pycvc built against one SWIG runtime cannot be mixed with modules built against another.
One line of actual change. Second of the two CUDA-lane fixes, alongside #310 (Windows).