Skip to content

Don't format a tensor to build the autocast flag - #155

Open
PavelGuzenfeld wants to merge 1 commit into
Parskatt:mainfrom
PavelGuzenfeld:fewer-host-syncs
Open

PavelGuzenfeld wants to merge 1 commit into
Parskatt:mainfrom
PavelGuzenfeld:fewer-host-syncs

Conversation

@PavelGuzenfeld

Copy link
Copy Markdown

str(f1_s) == "cuda" in Decoder.forward formats the whole feature tensor on every proj call, and that syncs the device. The value never matters: get_autocast_params overwrites enabled on both branches (True for cuda, False otherwise). Passing True gives the same result without the print.

Output is bitwise identical to main. torch.equal on warp and certainty for the toronto and sacre_coeur demo pairs, fused-local-corr on and off.

Timing on an RTX 3060 laptop, torch 2.11, match() on the toronto pair, 30 runs after a 60 s warmup, main and this branch alternated in separate processes three times. With fused-local-corr: 959, 968, 974 ms on main vs 929, 919, 922 ms here. Without it: 1093 vs 1051 ms. So about 3-5%, only measured on that one GPU.

get_autocast_params overwrites enabled for cuda and non-cuda alike, so str(f1_s) == "cuda" never mattered. It formatted the feature tensor and synced the device on every proj call.
@PavelGuzenfeld

Copy link
Copy Markdown
Author

Also measured on a Jetson Orin (JetPack 6.2, torch 2.4.0, no fused-local-corr there so use_custom_corr=False). main took 4693 and 4699 ms, this branch 3856 and 3856 ms, about 18% less. Same two demo pairs, output bitwise identical again. Main and the branch alternated in separate processes, twice, 10 runs each after a 60 s warmup.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant