fix FusedResidualDropoutBias nan in v100 #42344
Merged
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.
PR types
Bug fixes
PR changes
Others
Describe
问题定位
在V100上测试千亿ERNIE,发现精度对不齐,具体定位发现
FusedResidualDropoutBias
kernel运算的结果不对。再进一步定位,发现kernel实现没问题,不过在ERNIE千亿场景下,跑fp16启动kernel线程数会设置为1024,由于
FusedResidualDropoutBias
每个线程占用的寄存器数比较多,就出现了如下错误。也就是launch kernel时,block使用的寄存器超过了限制,导致kernel未被launch,最终没有执行。训练精度出现问题
问题解决
先将最大线程数简单设置为512(这个值足够SM使用,理论应该不会影响性能,大部分场景可能256好一些),来规避超出寄存器资源的问题。
当然后续可以对
FusedResidualDropoutBias
优化,减少线程对寄存器的使用。