ptrendx commented on a change in pull request #19209:
URL: https://github.com/apache/incubator-mxnet/pull/19209#discussion_r492986716
##########
File path: src/resource.cc
##########
@@ -428,37 +486,28 @@ void* Resource::get_host_space_internal(size_t size)
const {
void Resource::get_cudnn_dropout_desc(
cudnnDropoutDescriptor_t *dropout_desc,
mshadow::Stream<gpu> *stream,
- const float dropout, uint64_t seed,
+ const float dropout,
const std::string &name) const {
CHECK_EQ(req.type, ResourceRequest::kCuDNNDropoutDesc);
auto state_space = static_cast<resource::SpaceAllocator*>(ptr_);
CHECK_EQ(state_space->ctx.dev_id, stream->dev_id)
- << "The device id of cuDNN dropout state space doesn't match that from
stream.";
- CUDNN_CALL(cudnnCreateDropoutDescriptor(dropout_desc));
+ << "The device id of cudnn dropout state space doesn't match that from
stream.";
if (dropout <= 0) {
CUDNN_CALL(cudnnSetDropoutDescriptor(*dropout_desc, stream->dnn_handle_,
dropout,
nullptr,
0, seed));
- } else if (!state_space->handle.size) {
- // not initialized yet.
- size_t dropout_state_size;
- CUDNN_CALL(cudnnDropoutGetStatesSize(stream->dnn_handle_,
&dropout_state_size));
- // reserve GPU space
- Storage::Get()->DirectFree(Storage::Get()->Alloc(dropout_state_size,
state_space->ctx));
- CUDNN_CALL(cudnnSetDropoutDescriptor(*dropout_desc, stream->dnn_handle_,
- dropout,
-
state_space->GetSpace(dropout_state_size, name),
- dropout_state_size, seed));
} else {
+ CHECK(state_space->handle.size > 0)
+ << "CUDNN dropout descriptor was not initialized yet!";
// cudnnRestoreDropoutDescriptor() introduced with cuDNN v7
STATIC_ASSERT_CUDNN_VERSION_GE(7000);
CUDNN_CALL(cudnnRestoreDropoutDescriptor(*dropout_desc,
stream->dnn_handle_,
dropout,
state_space->handle.dptr,
state_space->handle.size,
- seed));
+ 0));
Review comment:
It does not matter. From cuDNN API reference:
```
seed
Input. Seed used in prior call to cudnnSetDropoutDescriptor() that
initialized states buffer. Using a different seed from this has no effect. A
change of seed, and subsequent update to random number generator states can be
achieved by calling cudnnSetDropoutDescriptor().
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]