-
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
slice large tensor for cudnn_softmax #43681
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
dim, | ||
dim, | ||
dim_log2); | ||
int64_t remaining = N; |
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.
如果只是支持了cudnn实现,那这些逻辑是不是直接实现在SoftmaxForward/BackwardCudnnKernel
函数里面更好?避免一个函数太长了吧。
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.
在最外层的softmax接口里去掉了这段,切片的逻辑封装了一下。
dim_log2); | ||
int64_t remaining = N; | ||
auto* x_data = x.data<T>(); | ||
int64_t batch_size = INT_MAX / dim; |
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.
INT_MAX -> std::numeric_limits<int32_t>::max()
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
PR types
Bug fixesPR changes
OPsDescribe
slice large tensor for cudnn_softmax背景
cuDNN在tensor元素超过2G时,会出现CUDNN_STATUS_NOT_SUPPORT的错误。本PR在输入size超过2G时,将输入切片,调用多次kernel分别处理切片数据。
性能