Speed up --verify-numerics sample generation for half-precision convs#1314
Merged
rkayaith merged 1 commit intoiree-org:mainfrom Feb 27, 2026
Merged
Speed up --verify-numerics sample generation for half-precision convs#1314rkayaith merged 1 commit intoiree-org:mainfrom
rkayaith merged 1 commit intoiree-org:mainfrom
Conversation
torch.randn on CPU is much slower for half-precision dtypes than on GPU. Generate sample data on GPU and transfer to CPU for the reference computation instead of the other way around. Tested on convfp16 -n 32 -c 256 -H 100 -W 100 -k 2376 -y 3 -x 3 -F 4 (NHWC, weight backward): total runtime dropped from 45.9s to 16.2s with --verify-numerics (8.3s without). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
zjgarvey
approved these changes
Feb 27, 2026
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.
torch.randnon CPU is much slower for half-precision dtypes than on GPU. For a large conv config (convfp16 -n 32 -c 256 -H 100 -W 100 -k 2376 -y 3 -x 3 -p 1 -q 1 -u 1 -v 1 -l 1 -j 1 --in_layout NHWC --fil_layout NHWC --out_layout NHWC -m conv -g 1 -F 4 -t 1), sample generation was taking 18.3s of 25.1s total verification time.Generate sample data on GPU and transfer to CPU for the reference computation instead of the other way around. Total runtime dropped from 45.9s to 16.2s with
--verify-numerics(8.3s without) on a 96-core EPYC 9454.