[CUDA] Swap block x and z dimension for conv2d NHWC schedule #9087
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.
In the cuda conv2d NHWC schedule, the number of blocks launched in the Z dimension is (roughly, modulo constant divisor)
H * W / 4
. According todeviceQuery
, the max grid z dimension is 65536:When H and W are large, it is very likely to generate an invalid schedule, because we try to launch too many blocks in the Z dimension. For example, here is an error that I hit when the input size is (800, 750). I cannot avoid this error even after auto tuning, since the block z size stays fixed during tuning. Without the change in this PR, I cannot ever run this model unless I use the auto scheduler.
My solution is simply to swap the use of block x and z dimension, since we can launch far more blocks in the x dim as
deviceQuery
shows above.cc @vinx13 @junrushao1994 @Hzfengsy