[SSD/PyT] Switching data from nchw to nhwc format #1017
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.
Upon profiling the PyTorch Detection/SSD code with resnet50, we noticed a lot of NCHW-NHWC transpose kernels. The changes suggested in this pull request will switch the input data format from NCHW to NHWC to comply with the more efficient memory format on Tensor Cores, and we have observed a ~50% throughput improvement on an A100 80G card.
python ./main.py --backbone resnet50 --warmup 300 --bs 256 --amp --data --epochs 1 --mode benchmark-training --benchmark-iterations 100 --num-workers 1
Before: Total images: 25600 total time: 60.946 Average images/sec: 420.047 Median images/sec: 420.351
After: Total images: 25600 total time: 40.827 Average images/sec: 627.030 Median images/sec: 627.356