-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set Tensor Core MathType in conv using cudnn #34409
Conversation
Update forked PaddlePaddle
Update my fork
update from PaddlePaddle
Update forked paddle repo
Update USERNAME/paddle
update Paddle USERNAME repo
update username repo
update local paddlepaddle
update paddlepaddle
… backward_TensorCore
… backward_TensorCore
Thanks for your contribution! |
#if CUDA_VERSION >= 11000 | ||
#if CUDNN_VERSION_MIN(8, 1, 0) | ||
} else if (dev_ctx.GetComputeCapability() >= 80 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
前向、反向input、反向filter,设置cudnn conv算法的代码逻辑都是一样的,可以封装成一个函数。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done,已封装成一个函数。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
VLOG(5) << "NOT use cudnn_tensor_op_math"; | ||
} | ||
#endif | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个return
是多余的,后续PR中删一下。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
PR types
New features
PR changes
OPs
Describe
功能
当数据类型为bfloat16时,使用Tesnor Core。包括以下3部分:
ConvolutionDescriptor
时,需要指明cudnnSetConvolutionMathType
。该PR添加当dtype 为CUDNN_DATA_BFLOAT16
时,设置MathType为CUDNN_TENSOR_OP_MATH
。PSEUDO_BFLOAT16_CONFIG
时,上述设置MathType的条件应改为if (dtype == CUDNN_DATA_FLOAT && allow_tf32)
。由于满足PSEUDO_BFLOAT16_CONFIG
与否,对性能无影响,故该PR设置MathType的条件是if (dtype == CUDNN_DATA_BFLOAT16)
。CUDNN_DATA_BFLOAT16
时设置MathType为CUDNN_TENSOR_OP_MATH
。CUDNN_DATA_BFLOAT16
时设置MathType为CUDNN_TENSOR_OP_MATH
。对于前向卷积算法的选择、后向data卷积算法选择、后向filter卷积算法选择中的设置convMathType。将三部分封装成了统一的函数。
效果
通过LOG日志发现,当数据类型为bfloat16时,代码执行期望分支。