Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions jaxlib/gpu/rnn_kernels.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ DoRnnComputeWorkspaceReserveSpaceSizes(int input_size, int hidden_size,
JAX_RETURN_IF_ERROR(
JAX_AS_STATUS(gpudnnDestroyRNNDataDescriptor(input_data_desc)));
JAX_RETURN_IF_ERROR(JAX_AS_STATUS(gpudnnDestroyRNNDescriptor(rnn_desc)));
#ifdef JAX_GPU_HIP
JAX_RETURN_IF_ERROR(JAX_AS_STATUS(gpuFree(dropout_states_dev)));
#endif

// Round up to nearest multiples of 4 so we can return them as f32 arrays.
workSpaceSize += (workSpaceSize % 4);
Expand Down Expand Up @@ -351,6 +354,9 @@ static absl::Status DnnRNNForward_(gpuStream_t stream, void** buffers,
JAX_RETURN_IF_ERROR(
JAX_AS_STATUS(gpudnnDestroyDropoutDescriptor(dropout_desc)));
JAX_RETURN_IF_ERROR(JAX_AS_STATUS(gpudnnDestroyRNNDescriptor(rnn_desc)));
#ifdef JAX_GPU_HIP
JAX_RETURN_IF_ERROR(JAX_AS_STATUS(gpuFree(dropout_states_dev)));
#endif

return absl::OkStatus();
}
Expand Down Expand Up @@ -536,6 +542,9 @@ static absl::Status DnnRNNBackward_(gpuStream_t stream, void** buffers,
JAX_RETURN_IF_ERROR(
JAX_AS_STATUS(gpudnnDestroyDropoutDescriptor(dropout_desc)));
JAX_RETURN_IF_ERROR(JAX_AS_STATUS(gpudnnDestroyRNNDescriptor(rnn_desc)));
#ifdef JAX_GPU_HIP
JAX_RETURN_IF_ERROR(JAX_AS_STATUS(gpuFree(dropout_states_dev)));
#endif

return absl::OkStatus();
}
Expand Down
1 change: 1 addition & 0 deletions jaxlib/gpu/vendor.h
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,7 @@ inline hipsparseStatus_t gpusparseCreate(gpusparseHandle_t* handle) {
#define GPU_STREAM_NON_BLOCKING hipStreamNonBlocking

#define gpuMalloc hipMalloc
#define gpuFree hipFree
#define gpuGetLastError hipExtGetLastError
#define gpuGetErrorString hipGetErrorString
#define gpuMemcpyAsync hipMemcpyAsync
Expand Down