Skip to content

Disable in-place sorting on ROCm. #237

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

Merged
merged 2 commits into from
Oct 3, 2018
Merged
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
5 changes: 5 additions & 0 deletions aten/src/THC/generic/THCTensorSort.cu
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,12 @@ void THCTensor_(sort)(THCState* state,
int maxSliceSize = 2048;
#endif

#ifdef __HIP_PLATFORM_HCC__
// TODO bitonicSortKVInPlace hangs on ROCm currently.
if (0) {
#else
if (sliceSize <= maxSliceSize) {
#endif
// Fill `indices` (the values) with the
// slice-relative index.
THCudaLongTensor_fillSliceWithIndex(state, indices, dim);
Expand Down
5 changes: 5 additions & 0 deletions aten/src/THC/generic/THCTensorTopK.cu
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ void THCTensor_(topk)(THCState* state,
if (sorted) {
// FIXME: the k/v inplace sort along slice only works for size <=
// 2048 at the moment
#ifdef __HIP_PLATFORM_HCC__
// TODO bitonicSortKVInPlace hangs on ROCm currently.
if (0) {
#else
if (sliceSize <= 2048) {
#endif
// This avoids any memory allocations and performs all sorting
// work inplace along the slice
THCTensor_(sortKeyValueInplace)(state, topK, indices, dim, dir);
Expand Down
1 change: 1 addition & 0 deletions test/test_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -6572,6 +6572,7 @@ def test_tensor_shape_empty(self):
self.assertEqual([(0, 1, 3, 0)], [z.shape for z in torch.split(x, 0, dim=0)])

# functions that operate over a dimension but don't reduce.
@skipIfRocm
def test_dim_function_empty(self):
devices = ['cpu'] if not torch.cuda.is_available() else ['cpu', 'cuda']
for device in devices:
Expand Down